all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: "João Guerra" <joca.bt@gmail.com>
Cc: 39649@debbugs.gnu.org
Subject: bug#39649: 27.0.60; tab-line doesn't scroll
Date: Fri, 21 Feb 2020 01:07:10 +0200	[thread overview]
Message-ID: <87r1yoopgp.fsf@mail.linkov.net> (raw)
In-Reply-To: <CAGiBfP10KLMH=qWKarfoQLHxxpo2hNA+GrUxovag8Cg2L9XXqQ@mail.gmail.com> ("João Guerra"'s message of "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

Thanks for the detailed visual bug reports - it's clear now
what should be fixed.  The following patch provides almost
prefect behavior with only one exception: it fails to switch
back from manual scrolling to automatic scrolling when
the tab-line is at its beginning, showing the first tab.
The problem is that in Emacs there is no such thing as
negative zero.

I don't understand why Emacs doesn't support signed zero.
For example in JavaScript: Math.sign(-0) => -0

Signed zero would help in the auto-hscroll implementation where
positive integers encode positions of manual scrolling and
negative integers encode positions of automatic scrolling.
And switching from manual to automatic just changes the sign.

But since positions count from zero, there is no way
to distinguish manual scrolling position from automatic
scrolling position at the beginning of the tab-line.

I have no idea how to overcome this limitation.

diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 8f1221abe4..70ca7e2204 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -464,6 +466,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 (- (nth 2 cache-key))))
     (or (and cache (equal (car cache) cache-key) (cdr cache))
         (cdr (set-window-parameter
               nil 'tab-line-cache





  reply	other threads:[~2020-02-20 23:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17 18:51 bug#39649: 27.0.60; tab-line doesn't scroll João Guerra
2020-02-17 23:03 ` Juri Linkov
2020-02-18 20:27   ` João Guerra
2020-02-18 22:39     ` Juri Linkov
2020-02-19  0:24       ` Juri Linkov
2020-02-19 20:57         ` João Guerra
2020-02-20 23:07           ` Juri Linkov [this message]
2020-02-21  1:34             ` Noam Postavsky
2020-02-22 23:52               ` Juri Linkov
2020-02-23 10:35                 ` João Guerra
2020-02-23 23:06                   ` Juri Linkov
2020-02-24 19:11                     ` João Guerra
2020-02-25 21:20                       ` Juri Linkov
2020-02-25 21:49                         ` João Guerra
2020-02-26 23:16                           ` Juri Linkov
2020-02-26 23:33                             ` Juri Linkov
2020-02-28  9:12                               ` Eli Zaretskii
2020-02-29 21:44                                 ` Juri Linkov
2020-03-01 16:12                                   ` Eli Zaretskii
2020-03-01 23:40                                     ` Juri Linkov
2020-09-20  8:40                                       ` Lars Ingebrigtsen
2020-02-27 21:13                             ` João Guerra
2020-02-27 22:37                               ` Juri Linkov
2020-02-28 18:30                                 ` João Guerra
2020-02-29 21:49                                   ` Juri Linkov
2020-03-04 17:25                                     ` João Guerra
2020-03-04 23:52                                       ` Juri Linkov
2020-03-05  8:04                                         ` João Guerra
2020-03-05 23:53                                           ` Juri Linkov
2020-09-20  8:41                                     ` Lars Ingebrigtsen
2020-10-14  6:16                                       ` Lars Ingebrigtsen
2020-02-28 13:16                         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1yoopgp.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=39649@debbugs.gnu.org \
    --cc=joca.bt@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.