-
-
Notifications
You must be signed in to change notification settings - Fork 75
feat(config): allow configuring widget border styles #642
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
Conversation
Awesome, good job with getting that up and running so quickly. I think border configuration should go in e.g. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Hash)]
#[serde(default)]
pub struct PreviewPanelConfig {
pub size: u16,
pub header: Option<Template>,
pub footer: Option<Template>,
pub scrollbar: bool,
pub border_style: BorderStyle,
} The only thing with that being that we currently don't have equivalent structs for Also, you can use serde to avoid having to manually implement deserialization for your #[derive(Clone, Debug, PartialEq, Deserialize, Default)]
#[serde(rename_all = "snake_case")]
pub enum BorderType {
None,
Plain,
#[default] // Default to Rounded
Rounded,
Thick,
} |
tests are failing left and right, but let me know if this implementation makes sense |
This looks much better 👍🏻 |
#648 is also on the way and making changes to similar files. I plan to merge that one relatively quickly and I thought we might as well refactor that as well in your PR if you don't mind 😊 |
sure, if it lands first I'll deal with the conflicts and bring in |
08c0923
to
a478a68
Compare
ok, I've rebased atop e809ccf |
Nice 👌🏻 The config part works perfectly. I'm unable however to set anything through channel prototypes. Both: [ui.results_panel]
border_type = "none" and [ui]
results_panel = { border_type = "none" } seem to have no effect. Same for the other borders. This makes me think we might want to add more tests including integration tests where we check that a given config and a given prototype render to the expected UI borders. TV has its own micro-framework for these kinds of tests and you can draw inspiration from one of the many existing ones (e.g. https://github.com/raylu/television/blob/2e388ce8151573dc4d79da84ff89220685c2ae4e/tests/cli/cli_ui.rs#L10-L31). |
Oh and it goes without saying the code looks much nicer and cleaner with that refactor you did. Thanks for that 🙏🏻 |
looks good, if you don't mind me intruding. Have you considered the possibility of adding also padding as part of the config? Right now if you remove the borders the text takes over that place and it might be too close to the edge. Adding optional padding would help to overcome this, something like
This would allow config like: [ui.input_bar]
border_type = "none"
padding = { top = 1, right = 1, bottom = 1, left = 1 } wdty? |
probably not in this PR as it's already doing quite a bit also just noticed I have conflicts again |
Ended up adding the CLI options for |
And fixed the conflicts. I'm happy to merge this as is if you're okay with it @lalvarezt @raylu :-) I do feel like we need to address the configuration logic problem which is quite a mess right now and is starting to get difficult to maintain, especially overrides (cli, config, prototypes). Maybe @raylu's suggestion https://docs.rs/merge/latest/merge/ can help with that. |
yup, right with you there, it's getting complex with so many options and priorities |
oh interesting. I didn't think anyone would want to mess with borders through argv, but I guess I could see it yeah, feel free to merge! |
📺 PR Description
this allows changing (or removing) the border styles
tv 0.12.3:

this PR with
see #638
Checklist