]> git.wh0rd.org Git - nano.git/commitdiff
in backup_lines(), avoid a segfault when the mark begins and ends on the
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Sun, 22 Apr 2007 15:04:05 +0000 (15:04 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Sun, 22 Apr 2007 15:04:05 +0000 (15:04 +0000)
line after the last line of the paragraph

git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_2_0_branch/nano@4099 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/text.c

index bc76fc2657be9faff884bd297eaef1b28fa674ce..d53b2bd9a2e7981175c57afa6638443c9d16f44c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
 CVS code -
+- text.c:
+  backup_lines()
+       - Avoid a segfault when the mark begins and ends on the line
+         after the last line of the paragraph. (DLR)
 
 GNU nano 2.0.5 - 2007.04.22
 - files.c:
index 5746d3b6bf0038f8b5bb3c58d02247886af4f5a3..58219fe0172680929108658ca7a4250bf39bc32f 100644 (file)
@@ -1212,9 +1212,16 @@ void backup_lines(filestruct *first_line, size_t par_len)
      * line, putting first_line, edittop, current, and mark_begin at the
      * same lines in the copied paragraph that they had in the original
      * paragraph. */
-    if (openfile->current != openfile->fileage)
+    if (openfile->current != openfile->fileage) {
        top = openfile->current->prev;
-    else
+#ifndef NANO_TINY
+       if (old_mark_set &&
+               openfile->current->lineno == mb_lineno_save) {
+           openfile->mark_begin = openfile->current;
+           openfile->mark_begin_x = mark_begin_x_save;
+       }
+#endif
+    } else
        top = openfile->current;
     for (i = par_len; i > 0 && top != NULL; i--) {
        if (top->lineno == fl_lineno_save)