Added StatusView:get_items()
This commit is contained in:
parent
844dced7cd
commit
d5ffee51ff
|
@ -79,32 +79,39 @@ function StatusView:draw_items(items, right_align, yoffset)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function draw_for_doc_view(self, x, y)
|
function StatusView:get_items()
|
||||||
local dv = core.active_view
|
if getmetatable(core.active_view) == DocView then
|
||||||
local line, col = dv.doc:get_selection()
|
local dv = core.active_view
|
||||||
local dirty = dv.doc:is_dirty()
|
local line, col = dv.doc:get_selection()
|
||||||
|
local dirty = dv.doc:is_dirty()
|
||||||
|
|
||||||
self:draw_items {
|
return {
|
||||||
dirty and style.accent or style.text, style.icon_font, "f",
|
dirty and style.accent or style.text, style.icon_font, "f",
|
||||||
style.dim, style.font, separator2, style.text,
|
style.dim, style.font, separator2, style.text,
|
||||||
dv.doc.filename and style.text or style.dim, dv.doc:get_name(),
|
dv.doc.filename and style.text or style.dim, dv.doc:get_name(),
|
||||||
style.text,
|
style.text,
|
||||||
separator,
|
separator,
|
||||||
"line: ", line,
|
"line: ", line,
|
||||||
separator,
|
separator,
|
||||||
col > config.line_limit and style.accent or style.text, "col: ", col,
|
col > config.line_limit and style.accent or style.text, "col: ", col,
|
||||||
style.text,
|
style.text,
|
||||||
separator,
|
separator,
|
||||||
string.format("%d%%", line / #dv.doc.lines * 100),
|
string.format("%d%%", line / #dv.doc.lines * 100),
|
||||||
}
|
}, {
|
||||||
|
style.icon_font, "g",
|
||||||
|
style.font, style.dim, separator2, style.text,
|
||||||
|
#dv.doc.lines, " lines",
|
||||||
|
separator,
|
||||||
|
dv.doc.crlf and "CRLF" or "LF"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
self:draw_items({
|
return {}, {
|
||||||
style.icon_font, "g",
|
style.icon_font, "g",
|
||||||
style.font, style.dim, separator2, style.text,
|
style.font, style.dim, separator2,
|
||||||
#dv.doc.lines, " lines",
|
#core.docs, style.text, " / ",
|
||||||
separator,
|
#core.project_files, " files"
|
||||||
dv.doc.crlf and "CRLF" or "LF"
|
}
|
||||||
}, true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,16 +122,9 @@ function StatusView:draw()
|
||||||
self:draw_items(self.message, false, self.size.y)
|
self:draw_items(self.message, false, self.size.y)
|
||||||
end
|
end
|
||||||
|
|
||||||
if getmetatable(core.active_view) == DocView then
|
local left, right = self:get_items()
|
||||||
draw_for_doc_view(self)
|
self:draw_items(left)
|
||||||
else
|
self:draw_items(right, true)
|
||||||
self:draw_items({
|
|
||||||
style.icon_font, "g",
|
|
||||||
style.font, style.dim, separator2,
|
|
||||||
#core.docs, style.text, " / ",
|
|
||||||
#core.project_files, " files"
|
|
||||||
}, true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue