Fix picture-mode with full-width characters
authorEli Zaretskii <eliz@gnu.org>
Sun, 10 Nov 2024 09:48:34 +0000 (11:48 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sun, 10 Nov 2024 09:48:34 +0000 (11:48 +0200)
* lisp/textmodes/picture.el (picture-insert): Don't rely on
'move-to-column' to move to the column that is its argument: this
might be false when full-width characters are involved.

lisp/textmodes/picture.el

index 08bb12cd80c52d3d2aa83becdf81effd915ce2c3..1435ea2c4e2d2f80a408d4aa8a12867f039d67e0 100644 (file)
@@ -257,12 +257,14 @@ Use \"\\[command-apropos] picture-movement\" to see commands which control motio
                   (> width 1)
                   (< (abs picture-horizontal-step) 2))
              (* picture-horizontal-step 2)
-           picture-horizontal-step)))
+           picture-horizontal-step))
+         actual-col)
     (while (> arg 0)
       (setq arg (1- arg))
       (if (/= picture-desired-column (current-column))
-         (move-to-column picture-desired-column t))
-      (let ((col (+ picture-desired-column width)))
+         (setq actual-col (move-to-column picture-desired-column t))
+        (setq actual-col picture-desired-column))
+      (let ((col (+ actual-col width)))
        (or (eolp)
            (let ((pos (point))
                   (col0 (current-column))