From 5bc4abeefea06119a7bbfd138f6b916fd04abb78 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 6 Jul 2017 22:10:37 -0500
Subject: [PATCH] text: update placewewant properly when indenting/unindenting

If the position of the cursor changes horizontally,
placewewant should change with it.

This fixes https://savannah.gnu.org/bugs/?51407.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
---
 src/text.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/text.c b/src/text.c
index 1b9f3a69..6a0cc528 100644
--- a/src/text.c
+++ b/src/text.c
@@ -363,8 +363,10 @@ void do_indent(ssize_t cols)
 			openfile->mark_begin_x >= indent_len)
 		openfile->mark_begin_x += line_indent_len;
 
-	    if (f == openfile->current && openfile->current_x >= indent_len)
+	    if (f == openfile->current && openfile->current_x >= indent_len) {
 		openfile->current_x += line_indent_len;
+		openfile->placewewant = xplustabs();
+	    }
 
 	    /* If the NO_NEWLINES flag isn't set, and this is the
 	     * magicline, add a new magicline. */
@@ -405,6 +407,7 @@ void do_indent(ssize_t cols)
 			openfile->current_x = indent_new;
 		    else
 			openfile->current_x -= indent_shift;
+		    openfile->placewewant = xplustabs();
 		}
 
 		/* We've unindented, so the indentation changed. */
-- 
GitLab