unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How is current_matrix and desired_matrix be created?
@ 2020-05-04  5:32 Tipo Jo
  2020-05-04 11:49 ` tomas
  2020-05-04 14:51 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Tipo Jo @ 2020-05-04  5:32 UTC (permalink / raw)
  To: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

I know that window->contents is the buffer should be shown in window. The
redisplay code use current_matrix and desired_matrix as the content should
be shown.
So what's the relationship between contents and those matrices? How does
emacs create the two matrices from window->contents?

[-- Attachment #2: Type: text/html, Size: 347 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How is current_matrix and desired_matrix be created?
  2020-05-04  5:32 How is current_matrix and desired_matrix be created? Tipo Jo
@ 2020-05-04 11:49 ` tomas
  2020-05-04 14:55   ` Eli Zaretskii
  2020-05-04 14:51 ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: tomas @ 2020-05-04 11:49 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

On Mon, May 04, 2020 at 01:32:15PM +0800, Tipo Jo wrote:
> I know that window->contents is the buffer should be shown in window. The
> redisplay code use current_matrix and desired_matrix as the content should
> be shown.

(Disclaimer: I haven't read the code yet, but the very readable
comments by Gerd Moellmann)

> So what's the relationship between contents and those matrices? How does
> emacs create the two matrices from window->contents?

Current matrix is the status as is shown on screen. Buffer updates
(insert character here, change some property there, scroll, etc)
go (conceptually, see below) to desired matrix. So the differences
of both represent the work that has to be done.

At redisplay time, both are compared and some "minimal" set of
changes is calculated, which are transmitted to the "glass", as
Gerd calls that. At this point, current matrix is thrown away,
and desired matrix becomes current matrix.

The "conceptually" above hints at the fact that the desired
matrix is "sparse", i.e. where it is equal to the current matrix
it might have a "hole" (if I got things right it happens line-
wise). So at redisplay time it starts out empty (which means
"equal to current matrix").

Cheers
-- t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How is current_matrix and desired_matrix be created?
  2020-05-04  5:32 How is current_matrix and desired_matrix be created? Tipo Jo
  2020-05-04 11:49 ` tomas
@ 2020-05-04 14:51 ` Eli Zaretskii
  2020-05-05 16:42   ` Tipo Jo
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-05-04 14:51 UTC (permalink / raw)
  To: Tipo Jo; +Cc: emacs-devel

> From: Tipo Jo <tiziyuanfang@gmail.com>
> Date: Mon, 4 May 2020 13:32:15 +0800
> 
> I know that window->contents is the buffer should be shown in window. The redisplay code use
> current_matrix and desired_matrix as the content should be shown. 
> So what's the relationship between contents and those matrices? How does emacs create the two matrices
> from window->contents?

Some of this is described in the large comment at the beginning of the
file xdisp.c.  I suggest to read that, and if you have follow-up
questions, ask them here.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How is current_matrix and desired_matrix be created?
  2020-05-04 11:49 ` tomas
@ 2020-05-04 14:55   ` Eli Zaretskii
  2020-05-04 15:39     ` tomas
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-05-04 14:55 UTC (permalink / raw)
  To: tomas; +Cc: emacs-devel

> Date: Mon, 4 May 2020 13:49:55 +0200
> From: <tomas@tuxteam.de>
> 
> Current matrix is the status as is shown on screen. Buffer updates
> (insert character here, change some property there, scroll, etc)
> go (conceptually, see below) to desired matrix. So the differences
> of both represent the work that has to be done.
> 
> At redisplay time, both are compared and some "minimal" set of
> changes is calculated, which are transmitted to the "glass", as
> Gerd calls that.

Small correction: the desired matrix is built as part of redisplay,
not before.

> At this point, current matrix is thrown away, and desired matrix
> becomes current matrix.

Small correction: the current matrix is never thrown away.  Instead,
it is updated by copying portions of the desired matrix into the
corresponding portions of the current matrix.  Then the _desired_
matrix is thrown away.

> The "conceptually" above hints at the fact that the desired
> matrix is "sparse", i.e. where it is equal to the current matrix
> it might have a "hole" (if I got things right it happens line-
> wise). So at redisplay time it starts out empty (which means
> "equal to current matrix").

Exactly, which is why the current matrix cannot be thrown away.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How is current_matrix and desired_matrix be created?
  2020-05-04 14:55   ` Eli Zaretskii
@ 2020-05-04 15:39     ` tomas
  0 siblings, 0 replies; 6+ messages in thread
From: tomas @ 2020-05-04 15:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

On Mon, May 04, 2020 at 05:55:44PM +0300, Eli Zaretskii wrote:

[...]

> Small correction [...]

Thanks for the corrections, appreciated :)

Cheers
-- t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How is current_matrix and desired_matrix be created?
  2020-05-04 14:51 ` Eli Zaretskii
@ 2020-05-05 16:42   ` Tipo Jo
  0 siblings, 0 replies; 6+ messages in thread
From: Tipo Jo @ 2020-05-05 16:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

Ok, thanks.

On Mon, May 4, 2020 at 10:51 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Tipo Jo <tiziyuanfang@gmail.com>
> > Date: Mon, 4 May 2020 13:32:15 +0800
> >
> > I know that window->contents is the buffer should be shown in window.
> The redisplay code use
> > current_matrix and desired_matrix as the content should be shown.
> > So what's the relationship between contents and those matrices? How does
> emacs create the two matrices
> > from window->contents?
>
> Some of this is described in the large comment at the beginning of the
> file xdisp.c.  I suggest to read that, and if you have follow-up
> questions, ask them here.
>

[-- Attachment #2: Type: text/html, Size: 1051 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-05 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04  5:32 How is current_matrix and desired_matrix be created? Tipo Jo
2020-05-04 11:49 ` tomas
2020-05-04 14:55   ` Eli Zaretskii
2020-05-04 15:39     ` tomas
2020-05-04 14:51 ` Eli Zaretskii
2020-05-05 16:42   ` Tipo Jo

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).