Commits

David Rogers  committed a260067

Bug 545: ScriptLexer is counting \r\n as 2 newlines

  • Participants
  • Parent commits 78e3160
  • Branches v1-8

Comments (0)

Files changed (1)

File OgreMain/src/OgreScriptLexer.cpp

 
 		// Set up some constant characters of interest
 #if OGRE_WCHAR_T_STRINGS
-		const wchar_t varopener = L'$', quote = L'\"', slash = L'/', backslash = L'\\', openbrace = L'{', closebrace = L'}', colon = L':', star = L'*';
+		const wchar_t varopener = L'$', quote = L'\"', slash = L'/', backslash = L'\\', openbrace = L'{', closebrace = L'}', colon = L':', star = L'*', cr = L'\r', lf = L'\n';
 		wchar_t c = 0, lastc = 0;
 #else
-		const wchar_t varopener = '$', quote = '\"', slash = '/', backslash = '\\', openbrace = '{', closebrace = '}', colon = ':', star = '*';
+		const wchar_t varopener = '$', quote = '\"', slash = '/', backslash = '\\', openbrace = '{', closebrace = '}', colon = ':', star = '*', cr = '\r', lf = '\n';
 		char c = 0, lastc = 0;
 #endif
 
 			}
 
 			// Separate check for newlines just to track line numbers
-			if(isNewline(c))
+			if(c == cr || (c == lf && lastc != cr))
 				line++;
 			
 			i++;