Bright background colours range from 100-107 but are stored as 90-97
internally.
---

Hi,

I think I found an issue with capture-pane when using bright background
(aixterm) colour codes, for example:

        printf '\e[100m foo \e[m'
        tmux capture-pane -pe

tmux capture-pane would ignore the first escape sequence.  This patch
should fix it. Please check if this is sane; it could be better to use
100-107 for the internal representation of those background colours. That
would be a slightly larger change but it might prevent similar issues.

Thanks,
Johannes


 grid.c                       | 18 +++++++++---------
 regress/capture-pane-sgr0.sh | 15 +++++++++++----
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/grid.c b/grid.c
index 9e18a73d..29943e6b 100644
--- a/grid.c
+++ b/grid.c
@@ -758,15 +758,15 @@ grid_string_cells_bg(const struct grid_cell *gc, int 
*values)
                case 8:
                        values[n++] = 49;
                        break;
-               case 100:
-               case 101:
-               case 102:
-               case 103:
-               case 104:
-               case 105:
-               case 106:
-               case 107:
-                       values[n++] = gc->bg - 10;
+               case 90:
+               case 91:
+               case 92:
+               case 93:
+               case 94:
+               case 95:
+               case 96:
+               case 97:
+                       values[n++] = gc->bg + 10;
                        break;
                }
        }
diff --git a/regress/capture-pane-sgr0.sh b/regress/capture-pane-sgr0.sh
index 79d96a38..0dd9cd82 100644
--- a/regress/capture-pane-sgr0.sh
+++ b/regress/capture-pane-sgr0.sh
@@ -13,11 +13,18 @@ $TMUX kill-server 2>/dev/null
 TMP=$(mktemp)
 trap "rm -f $TMP" 0 1 15
 
-$TMUX -f/dev/null new -d \
-       "printf '\033[31;42;1mabc\033[0;31mdef'; $TMUX capturep -peS0 -E0 >$TMP"
+$TMUX -f/dev/null new -d "
+       printf '\033[31;42;1mabc\033[0;31mdef\n'
+       printf '\033[m\033[100m bright bg \033[m'
+       $TMUX capturep -peS0 -E1 >>$TMP"
+
+
 sleep 1
-printf '\033[1m\033[31m\033[42mabc\033[0m\033[31m\033[49mdef\033[39m\n'| \
-       cmp - $TMP || exit 1
+
+(
+       printf '\033[1m\033[31m\033[42mabc\033[0m\033[31m\033[49mdef\033[39m\n'
+       printf '\033[100m bright bg \033[49m\n'
+) | cmp - $TMP || exit 1
 
 $TMUX has 2>/dev/null && exit 1
 
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/20200321134411.705702-1-aclopte%40gmail.com.

Reply via email to