emacs-devel
[Top][All Lists]
Advanced

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

Re: move_it_vertically_backward question


From: Po Lu
Subject: Re: move_it_vertically_backward question
Date: Wed, 15 Dec 2021 21:38:14 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> I still don't believe that would be better than a separate primitive
>> (since it doesn't make sense to supply the width information to the
>> pixel scrolling code), and unfortunately I don't quite understand how
>> `window_text_pixel_size' works either:

> So you don't have a sufficient understanding of how
> window_text_pixel_size works, but you are already sure it isn't a good
> candidate for the job you'd like to do?  Maybe it's better to wait
> until your understanding is sufficient, before making up your mind
> about that?

No, I meant "don't quite understand" as in the two questions I asked
you, which you've answered below:

> Do you understand why we use SAVE_IT and RESTORE_IT in the display
> engine?  (There's a comment near their definition which explains the
> basic reasons.)  If you do, I don't really see how such a question
> could pop up.  Maybe the comment that explains the need for this gork
> should be improved or clarified?

I didn't understand the comment when I first saw it, but now I do, so I
retract my question.  Thanks.

> See above: we don't lose anything in such situations.  I would not
> have allowed code into the display engine that would break bidi
> support.

>> Yes.  Maybe calling `move_it_vertically_backward' itself until a
>> suitable position is reached will be better, as I really don't want to
>> reinvent "move_it_vertically_backwards but slightly different".
>> 
>> Something like this:
>> 
>>   move_it_vertically_backward (&it, pix);
>> 
>>   while (-it.current_y < pix)
>>     {
>>       last_y = it.current_y;
>>       move_it_vertically_backward (&it, pix + it.current_y);
>> 
>>       if (it.current_y == last_y)
>>      break;
>>     }

> I cannot say anything intelligent because I don't think I understand
> the requirements well enough.  AFAICT, you never described them in
> enough detail, neither on help-gnu-emacs nor here.

The requirement is basically to find the start of a line that is at
least above window start by a given number of pixels, and to also find
the vertical distance between the top of that line and the start of the
window.

For instance, if we're scrolling upwards (upwards in this context is
opposite to the terminology we use for line-based scrolling: it means
moving the display downwards, like scroll-down) by 17 pixels, and there
are two lines each 14 pixels in height above window start, the new
window start will be set to the start position of the second line above
window start (which this function should return), and vscroll will be
set to 7 (which is 24 - 17, where the 24 is the aformentioned vertical
distance that this function should also return).

Thanks.


reply via email to

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