# HG changeset patch # User Bram Moolenaar # Date 1605715204 -3600 # Node ID de6c242ec236368838a38b7d655f9839ffab3d58 # Parent 84028b392f3780a23cb14068fd10d506338dda2c patch 8.2.2011: "syn sync" reports a very large number Commit: https://github.com/vim/vim/commit/9950280d377a5c0706d141017fcef9cad598b8b0 Author: Bram Moolenaar Date: Wed Nov 18 16:53:23 2020 +0100 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". diff --git a/src/syntax.c b/src/syntax.c --- a/src/syntax.c +++ b/src/syntax.c @@ -3869,9 +3869,14 @@ syn_cmd_list( msg_puts(_("no syncing")); else { - msg_puts(_("syncing starts ")); - msg_outnum(curwin->w_s->b_syn_sync_minlines); - msg_puts(_(" lines before top line")); + if (curwin->w_s->b_syn_sync_minlines == MAXLNUM) + msg_puts(_("syncing starts at the first line")); + else + { + msg_puts(_("syncing starts ")); + msg_outnum(curwin->w_s->b_syn_sync_minlines); + msg_puts(_(" lines before top line")); + } syn_match_msg(); } return; @@ -3935,19 +3940,24 @@ syn_lines_msg(void) || curwin->w_s->b_syn_sync_minlines > 0) { msg_puts("; "); - if (curwin->w_s->b_syn_sync_minlines > 0) + if (curwin->w_s->b_syn_sync_minlines == MAXLNUM) + msg_puts(_("from the first line")); + else { - msg_puts(_("minimal ")); - msg_outnum(curwin->w_s->b_syn_sync_minlines); - if (curwin->w_s->b_syn_sync_maxlines) - msg_puts(", "); + if (curwin->w_s->b_syn_sync_minlines > 0) + { + msg_puts(_("minimal ")); + msg_outnum(curwin->w_s->b_syn_sync_minlines); + if (curwin->w_s->b_syn_sync_maxlines) + msg_puts(", "); + } + if (curwin->w_s->b_syn_sync_maxlines > 0) + { + msg_puts(_("maximal ")); + msg_outnum(curwin->w_s->b_syn_sync_maxlines); + } + msg_puts(_(" lines before top line")); } - if (curwin->w_s->b_syn_sync_maxlines > 0) - { - msg_puts(_("maximal ")); - msg_outnum(curwin->w_s->b_syn_sync_maxlines); - } - msg_puts(_(" lines before top line")); } } diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim --- a/src/testdir/test_syntax.vim +++ b/src/testdir/test_syntax.vim @@ -316,6 +316,8 @@ func Test_syntax_arg_skipped() syn sync ccomment endif call assert_notmatch('on C-style comments', execute('syntax sync')) + syn sync fromstart + call assert_match('syncing starts at the first line', execute('syntax sync')) syn clear endfunc @@ -735,6 +737,7 @@ func Test_syntax_foldlevel() redir END call assert_equal("\nsyntax foldlevel start", @c) syn sync fromstart + call assert_match('from the first line$', execute('syn sync')) let a = map(range(3,9), 'foldclosed(v:val)') call assert_equal([3,3,3,3,3,3,3], a) " attached cascade folds together let a = map(range(10,15), 'foldclosed(v:val)') diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2011, +/**/ 2010, /**/ 2009,