Improve text wrapping for entry list - list now uses full width of terminal and can be displayed in smaller terminals without crashing

This commit is contained in:
2023-12-11 02:58:04 -05:00
parent 27cf610a1f
commit 23e51ae133
2 changed files with 21 additions and 22 deletions
+5 -5
View File
@@ -45,12 +45,12 @@ def curses_radio(_options, _pretext):
_current_line = 0
for _line in _pretext_lines:
if _current_line <= _height-4:
_remaining, _button_gen = _line, True
while len(_remaining) > _width:
stdscr.addstr(_current_line, 0, _remaining[:_width])
_remaining = _remaining[_width:]
_button_gen = True
while len(_line) > _width:
stdscr.addstr(_current_line, 0, _line[:_width])
_line = _line[_width:]
_current_line += 1
stdscr.addstr(_current_line, 0, _remaining)
stdscr.addstr(_current_line, 0, _line)
_current_line += 1
else:
_button_gen = False