minor cleanups
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1992 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
fc965a4869
commit
4b7e3c3efa
|
@ -100,6 +100,8 @@ CVS code -
|
||||||
do_writeout_void()
|
do_writeout_void()
|
||||||
- Call display_main_list(), for consistency with
|
- Call display_main_list(), for consistency with
|
||||||
do_insertfile_void(). (DLR)
|
do_insertfile_void(). (DLR)
|
||||||
|
write_marked()
|
||||||
|
- Remove check for MARK_ISSET's not being set. (DLR)
|
||||||
open_prevfile(), open_nextfile()
|
open_prevfile(), open_nextfile()
|
||||||
- Translate the "New Buffer" string when displaying "Switched
|
- Translate the "New Buffer" string when displaying "Switched
|
||||||
to" messages on the statusbar. (DLR)
|
to" messages on the statusbar. (DLR)
|
||||||
|
@ -182,9 +184,6 @@ CVS code -
|
||||||
wholewords, not after all other parameters. (DLR)
|
wholewords, not after all other parameters. (DLR)
|
||||||
- Maintain current_y's value when moving up or down lines so
|
- Maintain current_y's value when moving up or down lines so
|
||||||
that smooth scrolling works correctly. (DLR)
|
that smooth scrolling works correctly. (DLR)
|
||||||
- utils.c:
|
|
||||||
mark_order()
|
|
||||||
- Add check for MARK_ISSET's not being set. (DLR)
|
|
||||||
- winio.c:
|
- winio.c:
|
||||||
unget_kbinput()
|
unget_kbinput()
|
||||||
- New function used as a wrapper for ungetch(). (DLR)
|
- New function used as a wrapper for ungetch(). (DLR)
|
||||||
|
|
|
@ -1731,9 +1731,6 @@ int write_marked(const char *name, int tmp, int append)
|
||||||
char *origcharloc;
|
char *origcharloc;
|
||||||
/* The location of the character we nulled. */
|
/* The location of the character we nulled. */
|
||||||
|
|
||||||
if (!ISSET(MARK_ISSET))
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
/* Set fileage as the top of the mark, and filebot as the bottom. */
|
/* Set fileage as the top of the mark, and filebot as the bottom. */
|
||||||
if (current->lineno > mark_beginbuf->lineno ||
|
if (current->lineno > mark_beginbuf->lineno ||
|
||||||
(current->lineno == mark_beginbuf->lineno &&
|
(current->lineno == mark_beginbuf->lineno &&
|
||||||
|
|
|
@ -1471,12 +1471,12 @@ bool do_int_spell_fix(const char *word)
|
||||||
|
|
||||||
do_replace_highlight(TRUE, word);
|
do_replace_highlight(TRUE, word);
|
||||||
|
|
||||||
/* Allow the replace word to be corrected. */
|
/* Allow all instances of the word to be corrected. */
|
||||||
accepted = -1 != statusq(FALSE, spell_list, word,
|
accepted = (statusq(FALSE, spell_list, word,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
_("Edit a replacement"));
|
_("Edit a replacement")) != -1);
|
||||||
|
|
||||||
do_replace_highlight(FALSE, word);
|
do_replace_highlight(FALSE, word);
|
||||||
|
|
||||||
|
|
34
src/search.c
34
src/search.c
|
@ -268,11 +268,11 @@ bool is_whole_word(int curr_pos, const char *datastr, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for needle, starting at current, column current_x. If
|
/* Look for needle, starting at current, column current_x. If
|
||||||
* no_sameline is nonzero, skip over begin when looking for needle.
|
* no_sameline is TRUE, skip over begin when looking for needle. begin
|
||||||
* begin is the line where we first started searching, at column beginx.
|
* is the line where we first started searching, at column beginx. If
|
||||||
* If can_display_wrap is nonzero, we put messages on the statusbar, and
|
* can_display_wrap is TRUE, we put messages on the statusbar, and wrap
|
||||||
* wrap around the file boundaries. The return value specifies whether
|
* around the file boundaries. The return value specifies whether we
|
||||||
* we found anything. */
|
* found anything. */
|
||||||
bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||||
no_sameline, const filestruct *begin, size_t beginx, const char
|
no_sameline, const filestruct *begin, size_t beginx, const char
|
||||||
*needle)
|
*needle)
|
||||||
|
@ -288,12 +288,11 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||||
* will return immediately and say that no match was found, and
|
* will return immediately and say that no match was found, and
|
||||||
* rev_start will be properly set when the search continues on the
|
* rev_start will be properly set when the search continues on the
|
||||||
* previous or next line. */
|
* previous or next line. */
|
||||||
|
rev_start =
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (ISSET(REVERSE_SEARCH))
|
ISSET(REVERSE_SEARCH) ? fileptr->data + (current_x - 1) :
|
||||||
rev_start = fileptr->data + (current_x - 1);
|
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
rev_start = fileptr->data + (current_x + 1);
|
fileptr->data + (current_x + 1);
|
||||||
|
|
||||||
/* Look for needle in searchstr. */
|
/* Look for needle in searchstr. */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
|
@ -309,7 +308,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||||
if (search_last_line) {
|
if (search_last_line) {
|
||||||
if (can_display_wrap)
|
if (can_display_wrap)
|
||||||
not_found_msg(needle);
|
not_found_msg(needle);
|
||||||
return 0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
|
@ -327,7 +326,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||||
/* Start or end of buffer reached; wrap around. */
|
/* Start or end of buffer reached; wrap around. */
|
||||||
if (fileptr == NULL) {
|
if (fileptr == NULL) {
|
||||||
if (!can_display_wrap)
|
if (!can_display_wrap)
|
||||||
return 0;
|
return FALSE;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (ISSET(REVERSE_SEARCH)) {
|
if (ISSET(REVERSE_SEARCH)) {
|
||||||
|
@ -370,7 +369,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||||
|
|
||||||
if (can_display_wrap)
|
if (can_display_wrap)
|
||||||
not_found_msg(needle);
|
not_found_msg(needle);
|
||||||
return 0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set globals now that we are sure we found something. */
|
/* Set globals now that we are sure we found something. */
|
||||||
|
@ -378,7 +377,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||||
current_x = current_x_find;
|
current_x = current_x_find;
|
||||||
current_y = current_y_find;
|
current_y = current_y_find;
|
||||||
|
|
||||||
return 1;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for a string. */
|
/* Search for a string. */
|
||||||
|
@ -662,11 +661,10 @@ int do_replace_loop(const char *needle, filestruct *real_current, size_t
|
||||||
/* If we've found a match outside the marked text, skip over it
|
/* If we've found a match outside the marked text, skip over it
|
||||||
* and search for another one. */
|
* and search for another one. */
|
||||||
if (old_mark_set) {
|
if (old_mark_set) {
|
||||||
if (current->lineno < top->lineno
|
if (current->lineno < top->lineno || current->lineno >
|
||||||
|| current->lineno > bot->lineno
|
bot->lineno || (current == top && current_x < top_x) ||
|
||||||
|| (current == top && current_x < top_x)
|
(current == bot && (current_x > bot_x || current_x +
|
||||||
|| (current == bot && (current_x > bot_x ||
|
match_len > bot_x)))
|
||||||
current_x + match_len > bot_x)))
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -442,11 +442,8 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||||
{
|
{
|
||||||
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
|
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
|
||||||
|
|
||||||
if (!ISSET(MARK_ISSET))
|
if ((current->lineno == mark_beginbuf->lineno && current_x >
|
||||||
return;
|
mark_beginx) || current->lineno > mark_beginbuf->lineno) {
|
||||||
|
|
||||||
if ((current->lineno == mark_beginbuf->lineno && current_x > mark_beginx)
|
|
||||||
|| current->lineno > mark_beginbuf->lineno) {
|
|
||||||
*top = mark_beginbuf;
|
*top = mark_beginbuf;
|
||||||
*top_x = mark_beginx;
|
*top_x = mark_beginx;
|
||||||
*bot = current;
|
*bot = current;
|
||||||
|
|
Loading…
Reference in New Issue