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