Skip to content

Commit 454709b

Browse files
committed
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)
1 parent 2fcf668 commit 454709b

File tree

5 files changed

+55
-1
lines changed

5 files changed

+55
-1
lines changed

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,6 +2099,7 @@ test_arglist \
20992099
test_cdo \
21002100
test_channel \
21012101
test_charsearch \
2102+
test_charsearch_utf8 \
21022103
test_changedtick \
21032104
test_cindent \
21042105
test_cmdline \

src/search.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,11 @@ searchc(cmdarg_T *cap, int t_cmd)
16431643
}
16441644
else /* repeat previous search */
16451645
{
1646-
if (*lastc == NUL)
1646+
if (*lastc == NUL
1647+
#ifdef FEAT_MBYTE
1648+
&& lastc_bytelen == 1
1649+
#endif
1650+
)
16471651
return FAIL;
16481652
if (dir) /* repeat in opposite direction */
16491653
dir = -lastcdir;

src/testdir/test_alot_utf8.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
" files, so that they can be run by themselves.
77

88
set belloff=all
9+
source test_charsearch_utf8.vim
910
source test_expr_utf8.vim
1011
source test_matchadd_conceal_utf8.vim
1112
source test_regexp_utf8.vim
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
" Tests for related f{char} and t{char} using utf-8.
2+
if !has('multi_byte')
3+
finish
4+
endif
5+
6+
" Test for t,f,F,T movement commands
7+
function! Test_search_cmds()
8+
new!
9+
call setline(1, "・最初から最後まで最強のVimは最高")
10+
1
11+
normal! f
12+
call assert_equal([0, 1, 4, 0], getpos('.'))
13+
normal! ;
14+
call assert_equal([0, 1, 16, 0], getpos('.'))
15+
normal! 2;
16+
call assert_equal([0, 1, 43, 0], getpos('.'))
17+
normal! ,
18+
call assert_equal([0, 1, 28, 0], getpos('.'))
19+
bw!
20+
endfunction
21+
22+
" vim: shiftwidth=2 sts=2 expandtab
23+
" Tests for related f{char} and t{char} using utf-8.
24+
if !has('multi_byte')
25+
finish
26+
endif
27+
28+
" Test for t,f,F,T movement commands
29+
function! Test_search_cmds()
30+
new!
31+
call setline(1, "・最初から最後まで最強のVimは最高")
32+
1
33+
normal! f
34+
call assert_equal([0, 1, 4, 0], getpos('.'))
35+
normal! ;
36+
call assert_equal([0, 1, 16, 0], getpos('.'))
37+
normal! 2;
38+
call assert_equal([0, 1, 43, 0], getpos('.'))
39+
normal! ,
40+
call assert_equal([0, 1, 28, 0], getpos('.'))
41+
bw!
42+
endfunction
43+
44+
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
446,
769+
/**/
770+
446,
767771
/**/
768772
445,
769773
/**/

0 commit comments

Comments
 (0)