aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-05-12 13:32:39 +0200
committera-kenji <aks.kenji@protonmail.com>2021-05-12 15:27:28 +0200
commit776a2c5151f768bfa40fda7471258527c106dd85 (patch)
treeea9c4f5b93f5f9ca9a517dd146f69b1817bc0a60 /src/common
parentdocs(changelog): compatibility update (diff)
downloadsl0ppij-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')
-rw-r--r--src/common/input/handler.rs7
-rw-r--r--src/common/input/options.rs22
-rw-r--r--src/common/screen.rs4
3 files changed, 9 insertions, 24 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(),
- }
- }
-}
diff --git a/src/common/screen.rs b/src/common/screen.rs
index 804730d0..bc99f953 100644
--- a/src/common/screen.rs
+++ b/src/common/screen.rs
@@ -4,7 +4,7 @@ use std::collections::BTreeMap;
use std::os::unix::io::RawFd;
use std::str;
-use crate::common::input::options::ConfigOptions;
+use crate::common::input::options::Options;
use crate::common::pty::{PtyInstruction, VteBytes};
use crate::common::thread_bus::Bus;
use crate::errors::{ContextType, ScreenContext};
@@ -329,7 +329,7 @@ pub fn screen_thread_main(
bus: Bus<ScreenInstruction>,
max_panes: Option<usize>,
full_screen_ws: PositionAndSize,
- config_options: ConfigOptions,
+ config_options: Options,
) {
let colors = bus.os_input.as_ref().unwrap().load_palette();
let capabilities = config_options.simplified_ui;