Make StatusView:add_item accept a table

This commit is contained in:
Guldoman
2022-07-13 07:22:42 +02:00
parent 693bd11b22
commit 9cfa3ecd56
2 changed files with 121 additions and 104 deletions
+11 -10
View File
@@ -168,17 +168,17 @@
```lua
------@return StatusView.Item
function StatusView:add_item(
predicate, name, alignment, getitem, command, pos, tooltip
{ predicate, name, alignment, get_item, command, position, tooltip, separator }
) end
```
**Example:**
```lua
core.status_view:add_item(
nil,
"status:memory-usage",
StatusView.Item.RIGHT,
function()
core.status_view:add_item({
predicate = nil,
name = "status:memory-usage",
alignment = StatusView.Item.RIGHT,
get_item = function()
return {
style.text,
string.format(
@@ -187,10 +187,11 @@
)
}
end,
nil,
1,
"lua memory usage"
).separator = core.status_view.separator2
command = nil,
position = 1,
tooltip = "lua memory usage",
separator = core.status_view.separator2
})
```
* [CommandView:enter](https://github.com/lite-xl/lite-xl/pull/1004) now accepts