mirror of
https://github.com/neovim/neovim.git
synced 2025-11-22 10:06:33 +00:00
fix(edit.c): indentkeys double indent after "!" #12894
which is both unexpected and different from the Vim behaviour. Indent was triggered once by the '!' check in insert_execute(), and inserting the char was correctly skipped, but then triggered again in insert_check() (provided that cindent was not being ignored after manual indentation, i.e. `can_cindent == true`). While this is the smallest fix, another solution would be to remove VimState#check and instead move that to *_enter()/-_execute(), since the control flow is pretty unnecessarily convoluted as is. That would also have the benefit of differing less from the Vim source code.
This commit is contained in:
@@ -6,12 +6,20 @@ local expect = helpers.expect
|
||||
local command = helpers.command
|
||||
local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
local curbuf_contents = helpers.curbuf_contents
|
||||
|
||||
describe('insert-mode', function()
|
||||
before_each(function()
|
||||
clear()
|
||||
end)
|
||||
|
||||
it('indents only once after "!" keys #12894', function()
|
||||
command('let counter = []')
|
||||
command('set indentexpr=len(add(counter,0))')
|
||||
feed('i<C-F>x')
|
||||
eq(' x', curbuf_contents())
|
||||
end)
|
||||
|
||||
it('CTRL-@', function()
|
||||
-- Inserts last-inserted text, leaves insert-mode.
|
||||
insert('hello')
|
||||
|
||||
Reference in New Issue
Block a user