Skip to content

Commit ccd7f45

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.1.1072: 'diffopt' "linematch" cannot be used with {n} less than 10
Problem: 'diffopt' "linematch" cannot be used with {n} less than 10 digits (after v9.1.1022) Solution: Fix off-by-one error when checking for digit (zeertzjq) closes: #16577 Signed-off-by: zeertzjq <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 04d2a3f commit ccd7f45

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,7 @@ diffopt_changed(void)
27952795
else
27962796
return FAIL;
27972797
}
2798-
else if (STRNCMP(p, "linematch:", 10) == 0 && VIM_ISDIGIT(p[11]))
2798+
else if (STRNCMP(p, "linematch:", 10) == 0 && VIM_ISDIGIT(p[10]))
27992799
{
28002800
p += 10;
28012801
linematch_lines_new = getdigits(&p);

src/testdir/gen_opt_test.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,11 @@ let test_values = {
178178
\ 'icase', 'iwhite', 'iwhiteall', 'horizontal', 'vertical',
179179
\ 'closeoff', 'hiddenoff', 'foldcolumn:0', 'foldcolumn:12',
180180
\ 'followwrap', 'internal', 'indent-heuristic', 'algorithm:myers',
181-
\ 'algorithm:minimal', 'algorithm:patience',
182-
\ 'algorithm:histogram', 'icase,iwhite'],
183-
\ ['xxx', 'foldcolumn:xxx', 'algorithm:xxx', 'algorithm:']],
181+
\ 'icase,iwhite', 'algorithm:minimal', 'algorithm:patience',
182+
\ 'algorithm:histogram', 'linematch:5'],
183+
\ ['xxx', 'foldcolumn:', 'foldcolumn:x', 'foldcolumn:xxx',
184+
\ 'linematch:', 'linematch:x', 'linematch:xxx', 'algorithm:',
185+
\ 'algorithm:xxx', 'context:', 'context:x', 'context:xxx']],
184186
\ 'display': [['', 'lastline', 'truncate', 'uhex', 'lastline,uhex'],
185187
\ ['xxx']],
186188
\ 'eadirection': [['', 'both', 'ver', 'hor'], ['xxx', 'ver,hor']],

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1072,
707709
/**/
708710
1071,
709711
/**/

0 commit comments

Comments
 (0)