1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-04 06:14:50 +01:00
zsh/Test/X03zlebindkey.ztst
Peter Stephenson 0bd903abca 37405: Fix self-insert binding for multibyte sequences.
This makes it work even if the self-insert applies to a sequence longer
than an initial byte, including the case of a complete binding to a full
character sequence.
2015-12-15 12:41:20 +00:00

52 lines
1.1 KiB
Text

# Tests of the vi mode of ZLE
%prep
ZSH_TEST_LANG=
langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
$(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
for LANG in $langs; do
if [[ é = ? ]]; then
ZSH_TEST_LANG=$LANG
break;
fi
done
if [[ $OSTYPE = cygwin ]]; then
ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
elif ( zmodload zsh/zpty 2>/dev/null ); then
. $ZTST_srcdir/comptest
comptestinit -z $ZTST_testdir/../Src/zsh
else
ZTST_unimplemented="the zsh/zpty module is not available"
fi
%test
zpty_run 'bindkey -s "\C-xy" foo'
zletest $'\C-xy'
zpty_run 'bindkey -r "\C-xy"'
0:bindkey -s
>BUFFER: foo
>CURSOR: 3
if [[ -z $ZSH_TEST_LANG ]]; then
ZTST_skip="bindkey multibyte test skipped"
else
zpty_run 'alias unbind="bindkey -r ホ"'
zpty_run 'bindkey -s ホ bar'
zletest 'ホ'
zpty_run unbind
zletest 'ホ'
zpty_run 'bindkey ホ self-insert'
zletest 'ホ'
zpty_run unbind
zletest 'ホ'
fi
0:bindkey -s multibyte characters
>BUFFER: bar
>CURSOR: 3
>BUFFER: ホ
>CURSOR: 1
>BUFFER: ホ
>CURSOR: 1
>BUFFER: ホ
>CURSOR: 1