emacs-diffs
[Top][All Lists]
Advanced

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

emacs-27 92f30d6: * lisp/tab-line.el (tab-line-auto-hscroll): Fix for lo


From: Juri Linkov
Subject: emacs-27 92f30d6: * lisp/tab-line.el (tab-line-auto-hscroll): Fix for long tab names.
Date: Sun, 19 Jan 2020 19:36:01 -0500 (EST)

branch: emacs-27
commit 92f30d62c038affa515989ad3ccf170b604c9174
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/tab-line.el (tab-line-auto-hscroll): Fix for long tab names.
    
    Check for nil value returned by previous-single-property-change that
    happens when tab name is longer than window width.
---
 lisp/tab-line.el | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index ef530d4..5bbc45b 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -520,12 +520,14 @@ the selected tab visible."
             (add-face-text-property (point-min) (point-max) 'tab-line)
             (if (> (vertical-motion 1) 0)
                 (let* ((point (previous-single-property-change (point) 'tab))
-                       (tab-prop (or (get-pos-property point 'tab)
-                                     (get-pos-property
-                                      (previous-single-property-change point 
'tab) 'tab)))
-                       (new-hscroll (seq-position strings tab-prop
-                                                  (lambda (str tab)
-                                                    (eq (get-pos-property 1 
'tab str) tab)))))
+                       (tab-prop (when point
+                                   (or (get-pos-property point 'tab)
+                                       (and (setq point 
(previous-single-property-change point 'tab))
+                                            (get-pos-property point 'tab)))))
+                       (new-hscroll (when tab-prop
+                                      (seq-position strings tab-prop
+                                                    (lambda (str tab)
+                                                      (eq (get-pos-property 1 
'tab str) tab))))))
                   (when new-hscroll
                     (setq hscroll (- new-hscroll))
                     (set-window-parameter nil 'tab-line-hscroll hscroll)))
@@ -545,12 +547,14 @@ the selected tab visible."
               (add-face-text-property (point-min) (point-max) 'tab-line)
               (when (> (vertical-motion 1) 0)
                 (let* ((point (previous-single-property-change (point) 'tab))
-                       (tab-prop (or (get-pos-property point 'tab)
-                                     (get-pos-property
-                                      (previous-single-property-change point 
'tab) 'tab)))
-                       (new-hscroll (seq-position strings tab-prop
-                                                  (lambda (str tab)
-                                                    (eq (get-pos-property 1 
'tab str) tab)))))
+                       (tab-prop (when point
+                                   (or (get-pos-property point 'tab)
+                                       (and (setq point 
(previous-single-property-change point 'tab))
+                                            (get-pos-property point 'tab)))))
+                       (new-hscroll (when tab-prop
+                                      (seq-position strings tab-prop
+                                                    (lambda (str tab)
+                                                      (eq (get-pos-property 1 
'tab str) tab))))))
                   (when new-hscroll
                     (setq hscroll (- new-hscroll))
                     (set-window-parameter nil 'tab-line-hscroll 
hscroll)))))))))



reply via email to

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