Compare commits

..

2 Commits

3 changed files with 11 additions and 24 deletions

View File

@ -52,24 +52,6 @@ impl<'de> Deserialize<'de> for Keymap {
#[rustfmt::skip] #[rustfmt::skip]
Preset::mix(&mut shadow.completion.keymap, shadow.completion.prepend_keymap, shadow.completion.append_keymap); 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() == "<Backspace>") {
println!(
"WARNING: Default keybinding for `<Backspace>` is missing, please add a `{}` to the `[input]` section of `keymap.toml`.
In Yazi v0.2.0, `<Backspace>` previously hardcoded within the input component has been moved to `keymap.toml` to allow users to customize it.",
r#"{ on = [ "<Backspace>" ], 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 { Ok(Self {
manager: shadow.manager.keymap, manager: shadow.manager.keymap,
tasks: shadow.tasks.keymap, tasks: shadow.tasks.keymap,

View File

@ -1,7 +1,7 @@
use serde::{Deserialize, Deserializer}; use serde::{Deserialize, Deserializer};
use super::Style; use super::Style;
use crate::{theme::{Color, StyleShadow}, Pattern}; use crate::{preset::Preset, theme::{Color, StyleShadow}, Pattern};
pub struct Icon { pub struct Icon {
pub name: Pattern, pub name: Pattern,
@ -17,6 +17,10 @@ impl Icon {
#[derive(Deserialize)] #[derive(Deserialize)]
struct IconOuter { struct IconOuter {
rules: Vec<IconRule>, rules: Vec<IconRule>,
#[serde(default)]
prepend_rules: Vec<IconRule>,
#[serde(default)]
append_rules: Vec<IconRule>,
} }
#[derive(Deserialize)] #[derive(Deserialize)]
struct IconRule { struct IconRule {
@ -26,8 +30,11 @@ impl Icon {
fg: Option<Color>, fg: Option<Color>,
} }
let mut outer = IconOuter::deserialize(deserializer)?;
Preset::mix(&mut outer.rules, outer.prepend_rules, outer.append_rules);
Ok( Ok(
IconOuter::deserialize(deserializer)? outer
.rules .rules
.into_iter() .into_iter()
.map(|r| Icon { .map(|r| Icon {

View File

@ -1,6 +1,6 @@
use std::ops::Deref; use std::ops::Deref;
use mlua::{AnyUserData, ExternalError, Lua, MetaMethod, UserDataFields, UserDataMethods}; use mlua::{AnyUserData, Lua, MetaMethod, UserDataFields, UserDataMethods};
use super::{Tab, SCOPE}; use super::{Tab, SCOPE};
@ -29,8 +29,6 @@ impl Tabs {
reg.add_meta_method(MetaMethod::Index, |_, me, idx: usize| { reg.add_meta_method(MetaMethod::Index, |_, me, idx: usize| {
if idx > me.len() || idx == 0 { if idx > me.len() || idx == 0 {
Ok(None) Ok(None)
} else if idx - 1 == me.idx {
Err("Use `active` instead of `tabs` to access the current tab".into_lua_err())
} else { } else {
Some(Tab::make(&me[idx - 1])).transpose() Some(Tab::make(&me[idx - 1])).transpose()
} }