GNU bug report logs - #10978
`calendar-string-spread' loses with double-width characters

Previous Next

Package: emacs;

Reported by: Štěpán Němec <stepnem <at> gmail.com>

Date: Fri, 9 Mar 2012 11:59:02 UTC

Severity: normal

Fixed in version 24.0.95

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 10978 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 10978 <at> debbugs.gnu.org,
	Štěpán Němec <stepnem <at> gmail.com>
Subject: Re: bug#10978: `calendar-string-spread' loses with double-width
	characters
Date: Fri, 09 Mar 2012 21:27:08 -0500
Eli Zaretskii wrote:

> It should use `string-width' instead of `length'.

Like so?

*** lisp/calendar/calendar.el	2012-03-06 02:18:29 +0000
--- lisp/calendar/calendar.el	2012-03-10 02:16:16 +0000
***************
*** 1756,1762 ****
                            (if (< (length strings) 2)
                                (append (list "") strings (list ""))
                              strings)))
!          (n (- length (length (apply 'concat strings))))
           (m (1- (length strings)))
           (s (car strings))
           (strings (cdr strings))
--- 1756,1762 ----
                            (if (< (length strings) 2)
                                (append (list "") strings (list ""))
                              strings)))
!          (n (- length (string-width (apply 'concat strings))))
           (m (1- (length strings)))
           (s (car strings))
           (strings (cdr strings))
***************
*** 1766,1772 ****
                        (make-string (max 0 (/ (+ n i) m)) char)
                        string)
              i (1+ i)))
!     (substring s 0 length)))
  
  (defun calendar-update-mode-line ()
    "Update the calendar mode line with the current date and date style."
--- 1766,1772 ----
                        (make-string (max 0 (/ (+ n i) m)) char)
                        string)
              i (1+ i)))
!     (truncate-string-to-width s length)))
  
  (defun calendar-update-mode-line ()
    "Update the calendar mode line with the current date and date style."





This bug report was last modified 13 years and 68 days ago.

Previous Next


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