aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-03-11 05:14:50 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-22 13:16:10 -0400
commit6fe43d265825d51ba0353a4eca04067d9e2b7870 (patch)
treec53f55dc168a70c090d8af53c3dd76d639256d77 /plugins
parentd14d060f1c52afa0f72f15cdafcc0772474cce79 (diff)
downloadlite-xl-plugins-6fe43d265825d51ba0353a4eca04067d9e2b7870.tar.gz
lite-xl-plugins-6fe43d265825d51ba0353a4eca04067d9e2b7870.zip
scalestatus: use new StatusView api
Diffstat (limited to 'plugins')
-rw-r--r--plugins/scalestatus.lua41
1 files changed, 21 insertions, 20 deletions
diff --git a/plugins/scalestatus.lua b/plugins/scalestatus.lua
index 008feaf..85774a8 100644
--- a/plugins/scalestatus.lua
+++ b/plugins/scalestatus.lua
@@ -5,30 +5,31 @@
version: 20200628_155804
originally by SwissalpS
--]]
-local scale = require "plugins.scale"
+local core = require "core"
local common = require "core.common"
local config = require "core.config"
+local scale = require "plugins.scale"
local StatusView = require "core.statusview"
-config.plugins.scalestatus = common.merge({ format = '%.0f%%' }, config.plugins.scalestatus)
-
-local get_items = StatusView.get_items
-function StatusView:get_items()
-
- local left, right = get_items(self)
-
- local t = {
- self.separator,
- string.format(config.plugins.scalestatus.format, scale.get() * 100),
- }
-
- for _, item in ipairs(t) do
- table.insert(right, item)
- end
-
- return left, right
-
-end
+config.plugins.scalestatus = common.merge(
+ { format = '%.0f%%' },
+ config.plugins.scalestatus
+)
+
+core.status_view:add_item(
+ nil,
+ "status:scale",
+ StatusView.Item.RIGHT,
+ function()
+ return {string.format(
+ config.plugins.scalestatus.format,
+ scale.get() * 100
+ )}
+ end,
+ nil,
+ 1,
+ "scale"
+).separator = core.status_view.separator2
return true