From b70dba4e18514411ed38b5bbb846558158842ace Mon Sep 17 00:00:00 2001 From: Alan J Third Date: Fri, 15 Jan 2016 10:26:10 +0200 Subject: [PATCH] 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 --- lisp/textmodes/picture.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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)))) -- 2.39.2