emacs-devel
[Top][All Lists]
Advanced

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

Re: Allowing point to be outside the window?


From: Po Lu
Subject: Re: Allowing point to be outside the window?
Date: Thu, 09 Dec 2021 20:19:13 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> Once again, it's hard to understand the main ideas behind the
> feature.  You explained above when it brings point into the view, but
> what I'm looking for is an explanation for how to modify
> redisplay_window when this feature is turned ON, without losing too
> much of the existing redisplay functionality.

The idea is to prevent redisplay_window from entering `recenter' unless
`w->force_start' or a few other conditions are true, and to not display
the phys cursor if its position is unknown.  A large part of
`try_scrolling' is also disabled, but I think I know how to turn it on
now.

> Also, a large part of the patch seems to change mainly whitespace, so
> please use the -w switch to show diffs ignoring the whitespace
> changes, because otherwise it's very hard to spot the real changes.

Thanks, I will keep that in mind in the future.

> A couple of comments below:

>> --- a/src/window.c
>> +++ b/src/window.c
>> @@ -5576,7 +5576,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
>> bool whole, bool noerror)

> It seems you made changes for GUI scrolling, but not for TTY
> scrolling?  Is this feature supposed to be disabled on TTY frames?

No, it's something I plan to do in a while, but not yet.

>> @@ -17768,6 +17770,9 @@ try_scrolling (Lisp_Object window, bool 
>> just_this_one_p,
>>    else
>>      scroll_max = 0;
>>  
>> +  if (!keep_point_visible)
>> +    goto out;
>> +
>>   too_near_end:

> I'm confused here.  This bypasses all of try_scrolling's code, which
> can select a new window-start because, for example, point moved out of
> the visible portion of the window.  Does this mean that when
> this feature is turned ON, scrolling of the window in these cases is
> no longer supported?  For example, let's say I pressed C-n and that
> moved point below the window's end (with the default zero value of
> scroll-margin) -- does it mean the window will not scroll, leaving
> point invisible in this case?

It does not: it enters the code under the `recenter' label instead,
which causes point to be displayed at the center of the screen.

But the behavior is very different between that and the code in
try_scrolling, so I think it should be turned on if the numeric value of
point has changed, as we do with the recenter label.

>> @@ -18183,6 +18190,10 @@ try_cursor_movement (Lisp_Object window, struct 
>> text_pos startp,
>>      return rc;
>>  #endif
>>  
>> +  /* TODO: enable this optimization.  */
>> +  if (!keep_point_visible)
>> +    return CURSOR_MOVEMENT_CANNOT_BE_USED;

> Likewise here: you are disabling one of the more important redisplay
> optimizations, which minimizes redisplay work when the user just move
> point a little ways.  Can you tell why this needs to be disabled under
> the new behavior? it seems to be unrelated, because the optimization
> only does its thing when point didn't leave the window.

I disabled all the redisplay optimizations when first developing this
feature, so I could turn them on one-by-one to see if they would cause
any problems.

This optimization works fine however, so it can be enabled.

> This will have to go eventually, as this trace is not useful in
> general.

Thanks, I'll keep that in mind.

> This optimization also doesn't necessarily have anything to do with
> point being outside of the window.

That's because I haven't tested to see if it works yet.

Thanks.



reply via email to

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