From d9ca964064b94fe95d1001e3891d978478bd8428 Mon Sep 17 00:00:00 2001 From: grig-iv Date: Tue, 13 Feb 2024 00:25:04 +0300 Subject: [PATCH 1/5] refactor: remove warnings --- yazi-config/src/keymap/keymap.rs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/yazi-config/src/keymap/keymap.rs b/yazi-config/src/keymap/keymap.rs index f3b7adcff..c5f755b94 100644 --- a/yazi-config/src/keymap/keymap.rs +++ b/yazi-config/src/keymap/keymap.rs @@ -52,24 +52,6 @@ impl<'de> Deserialize<'de> for Keymap { #[rustfmt::skip] Preset::mix(&mut shadow.completion.keymap, shadow.completion.prepend_keymap, shadow.completion.append_keymap); - // TODO: remove this when v0.2.3 is released -- - if !shadow.input.keymap.iter().any(|c| c.on() == "") { - println!( - "WARNING: Default keybinding for `` is missing, please add a `{}` to the `[input]` section of `keymap.toml`. -In Yazi v0.2.0, `` previously hardcoded within the input component has been moved to `keymap.toml` to allow users to customize it.", - r#"{ on = [ "" ], exec = "backspace" }"# - ); - } - // TODO: -- remove this when v0.2.3 is released - - // TODO: remove this when v0.2.3 is released -- - if shadow.manager.keymap.iter().any(|c| c.exec().contains("--empty=name")) { - println!( - "WARNING: `rename --empty=name` is deprecated in Yazi v0.2.2, please use `rename --empty=stem` instead.", - ); - } - // TODO: -- remove this when v0.2.3 is released - Ok(Self { manager: shadow.manager.keymap, tasks: shadow.tasks.keymap, From a92787564b91b6e391fd59a802dcdadb5813ed08 Mon Sep 17 00:00:00 2001 From: grig-iv Date: Tue, 13 Feb 2024 00:27:25 +0300 Subject: [PATCH 2/5] feat: add [icon] prepend_rules and append_rules --- yazi-config/src/theme/icon.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/yazi-config/src/theme/icon.rs b/yazi-config/src/theme/icon.rs index 3898334ba..69f9418de 100644 --- a/yazi-config/src/theme/icon.rs +++ b/yazi-config/src/theme/icon.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Deserializer}; use super::Style; -use crate::{theme::{Color, StyleShadow}, Pattern}; +use crate::{theme::{Color, StyleShadow}, Pattern, preset::Preset}; pub struct Icon { pub name: Pattern, @@ -17,6 +17,10 @@ impl Icon { #[derive(Deserialize)] struct IconOuter { rules: Vec, + #[serde(default)] + prepend_rules: Vec, + #[serde(default)] + append_rules: Vec, } #[derive(Deserialize)] struct IconRule { @@ -26,8 +30,13 @@ impl Icon { fg: Option, } + let mut outer = IconOuter::deserialize(deserializer)?; + + #[rustfmt::skip] + Preset::mix(&mut outer.rules, outer.prepend_rules, outer.append_rules); + Ok( - IconOuter::deserialize(deserializer)? + outer .rules .into_iter() .map(|r| Icon { From bd9ccd30e13f6a887ba6302129221f72c88917b0 Mon Sep 17 00:00:00 2001 From: grig-iv Date: Tue, 13 Feb 2024 00:40:15 +0300 Subject: [PATCH 3/5] format: run rustfmt --- yazi-config/src/theme/icon.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/yazi-config/src/theme/icon.rs b/yazi-config/src/theme/icon.rs index 69f9418de..6e1033584 100644 --- a/yazi-config/src/theme/icon.rs +++ b/yazi-config/src/theme/icon.rs @@ -1,11 +1,15 @@ use serde::{Deserialize, Deserializer}; use super::Style; -use crate::{theme::{Color, StyleShadow}, Pattern, preset::Preset}; +use crate::{ + preset::Preset, + theme::{Color, StyleShadow}, + Pattern, +}; pub struct Icon { - pub name: Pattern, - pub text: String, + pub name: Pattern, + pub text: String, pub style: Style, } @@ -18,9 +22,9 @@ impl Icon { struct IconOuter { rules: Vec, #[serde(default)] - prepend_rules: Vec, + prepend_rules: Vec, #[serde(default)] - append_rules: Vec, + append_rules: Vec, } #[derive(Deserialize)] struct IconRule { @@ -40,8 +44,8 @@ impl Icon { .rules .into_iter() .map(|r| Icon { - name: r.name, - text: r.text, + name: r.name, + text: r.text, style: StyleShadow { fg: r.fg, ..Default::default() }.into(), }) .collect(), From daca83c7d2f27b07ef4abd9f635e79dfc8e00eae Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 13 Feb 2024 16:25:02 +0800 Subject: [PATCH 4/5] Format --- yazi-config/src/theme/icon.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/yazi-config/src/theme/icon.rs b/yazi-config/src/theme/icon.rs index 6e1033584..3692db1f0 100644 --- a/yazi-config/src/theme/icon.rs +++ b/yazi-config/src/theme/icon.rs @@ -1,15 +1,11 @@ use serde::{Deserialize, Deserializer}; use super::Style; -use crate::{ - preset::Preset, - theme::{Color, StyleShadow}, - Pattern, -}; +use crate::{preset::Preset, theme::{Color, StyleShadow}, Pattern}; pub struct Icon { - pub name: Pattern, - pub text: String, + pub name: Pattern, + pub text: String, pub style: Style, } @@ -20,11 +16,11 @@ impl Icon { { #[derive(Deserialize)] struct IconOuter { - rules: Vec, + rules: Vec, #[serde(default)] prepend_rules: Vec, #[serde(default)] - append_rules: Vec, + append_rules: Vec, } #[derive(Deserialize)] struct IconRule { @@ -44,8 +40,8 @@ impl Icon { .rules .into_iter() .map(|r| Icon { - name: r.name, - text: r.text, + name: r.name, + text: r.text, style: StyleShadow { fg: r.fg, ..Default::default() }.into(), }) .collect(), From 1540db1507327d9f4bc6c1e0db8700b7c5bf0e57 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 13 Feb 2024 16:29:40 +0800 Subject: [PATCH 5/5] remove rustfmt::skip --- yazi-config/src/theme/icon.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/yazi-config/src/theme/icon.rs b/yazi-config/src/theme/icon.rs index 3692db1f0..3b2bd3f23 100644 --- a/yazi-config/src/theme/icon.rs +++ b/yazi-config/src/theme/icon.rs @@ -31,8 +31,6 @@ impl Icon { } let mut outer = IconOuter::deserialize(deserializer)?; - - #[rustfmt::skip] Preset::mix(&mut outer.rules, outer.prepend_rules, outer.append_rules); Ok(