From a37ebcf2f88ad9eadec7fc9221c8443e05edaa81 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 23 Mar 2015 17:12:49 +0000 Subject: [PATCH] Not unsetting the mark before the possible bailout for zero size. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5156 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/text.c | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 54af3501..89f0b4e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ an error when the marked region is zero bytes long. The message is not needed -- it gets printed by the caller. This generalizes the fix for Savannah bug #29393. + * src/text.c (do_alt_speller): Do not unset the mark before the + possible bailout because of a zero-sized region. 2015-03-22 Chris Allegretta * src/text.c (do_alt_speller): timestamp can just be a __time_t. diff --git a/src/text.c b/src/text.c index 816f7616..5d07752a 100644 --- a/src/text.c +++ b/src/text.c @@ -2683,13 +2683,6 @@ const char *do_alt_speller(char *tempfile_name) size_t totsize_save = openfile->totsize; /* Our saved value of totsize, used when we spell-check a marked * selection. */ - - if (old_mark_set) { - /* If the mark is on, save the number of the line it starts on, - * and then turn the mark off. */ - mb_lineno_save = openfile->mark_begin->lineno; - openfile->mark_set = FALSE; - } #endif /* Get the timestamp and the size of the temporary file. */ @@ -2700,6 +2693,15 @@ const char *do_alt_speller(char *tempfile_name) if (spellfileinfo.st_size == 0) return NULL; +#ifndef NANO_TINY + if (old_mark_set) { + /* If the mark is on, save the number of the line it starts on, + * and then turn the mark off. */ + mb_lineno_save = openfile->mark_begin->lineno; + openfile->mark_set = FALSE; + } +#endif + endwin(); /* Set up an argument list to pass execvp(). */ -- 2.39.5