-
Notifications
You must be signed in to change notification settings - Fork 158
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
mode-line truncated in tty on window-split #397
Comments
Okay I tried switching away from doom-modeline into my own mode-line and I think I've figured out why this is happening. I'm quite sure there's a bug in emacs (at least on the tty). Which we notice here: doom-modeline/doom-modeline-core.el Lines 945 to 957 in af5f618
On the tty each window has an extra column which is taken up by the window seperator. Every window except the right most window. I believe the calculation for Anyways we can get around the issue by keeping track of whether the current window is right-most or not and updating the offset accordingly. I tried doing so in the mode-line evaluation directly but noticed significant performance drops. For the mean-time I'm instead saving this value in a window-parameter and updating it in a hook. Here's a patch which works for me, honestly it's kind of an ugly fix IMO and it's worth considering whether this is only a terminal issue or a tty issue (if it's the latter the condition below should be ANDed with @@ -926,6 +926,13 @@
(add-hook 'after-setting-font-hook #'doom-modeline-refresh-font-width-cache)
(add-hook 'server-after-make-frame-hook #'doom-modeline-refresh-font-width-cache)
+(add-hook 'window-configuration-change-hook
+ (defun doom-modeline-update-window-is-right-most ()
+ (dolist (window (window-list))
+ (set-window-parameter
+ window 'right-most
+ (not (window-in-direction 'right window))))))
+
(defun doom-modeline-def-modeline (name lhs &optional rhs)
"Defines a modeline format and byte-compiles it.
NAME is a symbol to identify it (used by `doom-modeline' for retrieval).
@@ -949,6 +956,7 @@
'display `((space
:align-to
(- (+ right right-fringe right-margin)
+ ,(if (window-parameter (selected-window) 'right-most) 0 1)
,(* (let ((width (doom-modeline--font-width)))
(or (and (= width 1) 1)
(/ width (frame-char-width) 1.0))) |
The PRs are always welcome! |
Just tried switching to a GUI for a second, this is definitely a TTY only issue. I'll patch out the fix in GUI frames and send over a PR. |
Closed by 1d400aa. |
Describe
There seems to be this weird issue where whenever you split a window vertically the modeline for the one on the eft is one-character shorter than the one on the right. That is to say the left modeline is truncated and the right isn't.
Resizing the window or any other affects doesn't seem to change this. I think it might be related to the fact that when you split a window the left one always has an odd width, whereas the right can have an odd or even width.
Steps and Expected
emacs -nw -q
- start emacsC-x b RET
- goto scratch bufferC-S-v
- paste this in from your clipboardM-x split-window-right
Environment:
Additional context
You can see the affect here.
The text was updated successfully, but these errors were encountered: