]> granicus.if.org Git - vim/commitdiff
patch 8.2.2011: "syn sync" reports a very large number v8.2.2011
authorBram Moolenaar <Bram@vim.org>
Wed, 18 Nov 2020 15:53:23 +0000 (16:53 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 18 Nov 2020 15:53:23 +0000 (16:53 +0100)
Problem:    "syn sync" reports a very large number.
Solution:   Use "at the first line".

src/syntax.c
src/testdir/test_syntax.vim
src/version.c

index 6025889b20f703a48b9c3426276676db74cd77e2..2245dc6251d54cfbcc7c510a789cdab8aa34e822 100644 (file)
@@ -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)
-       {
-           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)
+       if (curwin->w_s->b_syn_sync_minlines == MAXLNUM)
+           msg_puts(_("from the first line"));
+       else
        {
-           msg_puts(_("maximal "));
-           msg_outnum(curwin->w_s->b_syn_sync_maxlines);
+           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"));
        }
-       msg_puts(_(" lines before top line"));
     }
 }
 
index dc05355865481318617ed846c8d5d9ce1ff5c9e4..f668a508588ddf66236056930437917235f116e7 100644 (file)
@@ -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)')
index c56640dcaab1cc4ad3ed73751f7c4c8b12865189..80d2af9db1ee4ca3fd06d437352388b14768aa58 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2011,
 /**/
     2010,
 /**/