From: David Lawrence Ramsey Date: Fri, 15 Oct 2004 16:25:56 +0000 (+0000) Subject: minor cleanups X-Git-Tag: v1.3.5~128 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=4b7e3c3efa2bc83c22b6d357b39245b7bc6f682d;p=nano.git minor cleanups git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1992 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index fc4eb2a8..3318e0e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -100,6 +100,8 @@ CVS code - do_writeout_void() - Call display_main_list(), for consistency with do_insertfile_void(). (DLR) + write_marked() + - Remove check for MARK_ISSET's not being set. (DLR) open_prevfile(), open_nextfile() - Translate the "New Buffer" string when displaying "Switched to" messages on the statusbar. (DLR) @@ -182,9 +184,6 @@ CVS code - wholewords, not after all other parameters. (DLR) - Maintain current_y's value when moving up or down lines so that smooth scrolling works correctly. (DLR) -- utils.c: - mark_order() - - Add check for MARK_ISSET's not being set. (DLR) - winio.c: unget_kbinput() - New function used as a wrapper for ungetch(). (DLR) diff --git a/src/files.c b/src/files.c index 2ffdeb71..8211c281 100644 --- a/src/files.c +++ b/src/files.c @@ -1731,9 +1731,6 @@ int write_marked(const char *name, int tmp, int append) char *origcharloc; /* 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. */ if (current->lineno > mark_beginbuf->lineno || (current->lineno == mark_beginbuf->lineno && diff --git a/src/nano.c b/src/nano.c index 10d7eaed..0ae82646 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1471,12 +1471,12 @@ bool do_int_spell_fix(const char *word) do_replace_highlight(TRUE, word); - /* Allow the replace word to be corrected. */ - accepted = -1 != statusq(FALSE, spell_list, word, + /* Allow all instances of the word to be corrected. */ + accepted = (statusq(FALSE, spell_list, word, #ifndef NANO_SMALL NULL, #endif - _("Edit a replacement")); + _("Edit a replacement")) != -1); do_replace_highlight(FALSE, word); diff --git a/src/search.c b/src/search.c index 70b4b563..320a4f83 100644 --- a/src/search.c +++ b/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 - * no_sameline is nonzero, skip over begin when looking for needle. - * begin is the line where we first started searching, at column beginx. - * If can_display_wrap is nonzero, we put messages on the statusbar, and - * wrap around the file boundaries. The return value specifies whether - * we found anything. */ + * no_sameline is TRUE, skip over begin when looking for needle. begin + * is the line where we first started searching, at column beginx. If + * can_display_wrap is TRUE, we put messages on the statusbar, and wrap + * around the file boundaries. The return value specifies whether we + * found anything. */ bool findnextstr(bool can_display_wrap, bool wholeword, bool no_sameline, const filestruct *begin, size_t beginx, const char *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 * rev_start will be properly set when the search continues on the * previous or next line. */ + rev_start = #ifndef NANO_SMALL - if (ISSET(REVERSE_SEARCH)) - rev_start = fileptr->data + (current_x - 1); - else + ISSET(REVERSE_SEARCH) ? fileptr->data + (current_x - 1) : #endif - rev_start = fileptr->data + (current_x + 1); + fileptr->data + (current_x + 1); /* Look for needle in searchstr. */ while (TRUE) { @@ -309,7 +308,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool if (search_last_line) { if (can_display_wrap) not_found_msg(needle); - return 0; + return FALSE; } #ifndef NANO_SMALL @@ -327,7 +326,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool /* Start or end of buffer reached; wrap around. */ if (fileptr == NULL) { if (!can_display_wrap) - return 0; + return FALSE; #ifndef NANO_SMALL if (ISSET(REVERSE_SEARCH)) { @@ -370,7 +369,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool if (can_display_wrap) not_found_msg(needle); - return 0; + return FALSE; } /* 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_y = current_y_find; - return 1; + return TRUE; } /* 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 * and search for another one. */ if (old_mark_set) { - if (current->lineno < top->lineno - || current->lineno > bot->lineno - || (current == top && current_x < top_x) - || (current == bot && (current_x > bot_x || - current_x + match_len > bot_x))) + if (current->lineno < top->lineno || current->lineno > + bot->lineno || (current == top && current_x < top_x) || + (current == bot && (current_x > bot_x || current_x + + match_len > bot_x))) continue; } #endif diff --git a/src/utils.c b/src/utils.c index 0f6cf7aa..804a1d72 100644 --- a/src/utils.c +++ b/src/utils.c @@ -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); - if (!ISSET(MARK_ISSET)) - return; - - if ((current->lineno == mark_beginbuf->lineno && current_x > 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_x = mark_beginx; *bot = current;