diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 20:41:27 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-25 20:41:27 -0600 |
| commit | 31f697b4e619504ab894e064092528f7f73d565d (patch) | |
| tree | a05698851d28feb88d9bcf95a3530792b719b16b /tests | |
| parent | 456955dc33f24b1e9857bdc3c11788a2358e954c (diff) | |
| parent | deb0ed011fe2cfc7058facb3f63b7feaeb8d4a8e (diff) | |
| download | zash-31f697b4e619504ab894e064092528f7f73d565d.tar.gz | |
Merge pull request #33 from skurtz97/feat/prompt-width
interactive: a prompt's width counts columns, not bytes
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/linux/i-prompt-esc.exp | 4 | ||||
| -rw-r--r-- | tests/linux/i-prompt-esc.sh | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/linux/i-prompt-esc.exp b/tests/linux/i-prompt-esc.exp new file mode 100644 index 0000000..0d6e3de --- /dev/null +++ b/tests/linux/i-prompt-esc.exp @@ -0,0 +1,4 @@ +$ 32mP\e[0m> ' +]0;t(BP> Xabcdefghijklmn +]0;t(BP> exit +[status 0] diff --git a/tests/linux/i-prompt-esc.sh b/tests/linux/i-prompt-esc.sh new file mode 100644 index 0000000..18efd07 --- /dev/null +++ b/tests/linux/i-prompt-esc.sh @@ -0,0 +1,21 @@ +# Interactive: a prompt carrying sequences that are not just SGR. +# +# A terminal title (OSC, ended by BEL) and the charset reset plus colour +# that `tput sgr0` writes (`ESC ( B ESC [ m`) both come from a terminal's +# terminfo entry, and a prompt copied from elsewhere is full of them. +# None of them takes a column, so the line scrolls where a plain prompt +# of the same width would: a width rule that knows only `ESC [ ... m` +# counts the title and the `(B` as text, keeps 7 columns too few, and the +# redraw after ^A shows a shorter window than this expectation. +command -v python3 >/dev/null 2>&1 || exit 77 +python3 "$TESTS/tools/ptydrive.py" -c 16 "$TSH" <<'END' +send PS1='\\e]0;t\x07\\e(B\\e[1;32mP\\e[0m> '\r +expect P> +send abcdefghijklmn +send \x01 +send X +expect Xabcdefghijk +send \x03 +expect P> +send exit\r +END |
