dbordak / telephone-line

A new implementation of Powerline for Emacs
GNU General Public License v3.0
550 stars 51 forks source link

Separator not rendering correctly when window is inactive. #106

Closed stockersky closed 4 years ago

stockersky commented 4 years ago

I spent some time designing my telephone-line modeline and was happy about it :

active_ok

Then I realized that the modeline was empty on the inactive windows... First, I just set it up to use the same face whatever active or inactive:

(use-package telephone-line
  :ensure t
  :config
  (setq telephone-line-faces
      '((face0 . (my-modeline-face0 . my-modeline-face0))
        (face1 . (my-modeline-face1 . my-modeline-face1))
        (face2 . (my-modeline-face2 . my-modeline-face2))
        (face3 . (my-modeline-face3 . my-modeline-face3))
        (nil . (mode-line . mode-line-inactive))))

But the active and inactive modelines would render as this active_KO

Here is an example of how I define a face:

(defface my-modeline-face3
  '((t :foreground "gold"
       :background "chocolate4"
       :weight bold
       ;; :inherit mode-line
       ))
   :group 'telephone-line )

I tried with inherit mode-line. It changed nothing.

Then I tried a dedicated face for the inactive windows:

(defface my-modeline-face3-inactive
  '((t :foreground "gold"
       :background "blue"
       :inherit mode-line-inactive
       ))
  "Face for global variables."
   :group 'telephone-line )

(use-package telephone-line
  :ensure t
  :config
  (setq telephone-line-faces
      '((face0 . (my-modeline-face0 . my-modeline-face3-inactive))
    (face1 . (my-modeline-face1 . my-modeline-face3-inactive))
    (face2 . (my-modeline-face2 . my-modeline-face3-inactive))
    (face3 . (my-modeline-face3 . my-modeline-face3-inactive))
    (nil . (mode-line . mode-line-inactive))))

As a result, active modeline is correctly rendered, but the inactive one still has messy separator. (cubed separator has the same problem).

modeline_ko2

stockersky commented 4 years ago

Alright, I found out!

As I use a quite big font size for coding (13), the default telephone-line modeline size was too small.

Increasing the telephone-line modeline height solved the problem.

(setq telephone-line-height 22)
dbordak commented 4 years ago

This is actually an issue with when your font is defined -- the default height of telephone-line is the height of the font you've selected, but if you change the size of your font after telephone-line is loaded, it can lead to this issue.

There is a pending PR which will fix this fully, once that's merged I'd probably recommend you drop setting the height manually -- otherwise, you'd need to change it whenever you change your font :P