unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Petteri Hintsanen <petterih@iki.fi>, Juri Linkov <juri@linkov.net>
Cc: 66678@debbugs.gnu.org
Subject: bug#66678: 30.0.50; Tabs close erratically in text terminal
Date: Sun, 22 Oct 2023 15:17:23 +0300	[thread overview]
Message-ID: <83lebuq2b0.fsf@gnu.org> (raw)
In-Reply-To: <87edhmx5qr.fsf@iki.fi> (message from Petteri Hintsanen on Sun, 22 Oct 2023 14:21:16 +0300)

> From: Petteri Hintsanen <petterih@iki.fi>
> 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.





  reply	other threads:[~2023-10-22 12:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-22 11:21 bug#66678: 30.0.50; Tabs close erratically in text terminal Petteri Hintsanen
2023-10-22 12:17 ` Eli Zaretskii [this message]
2023-10-22 17:42 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83lebuq2b0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=66678@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=petterih@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).