mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-04 06:14:50 +01:00
211 lines
4.1 KiB
Text
211 lines
4.1 KiB
Text
# 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 $'long\eo s\eolong\ekjy-k'
|
|
0:yank up clears lastcol
|
|
>BUFFER: long
|
|
> s
|
|
>long
|
|
>CURSOR: 2
|
|
|
|
zletest $'long\eos\eklljyk'
|
|
0:yank up honours lastcol
|
|
>BUFFER: long
|
|
>s
|
|
>CURSOR: 2
|
|
|
|
zletest $'long\eolong\eo s\eolong\ekjd-k'
|
|
0:delete up clears lastcol
|
|
>BUFFER: long
|
|
>long
|
|
>CURSOR: 0
|
|
|
|
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
|
|
|
|
zpty_run 'bindkey -a "^P" yank-pop'
|
|
zletest $'word\C-wline\eddiSE\eP\C-P'
|
|
0:line based put before followed by character based yank-pop
|
|
>BUFFER: SwordE
|
|
>CURSOR: 4
|
|
|
|
zletest $'line\eddiword\C-w\eiSE\eP\C-P'
|
|
0:character based put before followed by line based yank-pop
|
|
>BUFFER: line
|
|
>SE
|
|
>CURSOR: 0
|
|
|
|
zletest $'one two three\C-w\C-w\C-wSE\e0p\C-P\C-P'
|
|
0:put after cycled twice with yank-pop
|
|
>BUFFER: SthreeE
|
|
>CURSOR: 5
|
|
|
|
zletest $'word\C-wline\eddiSE\ehp\C-P'
|
|
0:line based put after followed by character based yank-pop
|
|
>BUFFER: SwordE
|
|
>CURSOR: 4
|
|
|
|
zletest $'line\eddiword\C-w\eiSE\ehp\C-P'
|
|
0:character based after before followed by line based yank-pop
|
|
>BUFFER: SE
|
|
>line
|
|
>CURSOR: 3
|
|
|
|
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
|