emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 1e9a122 2/7: Fix picture-mode wrt double-width char


From: Paul Eggert
Subject: [Emacs-diffs] master 1e9a122 2/7: Fix picture-mode wrt double-width characters
Date: Tue, 22 Mar 2016 00:06:00 +0000

branch: master
commit 1e9a1229b170a4b3b0e0ab4fc228b2281b42ec25
Author: Alan J Third <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix picture-mode wrt double-width characters
    
    * lisp/textmodes/picture.el (picture-insert): Check the width of
    the character being replaced, not just that of the replacement.
    (Bug#1808)
    
    [This reapplies commit b70dba4e18514411ed38b5bbb846558158842ace,
    which was inadvertently lost by merge commit
    7823745acbe9b87eea2db4ef434e379fc903ec35.]
    
    Copyright-paperwork-exempt: yes
---
 lisp/textmodes/picture.el |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index 4aee273..b77f8e9 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -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))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]