fix(terminal): avoid reading over the end of cell.chars (#19580)

This commit is contained in:
zeertzjq
2022-07-30 21:40:30 +08:00
committed by GitHub
parent c34d72bf7c
commit d36d9be8ff
2 changed files with 11 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim
local poke_eventloop = helpers.poke_eventloop
local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source
local eq, neq = helpers.eq, helpers.neq
local meths = helpers.meths
local retry = helpers.retry
local write_file = helpers.write_file
local command = helpers.command
local exc_exec = helpers.exc_exec
@@ -364,3 +366,11 @@ describe('on_lines does not emit out-of-bounds line indexes when', function()
eq('', exec_lua([[return _G.cb_error]]))
end)
end)
it('terminal truncates number of composing characters to 5', function()
clear()
local chan = meths.open_term(0, {})
local composing = (''):sub(2)
meths.chan_send(chan, 'a' .. composing:rep(8))
retry(nil, nil, function() eq('a' .. composing:rep(5), meths.get_current_line()) end)
end)