Skip to content

Commit 9950280

Browse files
committed
patch 8.2.2011: "syn sync" reports a very large number
Problem: "syn sync" reports a very large number. Solution: Use "at the first line".
1 parent 8e02faf commit 9950280

3 files changed

Lines changed: 29 additions & 14 deletions

File tree

src/syntax.c

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,9 +3869,14 @@ syn_cmd_list(
38693869
msg_puts(_("no syncing"));
38703870
else
38713871
{
3872-
msg_puts(_("syncing starts "));
3873-
msg_outnum(curwin->w_s->b_syn_sync_minlines);
3874-
msg_puts(_(" lines before top line"));
3872+
if (curwin->w_s->b_syn_sync_minlines == MAXLNUM)
3873+
msg_puts(_("syncing starts at the first line"));
3874+
else
3875+
{
3876+
msg_puts(_("syncing starts "));
3877+
msg_outnum(curwin->w_s->b_syn_sync_minlines);
3878+
msg_puts(_(" lines before top line"));
3879+
}
38753880
syn_match_msg();
38763881
}
38773882
return;
@@ -3935,19 +3940,24 @@ syn_lines_msg(void)
39353940
|| curwin->w_s->b_syn_sync_minlines > 0)
39363941
{
39373942
msg_puts("; ");
3938-
if (curwin->w_s->b_syn_sync_minlines > 0)
3939-
{
3940-
msg_puts(_("minimal "));
3941-
msg_outnum(curwin->w_s->b_syn_sync_minlines);
3942-
if (curwin->w_s->b_syn_sync_maxlines)
3943-
msg_puts(", ");
3944-
}
3945-
if (curwin->w_s->b_syn_sync_maxlines > 0)
3943+
if (curwin->w_s->b_syn_sync_minlines == MAXLNUM)
3944+
msg_puts(_("from the first line"));
3945+
else
39463946
{
3947-
msg_puts(_("maximal "));
3948-
msg_outnum(curwin->w_s->b_syn_sync_maxlines);
3947+
if (curwin->w_s->b_syn_sync_minlines > 0)
3948+
{
3949+
msg_puts(_("minimal "));
3950+
msg_outnum(curwin->w_s->b_syn_sync_minlines);
3951+
if (curwin->w_s->b_syn_sync_maxlines)
3952+
msg_puts(", ");
3953+
}
3954+
if (curwin->w_s->b_syn_sync_maxlines > 0)
3955+
{
3956+
msg_puts(_("maximal "));
3957+
msg_outnum(curwin->w_s->b_syn_sync_maxlines);
3958+
}
3959+
msg_puts(_(" lines before top line"));
39493960
}
3950-
msg_puts(_(" lines before top line"));
39513961
}
39523962
}
39533963

src/testdir/test_syntax.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ func Test_syntax_arg_skipped()
316316
syn sync ccomment
317317
endif
318318
call assert_notmatch('on C-style comments', execute('syntax sync'))
319+
syn sync fromstart
320+
call assert_match('syncing starts at the first line', execute('syntax sync'))
319321

320322
syn clear
321323
endfunc
@@ -735,6 +737,7 @@ func Test_syntax_foldlevel()
735737
redir END
736738
call assert_equal("\nsyntax foldlevel start", @c)
737739
syn sync fromstart
740+
call assert_match('from the first line$', execute('syn sync'))
738741
let a = map(range(3,9), 'foldclosed(v:val)')
739742
call assert_equal([3,3,3,3,3,3,3], a) " attached cascade folds together
740743
let a = map(range(10,15), 'foldclosed(v:val)')

src/version.c

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

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2011,
753755
/**/
754756
2010,
755757
/**/

0 commit comments

Comments
 (0)