Skip to content

Commit

Permalink
[Fix] Invalid setting value for auto_open_doc_panel_on_navigate.
Browse files Browse the repository at this point in the history
This commit fixes a situation where invalid setting value could be used
for `auto_open_doc_panel_on_navigate`. It now does proper logging and
falls back to the default value.
  • Loading branch information
UltraInstinct05 committed Nov 15, 2021
1 parent ed922fb commit 3c38e65
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/commands/commands_browser_core_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ def on_select(self, idx, event, commands_data):

if modifier_key in event["modifier_keys"]:
command_data = list(commands_data)[idx]
type = command_data[1]["command_type"]
command_type = command_data[1]["command_type"]

if type == "text":
if command_type == "text":
final_string = f"view.run_command("
if type == "application":
if command_type == "application":
final_string = f"sublime.run_command("
if type in ["window", "find"]:
if command_type in ["window", "find"]:
final_string = f"window.run_command("

if not command_data[1].get("args"):
Expand Down Expand Up @@ -129,7 +129,15 @@ def on_highlight(self, idx, commands_data):
"""
if idx < 0:
return
if commands_browser_settings("auto_open_doc_panel_on_navigate"):

auto_open = commands_browser_settings("auto_open_doc_panel_on_navigate")

if (type(auto_open) != bool):
log(f"""'{auto_open}' is an invalid value for the setting
'auto_open_doc_panel_on_navigate'. Falling back to default value.""")
auto_open = False

if auto_open:
core_commands_doc_panel(self.window, list(commands_data)[idx])


Expand Down

0 comments on commit 3c38e65

Please sign in to comment.