From 25d0b72510928acfc8dab2ae41f2f60fbfa0f382 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Thu, 10 May 2018 14:33:28 +0200 Subject: menuconfig: Refactor resizing after fullscreen dialogs Cleaner to do it in _menuconfig(), as it makes the fullscreen dialogs fully independent. Saves some code too. --- menuconfig.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'menuconfig.py') diff --git a/menuconfig.py b/menuconfig.py index 8b3ca40..2f4a6e4 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -463,9 +463,15 @@ def _menuconfig(stdscr): elif c == "/": _jump_to_dialog() + # The terminal might have been resized while the fullscreen jump-to + # dialog was open + _resize_main() elif c == "?": _info_dialog(_shown[_sel_node_i]) + # The terminal might have been resized while the fullscreen info + # dialog was open + _resize_main() elif c in ("a", "A"): _toggle_show_all() @@ -1395,21 +1401,14 @@ def _jump_to_dialog(): _jump_to(matches[sel_node_i]) _safe_curs_set(0) - # Resize the main display before returning in case the terminal was - # resized while the search dialog was open - _resize_main() return if c == "\x1B": # \x1B = ESC _safe_curs_set(0) - _resize_main() return if c == curses.KEY_RESIZE: - # No need to call _resize_main(), because the search window is - # fullscreen. - # We adjust the scroll so that the selected node stays visible in # the list when the terminal is resized, hence the 'scroll' # assignment @@ -1600,8 +1599,6 @@ def _info_dialog(node): c = _get_wch_compat(text_win) if c == curses.KEY_RESIZE: - # No need to call _resize_main(), because the help window is - # fullscreen _resize_info_dialog(top_line_win, text_win, bot_sep_win, help_win) elif c in (curses.KEY_DOWN, "j", "J"): @@ -1628,10 +1625,6 @@ def _info_dialog(node): "\x1B", # \x1B = ESC "q", "Q", "h", "H"): - # Resize the main display before returning in case the terminal was - # resized while the help dialog was open - _resize_main() - return def _resize_info_dialog(top_line_win, text_win, bot_sep_win, help_win): -- cgit v1.2.3