Skip to content
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

feat(pickers): custom results height for centered layout #2911

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ribru17
Copy link

@ribru17 ribru17 commented Feb 5, 2024

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

  • Setting the new option to a value less than 1 and greater than 0 (so it should be a percentage value)
  • 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:

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

@Conni2461
Copy link
Member

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?

@ribru17 ribru17 force-pushed the master branch 2 times, most recently from b94f106 to 2d97ff4 Compare February 25, 2024 18:36
@ribru17
Copy link
Author

ribru17 commented Feb 25, 2024

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
Copy link
Author

ribru17 commented May 6, 2024

I gave this a rebase, I think it's good to merge 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants