all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: deng@randomsample.de, emacs-devel@gnu.org
Subject: Re: Recenter video
Date: Wed, 23 Jun 2010 20:44:07 +0300	[thread overview]
Message-ID: <83ocf1eja0.fsf@gnu.org> (raw)
In-Reply-To: <AANLkTimysMBDmPqRMfSTlW5qwqrRdGpr5dRwTbxrLyCW@mail.gmail.com>

> From: Lennart Borgman <lennart.borgman@gmail.com>
> Date: Wed, 23 Jun 2010 18:14:25 +0200
> Cc: deng@randomsample.de, emacs-devel@gnu.org
> 
> > Doesn't your patch cause try_scrolling to be called?  If so, that's a
> > no-no when the window_end_valid flag is nil.
> 
> 
> I don't think so, but since you suspect it I must ask you why you
> think it does that.

As far as I remember, the history of this was as follows:

You found that the clip_changed flag was the one that prevented
try_scrolling from being called, in this part of redisplay_window:

  /* Try to scroll by specified few lines.  */
  if ((scroll_conservatively
       || scroll_step
       || temp_scroll_step
       || NUMBERP (current_buffer->scroll_up_aggressively)
       || NUMBERP (current_buffer->scroll_down_aggressively))
      && !current_buffer->clip_changed
      && CHARPOS (startp) >= BEGV
      && CHARPOS (startp) <= ZV)
    {
      /* The function returns -1 if new fonts were loaded, 1 if
	 successful, 0 if not successful.  */
      int rc = try_scrolling (window, just_this_one_p,
			      scroll_conservatively,
			      scroll_step,
			      temp_scroll_step, last_line_misfit);

(When try_scrolling cannot be called, or when it is called and reports
a failure, Emacs falls back to recentering around point.)

The clip_changed flag was supposed to be reset by
reconsider_clip_changes, but it wasn't reset because of the condition
indicated below:

  if (b->clip_changed
	   && !NILP (w->window_end_valid)  <<<<<<<<<<<<<<<<<
	   && w->current_matrix->buffer == b
	   && w->current_matrix->zv == BUF_ZV (b)
	   && w->current_matrix->begv == BUF_BEGV (b))

Your patch tweaks the clip_changed flag so that it is now not set, and
the obstacle for calling try_scrolling is thereby removed.  But the
window_end_valid flag is still nil, because your patch does nothing to
change its value.  Calling try_scrolling when window_end_valid is nil
is not allowed, because try_scrolling reuses the current glyph matrix,
which is only guaranteed to be up to date when window_end_valid is
non-nil.

To check the correctness of my description above, please put a
breakpoint inside try_scrolling conditioned by w->window_end_valid
being equal to Qnil, then scroll by leaning on the down arrow, and see
if the breakpoint ever breaks.  If it does break, your patch violates
the redisplay protocol regarding reuse of the current matrix.




  parent reply	other threads:[~2010-06-23 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87ocf24xi6.fsf@engster.org>
     [not found] ` <AANLkTilIbHosLmnAFlMyM9OWbPk79m2FOtDdi4IwYChb@mail.gmail.com>
     [not found]   ` <87k4pq4tel.fsf@engster.org>
2010-06-23  0:41     ` Recenter video Lennart Borgman
2010-06-23  3:06       ` Eli Zaretskii
2010-06-23  9:44         ` Lennart Borgman
2010-06-23 15:18           ` Eli Zaretskii
2010-06-23 16:14             ` Lennart Borgman
2010-06-23 16:25               ` Lennart Borgman
2010-06-23 17:44               ` Eli Zaretskii [this message]
2010-06-23 17:55         ` 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=83ocf1eja0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=deng@randomsample.de \
    --cc=emacs-devel@gnu.org \
    --cc=lennart.borgman@gmail.com \
    /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.