Subject: bug#72420: set-goal-column misbehaves with a line-prefix and visual-line-mode

From: Eli Zaretskii <[email-masked]>
Date: Thu, 22 Aug 2024 17:33:16 +0300

> Cc: [email-masked]
> Date: Tue, 20 Aug 2024 15:24:12 +0300
> From: Eli Zaretskii <[email-masked]>
> 
> > From: "Martin Edström" <[email-masked]>
> > Date: Tue, 20 Aug 2024 10:28:44 +0200 (CEST)
> > 
> > Can we undo the "notabug" tag on this one?  The bug is with visual-line-mode.
> 
> I didn't yet have time to take another look at this, sorry.  When I
> do, I will consider this aspect.

I've now made this test case behave the same both with and without
visual-line-mode on the master branch of the Emacs Git repository.
The patch is below (you will need to rebuild Emacs for it to be
effective, since simple.el is preloaded).

diff --git a/lisp/simple.el b/lisp/simple.el
index a9f8b58..1d3be2b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -8200,7 +8200,7 @@ line-move-finish
 
 	;; Move to the desired column.
         (if (and line-move-visual
-                 (not (or truncate-lines truncate-partial-width-windows)))
+                 (not (or truncate-lines (truncated-partial-width-window-p))))
             ;; Under line-move-visual, goal-column should be
             ;; interpreted in units of the frame's canonical character
             ;; width, which is exactly what vertical-motion does.