GNU bug report logs - #52881
setting tab-line-separator to any value breaks clicking tabs with mouse

Previous Next

Package: emacs;

Reported by: Ben Sferrazza <ben.sferrazza <at> aeonsemi.com>

Date: Wed, 29 Dec 2021 22:14:01 UTC

Severity: normal

Fixed in version 28.0.90

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 52881 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Ben Sferrazza <ben.sferrazza <at> aeonsemi.com>
Cc: 52881 <at> debbugs.gnu.org
Subject: Re: bug#52881: setting tab-line-separator to any value breaks
 clicking tabs with mouse
Date: Thu, 30 Dec 2021 10:05:24 +0200
[Message part 1 (text/plain, inline)]
> 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:

[tab-line-separator.patch (text/x-diff, inline)]
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))

This bug report was last modified 3 years and 139 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.