emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/annotate 412053cefc 173/372: - [bugfix] When a window is r


From: ELPA Syncer
Subject: [nongnu] elpa/annotate 412053cefc 173/372: - [bugfix] When a window is resized ensure that the sizes are
Date: Fri, 4 Feb 2022 16:58:56 -0500 (EST)

branch: elpa/annotate
commit 412053cefc7738260086bf31050ac34f7f80ba1c
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>

    - [bugfix]  When  a  window  is  resized ensure  that  the  sizes  are
      calculated from the window that contains the current buffer.
---
 annotate.el | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/annotate.el b/annotate.el
index ee3255a47f..535110bcd6 100644
--- a/annotate.el
+++ b/annotate.el
@@ -756,24 +756,25 @@ to 'maximum-width'."
                        (if (= (length seq) 1)
                            nil
                          (annotate-safe-subseq seq from to nil))))
-  (let* ((theoretical-line-width      (- (window-body-width)
-                                         annotate-annotation-column))
-         (available-width             (if (> theoretical-line-width 0)
-                                          theoretical-line-width
-                                        line-width))
-         (lineated-list               (annotate-group-by-width text 
available-width))
-         (max-width                   (apply #'max
-                                             (mapcar #'string-width 
lineated-list)))
-         (all-but-last-lineated-list  (%subseq lineated-list 0 (1- (length 
lineated-list))))
-         (last-line                   (if all-but-last-lineated-list
-                                          (car (last lineated-list))
-                                        (cl-first lineated-list)))
-         (lineated                    (cl-mapcar (lambda (a)
-                                                   (pad a max-width t))
-                                                 all-but-last-lineated-list)))
-    (apply #'concat
-           (append lineated
-                   (list (pad last-line max-width nil)))))))
+    (let* ((current-window             (get-buffer-window (current-buffer)))
+           (theoretical-line-width     (- (window-body-width current-window)
+                                          annotate-annotation-column))
+           (available-width            (if (> theoretical-line-width 0)
+                                           theoretical-line-width
+                                         line-width))
+           (lineated-list              (annotate-group-by-width text 
available-width))
+           (max-width                  (apply #'max
+                                              (mapcar #'string-width 
lineated-list)))
+           (all-but-last-lineated-list (%subseq lineated-list 0 (1- (length 
lineated-list))))
+           (last-line                   (if all-but-last-lineated-list
+                                            (car (last lineated-list))
+                                          (cl-first lineated-list)))
+           (lineated                   (cl-mapcar (lambda (a)
+                                                    (pad a max-width t))
+                                                  all-but-last-lineated-list)))
+      (apply #'concat
+             (append lineated
+                     (list (pad last-line max-width nil)))))))
 
 (defun annotate--annotation-builder ()
   "Searches the line before point for annotations, and returns a



reply via email to

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