From fd47dbc12ab65f6c1359068305a616667bc139fc Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sun, 12 Feb 2012 17:09:43 -0600 Subject: [PATCH] Modify algorithm to toggle inverse command along with bright command Rxvt interprets the 'inverse' ANSI command (7m) in a strange way: when the ANSI 'bright' command (1m) is provided, the provided ansi foreground and background colours are swapped as expected; when 'bright' is not provided, the DEFAULT foreground and background colours are swapped, and the provided colours are ignored. Leaving out 'inverse' when 'bright' is not used produces expected results. --- flag | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/flag b/flag index 7eceef1..aac454d 100755 --- a/flag +++ b/flag @@ -130,10 +130,9 @@ flag() { firstchar ord=$(hexdec "${char}") bright="0" - [ "$(( ${ord} & 8 ))" -gt 0 ] && bright="1" - fore="3$(( ${ord} & 7 ))" - back="4$(( ${ord} & 7 ))" - printf "${open}\033[%s;%s;%s;7m${shut}%s" "${bright}" "${fore}" "${back}" "${sym:-${char}}" + [ "$(( ${ord} & 8 ))" -gt 0 ] && bright="1;7" + colour="$(( ${ord} & 7 ))" + printf "${open}\033[%s;3%s;4%sm${shut}%s" "${bright}" "${colour}" "${colour}" "${sym:-${char}}" done printf "${open}\033[0m${shut}" } -- 2.42.0