all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jose A Ortega Ruiz <jao@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tom@logand.com, emacs-devel@gnu.org
Subject: Re: Implementing image support for kitty terminal
Date: Fri, 09 Sep 2022 15:56:35 +0100	[thread overview]
Message-ID: <87wnacbnq4.fsf@mail.jao.io> (raw)
In-Reply-To: <83wnadcajk.fsf@gnu.org>

On Fri, Sep 09 2022, Eli Zaretskii wrote:

[...]

>> for instance, displaying an image would amount (logically) to
>> displaying a bunch of lines of text, all of the same length, with
>> the only peculiarity that maybe the cells on the borders wouldn't
>> look completely filled.
>
> That won't work, because Emacs must know the screen layout; you cannot
> lie to it with impunity.  For example, with your idea above, if point
> is in the first line of a window, and you type C-n, and the next line
> displays an image which takes more than one character cell's height,
> then what will be the line number, as it's known to Emacs, when point
> moves to that second line?  If you tell Emacs that there are 10 lines
> of text in-between, instead of a single tall line, Emacs will think
> the next line is line 11, whereas from the user POV it's line 2.

Say that, in that line, i have an image, which emacs knows about because
there's, say, a text property with 4 rows x 5 columns as the image
extent (which we derive from knowing the image size and the terminal
cell size, in pixels).  For movement and display purpose, we tell Emacs
to interpret that as the block of pure text

xxxx
xxxx
xxxx
xxxx
xxxx

and emacs, initially, displays that, as a normal tty would, with point
at the beginning of the block.  Now, it computes how many lines are
visible after any required scrolling, and then asks kitty to draw, on
the visible rectangle, the corresponding part of the image.

All movements and positioning would happen as if all that is being
displayed are blocks of text.  Of course that means that line numbers
won't treat images as spawning just one line, but several.  I find that
actually an advantage from the user's point of view, because the images
are taking more than one line in the glass, so to me it's very natural
that emacs tells me that, at the beginning of the image, line is no. 2,
and, at the end, line is no. 20.  and images could be scrolled line by
line in that schema. These terminals use the GPU for rendering when
available, so my expectation is that frequent redraws of the displayed
image sections will be fast enough, but i could well be wrong.

> A lot of Emacs features depend on Emacs knowing exactly what's on the
> screen, so you cannot easily lie to it about that.

Yes.  I am proposing we tell emacs that what's on the screen is some
lines of xs-text and making that, actually, true in every sense except
that we also tell kitty to display those rows differently at the very
end, when emacs is done with its text display duties.

jao
-- 
Whenever you commend, add your reasons for doing so; it is this which
distinguishes the approbation of a man of sense from the flattery of
sycophants and admiration of fools. -Richard Steele (1672-1729)



  reply	other threads:[~2022-09-09 14:56 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07 15:50 Implementing image support for kitty terminal Jose Antonio Ortega Ruiz
2022-09-07 17:10 ` Tomas Hlavaty
2022-09-07 18:11 ` Eli Zaretskii
2022-09-07 18:49   ` Jose A Ortega Ruiz
2022-09-07 19:41     ` Eli Zaretskii
2022-09-07 20:09       ` Jose A Ortega Ruiz
2022-09-08  6:51         ` Eli Zaretskii
2022-09-07 20:11       ` Stefan Monnier
2022-09-08  5:30         ` Eli Zaretskii
2022-09-08 12:47         ` Gerd Möllmann
2022-09-08 13:54           ` Eli Zaretskii
2022-09-08 14:03             ` Gerd Möllmann
2022-09-08 14:24               ` Gerd Möllmann
2022-09-08 16:04                 ` Eli Zaretskii
2022-09-09  4:59                   ` Gerd Möllmann
2022-09-09 12:19                   ` Stefan Monnier
2022-09-09 12:53                     ` Eli Zaretskii
2022-09-09 12:59                     ` Gerd Möllmann
2022-09-09 13:17                       ` tomas
2022-09-09 14:10                         ` Gerd Möllmann
2022-09-09 14:20                           ` Eli Zaretskii
2022-09-09 14:27                             ` Gerd Möllmann
2022-09-09 15:12                               ` Stefan Monnier
2022-09-10  7:52                                 ` Gerd Möllmann
2022-09-10 14:13                                   ` Optimizing tty display update (was: Implementing image support for kitty terminal) Stefan Monnier
2022-09-10 14:17                                     ` Gerd Möllmann
2022-09-10 14:25                                       ` Eli Zaretskii
2022-09-10 14:29                                         ` Gerd Möllmann
2022-09-10 15:14                                         ` Optimizing tty display update Stefan Monnier
2022-09-11 10:21                                           ` Gerd Möllmann
2022-09-11  1:09                                         ` Po Lu
2022-09-11  4:44                                           ` Gerd Möllmann
2022-09-11  5:32                                             ` VCS forensics (was: Optimizing tty display update) Eli Zaretskii
2022-09-11  5:51                                               ` VCS forensics Gerd Möllmann
2022-09-10 16:54                                       ` Optimizing tty display update Lars Ingebrigtsen
2022-09-10  8:06                           ` Implementing image support for kitty terminal Kyaw Thu Soe
2022-09-09 13:27                       ` Stefan Monnier
2022-09-08 16:00               ` Eli Zaretskii
2022-09-09  4:58                 ` Gerd Möllmann
2022-09-07 18:56   ` Tomas Hlavaty
2022-09-07 19:51     ` Eli Zaretskii
2022-09-08 18:30       ` Tomas Hlavaty
2022-09-08 18:45         ` Eli Zaretskii
2022-09-08 19:45           ` Tomas Hlavaty
2022-09-08 20:33             ` Jose A Ortega Ruiz
2022-09-08 20:29         ` Jose A Ortega Ruiz
2022-09-08 20:52           ` Tomas Hlavaty
2022-09-08 21:47             ` Jose A Ortega Ruiz
2022-09-08 22:21               ` Óscar Fuentes
2022-09-08 22:46                 ` Tomas Hlavaty
2022-09-09  5:48                 ` Jose A Ortega Ruiz
2022-09-08 22:43               ` Tomas Hlavaty
2022-09-08 23:32                 ` Jose A Ortega Ruiz
2022-09-09  1:43                   ` Po Lu
2022-09-09  5:52                     ` Jose A Ortega Ruiz
2022-09-09  7:25                       ` Po Lu
2022-09-09  6:06                   ` Eli Zaretskii
2022-09-09  6:21                     ` Jose A Ortega Ruiz
2022-09-09  6:43                       ` Eli Zaretskii
2022-09-09 14:56                         ` Jose A Ortega Ruiz [this message]
2022-09-09 15:20                           ` chad
2022-09-09 15:34                             ` Jose A Ortega Ruiz
2022-09-10  2:56                               ` Tomas Hlavaty
2022-09-10  3:35                                 ` Visuwesh
2022-09-10  6:01                                   ` Tomas Hlavaty
2022-09-10  6:51                                     ` Po Lu
2022-09-10 19:52                                       ` Tomas Hlavaty
2022-09-09 15:25                           ` Stefan Monnier
2022-09-09 16:15                           ` Eli Zaretskii
2022-09-10  0:45                             ` Jose A Ortega Ruiz
2022-09-10  6:15                               ` Eli Zaretskii
2022-09-09  1:41               ` Po Lu
2022-09-09  5:53                 ` Jose A Ortega Ruiz
2022-09-22 17:31                 ` Memory problems update (was: Implementing image support for kitty terminal) Jose Antonio Ortega Ruiz
2022-09-23  0:29                   ` Memory problems update Po Lu
2022-09-23  1:11                     ` Jose A Ortega Ruiz
2022-09-23  6:08                       ` Eli Zaretskii
2022-09-23 21:46                         ` Jose A Ortega Ruiz
2022-09-23 21:57                       ` Jose A Ortega Ruiz
2022-09-23 23:32                         ` Jose A Ortega Ruiz
2022-09-24  0:20                         ` Po Lu
2022-09-24 12:59                           ` Jose A Ortega Ruiz
2022-09-23  5:33                   ` Memory problems update (was: Implementing image support for kitty terminal) Eli Zaretskii
2022-09-23 22:01                     ` Jose A Ortega Ruiz
2022-09-24  6:25                       ` Eli Zaretskii
2022-09-24  6:33                         ` Memory problems update Po Lu
2022-09-24 12:53                           ` Jose A Ortega Ruiz
2022-09-09  1:40           ` Implementing image support for kitty terminal Po Lu
2022-09-09  5:56             ` Jose A Ortega Ruiz
2022-09-07 19:59     ` Jose A Ortega Ruiz
2022-09-08 11:13       ` Akib Azmain Turja
2022-09-08 13:25         ` Jose A Ortega Ruiz
2022-09-08 19:26         ` Tomas Hlavaty
2022-09-08 19:15       ` Tomas Hlavaty
2022-09-08 19:30         ` Eli Zaretskii
2022-09-08 20:03           ` Tomas Hlavaty
2022-09-09  5:43             ` Eli Zaretskii
2022-09-10  3:02               ` Tomas Hlavaty
2022-09-08 10:59     ` Akib Azmain Turja
2022-09-08 13:44       ` Eli Zaretskii
2022-09-08  9:13 ` Akib Azmain Turja
2022-09-08 19:31   ` Tomas Hlavaty
  -- strict thread matches above, loose matches on Subject: below --
2022-09-10 10:15 xenodasein--- via Emacs development discussions.
2022-09-10 10:38 ` Eli Zaretskii
2022-09-10 11:06   ` xenodasein--- via Emacs development discussions.
2022-09-10 11:13   ` 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=87wnacbnq4.fsf@mail.jao.io \
    --to=jao@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=tom@logand.com \
    /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.