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 7E9ED158094 for ; Sat, 30 Jul 2022 05:48:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BE17AE0C02; Sat, 30 Jul 2022 05:48:14 +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 98C68E0C02 for ; Sat, 30 Jul 2022 05:48:14 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 975F23406DD for ; Sat, 30 Jul 2022 05:48:13 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EC64C1E for ; Sat, 30 Jul 2022 05:48:10 +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: <1659159993.44c2ebb24e53bbf8c8848072cbe3b66471f883df.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: 44c2ebb24e53bbf8c8848072cbe3b66471f883df X-VCS-Branch: master Date: Sat, 30 Jul 2022 05:48:10 +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: f48450ee-73ec-4a5a-91c6-7cd4f8504613 X-Archives-Hash: 1e761ca0b8835f3dc51ba6b65aa9ad30 commit: 44c2ebb24e53bbf8c8848072cbe3b66471f883df Author: Ulrich Müller gentoo org> AuthorDate: Sat Sep 23 18:38:29 2017 +0000 Commit: Sam James gentoo org> CommitDate: Sat Jul 30 05:46:33 2022 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=44c2ebb2 functions.sh: Don't hardcode escape seqences for ENDCOL Similar to handling of colors, this should make use of tput, rather than sending unknown escape sequences to dumb terminals. Bug: https://bugs.gentoo.org/631870 Signed-off-by: Ulrich Müller gentoo.org> Signed-off-by: Sam James gentoo.org> functions.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions.sh b/functions.sh index a5f3bfd..acce989 100644 --- a/functions.sh +++ b/functions.sh @@ -429,10 +429,12 @@ COLS="${COLUMNS:-0}" # bash's internal COLUMNS variable [ -z "${COLS}" ] && COLS=80 [ "${COLS}" -gt 0 ] || COLS=80 # width of [ ok ] == 7 -if yesno "${RC_ENDCOL}"; then - ENDCOL='\033[A\033['$(( COLS - 8 ))'C' -else +if ! yesno "${RC_ENDCOL}"; then ENDCOL='' +elif command -v tput >/dev/null 2>&1; then + ENDCOL="$(tput cuu1)$(tput cuf $(( COLS - 8 )) )" +else + ENDCOL='\033[A\033['$(( COLS - 8 ))'C' fi # Setup the colors so our messages all look pretty