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: Eli Zaretskii
Subject: Re: Allowing point to be outside the window?
Date: Sat, 04 Dec 2021 18:24:13 +0200

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sat, 04 Dec 2021 21:13:40 +0800
> 
> > This "allows point to be outside a window" in what situations?
> 
> If you move point out of the visible area of the window (such as with
> `goto-char') or if you set the window start but do not force it.

Which commands did you try in addition to goto-char?  What about
scrolling commands?

> > Shouldn't set_cursor_from_row be disabled/bypassed in this mode?
> >
> > And I don't understand the dance with the cursor_visible_p flag: why
> > do you reset it at entry and set back before exiting?  Isn't the value
> > of w->cursor enough to tell whether the cursor position was computed
> > or not?
> 
> The idea is that if `set_cursor_from_row' returns false (say if the
> cursor was not found to be in the row), w->cursor_visible will also be
> set to false.

But you are just wasting cycles that way.  When it is known that point
is outside of the window, that function will end up being called for
every screen line we lay out.  Instead, just set the result without
calling it in those cases.

> I don't understand why set_cursor_from_row should be disabled though:
> isn't it responsible for placing the cursor on the display (and as such,
> isn't it required for the cursor to be displayed when point is _inside_
> the window?).

Yes.  I meant when you know that point is outside of the window.

> > I don't understand this change.  Are you forcibly trying to avoid
> > calling try_scrolling?  If so, why?  That function is only loosely
> > related to scrolling commands; in fact, if you type C-v in "emacs -Q",
> > you will never see it called.  This function is an optimization of a
> > window's redisplay, and that is needed even in this new mode you are
> > implementing.
> 
> Doesn't `try_scrolling' try to constrain point inside if it is too near
> the end of the window?

Among other things, yes.  But its main purpose is not to move point,
it's to find a suitable window-start position.

> (And isn't the optimization that tries to decide whether or not to
> blit the display if appropriate `scrolling_window' in dispextern.c?)

scrolling_window belongs to the second phase of a redisplay cycle,
where we actually deliver glyphs to the glass.  try_scrolling is from
the first phase, where we decide what should be on the glass.

In any case, both try_scrolling and scrolling_window are not about
bringing point back into view, they are about redrawing the window so
that it correctly reflects the buffer contents.  So these functions
cannot and shouldn't be bypassed, even in this mode.

> > The condition above doesn't check the keep_point_visible flag, why?
> 
> w->cursor_visible_p should always be true if keep_point_visible is not
> nil by the time we get there.

There should be a comment there about this, and perhaps also an
assertion.



reply via email to

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