all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Akib Azmain Turja <akib@disroot.org>
Cc: luangruo@yahoo.com, monnier@iro.umontreal.ca,
	emacs-devel@gnu.org, ibluefocus@outlook.com
Subject: Re: Implementing child frames on terminal
Date: Wed, 13 Jul 2022 21:11:32 +0300	[thread overview]
Message-ID: <83leswvq5n.fsf@gnu.org> (raw)
In-Reply-To: <877d4gzyma.fsf@disroot.org> (message from Akib Azmain Turja on Wed, 13 Jul 2022 23:55:09 +0600)

> From: Akib Azmain Turja <akib@disroot.org>
> Cc: luangruo@yahoo.com, monnier@iro.umontreal.ca, emacs-devel@gnu.org,
>  ibluefocus@outlook.com
> Date: Wed, 13 Jul 2022 23:55:09 +0600
> 
> > You mean, the display margins?  If that is the problem that bothers
> > you, then yes, the functions in dispnew.c that calculate the
> > dimensions of each window will have to take the clipping into account.
> > And again, this calculation happens just once, in the beginning of a
> > redisplay cycle, and only if needed (i.e. only when the previously
> > calculated dimensions no longer fit).
> >
> > But last_visible_x will still need to be adjusted as I outlined,
> 
> I don't think so.  I tried to hard-code last_visible_x to 40.  Then I
> compiled and started Emacs and found that the lines of *scratch* buffer
> wrapped at 39th column (and the 40th column being the continuation
> glyph).

Right.  You just discovered that setting last_visible_x is not the
only thing that should be done.  But I never said it's the only thing,
just that it is _one_ thing that needs to be done.  Changing the code
which produces the continuation/truncation glyphs to support child
frames is not hard, but it does need some coding.  And there really is
no way around that, because that's how Emacs display works.

Remember: this all came out of discussions about the design of child
frames on TTY displays, where you expressed doubt that we could easily
"clip" child frames where needed.  But that basic design is just the
beginning; there's more to this than meets the eye.

> It seems that line numbers are also unaffected by that
> last_visible_x.

Yes, they are.  From maybe_produce_line_number:

  /* We must leave space for 2 glyphs for continuation and truncation,
     and at least one glyph for buffer text.  */
  int width_limit =
    tem_it.last_visible_x - tem_it.first_visible_x
    - 3 * FRAME_COLUMN_WIDTH (it->f);
  [...]
      PRODUCE_GLYPHS (&tem_it);

      /* Stop producing glyphs, and refrain from producing the line
	 number, if we don't have enough space on this line.  */
      if (tem_it.current_x >= width_limit)
	{
	  it->lnum_width = 0;
	  it->lnum_pixel_width = 0;
	  bidi_unshelve_cache (itdata, false);
	  inhibit_free_realized_faces = save_free_realized_faces;
	  return;
	}

> > Why produce glyphs that will never get written to the glass?  It's
> > just a waste of cycles.  And it isn't for free: we'd need to have code
> > that checks whether a glyph should or shouldn't be written to the
> > screen, because writing it outside of the terminal could have bad
> > effects.
> 
> IIUC, we won't need additional code.  Because those garbage glyphs are
> outside of the frame's glyph matrix, so the terminal display code won't
> notice them at all.
> 
> I think we are all trying to do premature optimization.  Do we bother
> whether a character is clipped on X?

On X, the clipping is a given.  But on text-mode terminal there's no
clipping: if you write one character too many on a line, it will
generally wrap to the next line.

> Or is there any real reason to optimize?

It isn't an optimization, it's safe coding.



  reply	other threads:[~2022-07-13 18:11 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28 13:15 [NonGNU ELPA] New packages: corfu-doc and corfu-doc-terminal Akib Azmain Turja
2022-05-28 13:55 ` Philip Kaludercic
2022-05-28 14:38 ` Stefan Monnier
2022-05-28 16:30   ` Akib Azmain Turja
2022-05-28 17:47     ` Stefan Monnier
2022-05-28 20:27       ` Akib Azmain Turja
2022-05-28 22:03         ` Stefan Monnier
2022-05-28 19:16     ` Eli Zaretskii
2022-05-28 20:40       ` Akib Azmain Turja
2022-05-29  6:26         ` Eli Zaretskii
2022-07-12  3:19           ` Implementing child frames on terminal Akib Azmain Turja
2022-07-12  5:13             ` Po Lu
2022-07-12  8:35               ` Akib Azmain Turja
2022-07-12  9:44                 ` Po Lu
2022-07-12 13:25                   ` Eli Zaretskii
2022-07-12 13:38                     ` Po Lu
2022-07-12 13:48                       ` Eli Zaretskii
2022-07-12 13:19                 ` Eli Zaretskii
2022-07-12 14:21                   ` Akib Azmain Turja
2022-07-12 15:46                     ` Eli Zaretskii
2022-07-13 14:33                       ` Akib Azmain Turja
2022-07-13 15:57                         ` Eli Zaretskii
2022-07-13 17:55                           ` Akib Azmain Turja
2022-07-13 18:11                             ` Eli Zaretskii [this message]
2022-07-14  7:14                               ` Akib Azmain Turja
2022-07-14  7:27                                 ` Eli Zaretskii
2022-07-12 13:06             ` Eli Zaretskii
2022-07-12 13:40               ` Po Lu
2022-07-12 13:50                 ` Eli Zaretskii
2022-07-12 13:54                   ` Po Lu
2022-07-12 14:17                     ` Eli Zaretskii
2022-07-14  1:27                       ` Po Lu
2022-07-14  1:55                       ` Stefan Monnier
2022-07-14  3:34                         ` Po Lu
2022-07-14 14:00                           ` Stefan Monnier
2022-07-14  5:56                         ` Eli Zaretskii
2022-07-14  6:29                           ` Po Lu
2022-07-14  6:53                           ` Akib Azmain Turja
2022-07-14  7:20                             ` Eli Zaretskii
2022-07-14 12:07                               ` Akib Azmain Turja
2022-07-14 13:12                                 ` Eli Zaretskii
2022-07-14 13:52                                   ` Akib Azmain Turja
2022-07-14 14:00                                     ` Eli Zaretskii
2022-07-15  2:37                                     ` Po Lu
2022-07-15  3:35                                       ` Stefan Monnier
2022-07-15  4:24                                         ` Po Lu
2022-07-15  5:07                                           ` tomas
2022-07-14  7:25                             ` Po Lu
2022-07-14 12:11                               ` Akib Azmain Turja
2022-07-14 19:33                               ` Tassilo Horn
2022-07-14 14:03                           ` Stefan Monnier
2022-07-15 10:28                             ` Akib Azmain Turja
2022-07-12 14:03                 ` Akib Azmain Turja
2022-05-28 15:02 ` [NonGNU ELPA] New packages: corfu-doc and corfu-doc-terminal Stefan Monnier
2022-05-28 16:06 ` Akib Azmain Turja
2022-05-28 17:46   ` Philip Kaludercic
2022-05-28 20:31     ` Akib Azmain Turja
2022-05-29  8:14       ` Daniel Mendler
2022-07-15 15:06         ` Akib Azmain Turja
2022-07-17 14:53           ` Philip Kaludercic
2022-07-17 17:06             ` Akib Azmain Turja
2022-07-17 18:27               ` Philip Kaludercic
2022-07-18  9:27                 ` Akib Azmain Turja
2022-07-17 19:08               ` Stefan Monnier

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=83leswvq5n.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=akib@disroot.org \
    --cc=emacs-devel@gnu.org \
    --cc=ibluefocus@outlook.com \
    --cc=luangruo@yahoo.com \
    --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 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.