-
-
Notifications
You must be signed in to change notification settings - Fork 856
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
Display Configuration #818
Comments
This is one of the aspects of Telescope that still definitely needs some improving. I think you've got some good ideas here from an initial read, and I'd love to see what kind of PR you can put together. My initial gut reaction is that this could end up getting quite complicated with so many options, but I'll have to think on it for a day or two before I have any kind of valuable feedback to offer. Thanks for the suggestion and plan of action! |
I have looked more into how this sort of thing could be implemented, and I think it would be particularly difficult to have this order for the hierarchy because of the way that Without rewriting this function to handle a load of special cases, we could implement a different hierarchy that still has most of the benefits.
I also think that we can remove the This then leaves us with a hierarchy like this:
This seems like a reasonable compromise of much fewer options to deal with, but still allowing the user to give options in a form that is more convenient to them. With this system, we still have the ability to give The downside of this new "interleaved" hierarchy is that if a user defines the Unless there are any objections to this setup, I'll have a go at making a PR for this over the next couple of days. |
good job @l-kershaw 5a53ec5 :) Closing for now |
Will talk about width, but same logic applies to height.
Is your feature request related to a problem? Please describe.
Two different variables are used to calculate the width of a picker
width
0.75
width_padding
layout_defaults
option/defaultlayout_defaults
layout_strategy
Problems:
width_padding = math.floor((max_columns - width)/2)
orwidth = max_columns - 2 * width_padding
width
option and just use thewidth_padding
, then calculating the appropriatewidth
.width
option to affect the width of the picker.Describe the solution you'd like
A hierarchy of options/defaults.
When calculating the width of a picker with strategy
strat
, use the first non-null value in the following list to calculate both thewidth
and thewidth_padding
.opt.width
opt.layout_config[strat].width
opt.layout_config[strat].width_padding
opt.layout_config.width
opt.layout_config.width_padding
default.width
: default value=nil
default.layout_config[strat].width
: default value=nil
default.layout_config[strat].width_padding
: default value=nil
default.layout_config.width
: default value=nil
default.layout_config.width_padding
: default value=math.max(max_columns*0.1,5)
Advantages:
width
is still a top-level option, you can specify a custom width of the picker easily in any custom mappings.Disadvantages:
Describe alternatives you've considered
width_padding
options/defaults entirely.width_padding
can be calculated easily fromwidth
, this vastly simplifies the code required.n
column gap on each side of the picker.width
options/defaults entirely.width
can be calculated easily fromwidth_padding
, this simplifies the code required.center
layout strategy, as the other strategies don't check this option.If we had to pick one of these alternatives, I would remove
width_padding
as the notion ofwidth
is clearer to the user.Additional context
I'm happy to have a go at putting a PR for this together, but wanted to get feedback on the general idea first.
The text was updated successfully, but these errors were encountered: