GNU bug report logs -
#59620
29.0.50; Wrong global-mode-string position in tab-bar + emacs -nw
Previous Next
Reported by: Gabriel <gabriel376 <at> hotmail.com>
Date: Sat, 26 Nov 2022 21:52:02 UTC
Severity: normal
Found in version 29.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59620 in the body.
You can then email your comments to 59620 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59620
; Package
emacs
.
(Sat, 26 Nov 2022 21:52:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Gabriel <gabriel376 <at> hotmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
Your message specified a Severity: in the pseudo-header, but
the severity value bug was not recognised.
The default severity normal is being used instead.
The recognised values are: critical, grave, serious, important, normal, minor, wishlist.
(Sat, 26 Nov 2022 21:52:02 GMT) Full text and rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Severity: bug
Description:
The global-mode-string is wrongly positioned in tab-bar when using
"emacs -nw" and multiple windows. The bug only happens with emacs -nw.
Steps:
1) emacs -Q -nw (master "af545234314601ba3dcd8bf32e0d9b46e1917f79")
2) Eval the following to add display-time-mode right-aligned to tab-bar:
(progn
(display-time-mode 1)
(setopt tab-bar-format '(tab-bar-format-tabs-groups
tab-bar-separator
tab-bar-format-align-right
tab-bar-format-global))
(tab-bar-mode 1))
3) Split window right: C-x 3
Result: the global-mode-string will be wrongly positioned. It expected
to be right-aligned to the current frame, but it's right-aligned to the
left window. The position is correct while minibuffer has focus. See
attached images.
[one-window.png (image/png, attachment)]
[bug.png (image/png, attachment)]
[minibuffer-focus.png (image/png, attachment)]
[Message part 5 (text/plain, inline)]
---
Gabriel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59620
; Package
emacs
.
(Sun, 27 Nov 2022 06:20:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 59620 <at> debbugs.gnu.org (full text, mbox):
> From: Gabriel <gabriel376 <at> hotmail.com>
> Date: Sat, 26 Nov 2022 18:46:08 -0300
>
> 1) emacs -Q -nw (master "af545234314601ba3dcd8bf32e0d9b46e1917f79")
>
> 2) Eval the following to add display-time-mode right-aligned to tab-bar:
>
> (progn
> (display-time-mode 1)
> (setopt tab-bar-format '(tab-bar-format-tabs-groups
> tab-bar-separator
> tab-bar-format-align-right
> tab-bar-format-global))
> (tab-bar-mode 1))
>
> 3) Split window right: C-x 3
>
> Result: the global-mode-string will be wrongly positioned. It expected
> to be right-aligned to the current frame, but it's right-aligned to the
> left window. The position is correct while minibuffer has focus. See
> attached images.
Looks like tab-bar-format-align-right is evaluated with the wrong window
being the selected one: it should use the tab-bar pseudo-window to do what
you expect.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59620
; Package
emacs
.
(Sun, 27 Nov 2022 08:07:01 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>
> Looks like tab-bar-format-align-right is evaluated with the wrong window
> being the selected one: it should use the tab-bar pseudo-window to do what
> you expect.
I don't know what is the root cause, but it's a reasonable hypothesis.
Not sure why it only affects "emacs -nw", though.
Do you know how to get the tab-bar pseudo-window? It seems that
"f->tab_bar_window" it's not exposed from C to elisp.
Anyway, I think it's a bug. Maybe Juri can help on this. I will try to
find a fix, but I can't promise.
---
Gabriel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59620
; Package
emacs
.
(Mon, 28 Nov 2022 08:59:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 59620 <at> debbugs.gnu.org (full text, mbox):
>> Looks like tab-bar-format-align-right is evaluated with the wrong window
>> being the selected one: it should use the tab-bar pseudo-window to do what
>> you expect.
>
> I don't know what is the root cause, but it's a reasonable hypothesis.
> Not sure why it only affects "emacs -nw", though.
>
> Do you know how to get the tab-bar pseudo-window? It seems that
> "f->tab_bar_window" it's not exposed from C to elisp.
Unless Eli can suggest how to fix `(space :align-to (- right (,hpos)))
to work on TTY frames the same way as it works on GUI frames,
I could try to rewrite it to avoid the keyword `right', i.e. to use
`(space :align-to (,hpos-from-left)) where hpos-from-left could be
calculated by using string-pixel-width on the text from the left side.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59620
; Package
emacs
.
(Mon, 28 Nov 2022 12:59:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 59620 <at> debbugs.gnu.org (full text, mbox):
> Cc: 59620 <at> debbugs.gnu.org
> From: Juri Linkov <juri <at> linkov.net>
> Date: Mon, 28 Nov 2022 09:54:17 +0200
>
> >> Looks like tab-bar-format-align-right is evaluated with the wrong window
> >> being the selected one: it should use the tab-bar pseudo-window to do what
> >> you expect.
> >
> > I don't know what is the root cause, but it's a reasonable hypothesis.
> > Not sure why it only affects "emacs -nw", though.
> >
> > Do you know how to get the tab-bar pseudo-window? It seems that
> > "f->tab_bar_window" it's not exposed from C to elisp.
>
> Unless Eli can suggest how to fix `(space :align-to (- right (,hpos)))
> to work on TTY frames the same way as it works on GUI frames,
> I could try to rewrite it to avoid the keyword `right', i.e. to use
> `(space :align-to (,hpos-from-left)) where hpos-from-left could be
> calculated by using string-pixel-width on the text from the left side.
I replied without paying attention to the -nw part, sorry.
On TTY frames the tab bar is not a window, so what I wrote is impossible,
and thus avoiding the 'right' part in the align-to spec is a good idea
regardless.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59620
; Package
emacs
.
(Mon, 28 Nov 2022 17:37:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 59620 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> On TTY frames the tab bar is not a window, so what I wrote is impossible,
> and thus avoiding the 'right' part in the align-to spec is a good idea
> regardless.
Avoiding the 'right' part in align-to has such a drawback that while
resizing the frame the position of the aligned element is not updated
immediately. It's updated only when display-time refreshes the time on
the tab bar. The position relative to the right edge has no such problem.
So better to leave the 'right' part on GUI frames, and switch to counting
from the left only on TTY frames where frames are resized less often:
[tab-bar-format-align-right.patch (text/x-diff, inline)]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index eb4cec48619..cabad9d7d5e 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -936,7 +936,10 @@ tab-bar-format-align-right
(hpos (progn
(add-face-text-property 0 (length rest) 'tab-bar t rest)
(string-pixel-width rest)))
- (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
+ (str (propertize " " 'display
+ (if window-system
+ `(space :align-to (- right (,hpos)))
+ `(space :align-to (,(- (frame-inner-width) hpos)))))))
`((align-right menu-item ,str ignore))))
(defun tab-bar-format-global ()
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59620
; Package
emacs
.
(Mon, 28 Nov 2022 18:34:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 59620 <at> debbugs.gnu.org (full text, mbox):
> From: Juri Linkov <juri <at> linkov.net>
> Cc: gabriel376 <at> hotmail.com, 59620 <at> debbugs.gnu.org
> Date: Mon, 28 Nov 2022 19:29:38 +0200
>
> Avoiding the 'right' part in align-to has such a drawback that while
> resizing the frame the position of the aligned element is not updated
> immediately. It's updated only when display-time refreshes the time on
> the tab bar. The position relative to the right edge has no such problem.
> So better to leave the 'right' part on GUI frames, and switch to counting
> from the left only on TTY frames where frames are resized less often:
That would require you to make sure this code always runs in the context of
the tab-bar (pseudo)window. If that can be ensured, fine.
Reply sent
to
Juri Linkov <juri <at> linkov.net>
:
You have taken responsibility.
(Fri, 02 Dec 2022 08:02:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Gabriel <gabriel376 <at> hotmail.com>
:
bug acknowledged by developer.
(Fri, 02 Dec 2022 08:02:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 59620-done <at> debbugs.gnu.org (full text, mbox):
>> Avoiding the 'right' part in align-to has such a drawback that while
>> resizing the frame the position of the aligned element is not updated
>> immediately. It's updated only when display-time refreshes the time on
>> the tab bar. The position relative to the right edge has no such problem.
>> So better to leave the 'right' part on GUI frames, and switch to counting
>> from the left only on TTY frames where frames are resized less often:
>
> That would require you to make sure this code always runs in the context of
> the tab-bar (pseudo)window. If that can be ensured, fine.
Since this can't be ensured, I pushed a simpler patch to emacs-29,
and closed.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59620
; Package
emacs
.
(Fri, 02 Dec 2022 15:03:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 59620-done <at> debbugs.gnu.org (full text, mbox):
> From: Juri Linkov <juri <at> linkov.net>
> Cc: gabriel376 <at> hotmail.com, 59620-done <at> debbugs.gnu.org
> Date: Fri, 02 Dec 2022 09:59:57 +0200
>
> > That would require you to make sure this code always runs in the context of
> > the tab-bar (pseudo)window. If that can be ensured, fine.
>
> Since this can't be ensured, I pushed a simpler patch to emacs-29,
> and closed.
Thanks, but I think the code needs to use window-system the function, not
the variable, so that you could ask about the currently-selected frame. We
generally don't want to use window-system the variable too much.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 31 Dec 2022 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 168 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.