GNU bug report logs -
#10978
`calendar-string-spread' loses with double-width characters
Previous Next
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
View this message in rfc822 format
Eli Zaretskii wrote:
> But it looks like calendar-insert-at-column and calendar-string-spread
> also need similar changes.
ACK on calendar-insert-at-column, but calendar-string-spread is the
function already being discussed - was there a third?
> Sorry, I don't follow. Could you elaborate on what you had in mind?
I meant, don't do this:
(calendar-string-spread '("a" "b" "c") ?矢 10)
ie, a restriction similar to that of truncate-string-to-width:
The optional 4th arg PADDING, if non-nil, specifies a padding
character (which should have a display width of 1)
But, it can be handled a bit better with:
*** lisp/calendar/calendar.el 2012-03-06 02:18:29 +0000
--- lisp/calendar/calendar.el 2012-03-12 20:23:23 +0000
***************
*** 1756,1763 ****
(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))
(i 0))
--- 1756,1763 ----
(if (< (length strings) 2)
(append (list "") strings (list ""))
strings)))
! (n (- length (string-width (apply 'concat strings))))
! (m (* (1- (length strings)) (char-width char)))
(s (car strings))
(strings (cdr strings))
(i 0))
***************
*** 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 69 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.