From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#52881: setting tab-line-separator to any value breaks clicking tabs with mouse Date: Thu, 30 Dec 2021 10:05:24 +0200 Organization: LINKOV.NET Message-ID: <868rw28qm3.fsf@mail.linkov.net> References: 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="15758"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 52881@debbugs.gnu.org To: Ben Sferrazza Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 30 09:12:03 2021 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 1n2qXa-0003wy-Us for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Dec 2021 09:12:03 +0100 Original-Received: from localhost ([::1]:45438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2qXZ-0006zl-3P for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Dec 2021 03:12:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2qWg-0006on-Rv for bug-gnu-emacs@gnu.org; Thu, 30 Dec 2021 03:11:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2qWc-00012a-Bw for bug-gnu-emacs@gnu.org; Thu, 30 Dec 2021 03:11:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n2qWc-0001Z8-6p for bug-gnu-emacs@gnu.org; Thu, 30 Dec 2021 03:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Dec 2021 08:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52881 X-GNU-PR-Package: emacs Original-Received: via spool by 52881-submit@debbugs.gnu.org id=B52881.16408518175929 (code B ref 52881); Thu, 30 Dec 2021 08:11:02 +0000 Original-Received: (at 52881) by debbugs.gnu.org; 30 Dec 2021 08:10:17 +0000 Original-Received: from localhost ([127.0.0.1]:51302 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2qVt-0001XX-Dm for submit@debbugs.gnu.org; Thu, 30 Dec 2021 03:10:17 -0500 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:35305) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2qVr-0001X6-27 for 52881@debbugs.gnu.org; Thu, 30 Dec 2021 03:10:15 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 723CCE0005; Thu, 30 Dec 2021 08:10:06 +0000 (UTC) In-Reply-To: (Ben Sferrazza's message of "Wed, 29 Dec 2021 21:47:27 +0000") 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" Xref: news.gmane.io gmane.emacs.bugs:223419 Archived-At: --=-=-= Content-Type: text/plain > This is using Emacs 27.2 on a CentOS8 machine at work. I use Emacs > exclusively with -nw in a terminal with mouse support enabled. > > Using something like > > (setq tab-line-separator " | ") > > breaks the ability to click on a tab to select it. Leaving it at the > default value avoids the bug. Sorry, tab-line had hard-coded assumption on separators no longer than 1 character wide. Eli, is it ok to push this patch to the release branch to support longer separators: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tab-line-separator.patch diff --git a/lisp/tab-line.el b/lisp/tab-line.el index af0647acf7..5eae2eb7c4 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -636,7 +638,10 @@ tab-line-auto-hscroll (not (integerp hscroll))) (let ((selected (seq-position strings 'selected (lambda (str prop) - (get-pos-property 1 prop str))))) + (or (get-pos-property 0 prop str) + (and (next-single-property-change 0 prop str) + (get-pos-property (next-single-property-change 0 prop str) + prop str))))))) (cond ((null selected) ;; Do nothing if no tab is selected @@ -656,7 +661,11 @@ tab-line-auto-hscroll (new-hscroll (when tab-prop (seq-position strings tab-prop (lambda (str tab) - (eq (get-pos-property 1 'tab str) tab)))))) + (eq (or (get-pos-property 0 'tab str) + (and (next-single-property-change 0 'tab str) + (get-pos-property (next-single-property-change 0 'tab str) + 'tab str))) + tab)))))) (when new-hscroll (setq hscroll (float new-hscroll)) (set-window-parameter nil 'tab-line-hscroll hscroll))) @@ -683,7 +692,11 @@ tab-line-auto-hscroll (new-hscroll (when tab-prop (seq-position strings tab-prop (lambda (str tab) - (eq (get-pos-property 1 'tab str) tab)))))) + (eq (or (get-pos-property 0 'tab str) + (and (next-single-property-change 0 'tab str) + (get-pos-property (next-single-property-change 0 'tab str) + 'tab str))) + tab)))))) (when new-hscroll (setq hscroll (float new-hscroll)) (set-window-parameter nil 'tab-line-hscroll hscroll))))))))) @@ -742,7 +755,10 @@ tab-line-select-tab using the `previous-buffer' command." (interactive "e") (let* ((posnp (event-start event)) - (tab (get-pos-property 1 'tab (car (posn-string posnp)))) + (tab (or (get-pos-property 0 'tab (car (posn-string posnp))) + (and (next-single-property-change 0 'tab (car (posn-string posnp))) + (get-pos-property (next-single-property-change 0 'tab (car (posn-string posnp))) + 'tab (car (posn-string posnp)))))) (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))) (if buffer (tab-line-select-tab-buffer buffer (posn-window posnp)) @@ -858,7 +874,10 @@ tab-line-close-tab (interactive (list last-nonmenu-event)) (let* ((posnp (and (listp event) (event-start event))) (window (and posnp (posn-window posnp))) - (tab (get-pos-property 1 'tab (car (posn-string posnp)))) + (tab (or (get-pos-property 0 'tab (car (posn-string posnp))) + (and (next-single-property-change 0 'tab (car (posn-string posnp))) + (get-pos-property (next-single-property-change 0 'tab (car (posn-string posnp))) + 'tab (car (posn-string posnp)))))) (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))) (close-function (unless (bufferp tab) (cdr (assq 'close tab))))) (with-selected-window (or window (selected-window)) --=-=-=--