0.2.5 make zsh-navigation-tools unusable / non-exit-able #116

Closed
ronjouch opened this Issue Feb 15, 2016 · 10 comments

3 participants

@ronjouch

(May be related to #115 , appeared at the same time)


Minimal .zshrc:

ZSH=$HOME/.oh-my-zsh
plugins=(zsh-navigation-tools zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh

Scenario:

Expected: first entry is sent to current line

Actual: nothing happens: screen flickers and zsh-navigation-tools become impossible to exit (Ctrl+C, Ctrl+D don't help)

@ronjouch ronjouch changed the title from 0.2.x make zsh-navigation-tools unusable / non-exit-able to 0.2.5 make zsh-navigation-tools unusable / non-exit-able Feb 15, 2016
@george-b

I'm seeing a similar thing when using fzf.

Can be re-produced with the following .

source $HOME/.zsh/plugins/autosuggestions/zsh-autosuggestions.zsh

fzf-history-widget() {
  LBUFFER=$(fc -l 1 | fzf +s --tac -n2..,.. | sed "s/ *[0-9*]* *//")
  zle redisplay
}
zle -N fzf-history-widget
bindkey -e '^r' fzf-history-widget

@ronjouch do you see this issue if you comment out the references to zle redisplay? It seems to prevent this for me, however the redisplay is most certainly needed. I guess something in autosuggestions may have changed how this is handled.

I will try to step through the commits in more detail when I have some time.

Edit: I can confirm this is introduced with 5e419da

@ronjouch

@george-b yeah, v0.2.5 is this single commit :)

Regarding your request for info, I'm a zsh user but my knowledge of programming zsh is very, very limited and I have no idea what you're talking about. Can you precise what you mean by "comment out the references to zle redisplay"? I have no such thing in my zshrc.

@george-b

Regarding your request for info, I'm a zsh user but my knowledge of programming zsh is very, very limited and I have no idea what you're talking about. Can you precise what you mean by "comment out the references to zle redisplay"? I have no such thing in my zshrc.

Within zsh-navigation-tools there will be invocations of zle redisplay, e.g.

You can comment these out by prefixing them with a #. These are of course needed, in my case without the redisplay output is displayed before my prompt. However with the redisplay I am simply dropped back into fzf in my case since updating to v0.2.5 of autosuggestions.

I'm sure @ericfreese has far better knowledge of zsh widget than I, hopefully this cause of this is straight forward if you find the same behavior as I do.

@ericfreese
zsh-users member

So what 0.2.5 did is bind ALL widgets not found in the CLEAR, ACCEPT, or PARTIAL_ACCEPT lists to the _zsh_autosuggest_modify function: 5e419da#diff-2a58eb2e47d1b3ee3c072d264886fc66R52

Before 0.2.5, the redisplay widget was not bound, but now it is. I believe this is the same issue as described here, and I believe the correct fix is for zsh-navigation-tools to use zle .redisplay or zle .redisplay -w.

However, it's not really feasible to expect all of these other plugins to fix how they're calling zle, so I'll try to spend some time today looking into how we can handle those cases in this codebase.

@george-b

I believe the correct fix is for zsh-navigation-tools to use zle .redisplay or zle .redisplay -w.

Thanks! I can confirm this works for me. If you don't mind me asking what does the . prefix do? I've had a skim through zshzle man page but am still left wondering.

@ericfreese
zsh-users member

No probem, glad it helps.

From http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Widgets:

Each built-in widget has two names: its normal canonical name, and the same name preceded by a ‘.’. The ‘.’ name is special: it can’t be rebound to a different widget. This makes the widget available even when its usual name has been redefined.

@ericfreese
zsh-users member

Ok, I've just pushed v0.2.6, which I believe will fix these issues by no longer referring to the $WIDGET variable. Please give that a shot.

@ericfreese ericfreese closed this Feb 15, 2016
@george-b

Ok, I've just pushed v0.2.6, which I believe will fix these issues by no longer referring to the $WIDGET variable. Please give that a shot.

It does fix this issue however it has broken tab completion. Let me know if you want me to create a new issue for this.

$ cd _main_complete:199: command not found: expand-or-complete
_main_complete:199: command not found: modify
_main_complete:199: command not found: expand-or-complete
_main_complete:199: command not found: modify
@ericfreese
zsh-users member

Shoot. Yeah, let's make a separate issue for that.

@ericfreese
zsh-users member

Ah, forgot a pesky backslash. Will push v0.2.7 to fix that momentarily.

@exAspArk exAspArk referenced this issue in junegunn/fzf Mar 31, 2016
Closed

Implement zsh autocompletion #227

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment