From unknown Sun Aug 10 20:05:30 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#66678 <66678@debbugs.gnu.org> To: bug#66678 <66678@debbugs.gnu.org> Subject: Status: 30.0.50; Tabs close erratically in text terminal Reply-To: bug#66678 <66678@debbugs.gnu.org> Date: Mon, 11 Aug 2025 03:05:30 +0000 retitle 66678 30.0.50; Tabs close erratically in text terminal reassign 66678 emacs submitter 66678 Petteri Hintsanen severity 66678 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 22 07:22:17 2023 Received: (at submit) by debbugs.gnu.org; 22 Oct 2023 11:22:17 +0000 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 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 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 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 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 X-Spam-Flag: NO X-Spam-Score: 0.654 X-Spam-Level: X-Spam-Status: No, score=0.654 tagged_above=-9999 required=6 tests=[SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=0.001] autolearn=disabled 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) 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) 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) 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 From: Petteri Hintsanen To: bug-gnu-emacs@gnu.org Subject: 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="=-=-=" 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-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --=-=-= 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) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 22 08:18:01 2023 Received: (at 66678) by debbugs.gnu.org; 22 Oct 2023 12:18:01 +0000 Received: from localhost ([127.0.0.1]:45584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quXP6-0003Qe-Lp for submit@debbugs.gnu.org; Sun, 22 Oct 2023 08:18:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quXP4-0003QM-JQ for 66678@debbugs.gnu.org; Sun, 22 Oct 2023 08:17:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quXOV-0004di-Mk; Sun, 22 Oct 2023 08:17:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=HWRVcgVE/0XkGwxFH87FXSZhuz+xLpD6UdH6cnQutk4=; b=F2DVaFjk9q5d9c7RHckc T2Yj7SwrPBng9NHYQ8n6Esz2SGBI98EH0VXz0691OP+v0kXS+vD8PB3si9002cphDZK5n+VOQL0YJ G+7X4q3ys9XwYl931gIf2DUyniM6Py7kcromAQGADEQ38/QVVRreFYwPDOveW5rmTvIs7tirTlV1h hP45ZJttvPGnuyLfCtkJxjL8gKWre49Irz5NK1sOn/s8qt6yWl37vPWqoCMO4ammeqxuHXERCtvKc UmI1SRcpiRrlLTmolzsloJWsN7Zz6X3k89SHaUry6eUNPT9tX1KAFvyeycxKDgaoE0nXyfpS63v+i ZL9hY2s86xoj9Q==; Date: Sun, 22 Oct 2023 15:17:23 +0300 Message-Id: <83lebuq2b0.fsf@gnu.org> From: Eli Zaretskii To: Petteri Hintsanen , Juri Linkov In-Reply-To: <87edhmx5qr.fsf@iki.fi> (message from Petteri Hintsanen on Sun, 22 Oct 2023 14:21:16 +0300) Subject: Re: bug#66678: 30.0.50; Tabs close erratically in text terminal References: <87edhmx5qr.fsf@iki.fi> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 66678 Cc: 66678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Petteri Hintsanen > Date: Sun, 22 Oct 2023 14:21:16 +0300 > > 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. This is not specific to xterm or xterm-mouse, it happens with any mouse-equipped text-mode terminal. It happens in Emacs 29 as well. > I traced the issue to `tab-bar-auto-width' function which — I think — 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". Juri, please install the fix you think is appropriate on the emacs-29 branch, since the problem exists there as well. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 22 13:44:43 2023 Received: (at 66678) by debbugs.gnu.org; 22 Oct 2023 17:44:43 +0000 Received: from localhost ([127.0.0.1]:48025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qucVH-0003Fy-AJ for submit@debbugs.gnu.org; Sun, 22 Oct 2023 13:44:43 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:36477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qucVB-0003Fc-HS; Sun, 22 Oct 2023 13:44:42 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 5164860005; Sun, 22 Oct 2023 17:44:00 +0000 (UTC) From: Juri Linkov To: Petteri Hintsanen Subject: Re: bug#66678: 30.0.50; Tabs close erratically in text terminal In-Reply-To: <87edhmx5qr.fsf@iki.fi> (Petteri Hintsanen's message of "Sun, 22 Oct 2023 14:21:16 +0300") Organization: LINKOV.NET References: <87edhmx5qr.fsf@iki.fi> Date: Sun, 22 Oct 2023 20:42:14 +0300 Message-ID: <86edhmv9jd.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 66678 Cc: 66678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) close 66678 29.1.90 thanks > - 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 — I think — 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". Thank you for finding this subtle bug and fixing it. The space before "x" was intended to give more space to click on the close button, i.e. for more wider clicking area. So better to keep the 'close-tab' text property on the space. This means that your patch is the right way to fix this. Now it's pushed to the emacs-29 branch as well as separately to master to avoid merge conflicts. From unknown Sun Aug 10 20:05:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 20 Nov 2023 12:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator