From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: 'struct window' cleanup #5 [Re: 'struct window' cleanup #4]
Date: Tue, 03 Jul 2012 18:58:40 +0300 [thread overview]
Message-ID: <8362a46dlb.fsf@gnu.org> (raw)
In-Reply-To: <4FF28930.1000202@yandex.ru>
> Date: Tue, 03 Jul 2012 09:54:56 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: emacs-devel@gnu.org
>
> > Shouldn't we test w->window_end_valid for being non-zero, before we
> > trust the value of w->window_end_vpos? Zero for a vertical position
> > is perfectly valid, so if i is zero, you can err here.
>
> The core idea is to have window_end_vpos (and window_end_pos) equal to -1
> for just created window (i.e. pointer returned by make_window). For such
> a window, window_end_valid is always 0, and passing such a window to
> main redisplay routines is an error (so there are 4 debugging checks
> commented with "Just initialized windows should not pass here"). If the
> window is completely initialized, window_end_vpos may be 0 and
> window_end_valid may be 0 or 1.
AFAICT, window_end_valid and window_end_vpos have nothing to do with
initializing windows. They are flags used by the display engine in
order to know when certain redisplay optimizations are possible. So I
don't see how a completely initialized window has anything to do with
the fact that window_end_vpos is valid. Am I missing something?
But if what you write is true, the commentary to window_end_vpos and
window_end_pos should be modified, because right now the comments tell
explicitly not to trust the values of these two if window_end_valid is
zero. If not every use of those two must test window_end_valid first,
then we should explain in the comments when such a test is needed.
> > Bother: doesn't the comparison with w->buffer test for a specific
> > buffer, rather than just non-nil value? The corresponding assignment,
> > viz.:
> >
> >> if (accurate_p)
> >> {
> >> - w->window_end_valid = w->buffer;
> >> + w->window_end_valid = 1;
> >> w->update_mode_line = 0;
> >> }
> >
> > seems to handle the case when the display is "accurate". Perhaps use
> > a different value, like 2, for this situation?
>
> I tried a lot, but never hits the situation where window buffer was changed
> on the way from mark_window_display_accurate_1 to note_mouse_highlight (buffer
> text may be changed, of course). So I suppose that w->window_end_valid = w->buffer
> is just a synonym for w->window_end_valid = Qt.
I'm not convinced, sorry. note_mouse_highlight is usually invoked
asynchronously (when the mouse hovers above some mouse-sensitive part
of the display), so deliberately producing a situation could be
tricky. The fact that you didn't hit that combination doesn't
necessarily prove it is impossible. So I would still suggest to use a
special value, because bugs in these areas are notoriously hard to
track down.
Thanks.
prev parent reply other threads:[~2012-07-03 15:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-02 10:45 'struct window' cleanup #4 Dmitry Antipov
2012-07-02 14:48 ` Stefan Monnier
2012-07-02 17:07 ` Eli Zaretskii
2012-07-02 17:33 ` Eli Zaretskii
2012-07-03 5:54 ` 'struct window' cleanup #5 [Re: 'struct window' cleanup #4] Dmitry Antipov
2012-07-03 15:58 ` Eli Zaretskii [this message]
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=8362a46dlb.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=dmantipov@yandex.ru \
--cc=emacs-devel@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.