Skip to content

Commit 92f30d6

Browse files
committed
* 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.
1 parent dde3131 commit 92f30d6

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

lisp/tab-line.el

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,14 @@ the selected tab visible."
520520
(add-face-text-property (point-min) (point-max) 'tab-line)
521521
(if (> (vertical-motion 1) 0)
522522
(let* ((point (previous-single-property-change (point) 'tab))
523-
(tab-prop (or (get-pos-property point 'tab)
524-
(get-pos-property
525-
(previous-single-property-change point 'tab) 'tab)))
526-
(new-hscroll (seq-position strings tab-prop
527-
(lambda (str tab)
528-
(eq (get-pos-property 1 'tab str) tab)))))
523+
(tab-prop (when point
524+
(or (get-pos-property point 'tab)
525+
(and (setq point (previous-single-property-change point 'tab))
526+
(get-pos-property point 'tab)))))
527+
(new-hscroll (when tab-prop
528+
(seq-position strings tab-prop
529+
(lambda (str tab)
530+
(eq (get-pos-property 1 'tab str) tab))))))
529531
(when new-hscroll
530532
(setq hscroll (- new-hscroll))
531533
(set-window-parameter nil 'tab-line-hscroll hscroll)))
@@ -545,12 +547,14 @@ the selected tab visible."
545547
(add-face-text-property (point-min) (point-max) 'tab-line)
546548
(when (> (vertical-motion 1) 0)
547549
(let* ((point (previous-single-property-change (point) 'tab))
548-
(tab-prop (or (get-pos-property point 'tab)
549-
(get-pos-property
550-
(previous-single-property-change point 'tab) 'tab)))
551-
(new-hscroll (seq-position strings tab-prop
552-
(lambda (str tab)
553-
(eq (get-pos-property 1 'tab str) tab)))))
550+
(tab-prop (when point
551+
(or (get-pos-property point 'tab)
552+
(and (setq point (previous-single-property-change point 'tab))
553+
(get-pos-property point 'tab)))))
554+
(new-hscroll (when tab-prop
555+
(seq-position strings tab-prop
556+
(lambda (str tab)
557+
(eq (get-pos-property 1 'tab str) tab))))))
554558
(when new-hscroll
555559
(setq hscroll (- new-hscroll))
556560
(set-window-parameter nil 'tab-line-hscroll hscroll)))))))))

0 commit comments

Comments
 (0)