diff options
author | Alan J Third <alan@idiocy.org> | 2016-01-15 10:26:10 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2016-01-15 10:26:10 +0200 |
commit | b70dba4e18514411ed38b5bbb846558158842ace (patch) | |
tree | ec6f0781752b44dbcbd9b9e7fe4271df41437883 /lisp/textmodes/picture.el | |
parent | 2bc07f7a2a4fb96b470576567a18240f363b4a3b (diff) | |
download | emacs-b70dba4e18514411ed38b5bbb846558158842ace.tar.gz emacs-b70dba4e18514411ed38b5bbb846558158842ace.tar.bz2 emacs-b70dba4e18514411ed38b5bbb846558158842ace.zip |
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)
Copyright-paperwork-exempt: yes
Diffstat (limited to 'lisp/textmodes/picture.el')
-rw-r--r-- | 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 4aee2734158..b77f8e9717c 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)))) |