commit 13ec5d8ce983c3a474ecb2c3ae6e09bcb5c1b3bc
parent 30591c5e01bca3a270e36f9f3e6d4864443c2e9c
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sat, 10 Dec 2016 13:20:06 +0100
spelling: correctly restore the selected region
An added magic linefeed should be removed again /before/ restoring
the x position, as the latter needs to be calculated from the real
last line of the region.
This fixes https://savannah.gnu.org/bugs/?49817.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -3044,6 +3044,11 @@ const char *do_alt_speller(char *tempfile_name)
#ifndef NANO_TINY
if (old_mark_set) {
filestruct *top_save = openfile->fileage;
+
+ /* If a magicline was added, remove it again. */
+ if (added_magicline)
+ remove_magicline();
+
/* Adjust the end point of the marked region for any change in
* length of the region's last line. */
if (right_side_up)
@@ -3051,10 +3056,6 @@ const char *do_alt_speller(char *tempfile_name)
else
openfile->mark_begin_x = strlen(openfile->filebot->data);
- /* If a magicline was added, remove it again. */
- if (added_magicline)
- remove_magicline();
-
/* Unpartition the filestruct so that it contains all the text
* again. Note that we've replaced the marked text originally
* in the partition with the spell-checked marked text in the