fill-character test bits.

This commit is contained in:
Nicholas Marriott
2026-07-23 10:38:27 +01:00
parent 689e6f8fac
commit a2f3bdb601
4 changed files with 84 additions and 21 deletions

View File

@@ -0,0 +1,63 @@
#!/bin/sh
# Exercise fill-character as a format. The window is smaller than the attached
# client so OUTSIDE spans exist, then the only tiled pane is removed so EMPTY
# spans exist inside the window around a floating pane.
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 -LtestA$$ -f/dev/null"
TMUX2="$TEST_TMUX -LtestB$$ -f/dev/null"
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
}
must_equal() {
if [ "$1" != "$2" ]; then
fail "expected '$2', got '$1'"
fi
}
$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 setw fill-character '#{?is_inside,I,#{?is_outside,O,X}}' || exit 1
$TMUX2 resizew -x28 -y8 || exit 1
$TMUX2 new-pane -x12 -y4 -X8 -Y2 "sh -c 'printf FLOAT; exec sleep 100'" || exit 1
tiled=$($TMUX2 list-panes -F '#{pane_floating_flag} #{pane_id}' | \
awk '$1==0{print $2; exit}') || exit 1
$TMUX2 kill-pane -t "$tiled" || 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
$TMUX capturep -p >$TMP || exit 1
must_equal "$(sed -n '1p' $TMP | cut -c1-28)" \
"IIIIIIIIIIIIIIIIIIIIIIIIIIII"
must_equal "$(sed -n '1p' $TMP | cut -c29-40)" "OOOOOOOOOOOO"
must_equal "$(sed -n '9p' $TMP)" "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"
if grep -q X "$TMP"; then
fail "fill-character used neither inside nor outside"
fi
exit 0

View File

@@ -215,9 +215,9 @@ $TMUX2 new-pane -x20 -y6 -X8 -Y7 "sh -c 'printf OVERST; exec sleep 100'" || exit
compare floating-over-status
# A window left with only a floating pane: killing the single tiled pane removes
# it from the layout, so the area it occupied is no longer owned by any pane and
# is drawn as EMPTY cells (middle dots) around the float. This is the only way to
# produce a REDRAW_SPAN_EMPTY span.
# it from the layout, so the area it occupied is no longer owned by any pane.
# Use a visible fill character for the EMPTY cells around the float.
$TMUX2 set -g fill-character '#[acs]~' || exit 1
new_scene 40 12
$TMUX2 new-pane -x20 -y6 -X8 -Y3 "sh -c 'printf FLOAT; exec sleep 100'" || exit 1
tiled=$($TMUX2 list-panes -F '#{pane_floating_flag} #{pane_id}' | \

View File

@@ -1,12 +1,12 @@
01:abcdefghijklmnopq ···········
02:abcdefghijklmnopq ···········
03:abcdefghijklmnop┌────────···········
04:abcdefghijklmnop│EDGE ···········
05:abcdefghijklmnop│ ···········
06:abcdefghijklmnop│ ···········
07:abcdefghijklmnop└────────···········
···········
────────────────────────────┘···········
01:abcdefghijklmnopq ············
02:abcdefghijklmnopq ············
03:abcdefghijklmnop┌────────············
04:abcdefghijklmnop│EDGE ············
05:abcdefghijklmnop│ ············
06:abcdefghijklmnop│ ············
07:abcdefghijklmnop└────────············
············
········································
········································
········································
········································

View File

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