watch text-changes with signals
All checks were successful
NeoVim tests / code-quality (push) Successful in 1m23s

This commit is contained in:
2025-06-12 23:16:28 -06:00
parent 9054f4453f
commit 9bd0ff2088
2 changed files with 49 additions and 85 deletions

View File

@@ -22,29 +22,10 @@ tracker.create_effect(function()
-- constructed with `h(...)` calls). To help organize the markup, text and
-- tags can be nested in tables at any depth. Line breaks must be specified
-- manually, with '\n'.
local text_ref = ui_buf.renderer:create_ref()
ui_buf:render {
'Reactive Counter Example\n',
'========================\n\n',
{
'Text field: ',
h('text', { hl = 'DiffAdd', ref = text_ref }, { '[]' }),
'\n',
h('text', {
hl = 'DiffAdd',
nmap = {
['<CR>'] = function()
vim.notify(text_ref:text())
return ''
end,
},
}, ' Submit '),
},
'\n',
'\n',
{ 'Counter: ', tostring(count), '\n' },
'\n',