zsh-workers
 help / color / mirror / code / Atom feed
* Bad bindkey mojo in 3.1.5
@ 1998-11-02  6:17 Bart Schaefer
  1998-11-02  9:55 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 1998-11-02  6:17 UTC (permalink / raw)
  To: zsh-workers

Take a look at this:

zagzig<106> bindkey | grep back
"^B" backward-char
"^H" backward-delete-char
"^W" "^W" "^W" "^W" "^W" "^W" "^W" "^W" backward-kill-word
"^X^P" history-beginning-search-backward
"^Xr" history-incremental-search-backward
(etc.)

It didn't look like that when I started up; a fresh zsh shows:

zagzig<3> bindkey | grep back
"^B" backward-char
"^H" backward-delete-char
"^W" backward-kill-word
"^X^P" history-beginning-search-backward
"^Xr" history-incremental-search-backward
(etc.)

Looks like "zed" tickles the bug:

zagzig<4> zed -f zed
(output omitted, typed ctrl-J)
zagzig<5> bindkey | grep back
"^B" backward-char
"^H" backward-delete-char
"^W" "^W" backward-kill-word
"^X^P" history-beginning-search-backward
"^Xr" history-incremental-search-backward
(etc.)

Every time I run "zed" I get another "^W" stuck on the front of that
binding.  They're being taken as part of the widget name:

zagzig<6> alskdjfa<C-W>
No such widget `"^W" backward-kill-word'

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bad bindkey mojo in 3.1.5
  1998-11-02  6:17 Bad bindkey mojo in 3.1.5 Bart Schaefer
@ 1998-11-02  9:55 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1998-11-02  9:55 UTC (permalink / raw)
  To: zsh-workers

"Bart Schaefer" wrote:
> Take a look at this:
> 
> zagzig<106> bindkey | grep back
> "^B" backward-char
> "^H" backward-delete-char
> "^W" "^W" "^W" "^W" "^W" "^W" "^W" "^W" backward-kill-word
> "^X^P" history-beginning-search-backward
> "^Xr" history-incremental-search-backward
> (etc.)
> 
> Looks like "zed" tickles the bug:

The problem is in zed rather than the shell.  It doesn't occur with
the zed supplied with 3.1.5, but obviously I'm using the same one as
you (or similar, anyway), though I can't remember who altered it last.
In zsh 3.1, `bindkey '^w'' produces something like

"^W" kill-region

then when this gets restored, the call is in effect

bindkey "^W" "\"^W\" kill-region"

which is obviously wrong.  Zsh didn't used to print the "^W" when you
asked for just one binding, hence the difference.

The following fixes it under the assumption that everything up to and
including 3.0.x doesn't print the key string and doesn't have -L, and
conversely from then on.  Restoring bindkeys is better taken care of
in the zed supplied with the source, but that's specific to 3.1.
I didn't put PATCH: at the top since it doesn't patch any official
version of the source.

It wouldn't be beyond the wit of man, err, person, to implement a
.zedrc which could have arbitrary bindings in it.

*** /home/user2/pws/bin/fns/zed.cw	Wed Dec  3 13:35:57 1997
--- /home/user2/pws/bin/fns/zed	Mon Nov  2 10:45:02 1998
***************
*** 8,14 ****
  # Completion: use
  # compctl -f -x 'w[1,-f]' -F -- zed
  
! local var fun ctrl_W_bind="$(bindkey '^W')" oldcompctl hist
  # We do not want timeout while we are editing a file
  integer TMOUT=0
  
--- 8,19 ----
  # Completion: use
  # compctl -f -x 'w[1,-f]' -F -- zed
  
! local var fun oldcompctl ctrl_W_bind hist
! if [[ -z $ZSH_VERSION || $ZSH_VERSION = 3.0* ]]; then
!   ctrl_W_bind="bindkey '^W' \"$(bindkey '^W')\""
! else
!   ctrl_W_bind="$(bindkey -L '^W')"
! fi
  # We do not want timeout while we are editing a file
  integer TMOUT=0
  
***************
*** 33,39 ****
  cleanup () {
    bindkey "^M" accept-line
    bindkey "^X^W" undefined-key
!   bindkey "^W" "$ctrl_W_bind"
    [[ -n $oldcompctl ]] && eval $oldcompctl
    unfunction cleanup
    [[ -z $ZSH_VERSION ]] && unsetopt nobanghist
--- 38,44 ----
  cleanup () {
    bindkey "^M" accept-line
    bindkey "^X^W" undefined-key
!   eval $ctrl_W_bind
    [[ -n $oldcompctl ]] && eval $oldcompctl
    unfunction cleanup
    [[ -z $ZSH_VERSION ]] && unsetopt nobanghist

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarotti 2, 56100 Pisa, Italy


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-11-02 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-11-02  6:17 Bad bindkey mojo in 3.1.5 Bart Schaefer
1998-11-02  9:55 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).