zsh-users
 help / color / mirror / code / Atom feed
* Please fix history-search-backward/forward
@ 2010-08-28 18:54 Felipe Contreras
  2010-08-28 20:55 ` Mikael Magnusson
  0 siblings, 1 reply; 6+ messages in thread
From: Felipe Contreras @ 2010-08-28 18:54 UTC (permalink / raw)
  To: zsh-users

Hi,

zle says:
Search backward in the history for a line beginning with the first
word in the buffer.

GNU readline says:
Search backward through the history for the string of characters
between the start of the current line and the point.

I don't see why anybody would want zle's behavior. When I type "git
check<TAB>"; I expect the whole text to be searched; if I wanted only
the first word, I would type only the first word "git <TAB>". There's
absolutely no advantage of zle's way.

Now, it possible to workaround that behavior through
history-search-end[1]. However, I would expect such basic
functionality to be a one-liner configuration, or even better, just
make zle's history-search-backward work like that by default.

Moreover, it seems nobody has found necessary to workaround readline's
behavior to mimic zle's behavior, and with good reason I think.

This is a small issue, but it would improve the initial experience of
people trying zsh.

[1] http://zsh.sourceforge.net/Doc/Release/User-Contributions.html

-- 
Felipe Contreras


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

* Re: Please fix history-search-backward/forward
  2010-08-28 18:54 Please fix history-search-backward/forward Felipe Contreras
@ 2010-08-28 20:55 ` Mikael Magnusson
  2010-08-28 22:23   ` Felipe Contreras
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2010-08-28 20:55 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: zsh-users

On 28 August 2010 20:54, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> Hi,
>
> zle says:
> Search backward in the history for a line beginning with the first
> word in the buffer.
>
> GNU readline says:
> Search backward through the history for the string of characters
> between the start of the current line and the point.
>
> I don't see why anybody would want zle's behavior. When I type "git
> check<TAB>"; I expect the whole text to be searched; if I wanted only
> the first word, I would type only the first word "git <TAB>". There's
> absolutely no advantage of zle's way.
>
> Now, it possible to workaround that behavior through
> history-search-end[1]. However, I would expect such basic
> functionality to be a one-liner configuration, or even better, just
> make zle's history-search-backward work like that by default.
>
> Moreover, it seems nobody has found necessary to workaround readline's
> behavior to mimic zle's behavior, and with good reason I think.
>
> This is a small issue, but it would improve the initial experience of
> people trying zsh.
>
> [1] http://zsh.sourceforge.net/Doc/Release/User-Contributions.html
>

I think you want history-beginning-search-backward/forward ? Changing
the effects of a widget is (and I think I can say this quite safely)
is not really an option.

-- 
Mikael Magnusson


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

* Re: Please fix history-search-backward/forward
  2010-08-28 20:55 ` Mikael Magnusson
@ 2010-08-28 22:23   ` Felipe Contreras
  2010-08-28 22:33     ` Mikael Magnusson
  0 siblings, 1 reply; 6+ messages in thread
From: Felipe Contreras @ 2010-08-28 22:23 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh-users

On Sat, Aug 28, 2010 at 11:55 PM, Mikael Magnusson <mikachu@gmail.com> wrote:
> On 28 August 2010 20:54, Felipe Contreras <felipe.contreras@gmail.com> wrote:
>> zle says:
>> Search backward in the history for a line beginning with the first
>> word in the buffer.
>>
>> GNU readline says:
>> Search backward through the history for the string of characters
>> between the start of the current line and the point.

>> [1] http://zsh.sourceforge.net/Doc/Release/User-Contributions.html
>
> I think you want history-beginning-search-backward/forward ? Changing
> the effects of a widget is (and I think I can say this quite safely)
> is not really an option.

I already mentioned history-beginning-search-backward/forward
(history-search-end), the point is not how to do that.

The point is that history-beginning-search-backward-end encompasses
the functionality of history-search-backward, so why not make
history-search-backward do the same as
history-beginning-search-backward-end, if no functionality would be
lost?

-- 
Felipe Contreras


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

* Re: Please fix history-search-backward/forward
  2010-08-28 22:23   ` Felipe Contreras
@ 2010-08-28 22:33     ` Mikael Magnusson
  2010-08-29  0:52       ` Felipe Contreras
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2010-08-28 22:33 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: zsh-users

On 29 August 2010 00:23, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> On Sat, Aug 28, 2010 at 11:55 PM, Mikael Magnusson <mikachu@gmail.com> wrote:
>> On 28 August 2010 20:54, Felipe Contreras <felipe.contreras@gmail.com> wrote:
>>> zle says:
>>> Search backward in the history for a line beginning with the first
>>> word in the buffer.
>>>
>>> GNU readline says:
>>> Search backward through the history for the string of characters
>>> between the start of the current line and the point.
>
>>> [1] http://zsh.sourceforge.net/Doc/Release/User-Contributions.html
>>
>> I think you want history-beginning-search-backward/forward ? Changing
>> the effects of a widget is (and I think I can say this quite safely)
>> is not really an option.
>
> I already mentioned history-beginning-search-backward/forward
> (history-search-end), the point is not how to do that.

history-beginning-search-backward and
history-beginning-search-backward-end are not the same. The one I
mentioned is builtin and doesn't need any autoloads.

> The point is that history-beginning-search-backward-end encompasses
> the functionality of history-search-backward, so why not make
> history-search-backward do the same as
> history-beginning-search-backward-end, if no functionality would be
> lost?

They behave differently so I'm not sure what you mean. Trying to
emulate history-search-backward behavior in
history-beginning-search-backward(-end) would involve lots of awkward
cursor movement to put it after the first word.

OTOH, if you want the default bindings for ^[p and ^[n to be changed,
I have no counter argument, but who even uses those keys for history
movement? AFAIK, no other keys are bound to these widgets by default.
(ran zsh -f and did a few alt-x where-is).

-- 
Mikael Magnusson


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

* Re: Please fix history-search-backward/forward
  2010-08-28 22:33     ` Mikael Magnusson
@ 2010-08-29  0:52       ` Felipe Contreras
  2010-08-30 17:34         ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Felipe Contreras @ 2010-08-29  0:52 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh-users

On Sun, Aug 29, 2010 at 1:33 AM, Mikael Magnusson <mikachu@gmail.com> wrote:
> On 29 August 2010 00:23, Felipe Contreras <felipe.contreras@gmail.com> wrote:
>> On Sat, Aug 28, 2010 at 11:55 PM, Mikael Magnusson <mikachu@gmail.com> wrote:
>>> On 28 August 2010 20:54, Felipe Contreras <felipe.contreras@gmail.com> wrote:
>>>> zle says:
>>>> Search backward in the history for a line beginning with the first
>>>> word in the buffer.
>>>>
>>>> GNU readline says:
>>>> Search backward through the history for the string of characters
>>>> between the start of the current line and the point.
>>
>>>> [1] http://zsh.sourceforge.net/Doc/Release/User-Contributions.html
>>>
>>> I think you want history-beginning-search-backward/forward ? Changing
>>> the effects of a widget is (and I think I can say this quite safely)
>>> is not really an option.
>>
>> I already mentioned history-beginning-search-backward/forward
>> (history-search-end), the point is not how to do that.
>
> history-beginning-search-backward and
> history-beginning-search-backward-end are not the same. The one I
> mentioned is builtin and doesn't need any autoloads.

Ah!

But this is misleading:

---
history-beginning-search-backward
Search backward in the history for a line beginning with the current
line up to the cursor.

history-search-backward
Search backward in the history for a line beginning with the first
word in the buffer.
---

So both start from the beginning, so what's the 'beginning' in the
former supposed to differentiate? Wouldn't history-cur-search-backward
make more sense? Or even better:

---
history-search-backward
Search backward in the history for a line beginning with the current
line up to the cursor.

history-word-search-backward
Search backward in the history for a line beginning with the first
word in the buffer.
---

Note: I'm only objecting to the misleading names.

-- 
Felipe Contreras


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

* Re: Please fix history-search-backward/forward
  2010-08-29  0:52       ` Felipe Contreras
@ 2010-08-30 17:34         ` Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2010-08-30 17:34 UTC (permalink / raw)
  To: zsh-users

On Aug 28,  9:54pm, Felipe Contreras wrote:
}
} zle says:
} Search backward in the history for a line beginning with the first
} word in the buffer.
} 
} GNU readline says:
} Search backward through the history for the string of characters
} between the start of the current line and the point.
} 
} I don't see why anybody would want zle's behavior.

IIRC (it's been a very long time) the expected usage was to recall the
previous history line with ctrl+p and then look backward for some other
history entry where the same command was run with different arguments.
(That's how I use it, in any case.)

However, please keep in mind that zsh was written from scratch about
20 years ago by a university student who really just wanted something
saner than csh with an emacs-like line editor.  If ZLE doesn't pre-date
readline, they're at least near-contemporaries, and zsh's command set
bears no direct relation to readline's -- in fact many zsh features
were based on (sometimes mis-)reading of emacs and ksh documentation
by someone who didn't have ksh and may (I forget) only have had the
Gosling version of emacs rather than Stallman's.

Note that for the first many years of its existence nobody who had ever
used bash was moving to zsh -- new zsh users were all coming from csh
or the old Bourne sh and had never had line editing at all, much less
have any expectation of naming congruence with readline.

Furthermore, it has always been a major tenet of zsh development that
nothing gets changed merely because a new developer has come along and
disagrees with previous design decisions.  Unlike many current OSS
projects which seem to discard the past twice a week and make all the
users adapt to something new, with zsh we've always tried very hard
to provide that someone who last used zsh a decade ago can sit down
with the latest and start running his old scripts from muscle memory
and barely notice the difference (unless he wants to).

} When I type "git check<TAB>"; I expect the whole text to be searched;

You have history-search-* bound to TAB?  What do you use for completion?

On Aug 29, 12:33am, Mikael Magnusson wrote:
} 
} On 29 August 2010 00:23, Felipe Contreras <felipe.contreras@gmail.com> wrote: 
} > The point is that history-beginning-search-backward-end encompasses
} > the functionality of history-search-backward, so why not make
} > history-search-backward do the same as
} > history-beginning-search-backward-end, if no functionality would be
} > lost?
} 
} They behave differently so I'm not sure what you mean. Trying to
} emulate history-search-backward behavior in
} history-beginning-search-backward(-end) would involve lots of awkward
} cursor movement to put it after the first word.

(See my example above about ctrl+p followed by esc-p.)

} OTOH, if you want the default bindings for ^[p and ^[n to be changed,
} I have no counter argument, but who even uses those keys for history
} movement?

Er, I do, actually.  All the time.  I also have

bindkey ^Xp history-beginning-search-backward

and use that probably slightly more often, but not a lot more often.

On Aug 29,  3:52am, Felipe Contreras wrote:
}
} Ah!
} 
} So both start from the beginning, so what's the 'beginning' in the
} former supposed to differentiate? Wouldn't history-cur-search-backward
} make more sense?

The history-search-backward widget was around for a few years before
history-beginning-search-backward was added.  A new name was needed
for the new behavior (so as not to break anyone's old zshrc) and one
was chosen that made sense at the time.


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

end of thread, other threads:[~2010-08-30 17:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-28 18:54 Please fix history-search-backward/forward Felipe Contreras
2010-08-28 20:55 ` Mikael Magnusson
2010-08-28 22:23   ` Felipe Contreras
2010-08-28 22:33     ` Mikael Magnusson
2010-08-29  0:52       ` Felipe Contreras
2010-08-30 17:34         ` Bart Schaefer

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