Recently the [change in vc-git in emacs](3572613550)
broke modeline state in remote files as it prepends a string in the
beginning and cannot retrieve relative file path to pass as git command
argument.
The fix here ensures that the prefix in the beginning of the file path
doesn't break the `(vc-state)` command by passing local file name of the
remote files.
Fix#463
Instead of (de)activating the modeline for the current buffer and a
couple of special-cased buffers, (de)activate it for all open buffers.
This:
1. Ensures that enabling/disabling the modeline at any point sets the
modeline everywhere.
2. We actually catch all buffers at start, regardless of startup order.
Without this patch, the "*Async-native-compile-log*" doesn't get a
modeline.
This looks nicer, and it also makes sure it is not possible to try to
draw an image with a negative height for the middle part (which might
happen if window-start and buffer-size are out of sync).
The cached bar segment is only updated if it is active (that is: the hud
is not active), and drawing the segment relies on the cache being
up-to-date. This could cause problems if the bar is reconfigured while
inactive, and then activated.
Fix this by updating the cache when drawing if not populated yet, and
changing `doom-modeline-refresh-bars` to unconditionally invalidate it.
Both the bar and hud segment were invalidating their cache from
`window-configuration-change-hook`, which should not be necessary: the
bar segment should not care about window configuration at all, and the
hud segment should detect buffer position changes correctly on redraw.
These extra invalidations mask problems like the one this commit fixes.
Remove the unnecessary invalidations.
Co-authored-by: Vincent Zhang <seagle0128@gmail.com>
This is a small graphical indicator showing the rough size of and
position in the current buffer. It is not used by default in any
modeline, but is intended to be usable as a replacement of the "bar"
segment.
To avoid performance problems, cache the HUD images as window
parameters. When rendering the modeline, we check if the buffer
position (or size) has changed enough to change the image, and reuse the
image if not. This check should be similar in performance to rendering
buffer size or position. Changing bar width or height forcibly
invalidates all cached images, so they get redrawn as the modeline in
each window is rendered.
This only adds the segment. To use it, define a new modeline.