diff options
| author | a-kenji <aks.kenji@protonmail.com> | 2021-05-12 13:32:39 +0200 |
|---|---|---|
| committer | a-kenji <aks.kenji@protonmail.com> | 2021-05-12 15:27:28 +0200 |
| commit | 776a2c5151f768bfa40fda7471258527c106dd85 (patch) | |
| tree | ea9c4f5b93f5f9ca9a517dd146f69b1817bc0a60 /src/common/input | |
| parent | docs(changelog): compatibility update (diff) | |
| download | sl0ppij-776a2c5151f768bfa40fda7471258527c106dd85.tar.gz sl0ppij-776a2c5151f768bfa40fda7471258527c106dd85.tar.xz sl0ppij-776a2c5151f768bfa40fda7471258527c106dd85.zip | |
Fix Simplified Ui
Propagate the config now, in all the places, as opposed to
fallback to a default.
Diffstat (limited to 'src/common/input')
| -rw-r--r-- | src/common/input/handler.rs | 7 | ||||
| -rw-r--r-- | src/common/input/options.rs | 22 |
2 files changed, 7 insertions, 22 deletions
diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs index 68a75448..b3bbbd0c 100644 --- a/src/common/input/handler.rs +++ b/src/common/input/handler.rs @@ -147,9 +147,12 @@ impl InputHandler { /// Creates a [`Help`] struct indicating the current [`InputMode`] and its keybinds /// (as pairs of [`String`]s). // TODO this should probably be automatically generated in some way -pub fn get_mode_info(mode: InputMode, palette: Palette) -> ModeInfo { +pub fn get_mode_info( + mode: InputMode, + palette: Palette, + capabilities: PluginCapabilities, +) -> ModeInfo { let mut keybinds: Vec<(String, String)> = vec![]; - let capabilities = PluginCapabilities { arrow_fonts: true }; match mode { InputMode::Normal | InputMode::Locked => {} InputMode::Resize => { diff --git a/src/common/input/options.rs b/src/common/input/options.rs index 3bd3fc31..33625b65 100644 --- a/src/common/input/options.rs +++ b/src/common/input/options.rs @@ -6,18 +6,10 @@ use structopt::StructOpt; #[derive(Clone, Default, Debug, PartialEq, Deserialize, Serialize, StructOpt)] /// Options that can be set either through the config file, /// or cli flags -/// intermediate struct pub struct Options { /// Allow plugins to use a more simplified layout /// that is compatible with more fonts #[structopt(long)] - pub simplified_ui: Option<bool>, -} - -#[derive(Clone, Default, Debug, PartialEq, Deserialize, Serialize)] -/// Merged version of the [`Options`] struct -// TODO: Maybe a good candidate for a macro? -pub struct ConfigOptions { pub simplified_ui: bool, } @@ -34,8 +26,8 @@ impl Options { /// will supercede a `Some` in `self` // TODO: Maybe a good candidate for a macro? pub fn merge(&self, other: Options) -> Options { - let simplified_ui = if let Some(bool) = other.simplified_ui { - Some(bool) + let simplified_ui = if other.simplified_ui { + true } else { self.simplified_ui }; @@ -51,13 +43,3 @@ impl Options { } } } - -impl From<Options> for ConfigOptions { - fn from(options: Options) -> ConfigOptions { - let simplified_ui = options.simplified_ui; - - ConfigOptions { - simplified_ui: simplified_ui.unwrap_or_default(), - } - } -} |
