From 2e8fac6487ac3a686b4180cc4be7f1028a4d3efe Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sat, 29 Apr 2006 15:44:58 +0000
Subject: [PATCH] fix more do_indent_marked() breakage

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3456 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/text.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/text.c b/src/text.c
index 48717958..00a89283 100644
--- a/src/text.c
+++ b/src/text.c
@@ -278,12 +278,13 @@ void do_indent_marked(ssize_t len)
 		null_at(&f->data, line_len - indent_len + 1);
 		openfile->totsize -= indent_len;
 
-		/* If this is the current line, keep track of the change
-		 * in it. */
-		if (f == openfile->current) {
+		/* Keep track of the change in the current line. */
+		if (f == openfile->current)
 		    openfile->current_x -= indent_len;
+
+		if (f == openfile->mark_begin &&
+			openfile->mark_begin_x >= indent_len)
 		    openfile->mark_begin_x -= indent_len;
-		}
 
 		/* We've unindented, so set indent_changed to TRUE. */
 		if (!indent_changed)
@@ -298,12 +299,12 @@ void do_indent_marked(ssize_t len)
 	    strncpy(f->data, line_indent, line_indent_len);
 	    openfile->totsize += line_indent_len;
 
-	    /* If this is the current line, keep track of the change in
-	     * it. */
-	    if (f == openfile->current) {
+	    /* Keep track of the change in the current line. */
+	    if (f == openfile->current)
 		openfile->current_x += line_indent_len;
+
+	    if (f == openfile->mark_begin)
 		openfile->mark_begin_x += line_indent_len;
-	    }
 
 	    /* If the NO_NEWLINES flag isn't set, and this is the
 	     * magicline, add a new magicline. */
-- 
GitLab