]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix picture-mode wrt double-width characters
authorAlan J Third <alan@idiocy.org>
Fri, 15 Jan 2016 08:26:10 +0000 (10:26 +0200)
committerEli Zaretskii <eliz@gnu.org>
Fri, 15 Jan 2016 08:26:10 +0000 (10:26 +0200)
* lisp/textmodes/picture.el (picture-insert): Check the width of
the character being replaced, not just that of the replacement.
(Bug#1808)

Copyright-paperwork-exempt: yes

lisp/textmodes/picture.el

index 4aee2734158a9e688d3dd16f644fd4a95e396893..b77f8e9717c975c8556ceb608b7a28cd23de11fc 100644 (file)
@@ -272,7 +272,11 @@ Use \"\\[command-apropos] picture-movement\" to see commands which control motio
        (or (eolp)
            (let ((pos (point)))
              (move-to-column col t)
-             (delete-region pos (point)))))
+             (let ((old-width (string-width (buffer-substring pos (point)))))
+               (delete-region pos (point))
+               (when (> old-width width)
+                 (insert-char ?  (- old-width width))
+                 (goto-char pos))))))
       (insert ch)
       (forward-char -1)
       (picture-move))))