zsh-workers
 help / color / mirror / code / Atom feed
* Space in interactive menu select
@ 2018-07-01  6:25 Thayne
  2018-07-01  9:44 ` Mikael Magnusson
  0 siblings, 1 reply; 4+ messages in thread
From: Thayne @ 2018-07-01  6:25 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]

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.

Thayne McCombs

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

* Re: Space in interactive menu select
  2018-07-01  6:25 Space in interactive menu select Thayne
@ 2018-07-01  9:44 ` Mikael Magnusson
  2018-07-01 15:18   ` Thayne
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2018-07-01  9:44 UTC (permalink / raw)
  To: Thayne; +Cc: zsh workers

On Sun, Jul 1, 2018 at 8:25 AM, Thayne <astrothayne@gmail.com> 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


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

* Re: Space in interactive menu select
  2018-07-01  9:44 ` Mikael Magnusson
@ 2018-07-01 15:18   ` Thayne
  2018-07-02  5:11     ` Thayne
  0 siblings, 1 reply; 4+ messages in thread
From: Thayne @ 2018-07-01 15:18 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh workers

[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]

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@gmail.com> wrote:

> On Sun, Jul 1, 2018 at 8:25 AM, Thayne <astrothayne@gmail.com> 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
>

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

* Re: Space in interactive menu select
  2018-07-01 15:18   ` Thayne
@ 2018-07-02  5:11     ` Thayne
  0 siblings, 0 replies; 4+ messages in thread
From: Thayne @ 2018-07-02  5:11 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh workers

[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]

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@gmail.com> 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@gmail.com> wrote:
>
>> On Sun, Jul 1, 2018 at 8:25 AM, Thayne <astrothayne@gmail.com> 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
>>
>

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

end of thread, other threads:[~2018-07-02  5:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-01  6:25 Space in interactive menu select Thayne
2018-07-01  9:44 ` Mikael Magnusson
2018-07-01 15:18   ` Thayne
2018-07-02  5:11     ` Thayne

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).