emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107600: Small calendar-string-spread


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107600: Small calendar-string-spread fix for bug#10978
Date: Tue, 13 Mar 2012 13:56:31 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107600
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2012-03-13 13:56:31 -0400
message:
  Small calendar-string-spread fix for bug#10978
  
  * lisp/calendar/calendar.el (calendar-string-spread):
  Handle non-unit-width characters a bit better.
modified:
  lisp/ChangeLog
  lisp/calendar/calendar.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-03-13 10:40:29 +0000
+++ b/lisp/ChangeLog    2012-03-13 17:56:31 +0000
@@ -1,3 +1,8 @@
+2012-03-13  Glenn Morris  <address@hidden>
+
+       * calendar/calendar.el (calendar-string-spread):
+       Handle non-unit-width characters a bit better.  (Bug#10978)
+
 2012-03-13  Leo Liu  <address@hidden>
 
        * vc/vc-hg.el (vc-hg-working-revision): Rework to work with both

=== modified file 'lisp/calendar/calendar.el'
--- a/lisp/calendar/calendar.el 2012-03-06 02:18:29 +0000
+++ b/lisp/calendar/calendar.el 2012-03-13 17:56:31 +0000
@@ -1756,8 +1756,8 @@
                           (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 @@
                       (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."


reply via email to

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