summaryrefslogtreecommitdiff
path: root/test/snapshots/ttyprompt.snap
blob: 843ffe7c6b2695faf353faa8a36d174b9dedc2cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 31 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.