+2015-03-27 Mark Majeres <mark@engine12.com>
+ * src/text.c (do_alt_speller): Adjust the end point of the marked
+ region for any change in length of the region's last line.
+
2015-03-27 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/patch.nanorc: Recognize also Debian package diffs.
Fixes https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1300565
/* Whether we added a magicline after filebot. */
filestruct *top, *bot;
size_t top_x, bot_x;
+ bool right_side_up = FALSE;
ssize_t mb_lineno_save = 0;
/* We're going to close the current file, and open the output of
* the alternate spell command. The line that mark_begin points
* added when we're done correcting misspelled words; and
* turn the mark off. */
mark_order((const filestruct **)&top, &top_x,
- (const filestruct **)&bot, &bot_x, NULL);
+ (const filestruct **)&bot, &bot_x, &right_side_up);
filepart = partition_filestruct(top, top_x, bot, bot_x);
if (!ISSET(NO_NEWLINES))
added_magicline = (openfile->filebot->data[0] != '\0');
#ifndef NANO_TINY
if (old_mark_set) {
filestruct *top_save = openfile->fileage;
+ /* Adjust the end point of the marked region for any change in
+ length of the region's last line. */
+ if (right_side_up)
+ current_x_save = strlen(openfile->filebot->data);
+ else
+ openfile->mark_begin_x = strlen(openfile->filebot->data);
/* If the mark was on, the NO_NEWLINES flag isn't set, and we
* added a magicline, remove it now. */
openfile->totsize = totsize_save;
/* Assign mark_begin to the line where the mark began before. */
- goto_line_posx(mb_lineno_save, openfile->mark_begin_x);
- openfile->mark_begin = openfile->current;
-
- /* Assign mark_begin_x to the location in mark_begin where the
- * mark began before, adjusted for any shortening of the
- * line. */
- openfile->mark_begin_x = openfile->current_x;
+ openfile->mark_begin = fsfromline(mb_lineno_save);
/* Turn the mark back on. */
openfile->mark_set = TRUE;