diff options
-rw-r--r-- | src/nvim/normal.c | 4 | ||||
-rw-r--r-- | test/old/testdir/test_undo.vim | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 513fb5b202..4280d62a95 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -831,7 +831,7 @@ static void normal_get_additional_char(NormalState *s) // because if it's put back with vungetc() it's too late to apply // mapping. no_mapping--; - while (lang && (s->c = vpeekc()) > 0 + while ((s->c = vpeekc()) > 0 && (s->c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1)) { s->c = plain_vgetc(); if (!utf_iscomposing(s->c)) { @@ -848,7 +848,9 @@ static void normal_get_additional_char(NormalState *s) // but when replaying a recording the next key is already in the // typeahead buffer, so record a <Nop> before that to prevent the // vpeekc() above from applying wrong mappings when replaying. + no_u_sync++; gotchars_nop(); + no_u_sync--; } } no_mapping--; diff --git a/test/old/testdir/test_undo.vim b/test/old/testdir/test_undo.vim index 2d7604b1bf..b75b6f9b0d 100644 --- a/test/old/testdir/test_undo.vim +++ b/test/old/testdir/test_undo.vim @@ -870,5 +870,15 @@ func Test_undo_after_write() call delete('Xtestfile.txt') endfunc +func Test_undo_range_normal() + new + call setline(1, ['asa', 'bsb']) + let &l:undolevels = &l:undolevels + %normal dfs + call assert_equal(['a', 'b'], getline(1, '$')) + undo + call assert_equal(['asa', 'bsb'], getline(1, '$')) + bwipe! +endfunc " vim: shiftwidth=2 sts=2 expandtab |