all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: emacs-devel@gnu.org
Subject: Re: update_window:  w->desired_matrix is a partial representation.
Date: Sat, 19 Jan 2019 11:16:32 +0200	[thread overview]
Message-ID: <83h8e5atxr.fsf@gnu.org> (raw)
In-Reply-To: <m25zuntavr.wl%esq@lawlist.com> (message from Keith David Bershatsky on Thu, 17 Jan 2019 10:08:40 -0800)

> Date:  Thu, 17 Jan 2019 10:08:40 -0800
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  emacs-devel@gnu.org
> 
> VPOS 6 of the desired_matrix is _not_ enabled_p.  Thus, update_window_line is not called on that particular VPOS.

That means the contents of desired_matrix for this VPOS is not useful.

> The cache of fake cursors contains relevant coordinates (x, y, hpos, vpos), which are needed for erasing and/or redrawing.

Why do you cache screen coordinates and not the buffer positions?  If
the screen contents around some cursor don't change, you don't need to
redraw the cursor, so you don't need the coordinates.  And if the
screen does change, more often than not the coordinates will be
inaccurate anyway, and need to be recomputed anew.  So why cache them?

> I have a working draft that uses the existing function update_text_area (within dispnew.c) to track changes to each VPOS, and does the following:
> 
> -  All cached fake cursors for the changed VPOS are deleted from the cache.
> 
> -  The portion of each row that remains the same, do not need the fake cursors to be redrawn (except wherever overlaps occur when rif->write_glyphs gets called) -- instead, just the cache of fake cursors gets updated for that section of the row that remains the same.
> 
> -  Subsequent to each call of rif->write_glyphs, the fake cursors get redrawn for the length of what got rewritten by rif->write_glyphs and the cache gets updated accordingly.
> 
> -  As to the relevant section from the end of the row to the x-limit that gets cleared with rif->clear_end_of_line, fake cursors are redrawn on just the portion that got erased -- the cache is updated for the entire length between the end of the row and the right window edge (assumes no right margin).

This design assumes that update_window_line will be called for each
screen line where you have a cursor and whose contents change in some
way.  There's nothing in the display engine that makes sure this
assumption is true, since the display engine doesn't really know
anything about your fake cursors, does it?  For example, the display
engine could decide to use some optimization based on the buffer text,
which would invalidate your assumption.

Did you consider the alternative of calculating the screen coordinates
of the cursors like we do for the single "normal" cursor?  That is
done in set_cursor_from_row, which is called from display_line and
from several redisplay optimizations that avoid calling display_line.
You could call at the same places your function that recalculates the
coordinates of your cursors, if any, in that screen line, and then
store the calculated coordinates in the window structure, like we do
with the "normal" cursor.

> If the above-described plan of attack sounds prudent/efficient, then perhaps the appropriate place to update VPOS 6+ of the cache in this situation is wherever redisplay "scrolls the text on the glass directly"?

See try_window_id.  Search for "Scroll the display" to see how it
bypasses update_window for the screen lines it scrolls.  Directly
above that you will find code that updates the cursor accordingly.

If you decide to keep your current design, you should augment it so
that any future changes that introduce additional bypasses, such as
the ones in try_window_id, will be supported by fake cursors with
minimum changes.



  reply	other threads:[~2019-01-19  9:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 18:08 update_window: w->desired_matrix is a partial representation Keith David Bershatsky
2019-01-19  9:16 ` Eli Zaretskii [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-01-19 23:03 Keith David Bershatsky
2019-01-17  8:05 Keith David Bershatsky
2019-01-17 13:56 ` 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=83h8e5atxr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=esq@lawlist.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.