From 3059e16c25831eea80a190fb1447207732f30029 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 28 Oct 2015 20:24:15 +0000
Subject: [PATCH] Spoofing a line number for the redoing of an INSERT, because
 'u->mark_begin_lineno' is being used as the length of the insertion.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5375 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog  | 5 +++++
 src/text.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 9c19c975..cf8993da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-28  Benno Schulenberg  <bensberg@justemail.net>
+	* src/text.c (do_redo): For an INSERT, 'u->mark_begin_lineno' is not
+	an actual line number, so spoof it.  It can be spoofed, because 'f'
+	is not used for the INSERT case.  This fixes Savannah bug #45524.
+
 2015-10-27  Benno Schulenberg  <bensberg@justemail.net>
 	* src/move.c (do_next_word): Rewrite this function to use the same
 	logic as do_prev_word(), reducing its number of lines to half.
diff --git a/src/text.c b/src/text.c
index ffea145b..e1b42f78 100644
--- a/src/text.c
+++ b/src/text.c
@@ -639,7 +639,7 @@ void do_redo(void)
 	return;
     }
 
-    filestruct *f = fsfromline(u->mark_begin_lineno);
+    filestruct *f = fsfromline(u->type == INSERT ? 1 : u->mark_begin_lineno);
     if (!f) {
 	statusbar(_("Internal error: can't match line %d.  Please save your work."), u->mark_begin_lineno);
 	return;
-- 
GitLab