diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-11 13:04:40 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-06-11 13:04:40 +0200 |
| commit | 4af3e0c5a96567d476570924a76527f82156ff6c (patch) | |
| tree | d59ee6ee7f38a96c9e8672027d1b469b8bdb26a5 | |
| parent | 8035e92560b9ad7da505748cfed459ba7f45fe80 (diff) | |
menuconfig: Support starting a search from the info dialog
It's annoying to have to leave the information dialog just to do a
search related to something you saw in the information dialog.
Stay in the information dialog if the search is canceled.
| -rwxr-xr-x | menuconfig.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/menuconfig.py b/menuconfig.py index be65e98..83fd9eb 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -1406,6 +1406,12 @@ def _draw_frame(win, title): win.attroff(_DIALOG_FRAME_STYLE) def _jump_to_dialog(): + # Implements the jump-to dialog, where symbols can be looked up via + # incremental search and jumped to. + # + # Returns True if the user jumped to a symbol, and False if the dialog was + # canceled. + # Search text s = "" # Previous search text @@ -1525,11 +1531,11 @@ def _jump_to_dialog(): if matches: _jump_to(matches[sel_node_i]) _safe_curs_set(0) - return + return True if c == "\x1B": # \x1B = ESC _safe_curs_set(0) - return + return False if c == curses.KEY_RESIZE: @@ -1755,6 +1761,18 @@ def _info_dialog(node): if scroll > 0: scroll -= 1 + elif c == "/": + # Support starting a search from within the information dialog + + if _jump_to_dialog(): + # Jumped to a symbol. Cancel the information dialog. + return + + # Stay in the information dialog if the jump-to dialog was + # canceled. Resize it in case the terminal was resized while the + # fullscreen jump-to dialog was open. + _resize_info_dialog(top_line_win, text_win, bot_sep_win, help_win) + elif c in (curses.KEY_LEFT, curses.KEY_BACKSPACE, _ERASE_CHAR, "\x1B", # \x1B = ESC "q", "Q", "h", "H"): |
