diff options
| author | Topoetry <leo.tisane@disroot.org> | 2026-04-22 03:58:06 +0200 |
|---|---|---|
| committer | Topoetry <leo.tisane@disroot.org> | 2026-04-22 19:01:55 +0200 |
| commit | ee7d98607dc67b08cf554e2cfb7442407f94ce38 (patch) | |
| tree | fa92dc3b2f9222e3d3ca3d85681ef71e118b9545 /init.lua | |
| parent | 97d8bfa7adff156afe1dcf1e833c6dd864f6b5bf (diff) | |
| download | vis-lspc-ee7d98607dc67b08cf554e2cfb7442407f94ce38.tar.gz vis-lspc-ee7d98607dc67b08cf554e2cfb7442407f94ce38.zip | |
made 1 line message be displayed with vis:info
made the documentation for `show_message` clearer
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 32 |
1 files changed, 18 insertions, 14 deletions
@@ -454,22 +454,26 @@ end local function lspc_show_message(msg, hdr, syntax) local current_win = vis.win - if lspc.show_message == 'message' then - local to_show = (hdr or '') .. msg .. '\n' - vis:message(to_show) - vis.win.selection = vis.win.file.size - #to_show - vis:feedkeys('zt') - - elseif lspc.show_message == 'open' then - vis:command('open') - if syntax then - vis:command('set syntax ' .. syntax) - end + if string.find(string.sub(msg, 2, -2), "\n") then + if lspc.show_message == 'message' then + local to_show = (hdr or '') .. msg .. '\n' + vis:message(to_show) + vis.win.selection = vis.win.file.size - #to_show + vis:feedkeys('zt') + + elseif lspc.show_message == 'open' then + vis:command('open') + if syntax then + vis:command('set syntax ' .. syntax) + end - vis.win.file:insert(0, msg) - vis.win.selection.pos = 0 + vis.win.file:insert(0, msg) + vis.win.selection.pos = 0 + else + lspc:err('invalid message configuration "' .. lspc.show_message .. '".') + end else - lspc:err('invalid message configuration "' .. lspc.show_message .. '".') + vis:info(msg) end -- reset the focus to the current window |
