diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-05-09 18:57:48 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-05-09 19:07:09 +0200 |
| commit | c6d0304d948f1cba94c040674c8dcde38575da05 (patch) | |
| tree | 77e7612038ff765f6506c6f28e721d9ff5a921b2 /menuconfig.py | |
| parent | 1d252b30c7794300c33020099518daa042fb07fd (diff) | |
menuconfig: Fix rendering of long prefilled edit box string
The horizontal scroll (hscroll) wasn't initialized properly when the
initial (prefilled) contents of an edit box was longer than the edit box
itself (e.g. when saving with a long path in KCONFIG_CONFIG). Things
snapped back into place once a key was pressed.
Initialize hscroll properly to fix the initial rendering.
Diffstat (limited to 'menuconfig.py')
| -rwxr-xr-x | menuconfig.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/menuconfig.py b/menuconfig.py index a391be5..f0e524f 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -1080,8 +1080,11 @@ def _input_dialog(title, initial_text, info_text=None): # Cursor position i = len(initial_text) + def edit_width(): + return win.getmaxyx()[1] - 4 + # Horizontal scroll offset - hscroll = 0 + hscroll = max(i - edit_width() + 1, 0) while True: # Draw the "main" display with the menu, etc., so that resizing still @@ -1109,7 +1112,7 @@ def _input_dialog(title, initial_text, info_text=None): _resize_input_dialog(win, title, info_text) else: - s, i, hscroll = _edit_text(c, s, i, hscroll, win.getmaxyx()[1] - 4) + s, i, hscroll = _edit_text(c, s, i, hscroll, edit_width()) def _resize_input_dialog(win, title, info_text): # Resizes the input dialog to a size appropriate for the terminal size |
