diff options
| author | Alan J Third | 2016-01-15 10:26:10 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-01-15 10:26:10 +0200 |
| commit | b70dba4e18514411ed38b5bbb846558158842ace (patch) | |
| tree | ec6f0781752b44dbcbd9b9e7fe4271df41437883 | |
| parent | 2bc07f7a2a4fb96b470576567a18240f363b4a3b (diff) | |
| download | emacs-b70dba4e18514411ed38b5bbb846558158842ace.tar.gz 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
| -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 | |||
| 272 | (or (eolp) | 272 | (or (eolp) |
| 273 | (let ((pos (point))) | 273 | (let ((pos (point))) |
| 274 | (move-to-column col t) | 274 | (move-to-column col t) |
| 275 | (delete-region pos (point))))) | 275 | (let ((old-width (string-width (buffer-substring pos (point))))) |
| 276 | (delete-region pos (point)) | ||
| 277 | (when (> old-width width) | ||
| 278 | (insert-char ? (- old-width width)) | ||
| 279 | (goto-char pos)))))) | ||
| 276 | (insert ch) | 280 | (insert ch) |
| 277 | (forward-char -1) | 281 | (forward-char -1) |
| 278 | (picture-move)))) | 282 | (picture-move)))) |