diff src/qscintilla-2-matlab-block-comment.patch @ 4410:9b1f851080b6

qscitilla: update to 2.10.1 * src/qscintilla.mk: update version, checksum, use -std=c++11, use _qtX notation of lib names * src/qscintilla-1-fixes.patch: update patch * src/qscintilla-2-matlab-fold.patch: removed patch * src/qscintilla-3-matlab-block-comment.patch: update patch, rename => qscintilla-2-matlab-block-comment.patch * src/qscintilla-4-matlab-end-op.patch: update patch, rename => qscintilla-3-matlab-end-op.patch * dist-files.mk: add qscintilla-2-matlab-block-comment.patch, scintilla-3-matlab-end-op.patch, remove qscintilla-2-matlab-fold.patch qscintilla-4-matlab-end-op.patch qscintilla-3-matlab-block-comment.patch
author John D
date Mon, 10 Jul 2017 17:00:55 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/qscintilla-2-matlab-block-comment.patch	Mon Jul 10 17:00:55 2017 -0400
@@ -0,0 +1,67 @@
+diff -ur QScintilla_gpl-2.10.1.orig/lexers/LexMatlab.cpp QScintilla_gpl-2.10.1/lexers/LexMatlab.cpp
+--- QScintilla_gpl-2.10.1.orig/lexers/LexMatlab.cpp	2017-07-05 08:05:16.545914398 -0400
++++ QScintilla_gpl-2.10.1/lexers/LexMatlab.cpp	2017-07-05 08:19:56.616722104 -0400
+@@ -73,6 +73,15 @@
+ 	return 0;
+ }
+ 
++static bool IsSpaceToEOL(Sci_PositionU startPos, Accessor &styler) {
++        Sci_Position line = styler.GetLine(startPos);
++	Sci_PositionU eol_pos = styler.LineStart(line + 1) - 1;
++	for (Sci_PositionU i = startPos; i < eol_pos; i++) {
++		char ch = styler[i];
++		if(!IsASpace(ch)) return false;
++	}
++	return true;
++}
+ 
+ static void ColouriseMatlabOctaveDoc(
+             Sci_PositionU startPos, Sci_Position length, int initStyle,
+@@ -180,7 +189,7 @@
+ 			}
+ 		} else if (sc.state == SCE_MATLAB_COMMENT) {
+ 			// end or start of a nested a block comment?
+-			if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column) {
++			if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) {
+                            	if(commentDepth > 0) commentDepth --;
+ 
+ 				curLine = styler.GetLine(sc.currentPos);
+@@ -192,7 +201,7 @@
+ 					transpose = false;
+ 				}
+                         }
+-                        else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column)
++                        else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler))
+                         {
+  				commentDepth ++;
+ 
+@@ -213,9 +222,12 @@
+ 		// check start of a new state
+ 		if (sc.state == SCE_MATLAB_DEFAULT) {
+ 			if (IsCommentChar(sc.ch)) {
+-				// ncrement depth if we are a block comment
+-				if(sc.chNext == '{' && nonSpaceColumn == column)
+-					commentDepth ++;
++				// Increment depth if we are a block comment
++				if(sc.chNext == '{' && nonSpaceColumn == column) {
++					if(IsSpaceToEOL(sc.currentPos+2, styler)) {
++						commentDepth ++;
++					}
++				}
+ 				curLine = styler.GetLine(sc.currentPos);
+ 				styler.SetLineState(curLine, commentDepth);
+ 				sc.SetState(SCE_MATLAB_COMMENT);
+@@ -288,9 +300,9 @@
+ 		// a line that starts with a comment
+ 		if (style == SCE_MATLAB_COMMENT && IsComment(ch) && visibleChars == 0) {
+ 			// start/end of block comment 
+-			if (chNext == '{')
++			if (chNext == '{' && IsSpaceToEOL(i+2, styler))
+ 				levelNext ++;
+-			if (chNext == '}')
++			if (chNext == '}' && IsSpaceToEOL(i+2, styler))
+ 				levelNext --;
+ 		}
+ 		// keyword
+Only in QScintilla_gpl-2.10.1/lexers: LexMatlab.cpp.orig
+Only in QScintilla_gpl-2.10.1/lexers: LexMatlab.cpp.rej