Bug 124822 - [editline] [patch] Editline's ed-search-{prev,next}-history retains previous pattern when it shouldn't
Summary: [editline] [patch] Editline's ed-search-{prev,next}-history retains previous ...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2008-06-21 13:10 UTC by James Butler
Modified: 2018-01-03 05:12 UTC (History)
0 users

See Also:

file.diff (709 bytes, patch)
2008-06-21 13:10 UTC, James Butler
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Butler 2008-06-21 13:10:06 UTC
Editline's ed-search-{prev,next}-history functions save the pattern buffer
between invocations; this means that if a history search has previously
been performed, then starting a new search with an empty line will instead
search on the previous pattern. This seems to be in conflict with editrc(5),
and is different to tcsh etc.

Fix: Clear el->el_search.patbuf if we invoke ed-search-*-history with no chars behind the cursor. The attached patch seems to work for me, though my c-fu is weak.

Patch attached with submission follows:
How-To-Repeat: With /bin/sh -E:
$ bind <C-v><up-arrow> ed-search-prev-history
$ cd
$ ls
$ l<up-arrow>
-> Finds 'ls'
-> Control-c it
$ <up-arrow>
-> Finds 'ls'
$ ls<up-arrow again>
-> Beeps - should find 'cd'
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:02 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped