summaryrefslogtreecommitdiffhomepage
path: root/tests/linux/i-vi.sh
blob: d5fb71fafeb0c1e2b023ee649383e2f7aaaa6487 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Interactive: the built-in editor in vi mode.
command -v python3 >/dev/null 2>&1 || exit 77
PS1='$ ' ENV='' HISTFILE='' python3 "$TESTS/tools/ptydrive.py" "$TSH" -o vi <<'END'
send echo hello world\x1b0wcwBYE\x1b\r
expect BYE world
send \x1bk\r
expect BYE world
send echo one two three\x1bbbdw\r
expect one three
send echo one two three\x1b0wD\r
send echo abc\x1b0wiX\x1bA!\x1bIecho \x1b\r
expect echo Xabc!
send echo 12345\x1bhhhx2xrQ\r
expect 1Q
send echo a b\x1b0wyw$p\r
expect a ba 
send echo undo me\x1bddu\r
expect undo me
send echo upper\x1b0w5~\r
expect UPPER
send echo x\x1b/BYE\r\r
expect BYE world
send echo count\x1b03lx\r
expect ech count
send echo comment\x1b#
send echo done\r
expect done
# `.` repeats the last change, insert mode and all
send echo abcdef\x1b0wx..\r
expect echo def
send echo one two three\x1b0dw.\r
expect two three
send echo one two three\x1b0cwZZ\x1bw.\r
expect ZZ ZZ two three
# `y` over an empty range, with nothing killed yet: nothing is pasted and
# no null buffer reaches memcpy (ASan sees that one).
send \x15echo yank\x1b0y0\r
expect echo yank
# ... and a count repeats it that many times, on top of the change's own
send echo abcdef\x1b0x3.\r
expect  abcdef
# a motion is not a change: `.` still repeats the last real one
send echo abcdef\x1b0wx
send l.
send \r
expect echo bdef
# `/` typed over the previous pattern and backspaced to empty repeats the
# previous search, not a mix of the two patterns.
send echo apple\r
expect apple
send echo banana\r
expect banana
send \x1b/apple\r\r
expect echo apple
send \x1b/ban\x7f\x7f\x7f\r\r
expect echo apple
send exit\r
END