From: Eli Zaretskii Date: Thu, 28 Dec 2023 08:50:59 +0000 (+0200) Subject: Fix 'delete-rectangle' with multi-column characters X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6abf1c038f6c74f2e56078228cdf8a0cda40c6b3;p=emacs.git 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) --- 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)))))