Skip to content

Commit

Permalink
Support eolfilled style for Batch label (issue #104).
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Feb 27, 2019
1 parent f179655 commit d7fa61b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/VS2017/Notepad2.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.168
VisualStudioVersion = 15.0.28307.421
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Notepad2", "Notepad2.vcxproj", "{B69A8C7E-A22D-45DA-9997-2D1403C7AEE8}"
EndProject
Expand Down
1 change: 1 addition & 0 deletions scintilla/include/SciLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@
#define SCE_BAT_STRINGSQ 9
#define SCE_BAT_STRINGBT 10
#define SCE_BAT_ESCAPE 11
#define SCE_BAT_LABEL_LINE 12
#define SCE_MAKE_DEFAULT 0
#define SCE_MAKE_COMMENT 1
#define SCE_MAKE_PREPROCESSOR 2
Expand Down
1 change: 1 addition & 0 deletions scintilla/include/SciLexer.iface
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ val SCE_BAT_STRINGDQ=8
val SCE_BAT_STRINGSQ=9
val SCE_BAT_STRINGBT=10
val SCE_BAT_ESCAPE=11
val SCE_BAT_LABEL_LINE=12
# Lexical states for SCLEX_TCMD
#lex TCMD=SCLEX_TCMD SCE_TCMD_
#val SCE_TCMD_DEFAULT=0
Expand Down
7 changes: 6 additions & 1 deletion scintilla/lexers/LexBatch.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ static void ColouriseBatchDoc(Sci_PositionU startPos, Sci_Position length, int i
sc.SetState(SCE_BAT_DEFAULT);
}
break;
case SCE_BAT_LABEL_LINE:
if (sc.atLineStart) {
sc.SetState(SCE_BAT_DEFAULT);
}
break;
case SCE_BAT_VARIABLE: {
bool end_var = false;
if (quotedVar) {
Expand Down Expand Up @@ -313,7 +318,7 @@ static void ColouriseBatchDoc(Sci_PositionU startPos, Sci_Position length, int i
if (sc.Match(':', ':')) {
sc.SetState(SCE_BAT_COMMENT);
} else if ((visibleChars == 0 || isGoto || isCall) && sc.ch == ':' && iswordstart(sc.chNext) && sc.chNext != '\\') {
sc.SetState(SCE_BAT_LABEL);
sc.SetState((visibleChars == 0) ? SCE_BAT_LABEL_LINE : SCE_BAT_LABEL);
if (isGoto) {
isGoto = false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/EditLexers/stlBatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ NULL

, // 3 Options
"eol skip delims tokens usebackq " // FOR
"eof EOF " // special label

, NULL, NULL

Expand Down Expand Up @@ -58,7 +59,7 @@ static EDITSTYLE Styles_Batch[] = {
{ SCE_BAT_ESCAPE, NP2STYLE_EscapeSequence, EDITSTYLE_HOLE(L"Escape Sequence"), L"fore:#FF0000" },
{ SCE_BAT_VARIABLE, NP2STYLE_Variable, EDITSTYLE_HOLE(L"Variable"), L"fore:#003CE6; back:#FFF1A8" },
{ SCE_BAT_OPERATOR, NP2STYLE_Operator, EDITSTYLE_HOLE(L"Operator"), L"fore:#B000B0" },
{ SCE_BAT_LABEL, NP2STYLE_Label, EDITSTYLE_HOLE(L"Label"), L"fore:#C80000; back:#F4F4F4" },
{ MULTI_STYLE(SCE_BAT_LABEL, SCE_BAT_LABEL_LINE, 0, 0), NP2STYLE_Label, EDITSTYLE_HOLE(L"Label"), L"fore:#C80000; back:#F4F4F4" },
};

EDITLEXER lexBatch = {
Expand Down

0 comments on commit d7fa61b

Please sign in to comment.