diff --git a/ChangeLog b/ChangeLog index 12dd260f3d3d12521b4fa91b10d96e2e39e69ef7..a369db18faff42f2bc42ebab0f8fdcc82d7a8820 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2015-04-25 Benno Schulenberg <bensberg@justemail.net> * src/search.c (do_replace_loop): Remove the unintended special case for replacing multiple occurrences of a literal ^ or $. + * src/search.c (findnextstr): Delete an always-FALSE parameter. 2015-04-21 Benno Schulenberg <bensberg@justemail.net> * src/browser.c (findnextfile): Save the settings of the global diff --git a/src/proto.h b/src/proto.h index b786e1180eefbff414a3471fbf8a4b0244cd67a4..4e8d13ad0bd4f442578b71f4c1e7843f7e7baed5 100644 --- a/src/proto.h +++ b/src/proto.h @@ -584,8 +584,8 @@ bool findnextstr( #ifndef DISABLE_SPELLER bool whole_word, #endif - bool no_sameline, const filestruct *begin, size_t begin_x, const - char *needle, size_t *needle_len); + const filestruct *begin, size_t begin_x, + const char *needle, size_t *needle_len); void findnextstr_wrap_reset(void); void do_search(void); #if !defined(NANO_TINY) || !defined(DISABLE_BROWSER) diff --git a/src/search.c b/src/search.c index 94d37d6630a418c982ec78fb8f10bcd132fd201f..b3c4971059d3f0121d492d37a7a6ad5a146c6d2b 100644 --- a/src/search.c +++ b/src/search.c @@ -249,8 +249,7 @@ int search_init(bool replacing, bool use_answer) return 0; } -/* Look for needle, starting at (current, current_x). If no_sameline is - * TRUE, skip over begin when looking for needle. begin is the line +/* Look for needle, starting at (current, current_x). begin is the line * where we first started searching, at column begin_x. The return * value specifies whether we found anything. If we did, set needle_len * to the length of the string we found if it isn't NULL. */ @@ -258,8 +257,8 @@ bool findnextstr( #ifndef DISABLE_SPELLER bool whole_word, #endif - bool no_sameline, const filestruct *begin, size_t begin_x, const - char *needle, size_t *needle_len) + const filestruct *begin, size_t begin_x, + const char *needle, size_t *needle_len) { size_t found_len; /* The length of the match we find. */ @@ -324,17 +323,11 @@ bool findnextstr( fileptr->data, word); free(word); } -#endif /* If we're searching for whole words and this potential - * match isn't a whole word, or if we're not allowed to find - * a match on the same line we started on and this potential - * match is on that line, continue searching. */ - if ( -#ifndef DISABLE_SPELLER - (!whole_word || found_whole) && + * match isn't a whole word, continue searching. */ + if (!whole_word || found_whole) #endif - (!no_sameline || fileptr != openfile->current)) break; } @@ -467,7 +460,7 @@ void do_search(void) #ifndef DISABLE_SPELLER FALSE, #endif - FALSE, openfile->current, openfile->current_x, answer, NULL); + openfile->current, openfile->current_x, answer, NULL); /* If we found something, and we're back at the exact same spot where * we started searching, then this is the only occurrence. */ @@ -504,8 +497,7 @@ void do_research(void) #ifndef DISABLE_SPELLER FALSE, #endif - FALSE, openfile->current, openfile->current_x, - last_search, NULL); + openfile->current, openfile->current_x, last_search, NULL); /* If we found something, and we're back at the exact same spot * where we started searching, then this is the only occurrence. */ @@ -665,7 +657,7 @@ ssize_t do_replace_loop( #ifndef DISABLE_SPELLER whole_word, #endif - FALSE, real_current, *real_current_x, needle, &match_len)) { + real_current, *real_current_x, needle, &match_len)) { int i = 0; #ifndef NANO_TINY diff --git a/src/text.c b/src/text.c index 583c8ccd4af6fb3da0a85bdea57d77535fce5269..245d0e64386e0273f65e5591d5cc699377235c99 100644 --- a/src/text.c +++ b/src/text.c @@ -2389,8 +2389,7 @@ bool do_int_spell_fix(const char *word) /* Find the first whole occurrence of word. */ findnextstr_wrap_reset(); - while (findnextstr(TRUE, FALSE, openfile->fileage, 0, word, - &match_len)) { + while (findnextstr(TRUE, openfile->fileage, 0, word, &match_len)) { if (is_whole_word(openfile->current_x, openfile->current->data, word)) { size_t xpt = xplustabs();