mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
3e0466f552
commit
80dd0347c5
8 changed files with 30 additions and 46 deletions
|
|
@ -18,10 +18,10 @@ impl Widget for Bindings<'_> {
|
|||
return;
|
||||
}
|
||||
|
||||
// Key
|
||||
// On
|
||||
let col1 = bindings
|
||||
.iter()
|
||||
.map(|c| ListItem::new(c.on()).style(THEME.help.key.into()))
|
||||
.map(|c| ListItem::new(c.on()).style(THEME.help.on.into()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// Execution
|
||||
|
|
@ -33,10 +33,7 @@ impl Widget for Bindings<'_> {
|
|||
// Description
|
||||
let col3 = bindings
|
||||
.iter()
|
||||
.map(|c| {
|
||||
ListItem::new(if let Some(ref desc) = c.desc { desc } else { "-" })
|
||||
.style(THEME.help.desc.into())
|
||||
})
|
||||
.map(|c| ListItem::new(c.desc.as_deref().unwrap_or("-")).style(THEME.help.desc.into()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let chunks = layout::Layout::new()
|
||||
|
|
@ -47,7 +44,7 @@ impl Widget for Bindings<'_> {
|
|||
let cursor = self.cx.help.rel_cursor() as u16;
|
||||
buf.set_style(
|
||||
Rect { x: area.x, y: area.y + cursor, width: area.width, height: 1 },
|
||||
THEME.help.curr.into(),
|
||||
THEME.help.hovered.into(),
|
||||
);
|
||||
|
||||
List::new(col1).render(chunks[0], buf);
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ impl<'a> Widget for Layout<'a> {
|
|||
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||
let chunks = layout::Layout::new()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([Constraint::Min(0), Constraint::Length(1)].as_ref())
|
||||
.constraints([Constraint::Min(0), Constraint::Length(1)])
|
||||
.split(area);
|
||||
|
||||
Clear.render(area, buf);
|
||||
|
||||
let help = &self.cx.help;
|
||||
Paragraph::new(help.keyword().unwrap_or_else(|| format!("{}.help", help.layer())))
|
||||
.style(THEME.help.btm.into())
|
||||
.style(THEME.help.footer.into())
|
||||
.render(chunks[1], buf);
|
||||
|
||||
Bindings::new(self.cx).render(chunks[0], buf);
|
||||
|
|
|
|||
|
|
@ -40,13 +40,12 @@ impl<'a> Widget for Layout<'a> {
|
|||
Clear.render(area, buf);
|
||||
let block = Block::new()
|
||||
.title({
|
||||
let mut line = Line::from("Tasks".to_string());
|
||||
let mut line = Line::from("Tasks");
|
||||
line.patch_style(THEME.tasks.title.into());
|
||||
line
|
||||
})
|
||||
})
|
||||
.title_alignment(Alignment::Center)
|
||||
.padding(Padding::new(0, 0, 1, 1))
|
||||
// Maybe also add these border type in to the later theme system
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(THEME.tasks.border.into());
|
||||
|
|
|
|||
|
|
@ -36,13 +36,11 @@ impl Widget for Which<'_> {
|
|||
|
||||
let chunks = layout::Layout::new()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints(
|
||||
[Constraint::Ratio(1, 3), Constraint::Ratio(1, 3), Constraint::Ratio(1, 3)].as_ref(),
|
||||
)
|
||||
.constraints([Constraint::Ratio(1, 3), Constraint::Ratio(1, 3), Constraint::Ratio(1, 3)])
|
||||
.split(area);
|
||||
|
||||
Clear.render(area, buf);
|
||||
Block::new().style(THEME.which.block.into()).render(area, buf);
|
||||
Block::new().style(THEME.which.mask.into()).render(area, buf);
|
||||
Side::new(which.times, cands.0).render(chunks[0], buf);
|
||||
Side::new(which.times, cands.1).render(chunks[1], buf);
|
||||
Side::new(which.times, cands.2).render(chunks[2], buf);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use config::{keymap::Control, THEME};
|
||||
use ratatui::{prelude::{Buffer, Rect}, style::Style, text::{Line, Span}, widgets::{Block, List, ListItem, Padding, Widget}};
|
||||
use ratatui::{prelude::{Buffer, Rect}, text::{Line, Span}, widgets::{Block, List, ListItem, Padding, Widget}};
|
||||
|
||||
pub(super) struct Side<'a> {
|
||||
times: usize,
|
||||
|
|
@ -21,18 +21,18 @@ impl Widget for Side<'_> {
|
|||
// Keys
|
||||
let keys = c.on[self.times..].iter().map(ToString::to_string).collect::<Vec<_>>();
|
||||
spans.push(Span::raw(" ".repeat(10usize.saturating_sub(keys.join("").len()))));
|
||||
spans.push(Span::styled(keys[0].clone(), THEME.which.key.into()));
|
||||
spans.push(Span::styled(keys[0].clone(), THEME.which.cand.into()));
|
||||
spans.extend(
|
||||
keys.iter().skip(1).map(|k| Span::styled(k.to_string(), THEME.which.extend.into())),
|
||||
keys.iter().skip(1).map(|k| Span::styled(k.to_string(), THEME.which.rest.into())),
|
||||
);
|
||||
|
||||
// Separator
|
||||
spans.push(Span::styled(
|
||||
THEME.which.separator.separator.to_string(),
|
||||
Style::new().fg(THEME.which.separator.color.into()),
|
||||
THEME.which.separator.to_string(),
|
||||
THEME.which.separator_style.into(),
|
||||
));
|
||||
|
||||
// Exec,
|
||||
// Exec
|
||||
spans.push(Span::styled(c.desc_or_exec(), THEME.which.desc.into()));
|
||||
|
||||
ListItem::new(Line::from(spans))
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ use super::Style;
|
|||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct Help {
|
||||
pub key: Style,
|
||||
pub on: Style,
|
||||
pub exec: Style,
|
||||
pub desc: Style,
|
||||
pub curr: Style,
|
||||
pub btm: Style,
|
||||
|
||||
pub hovered: Style,
|
||||
pub footer: Style,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,14 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{Color, Style};
|
||||
use super::Style;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct Which {
|
||||
pub block: Style,
|
||||
pub key: Style,
|
||||
pub separator: WhichSeparator,
|
||||
pub extend: Style,
|
||||
pub mask: Style,
|
||||
pub cand: Style,
|
||||
pub rest: Style,
|
||||
pub desc: Style,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct WhichItem {
|
||||
pub key: Color,
|
||||
pub extend: Color,
|
||||
pub description: Color,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct WhichSeparator {
|
||||
pub separator: String,
|
||||
pub color: Color,
|
||||
pub separator_style: Style,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"language":"en","flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ"],"version":"0.2"}
|
||||
{"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand"],"language":"en","version":"0.2","flagWords":[]}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue