better Range:highlight(..) handling

This commit is contained in:
2024-10-14 17:48:14 -06:00
parent 03c5500966
commit 8bbb2ba9c8
5 changed files with 38 additions and 17 deletions

10
spec/withbuf.lua Normal file
View File

@@ -0,0 +1,10 @@
local function withbuf(lines, f)
vim.opt_global.swapfile = false
vim.cmd.new()
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
local ok, result = pcall(f)
vim.cmd.bdelete { bang = true }
if not ok then error(result) end
end
return withbuf