emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 39e0c60176: * lisp/tab-bar.el (tab-bar-format-align-right): Fix


From: Juri Linkov
Subject: emacs-29 39e0c60176: * lisp/tab-bar.el (tab-bar-format-align-right): Fix alignment on TTY frames.
Date: Fri, 2 Dec 2022 03:00:39 -0500 (EST)

branch: emacs-29
commit 39e0c60176242a2ca09f65090bcf2751b346ed26
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/tab-bar.el (tab-bar-format-align-right): Fix alignment on TTY frames.
    
    Calculate the alignment from the left edge instead of the right edge
    since the `right' spec doesn't work on TTY frames when windows are split
    horizontally (bug#59620).
---
 lisp/tab-bar.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index cba213d45d..dcda67e9c5 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -936,7 +936,12 @@ when the tab is current.  Return the result as a keymap."
          (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
+                          ;; The `right' spec doesn't work on TTY frames
+                          ;; when windows are split horizontally (bug#59620)
+                          (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 ()
@@ -1083,7 +1088,7 @@ tab bar might wrap to the second line when it shouldn't.")
                         (setf (substring name ins-pos ins-pos) space)
                         (setq curr-width (string-pixel-width name))
                         (if (and (< curr-width width)
-                                 (not (eq curr-width prev-width)))
+                                 (> curr-width prev-width))
                             (setq prev-width curr-width
                                   prev-name name)
                           ;; Set back a shorter name
@@ -1096,7 +1101,7 @@ tab bar might wrap to the second line when it shouldn't.")
                         (setf (substring name del-pos1 del-pos2) "")
                         (setq curr-width (string-pixel-width name))
                         (if (and (> curr-width width)
-                                 (not (eq curr-width prev-width)))
+                                 (< curr-width prev-width))
                             (setq prev-width curr-width)
                           (setq continue nil)))
                       (let* ((len (length name))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]