From 0b398648434ffce2ff45884421d221166d5a053a Mon Sep 17 00:00:00 2001 From: Cibin Mathew Date: Sun, 13 Feb 2022 23:18:32 +0530 Subject: [PATCH] Added key-binding: toggle_cmdline_focus --- doc/usage.rst | 1 + pudb/debugger.py | 7 ++++--- pudb/settings.py | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/usage.rst b/doc/usage.rst index 1c3d91b..84b007e 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -68,3 +68,4 @@ Overriding default key bindings hotkeys_code = C hotkeys_stack = S hotkeys_variables = V + hotkeys_toggle_cmdline_focus = ctrl x diff --git a/pudb/debugger.py b/pudb/debugger.py index e1271f8..8ae76b4 100644 --- a/pudb/debugger.py +++ b/pudb/debugger.py @@ -88,7 +88,7 @@ Keys: Shell-related: ! - open the external shell (configured in the settings) - Ctrl-x - toggle the internal shell focus + {CONFIG["hotkeys_toggle_cmdline_focus"]} - toggle the internal shell focus +/- - grow/shrink inline shell (active in command line history) _/= - minimize/maximize inline shell (active in command line history) @@ -869,7 +869,8 @@ class DebuggerUI(FrameVarInfoKeeper): ]) self.cmdline_pile = urwid.Pile([ - ("flow", urwid.Text("Command line: [Ctrl-X]")), + ("flow", urwid.Text( + f"Command line: [{CONFIG['hotkeys_toggle_cmdline_focus']}]")), ("weight", 1, urwid.AttrMap(self.cmdline_list, "command line output")), ("flow", self.cmdline_edit_bar), ]) @@ -1878,7 +1879,7 @@ class DebuggerUI(FrameVarInfoKeeper): self.cmdline_edit_sigwrap.listen("ctrl p", cmdline_history_prev) self.cmdline_edit_sigwrap.listen("esc", toggle_cmdline_focus) - self.top.listen("ctrl x", toggle_cmdline_focus) + self.top.listen(CONFIG["hotkeys_toggle_cmdline_focus"], toggle_cmdline_focus) # {{{ command line sizing def set_cmdline_default_size(weight): diff --git a/pudb/settings.py b/pudb/settings.py index 96fa123..cb518b5 100644 --- a/pudb/settings.py +++ b/pudb/settings.py @@ -118,6 +118,7 @@ def load_config(): conf_dict.setdefault("hotkeys_variables", "V") conf_dict.setdefault("hotkeys_stack", "S") conf_dict.setdefault("hotkeys_breakpoints", "B") + conf_dict.setdefault("hotkeys_toggle_cmdline_focus", "ctrl x") def normalize_bool_inplace(name): try: @@ -263,7 +264,8 @@ def edit_config(ui, conf_dict): bool(conf_dict["prompt_on_quit"]), on_state_change=_update_config, user_data=("prompt_on_quit", None)) - hide_cmdline_win = urwid.CheckBox("Hide command line (Ctrl-X) window " + hide_cmdline_win = urwid.CheckBox("Hide command line", + f"({conf_dict['hotkeys_toggle_cmdline_focus']}) window " "when not in use", bool(conf_dict["hide_cmdline_win"]), on_state_change=_update_config, user_data=("hide_cmdline_win", None))