zsh-workers
 help / color / mirror / code / Atom feed
* Question about _history-complete-older
@ 2012-01-26 19:10 Bernhard Tittelbach
  2012-01-27  7:51 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Bernhard Tittelbach @ 2012-01-26 19:10 UTC (permalink / raw)
  To: zsh-workers

Hi,

It seems to me that the functions _history-complete-newer and
_history-complete-older do the reciprocal opposite of what their names
would indicate.

In my zsh version 4.3.11, _history-complete-newer  completes a word from
the history, beginning with the oldest words in the history,
while _history-complete-older completes a word from history starting
with the most recent entries.

Could this possibly be a bug ? :-)

This is especially bothersome when considering the default keybindings:
"^[," _history-complete-newer
"^[/" _history-complete-older

Completing a word from recent history seem to me to be the most common
use case, but while 'm' ',' and '.'  are next to each other on most
keyboard layouts, '/' is seldom reachable without holding the Shift key
(in addition to the Esc-Key for the keybinding) on non-english keyboard
layouts.

regards,
Bernhard


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

* Re: Question about _history-complete-older
  2012-01-26 19:10 Question about _history-complete-older Bernhard Tittelbach
@ 2012-01-27  7:51 ` Bart Schaefer
  2012-01-27 15:17   ` Bernhard Tittelbach
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2012-01-27  7:51 UTC (permalink / raw)
  To: zsh-workers

On Jan 26,  8:10pm, Bernhard Tittelbach wrote:
}
} In my zsh version 4.3.11, _history-complete-newer  completes a word from
} the history, beginning with the oldest words in the history,
} while _history-complete-older completes a word from history starting
} with the most recent entries.

That's because they wrap around if they don't find anything.  So if
you do "newer" starting from the end, it will immediately find nothing
and then wrap to the beginning and start from there; similarly "older" 
from the end (most recent) will work backward from there.

Thus "newer" and "older" are relative to the entry on which you start
searching, not relative to each other; they refer to the direction of
the search, not to the recency of the entries they find.

If you don't want it to wrap around, you set the "stop" style:

stop
     If set to `true', the _history_complete_word bindable command will
     stop once when reaching the beginning or end of the history.
     Invoking _history_complete_word will then wrap around to the
     opposite end of the history.  If this style is set to `false' (the
     default), _history_complete_word will loop immediately as in a
     menu completion.

There ought to be an example for this, but there isn't, so:

    zstyle :completion:*:history-words stop yes

Also the I see the description for the "list" style is incorrect;
it says:

     The context always starts with `:completion:history-words'.

In fact the context always starts with :completion: and always ENDS
with :history-words, but there may be more context in between.


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

* Re: Question about _history-complete-older
  2012-01-27  7:51 ` Bart Schaefer
@ 2012-01-27 15:17   ` Bernhard Tittelbach
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Tittelbach @ 2012-01-27 15:17 UTC (permalink / raw)
  To: zsh-workers

On 2012-01-27 08:51, Bart Schaefer wrote:
> On Jan 26,  8:10pm, Bernhard Tittelbach wrote:
> }
> } In my zsh version 4.3.11, _history-complete-newer  completes a word from
> } the history, beginning with the oldest words in the history,
> } while _history-complete-older completes a word from history starting
> } with the most recent entries.
> 
> That's because they wrap around if they don't find anything.  So if
> you do "newer" starting from the end, it will immediately find nothing
> and then wrap to the beginning and start from there; similarly "older" 
> from the end (most recent) will work backward from there.
> 
> Thus "newer" and "older" are relative to the entry on which you start
> searching, not relative to each other; they refer to the direction of
> the search, not to the recency of the entries they find.


Thanks for clarifying :)

regards,
Bernhard


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

end of thread, other threads:[~2012-01-27 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26 19:10 Question about _history-complete-older Bernhard Tittelbach
2012-01-27  7:51 ` Bart Schaefer
2012-01-27 15:17   ` Bernhard Tittelbach

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