all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Akib Azmain Turja <akib@disroot.org>
To: Eli Zaretskii <eliz@gnu.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 20:33:52 +0600	[thread overview]
Message-ID: <87bkttytdb.fsf@disroot.org> (raw)
In-Reply-To: <8335f6xrjo.fsf@gnu.org>

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

Eli Zaretskii <eliz@gnu.org> writes:

>> But this problem is different than that.  In your too-long line case,
>> redisplay code checks whether a glyph is inside the window.  But for
>> child frames, it needs to check whether a glyph is inside the parent
>> frame (i.e. safe to write to), write it if it is and always assume
>> that it was written successfully.
>> 
>> For example, if we have a 30 chars wide child frames displaying a 40
>> chars wide line and the child frame's left edge is 20 char away from
>> it's parent right edge, the redisplay code has to write the first 20
>> chars to the glyph matrix and don't write the next 10 chars, but still
>> think that they were written, and finally truncate the last 10 chars or
>> wrap it depending on the value of "truncate-lines".
>
> The way redisplay of a window works, it starts by determining how wide
> can each screen line be before it overflows the right edge of the
> window.  The result of this is the member of 'struct it' called
> 'last_visible_x'.  It is computed once (see init_iterator), and then
> used everywhere when we need to decide whether there's place in the
> screen line for one more glyph.
>
> So to support the above, we'd just need to modify the calculation of
> last_visible_x in init_iterator such that it takes into consideration
> the edge of the parent frame.  And that shouldn't be hard, given that
> we know the offset of the child frame from its parent frame.
>

What do you mean?  Set last_visible_x to the last x position not
clipped?  That won't work, since last_visible_x has no effect on
margins AFAIK.  Same for first_visible_x.

I have another idea, we can make the glyph matrix memory larger than the
top-level (i.e. not a child) frame:

--8<---------------cut here---------------start------------->8---
+--------------------------------------+
|+------------------------------------+|
||                                    ||<<< glyph matrix memory
||<<< frame glyph matrix              ||
||                                    ||
||                                    ||
||                                    ||
||    +-----------------------------+ ||
||    |<<< child frame glyph matrix | ||
||    |                             | ||
|+----|.............................|-+|
|     |                             |  |
|     +-----------------------------+  |
+--------------------------------------+
--8<---------------cut here---------------end--------------->8---

According to the figure above, rendering glyphs for part of child frame
outside the top-level frame's edges won't cause any error because it
will write to allocated memory, but still those glyph won't appear on
the glass because they are outside the glyph matrix of the top-level
frame.  This technique won't allow to clip a nested child frame to the
edges of it parent (which is also a child frame) and also wastes some
memory, however.

Do you have a list of functions that directly writes to glyph matrix?
It is much easier to work with function than to work with dynamic
memory.

-- 
Akib Azmain Turja

This message is signed by me with my GnuPG key.  It's fingerprint is:

    7001 8CE5 819F 17A3 BBA6  66AF E74F 0EFA 922A E7F5

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2022-07-13 14:33 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 [this message]
2022-07-13 15:57                         ` Eli Zaretskii
2022-07-13 17:55                           ` Akib Azmain Turja
2022-07-13 18:11                             ` Eli Zaretskii
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=87bkttytdb.fsf@disroot.org \
    --to=akib@disroot.org \
    --cc=eliz@gnu.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.