blob: d9fa0d51ff3e5553ff90c9312a729aeeca39ae38 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# Tests of the vi mode of ZLE
%prep
if ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
. $ZTST_srcdir/comptest
comptestinit -v -z $ZTST_testdir/../Src/zsh
else
ZTST_unimplemented="the zsh/zpty module is not available"
fi
%test
zletest $'goox\ecld'
0:change last character in buffer
>BUFFER: good
>CURSOR: 4
zletest $'one two\eyb'
0:yank left moves the cursor
>BUFFER: one two
>CURSOR: 4
zletest $'one two\e0ye'
0:yank right leaves the cursor
>BUFFER: one two
>CURSOR: 0
zletest $'short\eoand longer\eyk'
0:yank up line moves cursor up but not to buffer start
>BUFFER: short
>and longer
>CURSOR: 4
zletest $'one\eotwo\ekyj'
0:yank down line leaves the cursor
>BUFFER: one
>two
>CURSOR: 2
zletest $'yankee doodle\ebhDyy0"1P'
0:paste register 1 to get last deletion
>BUFFER: doodleyankee
>CURSOR: 6
zletest $'yankee\eyyodoodle\edd"0p'
0:paste register 0 to get last yank
>BUFFER: yankee
>yankee
>CURSOR: 7
zletest $'err\eddahello\e"hddP'
0:setting named register also sets unnamed register
>BUFFER: hello
>CURSOR: 0
zletest $'first\e"ay0ddasecond\e"Add"aP'
0:appending to named register
>BUFFER: firs
>second
>CURSOR: 0
zletest $'word\e"a"byy"bp'
0:set one and then a different register
>BUFFER: word
>word
>CURSOR: 5
zletest $'i\exaar\e0"a"_cewn\eP'
0:set register then set black hole register
>BUFFER: win
>CURSOR: 1
zletest $'double\eyy"_"0P'
0:reset register after selecting black hole
>BUFFER: double
>double
>CURSOR: 0
# zsh works like vi here; in vim you get the concatenated string
zletest $'first\e"addasecond\eddP'
0:retrieve unnamed register after appending
>BUFFER: second
>CURSOR: 0
zletest $'Z\exayankee doodle\e"_db0"_yeP'
0:yank and delete to black hole register
>BUFFER: Zyankee e
>CURSOR: 0
zletest $'foo\eddabar\e"_p..'
0:paste from black hole register and repeat
>BUFFER: bar
>CURSOR: 2
zletest $'start\eFa"ac2lnew\eX"ap..'
0:repeat paste from named register
>BUFFER: stnwararart
>CURSOR: 9
zletest $'word\euaend'
0:undo initial change
>BUFFER: end
>CURSOR: 3
zletest $'text\e.'
0:repeat initial edit
>BUFFER: text
>text
>CURSOR: 8
zpty_run 'print -z before'
zletest $'after\e.'
0:repeat initial edit with non-blank starting line
>BUFFER: beforeafterafter
>CURSOR: 15
zpty_run 'setopt overstrike;print -z bung'
zletest $'ing\e2|.'
0:repeat initial edit with overstrike set
>BUFFER: binging
>CURSOR: 3
zpty_run 'bindkey "^_" undo'
zletest $'undoc\037e'
0:use of undo in vi insert mode
>BUFFER: undoe
>CURSOR: 5
zletest $'one\euatwo\e0clthree'
0:vi mode undo of initial and subsequent change
>BUFFER: threewo
>CURSOR: 5
zletest $'xxx\euiyyy\euAz'
0:undo invoked twice
>BUFFER: z
>CURSOR: 1
zpty_run 'bindkey -a "^K" redo'
zletest $'123\C-_\e\C-k'
0:undo in insert mode, redo in command
>BUFFER: 123
>CURSOR: 2
zpty_run 'bindkey "^Y" redo'
zletest $'pre\eA123\C-_\C-y\eu'
0:undo and redo in insert mode, undo in command
>BUFFER: pre
>CURSOR: 2
zpty_run 'bindkey "^Gu" split-undo'
zletest $'one\C-gutwo\eu'
0:split the undo sequence
>BUFFER: one
>CURSOR: 2
zletest $'one two\ebmt3|`tx``'
0:setting mark and returning to original position
>BUFFER: one wo
>CURSOR: 2
%clean
zmodload -ui zsh/zpty
|