diff --git a/ChangeLog b/ChangeLog index 4e337dc7d50b2750da995c306a5fa007e898541e..ce6e4832d260489d2c25a5fb3453d95cf59b62c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -265,7 +265,13 @@ CVS code - where it's used. (DLR) do_find_bracket() - Add comments and minor cleanups. (DLR) - find_history(), get_history_completion() + find_history() + - Make parameters const where possible. (DLR) + update_history() + - Don't renumber the history list starting after the entry we + found if the entry we found is at the bottom of the list. + (DLR, found by Simon Strandman) + get_history_completion() - Make parameters const where possible. (DLR) - text.c: do_word_count() diff --git a/src/files.c b/src/files.c index 92ebcedc1677373030ad493bc4fbd23035684aa1..9c23459feda8d0bd216e039b1df0208ffb4f0584 100644 --- a/src/files.c +++ b/src/files.c @@ -449,7 +449,7 @@ void read_file(FILE *f, const char *filename) if (fileptr == NULL) open_buffer(""); - /* Did we try to insert a file of 0 bytes? */ + /* Did we try to insert a file of zero bytes? */ if (num_lines != 0) { if (openfile->current != NULL) { fileptr->next = openfile->current; diff --git a/src/search.c b/src/search.c index c27feec2ab838da84e6ebc9f9154f1e85fe9b51e..d9548b0d098cab1eda6c6899b484f2547824fbdf 100644 --- a/src/search.c +++ b/src/search.c @@ -1211,11 +1211,13 @@ void update_history(filestruct **h, const char *s) bar = p->next; unlink_node(foo); delete_node(foo); - renumber(bar); + if (bar != NULL) + renumber(bar); } /* If the history is full, delete the beginning entry to make room - * for the new entry at the end. */ + * for the new entry at the end. We assume that MAX_SEARCH_HISTORY + * is greater than zero. */ if ((*hbot)->lineno == MAX_SEARCH_HISTORY + 1) { filestruct *foo = *hage;