-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
Odd default behavior with flex layout when resizing horizontally #3138
Labels
Comments
6 tasks
I created a PR that fixes this issue. I went with my alternate suggestion of setting the default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When using the flex layout with default settings, odd behavior is observed when resizing the window horizontally. The preview pane is hidden at certain widths.
Neovim version
Operating system and version
Linux 6.8.1
Telescope version / branch / rev
master (c2ce039)
checkhealth telescope
Steps to reproduce
nvim -nu minimal.lua
:Telescope live_grep
Expected behavior
The preview pane should remain visible while resizing horizontally. The layout should flip to vertical once the width is reduced below 120.
Actual behavior
There is a period while resizing horizontally where the preview pane is not visible. This happens between widths of 120 and 100. When the window width is reduced below 100, the preview appears again in a vertical layout. This doesn't make sense because if you started with a vertical layout, you wouldn't expect increasing the width of the window to show less of the UI.
Video:
https://github.com/nvim-telescope/telescope.nvim/assets/86718942/f8e272a0-b719-4752-9adc-fa08f085c099
Analysis
The reason this happens is because of a mismatch between the default
flip_columns
andflip_lines
values (which are 100 and 20) for the flex layout and thepreview_cutoff
values for the horizontal and vertical layouts (which are 120 and 40). When the window width is increased to 100, the horizontal layout is switched to, but the horizontal layout won't display a preview pane because the window width is below the preview cutoff for the horizontal layout.My suggested change would be to set the default
flip_columns
andflip_lines
values in the flex layout code to 120 and 40 respectively. This would ensure the vertical layout is only switched away from when the window is wide enough for the horizontal layout to display correctly. Alternatively, the defaultclip_columns
andflip_lines
values could be taken from thepreview_cutoff
values for the horizontal and vertical layouts automatically.Note that the desired behavior can be achieved just by adding the following code to telescope's config, but as I consider the default behavior a bit strange, I thought it might be better to have that changed so this config isn't needed.
Minimal config
The text was updated successfully, but these errors were encountered: