GNU bug report logs - #67925
29.1; delete-rectangle fails on multi-column characters

Previous Next

Package: emacs;

Reported by: awrhygty <at> outlook.com

Date: Wed, 20 Dec 2023 11:00:02 UTC

Severity: normal

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: awrhygty <at> outlook.com
Cc: 67925 <at> debbugs.gnu.org
Subject: bug#67925: 29.1; delete-rectangle fails on multi-column characters
Date: Wed, 20 Dec 2023 16:09:56 +0200
> From: awrhygty <at> 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)))))




This bug report was last modified 1 year and 232 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.