diff options
author | Kerin Millar <kfm@plushkava.net> | 2024-06-09 07:06:43 +0100 |
---|---|---|
committer | Kerin Millar <kfm@plushkava.net> | 2024-06-12 08:06:42 +0100 |
commit | 9c3da406f53faf3098932ce61edede414c6aef2a (patch) | |
tree | 6f516e9a3dd6e534a5d34e77f51d7c2f956a4ef5 | |
parent | Never print CHA sequences containing negative numbers in _eend() (diff) | |
download | gentoo-functions-9c3da406f53faf3098932ce61edede414c6aef2a.tar.gz gentoo-functions-9c3da406f53faf3098932ce61edede414c6aef2a.tar.bz2 gentoo-functions-9c3da406f53faf3098932ce61edede414c6aef2a.zip |
Have _eend() assume 80 columns in the absence of a smart terminal
In cases where the value of genfun_tty is lower than 2, it is implied
that the standard output refers either to a terminal insufficiently
capable of handling ECMA-48 CSI sequences or to a resource that is not a
terminal. Use <space> characters to indent the indicator to the extent
that the last character falls on the 80th column. Previously, the
indicator was indented by only one <space>.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
-rw-r--r-- | functions.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/functions.sh b/functions.sh index 409d424..fcba801 100644 --- a/functions.sh +++ b/functions.sh @@ -818,9 +818,12 @@ _eend() 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. - printf ' %s\n' "${msg}" + # The standard output refers either to an insufficiently capable + # terminal or to something other than a terminal. Print the + # indicator, using <space> characters to indent to the extent + # that the last character falls on the 80th column. This hinges + # on the fair assumption that a newline was already printed. + printf '%80s\n' "${msg}" fi return "${retval}" |