mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Merge branch 'main' into winget-ci-di
This commit is contained in:
commit
459f8bbf7c
4 changed files with 38 additions and 43 deletions
|
|
@ -1,5 +1,12 @@
|
||||||
Entity = {
|
Entity = {
|
||||||
_inc = 1000,
|
_inc = 1000,
|
||||||
|
_children = {
|
||||||
|
{ "icon", id = 1, order = 1000 },
|
||||||
|
{ "prefix", id = 2, order = 2000 },
|
||||||
|
{ "highlights", id = 3, order = 3000 },
|
||||||
|
{ "found", id = 4, order = 4000 },
|
||||||
|
{ "symlink", id = 5, order = 5000 },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function Entity:new(file) return setmetatable({ _file = file }, { __index = self }) end
|
function Entity:new(file) return setmetatable({ _file = file }, { __index = self }) end
|
||||||
|
|
@ -68,8 +75,8 @@ end
|
||||||
|
|
||||||
function Entity:render()
|
function Entity:render()
|
||||||
local lines = {}
|
local lines = {}
|
||||||
for _, child in ipairs(self._children) do
|
for _, c in ipairs(self._children) do
|
||||||
lines[#lines + 1] = child[1](self)
|
lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self)
|
||||||
end
|
end
|
||||||
return ui.Line(lines)
|
return ui.Line(lines)
|
||||||
end
|
end
|
||||||
|
|
@ -85,15 +92,7 @@ function Entity:style()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initialize children
|
-- Children
|
||||||
Entity._children = {
|
|
||||||
{ Entity.icon, id = 1, order = 1000 },
|
|
||||||
{ Entity.prefix, id = 2, order = 2000 },
|
|
||||||
{ Entity.highlights, id = 3, order = 3000 },
|
|
||||||
{ Entity.found, id = 4, order = 4000 },
|
|
||||||
{ Entity.symlink, id = 5, order = 5000 },
|
|
||||||
}
|
|
||||||
|
|
||||||
function Entity:children_add(fn, order)
|
function Entity:children_add(fn, order)
|
||||||
self._inc = self._inc + 1
|
self._inc = self._inc + 1
|
||||||
self._children[#self._children + 1] = { fn, id = self._inc, order = order }
|
self._children[#self._children + 1] = { fn, id = self._inc, order = order }
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@ Header = {
|
||||||
|
|
||||||
_id = "header",
|
_id = "header",
|
||||||
_inc = 1000,
|
_inc = 1000,
|
||||||
|
_left = {
|
||||||
|
{ "cwd", id = 1, order = 1000 },
|
||||||
|
},
|
||||||
|
_right = {
|
||||||
|
{ "count", id = 1, order = 1000 },
|
||||||
|
{ "tabs", id = 2, order = 2000 },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function Header:new(area, tab)
|
function Header:new(area, tab)
|
||||||
|
|
@ -101,15 +108,6 @@ function Header:scroll(event, step) end
|
||||||
|
|
||||||
function Header:touch(event, step) end
|
function Header:touch(event, step) end
|
||||||
|
|
||||||
-- Initialize children
|
|
||||||
Header._left = {
|
|
||||||
{ Header.cwd, id = 1, order = 1000 },
|
|
||||||
}
|
|
||||||
Header._right = {
|
|
||||||
{ Header.count, id = 1, order = 1000 },
|
|
||||||
{ Header.tabs, id = 2, order = 2000 },
|
|
||||||
}
|
|
||||||
|
|
||||||
function Header:children_add(fn, order, side)
|
function Header:children_add(fn, order, side)
|
||||||
self._inc = self._inc + 1
|
self._inc = self._inc + 1
|
||||||
local children = side == self.RIGHT and self._right or self._left
|
local children = side == self.RIGHT and self._right or self._left
|
||||||
|
|
@ -132,8 +130,8 @@ end
|
||||||
|
|
||||||
function Header:children_render(side)
|
function Header:children_render(side)
|
||||||
local lines = {}
|
local lines = {}
|
||||||
for _, child in ipairs(side == self.RIGHT and self._right or self._left) do
|
for _, c in ipairs(side == self.RIGHT and self._right or self._left) do
|
||||||
lines[#lines + 1] = child[1](self)
|
lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self)
|
||||||
end
|
end
|
||||||
return ui.Line(lines)
|
return ui.Line(lines)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
Linemode = {
|
Linemode = {
|
||||||
_inc = 1000,
|
_inc = 1000,
|
||||||
|
_children = {
|
||||||
|
{ "solo", id = 1, order = 1000 },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function Linemode:new(file) return setmetatable({ _file = file }, { __index = self }) end
|
function Linemode:new(file) return setmetatable({ _file = file }, { __index = self }) end
|
||||||
|
|
@ -58,17 +61,13 @@ end
|
||||||
|
|
||||||
function Linemode:render()
|
function Linemode:render()
|
||||||
local lines = {}
|
local lines = {}
|
||||||
for _, child in ipairs(self._children) do
|
for _, c in ipairs(self._children) do
|
||||||
lines[#lines + 1] = child[1](self)
|
lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self)
|
||||||
end
|
end
|
||||||
return ui.Line(lines)
|
return ui.Line(lines)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initialize children
|
-- Children
|
||||||
Linemode._children = {
|
|
||||||
{ Linemode.solo, id = 1, order = 1000 },
|
|
||||||
}
|
|
||||||
|
|
||||||
function Linemode:children_add(fn, order)
|
function Linemode:children_add(fn, order)
|
||||||
self._inc = self._inc + 1
|
self._inc = self._inc + 1
|
||||||
self._children[#self._children + 1] = { fn, id = self._inc, order = order }
|
self._children[#self._children + 1] = { fn, id = self._inc, order = order }
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,16 @@ Status = {
|
||||||
|
|
||||||
_id = "status",
|
_id = "status",
|
||||||
_inc = 1000,
|
_inc = 1000,
|
||||||
|
_left = {
|
||||||
|
{ "mode", id = 1, order = 1000 },
|
||||||
|
{ "size", id = 2, order = 2000 },
|
||||||
|
{ "name", id = 3, order = 3000 },
|
||||||
|
},
|
||||||
|
_right = {
|
||||||
|
{ "permissions", id = 4, order = 1000 },
|
||||||
|
{ "percentage", id = 5, order = 2000 },
|
||||||
|
{ "position", id = 6, order = 3000 },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function Status:new(area, tab)
|
function Status:new(area, tab)
|
||||||
|
|
@ -138,18 +148,7 @@ function Status:scroll(event, step) end
|
||||||
|
|
||||||
function Status:touch(event, step) end
|
function Status:touch(event, step) end
|
||||||
|
|
||||||
-- Initialize children
|
-- Children
|
||||||
Status._left = {
|
|
||||||
{ Status.mode, id = 1, order = 1000 },
|
|
||||||
{ Status.size, id = 2, order = 2000 },
|
|
||||||
{ Status.name, id = 3, order = 3000 },
|
|
||||||
}
|
|
||||||
Status._right = {
|
|
||||||
{ Status.permissions, id = 4, order = 1000 },
|
|
||||||
{ Status.percentage, id = 5, order = 2000 },
|
|
||||||
{ Status.position, id = 6, order = 3000 },
|
|
||||||
}
|
|
||||||
|
|
||||||
function Status:children_add(fn, order, side)
|
function Status:children_add(fn, order, side)
|
||||||
self._inc = self._inc + 1
|
self._inc = self._inc + 1
|
||||||
local children = side == self.RIGHT and self._right or self._left
|
local children = side == self.RIGHT and self._right or self._left
|
||||||
|
|
@ -172,8 +171,8 @@ end
|
||||||
|
|
||||||
function Status:children_render(side)
|
function Status:children_render(side)
|
||||||
local lines = {}
|
local lines = {}
|
||||||
for _, child in ipairs(side == self.RIGHT and self._right or self._left) do
|
for _, c in ipairs(side == self.RIGHT and self._right or self._left) do
|
||||||
lines[#lines + 1] = child[1](self)
|
lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self)
|
||||||
end
|
end
|
||||||
return ui.Line(lines)
|
return ui.Line(lines)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue