4410
|
1 diff -ur QScintilla_gpl-2.10.1.orig/lexers/LexMatlab.cpp QScintilla_gpl-2.10.1/lexers/LexMatlab.cpp |
|
2 --- QScintilla_gpl-2.10.1.orig/lexers/LexMatlab.cpp 2017-07-05 08:05:16.545914398 -0400 |
|
3 +++ QScintilla_gpl-2.10.1/lexers/LexMatlab.cpp 2017-07-05 08:19:56.616722104 -0400 |
|
4 @@ -73,6 +73,15 @@ |
|
5 return 0; |
|
6 } |
|
7 |
|
8 +static bool IsSpaceToEOL(Sci_PositionU startPos, Accessor &styler) { |
|
9 + Sci_Position line = styler.GetLine(startPos); |
|
10 + Sci_PositionU eol_pos = styler.LineStart(line + 1) - 1; |
|
11 + for (Sci_PositionU i = startPos; i < eol_pos; i++) { |
|
12 + char ch = styler[i]; |
|
13 + if(!IsASpace(ch)) return false; |
|
14 + } |
|
15 + return true; |
|
16 +} |
|
17 |
|
18 static void ColouriseMatlabOctaveDoc( |
|
19 Sci_PositionU startPos, Sci_Position length, int initStyle, |
|
20 @@ -180,7 +189,7 @@ |
|
21 } |
|
22 } else if (sc.state == SCE_MATLAB_COMMENT) { |
|
23 // end or start of a nested a block comment? |
|
24 - if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column) { |
|
25 + if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) { |
|
26 if(commentDepth > 0) commentDepth --; |
|
27 |
|
28 curLine = styler.GetLine(sc.currentPos); |
|
29 @@ -192,7 +201,7 @@ |
|
30 transpose = false; |
|
31 } |
|
32 } |
|
33 - else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column) |
|
34 + else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) |
|
35 { |
|
36 commentDepth ++; |
|
37 |
|
38 @@ -213,9 +222,12 @@ |
|
39 // check start of a new state |
|
40 if (sc.state == SCE_MATLAB_DEFAULT) { |
|
41 if (IsCommentChar(sc.ch)) { |
|
42 - // ncrement depth if we are a block comment |
|
43 - if(sc.chNext == '{' && nonSpaceColumn == column) |
|
44 - commentDepth ++; |
|
45 + // Increment depth if we are a block comment |
|
46 + if(sc.chNext == '{' && nonSpaceColumn == column) { |
|
47 + if(IsSpaceToEOL(sc.currentPos+2, styler)) { |
|
48 + commentDepth ++; |
|
49 + } |
|
50 + } |
|
51 curLine = styler.GetLine(sc.currentPos); |
|
52 styler.SetLineState(curLine, commentDepth); |
|
53 sc.SetState(SCE_MATLAB_COMMENT); |
|
54 @@ -288,9 +300,9 @@ |
|
55 // a line that starts with a comment |
|
56 if (style == SCE_MATLAB_COMMENT && IsComment(ch) && visibleChars == 0) { |
|
57 // start/end of block comment |
|
58 - if (chNext == '{') |
|
59 + if (chNext == '{' && IsSpaceToEOL(i+2, styler)) |
|
60 levelNext ++; |
|
61 - if (chNext == '}') |
|
62 + if (chNext == '}' && IsSpaceToEOL(i+2, styler)) |
|
63 levelNext --; |
|
64 } |
|
65 // keyword |
|
66 Only in QScintilla_gpl-2.10.1/lexers: LexMatlab.cpp.orig |
|
67 Only in QScintilla_gpl-2.10.1/lexers: LexMatlab.cpp.rej |