fix(extui): write each message chunk pattern separately (#34188)

Problem:  Bulking message lines to write in a single API call is
          complicated and still not correct w.r.t. overwriting
          highlights.
Solution: Write each chunk pattern separately with it's highlight
          such that it will be spliced correctly for message chunks
          that contain a carriage return. Go with correctness over
          performance until this proves to be too inefficient.
          Also add an identifying name to the various extui buffers.
This commit is contained in:
luukvbaal
2025-05-26 16:25:45 +02:00
committed by GitHub
parent a6e2c22347
commit c973c7ae6f
2 changed files with 25 additions and 51 deletions

View File

@@ -41,6 +41,7 @@ function M.tab_check_wins()
for _, type in ipairs({ 'box', 'cmd', 'more', 'prompt' }) do
if not api.nvim_buf_is_valid(M.bufs[type]) then
M.bufs[type] = api.nvim_create_buf(false, true)
api.nvim_buf_set_name(M.bufs[type], 'vim._extui.' .. type)
if type == 'cmd' then
-- Attach highlighter to the cmdline buffer.
local parser = assert(vim.treesitter.get_parser(M.bufs.cmd, 'vim', {}))