From: Chris Allegretta Date: Mon, 21 Jan 2002 20:40:14 +0000 (+0000) Subject: - search.c:do_search() - Check position of cursor and return value of findnextstr... X-Git-Tag: v1.1.6~12 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1c2fddcb402fc2dc5a640fc187a516c138b505d1;p=nano.git - search.c:do_search() - Check position of cursor and return value of findnextstr and tell user if search string only occurs once (Rocco & Chris) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1029 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 7b871473..21fbcf98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,6 +58,9 @@ CVS code - parse_next_word() - Added support for "\ ", in word parsing. - search.c: + do_search() + - Check position of cursor and return value of findnextstr and + tell user if search string only occurs once (Rocco & Chris). findnextstr() - Fix off by one in check for wrap around (Rocco Corsi). - winio.c: diff --git a/search.c b/search.c index 7afe28e5..cfe1ce98 100644 --- a/search.c +++ b/search.c @@ -412,7 +412,8 @@ void search_abort(void) int do_search(void) { int i; - filestruct *fileptr = current; + filestruct *fileptr = current, *didfind; + int fileptr_x = current_x; wrap_reset(); i = search_init(0); @@ -449,8 +450,14 @@ int do_search(void) last_search = mallocstrcpy(last_search, answer); search_last_line = 0; - findnextstr(FALSE, FALSE, current, current_x, answer); + didfind = findnextstr(FALSE, FALSE, current, current_x, answer); + + if ((fileptr == current) && (fileptr_x == current_x) && + didfind != NULL) + statusbar(_("This is the only occurrence")); + search_abort(); + return 1; }