fix(edit): fix K_EVENT interfering with 'digraph'

(cherry picked from commit b08549eb69)
This commit is contained in:
zeertzjq
2023-07-05 11:33:36 +08:00
committed by github-actions[bot]
parent 8fe351b674
commit 1234861183
2 changed files with 20 additions and 1 deletions

View File

@@ -609,7 +609,9 @@ static int insert_execute(VimState *state, int key)
} }
} }
if (s->c != K_EVENT) {
s->c = do_digraph(s->c); s->c = do_digraph(s->c);
}
if ((s->c == Ctrl_V || s->c == Ctrl_Q) && ctrl_x_mode_cmdline()) { if ((s->c == Ctrl_V || s->c == Ctrl_Q) && ctrl_x_mode_cmdline()) {
insert_do_complete(s); insert_do_complete(s);

View File

@@ -1826,6 +1826,23 @@ describe('API', function()
feed('<C-D>') feed('<C-D>')
expect('a') -- recognized i_0_CTRL-D expect('a') -- recognized i_0_CTRL-D
end) end)
it("does not interrupt with 'digraph'", function()
command('set digraph')
feed('i,')
eq(2, eval('1+1')) -- causes K_EVENT key
feed('<BS>')
eq(2, eval('1+1')) -- causes K_EVENT key
feed('.')
expect('') -- digraph ",." worked
feed('<Esc>')
feed(':,')
eq(2, eval('1+1')) -- causes K_EVENT key
feed('<BS>')
eq(2, eval('1+1')) -- causes K_EVENT key
feed('.')
eq('', funcs.getcmdline()) -- digraph ",." worked
end)
end) end)
describe('nvim_get_context', function() describe('nvim_get_context', function()