diff options
author | Kerin Millar <kfm@plushkava.net> | 2024-06-04 02:34:28 +0100 |
---|---|---|
committer | Kerin Millar <kfm@plushkava.net> | 2024-06-12 08:06:42 +0100 |
commit | 15a828808106b943eea2e3b1c89705c51d91d4af (patch) | |
tree | cf7b8f4b7afd7c571497b90d877581c3db45ec8a /functions.sh | |
parent | Clean up the jq detection procedure in eqatag() (diff) | |
download | gentoo-functions-15a828808106b943eea2e3b1c89705c51d91d4af.tar.gz gentoo-functions-15a828808106b943eea2e3b1c89705c51d91d4af.tar.bz2 gentoo-functions-15a828808106b943eea2e3b1c89705c51d91d4af.zip |
Never print CHA sequences containing negative numbers in _eend()
In cases where the value of genfun_tty is 2, render it impossible for
_eend() ever to produce a CHA sequence that incorporates a negative
column number. Some terminal emulators handle it sensibly whereas others
do not.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Diffstat (limited to 'functions.sh')
-rw-r--r-- | functions.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/functions.sh b/functions.sh index f5a59fc..409d424 100644 --- a/functions.sh +++ b/functions.sh @@ -773,7 +773,7 @@ yesno() # _eend() { - local efunc msg retval + local col efunc msg retval efunc=$1 shift @@ -815,7 +815,8 @@ _eend() # Save the cursor position with DECSC, move it up by one line # with CUU, position it horizontally with CHA, print the # indicator, then restore the cursor position with DECRC. - printf '\0337\033[1A\033[%dG %s\0338' "$(( genfun_cols - 6 + genfun_offset ))" "${msg}" + col=$(( genfun_cols > 6 ? genfun_cols - 6 : 1 )) + printf '\0337\033[1A\033[%dG %s\0338' "$(( col + genfun_offset ))" "${msg}" else # The standard output does not refer to a sufficiently capable # terminal. Print only the indicator. |