Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different alignments in horizontally split vs non-split frames #29

Open
johnmwu opened this issue Mar 19, 2020 · 2 comments
Open

Different alignments in horizontally split vs non-split frames #29

johnmwu opened this issue Mar 19, 2020 · 2 comments

Comments

@johnmwu
Copy link

johnmwu commented Mar 19, 2020

As an example, an unsplit frame looks like

image

whereas a split frame looks like

image

Most notably, it appears that the global info, i.e mode-line-misc-info, only appears when the frame is horizontally split. Now obviously this isn't the reason (that's stupid), but I can't find any better pattern for reproducing this.

@johnmwu
Copy link
Author

johnmwu commented Mar 19, 2020

Digging a bit further, this definitely has to do with smart-mode-line. In sml/generate-minor-modes, there is:

(defun sml/generate-minor-modes ()
  "Extracts all rich strings necessary for the minor mode list."
  (if sml/simplified
      ""
    (let* (;; The minor-mode-alist
           (nameList (rm--mode-list-as-string-list))
           ;; The size available
           (size (max 0
                      (- (if (member sml/mode-width '(full right))
                             ;; Calculate how much width is available
                             (sml/fill-width-available)
                           ;; or use what the user requested.
                           sml/mode-width)
                         (string-width (format-mode-line
...

Here, size is the number of chars in the minor mode list. I believe there's a bug in the calculation of sml/fill-width-available, where it calculates a number that's far too high (so the global info is pushed off). Also, this computation uses window-total-width, which explains why alignment changes when splitting the window horizontally.

I was able to fix the issue of global info by

(setq sml/mode-width 40)

@kiennq
Copy link
Owner

kiennq commented Mar 20, 2020

Can you try with this (:eval (string-trim (format-mode-line mode-line-modes))) instead of mode-line-modes in mini-modeline-r-format?
And also try to remove mode-line-end-spaces too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants