summaryrefslogtreecommitdiff
path: root/lisp/textmodes/picture.el
diff options
context:
space:
mode:
authorAlan J Third <alan@idiocy.org>2016-01-15 10:26:10 +0200
committerEli Zaretskii <eliz@gnu.org>2016-01-15 10:26:10 +0200
commitb70dba4e18514411ed38b5bbb846558158842ace (patch)
treeec6f0781752b44dbcbd9b9e7fe4271df41437883 /lisp/textmodes/picture.el
parent2bc07f7a2a4fb96b470576567a18240f363b4a3b (diff)
downloademacs-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.el6
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))))