From e044122d486a81c40540f01b7abd2d68a6a26112 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Mon, 11 Dec 2023 13:09:21 -0500 Subject: [PATCH] Allow displaying partial options in curses menus in smaller terminals --- lib/stweak.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/stweak.py b/lib/stweak.py index f50d7f2..df59c13 100644 --- a/lib/stweak.py +++ b/lib/stweak.py @@ -62,10 +62,14 @@ def curses_radio(_options, _pretext): if _button_gen: for _i, _option in enumerate(_options): _y = _i + _current_line + 1 - if _i == _selected: - stdscr.addstr(_y, 0, "[*] " + _option, A_REVERSE) + if _y < _height: + if _i == _selected: + stdscr.addstr(_y, 0, "[*] " + _option, A_REVERSE) + else: + stdscr.addstr(_y, 0, "[ ] " + _option) else: - stdscr.addstr(_y, 0, "[ ] " + _option) + stdscr.addstr(_y-1, 0, '# warning: re-size terminal to see more information') + break # update _selected based on user input _key = stdscr.getch()