telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

feat(pickers): custom results height for centered layout

Open ribru17 opened this issue 1 year ago • 5 comments

Description

I really like the center layout strategy, but I wish I had more control of the height of the individual sections. This PR adds a results_height option to the strategy that will set the height of the results window, and fill the rest of the height with the preview window. This can be especially nice for things like bcommits where the results window really doesn't need to be that large, and you mostly want to see your commit previews in all of their glory.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration

  • [x] Setting the new option to a value less than 1 and greater than 0 (so it should be a percentage value)
  • [x] Setting the option to an absolute height value

Configuration:

  • Neovim version (nvim --version): NVIM v0.9.5 Build type: Release LuaJIT 2.1.1702233742
  • Operating system and version: Arch Linux x86_64, 6.7.1-arch1-1

Checklist:

  • [x] My code follows the style guidelines of this project (stylua)
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation (lua annotations)

ribru17 avatar Feb 05 '24 17:02 ribru17

something doesnt work here, this is default dropdown theme

image

this is dropdown theme with results_height capped to 5

image

and this is dropwdown theme with results_height capped to 5 and previewer = false

image

am not against this, but this needs a little bit longer in the oven, i am also not quite sure what is causing this, on top of my head. i would need to debug a little bit longer here. Do you experience the same bugs or am i just using it wrong?

Conni2461 avatar Feb 25 '24 14:02 Conni2461

Thanks for looking into this, sorry for not testing as thoroughly. It seems I was always using prompt_position = 'bottom', using 'top' was what was messing things up, as the prompt position would also need to be updated in this case. It now gets updated when the position is set to 'top', and after some more testing I think this fixes all the issues; let me know what you think.

ribru17 avatar Feb 25 '24 18:02 ribru17

I gave this a rebase, I think it's good to merge :+1:

ribru17 avatar May 06 '24 16:05 ribru17

What's the status of this PR? It should fix #3133

franklouwers avatar Jun 20 '24 10:06 franklouwers