bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#39649: 27.0.60; tab-line doesn't scroll


From: João Guerra
Subject: bug#39649: 27.0.60; tab-line doesn't scroll
Date: Wed, 19 Feb 2020 21:57:15 +0100

This seems better to me. However, scrolling is occurring when not
necessary, which looks kinda weird https://youtu.be/_YG0XH8XJpI

On Wed, 19 Feb 2020 at 01:51, Juri Linkov <address@hidden> wrote:
>
> >> Seems to fix the issue in a specific situation, viz. after I select a
> >> tab manually with the mouse. However, when selecting a buffer that is
> >> already visible in the tab-line the tab-line still might get scrolled
> >> or if I just scroll the tab-line and change to a non-visible buffer
> >> the tab-line doesn't get scrolled. I'm a bit interested in knowing the
> >> reasoning to not always scroll the tab-line.
> >
> > While you're manually scrolling the tab-line using the mouse wheel
> > or clicking on arrow buttons, auto-scrolling should be disabled
> > because it should not bring the current tab back into view immediately
> > on every step of manual scrolling.  Just imagine that you clicked
> > on the arrow button to scroll, but it has no effect because auto-scrolling
> > immediately moved the tab-line back to its original state.
> > This is why auto-scrolling should be disabled during manual scrolling.
> >
> > Now the question: how to detect the moment when you stop manually
> > scrolling?  How would you indicate that manual scrolling is finished,
> > and it's time to enable auto-scrolling to bring the currently selected tab
> > back into view?  I have no idea.
>
> Actually, I have an idea - the right moment is when the current buffer
> changes on the current tab.  This patch is the right way to handle this case:
>
> diff --git a/lisp/tab-line.el b/lisp/tab-line.el
> index 86ac234f3d..ad2b167e33 100644
> --- a/lisp/tab-line.el
> +++ b/lisp/tab-line.el
> @@ -464,6 +464,13 @@ tab-line-format
>                            (window-buffer)
>                            (window-parameter nil 'tab-line-hscroll)))
>           (cache (window-parameter nil 'tab-line-cache)))
> +    ;; Enable auto-hscroll again after it was disabled on manual scrolling.
> +    ;; The moment to enable it is when the window-buffer was updated.
> +    (when (and tab-line-auto-hscroll       ; if auto-hscroll was enabled
> +               (natnump (nth 2 cache-key)) ; non-negative on manual scroll
> +               cache                       ; window-buffer was updated
> +               (not (equal (nth 1 (car cache)) (nth 1 cache-key))))
> +      (set-window-parameter nil 'tab-line-hscroll nil))
>      (or (and cache (equal (car cache) cache-key) (cdr cache))
>          (cdr (set-window-parameter
>                nil 'tab-line-cache





reply via email to

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