diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-02-10 01:33:49 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-02-10 01:33:49 -0800 |
commit | 0a62c283a13c2f911ea660ce736ed522cde3c1b9 (patch) | |
tree | 6d225b014964a812ea1d2e7301853d558b8262f3 /basta.sh | |
parent | fabdfa6ee630bb21c409ae3e31abfaff713e52c2 (diff) | |
download | basta-0a62c283a13c2f911ea660ce736ed522cde3c1b9.tar.gz basta-0a62c283a13c2f911ea660ce736ed522cde3c1b9.tar.bz2 basta-0a62c283a13c2f911ea660ce736ed522cde3c1b9.zip |
Check for changed window size at prompt time.
- In basta.check_cursor, we already query the terminal's
current position via basta.get_cur_line, and avoid doing
so if there is pending TTY input. Why don't we also
check the screen size here. If it has changed, we yield
a false return status.
- In basta.prompt_hook, we check the return status of
basta.check_cursor. If it is failed, then we add the WINCH
parameter when calling basta.update_status.
Diffstat (limited to 'basta.sh')
-rw-r--r-- | basta.sh | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -99,11 +99,19 @@ basta.check_cursor() if ! read -t 0; then local exit=$? local curln=$(basta.get_cur_line) + local realrows if [ $curln ] && [ $curln -gt $basta_scroll_lines ]; then printf $'\e[%s;1H' $basta_scroll_lines fi + + basta.query_terminal_lines realrows + + [ $LINES -eq $((realrows - $basta_prev_reserved_rows - 1)) ] + return $? fi + + return 0 } basta.do_exit_status() @@ -131,10 +139,12 @@ basta.initial_prompt_hook() basta.prompt_hook() { local exit=$? + local winch= + stty raw -echo onlcr opost - basta.check_cursor + basta.check_cursor || winch=WINCH basta.do_exit_status $exit - basta.update_status + basta.update_status $winch stty sane } |