diff src/syntax.c @ 2906:8477b2cc2b81 v7.3.226

updated for version 7.3.226 Problem: On a 64 bit system "syn sync fromstart" is very slow. (Bjorn Steinbrink) Solution: Store the state when starting to parse from the first line.
author Bram Moolenaar <bram@vim.org>
date Sun, 19 Jun 2011 04:54:21 +0200
parents 8d8bd6307b1a
children 320cc46d0eb0
line wrap: on
line diff
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -559,7 +559,13 @@ syntax_start(wp, lnum)
     if (INVALID_STATE(&current_state))
     {
 	syn_sync(wp, lnum, last_valid);
-	first_stored = current_lnum + syn_block->b_syn_sync_minlines;
+	if (current_lnum == 1)
+	    /* First line is always valid, no matter "minlines". */
+	    first_stored = 1;
+	else
+	    /* Need to parse "minlines" lines before state can be considered
+	     * valid to store. */
+	    first_stored = current_lnum + syn_block->b_syn_sync_minlines;
     }
     else
 	first_stored = current_lnum;