all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: akib@disroot.org
Cc: emacs-devel@gnu.org
Subject: Re: Questions on glyph matrices used for rendering frame in terminal
Date: Mon, 4 Jul 2022 21:37:02 +0200	[thread overview]
Message-ID: <D0F762ED-35A6-469C-A0AD-0BFC061BAA5E@gmail.com> (raw)

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


>> 
> 1. What's the purpose of the following in
> build_frame_matrix_from_leaf_window?  "frame_row->used[TEXT_AREA]" will
> always end up being equal to "window_matrix->matrix_w" after processing
> the right-most window of the row.

I don't understand.  What about the /matrix_x/ + matrix_w below?

> 
> --8<---------------cut here---------------start------------->8---
>       /* Set number of used glyphs in the frame matrix.  Since we fill
>          up with spaces, and visit leaf windows from left to right it
>          can be done simply.  */
>       frame_row->used[TEXT_AREA]
>         = window_matrix->matrix_x + window_matrix->matrix_w;
> --8<---------------cut here---------------end--------------->8---
> 
> 
> 2. From the documentation of make-terminal-frame:
> 
> > Note that changing the size of one terminal frame automatically
> > affects all frames on the same terminal device.
> 
> 
> But why?  Do they share glyph matrices, since only one of them is
> visible at a single time?

How else should other frames behave?  Leave a "hole" on the terminal where nothing is displayed when the TTY window is made larger?  And what if the terminal is made smaller?

> 
> 
> 3. Why clear the desired matrix in build_frame_matrix?  As I understand,
> that would clear the glyph matrices of windows the frame, because window
> desired matrix shares memory with frame desired matrix, and its seems
> like build_frame_matrix is called after window desired matrices are
> built.
> 
> --8<---------------cut here---------------start------------->8---
>   /* Clear all rows in the frame matrix covered by window matrices.
>      Menu bar lines are not covered by windows.  */
>   for (i = FRAME_TOP_MARGIN (f); i < f->desired_matrix->nrows; ++i)
>     clear_glyph_row (MATRIX_ROW (f->desired_matrix, i));
> --8<---------------cut here---------------end--------------->8---

In the TTY case, the glyph memory (struct glyph) for desired window matrices is sub-allocated from the glyph memory that is allocated for the frame.  The glyph_row structures on the other hand are different between windows and frame.  Clear_glyph_row doesn't affect the glyph memory, only the glyh_rows.

> 
> 
> 4. And one more question: why don't Emacs is use the window feature of
> ncurses despite depending on it?  Is it inefficient or lack of any
> feature?
> 

The reasons I can think of are

- ncurses is considerably younger than Emacs
- Its predecessor 'curses' (from BSD, IIRC) wasn't available everywhere (think VMS, MS-DOS, maybe others), when that part of the code was written.  I would guess that might have been around 1985.  What would that be - Emacs 16 :-).

Maybe there are also other technical reasons that make a rewrite with ncurses impossible, I don'T know.

(And there's of course always the consideration of why rewrite something that works.)




[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 874 bytes --]

             reply	other threads:[~2022-07-04 19:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04 19:37 Gerd Möllmann [this message]
2022-07-05  2:49 ` Questions on glyph matrices used for rendering frame in terminal Po Lu
2022-07-05  4:26 ` Akib Azmain Turja
2022-07-05  6:24   ` Gerd Möllmann
2022-07-05  9:03     ` Akib Azmain Turja
  -- strict thread matches above, loose matches on Subject: below --
2022-07-04 17:26 Akib Azmain Turja

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=D0F762ED-35A6-469C-A0AD-0BFC061BAA5E@gmail.com \
    --to=gerd.moellmann@gmail.com \
    --cc=akib@disroot.org \
    --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.