From 1fbc0fab56f1a1f620d9697e8592f8f1cd023389 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 21 Mar 2019 21:20:25 -0400 Subject: tests: Respond to terminal resizes --- tests.sh | 12 +++++++++--- 1 file 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 -- cgit v1.2.3