From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id AE15C15817D for ; Fri, 21 Jun 2024 13:14:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5B999E2AAB; Fri, 21 Jun 2024 13:14:20 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3567BE2AAA for ; Fri, 21 Jun 2024 13:14:20 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3FC74335DC3 for ; Fri, 21 Jun 2024 13:14:19 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8AE991D5A for ; Fri, 21 Jun 2024 13:14:15 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1718176002.15a828808106b943eea2e3b1c89705c51d91d4af.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 15a828808106b943eea2e3b1c89705c51d91d4af X-VCS-Branch: master Date: Fri, 21 Jun 2024 13:14:15 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6329dd28-92eb-4e50-b372-0dc723a579af X-Archives-Hash: fcb3c404f5fafc4bb73553eb8779d95d commit: 15a828808106b943eea2e3b1c89705c51d91d4af Author: Kerin Millar plushkava net> AuthorDate: Tue Jun 4 01:34:28 2024 +0000 Commit: Sam James gentoo org> CommitDate: Wed Jun 12 07:06:42 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=15a82880 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 plushkava.net> functions.sh | 5 +++-- 1 file 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.