Cycling through the tab-completion items from newest to oldest.
This fixes Savannah bug #47205. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5752 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
e2b6572e9a
commit
036c5f9c1f
|
@ -4,6 +4,8 @@
|
||||||
a semicolon instead of a comma between phrases.
|
a semicolon instead of a comma between phrases.
|
||||||
* src/text.c (do_cutword): Don't put cut words into the cutbuffer --
|
* src/text.c (do_cutword): Don't put cut words into the cutbuffer --
|
||||||
that is: treat the deletion of words like pressing Backspace/Delete.
|
that is: treat the deletion of words like pressing Backspace/Delete.
|
||||||
|
* src/search.c (get_history_completion, find_history): Cycle through
|
||||||
|
the items from newest to oldest. This fixes Savannah bug #47205.
|
||||||
|
|
||||||
2016-03-19 Benno Schulenberg <bensberg@justemail.net>
|
2016-03-19 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/search.c (search_init): Always remember the last typed string,
|
* src/search.c (search_init): Always remember the last typed string,
|
||||||
|
|
19
src/search.c
19
src/search.c
|
@ -1207,7 +1207,7 @@ filestruct *find_history(const filestruct *h_start, const filestruct
|
||||||
{
|
{
|
||||||
const filestruct *p;
|
const filestruct *p;
|
||||||
|
|
||||||
for (p = h_start; p != h_end->next && p != NULL; p = p->next) {
|
for (p = h_start; p != h_end->prev && p != NULL; p = p->prev) {
|
||||||
if (strncmp(s, p->data, len) == 0)
|
if (strncmp(s, p->data, len) == 0)
|
||||||
return (filestruct *)p;
|
return (filestruct *)p;
|
||||||
}
|
}
|
||||||
|
@ -1234,7 +1234,7 @@ void update_history(filestruct **h, const char *s)
|
||||||
assert(hage != NULL && hbot != NULL);
|
assert(hage != NULL && hbot != NULL);
|
||||||
|
|
||||||
/* If this string is already in the history, delete it. */
|
/* If this string is already in the history, delete it. */
|
||||||
p = find_history(*hage, *hbot, s, strlen(s));
|
p = find_history(*hbot, *hage, s, strlen(s));
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
filestruct *foo, *bar;
|
filestruct *foo, *bar;
|
||||||
|
@ -1337,25 +1337,24 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
|
||||||
|
|
||||||
assert(hage != NULL && hbot != NULL);
|
assert(hage != NULL && hbot != NULL);
|
||||||
|
|
||||||
/* Search the history list from the current position to the
|
/* Search the history list from the current position to the top
|
||||||
* bottom for a match of len characters. Skip over an exact
|
* for a match of len characters. Skip over an exact match. */
|
||||||
* match. */
|
p = find_history((*h)->prev, hage, s, len);
|
||||||
p = find_history((*h)->next, hbot, s, len);
|
|
||||||
|
|
||||||
while (p != NULL && strcmp(p->data, s) == 0)
|
while (p != NULL && strcmp(p->data, s) == 0)
|
||||||
p = find_history(p->next, hbot, s, len);
|
p = find_history(p->prev, hage, s, len);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
*h = p;
|
*h = p;
|
||||||
return mallocstrcpy(s, (*h)->data);
|
return mallocstrcpy(s, (*h)->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the history list from the top to the current position
|
/* Search the history list from the bottom to the current position
|
||||||
* for a match of len characters. Skip over an exact match. */
|
* for a match of len characters. Skip over an exact match. */
|
||||||
p = find_history(hage, *h, s, len);
|
p = find_history(hbot, *h, s, len);
|
||||||
|
|
||||||
while (p != NULL && strcmp(p->data, s) == 0)
|
while (p != NULL && strcmp(p->data, s) == 0)
|
||||||
p = find_history(p->next, *h, s, len);
|
p = find_history(p->prev, *h, s, len);
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
*h = p;
|
*h = p;
|
||||||
|
|
Loading…
Reference in New Issue