mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
update: able to set header flag style
This commit is contained in:
parent
5e48df5126
commit
543f241935
2 changed files with 9 additions and 3 deletions
|
|
@ -44,6 +44,7 @@ impl FromStr for Theme {
|
||||||
#[derive(Deserialize, Serialize, Validate)]
|
#[derive(Deserialize, Serialize, Validate)]
|
||||||
pub struct Manager {
|
pub struct Manager {
|
||||||
cwd: Style,
|
cwd: Style,
|
||||||
|
flag: Style,
|
||||||
|
|
||||||
// Hovered
|
// Hovered
|
||||||
hovered: Style,
|
hovered: Style,
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,13 @@ function Header:cwd()
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local s = ya.readable_path(tostring(self._current.cwd)) .. self:flags()
|
local s = ya.readable_path(tostring(self._current.cwd)) .. " "
|
||||||
return ui.Span(ya.truncate(s, { max = max, rtl = true })):style(THEME.manager.cwd)
|
local flag = self:flags()
|
||||||
|
|
||||||
|
return ui.Line {
|
||||||
|
ui.Span(ya.truncate(s, { max = max, rtl = true })):style(THEME.manager.cwd),
|
||||||
|
ui.Span(ya.truncate(flag, { max = max, rtl = true })):style(THEME.manager.flag)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function Header:flags()
|
function Header:flags()
|
||||||
|
|
@ -46,7 +51,7 @@ function Header:flags()
|
||||||
if finder then
|
if finder then
|
||||||
t[#t + 1] = string.format("find: %s", finder)
|
t[#t + 1] = string.format("find: %s", finder)
|
||||||
end
|
end
|
||||||
return #t == 0 and "" or " (" .. table.concat(t, ", ") .. ")"
|
return #t == 0 and "" or "(" .. table.concat(t, ", ") .. ")"
|
||||||
end
|
end
|
||||||
|
|
||||||
function Header:count()
|
function Header:count()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue