aboutsummaryrefslogtreecommitdiff
path: root/plugins/wordcount.lua
diff options
context:
space:
mode:
authorGuldoman <giulio.lettieri@gmail.com>2022-07-15 06:34:52 +0200
committerGitHub <noreply@github.com>2022-07-15 00:34:52 -0400
commitdfd0a5020fbf5904ca674256ff42510be5e11a48 (patch)
treeb02f25411f3e40a819577ebf2d607fe77a214f65 /plugins/wordcount.lua
parenta1c7102578f166df804bf5dbdbe6aac6810dff2d (diff)
downloadlite-xl-plugins-dfd0a5020fbf5904ca674256ff42510be5e11a48.tar.gz
lite-xl-plugins-dfd0a5020fbf5904ca674256ff42510be5e11a48.zip
Use new `StatusView:add_item` syntax (#117)
Diffstat (limited to 'plugins/wordcount.lua')
-rw-r--r--plugins/wordcount.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/wordcount.lua b/plugins/wordcount.lua
index 224ad5e..42224ac 100644
--- a/plugins/wordcount.lua
+++ b/plugins/wordcount.lua
@@ -71,11 +71,11 @@ end
local cached_word_length, cached_word_count
-core.status_view:add_item(
- function() return core.active_view:is(DocView) and not core.active_view:is(CommandView) and words[core.active_view.doc] end,
- "status:word-count",
- StatusView.Item.RIGHT,
- function()
+core.status_view:add_item({
+ predicate = function() return core.active_view:is(DocView) and not core.active_view:is(CommandView) and words[core.active_view.doc] end,
+ name = "status:word-count",
+ alignment = StatusView.Item.RIGHT,
+ get_item = function()
local selection_text = core.active_view.doc:get_selection_text()
if #selection_text ~= cached_word_length then
cached_word_count = compute_line_words(selection_text)
@@ -87,4 +87,4 @@ core.status_view:add_item(
return { style.text, words[core.active_view.doc] .. " words" }
end
end
-)
+})