summaryrefslogtreecommitdiff
path: root/test/snapshots/ttyprompt.snap
diff options
context:
space:
mode:
Diffstat (limited to 'test/snapshots/ttyprompt.snap')
-rw-r--r--test/snapshots/ttyprompt.snap35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/snapshots/ttyprompt.snap b/test/snapshots/ttyprompt.snap
new file mode 100644
index 00000000..9cb377bf
--- /dev/null
+++ b/test/snapshots/ttyprompt.snap
@@ -0,0 +1,35 @@
+# Leaving raw tty hides the shell's PROMPT and keeps the command typed at it.
+#
+# The two share one grid row, so blanking the row used to take the command with
+# the prompt and a shell out of tty read as output only. OSC 133 marks the row
+# CELL by cell, so config.tty_blank = .prompt cuts the prompt's own columns and
+# left-hugs what is left: the command lands at column 0, in line with the
+# output under it, rather than in a bay of blanks the prompt used to fill.
+#
+# `.prompt_and_input` is the old behaviour and blanks the whole row; it is a
+# comptime choice, so what THIS script pins is the default.
+file probe.txt marker
+start 30 100 -n 3
+wait 8000 probe.txt
+stable 700 20000
+# the greeting `ls` was typed at a prompt and already shows the rule: the
+# command is there, the prompt in front of it is not
+snap greeted
+# into tty and type a command WITHOUT submitting it, so the shell is sitting at
+# a prompt with input on it — the case the old behaviour erased
+key c-b
+stable 600 8000
+text echo ABCDEFGH
+stable 600 8000
+snap in-tty
+# ...and out: the prompt goes, `echo ABCDEFGH` stays, hugging the left edge
+key c-b
+stable 600 8000
+snap out-of-tty
+# The columns still have to reach the shell, and they do: the modal cursor's
+# column on a hidden-prompt row is short by exactly the prompt's width, so
+# enterTty adds it back before asking ghostty to walk the shell's own cursor
+# there. That arithmetic is pinned by the "entering tty walks the shell cursor"
+# unit test, which can put a pinned cursor on a known column; a click here
+# cannot, because leaving tty unpins and a body click on a terminal does not
+# pin it again.