fix: preview pane flicker#2537
Conversation
joelim-work
left a comment
There was a problem hiding this comment.
Previews are capped at the height of the preview window, so it effectively depends on the height as well. For example if the width is 10, then previews will contain at most 10 lines of text.
This change means that previews won't be updated if the height increases, leading to empty space in the preview window.
|
With the original PR, I was not able to trigger any issues when the height increases. Im not sure how to address this without a more complex solution, but I am wondering if we actually need b0d5923 @joelim-work do you have any example where the previous solution actually caused issues? I suspect it actually worked fine but I still have to find out why the height increase never triggered any issue. Both external and internal previews were reloaded on height changes. |
The issue happens using the default settings, just preview a text file and then increase the height window. The current PR right now will keep previews if the window height decreases (lines > height), but the design still requires previews to be refreshed if the window height increases instead, so this is at best an optimization. |
|
It looks like the issue did not trigger on tiling window manager but you are right. another problem was that the height was updated even when the cache has the correct size, so going back and forth in height triggered a reload and flicker every time. Now the patch checks the cache height instead |
The preview pane is redrawn on vertical resize in tiling window managers like sway when opening a sibling window below the lf terminal window, causing a visual flicker in the preview pane only. This is the case when gui apps are opened by lf in vertical setups.
The patch addresses this by only dropping cached regs when the preview width actually changed