From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jose A Ortega Ruiz Newsgroups: gmane.emacs.devel Subject: Re: Implementing image support for kitty terminal Date: Fri, 09 Sep 2022 15:56:35 +0100 Message-ID: <87wnacbnq4.fsf@mail.jao.io> References: <87v8pz18wf.fsf@mail.jao.io> <83o7vrgimc.fsf@gnu.org> <87wnafdnee.fsf@logand.com> <835yhzgdyi.fsf@gnu.org> <87k06den1s.fsf@logand.com> <87illxy5ir.fsf@mail.jao.io> <87sfl1d1wi.fsf@logand.com> <87czc5y1wp.fsf@mail.jao.io> <878rmtcwrv.fsf@logand.com> <87a679xx0v.fsf@mail.jao.io> <83zgf9cc9i.fsf@gnu.org> <87zgf9ax01.fsf@mail.jao.io> <83wnadcajk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32583"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tom@logand.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 09 16:57:20 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 1oWfRY-0008NK-0X for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Sep 2022 16:57:20 +0200 Original-Received: from localhost ([::1]:52864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWfRX-0004n3-3y for ged-emacs-devel@m.gmane-mx.org; Fri, 09 Sep 2022 10:57:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWfQt-00044I-Ll for emacs-devel@gnu.org; Fri, 09 Sep 2022 10:56:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:57810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWfQt-0008K1-Am; Fri, 09 Sep 2022 10:56:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=X+Zig/kmO1xQRSO080Pd0JDAd9021fOQJC/7kGzcRYs=; b=GDk0Ou/Ch1sEctgSszHg phhVTS49fttFOFZ3ziA2TGhz0saHrtqnai4tHlQG4Jo9uNReMaKUw4MUYvMNTnkdy+vZKLLyu+sj5 wIpZElRyjeH0GZ+SAHq0AdfXJQ1ttZhhaMyuZ52fvQ3DawH5DPUBe4aQHnDvxHGqiricFBJv6cRtX xrneMwNHAg+pld3LYNTnPBNhgY8HGN42l6Jt5a+KO8DzHW580gDbEifClHYYbb9VWP6NXoVdnytMl ew4HoIs0MJF8liCgfCk0Y6VW4NBh8LuTjSLiGAw2Rl04goGILzLRV3INMJ+ktviw0YvpdkEVhwup9 zPoIPA63YYMhWw==; Original-Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:50238 helo=rivendell.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWfQs-0004Du-Hg; Fri, 09 Sep 2022 10:56:38 -0400 Original-Received: from localhost (rivendell.localdomain [local]) by rivendell.localdomain (OpenSMTPD) with ESMTPA id 0d671d29; Fri, 9 Sep 2022 14:56:35 +0000 (UTC) In-Reply-To: <83wnadcajk.fsf@gnu.org> X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: 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:295072 Archived-At: 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)