unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrey Listopadov <andreyorst@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 68786@debbugs.gnu.org
Subject: bug#68786: 30.0.50; Horizontal overscroll
Date: Mon, 29 Jan 2024 20:53:34 +0300	[thread overview]
Message-ID: <87wmrs9fyt.fsf@gmail.com> (raw)
In-Reply-To: <86msso4abj.fsf@gnu.org>


Eli Zaretskii <eliz@gnu.org> writes:

> The above can also be done with horizontal scroll bar, if instead of
> dragging the scroll-bar's "thumb" you click on the arrow at the right
> side of the scroll bar.  At least it works here (perhaps this depends
> on the toolkit, I don't know).

I'm using GNOME, and in its toolkit the scrollbars are "modern",
i.e. flat and without any buttons.

> So I think the inconsistency is much smaller than you think, and we
> should stop right here and talk about why this makes you uncomfortable
> or requires any changes in your opinion.  I personally find nothing
> bad or unexpected with the ability to scroll past the last visible
> character: after all, if the user doesn't want that, he/she can avoid
> scrolling farther than he/she wants.

The reason I made the piece of code that prevents this is because
usually when I'm scrolling to the right (I'm using line truncation all
the time), I don't want to overshoot the code I want to see.  With the
touchpad it's quite easy to do, because the acceleration of the
scrolling motion is pretty high, but I usually want it to be that high,
otherwise it feels like a /drag/.

> It is true that most other applications don't vary the thumb size, but
> Emacs has always behaved like it does, so changing it to follow the
> other apps is not an option at this point, at least not by default.
>
> Having said that, ...
>
>> I would like to ask for a feature to limit the horizontal scroll by the
>> longest line, much like the horizontal scrollbar works by default. It
>> may not be the longest line in the buffer, as calculating this for huge
>> buffers is probably too impactful unless we can cache the longest line
>> length until the buffer is changed.  Or maybe Emacs already knows the
>> buffer's "dimensions", I don't know.
>
> ... I won't object to such a feature, provided that it's optional and
> OFF by default, and also that it is supported on as many toolkits as
> is practical.  Patches welcome.

Fair enough.  Right now I can't send a patch, because I don't have the
solution for this problem.  The piece of code I sent works for me, but
it's not general by any means, and has a lot of subtle flaws.

Maybe if you could point me out to parts of Emacs that do the
calculation of the longest visible line for the scroll bar so I could
adopt it instead of doing hacky unscallable-face-font-width-based
calculation?  Or maybe help me think of a better way to calculate this.

Thanks!





  reply	other threads:[~2024-01-29 17:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-28 20:41 bug#68786: 30.0.50; Horizontal overscroll Andrey Listopadov
2024-01-29 12:02 ` Eli Zaretskii
2024-01-29 17:53   ` Andrey Listopadov [this message]
2024-01-29 19:10     ` Eli Zaretskii
2024-01-31 16:40       ` Andrey Listopadov

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87wmrs9fyt.fsf@gmail.com \
    --to=andreyorst@gmail.com \
    --cc=68786@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).