summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-03-13 13:56:31 -0400
committerGlenn Morris <rgm@gnu.org>2012-03-13 13:56:31 -0400
commit3809f91dfa03f4494d6ea8f5c9e0137993531864 (patch)
tree22c035a201e1350f5fed97097e60d1ee6d78e26c /lisp/calendar
parent37576acd4a71b395a130e1ede7adcc11b5e79a45 (diff)
downloademacs-3809f91dfa03f4494d6ea8f5c9e0137993531864.tar.gz
Small calendar-string-spread fix for bug#10978
* lisp/calendar/calendar.el (calendar-string-spread): Handle non-unit-width characters a bit better.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/calendar.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 0c351c6072f..b09167ea49b 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1756,8 +1756,8 @@ the STRINGS are just concatenated and the result truncated."
(if (< (length strings) 2)
(append (list "") strings (list ""))
strings)))
- (n (- length (length (apply 'concat strings))))
- (m (1- (length strings)))
+ (n (- length (string-width (apply 'concat strings))))
+ (m (* (1- (length strings)) (char-width char)))
(s (car strings))
(strings (cdr strings))
(i 0))
@@ -1766,7 +1766,7 @@ the STRINGS are just concatenated and the result truncated."
(make-string (max 0 (/ (+ n i) m)) char)
string)
i (1+ i)))
- (substring s 0 length)))
+ (truncate-string-to-width s length)))
(defun calendar-update-mode-line ()
"Update the calendar mode line with the current date and date style."