From: David Lawrence Ramsey Date: Fri, 8 Oct 2004 15:35:33 +0000 (+0000) Subject: in mark_order(), add check for MARK_ISSET's not being set; also make one X-Git-Tag: v1.3.5~146 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7cfea8bb8ce4bd7e87a8d40492d1271268389c3f;p=nano.git in mark_order(), add check for MARK_ISSET's not being set; also make one more int -> bool conversion and cosmetic fix git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1974 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index a61e0e2b..60805692 100644 --- a/ChangeLog +++ b/ChangeLog @@ -154,6 +154,9 @@ 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 93ee44ae..376b34ac 100644 --- a/src/files.c +++ b/src/files.c @@ -1719,7 +1719,7 @@ int write_marked(const char *name, int tmp, int append) int retval = -1; filestruct *fileagebak = fileage; filestruct *filebotbak = filebot; - int oldmod = ISSET(MODIFIED); + bool old_modified = ISSET(MODIFIED); /* write_file() unsets the MODIFIED flag. */ size_t topx; /* The column of the beginning of the mark. */ @@ -1730,7 +1730,7 @@ int write_marked(const char *name, int tmp, int append) /* The location of the character we nulled. */ if (!ISSET(MARK_ISSET)) - return -1; + return retval; /* Set fileage as the top of the mark, and filebot as the bottom. */ if (current->lineno > mark_beginbuf->lineno || @@ -1763,7 +1763,7 @@ int write_marked(const char *name, int tmp, int append) *origcharloc = origchar; fileage = fileagebak; filebot = filebotbak; - if (oldmod) + if (old_modified) set_modified(); return retval; diff --git a/src/utils.c b/src/utils.c index d3d8e32c..25c0d63c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -441,6 +441,10 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct **bot, size_t *bot_x) { 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) { *top = mark_beginbuf;