bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67925: 29.1; delete-rectangle fails on multi-column characters


From: Eli Zaretskii
Subject: bug#67925: 29.1; delete-rectangle fails on multi-column characters
Date: Wed, 20 Dec 2023 16:09:56 +0200

> From: awrhygty@outlook.com
> Date: Wed, 20 Dec 2023 19:58:49 +0900
> 
> 
> If a multi-column character is crossing the start column of a intended
> rectangle, no characters are deleted in the same line.
> 
> For example, type 'C-x r d'(delete-rectangle) from column 1 to column 4
> of the text below, the second line characters are not deleted.
> 
> 01234
> 一二4
> 01234
> 
> result:
> 04
> 一二4
> 04
> 
> This does not apply to #'kill-rectangle.
> kill-rectangle result:
> 04
> 一4
> 04

Thanks.  Does the patch below give good results?

diff --git a/lisp/rect.el b/lisp/rect.el
index 8dc188b..9049e32 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -212,7 +212,10 @@ rectangle-dimensions
       (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)))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]