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

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

clear-rectangle-line doesn't work for wide chars


From: Katsumi Yamaoka
Subject: clear-rectangle-line doesn't work for wide chars
Date: Thu, 21 Feb 2002 14:18:26 +0900
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (sparc-sun-solaris2.6)

Dear Emacs Developers,

Mito <mito@mxa.nes.nec.co.jp> reported with a patch that the
command `C-x r c' (clear-rectangle-line) does not work correctly
for Japanese wide characters.  Emacs will replace such wide
characters with the same number of spaces but they should be
twice the length of the old characters.  It will occur under
the released version of Emacs 21.1 and the latest Emacs CVS.
Here is a patch for it:

*** rect.el~    Wed Oct  3 10:51:07 2001
--- rect.el     Thu Feb 21 05:10:31 2002
***************
*** 365,379 ****
  
  (defun clear-rectangle-line (startcol endcol fill)
    (let ((pt (point-at-eol))
!       spaces)
      (when (= (move-to-column-force startcol (or fill 'coerce)) startcol)
        (if (and (not fill)
               (<= (save-excursion (goto-char pt) (current-column)) endcol))
          (delete-region (point) pt)
        ;; else
!       (setq pt (point))
        (move-to-column-force endcol)
!       (setq spaces (- (point) pt))
        (delete-region pt (point))
        (indent-to (+ (current-column) spaces))))))
  
--- 365,380 ----
  
  (defun clear-rectangle-line (startcol endcol fill)
    (let ((pt (point-at-eol))
!       column spaces)
      (when (= (move-to-column-force startcol (or fill 'coerce)) startcol)
        (if (and (not fill)
               (<= (save-excursion (goto-char pt) (current-column)) endcol))
          (delete-region (point) pt)
        ;; else
!       (setq pt (point)
!             column (current-column))
        (move-to-column-force endcol)
!       (setq spaces (- (current-column) column))
        (delete-region pt (point))
        (indent-to (+ (current-column) spaces))))))
  
-- 
Katsumi Yamaoka <yamaoka@jpl.org>



reply via email to

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