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

Re: Space in interactive menu select



FYI, I'd be happy to help implement a fix if someone pointed me to the
right area of the codebase.
Thayne McCombs


On Sun, Jul 1, 2018 at 9:18 AM Thayne <astrothayne@xxxxxxxxx> wrote:

> That's true. It should probably act deferently if the space is quoted or
> escaped.
>
> On Sun, Jul 1, 2018, 03:44 Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
>> On Sun, Jul 1, 2018 at 8:25 AM, Thayne <astrothayne@xxxxxxxxx> wrote:
>> > With the following (minimal) .zshrc:
>> >
>> > zmodload zsh/complist
>> > zstyle ':completion:*' menu select yes interactive
>> > autoload -Uz compinit
>> > compinit
>> >
>> > If I finish the word that is being completed myself, then press space,
>> it
>> > starts completing for the next word, but if I then accept a completion
>> for
>> > that word, it then replaces *both* words that I typed during completion.
>> > https://asciinema.org/a/189304 shows an illustration of this.
>> >
>> > This is very unexpected behaviour. I would expect pressing a space
>> during
>> > interactive menu selection to stop the current completion and insert a
>> > space after what has been typed so far. Or at least that is how I would
>> > like it to happen, but as far as I can tell there isn't a way to
>> accomplish
>> > that.
>> >
>> > I have tried using `bindkey -M menuselect ' ' self-insert`, but that
>> > doesn't make a difference. `bindkey -M menuselect ' ' accept-line`
>> makes it
>> > so a space is treated the same as enter, which is less surprising, but
>> is a
>> > little annoying if I start the completion, realize that the completion
>> > doesn't have the option I actually need, type the real option, then
>> press
>> > space.
>> >
>> > I've also tried creating a custom zle widget that calls `zle send-break`
>> > and then `zle self-insert`. And bind space to that widget, but that
>> doesn't
>> > work either (it looks like it acts the same as `accept-line`.
>> >
>> > This seems like a bug to me.
>>
>> You can't really just treat the space key as a special case here,
>> consider completion inside a quote which won't end the current word.
>>
>> --
>> Mikael Magnusson
>>
>


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