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

Re: shared history but recalling history in current terminal



Am 28.11.2013 02:05, schrieb Bart Schaefer:
> On Nov 27,  8:08pm, René 'Necoro' Neumann wrote:
>> Subject: Re: shared history but recalling history in current terminal
>>
>> Am 27.11.2013 09:02, schrieb Bart Schaefer:
>>>
>>> zle-line-init() { zle set-local-history 1 }
>>> zle -N zle-line-init
>>>
>>> zle-keymap-select() {
>>>     [[ $KEYMAP = isearch ]]
>>>     zle set-local-history $?
>>> }
>>> zle -N zle-keymap-select
>>
>> Unfortunately, this seems only to work when not doing a 'RETURN' without
>> command in a session
> 
> Hmm.  The behavior you are describing would seem to imply either that
> you've omitted the "1" argument to set-local-history, or that it is
> being ignored and set-local-history is simply toggling the state each
> time it is called.
> 
> And indeed GDB confirms that passing the argument does not have the
> expected effect.
> 
> Workaround is:
> 
>     zle-line-init() { NUMERIC=1 zle set-local-history }
>     zle-keymap-select() {
>       [[ $KEYMAP = isearch ]]
>       NUMERIC=$? zle set-local-history
>     }
> 
> The documentation says "set it with the numeric argument" so I'm not sure
> if this is just Wayne's misunderstanding or if zle_hist.c needs a patch.
> 

Hmm. Thanks. This works now in that there is no interleaving. But
interleaving is not switched on when entering incremental search. For
fun I put the following in:

zle-isearch-update() { zle -M "$KEYMAP"; }
zle -N zle-isearch-update

And this always prints 'main'. Is this a bug? (I'm running 5.0.2 here)

- René



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