From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66678: 30.0.50; Tabs close erratically in text terminal Date: Sun, 22 Oct 2023 15:17:23 +0300 Message-ID: <83lebuq2b0.fsf@gnu.org> References: <87edhmx5qr.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26745"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66678@debbugs.gnu.org To: Petteri Hintsanen , Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 22 14:17:49 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 1quXOu-0006h9-Or for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Oct 2023 14:17:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quXOh-0006Ci-VT; Sun, 22 Oct 2023 08:17: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 1quXOg-0006CY-GT for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 08:17:35 -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 1quXOg-0004e1-7K for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 08:17:34 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1quXP8-0003Qw-55 for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 08:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Oct 2023 12:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66678 X-GNU-PR-Package: emacs Original-Received: via spool by 66678-submit@debbugs.gnu.org id=B66678.169797708113188 (code B ref 66678); Sun, 22 Oct 2023 12:18:02 +0000 Original-Received: (at 66678) by debbugs.gnu.org; 22 Oct 2023 12:18:01 +0000 Original-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 Original-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 Original-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==; In-Reply-To: <87edhmx5qr.fsf@iki.fi> (message from Petteri Hintsanen on Sun, 22 Oct 2023 14:21:16 +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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:272972 Archived-At: > 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.