From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Implementing image support for kitty terminal Date: Thu, 08 Sep 2022 21:45:39 +0300 Message-ID: <83a679emcs.fsf@gnu.org> References: <87v8pz18wf.fsf@mail.jao.io> <83o7vrgimc.fsf@gnu.org> <87wnafdnee.fsf@logand.com> <835yhzgdyi.fsf@gnu.org> <87k06den1s.fsf@logand.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26802"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jao@gnu.org, emacs-devel@gnu.org To: Tomas Hlavaty Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 08 20:47:18 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWMYX-0006nd-Vs for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Sep 2022 20:47:18 +0200 Original-Received: from localhost ([::1]:38680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWMYX-0002SM-0t for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Sep 2022 14:47:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWMXE-0000w5-B1 for emacs-devel@gnu.org; Thu, 08 Sep 2022 14:45:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWMXC-0006Jk-Vw; Thu, 08 Sep 2022 14:45:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=PqIw5YQwXxmWNjobBDALwJ3jmvaOHW4uxtLu2G1D9fA=; b=kE0AabqvUjWH s1qfn4f/nLv1SjuCu1wTwj+6I3q0T+HQyP3Y7nq1TjraUHl1LoWEEci9FTOx+/NkgVmsoQ+U2zko2 79wcbDphhtSHsj4DIjXfIaMLQcIfIXt3dtJ06AsR9PP5azLiSPQq/JTPxA5y8PSFO4YXU2tS49Dn7 GDeJkhxn1fIsXSSxatGOTrk83wHXBKFgv1BQxGVA5NfbLp3QfnasMlC7H7DmulN4+NbKE6nMHLLwf r0H0Jl8d+0xd26dDevc1Rl6+IIW1pxCZC37AGxKBjVr0Up1qRrgci5iBu3mlAFBbMbIkxHcG8Sr0H n/PL/qANyiHld/gfxIYpkQ==; Original-Received: from [87.69.77.57] (port=3163 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWMXB-0006Oe-4U; Thu, 08 Sep 2022 14:45:53 -0400 In-Reply-To: <87k06den1s.fsf@logand.com> (message from Tomas Hlavaty on Thu, 08 Sep 2022 20:30:39 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:295002 Archived-At: > From: Tomas Hlavaty > Cc: jao@gnu.org, emacs-devel@gnu.org > Date: Thu, 08 Sep 2022 20:30:39 +0200 > > On Wed 07 Sep 2022 at 22:51, Eli Zaretskii wrote: > > From: Tomas Hlavaty > >> Second, tty emacs would need to somehow reserve rectangle for the image. > >> This might be lots of work I guess. > > The second part is the problem I'm talking about. The other two are > > much simpler to add, I think. > > Maybe the difficulty comes from the idea that tty emacs should somehow > match GUI emacs capabilities when displaying images. No, it comes from the basic design of the display engine, which is common to GUI and TTY frames, as far as layout is concerned. > The original use-case in this thread was using kitty terminal to view > documents like doc-view or pdf-tools. There is no need to implement > full GUI like graphics capabilities for that. In emacs-framebuffer, I > simply use the dimensions and position of the buffer to display images > without changing any layouting in tty emacs. Adding images to eww would > be more complex, but I guess the change could be to shr layouting > written in elisp instead of changing emacs C code. You are again thinking about a completely different layer than the one which bothers me the most. As soon as you want to display images together with text, or even scroll through tall images displayed alone in a buffer, the basic layout issues come into play, because Emacs scrolls and updates the display by considering internally which portions of the window need to be redrawn and how, and it does that by comparing old coordinates of the stuff that was on the screen with the new coordinates of the stuff that should be on the screen. For this, it must now which part of the display occupies what screen location, and this must be done in the coordinate system used by the display code, which represents the screen as "glyph matrices": a series of glyph rows, and each display element as a glyph in some glyph row. This design is identical in both GUI and TTY windows, and the code which deals with the glyph matrices is the same in both cases. Of course, if all you want is to display a single image on the screen, and don't want to support scrolling of images nor display of images mixed with text, then these issues pretty much disappear. But I very much doubt that this will be good enough for our users. It is definitely much less interesting from my POV, because it basically means we implement some kludgey and severely restricted semi-solution.