GNU bug report logs -
#46299
28.0.50; Value of tab-bar-show not respected in new frames.
Previous Next
Full log
Message #152 received at 46299 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Bastian Beranek <bastian.beischer <at> gmail.com> writes:
> But how to go back? It seems that tab-bar-show should go back to "1" (in
> order to make it a real toggle, i.e. it undoes itself). However, that
> means that after the second toggle-frame-tab-bar the tab-bar will either
> be shown or not, depending on the number of tabs opened at that specific
> time. We have to consider that the user created or closed tabs in
> between, so that means that there will be situations in which
> toggle-frame-tab-bar does not really seem to do anything... For example:
>
> - 1 tab (tab bar hidden)
> - create tab -> 2 tabs (tab bar shown)
> - toggle-frame-tab-bar (tab bar hidden)
> - close tab (tab bar hidden)
> - toggle-frame-tab-bar (tab bar still hidden, because only 1 tab)
I think what we could do is:
a) always toggle the current visibility: That seems to be a must, it
would be confusing otherwise.
b) The first time toggle-frame-tab-bar is called, add a notice to the
frame parameters that prevents tab-bar--update-tab-bar-lines from
changing that frames tab-bar visibility. This means that after the
toggle the tab-bar visibility keeps its state until
toggle-frame-tab-bar is called again.
c) When it is called a second time toggle-frame-tab-bar sets the new
frame parameter to nil and flips the visibility again (see a).
d) Then the tab-bar--update-tab-bar-lines logic will be active again,
but only after a new tab is created or closed on that frame.
This prevents the problem listed in my last mail, in the last step the
tab-bar will be shown after toggling (although tab-bar-show is 1 and
there is only one tab), but then once you create more tabs or close tabs
it will revert to the usual behavior.
Is this acceptable?
Proposed patch is attached.
[0001-Fix-behavior-of-toggle-frame-tab-bar-bug-46299.patch (text/x-patch, inline)]
From 5f158962c1bc63c10ebaa49357a16e45664d5579 Mon Sep 17 00:00:00 2001
From: Bastian Beranek <bastian.beischer <at> rwth-aachen.de>
Date: Tue, 16 Feb 2021 11:35:35 +0100
Subject: [PATCH] Fix behavior of toggle-frame-tab-bar (bug #46299)
* lisp/tab-bar.el (toggle-frame-tab-bar): Add frame attribute to
protect tab bar state from changing.
(tab-bar--update-tab-bar-lines): Check for new attribute
---
lisp/tab-bar.el | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 4e47ae2c10..2fa34385f1 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -161,7 +161,8 @@ tab-bar--update-tab-bar-lines
(t frames))))
;; Loop over all frames and update default-frame-alist
(dolist (frame frame-lst)
- (set-frame-parameter frame 'tab-bar-lines (tab-bar--tab-bar-lines-for-frame frame))))
+ (unless (frame-parameter frame 'tab-bar-lines-keep-state)
+ (set-frame-parameter frame 'tab-bar-lines (tab-bar--tab-bar-lines-for-frame frame)))))
(when (eq frames t)
(setq default-frame-alist
(cons (cons 'tab-bar-lines (if (and tab-bar-mode (eq tab-bar-show t)) 1 0))
@@ -233,7 +234,9 @@ toggle-frame-tab-bar
(add-hook 'after-make-frame-functions 'toggle-frame-tab-bar)"
(interactive)
(set-frame-parameter frame 'tab-bar-lines
- (if (> (frame-parameter frame 'tab-bar-lines) 0) 0 1)))
+ (if (> (frame-parameter frame 'tab-bar-lines) 0) 0 1))
+ (set-frame-parameter frame 'tab-bar-lines-keep-state
+ (not (frame-parameter nil 'tab-bar-lines-keep-state))))
(defvar tab-bar-map (make-sparse-keymap)
"Keymap for the tab bar.
--
2.30.1
This bug report was last modified 4 years and 88 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.