mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
vim-patch:9.0.1866: undo is synced after character find
Problem: Undo is synced after character find. Solution: Set no_u_sync when calling gotchars_nop(). closes: vim/vim#13022 closes: vim/vim#13024dccc29c228
(cherry picked from commit311386c09f
)
This commit is contained in:
parent
6490d937b2
commit
4728f2d2f9
@ -810,7 +810,7 @@ static void normal_get_additional_char(NormalState *s)
|
|||||||
// because if it's put back with vungetc() it's too late to apply
|
// because if it's put back with vungetc() it's too late to apply
|
||||||
// mapping.
|
// mapping.
|
||||||
no_mapping--;
|
no_mapping--;
|
||||||
while (lang && (s->c = vpeekc()) > 0
|
while ((s->c = vpeekc()) > 0
|
||||||
&& (s->c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1)) {
|
&& (s->c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1)) {
|
||||||
s->c = plain_vgetc();
|
s->c = plain_vgetc();
|
||||||
if (!utf_iscomposing(s->c)) {
|
if (!utf_iscomposing(s->c)) {
|
||||||
@ -827,7 +827,9 @@ static void normal_get_additional_char(NormalState *s)
|
|||||||
// but when replaying a recording the next key is already in the
|
// but when replaying a recording the next key is already in the
|
||||||
// typeahead buffer, so record a <Nop> before that to prevent the
|
// typeahead buffer, so record a <Nop> before that to prevent the
|
||||||
// vpeekc() above from applying wrong mappings when replaying.
|
// vpeekc() above from applying wrong mappings when replaying.
|
||||||
|
no_u_sync++;
|
||||||
gotchars_nop();
|
gotchars_nop();
|
||||||
|
no_u_sync--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
no_mapping--;
|
no_mapping--;
|
||||||
|
@ -801,5 +801,15 @@ func Test_undo_after_write()
|
|||||||
call delete('Xtestfile.txt')
|
call delete('Xtestfile.txt')
|
||||||
endfunc
|
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
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Loading…
Reference in New Issue
Block a user