From: Alan J Third Date: Fri, 15 Jan 2016 08:26:10 +0000 (+0200) Subject: Fix picture-mode wrt double-width characters X-Git-Tag: emacs-25.0.90~167^2~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b70dba4e18514411ed38b5bbb846558158842ace;p=emacs.git 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 --- 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))))