when doing history string tab completion, skip over an exact match
unless it's the only match, as the old history code did git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2643 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
33d07ef055
commit
d2edb8a538
16
src/search.c
16
src/search.c
|
@ -1268,26 +1268,34 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
|
|||
|
||||
assert(hage != NULL && hbot != NULL);
|
||||
|
||||
/* Search the history list from the entry after the current
|
||||
* position to the bottom for a match of len characters. */
|
||||
/* Search the history list from the current position to the
|
||||
* bottom for a match of len characters. Skip over an exact
|
||||
* match. */
|
||||
p = find_history((*h)->next, hbot, s, len);
|
||||
|
||||
while (p != NULL && strcmp(p->data, s) == 0)
|
||||
p = find_history(p->next, hbot, s, len);
|
||||
|
||||
if (p != NULL) {
|
||||
*h = p;
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
/* Search the history list from the top to the current position
|
||||
* for a match of len characters. */
|
||||
* for a match of len characters. Skip over an exact match. */
|
||||
p = find_history(hage, *h, s, len);
|
||||
|
||||
while (p != NULL && strcmp(p->data, s) == 0)
|
||||
p = find_history(p->next, *h, s, len);
|
||||
|
||||
if (p != NULL) {
|
||||
*h = p;
|
||||
return (*h)->data;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're here, we didn't find a match, or len is 0. Return s. */
|
||||
/* If we're here, we didn't find a match, we didn't find an inexact
|
||||
* match, or len is 0. Return s. */
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue