diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-11 13:33:47 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-11 13:38:16 +0200 |
| commit | 330017a99cd7619c9eb1fe5fccbb02f5d9e7f6c5 (patch) | |
| tree | c7d7757e32af3f2906cf68ac0553ba308b8799b5 | |
| parent | 4af3e0c5a96567d476570924a76527f82156ff6c (diff) | |
menuconfig: Support viewing symbol info from within the jump-to dialog
Ctrl-F (Ctrl-H clashes with backspace) brings up the information dialog
for the selected item in the jump-to dialog.
Since it's now possible to jump directly from the information dialog to
the jump-to dialog and vice versa, recursive invocation becomes
possible. Work around it with a flag to _info_dialog() that makes '/'
return if the information dialog was launched from within the jump-to
dialog. (Recursive invocations work code-wise, but act in a confusing
way.)
| -rwxr-xr-x | menuconfig.py | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/menuconfig.py b/menuconfig.py index 83fd9eb..7d6a064 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -150,7 +150,8 @@ _JUMP_TO_HELP_LINES = """ Type text to narrow the search. Regexes are supported (via Python's 're' module). The up/down cursor keys step in the list. [Enter] jumps to the selected symbol. [ESC] aborts the search. Type multiple space-separated -strings/regexes to find entries that match all of them. +strings/regexes to find entries that match all of them. Type Ctrl-F to +view the help of the selected item without leaving the dialog. """[1:-1].split("\n") def _init_styles(): @@ -504,7 +505,7 @@ def _menuconfig(stdscr): _resize_main() elif c == "?": - _info_dialog(_shown[_sel_node_i]) + _info_dialog(_shown[_sel_node_i], False) # The terminal might have been resized while the fullscreen info # dialog was open _resize_main() @@ -1546,6 +1547,15 @@ def _jump_to_dialog(): edit_box, matches_win, bot_sep_win, help_win, sel_node_i, scroll) + elif c == "\x06": # \x06 = Ctrl-F + _safe_curs_set(0) + _info_dialog(matches[sel_node_i], True) + _safe_curs_set(1) + + scroll = _resize_jump_to_dialog( + edit_box, matches_win, bot_sep_win, help_win, + sel_node_i, scroll) + elif c == curses.KEY_DOWN: select_next_match() @@ -1704,8 +1714,13 @@ def _draw_jump_to_dialog(edit_box, matches_win, bot_sep_win, help_win, edit_box.noutrefresh() -def _info_dialog(node): - # Shows a fullscreen window with information about 'node' +def _info_dialog(node, from_jump_to_dialog): + # Shows a fullscreen window with information about 'node'. + # + # If 'from_jump_to_dialog' is True, the information dialog was opened from + # within the jump-to-dialog. In this case, we make '/' from within the + # information dialog just return, to avoid a confusing recursive invocation + # of the jump-to-dialog. # Top row, with title and arrows point up top_line_win = _styled_win(_SEPARATOR_STYLE) @@ -1764,6 +1779,10 @@ def _info_dialog(node): elif c == "/": # Support starting a search from within the information dialog + if from_jump_to_dialog: + # Avoid recursion + return + if _jump_to_dialog(): # Jumped to a symbol. Cancel the information dialog. return |
