summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-03-21 21:20:25 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-03-21 21:20:25 -0400
commit1fbc0fab56f1a1f620d9697e8592f8f1cd023389 (patch)
treeb6fa8d289b231747d36a86d963c51a4f60f59992 /tests.sh
parent4d458a8be62f79d7a931e7ee95da3438ca07b15e (diff)
downloadbfs-1fbc0fab56f1a1f620d9697e8592f8f1cd023389.tar.xz
tests: Respond to terminal resizes
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests.sh b/tests.sh
index 3d2ac43..4006534 100755
--- a/tests.sh
+++ b/tests.sh
@@ -2079,6 +2079,13 @@ function test_L_unique_depth() {
}
EOL='\n'
+
+function update_eol() {
+ # Put the cursor at the last column, then write a space so the next
+ # character will wrap
+ EOL="\\033[${COLUMNS}G "
+}
+
if [ -t 1 ]; then
RED='\033[01;31m'
GRN='\033[01;32m'
@@ -2086,9 +2093,8 @@ if [ -t 1 ]; then
RST='\033[0m'
if [ ! "$VERBOSE" ]; then
BOL='\r\033[K'
- # Put the cursor at the last column, then write a space so the next
- # character will wrap
- EOL="\\033[$(tput cols)G "
+ update_eol
+ trap update_eol WINCH
fi
fi