From 7f9ed903ec2913ba5ac51ac6764cd9c544c2e517 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sun, 13 Mar 2005 16:05:47 +0000
Subject: [PATCH] fix regressions caused by the justify overhaul: when
 adjusting the mark, take the indentation length into account, and don't
 declare an indent_len variable inside a loop when we already have one outside

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

diff --git a/src/nano.c b/src/nano.c
index d4c71ee0..52c1d0af 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2999,7 +2999,7 @@ void do_justify(bool full_justify)
 	    bool past_first_line = FALSE;
 
 	    for (i = 0; i < par_len; i++) {
-		size_t indent_len = quote_len +
+		indent_len = quote_len +
 			indent_length(indent_line->data + quote_len);
 
 		if (indent_len != strlen(indent_string)) {
@@ -3054,7 +3054,7 @@ void do_justify(bool full_justify)
 	     * in the next line. */
 	    if (mark_beginbuf == next_line) {
 		mark_beginbuf = current;
-		mark_beginx += line_len;
+		mark_beginx += line_len - indent_len;
 	    }
 #endif
 
@@ -3131,6 +3131,7 @@ void do_justify(bool full_justify)
 	    /* Break the line.  If this isn't the last line of the
 	     * paragraph, add a space after where we break it. */
 	    null_at(&current->data, break_pos);
+
 	    if (par_len > 1) {
 		current->data = charealloc(current->data,
 			break_pos + 2);
-- 
GitLab