Add screen redraw regression tests.

This commit is contained in:
Nicholas Marriott
2026-06-19 17:33:33 +01:00
parent e7544e0a3b
commit 6d95fc5450
93 changed files with 2190 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
#!/bin/sh
# Exercise screen-redraw.c bidirectional-isolate handling. When the client is
# UTF-8 and its terminal has the Bidi capability, each drawn span is wrapped in
# directional isolate characters (U+2066 .. U+2069) so a bidi terminal does not
# reorder pane contents across borders (the REDRAW_ISOLATES path).
#
# The Bidi capability is added with terminal-overrides before the client
# attaches, so the attached client picks it up. The isolate characters appear in
# the captured output around each span.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
compare() {
sleep 1
$TMUX capturep -p >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
new_scene() {
$TMUX2 neww -d "sh -c 'exec sleep 100'" || exit 1
$TMUX2 selectw -t:\$ || exit 1
$TMUX2 resizew -x40 -y12 || exit 1
}
C="sh -c 'exec sleep 100'"
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
$TMUX2 new -d -x40 -y12 "sh -c 'exec sleep 100'" || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 set -g window-size manual || exit 1
# Add the Bidi capability before the client attaches.
$TMUX2 set -ag terminal-overrides ",*:Bidi=\\E[8h" || exit 1
$TMUX new -d -x40 -y12 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
# Single pane: content is wrapped in isolates.
new_scene
compare bidi-single
# Two panes: borders and both panes are isolated.
new_scene
$TMUX2 splitw -h "$C" || exit 1
compare bidi-split
exit 0

View File

@@ -0,0 +1,167 @@
#!/bin/sh
# Exercise screen-redraw.c drawing of floating panes: their borders and titles,
# clipping at the window edge, and the interaction with the area outside the
# window (when the window is smaller than the attached client).
#
# Each scene is rendered in an inner tmux attached inside an outer tmux pane.
# The outer pane is captured (the full client scene drawn by screen-redraw.c)
# and compared with a golden file in screen_redraw_results/.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
compare() {
sleep 1
$TMUX capturep -p $2 >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
# new_scene <width> <height>: fresh inner window of the given window size.
new_scene() {
$TMUX2 neww -d "sh -c 'printf base; exec sleep 100'" || exit 1
$TMUX2 selectw -t:\$ || exit 1
$TMUX2 resizew -x$1 -y$2 || exit 1
}
# tile_2x2: split the current window into a 2x2 grid of tiled panes.
tile_2x2() {
C="sh -c 'exec sleep 100'"
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 select-layout tiled || exit 1
}
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
$TMUX2 new -d -x40 -y12 "sh -c 'printf base; exec sleep 100'" || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 set -g window-size manual || exit 1
$TMUX2 set -g pane-border-format " #{pane_title} " || exit 1
$TMUX new -d -x40 -y12 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
# Basic floating pane, well inside the window.
new_scene 40 12
$TMUX2 new-pane -x20 -y6 -X8 -Y3 "sh -c 'printf FLOAT; exec sleep 100'" || exit 1
compare floating-basic
# Floating pane with a title on its border. pane-border-status also draws the
# base pane's title, so set it explicitly (the default is the hostname, which is
# not stable).
new_scene 40 12
$TMUX2 setw pane-border-status top || exit 1
$TMUX2 selectp -t:.0 -T base || exit 1
$TMUX2 new-pane -x20 -y6 -X8 -Y2 -T title \
"sh -c 'printf FLOAT; exec sleep 100'" || exit 1
compare floating-title
# Larger floating pane with double border lines.
new_scene 40 12
$TMUX2 new-pane -x28 -y8 -X4 -Y1 -B double \
"sh -c 'printf FLOAT; exec sleep 100'" || exit 1
compare floating-border-double
# Floating pane positioned past the right and bottom edges: must clip.
new_scene 40 12
$TMUX2 new-pane -x20 -y6 -X30 -Y8 "sh -c 'printf CLIP; exec sleep 100'" || exit 1
compare floating-clip-edge
# Window smaller than the client (outside area filled), with a floating pane
# that overlaps the boundary into the outside region.
new_scene 28 8
$TMUX2 new-pane -x16 -y5 -X18 -Y4 "sh -c 'printf OUT; exec sleep 100'" || exit 1
compare floating-outside
# Floating pane clipped at the top-left corner (negative offsets).
new_scene 40 12
$TMUX2 new-pane -x18 -y6 -X-4 -Y-2 "sh -c 'printf TL; exec sleep 100'" || exit 1
compare floating-clip-topleft
# Floating pane over a tiled 2x2 grid: the float draws a complete box and must
# NOT merge its borders with the tiled pane borders underneath.
new_scene 40 12
tile_2x2
$TMUX2 new-pane -x16 -y6 -X11 -Y3 "sh -c 'printf FLT; exec sleep 100'" || exit 1
compare floating-over-tiled
# Same, but the float uses double border lines while the tiled panes use single:
# the two border styles must coexist without merging.
new_scene 40 12
tile_2x2
$TMUX2 new-pane -x16 -y6 -X11 -Y3 -B double \
"sh -c 'printf FLT; exec sleep 100'" || exit 1
compare floating-over-tiled-double
# Two overlapping floating panes: the later (top) float draws over the earlier.
new_scene 40 12
$TMUX2 new-pane -x16 -y6 -X4 -Y2 "sh -c 'printf AAA; exec sleep 100'" || exit 1
$TMUX2 new-pane -x16 -y6 -X14 -Y6 "sh -c 'printf BBB; exec sleep 100'" || exit 1
compare floating-overlap
# Two floating panes with different per-pane configuration: one has its status on
# top with single borders, the other has its status on the bottom with heavy
# borders (pane-border-status and pane-border-lines are per-pane options).
new_scene 40 12
$TMUX2 setw pane-border-format " #{pane_title} " || exit 1
$TMUX2 new-pane -x16 -y4 -X3 -Y1 -T one \
"sh -c 'printf ONE; exec sleep 100'" || exit 1
$TMUX2 set -p pane-border-status top || exit 1
$TMUX2 set -p pane-border-lines single || exit 1
$TMUX2 new-pane -x16 -y4 -X18 -Y6 -T two \
"sh -c 'printf TWO; exec sleep 100'" || exit 1
$TMUX2 set -p pane-border-status bottom || exit 1
$TMUX2 set -p pane-border-lines heavy || exit 1
compare floating-mixed-config
# Floating pane over a pane that has a scrollbar: the float must draw over the
# scrollbar. Captured with -e since the scrollbar is drawn with styles.
new_scene 40 12
$TMUX2 setw pane-scrollbars on || exit 1
$TMUX2 setw pane-scrollbars-style "bg=black,fg=white,width=1,pad=0" || exit 1
$TMUX2 new-pane -x16 -y6 -X22 -Y3 "sh -c 'printf OVERSB; exec sleep 100'" || exit 1
compare floating-over-scrollbar -e
# Floating pane overlapping the client status line: the status line is not part
# of the window scene, so the float is clipped at the window's bottom edge.
new_scene 40 11
$TMUX2 set status on || exit 1
$TMUX2 set status-position bottom || exit 1
$TMUX2 set status-format[0] "" || exit 1
$TMUX2 new-pane -x20 -y6 -X8 -Y7 "sh -c 'printf OVERST; exec sleep 100'" || exit 1
compare floating-over-status
exit 0

View File

@@ -0,0 +1,176 @@
#!/bin/sh
# Exercise screen-redraw.c pane-border-indicators: the arrow indicators that
# point at the active pane, and the two-pane border colour split.
#
# Arrows are drawn as glyphs (captured plain). The two-pane colour split is
# drawn with styles, so that scene is captured with escapes (-e) and uses
# distinct active/inactive border styles so the split is visible.
#
# Each scene is rendered in an inner tmux attached inside an outer tmux pane.
# The outer pane is captured and compared with a golden in screen-redraw-results/.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
# compare <name> [-e]: capture the outer pane and compare (or generate).
compare() {
sleep 1
$TMUX capturep -p $2 >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
new_scene() {
$TMUX2 neww -d "sh -c 'exec sleep 100'" || exit 1
$TMUX2 selectw -t:\$ || exit 1
$TMUX2 resizew -x40 -y12 || exit 1
}
C="sh -c 'exec sleep 100'"
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
$TMUX2 new -d -x40 -y12 "sh -c 'exec sleep 100'" || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 set -g window-size manual || exit 1
$TMUX new -d -x40 -y12 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
# --- Arrows: must appear for whichever pane is active (GitHub #4780). ---
$TMUX2 set -g pane-border-indicators arrows || exit 1
# Two panes, left active: arrow points left.
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
compare arrows-2pane-left
# Two panes, right active: arrow points right (the case that regressed).
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t1 || exit 1
compare arrows-2pane-right
# Three columns, middle active.
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t1 || exit 1
compare arrows-3pane
# Four panes (2x2), one active.
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 select-layout tiled || exit 1
$TMUX2 selectp -t0 || exit 1
compare arrows-4pane
# --- Two-pane border colour split. ---
# Distinct active/inactive styles so the coloured halves are visible; captured
# with -e to record the SGR.
$TMUX2 set -g pane-border-indicators colour || exit 1
# Left/right split: the border is vertical and is split into a top half (active
# pane colour) and a bottom half (the LAYOUT_LEFTRIGHT case).
new_scene
$TMUX2 setw pane-active-border-style fg=red || exit 1
$TMUX2 setw pane-border-style fg=green || exit 1
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
compare two-pane-colour-vertical -e
# Top/bottom split: the border is horizontal and is split into a left half and a
# right half instead (the LAYOUT_TOPBOTTOM case).
new_scene
$TMUX2 setw pane-active-border-style fg=red || exit 1
$TMUX2 setw pane-border-style fg=green || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
compare two-pane-colour-horizontal -e
# --- Marked pane. ---
# A marked pane (select-pane -m) has its border drawn reversed. Captured with -e
# to record the reverse attribute. The marked pane is made non-active so its
# reversed border is distinct from the active pane.
$TMUX2 set -g pane-border-indicators off || exit 1
# Left/right split, right pane marked.
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 selectp -t1 -m || exit 1
compare marked-pane-lr -e
# Top/bottom split, bottom pane marked.
new_scene
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 selectp -t1 -m || exit 1
compare marked-pane-tb -e
# Three columns, middle pane marked (reversed border on both sides).
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 selectp -t1 -m || exit 1
compare marked-pane-three -e
# Floating pane marked: the whole floating box border is reversed.
new_scene
$TMUX2 new-pane -x20 -y6 -X8 -Y3 "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 selectp -t1 -m || exit 1
compare marked-pane-float -e
# Marked pane together with a pane status line: the title border is reversed too.
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 setw pane-border-format " #{pane_index}:#{pane_title} " || exit 1
$TMUX2 setw pane-border-status top || exit 1
$TMUX2 selectp -t:.0 -T left || exit 1
$TMUX2 selectp -t:.1 -T right || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 selectp -t1 -m || exit 1
compare marked-pane-status -e
exit 0

View File

@@ -0,0 +1,116 @@
#!/bin/sh
# Exercise screen-redraw.c when the window is smaller than the attached client,
# so part of the client is outside the window. screen-redraw.c fills the outside
# area and draws a real border along the window's right and/or bottom edge (not
# just where panes meet). This checks redraw_get_window_offset and the OUTSIDE
# span handling, including how the window-edge border joins the pane borders.
#
# Each scene is rendered in an inner tmux attached inside an outer tmux pane.
# The outer client is 40x14; the inner window is made smaller with resizew. The
# outer pane is captured and compared with a golden in screen-redraw-results/.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
compare() {
sleep 1
$TMUX capturep -p >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
# new_scene <width> <height>: fresh inner window smaller than the 40x14 client.
new_scene() {
$TMUX2 neww -d "sh -c 'printf base; exec sleep 100'" || exit 1
$TMUX2 selectw -t:\$ || exit 1
$TMUX2 resizew -x$1 -y$2 || exit 1
}
C="sh -c 'exec sleep 100'"
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
$TMUX2 new -d -x40 -y14 "sh -c 'printf base; exec sleep 100'" || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 set -g window-size manual || exit 1
$TMUX new -d -x40 -y14 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
# Single pane, narrower than the client: a border along the right edge.
new_scene 28 14
compare outside-right-single
# Narrower than the client with a left/right split: the inter-pane border plus a
# real border on the window's right edge, then the outside area.
new_scene 28 14
$TMUX2 splitw -h "$C" || exit 1
compare outside-right-split
# Shorter than the client with a top/bottom split: a real border on the window's
# bottom edge.
new_scene 40 9
$TMUX2 splitw -v "$C" || exit 1
compare outside-bottom-split
# Smaller in both dimensions with a 2x2 grid: borders on the right and bottom
# edges meeting the internal pane borders at the corner.
new_scene 28 9
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 select-layout tiled || exit 1
compare outside-both-2x2
# Window BIGGER than the client: only part of the window is viewed and the view
# can be panned (refresh-client). This exercises a non-zero scene offset.
# A 2x2 grid in a 60x20 window viewed through the 40x14 client.
new_scene 60 20
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 select-layout tiled || exit 1
# Default view: the top-left of the window.
$TMUX2 refresh-client -U 100 || exit 1
$TMUX2 refresh-client -L 100 || exit 1
compare bigger-topleft
# Panned to the bottom-right of the window (down and right to the limit).
$TMUX2 refresh-client -D 100 || exit 1
$TMUX2 refresh-client -R 100 || exit 1
compare bigger-bottomright
exit 0

View File

@@ -0,0 +1,92 @@
#!/bin/sh
# Exercise drawing of popups (display-popup) over the window scene. A popup is an
# overlay drawn on top of the redraw scene (the overlay_draw path in
# screen-redraw.c), so this guards against regressions in how popups appear.
#
# A popup is modal and stays open until its command exits, so each scene fully
# re-creates the servers and re-attaches; the popup is opened in the background
# (display-popup blocks the client that runs it) and the outer pane is captured
# while it is open.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
compare() {
sleep 1
$TMUX capturep -p >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
C="sh -c 'exec sleep 100'"
# setup: fresh inner window attached inside a fresh outer pane, 40x14.
setup() {
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
$TMUX2 new -d -x40 -y14 "$C" || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 set -g window-size manual || exit 1
$TMUX2 resizew -x40 -y14 || exit 1
$TMUX new -d -x40 -y14 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
}
# popup <args>: open a popup running a fixed command, in the background (it stays
# open because the command sleeps; the servers are killed at the next setup).
popup() {
$TMUX2 display-popup "$@" -E "sh -c 'printf POPUP; exec sleep 100'" &
sleep 1
}
# Basic popup over a single pane.
setup
popup -w20 -h6 -x6 -y3
compare popup-basic
# Popup over a split: drawn on top of the pane border.
setup
$TMUX2 splitw -h "$C" || exit 1
popup -w24 -h8 -x8 -y3
compare popup-over-split
# Popup with no border lines (-B).
setup
popup -B -w20 -h6 -x6 -y3
compare popup-noborder
# Popup with double border lines.
setup
popup -b double -w20 -h6 -x6 -y3
compare popup-double
exit 0

View File

@@ -0,0 +1,12 @@

View File

@@ -0,0 +1,12 @@

View File

@@ -0,0 +1,12 @@
│ │
→ ←
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │

View File

@@ -0,0 +1,12 @@
─↑─────────────────┼────────────────────

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,12 @@

View File

@@ -0,0 +1,12 @@
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦
⁩│⁦

View File

@@ -0,0 +1,14 @@
─────────┼──────────────────────────────

View File

@@ -0,0 +1,14 @@
base │
─────────────────────────────┼──────────

View File

@@ -0,0 +1,14 @@
═══════════════════╬════════════════════

View File

@@ -0,0 +1,14 @@
━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,14 @@
1
1
1
1
1
1
0000000000000000000011111111111111111111
2
2
2
2
2
2
2

View File

@@ -0,0 +1,14 @@
|
|
|
|
|
|
-------------------+--------------------
|
|
|
|
|
|
|

View File

@@ -0,0 +1,14 @@
───────────────────┼────────────────────

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,12 @@
base
┌────────────────────┐
│FLOAT │
│ │
│ │
│ │
│ │
│ │
└────────────────────┘

View File

@@ -0,0 +1,12 @@
bas╔════════════════════════════╗
║FLOAT ║
║ ║
║ ║
║ ║
║ ║
║ ║
║ ║
║ ║
╚════════════════════════════╝

View File

@@ -0,0 +1,12 @@
base
┌──────────
│CLIP

View File

@@ -0,0 +1,12 @@
base
─────────────┘

View File

@@ -0,0 +1,12 @@
ba┌── one ─────────┐
│ONE │
│ │
│ │
│ │
└──────────────┏━━━━━━━━━━━━━━━━┓
┃TWO ┃
┃ ┃
┃ ┃
┃ ┃
┗━━ two ━━━━━━━━━┛

View File

@@ -0,0 +1,12 @@
base │···········
│···········
│···········
┌──────────│···········
│OUT │···········
│ │···········
│ │···········
│ │···········
────────────────────────────┘···········
········································
········································
········································

View File

@@ -0,0 +1,12 @@
base 
 
 ┌────────────────┐
 │OVERSB  │
 │  │
 │  │
 │  │
 │  │
 │  │
 └────────────────┘
 
 

View File

@@ -0,0 +1,12 @@
base
┌────────────────────┐
│OVERST │
│ │
│ │
│ │

View File

@@ -0,0 +1,12 @@
base │
╔════════════════╗
║FLT ║
║ ║
──────────║ ║────────────
║ ║
║ ║
║ ║
╚════════════════╝

View File

@@ -0,0 +1,12 @@
base │
┌────────────────┐
│FLT │
│ │
──────────│ │────────────
│ │
│ │
│ │
└────────────────┘

View File

@@ -0,0 +1,12 @@
base
┌────────────────┐
│AAA │
│ │
│ │
│ ┌────────────────┐
│ │BBB │
│ │ │
└─────────│ │
│ │
│ │
│ │

View File

@@ -0,0 +1,12 @@
── base ────────────────────────────────
base ┌── title ───────────┐
│FLOAT │
│ │
│ │
│ │
│ │
│ │
└────────────────────┘

View File

@@ -0,0 +1,12 @@
┌────────────────────┐
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────┘

View File

@@ -0,0 +1,12 @@
│
│
│
│
│
│
│
│
│
│
│
│

View File

@@ -0,0 +1,12 @@
── 0:left ──────────┬── 1:right ────────
│
│
│
│
│
│
│
│
│
│
│

View File

@@ -0,0 +1,12 @@
────────────────────────────────────────

View File

@@ -0,0 +1,12 @@
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │

View File

@@ -0,0 +1,14 @@
base │ │···········
│ │···········
│ │···········
│ │···········
─────────────┼──────────────┤···········
│ │···········
│ │···········
│ │···········
│ │···········
─────────────┴──────────────┘···········
········································
········································
········································
········································

View File

@@ -0,0 +1,14 @@
base
────────────────────────────────────────
────────────────────────────────────────
········································
········································
········································
········································

View File

@@ -0,0 +1,14 @@
base │···········
│···········
│···········
│···········
│···········
│···········
│···········
│···········
│···········
│···········
│···········
│···········
│···········
│···········

View File

@@ -0,0 +1,14 @@
base │ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········
│ │···········

View File

@@ -0,0 +1,14 @@
── p0 ─────────────┬── p1 ──────────────
── p2 ─────────────┼── p3 ──────────────

View File

@@ -0,0 +1,14 @@
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
── p0 ────┴── p1 ───┴── p2 ─────────────

View File

@@ -0,0 +1,14 @@
── p0 ────┬── p1 ───┬── p2 ─────────────
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │

View File

@@ -0,0 +1,14 @@
── 0:left ──────────┴── 1:right ────────

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,14 @@
── 0:left ──────────┬── 1:right ────────

View File

@@ -0,0 +1,14 @@
┌──────────────────┐
│POPUP │
│ │
│ │
│ │
└──────────────────┘

View File

@@ -0,0 +1,14 @@
╔══════════════════╗
║POPUP ║
║ ║
║ ║
║ ║
╚══════════════════╝

View File

@@ -0,0 +1,14 @@
POPUP

View File

@@ -0,0 +1,14 @@
┌──────────────────────┐
│POPUP │
│ │
│ │
│ │
│ │
│ │
└──────────────────────┘

View File

@@ -0,0 +1,12 @@
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 

View File

@@ -0,0 +1,12 @@
base 
 
 ┌────────────────────┐ 
 │FLOAT  │ 
 │  │ 
 │  │ 
 │  │ 
 │  │ 
 │  │ 
 └────────────────────┘ 
 
 

View File

@@ -0,0 +1,12 @@
  base
 
 
 
 
 
 
 
 
 
 
 

View File

@@ -0,0 +1,12 @@
 base
 
 
 
 
 
 
 
 
 
 
 

View File

@@ -0,0 +1,12 @@
base 
 
 
 
 
 
 
 
 
 
 
 

View File

@@ -0,0 +1,12 @@
base 
 
 
 
 
 
 
 
 
 
 
 

View File

@@ -0,0 +1,12 @@
base 
 
 
 
 
 
 
 
 
 
 
 

View File

@@ -0,0 +1,12 @@
TOP
──────────────────────────────
BOT

View File

@@ -0,0 +1,12 @@
TOP
──────────────────────────────
BOT

View File

@@ -0,0 +1,12 @@
TOP
──────────────────────────────
BOT

View File

@@ -0,0 +1,12 @@
TOP
──────────────────────────────
BOT

View File

@@ -0,0 +1,12 @@
TOP
──────────────────────────────
BOT

View File

@@ -0,0 +1,14 @@
════════════════════╦═══════════════════

View File

@@ -0,0 +1,14 @@
━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,14 @@
0000000000000000000022222222222222222222
2
2
2
2
2
2

View File

@@ -0,0 +1,14 @@
--------------------+-------------------
|
|
|
|
|
|

View File

@@ -0,0 +1,14 @@
────────────────────┬───────────────────

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,14 @@
║ ║
║ ║
║ ║
║ ║
║ ║
║ ║
║ ║
╠═════════╣
║ ║
║ ║
║ ║
║ ║
║ ║
║ ║

View File

@@ -0,0 +1,14 @@
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┣━━━━━━━━━┫
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┃ ┃

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,14 @@
0 1
0 1
0 1
0 1
0 1
0 1
0 1
22222222222
2 2
2 2
2 2
2 2
2 2
2 2

View File

@@ -0,0 +1,14 @@
| |
| |
| |
| |
| |
| |
| |
+---------+
| |
| |
| |
| |
| |
| |

View File

@@ -0,0 +1,14 @@
│ │
│ │
│ │
│ │
│ │
│ │
│ │
├─────────┤
│ │
│ │
│ │
│ │
│ │
│ │

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,14 @@
════════════════════╩═══════════════════

View File

@@ -0,0 +1,14 @@
━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,14 @@
1
1
1
1
1
1
1
0000000000000000000011111111111111111111

View File

@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
--------------------+-------------------

View File

@@ -0,0 +1,14 @@
────────────────────┴───────────────────

View File

@@ -0,0 +1,14 @@

View File

@@ -0,0 +1,12 @@
────────────────────────────────────────

View File

@@ -0,0 +1,12 @@
│
│
│
│
│
│
│
│
│
│
│
│

View File

@@ -0,0 +1,8 @@
 │
 │
 │
 │
 │
 │
 │
 │

View File

@@ -0,0 +1,8 @@


View File

@@ -0,0 +1,121 @@
#!/bin/sh
# Exercise screen-redraw.c drawing of pane scrollbars: position (right/left),
# width, and pad (which is handled separately from width). Scrollbars are drawn
# as styled (coloured) cells rather than glyphs, so these scenes are captured
# with escape sequences (-e); without that the scrollbar is invisible.
#
# Each scene is rendered in an inner tmux attached inside an outer tmux pane.
# The outer pane is captured and compared with a golden in screen_redraw_results/.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
# compare <name>: capture the outer pane with escapes and compare (or generate).
compare() {
sleep 1
$TMUX capturep -pe >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
# new_scene: fresh inner window, single full-size pane.
new_scene() {
$TMUX2 neww -d "sh -c 'printf base; exec sleep 100'" || exit 1
$TMUX2 selectw -t:\$ || exit 1
$TMUX2 resizew -x40 -y12 || exit 1
}
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
$TMUX2 new -d -x40 -y12 "sh -c 'printf base; exec sleep 100'" || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 set -g window-size manual || exit 1
$TMUX2 set -g pane-scrollbars on || exit 1
$TMUX new -d -x40 -y12 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
# Right, width 1, no pad.
new_scene
$TMUX2 setw pane-scrollbars-position right || exit 1
$TMUX2 setw pane-scrollbars-style "bg=black,fg=white,width=1,pad=0" || exit 1
compare scrollbar-right-w1
# Left, width 1, no pad.
new_scene
$TMUX2 setw pane-scrollbars-position left || exit 1
$TMUX2 setw pane-scrollbars-style "bg=black,fg=white,width=1,pad=0" || exit 1
compare scrollbar-left-w1
# Right, width 2, no pad.
new_scene
$TMUX2 setw pane-scrollbars-position right || exit 1
$TMUX2 setw pane-scrollbars-style "bg=black,fg=white,width=2,pad=0" || exit 1
compare scrollbar-right-w2
# Right, width 1, pad 1. The pad is drawn between the pane content and the
# scrollbar; for a right scrollbar that pad cell is at the right edge, so capture
# trims it and this matches scrollbar-right-w1. The golden still pins that
# behaviour (and the pad draw path runs); the left scene below shows pad visibly.
new_scene
$TMUX2 setw pane-scrollbars-position right || exit 1
$TMUX2 setw pane-scrollbars-style "bg=black,fg=white,width=1,pad=1" || exit 1
compare scrollbar-right-pad
# Left, width 1, pad 1: the pad cell sits between the slider and the content, so
# it is visible (one extra column before the pane content).
new_scene
$TMUX2 setw pane-scrollbars-position left || exit 1
$TMUX2 setw pane-scrollbars-style "bg=black,fg=white,width=1,pad=1" || exit 1
compare scrollbar-left-pad
# Floating pane with a scrollbar.
new_scene
$TMUX2 setw pane-scrollbars-position right || exit 1
$TMUX2 setw pane-scrollbars-style "bg=black,fg=white,width=1,pad=0" || exit 1
$TMUX2 new-pane -x20 -y6 -X8 -Y3 "sh -c 'printf FLOAT; exec sleep 100'" || exit 1
compare scrollbar-floating
# Scrollbar slider in copy mode: with scrollback the slider is shorter than the
# track, so this exercises the slider geometry (which only runs when the pane is
# in a mode). copy-mode -H hides the position indicator, which is not stable.
$TMUX2 neww -d "sh -c 'seq 40; exec sleep 100'" || exit 1
$TMUX2 selectw -t:\$ || exit 1
$TMUX2 resizew -x40 -y12 || exit 1
$TMUX2 setw pane-scrollbars-position right || exit 1
$TMUX2 setw pane-scrollbars-style "bg=black,fg=white,width=1,pad=0" || exit 1
$TMUX2 copy-mode -H || exit 1
$TMUX2 send -X history-top || exit 1
compare scrollbar-copy-mode -e
exit 0

View File

@@ -0,0 +1,92 @@
#!/bin/sh
# Exercise how the client status line affects the window scene drawn by
# screen-redraw.c. The status line is not part of the scene, but its size and
# position change the scene's offset and height (status_line_size and the
# REDRAW_STATUS_TOP flag in screen-redraw.c). The status line content does not
# matter, so status-format is set empty; only the offset effect is tested.
#
# A top/bottom split makes the offset visible: the horizontal border and the
# pane contents move as the status line grows or changes side.
#
# Each scene is rendered in an inner tmux attached inside an outer tmux pane.
# The outer pane is captured and compared with a golden in screen-redraw-results/.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
compare() {
sleep 1
$TMUX capturep -p >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
# Inner: a top/bottom split. The window tracks the attached client size, so the
# status line shrinks/shifts the window scene. Status content is blanked.
$TMUX2 new -d -x30 -y12 "sh -c 'printf TOP; exec sleep 100'" || exit 1
$TMUX2 set -g window-size latest || exit 1
i=0
while [ $i -le 4 ]; do
$TMUX2 set -g status-format[$i] "" || exit 1
i=$((i + 1))
done
$TMUX2 splitw -v "sh -c 'printf BOT; exec sleep 100'" || exit 1
$TMUX new -d -x30 -y12 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
# No status line: the window fills the whole client.
$TMUX2 set -g status off || exit 1
compare status-off
# One line at the bottom: the scene loses its bottom row.
$TMUX2 set -g status on || exit 1
$TMUX2 set -g status-position bottom || exit 1
compare status-bottom
# One line at the top: the whole scene is shifted down one row.
$TMUX2 set -g status-position top || exit 1
compare status-top
# Three lines at the bottom.
$TMUX2 set -g status 3 || exit 1
$TMUX2 set -g status-position bottom || exit 1
compare status-3-bottom
# Three lines at the top: the scene is shifted down three rows.
$TMUX2 set -g status-position top || exit 1
compare status-3-top
exit 0

View File

@@ -0,0 +1,180 @@
#!/bin/sh
# Exercise screen-redraw.c border drawing for non-floating (tiled) panes: the
# border junctions where panes meet, and pane status lines/titles.
#
# Four layouts cover every junction type that tiled panes produce:
# cross - a 2x2 grid: a full crossing (+ / CELL_LRUD)
# tee-lr - three columns with the middle split: left and right tees
# (|- and -| / URD, ULD)
# tee-up - a top/bottom split with the top split: a bottom tee (_|_ / LRU)
# tee-down - a top/bottom split with the bottom split: a top tee (T / LRD)
# Each layout is rendered once for every value of pane-border-lines, so every
# junction is checked in every border style. One layout per result file.
#
# Each scene is rendered in an inner tmux attached inside an outer tmux pane.
# The outer pane is captured (the full client scene drawn by screen-redraw.c)
# and compared with a golden file in screen-redraw-results/.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
compare() {
sleep 1
$TMUX capturep -p >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
# Fresh inner window of fixed size, with one command running.
new_scene() {
$TMUX2 neww -d "sh -c 'exec sleep 100'" || exit 1
$TMUX2 selectw -t:\$ || exit 1
$TMUX2 resizew -x40 -y14 || exit 1
}
C="sh -c 'exec sleep 100'"
# Layouts. Each produces one kind of junction. Splits at fixed window size are
# deterministic.
layout_cross() { # 2x2 grid: a full crossing
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 select-layout tiled || exit 1
}
layout_tee_lr() { # three columns, middle split: left and right tees
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t1 || exit 1
$TMUX2 splitw -v "$C" || exit 1
}
layout_tee_up() { # top/bottom, top split: a bottom tee
new_scene
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -h "$C" || exit 1
}
layout_tee_down() { # top/bottom, bottom split: a top tee
new_scene
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t1 || exit 1
$TMUX2 splitw -h "$C" || exit 1
}
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
$TMUX2 new -d -x40 -y14 "sh -c 'exec sleep 100'" || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 set -g window-size manual || exit 1
$TMUX2 set -g pane-border-format " #{pane_index} " || exit 1
$TMUX new -d -x40 -y14 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
# Every junction in every border style. New windows inherit the global option,
# so set it before building each layout.
for style in single double heavy simple number spaces none; do
$TMUX2 set -g pane-border-lines $style || exit 1
layout_cross; compare cross-$style
layout_tee_lr; compare tee-lr-$style
layout_tee_up; compare tee-up-$style
layout_tee_down; compare tee-down-$style
done
$TMUX2 set -g pane-border-lines single || exit 1
# Pane status lines and titles (one layout each). Use a format that includes the
# explicitly-set title; the default title is the hostname, which is not stable,
# so every pane's title must be set.
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 setw pane-border-format " #{pane_index}:#{pane_title} " || exit 1
$TMUX2 setw pane-border-status top || exit 1
$TMUX2 selectp -t:.0 -T left || exit 1
$TMUX2 selectp -t:.1 -T right || exit 1
$TMUX2 selectp -t:.0 || exit 1
compare pane-status-top
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 setw pane-border-format " #{pane_index}:#{pane_title} " || exit 1
$TMUX2 setw pane-border-status bottom || exit 1
$TMUX2 selectp -t:.0 -T left || exit 1
$TMUX2 selectp -t:.1 -T right || exit 1
$TMUX2 selectp -t:.0 || exit 1
compare pane-status-bottom
# title_all <title-prefix>: set every pane's title (the default is the hostname).
title_all() {
for p in $($TMUX2 list-panes -F '#{pane_index}'); do
$TMUX2 selectp -t:.$p -T $1$p || exit 1
done
$TMUX2 selectp -t:.0 || exit 1
}
# Three columns with a status line on top, then on the bottom.
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 setw pane-border-format " #{pane_title} " || exit 1
$TMUX2 setw pane-border-status top || exit 1
title_all p
compare pane-status-3-top
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 setw pane-border-format " #{pane_title} " || exit 1
$TMUX2 setw pane-border-status bottom || exit 1
title_all p
compare pane-status-3-bottom
# A 2x2 grid with a status line on top: status borders meet pane borders at the
# internal junctions.
new_scene
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
$TMUX2 splitw -v "$C" || exit 1
$TMUX2 select-layout tiled || exit 1
$TMUX2 setw pane-border-format " #{pane_title} " || exit 1
$TMUX2 setw pane-border-status top || exit 1
title_all p
compare pane-status-2x2-top
exit 0

View File

@@ -0,0 +1,77 @@
#!/bin/sh
# Exercise window-style and window-active-style, which set the default cell
# (background) style for a window's panes. screen-redraw.c uses these for the
# default grid cell of each pane (the active pane uses window-active-style, the
# others window-style). Captured with -e to record the background colours.
#
# Run with GENERATE=1 to (re)create the golden files.
PATH=/bin:/usr/bin
TERM=screen
LC_ALL=C.UTF-8
export TERM LC_ALL
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -Ltest -f/dev/null"
TMUX2="$TEST_TMUX -Ltest2 -f/dev/null"
RESULTS=screen-redraw-results
TMP=$(mktemp)
trap "rm -f $TMP; $TMUX kill-server 2>/dev/null; $TMUX2 kill-server 2>/dev/null" \
0 1 15
fail() {
echo "$*" >&2
exit 1
}
compare() {
sleep 1
$TMUX capturep -pe >$TMP || exit 1
if [ -n "$GENERATE" ]; then
cp $TMP "$RESULTS/$1.result" || exit 1
echo "generated $1"
else
cmp -s $TMP "$RESULTS/$1.result" || \
fail "scene $1 differs from $RESULTS/$1.result"
fi
}
new_scene() {
$TMUX2 neww -d "sh -c 'exec sleep 100'" || exit 1
$TMUX2 selectw -t:\$ || exit 1
$TMUX2 resizew -x40 -y8 || exit 1
}
C="sh -c 'exec sleep 100'"
$TMUX kill-server 2>/dev/null
$TMUX2 kill-server 2>/dev/null
$TMUX2 new -d -x40 -y8 "sh -c 'exec sleep 100'" || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 set -g window-size manual || exit 1
$TMUX new -d -x40 -y8 || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g window-size manual || exit 1
$TMUX set -g default-terminal "tmux-256color" || exit 1
$TMUX send -l "$TMUX2 attach" || exit 1
$TMUX send Enter || exit 1
sleep 1
# Single pane with a window background style.
new_scene
$TMUX2 setw window-style "bg=blue" || exit 1
compare window-style-single
# Split: the active pane uses window-active-style, the other window-style.
new_scene
$TMUX2 setw window-style "bg=blue" || exit 1
$TMUX2 setw window-active-style "bg=red" || exit 1
$TMUX2 splitw -h "$C" || exit 1
$TMUX2 selectp -t0 || exit 1
compare window-style-active
exit 0