unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Text Properties And Buffer Modification
Date: Sat, 08 Dec 2018 10:42:31 +0100	[thread overview]
Message-ID: <5C0B9207.8050508@gmx.at> (raw)
In-Reply-To: <83a7li79ee.fsf@gnu.org>

 >> IIUC try_window_id is based on the idea that typing should be fast
 >> (that is, cause no excessive redisplay) as long as it does not happen
 >> within an overlay.
 >
 > Not sure I agree with this interpretation.  My mental model of
 > try_window_id was that it attempts to reuse what is already on display
 > by scrolling parts of the displayed stuff, and then inserting/deleting
 > a few lines that have changed.  It determines which parts of the
 > display could be reused by analyzing where are the changes in the
 > buffer relative to the displayed portion.

The current description of try_window_id in xdisp.c is

       This function attempts to redisplay a window by reusing parts of
       its existing display.  It finds and reuses the part that was not
       changed, and redraws the rest.  (The "id" part in the function's
       name stands for "insert/delete", not for "identification" or
       somesuch.)

Could you kindly add that "scrolling parts of the displayed stuff"
there somehow.  For a simple minded reader like me, it's intuitively
not clear that it can do such virtual scrolling of unchanged contents.
Maybe also tell how many such unaltered chunks can be reused and/or
how large they must be.

 > How did we arrive at the
 > situation where only some lines need to be changed is immaterial, and
 > in general is not by typing, quickly or otherwise.

OK.  I was looking for the rationale of try_window_id and that's what
I came up with.  Till now I naively imagined try_window_id to reuse
parts of the old glyph matrix as long as a user did _not add or remove
a newline_ thus causing the part below the line where the change
occurred to move within the glyph matrix and consequently invalidate
the entire matrix and trigger a redisplay of the entire window.  The
fact that the code is smarter than that has eluded me so far.

 > try_window_id gives up if overlay changed because it finds the
 > portions of the displayed text to be reused by looking at buffer text,
 > and overlays invalidate the assumption that only buffer text
 > determines what's on screen.

It wouldn't matter much but I think that redisplay could handle an
overlay change just like any text property change.

 >> But why do we optimize changes of text properties as well?
 >
 > I'm not sure I understand the question.  What do you mean by "optimize
 > changes of text properties"?

I was asking myself why it's important to treat text property changes
in an optimized way in try_window_id because I thought they wouldn't
be affected much by typing.  And as far as font-locking is concerned,
it invalidates the rest of the buffer parts shown in a window anyway
whenever a text change occurs.

martin



  reply	other threads:[~2018-12-08  9:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 23:39 Text Properties And Buffer Modification T.V Raman
2018-12-05  6:33 ` Eli Zaretskii
2018-12-05  7:15   ` Joost Kremers
2018-12-05  8:30     ` Eli Zaretskii
2018-12-05 15:32       ` Stefan Monnier
2018-12-05 17:35         ` T.V Raman
2018-12-05 18:42         ` Eli Zaretskii
2018-12-05 19:04           ` martin rudalics
2018-12-05 19:09             ` Eli Zaretskii
2018-12-06  9:07               ` martin rudalics
2018-12-06  9:19                 ` Eli Zaretskii
2018-12-06 10:10                   ` martin rudalics
2018-12-06 10:28                     ` Eli Zaretskii
2018-12-06 18:46                       ` martin rudalics
2018-12-06 19:16                         ` Eli Zaretskii
2018-12-08  9:42                           ` martin rudalics [this message]
2018-12-08 11:22                             ` Eli Zaretskii
2018-12-05 20:54           ` Stefan Monnier
2018-12-06  6:04             ` Eli Zaretskii
2018-12-05  9:16   ` martin rudalics
2018-12-05 10:54     ` Eli Zaretskii
2018-12-05 19:04       ` martin rudalics
2018-12-05 19:08         ` 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5C0B9207.8050508@gmx.at \
    --to=rudalics@gmx.at \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).