mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fixed to maintain backwards compatibility with a warning
This commit is contained in:
parent
680da00d97
commit
41bf51fa9e
3 changed files with 23 additions and 2 deletions
|
|
@ -83,5 +83,15 @@ Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` wi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove when deprecated
|
||||||
|
if matches!(INPUT.create_title, popup::CreateTitle::One(_)) {
|
||||||
|
println!(
|
||||||
|
r#"WARNING: `create_title` config now takes two different values to account for the `--dir` flag.
|
||||||
|
Example:
|
||||||
|
[input]
|
||||||
|
create_title = ["Create:", "Create (dir):"]"#
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@ use serde::Deserialize;
|
||||||
|
|
||||||
use super::{Offset, Origin};
|
use super::{Offset, Origin};
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum CreateTitle {
|
||||||
|
One(String),
|
||||||
|
Two([String; 2]),
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
pub cursor_blink: bool,
|
pub cursor_blink: bool,
|
||||||
|
|
@ -14,7 +21,7 @@ pub struct Input {
|
||||||
pub cd_offset: Offset,
|
pub cd_offset: Offset,
|
||||||
|
|
||||||
// create
|
// create
|
||||||
pub create_title: [String; 2],
|
pub create_title: CreateTitle,
|
||||||
pub create_origin: Origin,
|
pub create_origin: Origin,
|
||||||
pub create_offset: Offset,
|
pub create_offset: Offset,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,12 @@ impl InputCfg {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create(dir: bool) -> Self {
|
pub fn create(dir: bool) -> Self {
|
||||||
|
let title = match &INPUT.create_title {
|
||||||
|
super::CreateTitle::One(single_title) => single_title.to_owned(),
|
||||||
|
super::CreateTitle::Two(titles) => titles[dir as usize].to_owned(),
|
||||||
|
};
|
||||||
Self {
|
Self {
|
||||||
title: INPUT.create_title[dir as usize].to_owned(),
|
title,
|
||||||
position: Position::new(INPUT.create_origin, INPUT.create_offset),
|
position: Position::new(INPUT.create_origin, INPUT.create_offset),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue