Placing some comments better and unwrapping some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5146 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
a4f28694c8
commit
cb776fad88
|
@ -1,5 +1,6 @@
|
||||||
2015-03-21 Benno Schulenberg <bensberg@justemail.net>
|
2015-03-21 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/text.c (do_alt_speller): Remove some leftovers.
|
* src/text.c (do_alt_speller): Remove some leftovers.
|
||||||
|
* src/search.c: Place some comments better and unwrap some lines.
|
||||||
|
|
||||||
2015-03-21 Mark Majeres <mark@engine12.com>
|
2015-03-21 Mark Majeres <mark@engine12.com>
|
||||||
* src/text.c (do_alt_speller): Restore the positions of the mark
|
* src/text.c (do_alt_speller): Restore the positions of the mark
|
||||||
|
|
30
src/search.c
30
src/search.c
|
@ -161,8 +161,7 @@ int search_init(bool replacing, bool use_answer)
|
||||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||||
|
|
||||||
buf = charalloc(strlen(disp) + 7);
|
buf = charalloc(strlen(disp) + 7);
|
||||||
/* We use (COLS / 3) here because we need to see more on the
|
/* We use (COLS / 3) here because we need to see more on the line. */
|
||||||
* line. */
|
|
||||||
sprintf(buf, " [%s%s]", disp,
|
sprintf(buf, " [%s%s]", disp,
|
||||||
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
(strlenpt(last_search) > COLS / 3) ? "..." : "");
|
||||||
free(disp);
|
free(disp);
|
||||||
|
@ -347,8 +346,8 @@ bool findnextstr(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We've finished processing the file, so get out. */
|
|
||||||
if (search_last_line) {
|
if (search_last_line) {
|
||||||
|
/* We've finished processing the file, so get out. */
|
||||||
not_found_msg(needle);
|
not_found_msg(needle);
|
||||||
disable_nodelay();
|
disable_nodelay();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -367,9 +366,8 @@ bool findnextstr(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We've reached the start or end of the buffer, so wrap
|
|
||||||
* around. */
|
|
||||||
if (fileptr == NULL) {
|
if (fileptr == NULL) {
|
||||||
|
/* We've reached the start or end of the buffer, so wrap around. */
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (ISSET(BACKWARDS_SEARCH)) {
|
if (ISSET(BACKWARDS_SEARCH)) {
|
||||||
fileptr = openfile->filebot;
|
fileptr = openfile->filebot;
|
||||||
|
@ -384,8 +382,8 @@ bool findnextstr(
|
||||||
statusbar(_("Search Wrapped"));
|
statusbar(_("Search Wrapped"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We've reached the original starting line. */
|
|
||||||
if (fileptr == begin)
|
if (fileptr == begin)
|
||||||
|
/* We've reached the original starting line. */
|
||||||
search_last_line = TRUE;
|
search_last_line = TRUE;
|
||||||
|
|
||||||
rev_start = fileptr->data;
|
rev_start = fileptr->data;
|
||||||
|
@ -445,8 +443,7 @@ void do_search(void)
|
||||||
i = search_init(FALSE, FALSE);
|
i = search_init(FALSE, FALSE);
|
||||||
|
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||||
* failed. */
|
|
||||||
search_replace_abort();
|
search_replace_abort();
|
||||||
else if (i == -2)
|
else if (i == -2)
|
||||||
/* Replace. */
|
/* Replace. */
|
||||||
|
@ -740,12 +737,10 @@ ssize_t do_replace_loop(
|
||||||
* beginning line already, and we're still on the beginning line
|
* beginning line already, and we're still on the beginning line
|
||||||
* after the search, it means that we've wrapped around, so
|
* after the search, it means that we've wrapped around, so
|
||||||
* we're done. */
|
* we're done. */
|
||||||
if (bol_or_eol && begin_line && openfile->current ==
|
if (bol_or_eol && begin_line && openfile->current == real_current)
|
||||||
real_current)
|
|
||||||
break;
|
break;
|
||||||
/* Otherwise, set the begin_line flag if we've found a match on
|
/* Otherwise, set the begin_line flag if we've found a match on
|
||||||
* the beginning line, reset the bol_or_eol flag, and
|
* the beginning line, reset the bol_or_eol flag, and continue. */
|
||||||
* continue. */
|
|
||||||
else {
|
else {
|
||||||
if (openfile->current == real_current)
|
if (openfile->current == real_current)
|
||||||
begin_line = TRUE;
|
begin_line = TRUE;
|
||||||
|
@ -913,8 +908,7 @@ void do_replace(void)
|
||||||
|
|
||||||
i = search_init(TRUE, FALSE);
|
i = search_init(TRUE, FALSE);
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
/* Cancel, Go to Line, blank search string, or regcomp()
|
/* Cancel, Go to Line, blank search string, or regcomp() failed. */
|
||||||
* failed. */
|
|
||||||
search_replace_abort();
|
search_replace_abort();
|
||||||
return;
|
return;
|
||||||
} else if (i == -2) {
|
} else if (i == -2) {
|
||||||
|
@ -951,8 +945,7 @@ void do_replace(void)
|
||||||
edit_refresh, _("Replace with"));
|
edit_refresh, _("Replace with"));
|
||||||
|
|
||||||
#ifndef DISABLE_HISTORIES
|
#ifndef DISABLE_HISTORIES
|
||||||
/* Add this replace string to the replace history list. i == 0
|
/* If the replace string is not "", add it to the replace history list. */
|
||||||
* means that the string is not "". */
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
update_history(&replace_history, answer);
|
update_history(&replace_history, answer);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1085,7 +1078,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||||
/* If allow_update is TRUE, update the screen. */
|
/* If allow_update is TRUE, update the screen. */
|
||||||
if (allow_update) {
|
if (allow_update) {
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
|
|
||||||
display_main_list();
|
display_main_list();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1144,8 +1136,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||||
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
|
mbrevstrpbrk(fileptr->data, bracket_set, rev_start) :
|
||||||
mbstrpbrk(rev_start, bracket_set));
|
mbstrpbrk(rev_start, bracket_set));
|
||||||
|
|
||||||
/* We've found a potential match. */
|
|
||||||
if (found != NULL)
|
if (found != NULL)
|
||||||
|
/* We've found a potential match. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
|
@ -1156,8 +1148,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
|
||||||
current_y_find++;
|
current_y_find++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We've reached the start or end of the buffer, so get out. */
|
|
||||||
if (fileptr == NULL)
|
if (fileptr == NULL)
|
||||||
|
/* We've reached the start or end of the buffer, so get out. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
rev_start = fileptr->data;
|
rev_start = fileptr->data;
|
||||||
|
|
Loading…
Reference in New Issue