diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 20:05:57 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 20:15:44 +0100 |
commit | 1257b047471bcb953db2ead6a3f0bf7244717078 (patch) | |
tree | 3eb7b12418875843b430b57bfa8f249d2c01cc0c | |
parent | ff4a628081c3fb50ea064353030a98375332cc23 (diff) | |
download | rneovim-1257b047471bcb953db2ead6a3f0bf7244717078.tar.gz rneovim-1257b047471bcb953db2ead6a3f0bf7244717078.tar.bz2 rneovim-1257b047471bcb953db2ead6a3f0bf7244717078.zip |
vim-patch:8.0.0446: the ";" command does not work after some characters
Problem: The ";" command does not work after characters with a lower byte
that is NUL.
Solution: Properly check for not having a previous character. (Hirohito
Higashi)
https://github.com/vim/vim/commit/454709baffd3205bf2b7d2519419675a122f2bd2
-rw-r--r-- | src/nvim/search.c | 10 | ||||
-rw-r--r-- | src/nvim/testdir/test_alot_utf8.vim | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_charsearch_utf8.vim | 44 |
3 files changed, 51 insertions, 4 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 5d41ed9c2a..1943e2ca43 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1380,13 +1380,15 @@ int searchc(cmdarg_T *cap, int t_cmd) lastc_bytelen += (*mb_char2bytes)(cap->ncharC2, lastc_bytes + lastc_bytelen); } } - } else { /* repeat previous search */ - if (*lastc == NUL) + } else { // repeat previous search + if (*lastc == NUL && lastc_bytelen == 1) { return FAIL; - if (dir) /* repeat in opposite direction */ + } + if (dir) { // repeat in opposite direction dir = -lastcdir; - else + } else { dir = lastcdir; + } t_cmd = last_t_cmd; c = *lastc; /* For multi-byte re-use last lastc_bytes[] and lastc_bytelen. */ diff --git a/src/nvim/testdir/test_alot_utf8.vim b/src/nvim/testdir/test_alot_utf8.vim index 90b2aab467..1da3e62b31 100644 --- a/src/nvim/testdir/test_alot_utf8.vim +++ b/src/nvim/testdir/test_alot_utf8.vim @@ -5,6 +5,7 @@ " runtest.vim. Checking for the multi_byte feature is in the individual " files, so that they can be run by themselves. +source test_charsearch_utf8.vim source test_expr_utf8.vim source test_matchadd_conceal_utf8.vim source test_regexp_utf8.vim diff --git a/src/nvim/testdir/test_charsearch_utf8.vim b/src/nvim/testdir/test_charsearch_utf8.vim new file mode 100644 index 0000000000..b700a8c756 --- /dev/null +++ b/src/nvim/testdir/test_charsearch_utf8.vim @@ -0,0 +1,44 @@ +" Tests for related f{char} and t{char} using utf-8. +if !has('multi_byte') + finish +endif + +" Test for t,f,F,T movement commands +function! Test_search_cmds() + new! + call setline(1, "・最初から最後まで最強のVimは最高") + 1 + normal! f最 + call assert_equal([0, 1, 4, 0], getpos('.')) + normal! ; + call assert_equal([0, 1, 16, 0], getpos('.')) + normal! 2; + call assert_equal([0, 1, 43, 0], getpos('.')) + normal! , + call assert_equal([0, 1, 28, 0], getpos('.')) + bw! +endfunction + +" vim: shiftwidth=2 sts=2 expandtab +" Tests for related f{char} and t{char} using utf-8. +if !has('multi_byte') + finish +endif + +" Test for t,f,F,T movement commands +function! Test_search_cmds() + new! + call setline(1, "・最初から最後まで最強のVimは最高") + 1 + normal! f最 + call assert_equal([0, 1, 4, 0], getpos('.')) + normal! ; + call assert_equal([0, 1, 16, 0], getpos('.')) + normal! 2; + call assert_equal([0, 1, 43, 0], getpos('.')) + normal! , + call assert_equal([0, 1, 28, 0], getpos('.')) + bw! +endfunction + +" vim: shiftwidth=2 sts=2 expandtab |