From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Petteri Hintsanen Newsgroups: gmane.emacs.bugs Subject: bug#66678: 30.0.50; Tabs close erratically in text terminal Date: Sun, 22 Oct 2023 14:21:16 +0300 Message-ID: <87edhmx5qr.fsf@iki.fi> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2584"; mail-complaints-to="usenet@ciao.gmane.io" To: 66678@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 22 13:22:53 2023 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 1quWXk-0000TC-AI for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Oct 2023 13:22:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quWXS-00032M-Rl; Sun, 22 Oct 2023 07:22:35 -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 1quWXR-00032D-Qc for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 07:22:33 -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 1quWXR-0003Uv-IY for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 07:22:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1quWXt-0004x1-Rj for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 07:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Petteri Hintsanen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Oct 2023 11:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66678 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.169797373718963 (code B ref -1); Sun, 22 Oct 2023 11:23:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Oct 2023 11:22:17 +0000 Original-Received: from localhost ([127.0.0.1]:45553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quWXA-0004vm-BT for submit@debbugs.gnu.org; Sun, 22 Oct 2023 07:22:17 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:51984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quWX4-0004vS-KI for submit@debbugs.gnu.org; Sun, 22 Oct 2023 07:22:14 -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 1quWWW-0002xm-Sw for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 07:21:37 -0400 Original-Received: from sinikuusama2.dnainternet.net ([83.102.40.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quWWT-0003QX-7L for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 07:21:36 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by sinikuusama2.dnainternet.net (Postfix) with ESMTP id B02D879C7 for ; Sun, 22 Oct 2023 14:21:18 +0300 (EEST) X-Virus-Scanned: DNA Internet at dnainternet.net Original-Received: from sinikuusama2.dnainternet.net ([83.102.40.152]) by localhost (sinikuusama2.dnainternet.net [127.0.0.1]) (DNA Internet, port 10041) with ESMTP id rmgjbSFR9t7v for ; Sun, 22 Oct 2023 14:21:18 +0300 (EEST) Original-Received: from omenapuu2.dnainternet.net (omenapuu2.dnainternet.net [83.102.40.54]) by sinikuusama2.dnainternet.net (Postfix) with ESMTP id 6C6497717 for ; Sun, 22 Oct 2023 14:21:18 +0300 (EEST) Original-Received: from romeo.fritz.box (62-78-178-196.bb.dnainternet.fi [62.78.178.196]) by omenapuu2.dnainternet.net (Postfix) with ESMTP id 4A3CD221 for ; Sun, 22 Oct 2023 14:21:17 +0300 (EEST) Original-Received: from phintsan (uid 1000) (envelope-from petterih@iki.fi) id 500101 by romeo.fritz.box (DragonFly Mail Agent v0.13); Sun, 22 Oct 2023 14:21:16 +0300 Received-SPF: neutral client-ip=83.102.40.152; envelope-from=petterih@iki.fi; helo=sinikuusama2.dnainternet.net X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779, UNPARSEABLE_RELAY=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:272970 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I'm running Emacs in xterm with xterm-mouse-mode and tab-bar-mode enabled. There, tabs have an "x" mark for closing them. However, tabs will also close if you click on the character position right after the buffer name in the tab. This makes it easy to unintentionally close a tab instead of switching to it, which is very annoying. Recipe: - In xterm, start emacs by `emacs -Q -nw'. - M-x xterm-mouse-mode - M-x tab-bar-mode - Create a new tab by clicking on "+" on the tab bar. Now you should have two tabs named `*scratch*' - Click on the first (leftmost) tab right after the second asterisk. Expected behavior: Leftmost tab is selected. Actual behavior: Leftmost tab is closed. I traced the issue to `tab-bar-auto-width' function which =E2=80=94 I think= =E2=80=94 is used to pad a tab text with spaces to make it have a uniform width within the tab bar. The function erroneously copies 'close-tab text property from the close button text (tab-bar-close-button) and positions it right after the buffer name, causing the said behavior. The attached patch fixes the immediate issue, but I doubt if it is sufficient, given that there is similar close tab-related logic elsewhere in the code. Another workaround is to set `tab-bar-close-button' to one character string "x" instead of " x". In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0) of 2023-10-22 built on romeo Repository revision: ae337884107c4d5f66aaceef0e8b548565317412 Repository branch: master System Description: Debian GNU/Linux 12 (bookworm) Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LC_MESSAGES: en_US.UTF-8 value of $LANG: fi_FI.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: xterm-mouse-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t tab-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-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 mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x cl-extra help-mode icons cl-loaddefs cl-lib cus-start cus-load xt-mouse term/xterm xterm byte-opt gv bytecomp byte-compile rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen 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 lcms2 dynamic-setting system-font-setting font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs) Memory information: ((conses 16 58490 14195) (symbols 48 7111 0) (strings 32 17493 1913) (string-bytes 1 469587) (vectors 16 8894) (vector-slots 8 113240 10638) (floats 8 33 11100) (intervals 56 256 23) (buffers 992 11)) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tab-bar.patch Content-Description: Tab bar patch diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index d2815c03ebf..e21367255a0 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1227,7 +1227,9 @@ tab-bar-auto-width ((< prev-width width) (let* ((space (apply #'propertize " " (text-properties-at 0 name))) - (ins-pos (- len (if close-p 1 0))) + (ins-pos (- len (if close-p + (length tab-bar-close-button) + 0))) (prev-name name)) (while continue (setq name (concat (substring name 0 ins-pos) --=-=-=--