diff options
author | Eli Zaretskii <eliz@gnu.org> | 2022-06-27 15:32:53 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2022-06-27 15:32:53 +0300 |
commit | 0190dff96ac15e48ad57f33d69f5900b3851b9e0 (patch) | |
tree | fb4299d32c151b207caf1f0fbbd828125f843134 /lisp/simple.el | |
parent | f9f41c586a31ad5ba326834c9f4dddfcf78f69e9 (diff) | |
download | emacs-0190dff96ac15e48ad57f33d69f5900b3851b9e0.tar.gz emacs-0190dff96ac15e48ad57f33d69f5900b3851b9e0.tar.bz2 emacs-0190dff96ac15e48ad57f33d69f5900b3851b9e0.zip |
Fix deletion of composed text
* lisp/composite.el (lgstring-glyph-boundary): New function.
* lisp/simple.el (delete-forward-char): Call
'lgstring-glyph-boundary' to find where to end the deletion inside
an automatic composition. (Bug#56237)
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 83185c4e1a8..ea94727b3a7 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1507,12 +1507,22 @@ the actual saved text might be different from what was killed." (while (> n 0) ;; 'find-composition' will return (FROM TO ....) or nil. (setq cmp (find-composition pos)) - (if cmp - ;; TO can be at POS, in which case we want to make - ;; sure we advance at least by 1 character. - (let ((cmp-end (cadr cmp))) - (setq pos (max (1+ pos) cmp-end))) - (setq pos (1+ pos))) + (setq pos + (if cmp + (let ((from (car cmp)) + (to (cadr cmp))) + (cond + ((= (length cmp) 2) ; static composition + to) + ;; TO can be at POS, in which case we want + ;; to make sure we advance at least by 1 + ;; character. + ((<= to pos) + (1+ pos)) + (t + (lgstring-glyph-boundary (nth 2 cmp) + from (1+ pos))))) + (1+ pos))) (setq n (1- n))) (delete-char (- pos start) killflag))) |