From 1d5f7ae9b0d915d69296e599786bcdf977238b1d Mon Sep 17 00:00:00 2001 From: sammyette Date: Sat, 26 Aug 2023 08:19:12 -0700 Subject: [PATCH] feat(statusview): make a separate item for doc position percent (#1579) * feat(statusview): make a separate item for doc position percent * chore: remove unused variable * fix(statusview): remove command for percent doc item * fix(statusview): change doc percent tooltip * fix(statusview): change percent tooltip message --- data/core/statusview.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/data/core/statusview.lua b/data/core/statusview.lua index 731c0552..3ef40d82 100644 --- a/data/core/statusview.lua +++ b/data/core/statusview.lua @@ -232,15 +232,27 @@ function StatusView:register_docview_items() return { style.text, line, ":", col > config.line_limit and style.accent or style.text, col, - style.text, - self.separator, - string.format("%.f%%", line / #dv.doc.lines * 100) + style.text } end, command = "doc:go-to-line", tooltip = "line : column" }) + self:add_item({ + predicate = predicate_docview, + name = "doc:position-percent", + alignment = StatusView.Item.LEFT, + get_item = function() + local dv = core.active_view + local line = dv.doc:get_selection() + return { + string.format("%.f%%", line / #dv.doc.lines * 100) + } + end, + tooltip = "caret position" + }) + self:add_item({ predicate = predicate_docview, name = "doc:selections",