From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phillip Susi Newsgroups: gmane.emacs.bugs Subject: bug#70000: 29.2; Grapheme handling incorrect Date: Mon, 25 Mar 2024 14:45:48 -0400 Message-ID: <878r26duar.fsf@vps.thesusis.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38735"; mail-complaints-to="usenet@ciao.gmane.io" To: 70000@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 25 19:47:21 2024 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 1ropLt-0009qR-7q for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Mar 2024 19:47:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ropLf-00062G-6E; Mon, 25 Mar 2024 14:47:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ropLb-00061q-6D for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2024 14:47:05 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ropLa-0001q0-Tw for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2024 14:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ropLa-00033r-3G for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2024 14:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Mar 2024 18:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70000 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171139236311697 (code B ref -1); Mon, 25 Mar 2024 18:47:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Mar 2024 18:46:03 +0000 Original-Received: from localhost ([127.0.0.1]:36258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ropKc-00032a-8G for submit@debbugs.gnu.org; Mon, 25 Mar 2024 14:46:02 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:44128) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ropKY-00031n-V0 for submit@debbugs.gnu.org; Mon, 25 Mar 2024 14:46:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ropKS-0005wA-5o for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2024 14:45:52 -0400 Original-Received: from vps.thesusis.net ([34.202.238.73]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ropKQ-0001lu-An for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2024 14:45:51 -0400 Original-Received: by vps.thesusis.net (Postfix, from userid 1000) id C454A2B46D; Mon, 25 Mar 2024 14:45:48 -0400 (EDT) Received-SPF: pass client-ip=34.202.238.73; envelope-from=phill@thesusis.net; helo=vps.thesusis.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282069 Archived-At: I had some terminal breakage the other day when browsing email with notmuch. Now a ways down the rabbit hole, it seems this is because emacs does not correctly handle graphemes. I found this article here: https://mitchellh.com/writing/grapheme-clusters-in-terminals If I paste that gramehe into GUI emacs, it is displayed as two separate characters, each two columns wide, instead of the correct way: as a single double wide character. C-f and C-b move over the character as if it were one, however, backspace deletes only the second, leaving both the first and the zero width joiner. If C-f and C-b treat it as one, then so should backspace. Under recent versions of the foot terminal emulator, this character is displayed as a single, double wide character, but emacs assumes it still is 4 colums wide, leading to terminal breakage. Emacs needs to not assume the width of graphemes are what wcwidth() reports, but instead need to query the cursor position after printing one to find out how wide the terminal actually dispalyed it as. In GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.39, cairo version 1.18.0) of 2024-02-26 built on localhost System Description: Gentoo Linux Configured using: 'configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --disable-silent-rules --docdir=/usr/share/doc/emacs-29.2-r1 --htmldir=/usr/share/doc/emacs-29.2-r1/html --libdir=/usr/lib64 --program-suffix=-emacs-29 --includedir=/usr/include/emacs-29 --infodir=/usr/share/info/emacs-29 --localstatedir=/var --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp --without-compress-install --without-hesiod --without-pop --with-file-notification=inotify --with-pdumper --enable-acl --with-dbus --with-modules --without-gameuser --with-libgmp --with-gpm --with-native-compilation=aot --without-json --without-kerberos --without-kerberos5 --with-lcms2 --without-xml2 --without-mailutils --without-selinux --without-sqlite3 --with-gnutls --with-libsystemd --with-threads --with-tree-sitter --without-wide-int --with-sound=alsa --with-zlib --with-pgtk --without-x --without-ns --with-toolkit-scroll-bars --without-gconf --without-gsettings --without-harfbuzz --without-libotf --without-m17n-flt --without-xwidgets --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --without-webp --without-imagemagick --with-dumping=pdumper 'CFLAGS=-march=native -O2 -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed'' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM JPEG LCMS2 LIBSYSTEMD MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t column-number-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cus-start cus-load wid-edit descr-text enriched disp-table facemenu comp comp-cstr warnings icons rx cl-extra help-mode manoj-dark-theme site-gentoo ranger-autoloads scopeline-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting font-render-setting cairo gtk pgtk lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 121243 14450) (symbols 48 22924 0) (strings 32 87992 2869) (string-bytes 1 2065634) (vectors 16 27491) (vector-slots 8 1623278 223666) (floats 8 58 48) (intervals 56 908 0) (buffers 984 13))