Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Qustions about ZLE widgets.



I started to experiment with new ZLE fetaures, and am a little confused. 
The following is supposed to create simple function which just replaces
buffer with duplicated input character, creates widget for it and binds it
to some character string:

dup_characters () {
	local char
	BUFFER="" 
	read -k char
	BUFFER="$BUFFER""$char""$char" 
	CURSOR=$#BUFFER 
}

zle -N dup_characters dup_characters

bindkey \^X\^D dup_characters

The result is slightly strange (for me at least):

case 1:

bor@itsrm1:~%> ^X^D =>
zsh: use 'logout' to logout.

case 2:

bor@itsrm1:~%> a^X^Db =>
bor@itsrm1:~%> abb
If I continue with ^X^D =>
bor@itsrm1:~%> abb <- (unprintable symbol follows, NL)
 <- cursor is here

Case 3:

bor@itsrm1:~%> aaaaa^X^Db =>
bor@itsrm1:~%> abb

I tried with and without zsh -f; the version is the latest 3.1.2-beta.

thanks in advance

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@xxxxxx
-------------------------------------------------------------------------




Messages sorted by: Reverse Date, Date, Thread, Author