From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Set-window-vscroll sometimes doesn't work
Date: Mon, 19 Oct 2020 12:56:38 -0400 [thread overview]
Message-ID: <4F794407-585E-4C74-85F3-00A668FB9675@gmail.com> (raw)
In-Reply-To: <83blgyp4k2.fsf@gnu.org>
> On Oct 19, 2020, at 12:24 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Mon, 19 Oct 2020 00:59:33 -0400
>> Cc: help-gnu-emacs@gnu.org
>>
>>>> Cool. I’m thinking about wrapping move_it_by_lines in window_scroll_pixel_based with a version that regards images (and tall lines) as several lines. Do you see some potential problems with that?
>>>
>>> What is the problem with the existing code that you are trying to
>>> solve? Whatever it is, it is highly likely that the solution already
>>> exists, and no new code is needed.
>>
>> The problem I have is that when I scroll over images they jumps in and out of the window: (bad-scrolling.mp4)
>
> AFAICT, you are trying to scroll an image that is smaller than the
> window? That's not supported by the current code, you will need to
> modify the criteria for entering the vscroll mode there.
>
> But in any case, I don't see how move_it_by_lines can have anything to
> do with this: whatever you do, an image must always remain a single
> "display element", and the only way we currently have to scroll
> partial images is via vscroll. Which works, so I don't understand why
> you need any changes in window_scroll_pixel_based.
>
What I came up with is this:
For (scroll-up 1):
1. If the first row is a normal line (i.e., with normal height), scroll up normally by one display line.
2. If the first row is an image, adjust vscroll += frame-default-pixel-line-height
3. If the first row is an image and we have scrolled to the bottom of the image, i.e., vscroll = image-height, scroll up one display line and set vscroll to 0.
In other words, sometimes we are not really scrolling, but faking a scroll by adjusting vscroll. IIUC window_scroll_pixel_based moves it by move_it_by_lines and set window-start to it. That’s not what we want when we want to fake scroll by adjusting vscroll: in that case we don’t want to change window-start.
Some questions:
1. Is there a way to get the line-height that an it is on?
2. Where is the code that ensures point is always fully visible? When I move point around Emacs adjusts scrolling to keep the point fully visible, but I don’t know who’s doing that work.
Yuan
next prev parent reply other threads:[~2020-10-19 16:56 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-18 0:35 Set-window-vscroll sometimes doesn't work Yuan Fu
2020-10-18 14:34 ` Eli Zaretskii
2020-10-18 17:24 ` Yuan Fu
2020-10-18 17:31 ` Eli Zaretskii
2020-10-18 17:51 ` Yuan Fu
2020-10-18 17:55 ` Eli Zaretskii
2020-10-18 18:02 ` Yuan Fu
2020-10-18 19:12 ` Yuan Fu
2020-10-18 19:19 ` Eli Zaretskii
2020-10-18 20:06 ` Yuan Fu
2020-10-19 2:23 ` Eli Zaretskii
[not found] ` <B1D235FE-49B8-4F0A-9C02-78B7E3244C47@gmail.com>
2020-10-19 6:00 ` Yuan Fu
2020-10-19 16:24 ` Eli Zaretskii
2020-10-19 16:56 ` Yuan Fu [this message]
2020-10-19 17:23 ` Eli Zaretskii
2020-10-19 20:39 ` Yuan Fu
2020-10-20 16:04 ` Eli Zaretskii
2020-10-20 18:00 ` Yuan Fu
2020-10-20 18:19 ` Yuan Fu
2020-10-21 16:25 ` Eli Zaretskii
2020-10-21 19:05 ` Yuan Fu
2020-10-22 4:16 ` Yuan Fu
2020-10-22 16:08 ` Eli Zaretskii
2020-10-22 16:50 ` Yuan Fu
2020-10-22 17:09 ` Eli Zaretskii
2020-10-22 19:33 ` Yuan Fu
2020-10-23 6:05 ` Eli Zaretskii
2020-10-23 16:48 ` Yuan Fu
2020-10-23 18:11 ` Eli Zaretskii
2020-10-23 20:30 ` Yuan Fu
2020-10-24 7:17 ` Eli Zaretskii
2020-10-26 8:38 ` Jens C. Jensen
2020-10-26 15:18 ` Eli Zaretskii
2020-10-27 18:10 ` Yuan Fu
2020-10-27 18:32 ` Eli Zaretskii
2020-10-22 16:05 ` 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=4F794407-585E-4C74-85F3-00A668FB9675@gmail.com \
--to=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=help-gnu-emacs@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 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.