From 9a1b52eee240fe513aa6185aa0b0a0446dc90aa0 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 27 Dec 2019 20:08:53 +0100 Subject: [PATCH 1/5] Assume xterm has 256 colors --- .znewterm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.znewterm b/.znewterm index 1d30148..f214735 100644 --- a/.znewterm +++ b/.znewterm @@ -28,6 +28,18 @@ then TERM=xterm fi +if [[ $TERM == xterm ]] +then + for t in xterm-256color xterm+256color + do + if [[ -f /usr/share/terminfo/x/$t ]] + then + TERM=$t + break + fi + done +fi + case "$TERM" in xterm*|screen) # indicated exit status by smiley (suggested by Stig Sandbeck Mathisen) From be8eb03364deec3ffc1041b236b2d013632cc2eb Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Tue, 31 Dec 2019 11:51:20 +0100 Subject: [PATCH 2/5] Accept xterm+256colors as an xterm variant --- .znewterm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.znewterm b/.znewterm index f214735..944a661 100644 --- a/.znewterm +++ b/.znewterm @@ -57,7 +57,7 @@ case "$TERM" in ;; esac -if [[ $TERM = xterm || $TERM = xterm-256color ]] +if [[ $TERM = xterm || $TERM = xterm-256color || $TERM = xterm+256color ]] then if [ -f ~/.zxtermcolors ] then From 43ba5d2b5c07ff597985ce0006ff8acfa33436c2 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Tue, 31 Dec 2019 12:10:05 +0100 Subject: [PATCH 3/5] Improve detection of xterm-256color and remove xterm+256color again --- .znewterm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.znewterm b/.znewterm index 944a661..038cbc9 100644 --- a/.znewterm +++ b/.znewterm @@ -23,20 +23,23 @@ then stty erase  fi -if [[ $TERM == xterm-256color && ! -f /usr/share/terminfo/x/xterm-256color ]] +if [[ $TERM == xterm-256color && ! -f /usr/share/terminfo/x/xterm-256color && ! -f /lib/terminfo/x/xterm-256color ]] then TERM=xterm fi if [[ $TERM == xterm ]] then - for t in xterm-256color xterm+256color + for t in xterm-256color do - if [[ -f /usr/share/terminfo/x/$t ]] - then - TERM=$t - break - fi + for d in /usr/share/terminfo/x /lib/terminfo/x + do + if [[ -f $d/$t ]] + then + TERM=$t + break + fi + done done fi @@ -57,7 +60,7 @@ case "$TERM" in ;; esac -if [[ $TERM = xterm || $TERM = xterm-256color || $TERM = xterm+256color ]] +if [[ $TERM = xterm || $TERM = xterm-256color ]] then if [ -f ~/.zxtermcolors ] then From 471701393938d18fbf003977f0cc6cb7b3a30999 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 28 Feb 2020 10:49:11 +0100 Subject: [PATCH 4/5] Remove xterm+256color again but check /lib/terminfo The terminal defintions with a + are just building blocks, not full definitions. We can't use them. OTOH, the definitions in /lib/terminfo seem to work fine in current Debian and Ubuntu versions (which is what I care about these days), so we accept them. --- .znewterm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.znewterm b/.znewterm index 944a661..45ec463 100644 --- a/.znewterm +++ b/.znewterm @@ -23,20 +23,23 @@ then stty erase  fi -if [[ $TERM == xterm-256color && ! -f /usr/share/terminfo/x/xterm-256color ]] +if [[ $TERM == xterm-256color && ! -f /usr/share/terminfo/x/xterm-256color && ! -f /lib/terminfo/x/xterm-256color ]] then TERM=xterm fi if [[ $TERM == xterm ]] then - for t in xterm-256color xterm+256color + for t in xterm-256color do - if [[ -f /usr/share/terminfo/x/$t ]] - then - TERM=$t - break - fi + for dir in /usr/share/terminfo/x /lib/terminfo/x/ + do + if [[ -f $dir/$t ]] + then + TERM=$t + break 2 + fi + done done fi @@ -57,7 +60,7 @@ case "$TERM" in ;; esac -if [[ $TERM = xterm || $TERM = xterm-256color || $TERM = xterm+256color ]] +if [[ $TERM = xterm || $TERM = xterm-256color ]] then if [ -f ~/.zxtermcolors ] then From 0fdf3838573b491afff7856dd95e197b6605c847 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 15 Mar 2020 13:06:47 +0100 Subject: [PATCH 5/5] Set highlight color for darkbg --- .zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 4b56f37..177b469 100644 --- a/.zshrc +++ b/.zshrc @@ -27,7 +27,7 @@ if ack=`whence ack-grep` then alias ack=$ack fi -alias darkbg='xtermcontrol --bg "#000" --fg "#FFF"; export BG=dark' +alias darkbg='xtermcontrol --bg "#000" --fg "#FFF --highlight="#00F""; export BG=dark' alias lightbg='xtermcontrol --bg "#EEE" --fg "#000" --highlight="#0FF"; export BG=light' alias defaultbg='. ~/.zxtermcolors' alias ag='ag --color-path "34;47"'