helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
32.38k stars 2.38k forks source link

Whole statusline "empties out" when filename doesn't fit #10078

Closed RudolfMan closed 3 months ago

RudolfMan commented 4 months ago

Summary

When current buffer's filename is long and doesn't fit the statusline - everything from there disappears.

Reproduction Steps

I tried this: 1. `hx` 2. Open a file with a name (including path to the file) that's longer than the width of the view/split. For example when split vertically, or resize the terminal window. I tried `:redraw` doesn't help. See the screenrecording: https://github.com/helix-editor/helix/assets/53276677/312a4c8a-866e-47d1-bf52-641a0a712d06 ### Helix log It doesn't crash or anything.. and nothing really helpful to me in logs..
~/.cache/helix/helix.log ``` 2024-03-31T20:33:15.024 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:15.024 helix_view::document [DEBUG] id 3 modified - last saved: 0, current: 0 2024-03-31T20:33:15.024 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:15.158 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:15.159 helix_view::document [DEBUG] id 3 modified - last saved: 0, current: 0 2024-03-31T20:33:15.159 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:15.907 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:15.908 helix_view::document [DEBUG] id 3 modified - last saved: 0, current: 0 2024-03-31T20:33:15.908 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:16.360 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:16.361 helix_view::document [DEBUG] id 3 modified - last saved: 0, current: 0 2024-03-31T20:33:16.361 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:19.927 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 2024-03-31T20:33:19.928 helix_view::document [DEBUG] id 3 modified - last saved: 0, current: 0 2024-03-31T20:33:19.928 helix_view::document [DEBUG] id 2 modified - last saved: 0, current: 0 ```
### Platform macOS 13.6.4 ### Terminal Emulator wezterm 20240203-110809-5046fc22, alacritty 0.13.1 (fe2a3c5) ### Installation Method brew ### Helix Version helix 24.3 (2cadec0b)
the-mikedavis commented 4 months ago

This is a consequence of #9122. We should add an else clause here: https://github.com/helix-editor/helix/blob/88d455afebb581bc607d12f04448fe6d8a21baa2/helix-term/src/ui/statusline.rs#L124

that fits as much of the left statusline as will fit, or tries to truncate the longest span(s)

archseer commented 4 months ago

I regret merging #9122 so close to the release, there was quite a few regressions. Should we have a patch release for this?

hamrik commented 4 months ago

At this point I'm considering reverting the refactor. There are more unforeseen consequences of it than potential benefits.

I've begun working on the autohide feature but the inner view dimensions seem to be quite hard-coded for clipping a space for the statusline, and making that that dynamic might not be worth pursuing for the time being.

@the-mikedavis Should I revert the changes?

the-mikedavis commented 4 months ago

I think the changes are still good - with the old render functions we couldn't middle-align the center statusline part like in #9950 or do the truncation I mentioned above.

This is pretty easy to hit but not all that limiting: you can still get the current document path from the % register or view it in the buffer picker. I would prefer that we do a short release cycle this time (1-2 months) rather than backport a fix for this into a patch release

hamrik commented 4 months ago

Started working on a draft PR to address this: #10087.

It needs more work/discussion, though.

I apologize for the mess.