aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-02-06 10:56:07 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-02-06 10:56:07 -0800
commit0ccbe71c0ad869d19d6b7f7b0b0f06d2a39f62e7 (patch)
tree3b8534ce1152a8f9ab4aa8bf2439163e097c0235
parent34e350d44fd0db988fc5620acbbf447a81408ddb (diff)
downloadbasta-0ccbe71c0ad869d19d6b7f7b0b0f06d2a39f62e7.tar.gz
basta-0ccbe71c0ad869d19d6b7f7b0b0f06d2a39f62e7.tar.bz2
basta-0ccbe71c0ad869d19d6b7f7b0b0f06d2a39f62e7.zip
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).
-rw-r--r--basta.sh6
1 files 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'
}