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

Vertical padding does not take tabline into account #995

Closed
siduck opened this issue Jul 15, 2021 · 6 comments · Fixed by #1027
Closed

Vertical padding does not take tabline into account #995

siduck opened this issue Jul 15, 2021 · 6 comments · Fixed by #1027
Labels
bug Something isn't working

Comments

@siduck
Copy link

siduck commented Jul 15, 2021

Hi there! Is there any setting to have both ( top and bottom space around telescope ) have equal padding? the bottom padding looks a bit more than the top one.

image

@siduck siduck added the bug Something isn't working label Jul 15, 2021
@fdschmidt93
Copy link
Member

fdschmidt93 commented Jul 15, 2021

See :h telescope.layout

This should achieve what you want.

telescope.setup {
  defaults = {
    layout_config = {
      height = {
        padding = 10
      }
    }
  }
}

For next time, please aspire to consult the docs first before reporting a "bug" that's not a bug ;) e2: I stand corrected.

e: closing this unless the snippet does not achieve the desired outcome

@siduck
Copy link
Author

siduck commented Jul 15, 2021

@fdschmidt93 thanks! anyways the bottom padding still looks a bit more , maybe because of the tabline

image

@clason
Copy link
Contributor

clason commented Jul 15, 2021

Yes, tabline is not taken into account when calculating the height. That is a bug.

@clason clason reopened this Jul 15, 2021
@clason clason changed the title equal padding Vertical padding does not take tabline into account Jul 15, 2021
@siduck
Copy link
Author

siduck commented Jul 15, 2021

Yes, tabline is not taken into account when calculating the height. That is a bug.

can we hide the tabline when telescope's opened? like ( toggling showtabline=0) also re-add it when telescope's closed? looks better without it :D

image

@fdschmidt93
Copy link
Member

can we hide the tabline when telescope's opened? like ( toggling showtabline=0) also re-add it when telescope's closed? looks better without it :D

You could achieve that with autocommands around the TelescopePrompt filetype I guess.

@l-kershaw
Copy link
Contributor

Firstly, I think I should point out that there will always be some circumstances where the amount of padding differs above/below. For example if the number of lines in the window is 80 and the height of the picker is set to be 75, you can't evenly distribute the remaining 5 lines between the top and bottom.
However, this should never be an issue when using the height={padding=...} style of configuration, as the height of the picker is calculated in a way that ensures the spacing is even on both sides.

That being said I agree that the current situation isn't quite ideal, and we can definitely improve upon it.


I don't think that hiding the tabline with an autocommand is the best way to handle this. This would cause the whole file to move visually upwards, which is less noticeable with large layouts, but would be very noticeable with smaller ones (like the get_dropdown theme or the upcoming get_cursor theme #878). It also wouldn't really be relevant when the picker is not positioned/sized relative to the whole window (as in the upcoming cursor layout PR).

I think it would be better to build into the logic of the layout_strategies with a check for showtabline that adjusts max_lines before picker_width and picker_height are calculated. You would also need to adjust height_padding slightly if showtabline==1.
This then does not hide information that the user might want, avoids the scrolling issue and allows us to choose which layouts require adjusting for the tabline.

If someone wants to write a PR for this, then I'm more than happy to review it, just ping me if you do 🙂
If not, I can add it to my list and will write a PR when I get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants