From 6abf1c038f6c74f2e56078228cdf8a0cda40c6b3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 28 Dec 2023 10:50:59 +0200 Subject: [PATCH] Fix 'delete-rectangle' with multi-column characters * lisp/rect.el (delete-rectangle-line): Support multi-column characters, when STARTCOL is in the middle of such a character. (Bug#67925) --- lisp/rect.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/rect.el b/lisp/rect.el index 8dc188b1de0..9049e322ca6 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -212,7 +212,10 @@ The returned value has the form of (WIDTH . HEIGHT)." (cons width height)))) (defun delete-rectangle-line (startcol endcol fill) - (when (= (move-to-column startcol (if fill t 'coerce)) startcol) + ;; We use >= here, not =, for characters that use more than one + ;; column on display, when STARTCOL is in the middle of such a + ;; character. + (when (>= (move-to-column startcol (if fill t 'coerce)) startcol) (delete-region (point) (progn (move-to-column endcol 'coerce) (point))))) -- 2.39.2