From 0ccbe71c0ad869d19d6b7f7b0b0f06d2a39f62e7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 6 Feb 2025 10:56:07 -0800 Subject: Distinguish WINCH in basta.update_status. - When SIGWINCH and SIGALRM are received and we are calling basta.update_status because of that, pass in an argument which allows that to be distinguished. basta.update_status will call basta.prepare_term if it was invoked because of SIGWINCH, even the apparent terminal size has not changed. - One upshot of this is that the user can recover a broken scrolling region now by doing "kill -WINCH $$", which will work even in the pathological situation when the full screen is scrolling, and basta_scroll_lines, LINES and stty rows all contain the same value (the full screen height). --- basta.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/basta.sh b/basta.sh index 962e8c6..80a8d36 100644 --- a/basta.sh +++ b/basta.sh @@ -67,7 +67,8 @@ basta.update_status() basta.query_termios_lines_cols tio_lines tio_cols - [ $LINES -eq $basta_old_lines -a \ + [ "$1" != WINCH -a \ + $LINES -eq $basta_old_lines -a \ $COLUMNS -eq $basta_old_cols -a \ $LINES -eq $tio_lines -a \ $COLUMNS -eq $tio_cols ] || basta.prepare_term @@ -151,7 +152,8 @@ basta.alarm_timer() basta.install_hooks() { - trap 'basta.update_status "$_"' ALRM WINCH + trap 'basta.update_status ALRM "$_"' ALRM + trap 'basta.update_status WINCH "$_"' WINCH trap basta.cleanup EXIT PROMPT_COMMAND='basta.initial_prompt_hook' } -- cgit v1.2.3