From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Akib Azmain Turja via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#57607: Feature request: Use the character cell on bottom-right corner of a terminal Date: Tue, 04 Oct 2022 13:22:51 +0600 Message-ID: <87edvohx2s.fsf@disroot.org> References: <87wnakl5md.fsf@disroot.org> <87o7vt3s58.fsf@disroot.org> <87ilm04xzl.fsf@disroot.org> <875yi0v8r6.fsf@disroot.org> <874jxjhz9l.fsf@disroot.org> <87tu5i9kbg.fsf@disroot.org> <87r0zpi9za.fsf@disroot.org> <83y1twwv7w.fsf@gnu.org> Reply-To: Akib Azmain Turja Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16282"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 57607@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 04 09:54:20 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ofckt-00040o-SW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Oct 2022 09:54:20 +0200 Original-Received: from localhost ([::1]:49918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofcks-0006x4-7c for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Oct 2022 03:54:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofcKU-0003VR-Kh for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 03:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53202) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofcKU-0001Xw-BT for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 03:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ofcKU-0004ji-5p for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2022 03:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Akib Azmain Turja Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Oct 2022 07:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57607 X-GNU-PR-Package: emacs Original-Received: via spool by 57607-submit@debbugs.gnu.org id=B57607.166486838718152 (code B ref 57607); Tue, 04 Oct 2022 07:27:02 +0000 Original-Received: (at 57607) by debbugs.gnu.org; 4 Oct 2022 07:26:27 +0000 Original-Received: from localhost ([127.0.0.1]:52280 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofcJu-0004ii-If for submit@debbugs.gnu.org; Tue, 04 Oct 2022 03:26:26 -0400 Original-Received: from knopi.disroot.org ([178.21.23.139]:58780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofcJt-0004iZ-GB for 57607@debbugs.gnu.org; Tue, 04 Oct 2022 03:26:25 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 618FF4C678; Tue, 4 Oct 2022 09:26:24 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Original-Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9Q3jvhpOFc63; Tue, 4 Oct 2022 09:26:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1664868382; bh=QK7aeURaODoRax05wun1sJXF4a0wwurizyhSDeOLfLU=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=fzBy/5FNSAKsOq6PnUJ5r08XUmjorzfxIfR21eDIjpv5D8QnnU3fIZpP2+w7Vj+ht uHIzgMmzSfoWhRfXexYK6v99vv/iDE6CIHkFJRwro0uRp+L3LPBVWiAu9uMJkbaZE1 hSRK2I6tN5NE1isqmLu/ddMV/FASP8wdKLY6p+knpVCakGGfm74jZW7svKZW96or8X 3ACXLJvBWfwcjqsZ/HRU9dNvahq8ruptg1K2+Q4NSIXdFggnBL0nqaBbK4IeC4EPFs +UzgPjHrII47x7aZwWHVj5qMkXmgQdwaZ5MjXWvBIgxhOPTl3A2O5tzlyv3/p36UHg cS/42LUEAvu+w== In-Reply-To: <83y1twwv7w.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 03 Oct 2022 22:41:39 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:244370 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> Cc: gerd.moellmann@gmail.com >> Date: Mon, 03 Oct 2022 14:31:53 +0600 >> From: Akib Azmain Turja via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >>=20 >> I have implemented it. Implementing it was easier than I thought. Here >> is the patch: > > Thanks. But could you please describe the idea of the patch in some > comment? It is hard to follow the code, especially since the diff has > many pure whitespace changes. The idea is that you write the string just like before (for example, you want to write "hello" in a five columns width terminal, so you write only "hell", so that the line shows "hell "), then move a character backward and write the last glyph (write "o", so that the line shows "helo "), move a character backward again and arrange that after writing the next glyph, the character on the current position will be pushed towards right and write the glyph before the last one (write "l", now the line shows "hello"). Should I add the explanation to the function as comment? > > Also, this: > >> + /* Go to the previous position. */ >> + cmgoto (tty, curY (tty), curX (tty) - 1); >> + cmplus (tty, 1); > > Seem to assume the last character takes just one column? What about > characters whose width is 2 columns? Yes, I assume that. I don't think any multi-char width glyph reach this function (I think they are converted to single column width glyphs, for example "^L" is converted to "^" and "L"). The reason of the assumption is the following code: =2D-8<---------------cut here---------------start------------->8--- if (AutoWrap (tty) && curY (tty) + 1 =3D=3D FRAME_TOTAL_LINES (f) && (curX (tty) + len) =3D=3D FRAME_COLS (f)) len --; =2D-8<---------------cut here---------------end--------------->8--- Which also assumes the same. > > And finally, it would be nice to avoid so much code duplication > between tty_write_glyphs and tty_write_glyphs_with_face. Is that > feasible? Yes, I think so. I think it possible to just add a new argument "face_id" to tty_write_glyphs would the trick. tty_write_glyph will try to use "face_id" if it is specified, otherwise fallback to the face_id in the string. But how to "not" specify a face_id? Would a NULL work? =2D-=20 Akib Azmain Turja Find me on Mastodon at @akib@hostux.social. This message is signed by me with my GnuPG key. Its fingerprint is: 7001 8CE5 819F 17A3 BBA6 66AF E74F 0EFA 922A E7F5 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEyVTKmrtL6kNBe3FRVTX89U2IYWsFAmM730wACgkQVTX89U2I YWsX8g/9EFBIU3hcDyRXv3G25Qdxrhev/kfyORzTg0SzpZzDkc3/zD18UL/7UkpH sWorEYblrHq0gzVW2ELVu1wTatC38gEvt/dHZSAPkYuEbXrvVIfQzuColQPaIx05 Z8VTcJc65ojhnROMgrPtReHLZBpB259hagbldx4jNKeWb7Z1Rjn6XWXMVWkdEPxK gyOrkhfjXLt4SxaQtsqV0VcAl/GzsSule4PiZQOePjTG4C6jdUggX3BgmOZryNAT MpB9lja70bl36U4olPboj7jn3oui6btYQvMpA79Uiz0J9PslnAt/qe8CpudP+RVx vHLY8aQt4KxMiXk8DmE4fFSCD1b+OamRQ2lzWfh3P6pmWV3ZUfW9YF/EDwss5SLQ hAoJo4elpi++tWsyXtrqGOcWoT8arpXZL3hGJ/zuc6nVl3azaqAOq1t4eA85KS/v SlHAHH5blR0kAVRvw3QZKgFoec+SzWaWPKHfC5Riqi/fcK91cEOtuGHpTz8KguO5 53pIWI+m2POBcoV4OiKbFCrvRvwmo5WDjiWpIU59379eX7ixIeSDRdrKdlc7lyuj zuy8+Tz1B/ib6QDXdJcMM9jr0xhjLCFI6TxOYV3xnJ/JwkGOpVMeU0kn2mk11fPP hjIWXt2/9zzpzla5Y/8RHSVgESNIiaxnBzqGSRzfMOrMY/6MnO8= =ezfb -----END PGP SIGNATURE----- --=-=-=--