diff options
author | Guldoman <giulio.lettieri@gmail.com> | 2022-07-15 06:34:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-15 00:34:52 -0400 |
commit | dfd0a5020fbf5904ca674256ff42510be5e11a48 (patch) | |
tree | b02f25411f3e40a819577ebf2d607fe77a214f65 /plugins/wordcount.lua | |
parent | a1c7102578f166df804bf5dbdbe6aac6810dff2d (diff) | |
download | lite-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.lua | 12 |
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 -) +}) |