Merge branch with the changes upgrading to Scintilla 3.5.5.

Closes #16776.
This commit is contained in:
Vadim Zeitlin
2015-07-05 17:00:36 +02:00
114 changed files with 11225 additions and 5242 deletions

View File

@@ -236,6 +236,7 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexBaan.o \ wxscintilla_LexBaan.o \
wxscintilla_LexBash.o \ wxscintilla_LexBash.o \
wxscintilla_LexBasic.o \ wxscintilla_LexBasic.o \
wxscintilla_LexBibTeX.o \
wxscintilla_LexBullant.o \ wxscintilla_LexBullant.o \
wxscintilla_LexCaml.o \ wxscintilla_LexCaml.o \
wxscintilla_LexCLW.o \ wxscintilla_LexCLW.o \
@@ -249,6 +250,7 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexCSS.o \ wxscintilla_LexCSS.o \
wxscintilla_LexD.o \ wxscintilla_LexD.o \
wxscintilla_LexDMAP.o \ wxscintilla_LexDMAP.o \
wxscintilla_LexDMIS.o \
wxscintilla_LexECL.o \ wxscintilla_LexECL.o \
wxscintilla_LexEiffel.o \ wxscintilla_LexEiffel.o \
wxscintilla_LexErlang.o \ wxscintilla_LexErlang.o \
@@ -259,6 +261,7 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexGAP.o \ wxscintilla_LexGAP.o \
wxscintilla_LexGui4Cli.o \ wxscintilla_LexGui4Cli.o \
wxscintilla_LexHaskell.o \ wxscintilla_LexHaskell.o \
wxscintilla_LexHex.o \
wxscintilla_LexHTML.o \ wxscintilla_LexHTML.o \
wxscintilla_LexInno.o \ wxscintilla_LexInno.o \
wxscintilla_LexKix.o \ wxscintilla_LexKix.o \
@@ -294,6 +297,7 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexPython.o \ wxscintilla_LexPython.o \
wxscintilla_LexR.o \ wxscintilla_LexR.o \
wxscintilla_LexRebol.o \ wxscintilla_LexRebol.o \
wxscintilla_LexRegistry.o \
wxscintilla_LexRuby.o \ wxscintilla_LexRuby.o \
wxscintilla_LexRust.o \ wxscintilla_LexRust.o \
wxscintilla_LexScriptol.o \ wxscintilla_LexScriptol.o \
@@ -336,11 +340,14 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_ContractionState.o \ wxscintilla_ContractionState.o \
wxscintilla_Decoration.o \ wxscintilla_Decoration.o \
wxscintilla_Document.o \ wxscintilla_Document.o \
wxscintilla_EditModel.o \
wxscintilla_EditView.o \
wxscintilla_Editor.o \ wxscintilla_Editor.o \
wxscintilla_ExternalLexer.o \ wxscintilla_ExternalLexer.o \
wxscintilla_Indicator.o \ wxscintilla_Indicator.o \
wxscintilla_KeyMap.o \ wxscintilla_KeyMap.o \
wxscintilla_LineMarker.o \ wxscintilla_LineMarker.o \
wxscintilla_MarginView.o \
wxscintilla_PerLine.o \ wxscintilla_PerLine.o \
wxscintilla_PositionCache.o \ wxscintilla_PositionCache.o \
wxscintilla_RESearch.o \ wxscintilla_RESearch.o \
@@ -17059,6 +17066,9 @@ wxscintilla_LexBash.o: $(srcdir)/src/stc/scintilla/lexers/LexBash.cxx
wxscintilla_LexBasic.o: $(srcdir)/src/stc/scintilla/lexers/LexBasic.cxx wxscintilla_LexBasic.o: $(srcdir)/src/stc/scintilla/lexers/LexBasic.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexBasic.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexBasic.cxx
wxscintilla_LexBibTeX.o: $(srcdir)/src/stc/scintilla/lexers/LexBibTeX.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexBibTeX.cxx
wxscintilla_LexBullant.o: $(srcdir)/src/stc/scintilla/lexers/LexBullant.cxx wxscintilla_LexBullant.o: $(srcdir)/src/stc/scintilla/lexers/LexBullant.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexBullant.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexBullant.cxx
@@ -17098,6 +17108,9 @@ wxscintilla_LexD.o: $(srcdir)/src/stc/scintilla/lexers/LexD.cxx
wxscintilla_LexDMAP.o: $(srcdir)/src/stc/scintilla/lexers/LexDMAP.cxx wxscintilla_LexDMAP.o: $(srcdir)/src/stc/scintilla/lexers/LexDMAP.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexDMAP.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexDMAP.cxx
wxscintilla_LexDMIS.o: $(srcdir)/src/stc/scintilla/lexers/LexDMIS.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexDMIS.cxx
wxscintilla_LexECL.o: $(srcdir)/src/stc/scintilla/lexers/LexECL.cxx wxscintilla_LexECL.o: $(srcdir)/src/stc/scintilla/lexers/LexECL.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexECL.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexECL.cxx
@@ -17128,6 +17141,9 @@ wxscintilla_LexGui4Cli.o: $(srcdir)/src/stc/scintilla/lexers/LexGui4Cli.cxx
wxscintilla_LexHaskell.o: $(srcdir)/src/stc/scintilla/lexers/LexHaskell.cxx wxscintilla_LexHaskell.o: $(srcdir)/src/stc/scintilla/lexers/LexHaskell.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexHaskell.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexHaskell.cxx
wxscintilla_LexHex.o: $(srcdir)/src/stc/scintilla/lexers/LexHex.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexHex.cxx
wxscintilla_LexHTML.o: $(srcdir)/src/stc/scintilla/lexers/LexHTML.cxx wxscintilla_LexHTML.o: $(srcdir)/src/stc/scintilla/lexers/LexHTML.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexHTML.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexHTML.cxx
@@ -17233,6 +17249,9 @@ wxscintilla_LexR.o: $(srcdir)/src/stc/scintilla/lexers/LexR.cxx
wxscintilla_LexRebol.o: $(srcdir)/src/stc/scintilla/lexers/LexRebol.cxx wxscintilla_LexRebol.o: $(srcdir)/src/stc/scintilla/lexers/LexRebol.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexRebol.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexRebol.cxx
wxscintilla_LexRegistry.o: $(srcdir)/src/stc/scintilla/lexers/LexRegistry.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexRegistry.cxx
wxscintilla_LexRuby.o: $(srcdir)/src/stc/scintilla/lexers/LexRuby.cxx wxscintilla_LexRuby.o: $(srcdir)/src/stc/scintilla/lexers/LexRuby.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexRuby.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexRuby.cxx
@@ -17359,6 +17378,12 @@ wxscintilla_Decoration.o: $(srcdir)/src/stc/scintilla/src/Decoration.cxx
wxscintilla_Document.o: $(srcdir)/src/stc/scintilla/src/Document.cxx wxscintilla_Document.o: $(srcdir)/src/stc/scintilla/src/Document.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/Document.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/Document.cxx
wxscintilla_EditModel.o: $(srcdir)/src/stc/scintilla/src/EditModel.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/EditModel.cxx
wxscintilla_EditView.o: $(srcdir)/src/stc/scintilla/src/EditView.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/EditView.cxx
wxscintilla_Editor.o: $(srcdir)/src/stc/scintilla/src/Editor.cxx wxscintilla_Editor.o: $(srcdir)/src/stc/scintilla/src/Editor.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/Editor.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/Editor.cxx
@@ -17374,6 +17399,9 @@ wxscintilla_KeyMap.o: $(srcdir)/src/stc/scintilla/src/KeyMap.cxx
wxscintilla_LineMarker.o: $(srcdir)/src/stc/scintilla/src/LineMarker.cxx wxscintilla_LineMarker.o: $(srcdir)/src/stc/scintilla/src/LineMarker.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LineMarker.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LineMarker.cxx
wxscintilla_MarginView.o: $(srcdir)/src/stc/scintilla/src/MarginView.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/MarginView.cxx
wxscintilla_PerLine.o: $(srcdir)/src/stc/scintilla/src/PerLine.cxx wxscintilla_PerLine.o: $(srcdir)/src/stc/scintilla/src/PerLine.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/PerLine.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/PerLine.cxx

View File

@@ -69,6 +69,7 @@
src/stc/scintilla/lexers/LexBaan.cxx src/stc/scintilla/lexers/LexBaan.cxx
src/stc/scintilla/lexers/LexBash.cxx src/stc/scintilla/lexers/LexBash.cxx
src/stc/scintilla/lexers/LexBasic.cxx src/stc/scintilla/lexers/LexBasic.cxx
src/stc/scintilla/lexers/LexBibTeX.cxx
src/stc/scintilla/lexers/LexBullant.cxx src/stc/scintilla/lexers/LexBullant.cxx
src/stc/scintilla/lexers/LexCaml.cxx src/stc/scintilla/lexers/LexCaml.cxx
src/stc/scintilla/lexers/LexCLW.cxx src/stc/scintilla/lexers/LexCLW.cxx
@@ -82,6 +83,7 @@
src/stc/scintilla/lexers/LexCSS.cxx src/stc/scintilla/lexers/LexCSS.cxx
src/stc/scintilla/lexers/LexD.cxx src/stc/scintilla/lexers/LexD.cxx
src/stc/scintilla/lexers/LexDMAP.cxx src/stc/scintilla/lexers/LexDMAP.cxx
src/stc/scintilla/lexers/LexDMIS.cxx
src/stc/scintilla/lexers/LexECL.cxx src/stc/scintilla/lexers/LexECL.cxx
src/stc/scintilla/lexers/LexEiffel.cxx src/stc/scintilla/lexers/LexEiffel.cxx
src/stc/scintilla/lexers/LexErlang.cxx src/stc/scintilla/lexers/LexErlang.cxx
@@ -92,6 +94,7 @@
src/stc/scintilla/lexers/LexGAP.cxx src/stc/scintilla/lexers/LexGAP.cxx
src/stc/scintilla/lexers/LexGui4Cli.cxx src/stc/scintilla/lexers/LexGui4Cli.cxx
src/stc/scintilla/lexers/LexHaskell.cxx src/stc/scintilla/lexers/LexHaskell.cxx
src/stc/scintilla/lexers/LexHex.cxx
src/stc/scintilla/lexers/LexHTML.cxx src/stc/scintilla/lexers/LexHTML.cxx
src/stc/scintilla/lexers/LexInno.cxx src/stc/scintilla/lexers/LexInno.cxx
src/stc/scintilla/lexers/LexKix.cxx src/stc/scintilla/lexers/LexKix.cxx
@@ -127,6 +130,7 @@
src/stc/scintilla/lexers/LexPython.cxx src/stc/scintilla/lexers/LexPython.cxx
src/stc/scintilla/lexers/LexR.cxx src/stc/scintilla/lexers/LexR.cxx
src/stc/scintilla/lexers/LexRebol.cxx src/stc/scintilla/lexers/LexRebol.cxx
src/stc/scintilla/lexers/LexRegistry.cxx
src/stc/scintilla/lexers/LexRuby.cxx src/stc/scintilla/lexers/LexRuby.cxx
src/stc/scintilla/lexers/LexRust.cxx src/stc/scintilla/lexers/LexRust.cxx
src/stc/scintilla/lexers/LexScriptol.cxx src/stc/scintilla/lexers/LexScriptol.cxx
@@ -169,11 +173,14 @@
src/stc/scintilla/src/ContractionState.cxx src/stc/scintilla/src/ContractionState.cxx
src/stc/scintilla/src/Decoration.cxx src/stc/scintilla/src/Decoration.cxx
src/stc/scintilla/src/Document.cxx src/stc/scintilla/src/Document.cxx
src/stc/scintilla/src/EditModel.cxx
src/stc/scintilla/src/EditView.cxx
src/stc/scintilla/src/Editor.cxx src/stc/scintilla/src/Editor.cxx
src/stc/scintilla/src/ExternalLexer.cxx src/stc/scintilla/src/ExternalLexer.cxx
src/stc/scintilla/src/Indicator.cxx src/stc/scintilla/src/Indicator.cxx
src/stc/scintilla/src/KeyMap.cxx src/stc/scintilla/src/KeyMap.cxx
src/stc/scintilla/src/LineMarker.cxx src/stc/scintilla/src/LineMarker.cxx
src/stc/scintilla/src/MarginView.cxx
src/stc/scintilla/src/PerLine.cxx src/stc/scintilla/src/PerLine.cxx
src/stc/scintilla/src/PositionCache.cxx src/stc/scintilla/src/PositionCache.cxx
src/stc/scintilla/src/RESearch.cxx src/stc/scintilla/src/RESearch.cxx

View File

@@ -217,6 +217,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexBaan.obj \ $(OBJS)\wxscintilla_LexBaan.obj \
$(OBJS)\wxscintilla_LexBash.obj \ $(OBJS)\wxscintilla_LexBash.obj \
$(OBJS)\wxscintilla_LexBasic.obj \ $(OBJS)\wxscintilla_LexBasic.obj \
$(OBJS)\wxscintilla_LexBibTeX.obj \
$(OBJS)\wxscintilla_LexBullant.obj \ $(OBJS)\wxscintilla_LexBullant.obj \
$(OBJS)\wxscintilla_LexCaml.obj \ $(OBJS)\wxscintilla_LexCaml.obj \
$(OBJS)\wxscintilla_LexCLW.obj \ $(OBJS)\wxscintilla_LexCLW.obj \
@@ -230,6 +231,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexCSS.obj \ $(OBJS)\wxscintilla_LexCSS.obj \
$(OBJS)\wxscintilla_LexD.obj \ $(OBJS)\wxscintilla_LexD.obj \
$(OBJS)\wxscintilla_LexDMAP.obj \ $(OBJS)\wxscintilla_LexDMAP.obj \
$(OBJS)\wxscintilla_LexDMIS.obj \
$(OBJS)\wxscintilla_LexECL.obj \ $(OBJS)\wxscintilla_LexECL.obj \
$(OBJS)\wxscintilla_LexEiffel.obj \ $(OBJS)\wxscintilla_LexEiffel.obj \
$(OBJS)\wxscintilla_LexErlang.obj \ $(OBJS)\wxscintilla_LexErlang.obj \
@@ -240,6 +242,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexGAP.obj \ $(OBJS)\wxscintilla_LexGAP.obj \
$(OBJS)\wxscintilla_LexGui4Cli.obj \ $(OBJS)\wxscintilla_LexGui4Cli.obj \
$(OBJS)\wxscintilla_LexHaskell.obj \ $(OBJS)\wxscintilla_LexHaskell.obj \
$(OBJS)\wxscintilla_LexHex.obj \
$(OBJS)\wxscintilla_LexHTML.obj \ $(OBJS)\wxscintilla_LexHTML.obj \
$(OBJS)\wxscintilla_LexInno.obj \ $(OBJS)\wxscintilla_LexInno.obj \
$(OBJS)\wxscintilla_LexKix.obj \ $(OBJS)\wxscintilla_LexKix.obj \
@@ -275,6 +278,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexPython.obj \ $(OBJS)\wxscintilla_LexPython.obj \
$(OBJS)\wxscintilla_LexR.obj \ $(OBJS)\wxscintilla_LexR.obj \
$(OBJS)\wxscintilla_LexRebol.obj \ $(OBJS)\wxscintilla_LexRebol.obj \
$(OBJS)\wxscintilla_LexRegistry.obj \
$(OBJS)\wxscintilla_LexRuby.obj \ $(OBJS)\wxscintilla_LexRuby.obj \
$(OBJS)\wxscintilla_LexRust.obj \ $(OBJS)\wxscintilla_LexRust.obj \
$(OBJS)\wxscintilla_LexScriptol.obj \ $(OBJS)\wxscintilla_LexScriptol.obj \
@@ -317,11 +321,14 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_ContractionState.obj \ $(OBJS)\wxscintilla_ContractionState.obj \
$(OBJS)\wxscintilla_Decoration.obj \ $(OBJS)\wxscintilla_Decoration.obj \
$(OBJS)\wxscintilla_Document.obj \ $(OBJS)\wxscintilla_Document.obj \
$(OBJS)\wxscintilla_EditModel.obj \
$(OBJS)\wxscintilla_EditView.obj \
$(OBJS)\wxscintilla_Editor.obj \ $(OBJS)\wxscintilla_Editor.obj \
$(OBJS)\wxscintilla_ExternalLexer.obj \ $(OBJS)\wxscintilla_ExternalLexer.obj \
$(OBJS)\wxscintilla_Indicator.obj \ $(OBJS)\wxscintilla_Indicator.obj \
$(OBJS)\wxscintilla_KeyMap.obj \ $(OBJS)\wxscintilla_KeyMap.obj \
$(OBJS)\wxscintilla_LineMarker.obj \ $(OBJS)\wxscintilla_LineMarker.obj \
$(OBJS)\wxscintilla_MarginView.obj \
$(OBJS)\wxscintilla_PerLine.obj \ $(OBJS)\wxscintilla_PerLine.obj \
$(OBJS)\wxscintilla_PositionCache.obj \ $(OBJS)\wxscintilla_PositionCache.obj \
$(OBJS)\wxscintilla_RESearch.obj \ $(OBJS)\wxscintilla_RESearch.obj \
@@ -5941,6 +5948,9 @@ $(OBJS)\wxscintilla_LexBash.obj: ..\..\src\stc\scintilla\lexers\LexBash.cxx
$(OBJS)\wxscintilla_LexBasic.obj: ..\..\src\stc\scintilla\lexers\LexBasic.cxx $(OBJS)\wxscintilla_LexBasic.obj: ..\..\src\stc\scintilla\lexers\LexBasic.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBasic.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBasic.cxx
$(OBJS)\wxscintilla_LexBibTeX.obj: ..\..\src\stc\scintilla\lexers\LexBibTeX.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBibTeX.cxx
$(OBJS)\wxscintilla_LexBullant.obj: ..\..\src\stc\scintilla\lexers\LexBullant.cxx $(OBJS)\wxscintilla_LexBullant.obj: ..\..\src\stc\scintilla\lexers\LexBullant.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBullant.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBullant.cxx
@@ -5980,6 +5990,9 @@ $(OBJS)\wxscintilla_LexD.obj: ..\..\src\stc\scintilla\lexers\LexD.cxx
$(OBJS)\wxscintilla_LexDMAP.obj: ..\..\src\stc\scintilla\lexers\LexDMAP.cxx $(OBJS)\wxscintilla_LexDMAP.obj: ..\..\src\stc\scintilla\lexers\LexDMAP.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMAP.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMAP.cxx
$(OBJS)\wxscintilla_LexDMIS.obj: ..\..\src\stc\scintilla\lexers\LexDMIS.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMIS.cxx
$(OBJS)\wxscintilla_LexECL.obj: ..\..\src\stc\scintilla\lexers\LexECL.cxx $(OBJS)\wxscintilla_LexECL.obj: ..\..\src\stc\scintilla\lexers\LexECL.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexECL.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexECL.cxx
@@ -6010,6 +6023,9 @@ $(OBJS)\wxscintilla_LexGui4Cli.obj: ..\..\src\stc\scintilla\lexers\LexGui4Cli.cx
$(OBJS)\wxscintilla_LexHaskell.obj: ..\..\src\stc\scintilla\lexers\LexHaskell.cxx $(OBJS)\wxscintilla_LexHaskell.obj: ..\..\src\stc\scintilla\lexers\LexHaskell.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHaskell.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHaskell.cxx
$(OBJS)\wxscintilla_LexHex.obj: ..\..\src\stc\scintilla\lexers\LexHex.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHex.cxx
$(OBJS)\wxscintilla_LexHTML.obj: ..\..\src\stc\scintilla\lexers\LexHTML.cxx $(OBJS)\wxscintilla_LexHTML.obj: ..\..\src\stc\scintilla\lexers\LexHTML.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHTML.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHTML.cxx
@@ -6115,6 +6131,9 @@ $(OBJS)\wxscintilla_LexR.obj: ..\..\src\stc\scintilla\lexers\LexR.cxx
$(OBJS)\wxscintilla_LexRebol.obj: ..\..\src\stc\scintilla\lexers\LexRebol.cxx $(OBJS)\wxscintilla_LexRebol.obj: ..\..\src\stc\scintilla\lexers\LexRebol.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRebol.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRebol.cxx
$(OBJS)\wxscintilla_LexRegistry.obj: ..\..\src\stc\scintilla\lexers\LexRegistry.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRegistry.cxx
$(OBJS)\wxscintilla_LexRuby.obj: ..\..\src\stc\scintilla\lexers\LexRuby.cxx $(OBJS)\wxscintilla_LexRuby.obj: ..\..\src\stc\scintilla\lexers\LexRuby.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRuby.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRuby.cxx
@@ -6241,6 +6260,12 @@ $(OBJS)\wxscintilla_Decoration.obj: ..\..\src\stc\scintilla\src\Decoration.cxx
$(OBJS)\wxscintilla_Document.obj: ..\..\src\stc\scintilla\src\Document.cxx $(OBJS)\wxscintilla_Document.obj: ..\..\src\stc\scintilla\src\Document.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Document.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Document.cxx
$(OBJS)\wxscintilla_EditModel.obj: ..\..\src\stc\scintilla\src\EditModel.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\EditModel.cxx
$(OBJS)\wxscintilla_EditView.obj: ..\..\src\stc\scintilla\src\EditView.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\EditView.cxx
$(OBJS)\wxscintilla_Editor.obj: ..\..\src\stc\scintilla\src\Editor.cxx $(OBJS)\wxscintilla_Editor.obj: ..\..\src\stc\scintilla\src\Editor.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Editor.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Editor.cxx
@@ -6256,6 +6281,9 @@ $(OBJS)\wxscintilla_KeyMap.obj: ..\..\src\stc\scintilla\src\KeyMap.cxx
$(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx $(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LineMarker.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LineMarker.cxx
$(OBJS)\wxscintilla_MarginView.obj: ..\..\src\stc\scintilla\src\MarginView.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\MarginView.cxx
$(OBJS)\wxscintilla_PerLine.obj: ..\..\src\stc\scintilla\src\PerLine.cxx $(OBJS)\wxscintilla_PerLine.obj: ..\..\src\stc\scintilla\src\PerLine.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PerLine.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PerLine.cxx

View File

@@ -205,6 +205,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexBaan.o \ $(OBJS)\wxscintilla_LexBaan.o \
$(OBJS)\wxscintilla_LexBash.o \ $(OBJS)\wxscintilla_LexBash.o \
$(OBJS)\wxscintilla_LexBasic.o \ $(OBJS)\wxscintilla_LexBasic.o \
$(OBJS)\wxscintilla_LexBibTeX.o \
$(OBJS)\wxscintilla_LexBullant.o \ $(OBJS)\wxscintilla_LexBullant.o \
$(OBJS)\wxscintilla_LexCaml.o \ $(OBJS)\wxscintilla_LexCaml.o \
$(OBJS)\wxscintilla_LexCLW.o \ $(OBJS)\wxscintilla_LexCLW.o \
@@ -218,6 +219,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexCSS.o \ $(OBJS)\wxscintilla_LexCSS.o \
$(OBJS)\wxscintilla_LexD.o \ $(OBJS)\wxscintilla_LexD.o \
$(OBJS)\wxscintilla_LexDMAP.o \ $(OBJS)\wxscintilla_LexDMAP.o \
$(OBJS)\wxscintilla_LexDMIS.o \
$(OBJS)\wxscintilla_LexECL.o \ $(OBJS)\wxscintilla_LexECL.o \
$(OBJS)\wxscintilla_LexEiffel.o \ $(OBJS)\wxscintilla_LexEiffel.o \
$(OBJS)\wxscintilla_LexErlang.o \ $(OBJS)\wxscintilla_LexErlang.o \
@@ -228,6 +230,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexGAP.o \ $(OBJS)\wxscintilla_LexGAP.o \
$(OBJS)\wxscintilla_LexGui4Cli.o \ $(OBJS)\wxscintilla_LexGui4Cli.o \
$(OBJS)\wxscintilla_LexHaskell.o \ $(OBJS)\wxscintilla_LexHaskell.o \
$(OBJS)\wxscintilla_LexHex.o \
$(OBJS)\wxscintilla_LexHTML.o \ $(OBJS)\wxscintilla_LexHTML.o \
$(OBJS)\wxscintilla_LexInno.o \ $(OBJS)\wxscintilla_LexInno.o \
$(OBJS)\wxscintilla_LexKix.o \ $(OBJS)\wxscintilla_LexKix.o \
@@ -263,6 +266,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexPython.o \ $(OBJS)\wxscintilla_LexPython.o \
$(OBJS)\wxscintilla_LexR.o \ $(OBJS)\wxscintilla_LexR.o \
$(OBJS)\wxscintilla_LexRebol.o \ $(OBJS)\wxscintilla_LexRebol.o \
$(OBJS)\wxscintilla_LexRegistry.o \
$(OBJS)\wxscintilla_LexRuby.o \ $(OBJS)\wxscintilla_LexRuby.o \
$(OBJS)\wxscintilla_LexRust.o \ $(OBJS)\wxscintilla_LexRust.o \
$(OBJS)\wxscintilla_LexScriptol.o \ $(OBJS)\wxscintilla_LexScriptol.o \
@@ -305,11 +309,14 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_ContractionState.o \ $(OBJS)\wxscintilla_ContractionState.o \
$(OBJS)\wxscintilla_Decoration.o \ $(OBJS)\wxscintilla_Decoration.o \
$(OBJS)\wxscintilla_Document.o \ $(OBJS)\wxscintilla_Document.o \
$(OBJS)\wxscintilla_EditModel.o \
$(OBJS)\wxscintilla_EditView.o \
$(OBJS)\wxscintilla_Editor.o \ $(OBJS)\wxscintilla_Editor.o \
$(OBJS)\wxscintilla_ExternalLexer.o \ $(OBJS)\wxscintilla_ExternalLexer.o \
$(OBJS)\wxscintilla_Indicator.o \ $(OBJS)\wxscintilla_Indicator.o \
$(OBJS)\wxscintilla_KeyMap.o \ $(OBJS)\wxscintilla_KeyMap.o \
$(OBJS)\wxscintilla_LineMarker.o \ $(OBJS)\wxscintilla_LineMarker.o \
$(OBJS)\wxscintilla_MarginView.o \
$(OBJS)\wxscintilla_PerLine.o \ $(OBJS)\wxscintilla_PerLine.o \
$(OBJS)\wxscintilla_PositionCache.o \ $(OBJS)\wxscintilla_PositionCache.o \
$(OBJS)\wxscintilla_RESearch.o \ $(OBJS)\wxscintilla_RESearch.o \
@@ -6116,6 +6123,9 @@ $(OBJS)\wxscintilla_LexBash.o: ../../src/stc/scintilla/lexers/LexBash.cxx
$(OBJS)\wxscintilla_LexBasic.o: ../../src/stc/scintilla/lexers/LexBasic.cxx $(OBJS)\wxscintilla_LexBasic.o: ../../src/stc/scintilla/lexers/LexBasic.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexBibTeX.o: ../../src/stc/scintilla/lexers/LexBibTeX.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexBullant.o: ../../src/stc/scintilla/lexers/LexBullant.cxx $(OBJS)\wxscintilla_LexBullant.o: ../../src/stc/scintilla/lexers/LexBullant.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -6155,6 +6165,9 @@ $(OBJS)\wxscintilla_LexD.o: ../../src/stc/scintilla/lexers/LexD.cxx
$(OBJS)\wxscintilla_LexDMAP.o: ../../src/stc/scintilla/lexers/LexDMAP.cxx $(OBJS)\wxscintilla_LexDMAP.o: ../../src/stc/scintilla/lexers/LexDMAP.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexDMIS.o: ../../src/stc/scintilla/lexers/LexDMIS.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexECL.o: ../../src/stc/scintilla/lexers/LexECL.cxx $(OBJS)\wxscintilla_LexECL.o: ../../src/stc/scintilla/lexers/LexECL.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -6185,6 +6198,9 @@ $(OBJS)\wxscintilla_LexGui4Cli.o: ../../src/stc/scintilla/lexers/LexGui4Cli.cxx
$(OBJS)\wxscintilla_LexHaskell.o: ../../src/stc/scintilla/lexers/LexHaskell.cxx $(OBJS)\wxscintilla_LexHaskell.o: ../../src/stc/scintilla/lexers/LexHaskell.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexHex.o: ../../src/stc/scintilla/lexers/LexHex.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexHTML.o: ../../src/stc/scintilla/lexers/LexHTML.cxx $(OBJS)\wxscintilla_LexHTML.o: ../../src/stc/scintilla/lexers/LexHTML.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -6290,6 +6306,9 @@ $(OBJS)\wxscintilla_LexR.o: ../../src/stc/scintilla/lexers/LexR.cxx
$(OBJS)\wxscintilla_LexRebol.o: ../../src/stc/scintilla/lexers/LexRebol.cxx $(OBJS)\wxscintilla_LexRebol.o: ../../src/stc/scintilla/lexers/LexRebol.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexRegistry.o: ../../src/stc/scintilla/lexers/LexRegistry.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexRuby.o: ../../src/stc/scintilla/lexers/LexRuby.cxx $(OBJS)\wxscintilla_LexRuby.o: ../../src/stc/scintilla/lexers/LexRuby.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -6416,6 +6435,12 @@ $(OBJS)\wxscintilla_Decoration.o: ../../src/stc/scintilla/src/Decoration.cxx
$(OBJS)\wxscintilla_Document.o: ../../src/stc/scintilla/src/Document.cxx $(OBJS)\wxscintilla_Document.o: ../../src/stc/scintilla/src/Document.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_EditModel.o: ../../src/stc/scintilla/src/EditModel.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_EditView.o: ../../src/stc/scintilla/src/EditView.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_Editor.o: ../../src/stc/scintilla/src/Editor.cxx $(OBJS)\wxscintilla_Editor.o: ../../src/stc/scintilla/src/Editor.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -6431,6 +6456,9 @@ $(OBJS)\wxscintilla_KeyMap.o: ../../src/stc/scintilla/src/KeyMap.cxx
$(OBJS)\wxscintilla_LineMarker.o: ../../src/stc/scintilla/src/LineMarker.cxx $(OBJS)\wxscintilla_LineMarker.o: ../../src/stc/scintilla/src/LineMarker.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_MarginView.o: ../../src/stc/scintilla/src/MarginView.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_PerLine.o: ../../src/stc/scintilla/src/PerLine.cxx $(OBJS)\wxscintilla_PerLine.o: ../../src/stc/scintilla/src/PerLine.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -228,6 +228,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexBaan.obj \ $(OBJS)\wxscintilla_LexBaan.obj \
$(OBJS)\wxscintilla_LexBash.obj \ $(OBJS)\wxscintilla_LexBash.obj \
$(OBJS)\wxscintilla_LexBasic.obj \ $(OBJS)\wxscintilla_LexBasic.obj \
$(OBJS)\wxscintilla_LexBibTeX.obj \
$(OBJS)\wxscintilla_LexBullant.obj \ $(OBJS)\wxscintilla_LexBullant.obj \
$(OBJS)\wxscintilla_LexCaml.obj \ $(OBJS)\wxscintilla_LexCaml.obj \
$(OBJS)\wxscintilla_LexCLW.obj \ $(OBJS)\wxscintilla_LexCLW.obj \
@@ -241,6 +242,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexCSS.obj \ $(OBJS)\wxscintilla_LexCSS.obj \
$(OBJS)\wxscintilla_LexD.obj \ $(OBJS)\wxscintilla_LexD.obj \
$(OBJS)\wxscintilla_LexDMAP.obj \ $(OBJS)\wxscintilla_LexDMAP.obj \
$(OBJS)\wxscintilla_LexDMIS.obj \
$(OBJS)\wxscintilla_LexECL.obj \ $(OBJS)\wxscintilla_LexECL.obj \
$(OBJS)\wxscintilla_LexEiffel.obj \ $(OBJS)\wxscintilla_LexEiffel.obj \
$(OBJS)\wxscintilla_LexErlang.obj \ $(OBJS)\wxscintilla_LexErlang.obj \
@@ -251,6 +253,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexGAP.obj \ $(OBJS)\wxscintilla_LexGAP.obj \
$(OBJS)\wxscintilla_LexGui4Cli.obj \ $(OBJS)\wxscintilla_LexGui4Cli.obj \
$(OBJS)\wxscintilla_LexHaskell.obj \ $(OBJS)\wxscintilla_LexHaskell.obj \
$(OBJS)\wxscintilla_LexHex.obj \
$(OBJS)\wxscintilla_LexHTML.obj \ $(OBJS)\wxscintilla_LexHTML.obj \
$(OBJS)\wxscintilla_LexInno.obj \ $(OBJS)\wxscintilla_LexInno.obj \
$(OBJS)\wxscintilla_LexKix.obj \ $(OBJS)\wxscintilla_LexKix.obj \
@@ -286,6 +289,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexPython.obj \ $(OBJS)\wxscintilla_LexPython.obj \
$(OBJS)\wxscintilla_LexR.obj \ $(OBJS)\wxscintilla_LexR.obj \
$(OBJS)\wxscintilla_LexRebol.obj \ $(OBJS)\wxscintilla_LexRebol.obj \
$(OBJS)\wxscintilla_LexRegistry.obj \
$(OBJS)\wxscintilla_LexRuby.obj \ $(OBJS)\wxscintilla_LexRuby.obj \
$(OBJS)\wxscintilla_LexRust.obj \ $(OBJS)\wxscintilla_LexRust.obj \
$(OBJS)\wxscintilla_LexScriptol.obj \ $(OBJS)\wxscintilla_LexScriptol.obj \
@@ -328,11 +332,14 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_ContractionState.obj \ $(OBJS)\wxscintilla_ContractionState.obj \
$(OBJS)\wxscintilla_Decoration.obj \ $(OBJS)\wxscintilla_Decoration.obj \
$(OBJS)\wxscintilla_Document.obj \ $(OBJS)\wxscintilla_Document.obj \
$(OBJS)\wxscintilla_EditModel.obj \
$(OBJS)\wxscintilla_EditView.obj \
$(OBJS)\wxscintilla_Editor.obj \ $(OBJS)\wxscintilla_Editor.obj \
$(OBJS)\wxscintilla_ExternalLexer.obj \ $(OBJS)\wxscintilla_ExternalLexer.obj \
$(OBJS)\wxscintilla_Indicator.obj \ $(OBJS)\wxscintilla_Indicator.obj \
$(OBJS)\wxscintilla_KeyMap.obj \ $(OBJS)\wxscintilla_KeyMap.obj \
$(OBJS)\wxscintilla_LineMarker.obj \ $(OBJS)\wxscintilla_LineMarker.obj \
$(OBJS)\wxscintilla_MarginView.obj \
$(OBJS)\wxscintilla_PerLine.obj \ $(OBJS)\wxscintilla_PerLine.obj \
$(OBJS)\wxscintilla_PositionCache.obj \ $(OBJS)\wxscintilla_PositionCache.obj \
$(OBJS)\wxscintilla_RESearch.obj \ $(OBJS)\wxscintilla_RESearch.obj \
@@ -6633,6 +6640,9 @@ $(OBJS)\wxscintilla_LexBash.obj: ..\..\src\stc\scintilla\lexers\LexBash.cxx
$(OBJS)\wxscintilla_LexBasic.obj: ..\..\src\stc\scintilla\lexers\LexBasic.cxx $(OBJS)\wxscintilla_LexBasic.obj: ..\..\src\stc\scintilla\lexers\LexBasic.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBasic.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBasic.cxx
$(OBJS)\wxscintilla_LexBibTeX.obj: ..\..\src\stc\scintilla\lexers\LexBibTeX.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBibTeX.cxx
$(OBJS)\wxscintilla_LexBullant.obj: ..\..\src\stc\scintilla\lexers\LexBullant.cxx $(OBJS)\wxscintilla_LexBullant.obj: ..\..\src\stc\scintilla\lexers\LexBullant.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBullant.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexBullant.cxx
@@ -6672,6 +6682,9 @@ $(OBJS)\wxscintilla_LexD.obj: ..\..\src\stc\scintilla\lexers\LexD.cxx
$(OBJS)\wxscintilla_LexDMAP.obj: ..\..\src\stc\scintilla\lexers\LexDMAP.cxx $(OBJS)\wxscintilla_LexDMAP.obj: ..\..\src\stc\scintilla\lexers\LexDMAP.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMAP.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMAP.cxx
$(OBJS)\wxscintilla_LexDMIS.obj: ..\..\src\stc\scintilla\lexers\LexDMIS.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMIS.cxx
$(OBJS)\wxscintilla_LexECL.obj: ..\..\src\stc\scintilla\lexers\LexECL.cxx $(OBJS)\wxscintilla_LexECL.obj: ..\..\src\stc\scintilla\lexers\LexECL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexECL.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexECL.cxx
@@ -6702,6 +6715,9 @@ $(OBJS)\wxscintilla_LexGui4Cli.obj: ..\..\src\stc\scintilla\lexers\LexGui4Cli.cx
$(OBJS)\wxscintilla_LexHaskell.obj: ..\..\src\stc\scintilla\lexers\LexHaskell.cxx $(OBJS)\wxscintilla_LexHaskell.obj: ..\..\src\stc\scintilla\lexers\LexHaskell.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHaskell.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHaskell.cxx
$(OBJS)\wxscintilla_LexHex.obj: ..\..\src\stc\scintilla\lexers\LexHex.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHex.cxx
$(OBJS)\wxscintilla_LexHTML.obj: ..\..\src\stc\scintilla\lexers\LexHTML.cxx $(OBJS)\wxscintilla_LexHTML.obj: ..\..\src\stc\scintilla\lexers\LexHTML.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHTML.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexHTML.cxx
@@ -6807,6 +6823,9 @@ $(OBJS)\wxscintilla_LexR.obj: ..\..\src\stc\scintilla\lexers\LexR.cxx
$(OBJS)\wxscintilla_LexRebol.obj: ..\..\src\stc\scintilla\lexers\LexRebol.cxx $(OBJS)\wxscintilla_LexRebol.obj: ..\..\src\stc\scintilla\lexers\LexRebol.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRebol.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRebol.cxx
$(OBJS)\wxscintilla_LexRegistry.obj: ..\..\src\stc\scintilla\lexers\LexRegistry.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRegistry.cxx
$(OBJS)\wxscintilla_LexRuby.obj: ..\..\src\stc\scintilla\lexers\LexRuby.cxx $(OBJS)\wxscintilla_LexRuby.obj: ..\..\src\stc\scintilla\lexers\LexRuby.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRuby.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRuby.cxx
@@ -6933,6 +6952,12 @@ $(OBJS)\wxscintilla_Decoration.obj: ..\..\src\stc\scintilla\src\Decoration.cxx
$(OBJS)\wxscintilla_Document.obj: ..\..\src\stc\scintilla\src\Document.cxx $(OBJS)\wxscintilla_Document.obj: ..\..\src\stc\scintilla\src\Document.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Document.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Document.cxx
$(OBJS)\wxscintilla_EditModel.obj: ..\..\src\stc\scintilla\src\EditModel.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\EditModel.cxx
$(OBJS)\wxscintilla_EditView.obj: ..\..\src\stc\scintilla\src\EditView.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\EditView.cxx
$(OBJS)\wxscintilla_Editor.obj: ..\..\src\stc\scintilla\src\Editor.cxx $(OBJS)\wxscintilla_Editor.obj: ..\..\src\stc\scintilla\src\Editor.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Editor.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Editor.cxx
@@ -6948,6 +6973,9 @@ $(OBJS)\wxscintilla_KeyMap.obj: ..\..\src\stc\scintilla\src\KeyMap.cxx
$(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx $(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LineMarker.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LineMarker.cxx
$(OBJS)\wxscintilla_MarginView.obj: ..\..\src\stc\scintilla\src\MarginView.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\MarginView.cxx
$(OBJS)\wxscintilla_PerLine.obj: ..\..\src\stc\scintilla\src\PerLine.cxx $(OBJS)\wxscintilla_PerLine.obj: ..\..\src\stc\scintilla\src\PerLine.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PerLine.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PerLine.cxx

View File

@@ -286,6 +286,12 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\Document.cxx"> RelativePath="..\..\src\stc\scintilla\src\Document.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\EditModel.cxx">
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\EditView.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\Editor.cxx"> RelativePath="..\..\src\stc\scintilla\src\Editor.cxx">
</File> </File>
@@ -337,6 +343,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx"> RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx"> RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx">
</File> </File>
@@ -376,6 +385,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx"> RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx"> RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx">
</File> </File>
@@ -409,6 +421,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx"> RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexHex.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx"> RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx">
</File> </File>
@@ -511,6 +526,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx"> RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexRegistry.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx"> RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx">
</File> </File>
@@ -592,6 +610,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx"> RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\MarginView.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx"> RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx">
</File> </File>

View File

@@ -730,6 +730,14 @@
RelativePath="..\..\src\stc\scintilla\src\Document.cxx" RelativePath="..\..\src\stc\scintilla\src\Document.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\EditModel.cxx"
>
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\EditView.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\Editor.cxx" RelativePath="..\..\src\stc\scintilla\src\Editor.cxx"
> >
@@ -798,6 +806,10 @@
RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx"
> >
@@ -850,6 +862,10 @@
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx"
> >
@@ -894,6 +910,10 @@
RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexHex.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx"
> >
@@ -1030,6 +1050,10 @@
RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexRegistry.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx"
> >
@@ -1138,6 +1162,10 @@
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx" RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\MarginView.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx" RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx"
> >

View File

@@ -726,6 +726,14 @@
RelativePath="..\..\src\stc\scintilla\src\Document.cxx" RelativePath="..\..\src\stc\scintilla\src\Document.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\EditModel.cxx"
>
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\EditView.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\Editor.cxx" RelativePath="..\..\src\stc\scintilla\src\Editor.cxx"
> >
@@ -794,6 +802,10 @@
RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx"
> >
@@ -846,6 +858,10 @@
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx"
> >
@@ -890,6 +906,10 @@
RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexHex.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx"
> >
@@ -1026,6 +1046,10 @@
RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\lexers\LexRegistry.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx" RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx"
> >
@@ -1134,6 +1158,10 @@
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx" RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\MarginView.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx" RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx"
> >

View File

@@ -415,6 +415,8 @@
<ClCompile Include="..\..\src\stc\scintilla\src\ContractionState.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\ContractionState.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\Decoration.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\Decoration.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\Document.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\Document.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\EditModel.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\EditView.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\Editor.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\Editor.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\ExternalLexer.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\ExternalLexer.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\Indicator.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\Indicator.cxx" />
@@ -432,6 +434,7 @@
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBaan.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexBaan.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBash.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexBash.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBasic.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexBasic.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBullant.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexBullant.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexCLW.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexCLW.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexCOBOL.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexCOBOL.cxx" />
@@ -445,6 +448,7 @@
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexCsound.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexCsound.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexD.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexD.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexDMAP.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexDMAP.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexDMIS.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexECL.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexECL.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexEScript.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexEScript.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexEiffel.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexEiffel.cxx" />
@@ -456,6 +460,7 @@
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexGui4Cli.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexGui4Cli.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexHTML.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexHTML.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexHaskell.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexHaskell.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexHex.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexInno.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexInno.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexKix.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexKix.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexKVIrc.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexKVIrc.cxx" />
@@ -490,6 +495,7 @@
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexPython.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexPython.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexR.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexR.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRebol.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexRebol.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRegistry.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRuby.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexRuby.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRust.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexRust.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexSML.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexSML.cxx" />
@@ -517,6 +523,7 @@
<ClCompile Include="..\..\src\stc\scintilla\lexlib\LexerNoExceptions.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexlib\LexerNoExceptions.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexlib\LexerSimple.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexlib\LexerSimple.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\LineMarker.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\LineMarker.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\MarginView.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\PerLine.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\PerLine.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\src\PositionCache.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\src\PositionCache.cxx" />
<ClCompile Include="..\..\src\stc\scintilla\lexlib\PropSetSimple.cxx" /> <ClCompile Include="..\..\src\stc\scintilla\lexlib\PropSetSimple.cxx" />

View File

@@ -50,6 +50,12 @@
<ClCompile Include="..\..\src\stc\scintilla\src\Document.cxx"> <ClCompile Include="..\..\src\stc\scintilla\src\Document.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\src\EditModel.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\src\EditView.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\src\Editor.cxx"> <ClCompile Include="..\..\src\stc\scintilla\src\Editor.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@@ -101,6 +107,9 @@
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBasic.cxx"> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexBasic.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBullant.cxx"> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexBullant.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@@ -140,6 +149,9 @@
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexDMAP.cxx"> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexDMAP.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexDMIS.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexECL.cxx"> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexECL.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@@ -173,6 +185,9 @@
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexHaskell.cxx"> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexHaskell.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexHex.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexInno.cxx"> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexInno.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@@ -275,6 +290,9 @@
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRebol.cxx"> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexRebol.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRegistry.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRuby.cxx"> <ClCompile Include="..\..\src\stc\scintilla\lexers\LexRuby.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@@ -356,6 +374,9 @@
<ClCompile Include="..\..\src\stc\scintilla\src\LineMarker.cxx"> <ClCompile Include="..\..\src\stc\scintilla\src\LineMarker.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\src\MarginView.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\stc\scintilla\src\PerLine.cxx"> <ClCompile Include="..\..\src\stc\scintilla\src\PerLine.cxx">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

View File

@@ -98,7 +98,7 @@ All (GUI):
- Optimized wxRTC insertion and deletion when floating objects are present. - Optimized wxRTC insertion and deletion when floating objects are present.
- Added on-demand image loading option to wxRTC. - Added on-demand image loading option to wxRTC.
- Add wxFont::GetBaseFont() (Melroy Tellis). - Add wxFont::GetBaseFont() (Melroy Tellis).
- Update included Scintilla to version 3.4.1 (Christian Walther, Heyoupeng). - Update Scintilla to v3.5.5 (Christian Walther, Heyoupeng, ARATA Mizuki).
- Add wxStyledTextCtrl copy/paste text events (Christian Walther). - Add wxStyledTextCtrl copy/paste text events (Christian Walther).
- Improve RTL support in wxStyledTextCtrl (Zane U. Ji). - Improve RTL support in wxStyledTextCtrl (Zane U. Ji).
- Add support for loading old V1 BMP files to wxImage (Artur Wieczorek). - Add support for loading old V1 BMP files to wxImage (Artur Wieczorek).

View File

@@ -75,6 +75,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
/// The SC_CP_UTF8 value can be used to enter Unicode mode. /// The SC_CP_UTF8 value can be used to enter Unicode mode.
/// This is the same value as CP_UTF8 in Windows /// This is the same value as CP_UTF8 in Windows
#define wxSTC_CP_UTF8 65001 #define wxSTC_CP_UTF8 65001
#define wxSTC_IME_WINDOWED 0
#define wxSTC_IME_INLINE 1
#define wxSTC_MARKER_MAX 31 #define wxSTC_MARKER_MAX 31
#define wxSTC_MARK_CIRCLE 0 #define wxSTC_MARK_CIRCLE 0
#define wxSTC_MARK_ROUNDRECT 1 #define wxSTC_MARK_ROUNDRECT 1
@@ -190,12 +192,20 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_INDIC_DOTBOX 12 #define wxSTC_INDIC_DOTBOX 12
#define wxSTC_INDIC_SQUIGGLEPIXMAP 13 #define wxSTC_INDIC_SQUIGGLEPIXMAP 13
#define wxSTC_INDIC_COMPOSITIONTHICK 14 #define wxSTC_INDIC_COMPOSITIONTHICK 14
#define wxSTC_INDIC_MAX 31 #define wxSTC_INDIC_COMPOSITIONTHIN 15
#define wxSTC_INDIC_FULLBOX 16
#define wxSTC_INDIC_TEXTFORE 17
#define wxSTC_INDIC_IME 32
#define wxSTC_INDIC_IME_MAX 35
#define wxSTC_INDIC_MAX 35
#define wxSTC_INDIC_CONTAINER 8 #define wxSTC_INDIC_CONTAINER 8
#define wxSTC_INDIC0_MASK 0x20 #define wxSTC_INDIC0_MASK 0x20
#define wxSTC_INDIC1_MASK 0x40 #define wxSTC_INDIC1_MASK 0x40
#define wxSTC_INDIC2_MASK 0x80 #define wxSTC_INDIC2_MASK 0x80
#define wxSTC_INDICS_MASK 0xE0 #define wxSTC_INDICS_MASK 0xE0
#define wxSTC_INDICVALUEBIT 0x1000000
#define wxSTC_INDICVALUEMASK 0xFFFFFF
#define wxSTC_INDICFLAG_VALUEFORE 1
#define wxSTC_IV_NONE 0 #define wxSTC_IV_NONE 0
#define wxSTC_IV_REAL 1 #define wxSTC_IV_REAL 1
#define wxSTC_IV_LOOKFORWARD 2 #define wxSTC_IV_LOOKFORWARD 2
@@ -220,6 +230,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_FIND_WORDSTART 0x00100000 #define wxSTC_FIND_WORDSTART 0x00100000
#define wxSTC_FIND_REGEXP 0x00200000 #define wxSTC_FIND_REGEXP 0x00200000
#define wxSTC_FIND_POSIX 0x00400000 #define wxSTC_FIND_POSIX 0x00400000
#define wxSTC_FIND_CXX11REGEX 0x00800000
#define wxSTC_FOLDLEVELBASE 0x400 #define wxSTC_FOLDLEVELBASE 0x400
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000 #define wxSTC_FOLDLEVELWHITEFLAG 0x1000
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000 #define wxSTC_FOLDLEVELHEADERFLAG 0x2000
@@ -235,6 +246,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040 #define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
#define wxSTC_FOLDFLAG_LINESTATE 0x0080
#define wxSTC_TIME_FOREVER 10000000 #define wxSTC_TIME_FOREVER 10000000
#define wxSTC_WRAP_NONE 0 #define wxSTC_WRAP_NONE 0
#define wxSTC_WRAP_WORD 1 #define wxSTC_WRAP_WORD 1
@@ -254,6 +266,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_CACHE_CARET 1 #define wxSTC_CACHE_CARET 1
#define wxSTC_CACHE_PAGE 2 #define wxSTC_CACHE_PAGE 2
#define wxSTC_CACHE_DOCUMENT 3 #define wxSTC_CACHE_DOCUMENT 3
#define wxSTC_PHASES_ONE 0
#define wxSTC_PHASES_TWO 1
#define wxSTC_PHASES_MULTIPLE 2
/// Control font anti-aliasing. /// Control font anti-aliasing.
#define wxSTC_EFF_QUALITY_MASK 0xF #define wxSTC_EFF_QUALITY_MASK 0xF
@@ -269,6 +284,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_STATUS_OK 0 #define wxSTC_STATUS_OK 0
#define wxSTC_STATUS_FAILURE 1 #define wxSTC_STATUS_FAILURE 1
#define wxSTC_STATUS_BADALLOC 2 #define wxSTC_STATUS_BADALLOC 2
#define wxSTC_STATUS_WARN_START 1000
#define wxSTC_STATUS_WARN_REGEX 1001
#define wxSTC_CURSORNORMAL -1 #define wxSTC_CURSORNORMAL -1
#define wxSTC_CURSORARROW 2 #define wxSTC_CURSORARROW 2
#define wxSTC_CURSORWAIT 4 #define wxSTC_CURSORWAIT 4
@@ -309,6 +326,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_SEL_THIN 3 #define wxSTC_SEL_THIN 3
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0 #define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 #define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
#define wxSTC_MULTIAUTOC_ONCE 0
#define wxSTC_MULTIAUTOC_EACH 1
#define wxSTC_ORDER_PRESORTED 0 #define wxSTC_ORDER_PRESORTED 0
#define wxSTC_ORDER_PERFORMSORT 1 #define wxSTC_ORDER_PERFORMSORT 1
#define wxSTC_ORDER_CUSTOM 2 #define wxSTC_ORDER_CUSTOM 2
@@ -326,12 +345,15 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_ANNOTATION_HIDDEN 0 #define wxSTC_ANNOTATION_HIDDEN 0
#define wxSTC_ANNOTATION_STANDARD 1 #define wxSTC_ANNOTATION_STANDARD 1
#define wxSTC_ANNOTATION_BOXED 2 #define wxSTC_ANNOTATION_BOXED 2
#define wxSTC_ANNOTATION_INDENTED 3
#define wxSTC_UNDO_MAY_COALESCE 1 #define wxSTC_UNDO_MAY_COALESCE 1
#define wxSTC_SCVS_NONE 0 #define wxSTC_SCVS_NONE 0
#define wxSTC_SCVS_RECTANGULARSELECTION 1 #define wxSTC_SCVS_RECTANGULARSELECTION 1
#define wxSTC_SCVS_USERACCESSIBLE 2 #define wxSTC_SCVS_USERACCESSIBLE 2
#define wxSTC_TECHNOLOGY_DEFAULT 0 #define wxSTC_TECHNOLOGY_DEFAULT 0
#define wxSTC_TECHNOLOGY_DIRECTWRITE 1 #define wxSTC_TECHNOLOGY_DIRECTWRITE 1
#define wxSTC_TECHNOLOGY_DIRECTWRITERETAIN 2
#define wxSTC_TECHNOLOGY_DIRECTWRITEDC 3
/// Line end types which may be used in addition to LF, CR, and CRLF /// Line end types which may be used in addition to LF, CR, and CRLF
/// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, /// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator,
@@ -369,7 +391,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_MOD_CHANGEANNOTATION 0x20000 #define wxSTC_MOD_CHANGEANNOTATION 0x20000
#define wxSTC_MOD_CONTAINER 0x40000 #define wxSTC_MOD_CONTAINER 0x40000
#define wxSTC_MOD_LEXERSTATE 0x80000 #define wxSTC_MOD_LEXERSTATE 0x80000
#define wxSTC_MODEVENTMASKALL 0xFFFFF #define wxSTC_MOD_INSERTCHECK 0x100000
#define wxSTC_MOD_CHANGETABSTOPS 0x200000
#define wxSTC_MODEVENTMASKALL 0x3FFFFF
#define wxSTC_UPDATE_CONTENT 0x1 #define wxSTC_UPDATE_CONTENT 0x1
#define wxSTC_UPDATE_SELECTION 0x2 #define wxSTC_UPDATE_SELECTION 0x2
#define wxSTC_UPDATE_V_SCROLL 0x4 #define wxSTC_UPDATE_V_SCROLL 0x4
@@ -518,6 +542,12 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_LEX_RUST 111 #define wxSTC_LEX_RUST 111
#define wxSTC_LEX_DMAP 112 #define wxSTC_LEX_DMAP 112
#define wxSTC_LEX_AS 113 #define wxSTC_LEX_AS 113
#define wxSTC_LEX_DMIS 114
#define wxSTC_LEX_REGISTRY 115
#define wxSTC_LEX_BIBTEX 116
#define wxSTC_LEX_SREC 117
#define wxSTC_LEX_IHEX 118
#define wxSTC_LEX_TEHEX 119
/// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a /// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
/// value assigned in sequence from SCLEX_AUTOMATIC+1. /// value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -568,6 +598,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_C_PREPROCESSORCOMMENT 23 #define wxSTC_C_PREPROCESSORCOMMENT 23
#define wxSTC_C_PREPROCESSORCOMMENTDOC 24 #define wxSTC_C_PREPROCESSORCOMMENTDOC 24
#define wxSTC_C_USERLITERAL 25 #define wxSTC_C_USERLITERAL 25
#define wxSTC_C_TASKMARKER 26
#define wxSTC_C_ESCAPESEQUENCE 27
/// Lexical states for SCLEX_D /// Lexical states for SCLEX_D
#define wxSTC_D_DEFAULT 0 #define wxSTC_D_DEFAULT 0
@@ -1399,6 +1431,11 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_V_IDENTIFIER 11 #define wxSTC_V_IDENTIFIER 11
#define wxSTC_V_STRINGEOL 12 #define wxSTC_V_STRINGEOL 12
#define wxSTC_V_USER 19 #define wxSTC_V_USER 19
#define wxSTC_V_COMMENT_WORD 20
#define wxSTC_V_INPUT 21
#define wxSTC_V_OUTPUT 22
#define wxSTC_V_INOUT 23
#define wxSTC_V_PORT_CONNECT 24
/// Lexical states for SCLEX_KIX /// Lexical states for SCLEX_KIX
#define wxSTC_KIX_DEFAULT 0 #define wxSTC_KIX_DEFAULT 0
@@ -1411,6 +1448,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_KIX_KEYWORD 7 #define wxSTC_KIX_KEYWORD 7
#define wxSTC_KIX_FUNCTIONS 8 #define wxSTC_KIX_FUNCTIONS 8
#define wxSTC_KIX_OPERATOR 9 #define wxSTC_KIX_OPERATOR 9
#define wxSTC_KIX_COMMENTSTREAM 10
#define wxSTC_KIX_IDENTIFIER 31 #define wxSTC_KIX_IDENTIFIER 31
/// Lexical states for SCLEX_GUI4CLI /// Lexical states for SCLEX_GUI4CLI
@@ -1521,6 +1559,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_VHDL_STDPACKAGE 12 #define wxSTC_VHDL_STDPACKAGE 12
#define wxSTC_VHDL_STDTYPE 13 #define wxSTC_VHDL_STDTYPE 13
#define wxSTC_VHDL_USERWORD 14 #define wxSTC_VHDL_USERWORD 14
#define wxSTC_VHDL_BLOCK_COMMENT 15
/// Lexical states for SCLEX_CAML /// Lexical states for SCLEX_CAML
#define wxSTC_CAML_DEFAULT 0 #define wxSTC_CAML_DEFAULT 0
@@ -1642,6 +1681,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_SQL_USER3 21 #define wxSTC_SQL_USER3 21
#define wxSTC_SQL_USER4 22 #define wxSTC_SQL_USER4 22
#define wxSTC_SQL_QUOTEDIDENTIFIER 23 #define wxSTC_SQL_QUOTEDIDENTIFIER 23
#define wxSTC_SQL_QOPERATOR 24
/// Lexical states for SCLEX_SMALLTALK /// Lexical states for SCLEX_SMALLTALK
#define wxSTC_ST_DEFAULT 0 #define wxSTC_ST_DEFAULT 0
@@ -2287,6 +2327,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_RUST_LIFETIME 18 #define wxSTC_RUST_LIFETIME 18
#define wxSTC_RUST_MACRO 19 #define wxSTC_RUST_MACRO 19
#define wxSTC_RUST_LEXERROR 20 #define wxSTC_RUST_LEXERROR 20
#define wxSTC_RUST_BYTESTRING 21
#define wxSTC_RUST_BYTESTRINGR 22
#define wxSTC_RUST_BYTECHARACTER 23
/// Lexical states for SCLEX_DMAP /// Lexical states for SCLEX_DMAP
#define wxSTC_DMAP_DEFAULT 0 #define wxSTC_DMAP_DEFAULT 0
@@ -2301,6 +2344,63 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_DMAP_WORD2 9 #define wxSTC_DMAP_WORD2 9
#define wxSTC_DMAP_WORD3 10 #define wxSTC_DMAP_WORD3 10
/// Lexical states for SCLEX_DMIS
#define wxSTC_DMIS_DEFAULT 0
#define wxSTC_DMIS_COMMENT 1
#define wxSTC_DMIS_STRING 2
#define wxSTC_DMIS_NUMBER 3
#define wxSTC_DMIS_KEYWORD 4
#define wxSTC_DMIS_MAJORWORD 5
#define wxSTC_DMIS_MINORWORD 6
#define wxSTC_DMIS_UNSUPPORTED_MAJOR 7
#define wxSTC_DMIS_UNSUPPORTED_MINOR 8
#define wxSTC_DMIS_LABEL 9
/// Lexical states for SCLEX_REGISTRY
#define wxSTC_REG_DEFAULT 0
#define wxSTC_REG_COMMENT 1
#define wxSTC_REG_VALUENAME 2
#define wxSTC_REG_STRING 3
#define wxSTC_REG_HEXDIGIT 4
#define wxSTC_REG_VALUETYPE 5
#define wxSTC_REG_ADDEDKEY 6
#define wxSTC_REG_DELETEDKEY 7
#define wxSTC_REG_ESCAPED 8
#define wxSTC_REG_KEYPATH_GUID 9
#define wxSTC_REG_STRING_GUID 10
#define wxSTC_REG_PARAMETER 11
#define wxSTC_REG_OPERATOR 12
/// Lexical state for SCLEX_BIBTEX
#define wxSTC_BIBTEX_DEFAULT 0
#define wxSTC_BIBTEX_ENTRY 1
#define wxSTC_BIBTEX_UNKNOWN_ENTRY 2
#define wxSTC_BIBTEX_KEY 3
#define wxSTC_BIBTEX_PARAMETER 4
#define wxSTC_BIBTEX_VALUE 5
#define wxSTC_BIBTEX_COMMENT 6
/// Lexical state for SCLEX_SREC
#define wxSTC_HEX_DEFAULT 0
#define wxSTC_HEX_RECSTART 1
#define wxSTC_HEX_RECTYPE 2
#define wxSTC_HEX_RECTYPE_UNKNOWN 3
#define wxSTC_HEX_BYTECOUNT 4
#define wxSTC_HEX_BYTECOUNT_WRONG 5
#define wxSTC_HEX_NOADDRESS 6
#define wxSTC_HEX_DATAADDRESS 7
#define wxSTC_HEX_RECCOUNT 8
#define wxSTC_HEX_STARTADDRESS 9
#define wxSTC_HEX_ADDRESSFIELD_UNKNOWN 10
#define wxSTC_HEX_EXTENDEDADDRESS 11
#define wxSTC_HEX_DATA_ODD 12
#define wxSTC_HEX_DATA_EVEN 13
#define wxSTC_HEX_DATA_UNKNOWN 14
#define wxSTC_HEX_DATA_EMPTY 15
#define wxSTC_HEX_CHECKSUM 16
#define wxSTC_HEX_CHECKSUM_WRONG 17
#define wxSTC_HEX_GARBAGE 18
//}}} //}}}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -2666,6 +2766,9 @@ public:
// Insert string at a position. // Insert string at a position.
void InsertText(int pos, const wxString& text); void InsertText(int pos, const wxString& text);
// Change the text that is being inserted in response to SC_MOD_INSERTCHECK
void ChangeInsertion(int length, const wxString& text);
// Delete all text in the document. // Delete all text in the document.
void ClearAll(); void ClearAll();
@@ -2745,6 +2848,7 @@ public:
// Retrieve the text of the line containing the caret. // Retrieve the text of the line containing the caret.
// Returns the index of the caret on the line. // Returns the index of the caret on the line.
// Result is NUL-terminated.
#ifdef SWIG #ifdef SWIG
wxString GetCurLine(int* OUTPUT); wxString GetCurLine(int* OUTPUT);
#else #else
@@ -2784,9 +2888,24 @@ public:
// Retrieve the visible size of a tab. // Retrieve the visible size of a tab.
int GetTabWidth() const; int GetTabWidth() const;
// Clear explicit tabstops on a line.
void ClearTabStops(int line);
// Add an explicit tab stop for a line.
void AddTabStop(int line, int x);
// Find the next explicit tab stop position on a line after a position.
int GetNextTabStop(int line, int x);
// Set the code page used to interpret the bytes of the document as characters. // Set the code page used to interpret the bytes of the document as characters.
void SetCodePage(int codePage); void SetCodePage(int codePage);
// Is the IME displayed in a winow or inline?
int GetIMEInteraction() const;
// Choose to display the the IME in a winow or inline.
void SetIMEInteraction(int imeInteraction);
// Set the symbol used for a particular marker number, // Set the symbol used for a particular marker number,
// and optionally the fore and background colours. // and optionally the fore and background colours.
void MarkerDefine(int markerNumber, int markerSymbol, void MarkerDefine(int markerNumber, int markerSymbol,
@@ -3025,6 +3144,24 @@ public:
// Retrieve whether indicator drawn under or over text. // Retrieve whether indicator drawn under or over text.
bool IndicatorGetUnder(int indic) const; bool IndicatorGetUnder(int indic) const;
// Set a hover indicator to plain, squiggle or TT.
void IndicatorSetHoverStyle(int indic, int style);
// Retrieve the hover style of an indicator.
int IndicatorGetHoverStyle(int indic) const;
// Set the foreground hover colour of an indicator.
void IndicatorSetHoverForeground(int indic, const wxColour& fore);
// Retrieve the foreground hover colour of an indicator.
wxColour IndicatorGetHoverForeground(int indic) const;
// Set the attributes of an indicator.
void IndicatorSetFlags(int indic, int flags);
// Retrieve the attributes of an indicator.
int IndicatorGetFlags(int indic) const;
// Set the foreground colour of all whitespace and whether to use this setting. // Set the foreground colour of all whitespace and whether to use this setting.
void SetWhitespaceForeground(bool useSetting, const wxColour& fore); void SetWhitespaceForeground(bool useSetting, const wxColour& fore);
@@ -3383,6 +3520,12 @@ public:
// Get the position that ends the target. // Get the position that ends the target.
int GetTargetEnd() const; int GetTargetEnd() const;
// Sets both the start and end of the target in one call.
void SetTargetRange(int start, int end);
// Retrieve the text in the target.
wxString GetTargetText() const;
// Replace the target text with the argument text. // Replace the target text with the argument text.
// Text is counted so it can contain NULs. // Text is counted so it can contain NULs.
// Returns the length of the replacement text. // Returns the length of the replacement text.
@@ -3610,13 +3753,22 @@ public:
// Append a string to the end of the document without changing the selection. // Append a string to the end of the document without changing the selection.
void AppendText(const wxString& text); void AppendText(const wxString& text);
// Is drawing done in two phases with backgrounds drawn before faoregrounds? // Is drawing done in two phases with backgrounds drawn before foregrounds?
bool GetTwoPhaseDraw() const; bool GetTwoPhaseDraw() const;
// In twoPhaseDraw mode, drawing is performed in two phases, first the background // In twoPhaseDraw mode, drawing is performed in two phases, first the background
// and then the foreground. This avoids chopping off characters that overlap the next run. // and then the foreground. This avoids chopping off characters that overlap the next run.
void SetTwoPhaseDraw(bool twoPhase); void SetTwoPhaseDraw(bool twoPhase);
// How many phases is drawing done in?
int GetPhasesDraw() const;
// In one phase draw, text is drawn in a series of rectangular blocks with no overlap.
// In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally.
// In multiple phase draw, each element is drawn over the whole drawing area, allowing text
// to overlap from one line to the next.
void SetPhasesDraw(int phases);
// Scroll so that a display line is at the top of the display. // Scroll so that a display line is at the top of the display.
void SetFirstVisibleLine(int lineDisplay); void SetFirstVisibleLine(int lineDisplay);
@@ -3627,6 +3779,7 @@ public:
int GetMultiPaste() const; int GetMultiPaste() const;
// Retrieve the value of a tag from a regular expression search. // Retrieve the value of a tag from a regular expression search.
// Result is NUL-terminated.
wxString GetTag(int tagNumber) const; wxString GetTag(int tagNumber) const;
// Make the target range start and end be the same as the selection range start and end. // Make the target range start and end be the same as the selection range start and end.
@@ -4129,6 +4282,12 @@ public:
// Get auto-completion case insensitive behaviour. // Get auto-completion case insensitive behaviour.
int AutoCompGetCaseInsensitiveBehaviour() const; int AutoCompGetCaseInsensitiveBehaviour() const;
// Change the effect of autocompleting when there are multiple selections.
void AutoCompSetMulti(int multi);
// Retrieve the effect of autocompleting when there are multiple selections..
int AutoCompGetMulti() const;
// Set the way autocompletion lists are ordered. // Set the way autocompletion lists are ordered.
void AutoCompSetOrder(int order); void AutoCompSetOrder(int order);
@@ -4224,12 +4383,6 @@ public:
// the range of a call to GetRangePointer. // the range of a call to GetRangePointer.
int GetGapPosition() const; int GetGapPosition() const;
// Always interpret keyboard input as Unicode
void SetKeysUnicode(bool keysUnicode);
// Are keys always interpreted as Unicode?
bool GetKeysUnicode() const;
// Set the alpha fill colour of the given indicator. // Set the alpha fill colour of the given indicator.
void IndicatorSetAlpha(int indicator, int alpha); void IndicatorSetAlpha(int indicator, int alpha);
@@ -4539,6 +4692,7 @@ public:
void SetRepresentation(const wxString& encodedCharacter, const wxString& representation); void SetRepresentation(const wxString& encodedCharacter, const wxString& representation);
// Set the way a character is drawn. // Set the way a character is drawn.
// Result is NUL-terminated.
wxString GetRepresentation(const wxString& encodedCharacter) const; wxString GetRepresentation(const wxString& encodedCharacter) const;
// Remove a character representation. // Remove a character representation.
@@ -4586,15 +4740,18 @@ public:
void* PrivateLexerCall(int operation, void* pointer); void* PrivateLexerCall(int operation, void* pointer);
// Retrieve a '\n' separated list of properties understood by the current lexer. // Retrieve a '\n' separated list of properties understood by the current lexer.
// Result is NUL-terminated.
wxString PropertyNames() const; wxString PropertyNames() const;
// Retrieve the type of a property. // Retrieve the type of a property.
int PropertyType(const wxString& name); int PropertyType(const wxString& name);
// Describe a property. // Describe a property.
// Result is NUL-terminated.
wxString DescribeProperty(const wxString& name) const; wxString DescribeProperty(const wxString& name) const;
// Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. // Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
// Result is NUL-terminated.
wxString DescribeKeyWordSets() const; wxString DescribeKeyWordSets() const;
// Bit set of LineEndType enumertion for which line ends beyond the standard // Bit set of LineEndType enumertion for which line ends beyond the standard
@@ -4627,6 +4784,7 @@ public:
int DistanceToSecondaryStyles() const; int DistanceToSecondaryStyles() const;
// Get the set of base styles that can be extended with sub styles // Get the set of base styles that can be extended with sub styles
// Result is NUL-terminated.
wxString GetSubStyleBases() const; wxString GetSubStyleBases() const;
//}}} //}}}

View File

@@ -31,6 +31,8 @@
/// The SC_CP_UTF8 value can be used to enter Unicode mode. /// The SC_CP_UTF8 value can be used to enter Unicode mode.
/// This is the same value as CP_UTF8 in Windows /// This is the same value as CP_UTF8 in Windows
#define wxSTC_CP_UTF8 65001 #define wxSTC_CP_UTF8 65001
#define wxSTC_IME_WINDOWED 0
#define wxSTC_IME_INLINE 1
#define wxSTC_MARKER_MAX 31 #define wxSTC_MARKER_MAX 31
#define wxSTC_MARK_CIRCLE 0 #define wxSTC_MARK_CIRCLE 0
#define wxSTC_MARK_ROUNDRECT 1 #define wxSTC_MARK_ROUNDRECT 1
@@ -146,12 +148,20 @@
#define wxSTC_INDIC_DOTBOX 12 #define wxSTC_INDIC_DOTBOX 12
#define wxSTC_INDIC_SQUIGGLEPIXMAP 13 #define wxSTC_INDIC_SQUIGGLEPIXMAP 13
#define wxSTC_INDIC_COMPOSITIONTHICK 14 #define wxSTC_INDIC_COMPOSITIONTHICK 14
#define wxSTC_INDIC_MAX 31 #define wxSTC_INDIC_COMPOSITIONTHIN 15
#define wxSTC_INDIC_FULLBOX 16
#define wxSTC_INDIC_TEXTFORE 17
#define wxSTC_INDIC_IME 32
#define wxSTC_INDIC_IME_MAX 35
#define wxSTC_INDIC_MAX 35
#define wxSTC_INDIC_CONTAINER 8 #define wxSTC_INDIC_CONTAINER 8
#define wxSTC_INDIC0_MASK 0x20 #define wxSTC_INDIC0_MASK 0x20
#define wxSTC_INDIC1_MASK 0x40 #define wxSTC_INDIC1_MASK 0x40
#define wxSTC_INDIC2_MASK 0x80 #define wxSTC_INDIC2_MASK 0x80
#define wxSTC_INDICS_MASK 0xE0 #define wxSTC_INDICS_MASK 0xE0
#define wxSTC_INDICVALUEBIT 0x1000000
#define wxSTC_INDICVALUEMASK 0xFFFFFF
#define wxSTC_INDICFLAG_VALUEFORE 1
#define wxSTC_IV_NONE 0 #define wxSTC_IV_NONE 0
#define wxSTC_IV_REAL 1 #define wxSTC_IV_REAL 1
#define wxSTC_IV_LOOKFORWARD 2 #define wxSTC_IV_LOOKFORWARD 2
@@ -176,6 +186,7 @@
#define wxSTC_FIND_WORDSTART 0x00100000 #define wxSTC_FIND_WORDSTART 0x00100000
#define wxSTC_FIND_REGEXP 0x00200000 #define wxSTC_FIND_REGEXP 0x00200000
#define wxSTC_FIND_POSIX 0x00400000 #define wxSTC_FIND_POSIX 0x00400000
#define wxSTC_FIND_CXX11REGEX 0x00800000
#define wxSTC_FOLDLEVELBASE 0x400 #define wxSTC_FOLDLEVELBASE 0x400
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000 #define wxSTC_FOLDLEVELWHITEFLAG 0x1000
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000 #define wxSTC_FOLDLEVELHEADERFLAG 0x2000
@@ -191,6 +202,7 @@
#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040 #define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
#define wxSTC_FOLDFLAG_LINESTATE 0x0080
#define wxSTC_TIME_FOREVER 10000000 #define wxSTC_TIME_FOREVER 10000000
#define wxSTC_WRAP_NONE 0 #define wxSTC_WRAP_NONE 0
#define wxSTC_WRAP_WORD 1 #define wxSTC_WRAP_WORD 1
@@ -210,6 +222,9 @@
#define wxSTC_CACHE_CARET 1 #define wxSTC_CACHE_CARET 1
#define wxSTC_CACHE_PAGE 2 #define wxSTC_CACHE_PAGE 2
#define wxSTC_CACHE_DOCUMENT 3 #define wxSTC_CACHE_DOCUMENT 3
#define wxSTC_PHASES_ONE 0
#define wxSTC_PHASES_TWO 1
#define wxSTC_PHASES_MULTIPLE 2
/// Control font anti-aliasing. /// Control font anti-aliasing.
#define wxSTC_EFF_QUALITY_MASK 0xF #define wxSTC_EFF_QUALITY_MASK 0xF
@@ -225,6 +240,8 @@
#define wxSTC_STATUS_OK 0 #define wxSTC_STATUS_OK 0
#define wxSTC_STATUS_FAILURE 1 #define wxSTC_STATUS_FAILURE 1
#define wxSTC_STATUS_BADALLOC 2 #define wxSTC_STATUS_BADALLOC 2
#define wxSTC_STATUS_WARN_START 1000
#define wxSTC_STATUS_WARN_REGEX 1001
#define wxSTC_CURSORNORMAL -1 #define wxSTC_CURSORNORMAL -1
#define wxSTC_CURSORARROW 2 #define wxSTC_CURSORARROW 2
#define wxSTC_CURSORWAIT 4 #define wxSTC_CURSORWAIT 4
@@ -265,6 +282,8 @@
#define wxSTC_SEL_THIN 3 #define wxSTC_SEL_THIN 3
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0 #define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 #define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
#define wxSTC_MULTIAUTOC_ONCE 0
#define wxSTC_MULTIAUTOC_EACH 1
#define wxSTC_ORDER_PRESORTED 0 #define wxSTC_ORDER_PRESORTED 0
#define wxSTC_ORDER_PERFORMSORT 1 #define wxSTC_ORDER_PERFORMSORT 1
#define wxSTC_ORDER_CUSTOM 2 #define wxSTC_ORDER_CUSTOM 2
@@ -282,12 +301,15 @@
#define wxSTC_ANNOTATION_HIDDEN 0 #define wxSTC_ANNOTATION_HIDDEN 0
#define wxSTC_ANNOTATION_STANDARD 1 #define wxSTC_ANNOTATION_STANDARD 1
#define wxSTC_ANNOTATION_BOXED 2 #define wxSTC_ANNOTATION_BOXED 2
#define wxSTC_ANNOTATION_INDENTED 3
#define wxSTC_UNDO_MAY_COALESCE 1 #define wxSTC_UNDO_MAY_COALESCE 1
#define wxSTC_SCVS_NONE 0 #define wxSTC_SCVS_NONE 0
#define wxSTC_SCVS_RECTANGULARSELECTION 1 #define wxSTC_SCVS_RECTANGULARSELECTION 1
#define wxSTC_SCVS_USERACCESSIBLE 2 #define wxSTC_SCVS_USERACCESSIBLE 2
#define wxSTC_TECHNOLOGY_DEFAULT 0 #define wxSTC_TECHNOLOGY_DEFAULT 0
#define wxSTC_TECHNOLOGY_DIRECTWRITE 1 #define wxSTC_TECHNOLOGY_DIRECTWRITE 1
#define wxSTC_TECHNOLOGY_DIRECTWRITERETAIN 2
#define wxSTC_TECHNOLOGY_DIRECTWRITEDC 3
/// Line end types which may be used in addition to LF, CR, and CRLF /// Line end types which may be used in addition to LF, CR, and CRLF
/// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, /// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator,
@@ -325,7 +347,9 @@
#define wxSTC_MOD_CHANGEANNOTATION 0x20000 #define wxSTC_MOD_CHANGEANNOTATION 0x20000
#define wxSTC_MOD_CONTAINER 0x40000 #define wxSTC_MOD_CONTAINER 0x40000
#define wxSTC_MOD_LEXERSTATE 0x80000 #define wxSTC_MOD_LEXERSTATE 0x80000
#define wxSTC_MODEVENTMASKALL 0xFFFFF #define wxSTC_MOD_INSERTCHECK 0x100000
#define wxSTC_MOD_CHANGETABSTOPS 0x200000
#define wxSTC_MODEVENTMASKALL 0x3FFFFF
#define wxSTC_UPDATE_CONTENT 0x1 #define wxSTC_UPDATE_CONTENT 0x1
#define wxSTC_UPDATE_SELECTION 0x2 #define wxSTC_UPDATE_SELECTION 0x2
#define wxSTC_UPDATE_V_SCROLL 0x4 #define wxSTC_UPDATE_V_SCROLL 0x4
@@ -474,6 +498,12 @@
#define wxSTC_LEX_RUST 111 #define wxSTC_LEX_RUST 111
#define wxSTC_LEX_DMAP 112 #define wxSTC_LEX_DMAP 112
#define wxSTC_LEX_AS 113 #define wxSTC_LEX_AS 113
#define wxSTC_LEX_DMIS 114
#define wxSTC_LEX_REGISTRY 115
#define wxSTC_LEX_BIBTEX 116
#define wxSTC_LEX_SREC 117
#define wxSTC_LEX_IHEX 118
#define wxSTC_LEX_TEHEX 119
/// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a /// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
/// value assigned in sequence from SCLEX_AUTOMATIC+1. /// value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -524,6 +554,8 @@
#define wxSTC_C_PREPROCESSORCOMMENT 23 #define wxSTC_C_PREPROCESSORCOMMENT 23
#define wxSTC_C_PREPROCESSORCOMMENTDOC 24 #define wxSTC_C_PREPROCESSORCOMMENTDOC 24
#define wxSTC_C_USERLITERAL 25 #define wxSTC_C_USERLITERAL 25
#define wxSTC_C_TASKMARKER 26
#define wxSTC_C_ESCAPESEQUENCE 27
/// Lexical states for SCLEX_D /// Lexical states for SCLEX_D
#define wxSTC_D_DEFAULT 0 #define wxSTC_D_DEFAULT 0
@@ -1355,6 +1387,11 @@
#define wxSTC_V_IDENTIFIER 11 #define wxSTC_V_IDENTIFIER 11
#define wxSTC_V_STRINGEOL 12 #define wxSTC_V_STRINGEOL 12
#define wxSTC_V_USER 19 #define wxSTC_V_USER 19
#define wxSTC_V_COMMENT_WORD 20
#define wxSTC_V_INPUT 21
#define wxSTC_V_OUTPUT 22
#define wxSTC_V_INOUT 23
#define wxSTC_V_PORT_CONNECT 24
/// Lexical states for SCLEX_KIX /// Lexical states for SCLEX_KIX
#define wxSTC_KIX_DEFAULT 0 #define wxSTC_KIX_DEFAULT 0
@@ -1367,6 +1404,7 @@
#define wxSTC_KIX_KEYWORD 7 #define wxSTC_KIX_KEYWORD 7
#define wxSTC_KIX_FUNCTIONS 8 #define wxSTC_KIX_FUNCTIONS 8
#define wxSTC_KIX_OPERATOR 9 #define wxSTC_KIX_OPERATOR 9
#define wxSTC_KIX_COMMENTSTREAM 10
#define wxSTC_KIX_IDENTIFIER 31 #define wxSTC_KIX_IDENTIFIER 31
/// Lexical states for SCLEX_GUI4CLI /// Lexical states for SCLEX_GUI4CLI
@@ -1477,6 +1515,7 @@
#define wxSTC_VHDL_STDPACKAGE 12 #define wxSTC_VHDL_STDPACKAGE 12
#define wxSTC_VHDL_STDTYPE 13 #define wxSTC_VHDL_STDTYPE 13
#define wxSTC_VHDL_USERWORD 14 #define wxSTC_VHDL_USERWORD 14
#define wxSTC_VHDL_BLOCK_COMMENT 15
/// Lexical states for SCLEX_CAML /// Lexical states for SCLEX_CAML
#define wxSTC_CAML_DEFAULT 0 #define wxSTC_CAML_DEFAULT 0
@@ -1598,6 +1637,7 @@
#define wxSTC_SQL_USER3 21 #define wxSTC_SQL_USER3 21
#define wxSTC_SQL_USER4 22 #define wxSTC_SQL_USER4 22
#define wxSTC_SQL_QUOTEDIDENTIFIER 23 #define wxSTC_SQL_QUOTEDIDENTIFIER 23
#define wxSTC_SQL_QOPERATOR 24
/// Lexical states for SCLEX_SMALLTALK /// Lexical states for SCLEX_SMALLTALK
#define wxSTC_ST_DEFAULT 0 #define wxSTC_ST_DEFAULT 0
@@ -2243,6 +2283,9 @@
#define wxSTC_RUST_LIFETIME 18 #define wxSTC_RUST_LIFETIME 18
#define wxSTC_RUST_MACRO 19 #define wxSTC_RUST_MACRO 19
#define wxSTC_RUST_LEXERROR 20 #define wxSTC_RUST_LEXERROR 20
#define wxSTC_RUST_BYTESTRING 21
#define wxSTC_RUST_BYTESTRINGR 22
#define wxSTC_RUST_BYTECHARACTER 23
/// Lexical states for SCLEX_DMAP /// Lexical states for SCLEX_DMAP
#define wxSTC_DMAP_DEFAULT 0 #define wxSTC_DMAP_DEFAULT 0
@@ -2257,6 +2300,63 @@
#define wxSTC_DMAP_WORD2 9 #define wxSTC_DMAP_WORD2 9
#define wxSTC_DMAP_WORD3 10 #define wxSTC_DMAP_WORD3 10
/// Lexical states for SCLEX_DMIS
#define wxSTC_DMIS_DEFAULT 0
#define wxSTC_DMIS_COMMENT 1
#define wxSTC_DMIS_STRING 2
#define wxSTC_DMIS_NUMBER 3
#define wxSTC_DMIS_KEYWORD 4
#define wxSTC_DMIS_MAJORWORD 5
#define wxSTC_DMIS_MINORWORD 6
#define wxSTC_DMIS_UNSUPPORTED_MAJOR 7
#define wxSTC_DMIS_UNSUPPORTED_MINOR 8
#define wxSTC_DMIS_LABEL 9
/// Lexical states for SCLEX_REGISTRY
#define wxSTC_REG_DEFAULT 0
#define wxSTC_REG_COMMENT 1
#define wxSTC_REG_VALUENAME 2
#define wxSTC_REG_STRING 3
#define wxSTC_REG_HEXDIGIT 4
#define wxSTC_REG_VALUETYPE 5
#define wxSTC_REG_ADDEDKEY 6
#define wxSTC_REG_DELETEDKEY 7
#define wxSTC_REG_ESCAPED 8
#define wxSTC_REG_KEYPATH_GUID 9
#define wxSTC_REG_STRING_GUID 10
#define wxSTC_REG_PARAMETER 11
#define wxSTC_REG_OPERATOR 12
/// Lexical state for SCLEX_BIBTEX
#define wxSTC_BIBTEX_DEFAULT 0
#define wxSTC_BIBTEX_ENTRY 1
#define wxSTC_BIBTEX_UNKNOWN_ENTRY 2
#define wxSTC_BIBTEX_KEY 3
#define wxSTC_BIBTEX_PARAMETER 4
#define wxSTC_BIBTEX_VALUE 5
#define wxSTC_BIBTEX_COMMENT 6
/// Lexical state for SCLEX_SREC
#define wxSTC_HEX_DEFAULT 0
#define wxSTC_HEX_RECSTART 1
#define wxSTC_HEX_RECTYPE 2
#define wxSTC_HEX_RECTYPE_UNKNOWN 3
#define wxSTC_HEX_BYTECOUNT 4
#define wxSTC_HEX_BYTECOUNT_WRONG 5
#define wxSTC_HEX_NOADDRESS 6
#define wxSTC_HEX_DATAADDRESS 7
#define wxSTC_HEX_RECCOUNT 8
#define wxSTC_HEX_STARTADDRESS 9
#define wxSTC_HEX_ADDRESSFIELD_UNKNOWN 10
#define wxSTC_HEX_EXTENDEDADDRESS 11
#define wxSTC_HEX_DATA_ODD 12
#define wxSTC_HEX_DATA_EVEN 13
#define wxSTC_HEX_DATA_UNKNOWN 14
#define wxSTC_HEX_DATA_EMPTY 15
#define wxSTC_HEX_CHECKSUM 16
#define wxSTC_HEX_CHECKSUM_WRONG 17
#define wxSTC_HEX_GARBAGE 18
//}}} //}}}
// Commands that can be bound to keystrokes {{{ // Commands that can be bound to keystrokes {{{
@@ -2708,6 +2808,11 @@ public:
*/ */
void InsertText(int pos, const wxString& text); void InsertText(int pos, const wxString& text);
/**
Change the text that is being inserted in response to SC_MOD_INSERTCHECK
*/
void ChangeInsertion(int length, const wxString& text);
/** /**
Delete all text in the document. Delete all text in the document.
*/ */
@@ -2836,6 +2941,7 @@ public:
/** /**
Retrieve the text of the line containing the caret. Retrieve the text of the line containing the caret.
Returns the index of the caret on the line. Returns the index of the caret on the line.
Result is NUL-terminated.
*/ */
wxString GetCurLine(int* linePos=NULL); wxString GetCurLine(int* linePos=NULL);
@@ -2892,11 +2998,36 @@ public:
*/ */
int GetTabWidth() const; int GetTabWidth() const;
/**
Clear explicit tabstops on a line.
*/
void ClearTabStops(int line);
/**
Add an explicit tab stop for a line.
*/
void AddTabStop(int line, int x);
/**
Find the next explicit tab stop position on a line after a position.
*/
int GetNextTabStop(int line, int x);
/** /**
Set the code page used to interpret the bytes of the document as characters. Set the code page used to interpret the bytes of the document as characters.
*/ */
void SetCodePage(int codePage); void SetCodePage(int codePage);
/**
Is the IME displayed in a winow or inline?
*/
int GetIMEInteraction() const;
/**
Choose to display the the IME in a winow or inline.
*/
void SetIMEInteraction(int imeInteraction);
/** /**
Set the symbol used for a particular marker number, Set the symbol used for a particular marker number,
and optionally the fore and background colours. and optionally the fore and background colours.
@@ -3289,6 +3420,36 @@ public:
*/ */
bool IndicatorGetUnder(int indic) const; bool IndicatorGetUnder(int indic) const;
/**
Set a hover indicator to plain, squiggle or TT.
*/
void IndicatorSetHoverStyle(int indic, int style);
/**
Retrieve the hover style of an indicator.
*/
int IndicatorGetHoverStyle(int indic) const;
/**
Set the foreground hover colour of an indicator.
*/
void IndicatorSetHoverForeground(int indic, const wxColour& fore);
/**
Retrieve the foreground hover colour of an indicator.
*/
wxColour IndicatorGetHoverForeground(int indic) const;
/**
Set the attributes of an indicator.
*/
void IndicatorSetFlags(int indic, int flags);
/**
Retrieve the attributes of an indicator.
*/
int IndicatorGetFlags(int indic) const;
/** /**
Set the foreground colour of all whitespace and whether to use this setting. Set the foreground colour of all whitespace and whether to use this setting.
*/ */
@@ -3869,6 +4030,16 @@ public:
*/ */
int GetTargetEnd() const; int GetTargetEnd() const;
/**
Sets both the start and end of the target in one call.
*/
void SetTargetRange(int start, int end);
/**
Retrieve the text in the target.
*/
wxString GetTargetText() const;
/** /**
Replace the target text with the argument text. Replace the target text with the argument text.
Text is counted so it can contain NULs. Text is counted so it can contain NULs.
@@ -4237,7 +4408,7 @@ public:
void AppendText(const wxString& text); void AppendText(const wxString& text);
/** /**
Is drawing done in two phases with backgrounds drawn before faoregrounds? Is drawing done in two phases with backgrounds drawn before foregrounds?
*/ */
bool GetTwoPhaseDraw() const; bool GetTwoPhaseDraw() const;
@@ -4247,6 +4418,19 @@ public:
*/ */
void SetTwoPhaseDraw(bool twoPhase); void SetTwoPhaseDraw(bool twoPhase);
/**
How many phases is drawing done in?
*/
int GetPhasesDraw() const;
/**
In one phase draw, text is drawn in a series of rectangular blocks with no overlap.
In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally.
In multiple phase draw, each element is drawn over the whole drawing area, allowing text
to overlap from one line to the next.
*/
void SetPhasesDraw(int phases);
/** /**
Scroll so that a display line is at the top of the display. Scroll so that a display line is at the top of the display.
*/ */
@@ -4264,6 +4448,7 @@ public:
/** /**
Retrieve the value of a tag from a regular expression search. Retrieve the value of a tag from a regular expression search.
Result is NUL-terminated.
*/ */
wxString GetTag(int tagNumber) const; wxString GetTag(int tagNumber) const;
@@ -5073,6 +5258,16 @@ public:
*/ */
int AutoCompGetCaseInsensitiveBehaviour() const; int AutoCompGetCaseInsensitiveBehaviour() const;
/**
Change the effect of autocompleting when there are multiple selections.
*/
void AutoCompSetMulti(int multi);
/**
Retrieve the effect of autocompleting when there are multiple selections..
*/
int AutoCompGetMulti() const;
/** /**
Set the way autocompletion lists are ordered. Set the way autocompletion lists are ordered.
*/ */
@@ -5228,16 +5423,6 @@ public:
*/ */
int GetGapPosition() const; int GetGapPosition() const;
/**
Always interpret keyboard input as Unicode
*/
void SetKeysUnicode(bool keysUnicode);
/**
Are keys always interpreted as Unicode?
*/
bool GetKeysUnicode() const;
/** /**
Set the alpha fill colour of the given indicator. Set the alpha fill colour of the given indicator.
*/ */
@@ -5734,6 +5919,7 @@ public:
/** /**
Set the way a character is drawn. Set the way a character is drawn.
Result is NUL-terminated.
*/ */
wxString GetRepresentation(const wxString& encodedCharacter) const; wxString GetRepresentation(const wxString& encodedCharacter) const;
@@ -5811,6 +5997,7 @@ public:
/** /**
Retrieve a '\n' separated list of properties understood by the current lexer. Retrieve a '\n' separated list of properties understood by the current lexer.
Result is NUL-terminated.
*/ */
wxString PropertyNames() const; wxString PropertyNames() const;
@@ -5821,11 +6008,13 @@ public:
/** /**
Describe a property. Describe a property.
Result is NUL-terminated.
*/ */
wxString DescribeProperty(const wxString& name) const; wxString DescribeProperty(const wxString& name) const;
/** /**
Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
Result is NUL-terminated.
*/ */
wxString DescribeKeyWordSets() const; wxString DescribeKeyWordSets() const;
@@ -5878,6 +6067,7 @@ public:
/** /**
Get the set of base styles that can be extended with sub styles Get the set of base styles that can be extended with sub styles
Result is NUL-terminated.
*/ */
wxString GetSubStyleBases() const; wxString GetSubStyleBases() const;

View File

@@ -1643,10 +1643,11 @@ wxWX2MBbuf wx2stc(const wxString& str)
size_t wclen = str.length(); size_t wclen = str.length();
size_t len = UTF8Length(wcstr, wclen); size_t len = UTF8Length(wcstr, wclen);
wxCharBuffer buffer(len+1); // The buffer object adds extra byte for the terminating NUL and we must
UTF8FromUTF16(wcstr, wclen, buffer.data(), len); // pass the total length, including this NUL, to UTF8FromUTF16() to ensure
// that it NULL-terminates the string.
// TODO check NULL termination!! wxCharBuffer buffer(len);
UTF8FromUTF16(wcstr, wclen, buffer.data(), len + 1);
return buffer; return buffer;
} }

View File

@@ -545,7 +545,7 @@ void ScintillaWX::Paste() {
} }
else else
{ {
InsertPaste(selStart, buf, len); InsertPaste(buf, len);
} }
} }
#endif // wxUSE_DATAOBJ #endif // wxUSE_DATAOBJ

View File

@@ -26,6 +26,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#include <stdexcept>
// These are all Scintilla headers // These are all Scintilla headers
#include "Platform.h" #include "Platform.h"
@@ -59,6 +60,9 @@
#include "Document.h" #include "Document.h"
#include "Selection.h" #include "Selection.h"
#include "PositionCache.h" #include "PositionCache.h"
#include "EditModel.h"
#include "MarginView.h"
#include "EditView.h"
#include "Editor.h" #include "Editor.h"
#include "PropSetSimple.h" #include "PropSetSimple.h"
#include "ScintillaBase.h" #include "ScintillaBase.h"
@@ -113,38 +117,38 @@ public:
~ScintillaWX(); ~ScintillaWX();
// base class virtuals // base class virtuals
virtual void Initialise(); virtual void Initialise() wxOVERRIDE;
virtual void Finalise(); virtual void Finalise() wxOVERRIDE;
virtual void StartDrag(); virtual void StartDrag() wxOVERRIDE;
virtual bool SetIdle(bool on); virtual bool SetIdle(bool on) wxOVERRIDE;
virtual void SetTicking(bool on); virtual void SetTicking(bool on) wxOVERRIDE;
virtual void SetMouseCapture(bool on); virtual void SetMouseCapture(bool on) wxOVERRIDE;
virtual bool HaveMouseCapture(); virtual bool HaveMouseCapture() wxOVERRIDE;
virtual void ScrollText(int linesToMove); virtual void ScrollText(int linesToMove) wxOVERRIDE;
virtual void SetVerticalScrollPos(); virtual void SetVerticalScrollPos() wxOVERRIDE;
virtual void SetHorizontalScrollPos(); virtual void SetHorizontalScrollPos() wxOVERRIDE;
virtual bool ModifyScrollBars(int nMax, int nPage); virtual bool ModifyScrollBars(int nMax, int nPage) wxOVERRIDE;
virtual void Copy(); virtual void Copy() wxOVERRIDE;
virtual void Paste(); virtual void Paste() wxOVERRIDE;
virtual void CopyToClipboard(const SelectionText &selectedText); virtual void CopyToClipboard(const SelectionText &selectedText) wxOVERRIDE;
virtual void CreateCallTipWindow(PRectangle rc); virtual void CreateCallTipWindow(PRectangle rc) wxOVERRIDE;
virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true) wxOVERRIDE;
virtual void ClaimSelection(); virtual void ClaimSelection() wxOVERRIDE;
virtual sptr_t DefWndProc(unsigned int iMessage, virtual sptr_t DefWndProc(unsigned int iMessage,
uptr_t wParam, uptr_t wParam,
sptr_t lParam); sptr_t lParam) wxOVERRIDE;
virtual sptr_t WndProc(unsigned int iMessage, virtual sptr_t WndProc(unsigned int iMessage,
uptr_t wParam, uptr_t wParam,
sptr_t lParam); sptr_t lParam) wxOVERRIDE;
virtual void NotifyChange(); virtual void NotifyChange() wxOVERRIDE;
virtual void NotifyParent(SCNotification scn); virtual void NotifyParent(SCNotification scn) wxOVERRIDE;
virtual void CancelModes(); virtual void CancelModes() wxOVERRIDE;
virtual void UpdateSystemCaret(); virtual void UpdateSystemCaret() wxOVERRIDE;
// Event delegates // Event delegates
void DoPaint(wxDC* dc, wxRect rect); void DoPaint(wxDC* dc, wxRect rect);
@@ -182,7 +186,7 @@ public:
void FullPaint(); void FullPaint();
void FullPaintDC(wxDC* dc); void FullPaintDC(wxDC* dc);
bool CanPaste(); bool CanPaste();
bool GetHideSelection() { return hideSelection; } bool GetHideSelection() { return view.hideSelection; }
void DoScrollToLine(int line); void DoScrollToLine(int line);
void DoScrollToColumn(int column); void DoScrollToColumn(int column);
void ClipChildren(wxDC& dc, PRectangle rect); void ClipChildren(wxDC& dc, PRectangle rect);

View File

@@ -371,6 +371,12 @@ methodOverrideMap = {
'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0), 'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0),
'IndicSetUnder': ('IndicatorSetUnder', 0, 0, 0), 'IndicSetUnder': ('IndicatorSetUnder', 0, 0, 0),
'IndicGetUnder': ('IndicatorGetUnder', 0, 0, 0), 'IndicGetUnder': ('IndicatorGetUnder', 0, 0, 0),
'IndicSetHoverStyle': ('IndicatorSetHoverStyle', 0, 0, 0),
'IndicGetHoverStyle': ('IndicatorGetHoverStyle', 0, 0, 0),
'IndicSetHoverFore': ('IndicatorSetHoverForeground', 0, 0, 0),
'IndicGetHoverFore': ('IndicatorGetHoverForeground', 0, 0, 0),
'IndicSetFlags': ('IndicatorSetFlags', 0, 0, 0),
'IndicGetFlags': ('IndicatorGetFlags', 0, 0, 0),
'SetWhitespaceFore' : ('SetWhitespaceForeground', 0, 0, 0), 'SetWhitespaceFore' : ('SetWhitespaceForeground', 0, 0, 0),
'SetWhitespaceBack' : ('SetWhitespaceBackground', 0, 0, 0), 'SetWhitespaceBack' : ('SetWhitespaceBackground', 0, 0, 0),
@@ -406,6 +412,8 @@ methodOverrideMap = {
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0), 'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
'AutoCSetCaseInsensitiveBehaviour' : ('AutoCompSetCaseInsensitiveBehaviour', 0, 0, 0), 'AutoCSetCaseInsensitiveBehaviour' : ('AutoCompSetCaseInsensitiveBehaviour', 0, 0, 0),
'AutoCGetCaseInsensitiveBehaviour' : ('AutoCompGetCaseInsensitiveBehaviour', 0, 0, 0), 'AutoCGetCaseInsensitiveBehaviour' : ('AutoCompGetCaseInsensitiveBehaviour', 0, 0, 0),
'AutoCSetMulti' : ('AutoCompSetMulti', 0, 0, 0),
'AutoCGetMulti' : ('AutoCompGetMulti', 0, 0, 0),
'AutoCSetOrder' : ('AutoCompSetOrder', 0, 0, 0), 'AutoCSetOrder' : ('AutoCompSetOrder', 0, 0, 0),
'AutoCGetOrder' : ('AutoCompGetOrder', 0, 0, 0), 'AutoCGetOrder' : ('AutoCompGetOrder', 0, 0, 0),
@@ -586,6 +594,22 @@ methodOverrideMap = {
'GetDirectFunction' : (None, 0, 0, 0), 'GetDirectFunction' : (None, 0, 0, 0),
'GetDirectPointer' : (None, 0, 0, 0), 'GetDirectPointer' : (None, 0, 0, 0),
'GetTargetText' :
(0,
'wxString %s() const;',
'''wxString %s() const {
int startPos = GetTargetStart();
int endPos = GetTargetEnd();
wxMemoryBuffer mbuf(endPos-startPos+1); // leave room for the null...
char* buf = (char*)mbuf.GetWriteBuf(endPos-startPos+1);
SendMsg(%s, 0, (sptr_t)buf);
mbuf.UngetWriteBuf(endPos-startPos);
mbuf.AppendByte(0);
return stc2wx(buf);''',
0),
'CallTipPosStart' : ('CallTipPosAtStart', 0, 0, 0), 'CallTipPosStart' : ('CallTipPosAtStart', 0, 0, 0),
'CallTipSetPosStart': ('CallTipSetPosAtStart', 0, 0, 0), 'CallTipSetPosStart': ('CallTipSetPosAtStart', 0, 0, 0),
'CallTipSetHlt' : ('CallTipSetHighlight', 0, 0, 0), 'CallTipSetHlt' : ('CallTipSetHighlight', 0, 0, 0),

View File

@@ -3,7 +3,7 @@ directories from the Scintilla source distribution. All other code
needed to implement Scintilla on top of wxWidgets is located in the needed to implement Scintilla on top of wxWidgets is located in the
directory above this one. directory above this one.
The current version of the Scintilla code is 3.4.1 The current version of the Scintilla code is 3.5.5
These are the basic steps needed to update the version of Scintilla used by wxSTC. These are the basic steps needed to update the version of Scintilla used by wxSTC.

View File

@@ -77,7 +77,9 @@ namespace Scintilla {
typedef float XYPOSITION; typedef float XYPOSITION;
typedef double XYACCUMULATOR; typedef double XYACCUMULATOR;
//#define XYPOSITION int inline int RoundXYPosition(XYPOSITION xyPos) {
return int(xyPos + 0.5);
}
// Underlying the implementation of the platform classes are platform specific types. // Underlying the implementation of the platform classes are platform specific types.
// Sometimes these need to be passed around by client code so they are defined here // Sometimes these need to be passed around by client code so they are defined here
@@ -92,7 +94,7 @@ typedef void *IdlerID;
/** /**
* A geometric point class. * A geometric point class.
* Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably. * Point is similar to the Win32 POINT and GTK+ GdkPoint types.
*/ */
class Point { class Point {
public: public:
@@ -102,6 +104,10 @@ public:
explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) { explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {
} }
static Point FromInts(int x_, int y_) {
return Point(static_cast<XYPOSITION>(x_), static_cast<XYPOSITION>(y_));
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine // Other automatically defined methods (assignment, copy constructor, destructor) are fine
static Point FromLong(long lpoint); static Point FromLong(long lpoint);
@@ -109,7 +115,7 @@ public:
/** /**
* A geometric rectangle class. * A geometric rectangle class.
* PRectangle is exactly the same as the Win32 RECT so can be used interchangeably. * PRectangle is similar to the Win32 RECT.
* PRectangles contain their top and left sides, but not their right and bottom sides. * PRectangles contain their top and left sides, but not their right and bottom sides.
*/ */
class PRectangle { class PRectangle {
@@ -119,10 +125,15 @@ public:
XYPOSITION right; XYPOSITION right;
XYPOSITION bottom; XYPOSITION bottom;
PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) : explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :
left(left_), top(top_), right(right_), bottom(bottom_) { left(left_), top(top_), right(right_), bottom(bottom_) {
} }
static PRectangle FromInts(int left_, int top_, int right_, int bottom_) {
return PRectangle(static_cast<XYPOSITION>(left_), static_cast<XYPOSITION>(top_),
static_cast<XYPOSITION>(right_), static_cast<XYPOSITION>(bottom_));
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine // Other automatically defined methods (assignment, copy constructor, destructor) are fine
bool operator==(PRectangle &rc) const { bool operator==(PRectangle &rc) const {
@@ -133,6 +144,11 @@ public:
return (pt.x >= left) && (pt.x <= right) && return (pt.x >= left) && (pt.x <= right) &&
(pt.y >= top) && (pt.y <= bottom); (pt.y >= top) && (pt.y <= bottom);
} }
bool ContainsWholePixel(Point pt) const {
// Does the rectangle contain all of the pixel to left/below the point
return (pt.x >= left) && ((pt.x+1) <= right) &&
(pt.y >= top) && ((pt.y+1) <= bottom);
}
bool Contains(PRectangle rc) const { bool Contains(PRectangle rc) const {
return (rc.left >= left) && (rc.right <= right) && return (rc.left >= left) && (rc.right <= right) &&
(rc.top >= top) && (rc.bottom <= bottom); (rc.top >= top) && (rc.bottom <= bottom);
@@ -255,7 +271,6 @@ struct FontParameters {
class Font { class Font {
protected: protected:
FontID fid; FontID fid;
// Private so Font objects can not be copied // Private so Font objects can not be copied
Font(const Font &); Font(const Font &);
Font &operator=(const Font &); Font &operator=(const Font &);
@@ -269,7 +284,6 @@ public:
FontID GetID() { return fid; } FontID GetID() { return fid; }
// Alias another font - caller guarantees not to Release // Alias another font - caller guarantees not to Release
void SetID(FontID fid_) { fid = fid_; } void SetID(FontID fid_) { fid = fid_; }
friend class Surface; friend class Surface;
friend class SurfaceImpl; friend class SurfaceImpl;
}; };
@@ -512,11 +526,6 @@ public:
} }
#endif #endif
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4244 4309 4514 4710)
#endif
#if defined(__GNUC__) && defined(SCINTILLA_QT) #if defined(__GNUC__) && defined(SCINTILLA_QT)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers" #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif #endif

View File

@@ -126,6 +126,12 @@
#define SCLEX_RUST 111 #define SCLEX_RUST 111
#define SCLEX_DMAP 112 #define SCLEX_DMAP 112
#define SCLEX_AS 113 #define SCLEX_AS 113
#define SCLEX_DMIS 114
#define SCLEX_REGISTRY 115
#define SCLEX_BIBTEX 116
#define SCLEX_SREC 117
#define SCLEX_IHEX 118
#define SCLEX_TEHEX 119
#define SCLEX_AUTOMATIC 1000 #define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0 #define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1 #define SCE_P_COMMENTLINE 1
@@ -169,6 +175,8 @@
#define SCE_C_PREPROCESSORCOMMENT 23 #define SCE_C_PREPROCESSORCOMMENT 23
#define SCE_C_PREPROCESSORCOMMENTDOC 24 #define SCE_C_PREPROCESSORCOMMENTDOC 24
#define SCE_C_USERLITERAL 25 #define SCE_C_USERLITERAL 25
#define SCE_C_TASKMARKER 26
#define SCE_C_ESCAPESEQUENCE 27
#define SCE_D_DEFAULT 0 #define SCE_D_DEFAULT 0
#define SCE_D_COMMENT 1 #define SCE_D_COMMENT 1
#define SCE_D_COMMENTLINE 2 #define SCE_D_COMMENTLINE 2
@@ -893,6 +901,11 @@
#define SCE_V_IDENTIFIER 11 #define SCE_V_IDENTIFIER 11
#define SCE_V_STRINGEOL 12 #define SCE_V_STRINGEOL 12
#define SCE_V_USER 19 #define SCE_V_USER 19
#define SCE_V_COMMENT_WORD 20
#define SCE_V_INPUT 21
#define SCE_V_OUTPUT 22
#define SCE_V_INOUT 23
#define SCE_V_PORT_CONNECT 24
#define SCE_KIX_DEFAULT 0 #define SCE_KIX_DEFAULT 0
#define SCE_KIX_COMMENT 1 #define SCE_KIX_COMMENT 1
#define SCE_KIX_STRING1 2 #define SCE_KIX_STRING1 2
@@ -903,6 +916,7 @@
#define SCE_KIX_KEYWORD 7 #define SCE_KIX_KEYWORD 7
#define SCE_KIX_FUNCTIONS 8 #define SCE_KIX_FUNCTIONS 8
#define SCE_KIX_OPERATOR 9 #define SCE_KIX_OPERATOR 9
#define SCE_KIX_COMMENTSTREAM 10
#define SCE_KIX_IDENTIFIER 31 #define SCE_KIX_IDENTIFIER 31
#define SCE_GC_DEFAULT 0 #define SCE_GC_DEFAULT 0
#define SCE_GC_COMMENTLINE 1 #define SCE_GC_COMMENTLINE 1
@@ -999,6 +1013,7 @@
#define SCE_VHDL_STDPACKAGE 12 #define SCE_VHDL_STDPACKAGE 12
#define SCE_VHDL_STDTYPE 13 #define SCE_VHDL_STDTYPE 13
#define SCE_VHDL_USERWORD 14 #define SCE_VHDL_USERWORD 14
#define SCE_VHDL_BLOCK_COMMENT 15
#define SCE_CAML_DEFAULT 0 #define SCE_CAML_DEFAULT 0
#define SCE_CAML_IDENTIFIER 1 #define SCE_CAML_IDENTIFIER 1
#define SCE_CAML_TAGNAME 2 #define SCE_CAML_TAGNAME 2
@@ -1110,6 +1125,7 @@
#define SCE_SQL_USER3 21 #define SCE_SQL_USER3 21
#define SCE_SQL_USER4 22 #define SCE_SQL_USER4 22
#define SCE_SQL_QUOTEDIDENTIFIER 23 #define SCE_SQL_QUOTEDIDENTIFIER 23
#define SCE_SQL_QOPERATOR 24
#define SCE_ST_DEFAULT 0 #define SCE_ST_DEFAULT 0
#define SCE_ST_STRING 1 #define SCE_ST_STRING 1
#define SCE_ST_NUMBER 2 #define SCE_ST_NUMBER 2
@@ -1689,6 +1705,9 @@
#define SCE_RUST_LIFETIME 18 #define SCE_RUST_LIFETIME 18
#define SCE_RUST_MACRO 19 #define SCE_RUST_MACRO 19
#define SCE_RUST_LEXERROR 20 #define SCE_RUST_LEXERROR 20
#define SCE_RUST_BYTESTRING 21
#define SCE_RUST_BYTESTRINGR 22
#define SCE_RUST_BYTECHARACTER 23
#define SCE_DMAP_DEFAULT 0 #define SCE_DMAP_DEFAULT 0
#define SCE_DMAP_COMMENT 1 #define SCE_DMAP_COMMENT 1
#define SCE_DMAP_NUMBER 2 #define SCE_DMAP_NUMBER 2
@@ -1700,6 +1719,55 @@
#define SCE_DMAP_WORD 8 #define SCE_DMAP_WORD 8
#define SCE_DMAP_WORD2 9 #define SCE_DMAP_WORD2 9
#define SCE_DMAP_WORD3 10 #define SCE_DMAP_WORD3 10
#define SCE_DMIS_DEFAULT 0
#define SCE_DMIS_COMMENT 1
#define SCE_DMIS_STRING 2
#define SCE_DMIS_NUMBER 3
#define SCE_DMIS_KEYWORD 4
#define SCE_DMIS_MAJORWORD 5
#define SCE_DMIS_MINORWORD 6
#define SCE_DMIS_UNSUPPORTED_MAJOR 7
#define SCE_DMIS_UNSUPPORTED_MINOR 8
#define SCE_DMIS_LABEL 9
#define SCE_REG_DEFAULT 0
#define SCE_REG_COMMENT 1
#define SCE_REG_VALUENAME 2
#define SCE_REG_STRING 3
#define SCE_REG_HEXDIGIT 4
#define SCE_REG_VALUETYPE 5
#define SCE_REG_ADDEDKEY 6
#define SCE_REG_DELETEDKEY 7
#define SCE_REG_ESCAPED 8
#define SCE_REG_KEYPATH_GUID 9
#define SCE_REG_STRING_GUID 10
#define SCE_REG_PARAMETER 11
#define SCE_REG_OPERATOR 12
#define SCE_BIBTEX_DEFAULT 0
#define SCE_BIBTEX_ENTRY 1
#define SCE_BIBTEX_UNKNOWN_ENTRY 2
#define SCE_BIBTEX_KEY 3
#define SCE_BIBTEX_PARAMETER 4
#define SCE_BIBTEX_VALUE 5
#define SCE_BIBTEX_COMMENT 6
#define SCE_HEX_DEFAULT 0
#define SCE_HEX_RECSTART 1
#define SCE_HEX_RECTYPE 2
#define SCE_HEX_RECTYPE_UNKNOWN 3
#define SCE_HEX_BYTECOUNT 4
#define SCE_HEX_BYTECOUNT_WRONG 5
#define SCE_HEX_NOADDRESS 6
#define SCE_HEX_DATAADDRESS 7
#define SCE_HEX_RECCOUNT 8
#define SCE_HEX_STARTADDRESS 9
#define SCE_HEX_ADDRESSFIELD_UNKNOWN 10
#define SCE_HEX_EXTENDEDADDRESS 11
#define SCE_HEX_DATA_ODD 12
#define SCE_HEX_DATA_EVEN 13
#define SCE_HEX_DATA_UNKNOWN 14
#define SCE_HEX_DATA_EMPTY 15
#define SCE_HEX_CHECKSUM 16
#define SCE_HEX_CHECKSUM_WRONG 17
#define SCE_HEX_GARBAGE 18
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif #endif

View File

@@ -18,9 +18,9 @@ extern "C" {
#if defined(_WIN32) #if defined(_WIN32)
/* Return false on failure: */ /* Return false on failure: */
int Scintilla_RegisterClasses(void *hInstance); int Scintilla_RegisterClasses(void *hInstance);
int Scintilla_ReleaseResources(); int Scintilla_ReleaseResources(void);
#endif #endif
int Scintilla_LinkLexers(); int Scintilla_LinkLexers(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
@@ -42,17 +42,6 @@ typedef long sptr_t;
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
/* Workaround for building with MinGW (not MinGW-w64) in strict ANSI mode which
* is, notably, enabled by -std=c++NN options. */
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && defined(__STRICT_ANSI__)
/* Other headers included by an application using Scintilla might already
* define isascii() too, for the same reasons, try to play nicely with the. */
#ifndef isascii
inline int isascii(int c) { return !(c & ~0x7F); }
#define isascii isascii
#endif
#endif
/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
#define INVALID_POSITION -1 #define INVALID_POSITION -1
#define SCI_START 2000 #define SCI_START 2000
@@ -61,6 +50,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SCI_ADDTEXT 2001 #define SCI_ADDTEXT 2001
#define SCI_ADDSTYLEDTEXT 2002 #define SCI_ADDSTYLEDTEXT 2002
#define SCI_INSERTTEXT 2003 #define SCI_INSERTTEXT 2003
#define SCI_CHANGEINSERTION 2672
#define SCI_CLEARALL 2004 #define SCI_CLEARALL 2004
#define SCI_DELETERANGE 2645 #define SCI_DELETERANGE 2645
#define SCI_CLEARDOCUMENTSTYLE 2005 #define SCI_CLEARDOCUMENTSTYLE 2005
@@ -102,8 +92,15 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SCI_SETBUFFEREDDRAW 2035 #define SCI_SETBUFFEREDDRAW 2035
#define SCI_SETTABWIDTH 2036 #define SCI_SETTABWIDTH 2036
#define SCI_GETTABWIDTH 2121 #define SCI_GETTABWIDTH 2121
#define SCI_CLEARTABSTOPS 2675
#define SCI_ADDTABSTOP 2676
#define SCI_GETNEXTTABSTOP 2677
#define SC_CP_UTF8 65001 #define SC_CP_UTF8 65001
#define SCI_SETCODEPAGE 2037 #define SCI_SETCODEPAGE 2037
#define SC_IME_WINDOWED 0
#define SC_IME_INLINE 1
#define SCI_GETIMEINTERACTION 2678
#define SCI_SETIMEINTERACTION 2679
#define MARKER_MAX 31 #define MARKER_MAX 31
#define SC_MARK_CIRCLE 0 #define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1 #define SC_MARK_ROUNDRECT 1
@@ -277,7 +274,12 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define INDIC_DOTBOX 12 #define INDIC_DOTBOX 12
#define INDIC_SQUIGGLEPIXMAP 13 #define INDIC_SQUIGGLEPIXMAP 13
#define INDIC_COMPOSITIONTHICK 14 #define INDIC_COMPOSITIONTHICK 14
#define INDIC_MAX 31 #define INDIC_COMPOSITIONTHIN 15
#define INDIC_FULLBOX 16
#define INDIC_TEXTFORE 17
#define INDIC_IME 32
#define INDIC_IME_MAX 35
#define INDIC_MAX 35
#define INDIC_CONTAINER 8 #define INDIC_CONTAINER 8
#define INDIC0_MASK 0x20 #define INDIC0_MASK 0x20
#define INDIC1_MASK 0x40 #define INDIC1_MASK 0x40
@@ -289,6 +291,15 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SCI_INDICGETFORE 2083 #define SCI_INDICGETFORE 2083
#define SCI_INDICSETUNDER 2510 #define SCI_INDICSETUNDER 2510
#define SCI_INDICGETUNDER 2511 #define SCI_INDICGETUNDER 2511
#define SCI_INDICSETHOVERSTYLE 2680
#define SCI_INDICGETHOVERSTYLE 2681
#define SCI_INDICSETHOVERFORE 2682
#define SCI_INDICGETHOVERFORE 2683
#define SC_INDICVALUEBIT 0x1000000
#define SC_INDICVALUEMASK 0xFFFFFF
#define SC_INDICFLAG_VALUEFORE 1
#define SCI_INDICSETFLAGS 2684
#define SCI_INDICGETFLAGS 2685
#define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEFORE 2084
#define SCI_SETWHITESPACEBACK 2085 #define SCI_SETWHITESPACEBACK 2085
#define SCI_SETWHITESPACESIZE 2086 #define SCI_SETWHITESPACESIZE 2086
@@ -375,6 +386,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SCFIND_WORDSTART 0x00100000 #define SCFIND_WORDSTART 0x00100000
#define SCFIND_REGEXP 0x00200000 #define SCFIND_REGEXP 0x00200000
#define SCFIND_POSIX 0x00400000 #define SCFIND_POSIX 0x00400000
#define SCFIND_CXX11REGEX 0x00800000
#define SCI_FINDTEXT 2150 #define SCI_FINDTEXT 2150
#define SCI_FORMATRANGE 2151 #define SCI_FORMATRANGE 2151
#define SCI_GETFIRSTVISIBLELINE 2152 #define SCI_GETFIRSTVISIBLELINE 2152
@@ -420,6 +432,8 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SCI_GETTARGETSTART 2191 #define SCI_GETTARGETSTART 2191
#define SCI_SETTARGETEND 2192 #define SCI_SETTARGETEND 2192
#define SCI_GETTARGETEND 2193 #define SCI_GETTARGETEND 2193
#define SCI_SETTARGETRANGE 2686
#define SCI_GETTARGETTEXT 2687
#define SCI_REPLACETARGET 2194 #define SCI_REPLACETARGET 2194
#define SCI_REPLACETARGETRE 2195 #define SCI_REPLACETARGETRE 2195
#define SCI_SEARCHINTARGET 2197 #define SCI_SEARCHINTARGET 2197
@@ -472,6 +486,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
#define SC_FOLDFLAG_LEVELNUMBERS 0x0040 #define SC_FOLDFLAG_LEVELNUMBERS 0x0040
#define SC_FOLDFLAG_LINESTATE 0x0080
#define SCI_SETFOLDFLAGS 2233 #define SCI_SETFOLDFLAGS 2233
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 #define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
#define SCI_SETTABINDENTS 2260 #define SCI_SETTABINDENTS 2260
@@ -526,6 +541,11 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SCI_APPENDTEXT 2282 #define SCI_APPENDTEXT 2282
#define SCI_GETTWOPHASEDRAW 2283 #define SCI_GETTWOPHASEDRAW 2283
#define SCI_SETTWOPHASEDRAW 2284 #define SCI_SETTWOPHASEDRAW 2284
#define SC_PHASES_ONE 0
#define SC_PHASES_TWO 1
#define SC_PHASES_MULTIPLE 2
#define SCI_GETPHASESDRAW 2673
#define SCI_SETPHASESDRAW 2674
#define SC_EFF_QUALITY_MASK 0xF #define SC_EFF_QUALITY_MASK 0xF
#define SC_EFF_QUALITY_DEFAULT 0 #define SC_EFF_QUALITY_DEFAULT 0
#define SC_EFF_QUALITY_NON_ANTIALIASED 1 #define SC_EFF_QUALITY_NON_ANTIALIASED 1
@@ -640,6 +660,8 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SC_STATUS_OK 0 #define SC_STATUS_OK 0
#define SC_STATUS_FAILURE 1 #define SC_STATUS_FAILURE 1
#define SC_STATUS_BADALLOC 2 #define SC_STATUS_BADALLOC 2
#define SC_STATUS_WARN_START 1000
#define SC_STATUS_WARN_REGEX 1001
#define SCI_SETSTATUS 2382 #define SCI_SETSTATUS 2382
#define SCI_GETSTATUS 2383 #define SCI_GETSTATUS 2383
#define SCI_SETMOUSEDOWNCAPTURES 2384 #define SCI_SETMOUSEDOWNCAPTURES 2384
@@ -726,6 +748,10 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 #define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634 #define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634
#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635 #define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635
#define SC_MULTIAUTOC_ONCE 0
#define SC_MULTIAUTOC_EACH 1
#define SCI_AUTOCSETMULTI 2636
#define SCI_AUTOCGETMULTI 2637
#define SC_ORDER_PRESORTED 0 #define SC_ORDER_PRESORTED 0
#define SC_ORDER_PERFORMSORT 1 #define SC_ORDER_PERFORMSORT 1
#define SC_ORDER_CUSTOM 2 #define SC_ORDER_CUSTOM 2
@@ -771,8 +797,6 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SCI_GETCHARACTERPOINTER 2520 #define SCI_GETCHARACTERPOINTER 2520
#define SCI_GETRANGEPOINTER 2643 #define SCI_GETRANGEPOINTER 2643
#define SCI_GETGAPPOSITION 2644 #define SCI_GETGAPPOSITION 2644
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#define SCI_INDICSETALPHA 2523 #define SCI_INDICSETALPHA 2523
#define SCI_INDICGETALPHA 2524 #define SCI_INDICGETALPHA 2524
#define SCI_INDICSETOUTLINEALPHA 2558 #define SCI_INDICSETOUTLINEALPHA 2558
@@ -806,6 +830,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define ANNOTATION_HIDDEN 0 #define ANNOTATION_HIDDEN 0
#define ANNOTATION_STANDARD 1 #define ANNOTATION_STANDARD 1
#define ANNOTATION_BOXED 2 #define ANNOTATION_BOXED 2
#define ANNOTATION_INDENTED 3
#define SCI_ANNOTATIONSETVISIBLE 2548 #define SCI_ANNOTATIONSETVISIBLE 2548
#define SCI_ANNOTATIONGETVISIBLE 2549 #define SCI_ANNOTATIONGETVISIBLE 2549
#define SCI_ANNOTATIONSETSTYLEOFFSET 2550 #define SCI_ANNOTATIONSETSTYLEOFFSET 2550
@@ -885,6 +910,8 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SCI_SCROLLTOEND 2629 #define SCI_SCROLLTOEND 2629
#define SC_TECHNOLOGY_DEFAULT 0 #define SC_TECHNOLOGY_DEFAULT 0
#define SC_TECHNOLOGY_DIRECTWRITE 1 #define SC_TECHNOLOGY_DIRECTWRITE 1
#define SC_TECHNOLOGY_DIRECTWRITERETAIN 2
#define SC_TECHNOLOGY_DIRECTWRITEDC 3
#define SCI_SETTECHNOLOGY 2630 #define SCI_SETTECHNOLOGY 2630
#define SCI_GETTECHNOLOGY 2631 #define SCI_GETTECHNOLOGY 2631
#define SCI_CREATELOADER 2632 #define SCI_CREATELOADER 2632
@@ -956,7 +983,9 @@ inline int isascii(int c) { return !(c & ~0x7F); }
#define SC_MOD_CHANGEANNOTATION 0x20000 #define SC_MOD_CHANGEANNOTATION 0x20000
#define SC_MOD_CONTAINER 0x40000 #define SC_MOD_CONTAINER 0x40000
#define SC_MOD_LEXERSTATE 0x80000 #define SC_MOD_LEXERSTATE 0x80000
#define SC_MODEVENTMASKALL 0xFFFFF #define SC_MOD_INSERTCHECK 0x100000
#define SC_MOD_CHANGETABSTOPS 0x200000
#define SC_MODEVENTMASKALL 0x3FFFFF
#define SC_UPDATE_CONTENT 0x1 #define SC_UPDATE_CONTENT 0x1
#define SC_UPDATE_SELECTION 0x2 #define SC_UPDATE_SELECTION 0x2
#define SC_UPDATE_V_SCROLL 0x4 #define SC_UPDATE_V_SCROLL 0x4
@@ -1025,7 +1054,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
* CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. * CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
* So older code that treats Scintilla as a RichEdit will work. */ * So older code that treats Scintilla as a RichEdit will work. */
#ifdef SCI_NAMESPACE #if defined(__cplusplus) && defined(SCI_NAMESPACE)
namespace Scintilla { namespace Scintilla {
#endif #endif
@@ -1117,7 +1146,7 @@ struct SCNotification {
int updated; /* SCN_UPDATEUI */ int updated; /* SCN_UPDATEUI */
}; };
#ifdef SCI_NAMESPACE #if defined(__cplusplus) && defined(SCI_NAMESPACE)
} }
#endif #endif
@@ -1126,6 +1155,8 @@ struct SCNotification {
#define SC_CP_DBCS 1 #define SC_CP_DBCS 1
#define SCI_SETUSEPALETTE 2039 #define SCI_SETUSEPALETTE 2039
#define SCI_GETUSEPALETTE 2139 #define SCI_GETUSEPALETTE 2139
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#endif #endif

View File

@@ -72,11 +72,11 @@
## Line numbers and positions start at 0. ## Line numbers and positions start at 0.
## String arguments may contain NUL ('\0') characters where the calls provide a length ## String arguments may contain NUL ('\0') characters where the calls provide a length
## argument and retrieve NUL characters. All retrieved strings except for those retrieved ## argument and retrieve NUL characters. APIs marked as NUL-terminated also have a
## by GetLine also have a NUL appended but client code should calculate the size that ## NUL appended but client code should calculate the size that will be returned rather
## will be returned rather than relying upon the NUL whenever possible. Allow for the ## than relying upon the NUL whenever possible. Allow for the extra NUL character when
## extra NUL character when allocating buffers. The size to allocate for a stringresult ## allocating buffers. The size to allocate for a stringresult (not including NUL) can be
## can be determined by calling with a NULL (0) pointer. ## determined by calling with a NULL (0) pointer.
cat Basics cat Basics
@@ -98,6 +98,9 @@ fun void AddStyledText=2002(int length, cells c)
# Insert string at a position. # Insert string at a position.
fun void InsertText=2003(position pos, string text) fun void InsertText=2003(position pos, string text)
# Change the text that is being inserted in response to SC_MOD_INSERTCHECK
fun void ChangeInsertion=2672(int length, string text)
# Delete all text in the document. # Delete all text in the document.
fun void ClearAll=2004(,) fun void ClearAll=2004(,)
@@ -183,6 +186,7 @@ set void SetAnchor=2026(position posAnchor,)
# Retrieve the text of the line containing the caret. # Retrieve the text of the line containing the caret.
# Returns the index of the caret on the line. # Returns the index of the caret on the line.
# Result is NUL-terminated.
fun int GetCurLine=2027(int length, stringresult text) fun int GetCurLine=2027(int length, stringresult text)
# Retrieve the position of the last correctly styled character. # Retrieve the position of the last correctly styled character.
@@ -223,6 +227,15 @@ set void SetTabWidth=2036(int tabWidth,)
# Retrieve the visible size of a tab. # Retrieve the visible size of a tab.
get int GetTabWidth=2121(,) get int GetTabWidth=2121(,)
# Clear explicit tabstops on a line.
fun void ClearTabStops=2675(int line,)
# Add an explicit tab stop for a line.
fun void AddTabStop=2676(int line, int x)
# Find the next explicit tab stop position on a line after a position.
fun int GetNextTabStop=2677(int line, int x)
# The SC_CP_UTF8 value can be used to enter Unicode mode. # The SC_CP_UTF8 value can be used to enter Unicode mode.
# This is the same value as CP_UTF8 in Windows # This is the same value as CP_UTF8 in Windows
val SC_CP_UTF8=65001 val SC_CP_UTF8=65001
@@ -231,6 +244,16 @@ val SC_CP_UTF8=65001
# The SC_CP_UTF8 value can be used to enter Unicode mode. # The SC_CP_UTF8 value can be used to enter Unicode mode.
set void SetCodePage=2037(int codePage,) set void SetCodePage=2037(int codePage,)
enu IMEInteraction=SC_IME_
val SC_IME_WINDOWED=0
val SC_IME_INLINE=1
# Is the IME displayed in a winow or inline?
get int GetIMEInteraction=2678(,)
# Choose to display the the IME in a winow or inline.
set void SetIMEInteraction=2679(int imeInteraction,)
enu MarkerSymbol=SC_MARK_ enu MarkerSymbol=SC_MARK_
val MARKER_MAX=31 val MARKER_MAX=31
val SC_MARK_CIRCLE=0 val SC_MARK_CIRCLE=0
@@ -457,6 +480,7 @@ get int StyleGetSize=2485(int style,)
# Get the font of a style. # Get the font of a style.
# Returns the length of the fontName # Returns the length of the fontName
# Result is NUL-terminated.
get int StyleGetFont=2486(int style, stringresult fontName) get int StyleGetFont=2486(int style, stringresult fontName)
# Get is a style to have its end of line filled or not. # Get is a style to have its end of line filled or not.
@@ -556,7 +580,7 @@ set void SetCaretPeriod=2076(int periodMilliseconds,)
set void SetWordChars=2077(, string characters) set void SetWordChars=2077(, string characters)
# Get the set of characters making up words for when moving or selecting by word. # Get the set of characters making up words for when moving or selecting by word.
# Retuns the number of characters # Returns the number of characters
get int GetWordChars=2646(, stringresult characters) get int GetWordChars=2646(, stringresult characters)
# Start a sequence of actions that is undone and redone as a unit. # Start a sequence of actions that is undone and redone as a unit.
@@ -583,7 +607,12 @@ val INDIC_SQUIGGLELOW=11
val INDIC_DOTBOX=12 val INDIC_DOTBOX=12
val INDIC_SQUIGGLEPIXMAP=13 val INDIC_SQUIGGLEPIXMAP=13
val INDIC_COMPOSITIONTHICK=14 val INDIC_COMPOSITIONTHICK=14
val INDIC_MAX=31 val INDIC_COMPOSITIONTHIN=15
val INDIC_FULLBOX=16
val INDIC_TEXTFORE=17
val INDIC_IME=32
val INDIC_IME_MAX=35
val INDIC_MAX=35
val INDIC_CONTAINER=8 val INDIC_CONTAINER=8
val INDIC0_MASK=0x20 val INDIC0_MASK=0x20
val INDIC1_MASK=0x40 val INDIC1_MASK=0x40
@@ -608,6 +637,30 @@ set void IndicSetUnder=2510(int indic, bool under)
# Retrieve whether indicator drawn under or over text. # Retrieve whether indicator drawn under or over text.
get bool IndicGetUnder=2511(int indic,) get bool IndicGetUnder=2511(int indic,)
# Set a hover indicator to plain, squiggle or TT.
set void IndicSetHoverStyle=2680(int indic, int style)
# Retrieve the hover style of an indicator.
get int IndicGetHoverStyle=2681(int indic,)
# Set the foreground hover colour of an indicator.
set void IndicSetHoverFore=2682(int indic, colour fore)
# Retrieve the foreground hover colour of an indicator.
get colour IndicGetHoverFore=2683(int indic,)
val SC_INDICVALUEBIT=0x1000000
val SC_INDICVALUEMASK=0xFFFFFF
enu IndicFlag=SC_INDICFLAG_
val SC_INDICFLAG_VALUEFORE=1
# Set the attributes of an indicator.
set void IndicSetFlags=2684(int indic, int flags)
# Retrieve the attributes of an indicator.
get int IndicGetFlags=2685(int indic,)
# Set the foreground colour of all whitespace and whether to use this setting. # Set the foreground colour of all whitespace and whether to use this setting.
fun void SetWhitespaceFore=2084(bool useSetting, colour fore) fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
@@ -862,6 +915,7 @@ val SCFIND_MATCHCASE=0x4
val SCFIND_WORDSTART=0x00100000 val SCFIND_WORDSTART=0x00100000
val SCFIND_REGEXP=0x00200000 val SCFIND_REGEXP=0x00200000
val SCFIND_POSIX=0x00400000 val SCFIND_POSIX=0x00400000
val SCFIND_CXX11REGEX=0x00800000
# Find some text in the document. # Find some text in the document.
fun position FindText=2150(int flags, findtext ft) fun position FindText=2150(int flags, findtext ft)
@@ -899,6 +953,7 @@ fun void SetSel=2160(position start, position end)
# Retrieve the selected text. # Retrieve the selected text.
# Return the length of the text. # Return the length of the text.
# Result is NUL-terminated.
fun int GetSelText=2161(, stringresult text) fun int GetSelText=2161(, stringresult text)
# Retrieve a range of text. # Retrieve a range of text.
@@ -969,6 +1024,7 @@ fun void SetText=2181(, string text)
# Retrieve all the text in the document. # Retrieve all the text in the document.
# Returns number of characters retrieved. # Returns number of characters retrieved.
# Result is NUL-terminated.
fun int GetText=2182(int length, stringresult text) fun int GetText=2182(int length, stringresult text)
# Retrieve the number of characters in the document. # Retrieve the number of characters in the document.
@@ -1007,6 +1063,12 @@ set void SetTargetEnd=2192(position pos,)
# Get the position that ends the target. # Get the position that ends the target.
get position GetTargetEnd=2193(,) get position GetTargetEnd=2193(,)
# Sets both the start and end of the target in one call.
fun void SetTargetRange=2686(position start, position end)
# Retrieve the text in the target.
get int GetTargetText=2687(, stringresult characters)
# Replace the target text with the argument text. # Replace the target text with the argument text.
# Text is counted so it can contain NULs. # Text is counted so it can contain NULs.
# Returns the length of the replacement text. # Returns the length of the replacement text.
@@ -1151,6 +1213,7 @@ val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004
val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008 val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008
val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010 val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010
val SC_FOLDFLAG_LEVELNUMBERS=0x0040 val SC_FOLDFLAG_LEVELNUMBERS=0x0040
val SC_FOLDFLAG_LINESTATE=0x0080
# Set some style options for folding. # Set some style options for folding.
set void SetFoldFlags=2233(int flags,) set void SetFoldFlags=2233(int flags,)
@@ -1287,13 +1350,27 @@ get bool GetVScrollBar=2281(,)
# Append a string to the end of the document without changing the selection. # Append a string to the end of the document without changing the selection.
fun void AppendText=2282(int length, string text) fun void AppendText=2282(int length, string text)
# Is drawing done in two phases with backgrounds drawn before faoregrounds? # Is drawing done in two phases with backgrounds drawn before foregrounds?
get bool GetTwoPhaseDraw=2283(,) get bool GetTwoPhaseDraw=2283(,)
# In twoPhaseDraw mode, drawing is performed in two phases, first the background # In twoPhaseDraw mode, drawing is performed in two phases, first the background
# and then the foreground. This avoids chopping off characters that overlap the next run. # and then the foreground. This avoids chopping off characters that overlap the next run.
set void SetTwoPhaseDraw=2284(bool twoPhase,) set void SetTwoPhaseDraw=2284(bool twoPhase,)
enu FontQuality=SC_PHASES_
val SC_PHASES_ONE=0
val SC_PHASES_TWO=1
val SC_PHASES_MULTIPLE=2
# How many phases is drawing done in?
get int GetPhasesDraw=2673(,)
# In one phase draw, text is drawn in a series of rectangular blocks with no overlap.
# In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally.
# In multiple phase draw, each element is drawn over the whole drawing area, allowing text
# to overlap from one line to the next.
set void SetPhasesDraw=2674(int phases,)
# Control font anti-aliasing. # Control font anti-aliasing.
enu FontQuality=SC_EFF_ enu FontQuality=SC_EFF_
@@ -1323,6 +1400,7 @@ set void SetMultiPaste=2614(int multiPaste,)
get int GetMultiPaste=2615(,) get int GetMultiPaste=2615(,)
# Retrieve the value of a tag from a regular expression search. # Retrieve the value of a tag from a regular expression search.
# Result is NUL-terminated.
get int GetTag=2616(int tagNumber, stringresult tagValue) get int GetTag=2616(int tagNumber, stringresult tagValue)
# Make the target range start and end be the same as the selection range start and end. # Make the target range start and end be the same as the selection range start and end.
@@ -1624,6 +1702,8 @@ enu Status=SC_STATUS_
val SC_STATUS_OK=0 val SC_STATUS_OK=0
val SC_STATUS_FAILURE=1 val SC_STATUS_FAILURE=1
val SC_STATUS_BADALLOC=2 val SC_STATUS_BADALLOC=2
val SC_STATUS_WARN_START=1000
val SC_STATUS_WARN_REGEX=1001
# Change error status - 0 = OK. # Change error status - 0 = OK.
set void SetStatus=2382(int statusCode,) set void SetStatus=2382(int statusCode,)
@@ -1868,6 +1948,7 @@ get int AutoCGetCurrent=2445(,)
# Get currently selected item text in the auto-completion list # Get currently selected item text in the auto-completion list
# Returns the length of the item text # Returns the length of the item text
# Result is NUL-terminated.
get int AutoCGetCurrentText=2610(, stringresult s) get int AutoCGetCurrentText=2610(, stringresult s)
enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_ enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_
@@ -1880,6 +1961,16 @@ set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,)
# Get auto-completion case insensitive behaviour. # Get auto-completion case insensitive behaviour.
get int AutoCGetCaseInsensitiveBehaviour=2635(,) get int AutoCGetCaseInsensitiveBehaviour=2635(,)
enu MultiAutoComplete=SC_MULTIAUTOC_
val SC_MULTIAUTOC_ONCE=0
val SC_MULTIAUTOC_EACH=1
# Change the effect of autocompleting when there are multiple selections.
set void AutoCSetMulti=2636(int multi,)
# Retrieve the effect of autocompleting when there are multiple selections..
get int AutoCGetMulti=2637(,)
enu Ordering=SC_ORDER_ enu Ordering=SC_ORDER_
val SC_ORDER_PRESORTED=0 val SC_ORDER_PRESORTED=0
val SC_ORDER_PERFORMSORT=1 val SC_ORDER_PERFORMSORT=1
@@ -2007,12 +2098,6 @@ get int GetRangePointer=2643(int position, int rangeLength)
# the range of a call to GetRangePointer. # the range of a call to GetRangePointer.
get position GetGapPosition=2644(,) get position GetGapPosition=2644(,)
# Always interpret keyboard input as Unicode
set void SetKeysUnicode=2521(bool keysUnicode,)
# Are keys always interpreted as Unicode?
get bool GetKeysUnicode=2522(,)
# Set the alpha fill colour of the given indicator. # Set the alpha fill colour of the given indicator.
set void IndicSetAlpha=2523(int indicator, int alpha) set void IndicSetAlpha=2523(int indicator, int alpha)
@@ -2105,6 +2190,7 @@ enu AnnotationVisible=ANNOTATION_
val ANNOTATION_HIDDEN=0 val ANNOTATION_HIDDEN=0
val ANNOTATION_STANDARD=1 val ANNOTATION_STANDARD=1
val ANNOTATION_BOXED=2 val ANNOTATION_BOXED=2
val ANNOTATION_INDENTED=3
# Set the visibility for the annotations for a view # Set the visibility for the annotations for a view
set void AnnotationSetVisible=2548(int visible,) set void AnnotationSetVisible=2548(int visible,)
@@ -2312,6 +2398,8 @@ fun void ScrollToEnd=2629(,)
val SC_TECHNOLOGY_DEFAULT=0 val SC_TECHNOLOGY_DEFAULT=0
val SC_TECHNOLOGY_DIRECTWRITE=1 val SC_TECHNOLOGY_DIRECTWRITE=1
val SC_TECHNOLOGY_DIRECTWRITERETAIN=2
val SC_TECHNOLOGY_DIRECTWRITEDC=3
# Set the technology used. # Set the technology used.
set void SetTechnology=2630(int technology,) set void SetTechnology=2630(int technology,)
@@ -2364,6 +2452,7 @@ get int GetLineEndTypesActive=2658(,)
set void SetRepresentation=2665(string encodedCharacter, string representation) set void SetRepresentation=2665(string encodedCharacter, string representation)
# Set the way a character is drawn. # Set the way a character is drawn.
# Result is NUL-terminated.
get int GetRepresentation=2666(string encodedCharacter, stringresult representation) get int GetRepresentation=2666(string encodedCharacter, stringresult representation)
# Remove a character representation. # Remove a character representation.
@@ -2400,10 +2489,12 @@ set void SetLexerLanguage=4006(, string language)
fun void LoadLexerLibrary=4007(, string path) fun void LoadLexerLibrary=4007(, string path)
# Retrieve a "property" value previously set with SetProperty. # Retrieve a "property" value previously set with SetProperty.
# Result is NUL-terminated.
get int GetProperty=4008(string key, stringresult buf) get int GetProperty=4008(string key, stringresult buf)
# Retrieve a "property" value previously set with SetProperty, # Retrieve a "property" value previously set with SetProperty,
# with "$()" variable replacement on returned buffer. # with "$()" variable replacement on returned buffer.
# Result is NUL-terminated.
get int GetPropertyExpanded=4009(string key, stringresult buf) get int GetPropertyExpanded=4009(string key, stringresult buf)
# Retrieve a "property" value previously set with SetProperty, # Retrieve a "property" value previously set with SetProperty,
@@ -2415,12 +2506,14 @@ get int GetStyleBitsNeeded=4011(,)
# Retrieve the name of the lexer. # Retrieve the name of the lexer.
# Return the length of the text. # Return the length of the text.
# Result is NUL-terminated.
get int GetLexerLanguage=4012(, stringresult text) get int GetLexerLanguage=4012(, stringresult text)
# For private communication between an application and a known lexer. # For private communication between an application and a known lexer.
fun int PrivateLexerCall=4013(int operation, int pointer) fun int PrivateLexerCall=4013(int operation, int pointer)
# Retrieve a '\n' separated list of properties understood by the current lexer. # Retrieve a '\n' separated list of properties understood by the current lexer.
# Result is NUL-terminated.
fun int PropertyNames=4014(, stringresult names) fun int PropertyNames=4014(, stringresult names)
enu TypeProperty=SC_TYPE_ enu TypeProperty=SC_TYPE_
@@ -2432,9 +2525,11 @@ val SC_TYPE_STRING=2
fun int PropertyType=4015(string name,) fun int PropertyType=4015(string name,)
# Describe a property. # Describe a property.
# Result is NUL-terminated.
fun int DescribeProperty=4016(string name, stringresult description) fun int DescribeProperty=4016(string name, stringresult description)
# Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. # Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
# Result is NUL-terminated.
fun int DescribeKeyWordSets=4017(, stringresult descriptions) fun int DescribeKeyWordSets=4017(, stringresult descriptions)
# Bit set of LineEndType enumertion for which line ends beyond the standard # Bit set of LineEndType enumertion for which line ends beyond the standard
@@ -2467,6 +2562,7 @@ set void SetIdentifiers=4024(int style, string identifiers)
get int DistanceToSecondaryStyles=4025(,) get int DistanceToSecondaryStyles=4025(,)
# Get the set of base styles that can be extended with sub styles # Get the set of base styles that can be extended with sub styles
# Result is NUL-terminated.
get int GetSubStyleBases=4026(, stringresult styles) get int GetSubStyleBases=4026(, stringresult styles)
# Notifications # Notifications
@@ -2494,7 +2590,9 @@ val SC_MOD_CHANGEMARGIN=0x10000
val SC_MOD_CHANGEANNOTATION=0x20000 val SC_MOD_CHANGEANNOTATION=0x20000
val SC_MOD_CONTAINER=0x40000 val SC_MOD_CONTAINER=0x40000
val SC_MOD_LEXERSTATE=0x80000 val SC_MOD_LEXERSTATE=0x80000
val SC_MODEVENTMASKALL=0xFFFFF val SC_MOD_INSERTCHECK=0x100000
val SC_MOD_CHANGETABSTOPS=0x200000
val SC_MODEVENTMASKALL=0x3FFFFF
enu Update=SC_UPDATE_ enu Update=SC_UPDATE_
val SC_UPDATE_CONTENT=0x1 val SC_UPDATE_CONTENT=0x1
@@ -2659,6 +2757,12 @@ val SCLEX_KVIRC=110
val SCLEX_RUST=111 val SCLEX_RUST=111
val SCLEX_DMAP=112 val SCLEX_DMAP=112
val SCLEX_AS=113 val SCLEX_AS=113
val SCLEX_DMIS=114
val SCLEX_REGISTRY=115
val SCLEX_BIBTEX=116
val SCLEX_SREC=117
val SCLEX_IHEX=118
val SCLEX_TEHEX=119
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1. # value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -2711,6 +2815,8 @@ val SCE_C_HASHQUOTEDSTRING=22
val SCE_C_PREPROCESSORCOMMENT=23 val SCE_C_PREPROCESSORCOMMENT=23
val SCE_C_PREPROCESSORCOMMENTDOC=24 val SCE_C_PREPROCESSORCOMMENTDOC=24
val SCE_C_USERLITERAL=25 val SCE_C_USERLITERAL=25
val SCE_C_TASKMARKER=26
val SCE_C_ESCAPESEQUENCE=27
# Lexical states for SCLEX_D # Lexical states for SCLEX_D
lex D=SCLEX_D SCE_D_ lex D=SCLEX_D SCE_D_
val SCE_D_DEFAULT=0 val SCE_D_DEFAULT=0
@@ -3537,6 +3643,11 @@ val SCE_V_OPERATOR=10
val SCE_V_IDENTIFIER=11 val SCE_V_IDENTIFIER=11
val SCE_V_STRINGEOL=12 val SCE_V_STRINGEOL=12
val SCE_V_USER=19 val SCE_V_USER=19
val SCE_V_COMMENT_WORD=20
val SCE_V_INPUT=21
val SCE_V_OUTPUT=22
val SCE_V_INOUT=23
val SCE_V_PORT_CONNECT=24
# Lexical states for SCLEX_KIX # Lexical states for SCLEX_KIX
lex Kix=SCLEX_KIX SCE_KIX_ lex Kix=SCLEX_KIX SCE_KIX_
val SCE_KIX_DEFAULT=0 val SCE_KIX_DEFAULT=0
@@ -3549,6 +3660,7 @@ val SCE_KIX_MACRO=6
val SCE_KIX_KEYWORD=7 val SCE_KIX_KEYWORD=7
val SCE_KIX_FUNCTIONS=8 val SCE_KIX_FUNCTIONS=8
val SCE_KIX_OPERATOR=9 val SCE_KIX_OPERATOR=9
val SCE_KIX_COMMENTSTREAM=10
val SCE_KIX_IDENTIFIER=31 val SCE_KIX_IDENTIFIER=31
# Lexical states for SCLEX_GUI4CLI # Lexical states for SCLEX_GUI4CLI
lex Gui4Cli=SCLEX_GUI4CLI SCE_GC_ lex Gui4Cli=SCLEX_GUI4CLI SCE_GC_
@@ -3659,6 +3771,7 @@ val SCE_VHDL_STDFUNCTION=11
val SCE_VHDL_STDPACKAGE=12 val SCE_VHDL_STDPACKAGE=12
val SCE_VHDL_STDTYPE=13 val SCE_VHDL_STDTYPE=13
val SCE_VHDL_USERWORD=14 val SCE_VHDL_USERWORD=14
val SCE_VHDL_BLOCK_COMMENT=15
# Lexical states for SCLEX_CAML # Lexical states for SCLEX_CAML
lex Caml=SCLEX_CAML SCE_CAML_ lex Caml=SCLEX_CAML SCE_CAML_
val SCE_CAML_DEFAULT=0 val SCE_CAML_DEFAULT=0
@@ -3780,6 +3893,7 @@ val SCE_SQL_USER2=20
val SCE_SQL_USER3=21 val SCE_SQL_USER3=21
val SCE_SQL_USER4=22 val SCE_SQL_USER4=22
val SCE_SQL_QUOTEDIDENTIFIER=23 val SCE_SQL_QUOTEDIDENTIFIER=23
val SCE_SQL_QOPERATOR=24
# Lexical states for SCLEX_SMALLTALK # Lexical states for SCLEX_SMALLTALK
lex Smalltalk=SCLEX_SMALLTALK SCE_ST_ lex Smalltalk=SCLEX_SMALLTALK SCE_ST_
val SCE_ST_DEFAULT=0 val SCE_ST_DEFAULT=0
@@ -4425,6 +4539,9 @@ val SCE_RUST_IDENTIFIER=17
val SCE_RUST_LIFETIME=18 val SCE_RUST_LIFETIME=18
val SCE_RUST_MACRO=19 val SCE_RUST_MACRO=19
val SCE_RUST_LEXERROR=20 val SCE_RUST_LEXERROR=20
val SCE_RUST_BYTESTRING=21
val SCE_RUST_BYTESTRINGR=22
val SCE_RUST_BYTECHARACTER=23
# Lexical states for SCLEX_DMAP # Lexical states for SCLEX_DMAP
lex DMAP=SCLEX_DMAP SCE_DMAP_ lex DMAP=SCLEX_DMAP SCE_DMAP_
val SCE_DMAP_DEFAULT=0 val SCE_DMAP_DEFAULT=0
@@ -4438,6 +4555,67 @@ val SCE_DMAP_IDENTIFIER=7
val SCE_DMAP_WORD=8 val SCE_DMAP_WORD=8
val SCE_DMAP_WORD2=9 val SCE_DMAP_WORD2=9
val SCE_DMAP_WORD3=10 val SCE_DMAP_WORD3=10
# Lexical states for SCLEX_DMIS
lex DMIS=SCLEX_DMIS SCE_DMIS_
val SCE_DMIS_DEFAULT=0
val SCE_DMIS_COMMENT=1
val SCE_DMIS_STRING=2
val SCE_DMIS_NUMBER=3
val SCE_DMIS_KEYWORD=4
val SCE_DMIS_MAJORWORD=5
val SCE_DMIS_MINORWORD=6
val SCE_DMIS_UNSUPPORTED_MAJOR=7
val SCE_DMIS_UNSUPPORTED_MINOR=8
val SCE_DMIS_LABEL=9
# Lexical states for SCLEX_REGISTRY
lex REG=SCLEX_REGISTRY SCE_REG_
val SCE_REG_DEFAULT=0
val SCE_REG_COMMENT=1
val SCE_REG_VALUENAME=2
val SCE_REG_STRING=3
val SCE_REG_HEXDIGIT=4
val SCE_REG_VALUETYPE=5
val SCE_REG_ADDEDKEY=6
val SCE_REG_DELETEDKEY=7
val SCE_REG_ESCAPED=8
val SCE_REG_KEYPATH_GUID=9
val SCE_REG_STRING_GUID=10
val SCE_REG_PARAMETER=11
val SCE_REG_OPERATOR=12
# Lexical state for SCLEX_BIBTEX
lex BibTeX=SCLEX_BIBTEX SCE_BIBTEX_
val SCE_BIBTEX_DEFAULT=0
val SCE_BIBTEX_ENTRY=1
val SCE_BIBTEX_UNKNOWN_ENTRY=2
val SCE_BIBTEX_KEY=3
val SCE_BIBTEX_PARAMETER=4
val SCE_BIBTEX_VALUE=5
val SCE_BIBTEX_COMMENT=6
# Lexical state for SCLEX_SREC
lex Srec=SCLEX_SREC SCE_HEX_
val SCE_HEX_DEFAULT=0
val SCE_HEX_RECSTART=1
val SCE_HEX_RECTYPE=2
val SCE_HEX_RECTYPE_UNKNOWN=3
val SCE_HEX_BYTECOUNT=4
val SCE_HEX_BYTECOUNT_WRONG=5
val SCE_HEX_NOADDRESS=6
val SCE_HEX_DATAADDRESS=7
val SCE_HEX_RECCOUNT=8
val SCE_HEX_STARTADDRESS=9
val SCE_HEX_ADDRESSFIELD_UNKNOWN=10
val SCE_HEX_EXTENDEDADDRESS=11
val SCE_HEX_DATA_ODD=12
val SCE_HEX_DATA_EVEN=13
val SCE_HEX_DATA_UNKNOWN=14
val SCE_HEX_DATA_EMPTY=15
val SCE_HEX_CHECKSUM=16
val SCE_HEX_CHECKSUM_WRONG=17
val SCE_HEX_GARBAGE=18
# Lexical state for SCLEX_IHEX (shared with Srec)
lex IHex=SCLEX_IHEX SCE_HEX_
# Lexical state for SCLEX_TEHEX (shared with Srec)
lex TEHex=SCLEX_TEHEX SCE_HEX_
# Events # Events
@@ -4490,3 +4668,11 @@ get bool GetUsePalette=2139(,)
# In palette mode, Scintilla uses the environment's palette calls to display # In palette mode, Scintilla uses the environment's palette calls to display
# more colours. This may lead to ugly displays. # more colours. This may lead to ugly displays.
set void SetUsePalette=2039(bool usePalette,) set void SetUsePalette=2039(bool usePalette,)
# Deprecated in 3.5.5
# Always interpret keyboard input as Unicode
set void SetKeysUnicode=2521(bool keysUnicode,)
# Are keys always interpreted as Unicode?
get bool GetKeysUnicode=2522(,)

View File

@@ -117,20 +117,20 @@ static inline bool IsDoxygenChar (const int ch)
static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler)
{ {
// Used to buffer a string, to be able to compare it using built-in functions // Used to buffer a string, to be able to compare it using built-in functions
char Buffer[100]; char Buffer[100];
// Used to know the length of an operator // Used to know the length of an operator
int OpType; int OpType;
// Get references to keywords lists // Get references to keywords lists
WordList &cpuInstruction = *keywordlists[0]; WordList &cpuInstruction = *keywordlists[0];
WordList &registers = *keywordlists[1]; WordList &registers = *keywordlists[1];
WordList &directive = *keywordlists[2]; WordList &directive = *keywordlists[2];
WordList &extInstruction = *keywordlists[3]; WordList &extInstruction = *keywordlists[3];
WordList &alert = *keywordlists[4]; WordList &alert = *keywordlists[4];
WordList &doxygenKeyword = *keywordlists[5]; WordList &doxygenKeyword = *keywordlists[5];
@@ -140,109 +140,109 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
/************************************************************ /************************************************************
* *
* Parse the source * Parse the source
* *
************************************************************/ ************************************************************/
for ( ; sc.More(); sc.Forward()) for ( ; sc.More(); sc.Forward())
{ {
/************************************************************ /************************************************************
* *
* A style always terminates at the end of a line, even for * A style always terminates at the end of a line, even for
* comments (no multi-lines comments) * comments (no multi-lines comments)
* *
************************************************************/ ************************************************************/
if (sc.atLineStart) { if (sc.atLineStart) {
sc.SetState(SCE_A68K_DEFAULT); sc.SetState(SCE_A68K_DEFAULT);
} }
/************************************************************ /************************************************************
* *
* If we are not in "default style", check if the style continues * If we are not in "default style", check if the style continues
* In this case, we just have to loop * In this case, we just have to loop
* *
************************************************************/ ************************************************************/
if (sc.state != SCE_A68K_DEFAULT) if (sc.state != SCE_A68K_DEFAULT)
{ {
if ( ((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number if ( ((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number
|| ((sc.state == SCE_A68K_NUMBER_BIN) && IsBin(sc.ch)) // Binary number || ((sc.state == SCE_A68K_NUMBER_BIN) && IsBin(sc.ch)) // Binary number
|| ((sc.state == SCE_A68K_NUMBER_HEX) && isxdigit(sc.ch)) // Hexa number || ((sc.state == SCE_A68K_NUMBER_HEX) && isxdigit(sc.ch)) // Hexa number
|| ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument || ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument
|| ((sc.state == SCE_A68K_STRING1) && (sc.ch != '\'')) // String single-quoted || ((sc.state == SCE_A68K_STRING1) && (sc.ch != '\'')) // String single-quoted
|| ((sc.state == SCE_A68K_STRING2) && (sc.ch != '\"')) // String double-quoted || ((sc.state == SCE_A68K_STRING2) && (sc.ch != '\"')) // String double-quoted
|| ((sc.state == SCE_A68K_MACRO_DECLARATION) && IsIdentifierChar(sc.ch)) // Macro declaration (or global label, we don't know at this point) || ((sc.state == SCE_A68K_MACRO_DECLARATION) && IsIdentifierChar(sc.ch)) // Macro declaration (or global label, we don't know at this point)
|| ((sc.state == SCE_A68K_IDENTIFIER) && IsIdentifierChar(sc.ch)) // Identifier || ((sc.state == SCE_A68K_IDENTIFIER) && IsIdentifierChar(sc.ch)) // Identifier
|| ((sc.state == SCE_A68K_LABEL) && IsIdentifierChar(sc.ch)) // Label (local) || ((sc.state == SCE_A68K_LABEL) && IsIdentifierChar(sc.ch)) // Label (local)
|| ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && IsDoxygenChar(sc.ch)) // Doxygen keyword || ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && IsDoxygenChar(sc.ch)) // Doxygen keyword
|| ((sc.state == SCE_A68K_COMMENT_SPECIAL) && isalpha(sc.ch)) // Alert || ((sc.state == SCE_A68K_COMMENT_SPECIAL) && isalpha(sc.ch)) // Alert
|| ((sc.state == SCE_A68K_COMMENT) && !isalpha(sc.ch) && (sc.ch != '\\'))) // Normal comment || ((sc.state == SCE_A68K_COMMENT) && !isalpha(sc.ch) && (sc.ch != '\\'))) // Normal comment
{ {
continue; continue;
} }
/************************************************************ /************************************************************
* *
* Check if current state terminates * Check if current state terminates
* *
************************************************************/ ************************************************************/
// Strings: include terminal ' or " in the current string by skipping it // Strings: include terminal ' or " in the current string by skipping it
if ((sc.state == SCE_A68K_STRING1) || (sc.state == SCE_A68K_STRING2)) { if ((sc.state == SCE_A68K_STRING1) || (sc.state == SCE_A68K_STRING2)) {
sc.Forward(); sc.Forward();
} }
// If a macro declaration was terminated with ':', it was a label // If a macro declaration was terminated with ':', it was a label
else if ((sc.state == SCE_A68K_MACRO_DECLARATION) && (sc.chPrev == ':')) { else if ((sc.state == SCE_A68K_MACRO_DECLARATION) && (sc.chPrev == ':')) {
sc.ChangeState(SCE_A68K_LABEL); sc.ChangeState(SCE_A68K_LABEL);
} }
// If it wasn't a Doxygen keyword, change it to normal comment // If it wasn't a Doxygen keyword, change it to normal comment
else if (sc.state == SCE_A68K_COMMENT_DOXYGEN) { else if (sc.state == SCE_A68K_COMMENT_DOXYGEN) {
sc.GetCurrent(Buffer, sizeof(Buffer)); sc.GetCurrent(Buffer, sizeof(Buffer));
if (!doxygenKeyword.InList(Buffer)) { if (!doxygenKeyword.InList(Buffer)) {
sc.ChangeState(SCE_A68K_COMMENT); sc.ChangeState(SCE_A68K_COMMENT);
} }
sc.SetState(SCE_A68K_COMMENT); sc.SetState(SCE_A68K_COMMENT);
continue; continue;
} }
// If it wasn't an Alert, change it to normal comment // If it wasn't an Alert, change it to normal comment
else if (sc.state == SCE_A68K_COMMENT_SPECIAL) { else if (sc.state == SCE_A68K_COMMENT_SPECIAL) {
sc.GetCurrent(Buffer, sizeof(Buffer)); sc.GetCurrent(Buffer, sizeof(Buffer));
if (!alert.InList(Buffer)) { if (!alert.InList(Buffer)) {
sc.ChangeState(SCE_A68K_COMMENT); sc.ChangeState(SCE_A68K_COMMENT);
} }
// Reset style to normal comment, or to Doxygen keyword if it begins with '\' // Reset style to normal comment, or to Doxygen keyword if it begins with '\'
if (sc.ch == '\\') { if (sc.ch == '\\') {
sc.SetState(SCE_A68K_COMMENT_DOXYGEN); sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
} }
else { else {
sc.SetState(SCE_A68K_COMMENT); sc.SetState(SCE_A68K_COMMENT);
} }
continue; continue;
} }
// If we are in a comment, it's a Doxygen keyword or an Alert // If we are in a comment, it's a Doxygen keyword or an Alert
else if (sc.state == SCE_A68K_COMMENT) { else if (sc.state == SCE_A68K_COMMENT) {
if (sc.ch == '\\') { if (sc.ch == '\\') {
sc.SetState(SCE_A68K_COMMENT_DOXYGEN); sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
} }
else { else {
sc.SetState(SCE_A68K_COMMENT_SPECIAL); sc.SetState(SCE_A68K_COMMENT_SPECIAL);
} }
continue; continue;
} }
// Check if we are at the end of an identifier // Check if we are at the end of an identifier
// In this case, colourise it if was a keyword. // In this case, colourise it if was a keyword.
else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) { else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) {
sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context
if (cpuInstruction.InList(Buffer)) { // And check if it belongs to a keyword list if (cpuInstruction.InList(Buffer)) { // And check if it belongs to a keyword list
sc.ChangeState(SCE_A68K_CPUINSTRUCTION); sc.ChangeState(SCE_A68K_CPUINSTRUCTION);
@@ -269,30 +269,30 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
* *
************************************************************/ ************************************************************/
// Something which begins at the beginning of a line, and with // Something which begins at the beginning of a line, and with
// - '\' + an identifier start char, or // - '\' + an identifier start char, or
// - '\\@' + an identifier start char // - '\\@' + an identifier start char
// is a local label (second case is used for macro local labels). We set it already as a label, it can't be a macro/equ declaration // is a local label (second case is used for macro local labels). We set it already as a label, it can't be a macro/equ declaration
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.chNext) && (sc.ch == '\\')) { if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.chNext) && (sc.ch == '\\')) {
sc.SetState(SCE_A68K_LABEL); sc.SetState(SCE_A68K_LABEL);
} }
if (sc.atLineStart && (sc.ch < 0x80) && (sc.ch == '\\') && (sc.chNext == '\\')) { if (sc.atLineStart && (sc.ch < 0x80) && (sc.ch == '\\') && (sc.chNext == '\\')) {
sc.Forward(2); sc.Forward(2);
if ((sc.ch == '@') && IsIdentifierStart(sc.chNext)) { if ((sc.ch == '@') && IsIdentifierStart(sc.chNext)) {
sc.ChangeState(SCE_A68K_LABEL); sc.ChangeState(SCE_A68K_LABEL);
sc.SetState(SCE_A68K_LABEL); sc.SetState(SCE_A68K_LABEL);
} }
} }
// Label and macro identifiers start at the beginning of a line // Label and macro identifiers start at the beginning of a line
// We set both as a macro id, but if it wasn't one (':' at the end), // We set both as a macro id, but if it wasn't one (':' at the end),
// it will be changed as a label. // it will be changed as a label.
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) {
sc.SetState(SCE_A68K_MACRO_DECLARATION); sc.SetState(SCE_A68K_MACRO_DECLARATION);
} }
else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Default: alert in a comment. If it doesn't match else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Default: alert in a comment. If it doesn't match
sc.SetState(SCE_A68K_COMMENT); // with an alert, it will be toggle to a normal comment sc.SetState(SCE_A68K_COMMENT); // with an alert, it will be toggle to a normal comment
} }
else if ((sc.ch < 0x80) && isdigit(sc.ch)) { // Decimal numbers haven't prefix else if ((sc.ch < 0x80) && isdigit(sc.ch)) { // Decimal numbers haven't prefix
sc.SetState(SCE_A68K_NUMBER_DEC); sc.SetState(SCE_A68K_NUMBER_DEC);
@@ -309,7 +309,7 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle,
else if ((sc.ch < 0x80) && (sc.ch == '\"')) { // String (double-quoted) else if ((sc.ch < 0x80) && (sc.ch == '\"')) { // String (double-quoted)
sc.SetState(SCE_A68K_STRING2); sc.SetState(SCE_A68K_STRING2);
} }
else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro are prefixed with '\' else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro are prefixed with '\'
sc.SetState(SCE_A68K_MACRO_ARG); sc.SetState(SCE_A68K_MACRO_ARG);
} }
else if ((sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { // An identifier: constant, label, etc... else if ((sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { // An identifier: constant, label, etc...

View File

@@ -419,8 +419,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
sc.Forward(); sc.Forward();
HereDoc.Quoted = true; HereDoc.Quoted = true;
HereDoc.State = 1; HereDoc.State = 1;
} else if (!HereDoc.Indent && sc.chNext == '-') { // <<- indent case
HereDoc.Indent = true;
} else if (setHereDoc.Contains(sc.chNext)) { } else if (setHereDoc.Contains(sc.chNext)) {
// an unquoted here-doc delimiter, no special handling // an unquoted here-doc delimiter, no special handling
// TODO check what exactly bash considers part of the delim // TODO check what exactly bash considers part of the delim
@@ -469,7 +467,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
if (sc.atLineStart) { if (sc.atLineStart) {
sc.SetState(SCE_SH_HERE_Q); sc.SetState(SCE_SH_HERE_Q);
int prefixws = 0; int prefixws = 0;
while (IsASpace(sc.ch) && !sc.atLineEnd) { // whitespace prefix while (sc.ch == '\t' && !sc.atLineEnd) { // tabulation prefix
sc.Forward(); sc.Forward();
prefixws++; prefixws++;
} }
@@ -481,7 +479,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
char s[HERE_DELIM_MAX]; char s[HERE_DELIM_MAX];
sc.GetCurrent(s, sizeof(s)); sc.GetCurrent(s, sizeof(s));
if (sc.LengthCurrent() == 0) { // '' or "" delimiters if (sc.LengthCurrent() == 0) { // '' or "" delimiters
if (prefixws == 0 && HereDoc.Quoted && HereDoc.DelimiterLength == 0) if ((prefixws == 0 || HereDoc.Indent) &&
HereDoc.Quoted && HereDoc.DelimiterLength == 0)
sc.SetState(SCE_SH_DEFAULT); sc.SetState(SCE_SH_DEFAULT);
break; break;
} }
@@ -672,7 +671,12 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
} else if (sc.Match('<', '<')) { } else if (sc.Match('<', '<')) {
sc.SetState(SCE_SH_HERE_DELIM); sc.SetState(SCE_SH_HERE_DELIM);
HereDoc.State = 0; HereDoc.State = 0;
HereDoc.Indent = false; if (sc.GetRelative(2) == '-') { // <<- indent case
HereDoc.Indent = true;
sc.Forward();
} else {
HereDoc.Indent = false;
}
} else if (sc.ch == '-' && // one-char file test operators } else if (sc.ch == '-' && // one-char file test operators
setSingleCharOp.Contains(sc.chNext) && setSingleCharOp.Contains(sc.chNext) &&
!setWord.Contains(sc.GetRelative(2)) && !setWord.Contains(sc.GetRelative(2)) &&
@@ -767,6 +771,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int visibleChars = 0; int visibleChars = 0;
int skipHereCh = 0;
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev; int levelCurrent = levelPrev;
@@ -798,7 +803,15 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
// Here Document folding // Here Document folding
if (style == SCE_SH_HERE_DELIM) { if (style == SCE_SH_HERE_DELIM) {
if (ch == '<' && chNext == '<') { if (ch == '<' && chNext == '<') {
levelCurrent++; if (styler.SafeGetCharAt(i + 2) == '<') {
skipHereCh = 1;
} else {
if (skipHereCh == 0) {
levelCurrent++;
} else {
skipHereCh = 0;
}
}
} }
} else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) { } else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) {
levelCurrent--; levelCurrent--;

View File

@@ -0,0 +1,310 @@
// Copyright 2008-2010 Sergiu Dotenco. The License.txt file describes the
// conditions under which this software may be distributed.
/**
* @file LexBibTeX.cxx
* @brief General BibTeX coloring scheme.
* @author Sergiu Dotenco
* @date April 18, 2009
*/
#include <stdlib.h>
#include <string.h>
#include <cassert>
#include <cctype>
#include <string>
#include <algorithm>
#include <functional>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "PropSetSimple.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
namespace {
bool IsAlphabetic(unsigned int ch)
{
return IsASCII(ch) && std::isalpha(ch) != 0;
}
bool IsAlphaNumeric(char ch)
{
return IsASCII(ch) && std::isalnum(ch);
}
bool EqualCaseInsensitive(const char* a, const char* b)
{
return CompareCaseInsensitive(a, b) == 0;
}
bool EntryWithoutKey(const char* name)
{
return EqualCaseInsensitive(name,"string");
}
char GetClosingBrace(char openbrace)
{
char result = openbrace;
switch (openbrace) {
case '(': result = ')'; break;
case '{': result = '}'; break;
}
return result;
}
bool IsEntryStart(char prev, char ch)
{
return prev != '\\' && ch == '@';
}
bool IsEntryStart(const StyleContext& sc)
{
return IsEntryStart(sc.chPrev, sc.ch);
}
void ColorizeBibTeX(unsigned start_pos, int length, int /*init_style*/, WordList* keywordlists[], Accessor& styler)
{
WordList &EntryNames = *keywordlists[0];
bool fold_compact = styler.GetPropertyInt("fold.compact", 1) != 0;
std::string buffer;
buffer.reserve(25);
// We always colorize a section from the beginning, so let's
// search for the @ character which isn't escaped, i.e. \@
while (start_pos > 0 && !IsEntryStart(styler.SafeGetCharAt(start_pos - 1),
styler.SafeGetCharAt(start_pos))) {
--start_pos; ++length;
}
styler.StartAt(start_pos);
styler.StartSegment(start_pos);
int current_line = styler.GetLine(start_pos);
int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK;
int current_level = prev_level;
int visible_chars = 0;
bool in_comment = false ;
StyleContext sc(start_pos, length, SCE_BIBTEX_DEFAULT, styler);
bool going = sc.More(); // needed because of a fuzzy end of file state
char closing_brace = 0;
bool collect_entry_name = false;
for (; going; sc.Forward()) {
if (!sc.More())
going = false; // we need to go one behind the end of text
if (in_comment) {
if (sc.atLineEnd) {
sc.SetState(SCE_BIBTEX_DEFAULT);
in_comment = false;
}
}
else {
// Found @entry
if (IsEntryStart(sc)) {
sc.SetState(SCE_BIBTEX_UNKNOWN_ENTRY);
sc.Forward();
++current_level;
buffer.clear();
collect_entry_name = true;
}
else if ((sc.state == SCE_BIBTEX_ENTRY || sc.state == SCE_BIBTEX_UNKNOWN_ENTRY)
&& (sc.ch == '{' || sc.ch == '(')) {
// Entry name colorization done
// Found either a { or a ( after entry's name, e.g. @entry(...) @entry{...}
// Closing counterpart needs to be stored.
closing_brace = GetClosingBrace(sc.ch);
sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize { (
// @string doesn't have any key
if (EntryWithoutKey(buffer.c_str()))
sc.ForwardSetState(SCE_BIBTEX_PARAMETER);
else
sc.ForwardSetState(SCE_BIBTEX_KEY); // Key/label colorization
}
// Need to handle the case where entry's key is empty
// e.g. @book{,...}
if (sc.state == SCE_BIBTEX_KEY && sc.ch == ',') {
// Key/label colorization done
sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the ,
sc.ForwardSetState(SCE_BIBTEX_PARAMETER); // Parameter colorization
}
else if (sc.state == SCE_BIBTEX_PARAMETER && sc.ch == '=') {
sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the =
sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization
int start = sc.currentPos;
// We need to handle multiple situations:
// 1. name"one two {three}"
// 2. name={one {one two {two}} three}
// 3. year=2005
// Skip ", { until we encounter the first alphanumerical character
while (sc.More() && !(IsAlphaNumeric(sc.ch) || sc.ch == '"' || sc.ch == '{'))
sc.Forward();
if (sc.More()) {
// Store " or {
char ch = sc.ch;
// Not interested in alphanumerical characters
if (IsAlphaNumeric(ch))
ch = 0;
int skipped = 0;
if (ch) {
// Skip preceding " or { such as in name={{test}}.
// Remember how many characters have been skipped
// Make sure that empty values, i.e. "" are also handled correctly
while (sc.More() && (sc.ch == ch && (ch != '"' || skipped < 1))) {
sc.Forward();
++skipped;
}
}
// Closing counterpart for " is the same character
if (ch == '{')
ch = '}';
// We have reached the parameter value
// In case the open character was a alnum char, skip until , is found
// otherwise until skipped == 0
while (sc.More() && (skipped > 0 || (!ch && !(sc.ch == ',' || sc.ch == closing_brace)))) {
// Make sure the character isn't escaped
if (sc.chPrev != '\\') {
// Parameter value contains a { which is the 2nd case described above
if (sc.ch == '{')
++skipped; // Remember it
else if (sc.ch == '}')
--skipped;
else if (skipped == 1 && sc.ch == ch && ch == '"') // Don't ignore cases like {"o}
skipped = 0;
}
sc.Forward();
}
}
// Don't colorize the ,
sc.SetState(SCE_BIBTEX_DEFAULT);
// Skip until the , or entry's closing closing_brace is found
// since this parameter might be the last one
while (sc.More() && !(sc.ch == ',' || sc.ch == closing_brace))
sc.Forward();
int state = SCE_BIBTEX_PARAMETER; // The might be more parameters
// We've reached the closing closing_brace for the bib entry
// in case no " or {} has been used to enclose the value,
// as in 3rd case described above
if (sc.ch == closing_brace) {
--current_level;
// Make sure the text between entries is not colored
// using parameter's style
state = SCE_BIBTEX_DEFAULT;
}
int end = sc.currentPos;
current_line = styler.GetLine(end);
// We have possibly skipped some lines, so the folding levels
// have to be adjusted separately
for (int i = styler.GetLine(start); i <= styler.GetLine(end); ++i)
styler.SetLevel(i, prev_level);
sc.ForwardSetState(state);
}
if (sc.state == SCE_BIBTEX_PARAMETER && sc.ch == closing_brace) {
sc.SetState(SCE_BIBTEX_DEFAULT);
--current_level;
}
// Non escaped % found which represents a comment until the end of the line
if (sc.chPrev != '\\' && sc.ch == '%') {
in_comment = true;
sc.SetState(SCE_BIBTEX_COMMENT);
}
}
if (sc.state == SCE_BIBTEX_UNKNOWN_ENTRY || sc.state == SCE_BIBTEX_ENTRY) {
if (!IsAlphabetic(sc.ch) && collect_entry_name)
collect_entry_name = false;
if (collect_entry_name) {
buffer += static_cast<char>(tolower(sc.ch));
if (EntryNames.InList(buffer.c_str()))
sc.ChangeState(SCE_BIBTEX_ENTRY);
else
sc.ChangeState(SCE_BIBTEX_UNKNOWN_ENTRY);
}
}
if (sc.atLineEnd) {
int level = prev_level;
if (visible_chars == 0 && fold_compact)
level |= SC_FOLDLEVELWHITEFLAG;
if ((current_level > prev_level))
level |= SC_FOLDLEVELHEADERFLAG;
// else if (current_level < prev_level)
// level |= SC_FOLDLEVELBOXFOOTERFLAG; // Deprecated
if (level != styler.LevelAt(current_line)) {
styler.SetLevel(current_line, level);
}
++current_line;
prev_level = current_level;
visible_chars = 0;
}
if (!isspacechar(sc.ch))
++visible_chars;
}
sc.Complete();
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(current_line) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(current_line, prev_level | flagsNext);
}
}
static const char * const BibTeXWordLists[] = {
"Entry Names",
0,
};
LexerModule lmBibTeX(SCLEX_BIBTEX, ColorizeBibTeX, "bib", 0, BibTeXWordLists);
// Entry Names
// article, book, booklet, conference, inbook,
// incollection, inproceedings, manual, mastersthesis,
// misc, phdthesis, proceedings, techreport, unpublished,
// string, url

View File

@@ -8,10 +8,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <string> #include <string>
#include <vector> #include <vector>
@@ -36,7 +36,10 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
static bool IsSpaceEquiv(int state) { namespace {
// Use an unnamed namespace to protect the functions and classes from name conflicts
bool IsSpaceEquiv(int state) {
return (state <= SCE_C_COMMENTDOC) || return (state <= SCE_C_COMMENTDOC) ||
// including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
(state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) || (state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) ||
@@ -50,7 +53,7 @@ static bool IsSpaceEquiv(int state) {
// a = b+++/ptn/... // a = b+++/ptn/...
// Putting a space between the '++' post-inc operator and the '+' binary op // Putting a space between the '++' post-inc operator and the '+' binary op
// fixes this, and is highly recommended for readability anyway. // fixes this, and is highly recommended for readability anyway.
static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
int pos = (int) sc.currentPos; int pos = (int) sc.currentPos;
while (--pos > 0) { while (--pos > 0) {
char ch = styler[pos]; char ch = styler[pos];
@@ -61,7 +64,7 @@ static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
return false; return false;
} }
static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
// Don't look at styles, so no need to flush. // Don't look at styles, so no need to flush.
int pos = (int) sc.currentPos; int pos = (int) sc.currentPos;
int currentLine = styler.GetLine(pos); int currentLine = styler.GetLine(pos);
@@ -83,7 +86,120 @@ static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
return !*s; return !*s;
} }
static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) { bool IsSpaceOrTab(int ch) {
return ch == ' ' || ch == '\t';
}
bool OnlySpaceOrTab(const std::string &s) {
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
if (!IsSpaceOrTab(*it))
return false;
}
return true;
}
std::vector<std::string> StringSplit(const std::string &text, int separator) {
std::vector<std::string> vs(text.empty() ? 0 : 1);
for (std::string::const_iterator it = text.begin(); it != text.end(); ++it) {
if (*it == separator) {
vs.push_back(std::string());
} else {
vs.back() += *it;
}
}
return vs;
}
struct BracketPair {
std::vector<std::string>::iterator itBracket;
std::vector<std::string>::iterator itEndBracket;
};
BracketPair FindBracketPair(std::vector<std::string> &tokens) {
BracketPair bp;
std::vector<std::string>::iterator itTok = std::find(tokens.begin(), tokens.end(), "(");
bp.itBracket = tokens.end();
bp.itEndBracket = tokens.end();
if (itTok != tokens.end()) {
bp.itBracket = itTok;
size_t nest = 0;
while (itTok != tokens.end()) {
if (*itTok == "(") {
nest++;
} else if (*itTok == ")") {
nest--;
if (nest == 0) {
bp.itEndBracket = itTok;
return bp;
}
}
++itTok;
}
}
bp.itBracket = tokens.end();
return bp;
}
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
int activity, WordList &markerList, bool caseSensitive){
if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) {
const int lengthMarker = 50;
char marker[lengthMarker+1];
int currPos = (int) sc.currentPos;
int i = 0;
while (i < lengthMarker) {
char ch = styler.SafeGetCharAt(currPos + i);
if (IsASpace(ch) || isoperator(ch)) {
break;
}
if (caseSensitive)
marker[i] = ch;
else
marker[i] = static_cast<char>(tolower(ch));
i++;
}
marker[i] = '\0';
if (markerList.InList(marker)) {
sc.SetState(SCE_C_TASKMARKER|activity);
}
}
}
struct EscapeSequence {
int digitsLeft;
CharacterSet setHexDigits;
CharacterSet setOctDigits;
CharacterSet setNoneNumeric;
CharacterSet *escapeSetValid;
EscapeSequence() {
digitsLeft = 0;
escapeSetValid = 0;
setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef");
setOctDigits = CharacterSet(CharacterSet::setNone, "01234567");
}
void resetEscapeState(int nextChar) {
digitsLeft = 0;
escapeSetValid = &setNoneNumeric;
if (nextChar == 'U') {
digitsLeft = 9;
escapeSetValid = &setHexDigits;
} else if (nextChar == 'u') {
digitsLeft = 5;
escapeSetValid = &setHexDigits;
} else if (nextChar == 'x') {
digitsLeft = 5;
escapeSetValid = &setHexDigits;
} else if (setOctDigits.Contains(nextChar)) {
digitsLeft = 3;
escapeSetValid = &setOctDigits;
}
}
bool atEscapeEnd(int currChar) const {
return (digitsLeft <= 0) || !escapeSetValid->Contains(currChar);
}
};
std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
std::string restOfLine; std::string restOfLine;
int i =0; int i =0;
char ch = styler.SafeGetCharAt(start, '\n'); char ch = styler.SafeGetCharAt(start, '\n');
@@ -100,40 +216,21 @@ static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace
return restOfLine; return restOfLine;
} }
static bool IsStreamCommentStyle(int style) { bool IsStreamCommentStyle(int style) {
return style == SCE_C_COMMENT || return style == SCE_C_COMMENT ||
style == SCE_C_COMMENTDOC || style == SCE_C_COMMENTDOC ||
style == SCE_C_COMMENTDOCKEYWORD || style == SCE_C_COMMENTDOCKEYWORD ||
style == SCE_C_COMMENTDOCKEYWORDERROR; style == SCE_C_COMMENTDOCKEYWORDERROR;
} }
static std::vector<std::string> Tokenize(const std::string &s) {
// Break into space separated tokens
std::string word;
std::vector<std::string> tokens;
for (const char *cp = s.c_str(); *cp; cp++) {
if ((*cp == ' ') || (*cp == '\t')) {
if (!word.empty()) {
tokens.push_back(word);
word = "";
}
} else {
word += *cp;
}
}
if (!word.empty()) {
tokens.push_back(word);
}
return tokens;
}
struct PPDefinition { struct PPDefinition {
int line; int line;
std::string key; std::string key;
std::string value; std::string value;
bool isUndef; bool isUndef;
PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false) : std::string arguments;
line(line_), key(key_), value(value_), isUndef(isUndef_) { PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {
} }
}; };
@@ -209,8 +306,11 @@ struct OptionsCPP {
bool identifiersAllowDollars; bool identifiersAllowDollars;
bool trackPreprocessor; bool trackPreprocessor;
bool updatePreprocessor; bool updatePreprocessor;
bool verbatimStringsAllowEscapes;
bool triplequotedStrings; bool triplequotedStrings;
bool hashquotedStrings; bool hashquotedStrings;
bool backQuotedStrings;
bool escapeSequence;
bool fold; bool fold;
bool foldSyntaxBased; bool foldSyntaxBased;
bool foldComment; bool foldComment;
@@ -227,8 +327,11 @@ struct OptionsCPP {
identifiersAllowDollars = true; identifiersAllowDollars = true;
trackPreprocessor = true; trackPreprocessor = true;
updatePreprocessor = true; updatePreprocessor = true;
verbatimStringsAllowEscapes = false;
triplequotedStrings = false; triplequotedStrings = false;
hashquotedStrings = false; hashquotedStrings = false;
backQuotedStrings = false;
escapeSequence = false;
fold = false; fold = false;
foldSyntaxBased = true; foldSyntaxBased = true;
foldComment = false; foldComment = false;
@@ -243,12 +346,13 @@ struct OptionsCPP {
} }
}; };
static const char *const cppWordLists[] = { const char *const cppWordLists[] = {
"Primary keywords and identifiers", "Primary keywords and identifiers",
"Secondary keywords and identifiers", "Secondary keywords and identifiers",
"Documentation comment keywords", "Documentation comment keywords",
"Global classes and typedefs", "Global classes and typedefs",
"Preprocessor definitions", "Preprocessor definitions",
"Task marker and error marker keywords",
0, 0,
}; };
@@ -268,12 +372,21 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor, DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor,
"Set to 1 to update preprocessor definitions when #define found."); "Set to 1 to update preprocessor definitions when #define found.");
DefineProperty("lexer.cpp.verbatim.strings.allow.escapes", &OptionsCPP::verbatimStringsAllowEscapes,
"Set to 1 to allow verbatim strings to contain escape sequences.");
DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings, DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings,
"Set to 1 to enable highlighting of triple-quoted strings."); "Set to 1 to enable highlighting of triple-quoted strings.");
DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings, DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings,
"Set to 1 to enable highlighting of hash-quoted strings."); "Set to 1 to enable highlighting of hash-quoted strings.");
DefineProperty("lexer.cpp.backquoted.strings", &OptionsCPP::backQuotedStrings,
"Set to 1 to enable highlighting of back-quoted raw strings .");
DefineProperty("lexer.cpp.escape.sequence", &OptionsCPP::escapeSequence,
"Set to 1 to enable highlighting of escape sequences in strings");
DefineProperty("fold", &OptionsCPP::fold); DefineProperty("fold", &OptionsCPP::fold);
DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased, DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased,
@@ -312,7 +425,9 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
} }
}; };
static const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0}; const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0};
}
class LexerCPP : public ILexerWithSubStyles { class LexerCPP : public ILexerWithSubStyles {
bool caseSensitive; bool caseSensitive;
@@ -321,6 +436,7 @@ class LexerCPP : public ILexerWithSubStyles {
CharacterSet setArithmethicOp; CharacterSet setArithmethicOp;
CharacterSet setRelOp; CharacterSet setRelOp;
CharacterSet setLogicalOp; CharacterSet setLogicalOp;
CharacterSet setWordStart;
PPStates vlls; PPStates vlls;
std::vector<PPDefinition> ppDefineHistory; std::vector<PPDefinition> ppDefineHistory;
WordList keywords; WordList keywords;
@@ -328,9 +444,26 @@ class LexerCPP : public ILexerWithSubStyles {
WordList keywords3; WordList keywords3;
WordList keywords4; WordList keywords4;
WordList ppDefinitions; WordList ppDefinitions;
std::map<std::string, std::string> preprocessorDefinitionsStart; WordList markerList;
struct SymbolValue {
std::string value;
std::string arguments;
SymbolValue(const std::string &value_="", const std::string &arguments_="") : value(value_), arguments(arguments_) {
}
SymbolValue &operator = (const std::string &value_) {
value = value_;
arguments.clear();
return *this;
}
bool IsMacro() const {
return !arguments.empty();
}
};
typedef std::map<std::string, SymbolValue> SymbolTable;
SymbolTable preprocessorDefinitionsStart;
OptionsCPP options; OptionsCPP options;
OptionSetCPP osCPP; OptionSetCPP osCPP;
EscapeSequence escapeSeq;
SparseState<std::string> rawStringTerminators; SparseState<std::string> rawStringTerminators;
enum { activeFlag = 0x40 }; enum { activeFlag = 0x40 };
enum { ssIdentifier, ssDocKeyword }; enum { ssIdentifier, ssDocKeyword };
@@ -394,7 +527,7 @@ public:
} }
int SCI_METHOD PrimaryStyleFromStyle(int style) { int SCI_METHOD PrimaryStyleFromStyle(int style) {
return MaskActive(style); return MaskActive(style);
} }
void SCI_METHOD FreeSubStyles() { void SCI_METHOD FreeSubStyles() {
subStyles.Free(); subStyles.Free();
} }
@@ -417,8 +550,9 @@ public:
static int MaskActive(int style) { static int MaskActive(int style) {
return style & ~activeFlag; return style & ~activeFlag;
} }
void EvaluateTokens(std::vector<std::string> &tokens); void EvaluateTokens(std::vector<std::string> &tokens, const SymbolTable &preprocessorDefinitions);
bool EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions); std::vector<std::string> Tokenize(const std::string &expr) const;
bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions);
}; };
int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
@@ -452,6 +586,9 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
case 4: case 4:
wordListN = &ppDefinitions; wordListN = &ppDefinitions;
break; break;
case 5:
wordListN = &markerList;
break;
} }
int firstModification = -1; int firstModification = -1;
if (wordListN) { if (wordListN) {
@@ -469,7 +606,16 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
if (cpEquals) { if (cpEquals) {
std::string name(cpDefinition, cpEquals - cpDefinition); std::string name(cpDefinition, cpEquals - cpDefinition);
std::string val(cpEquals+1); std::string val(cpEquals+1);
preprocessorDefinitionsStart[name] = val; size_t bracket = name.find('(');
size_t bracketEnd = name.find(')');
if ((bracket != std::string::npos) && (bracketEnd != std::string::npos)) {
// Macro
std::string args = name.substr(bracket + 1, bracketEnd - bracket - 1);
name = name.substr(0, bracket);
preprocessorDefinitionsStart[name] = SymbolValue(val, args);
} else {
preprocessorDefinitionsStart[name] = val;
}
} else { } else {
std::string name(cpDefinition); std::string name(cpDefinition);
std::string val("1"); std::string val("1");
@@ -499,7 +645,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\t\v\f\n"); CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\t\v\f\n");
@@ -511,6 +657,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
int visibleChars = 0; int visibleChars = 0;
bool lastWordWasUUID = false; bool lastWordWasUUID = false;
int styleBeforeDCKeyword = SCE_C_DEFAULT; int styleBeforeDCKeyword = SCE_C_DEFAULT;
int styleBeforeTaskMarker = SCE_C_DEFAULT;
bool continuationLine = false; bool continuationLine = false;
bool isIncludePreprocessor = false; bool isIncludePreprocessor = false;
bool isStringInPreprocessor = false; bool isStringInPreprocessor = false;
@@ -540,7 +687,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} }
} }
StyleContext sc(startPos, length, initStyle, styler, static_cast<char>(0xff)); StyleContext sc(startPos, length, initStyle, styler, static_cast<unsigned char>(0xff));
LinePPState preproc = vlls.ForLine(lineCurrent); LinePPState preproc = vlls.ForLine(lineCurrent);
bool definitionsChanged = false; bool definitionsChanged = false;
@@ -556,12 +703,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
definitionsChanged = true; definitionsChanged = true;
} }
std::map<std::string, std::string> preprocessorDefinitions = preprocessorDefinitionsStart; SymbolTable preprocessorDefinitions = preprocessorDefinitionsStart;
for (std::vector<PPDefinition>::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) { for (std::vector<PPDefinition>::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) {
if (itDef->isUndef) if (itDef->isUndef)
preprocessorDefinitions.erase(itDef->key); preprocessorDefinitions.erase(itDef->key);
else else
preprocessorDefinitions[itDef->key] = itDef->value; preprocessorDefinitions[itDef->key] = SymbolValue(itDef->value, itDef->arguments);
} }
std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1); std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1);
@@ -581,13 +728,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// Inside inactive preprocessor declaration, state will be reset anyway at the end of this block. // Inside inactive preprocessor declaration, state will be reset anyway at the end of this block.
if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) { if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) {
// Prevent SCE_C_STRINGEOL from leaking back to previous line which // Prevent SCE_C_STRINGEOL from leaking back to previous line which
// ends with a line continuation by locking in the state upto this position. // ends with a line continuation by locking in the state up to this position.
sc.SetState(sc.state); sc.SetState(sc.state);
} }
if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) { if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) {
sc.SetState(SCE_C_DEFAULT|activitySet); sc.SetState(SCE_C_DEFAULT|activitySet);
} }
// Reset states to begining of colourise so no surprises // Reset states to beginning of colourise so no surprises
// if different sets of lines lexed. // if different sets of lines lexed.
visibleChars = 0; visibleChars = 0;
lastWordWasUUID = false; lastWordWasUUID = false;
@@ -679,10 +826,18 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) || ((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8')); ((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
if (valid) { if (valid) {
if (literalString) if (literalString) {
sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet); if (raw) {
else // Set the style of the string prefix to SCE_C_STRINGRAW but then change to
// SCE_C_DEFAULT as that allows the raw string start code to run.
sc.ChangeState(SCE_C_STRINGRAW|activitySet);
sc.SetState(SCE_C_DEFAULT|activitySet);
} else {
sc.ChangeState(SCE_C_STRING|activitySet);
}
} else {
sc.ChangeState(SCE_C_CHARACTER|activitySet); sc.ChangeState(SCE_C_CHARACTER|activitySet);
}
} else { } else {
sc.SetState(SCE_C_DEFAULT | activitySet); sc.SetState(SCE_C_DEFAULT | activitySet);
} }
@@ -725,6 +880,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
if (sc.Match('*', '/')) { if (sc.Match('*', '/')) {
sc.Forward(); sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT|activitySet); sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
} else {
styleBeforeTaskMarker = SCE_C_COMMENT;
highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive);
} }
break; break;
case SCE_C_COMMENTDOC: case SCE_C_COMMENTDOC:
@@ -742,6 +900,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
case SCE_C_COMMENTLINE: case SCE_C_COMMENTLINE:
if (sc.atLineStart && !continuationLine) { if (sc.atLineStart && !continuationLine) {
sc.SetState(SCE_C_DEFAULT|activitySet); sc.SetState(SCE_C_DEFAULT|activitySet);
} else {
styleBeforeTaskMarker = SCE_C_COMMENTLINE;
highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive);
} }
break; break;
case SCE_C_COMMENTLINEDOC: case SCE_C_COMMENTLINEDOC:
@@ -794,9 +955,11 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
isIncludePreprocessor = false; isIncludePreprocessor = false;
} }
} else if (sc.ch == '\\') { } else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { if (options.escapeSequence) {
sc.Forward(); sc.SetState(SCE_C_ESCAPESEQUENCE|activitySet);
escapeSeq.resetEscapeState(sc.chNext);
} }
sc.Forward(); // Skip all characters after the backslash
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
if (sc.chNext == '_') { if (sc.chNext == '_') {
sc.ChangeState(SCE_C_USERLITERAL|activitySet); sc.ChangeState(SCE_C_USERLITERAL|activitySet);
@@ -805,6 +968,24 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} }
} }
break; break;
case SCE_C_ESCAPESEQUENCE:
escapeSeq.digitsLeft--;
if (!escapeSeq.atEscapeEnd(sc.ch)) {
break;
}
if (sc.ch == '"') {
sc.SetState(SCE_C_STRING|activitySet);
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
} else if (sc.ch == '\\') {
escapeSeq.resetEscapeState(sc.chNext);
sc.Forward();
} else {
sc.SetState(SCE_C_STRING|activitySet);
if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL|activitySet);
}
}
break;
case SCE_C_HASHQUOTEDSTRING: case SCE_C_HASHQUOTEDSTRING:
if (sc.ch == '\\') { if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
@@ -860,7 +1041,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} }
break; break;
case SCE_C_VERBATIM: case SCE_C_VERBATIM:
if (sc.ch == '\"') { if (options.verbatimStringsAllowEscapes && (sc.ch == '\\')) {
sc.Forward(); // Skip all characters after the backslash
} else if (sc.ch == '\"') {
if (sc.chNext == '\"') { if (sc.chNext == '\"') {
sc.Forward(); sc.Forward();
} else { } else {
@@ -880,6 +1063,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
if (sc.atLineEnd || sc.ch == ')') { if (sc.atLineEnd || sc.ch == ')') {
sc.SetState(SCE_C_DEFAULT|activitySet); sc.SetState(SCE_C_DEFAULT|activitySet);
} }
break;
case SCE_C_TASKMARKER:
if (isoperator(sc.ch) || IsASpace(sc.ch)) {
sc.SetState(styleBeforeTaskMarker|activitySet);
styleBeforeTaskMarker = SCE_C_DEFAULT;
}
} }
if (sc.atLineEnd && !atLineEndBeforeSwitch) { if (sc.atLineEnd && !atLineEndBeforeSwitch) {
@@ -900,6 +1089,10 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} else if (options.hashquotedStrings && sc.Match('#', '\"')) { } else if (options.hashquotedStrings && sc.Match('#', '\"')) {
sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet); sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet);
sc.Forward(); sc.Forward();
} else if (options.backQuotedStrings && sc.Match('`')) {
sc.SetState(SCE_C_STRINGRAW|activitySet);
rawStringTerminator = "`";
sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
if (lastWordWasUUID) { if (lastWordWasUUID) {
sc.SetState(SCE_C_UUID|activitySet); sc.SetState(SCE_C_UUID|activitySet);
@@ -1018,19 +1211,37 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} else if (sc.Match("define")) { } else if (sc.Match("define")) {
if (options.updatePreprocessor && !preproc.IsInactive()) { if (options.updatePreprocessor && !preproc.IsInactive()) {
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true); std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true);
if (restOfLine.find(")") == std::string::npos) { // Don't handle macros with arguments size_t startName = 0;
std::vector<std::string> tokens = Tokenize(restOfLine); while ((startName < restOfLine.length()) && IsSpaceOrTab(restOfLine[startName]))
std::string key; startName++;
std::string value("1"); size_t endName = startName;
if (tokens.size() >= 1) { while ((endName < restOfLine.length()) && setWord.Contains(static_cast<unsigned char>(restOfLine[endName])))
key = tokens[0]; endName++;
if (tokens.size() >= 2) { std::string key = restOfLine.substr(startName, endName-startName);
value = tokens[1]; if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) {
} // Macro
preprocessorDefinitions[key] = value; size_t endArgs = endName;
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value)); while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')'))
definitionsChanged = true; endArgs++;
} std::string args = restOfLine.substr(endName + 1, endArgs - endName - 1);
size_t startValue = endArgs+1;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value;
if (startValue < restOfLine.length())
value = restOfLine.substr(startValue);
preprocessorDefinitions[key] = SymbolValue(value, args);
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
definitionsChanged = true;
} else {
// Value
size_t startValue = endName;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value = restOfLine.substr(startValue);
preprocessorDefinitions[key] = value;
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
definitionsChanged = true;
} }
} }
} else if (sc.Match("undef")) { } else if (sc.Match("undef")) {
@@ -1140,14 +1351,14 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
} }
} }
if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) { if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) {
if (ch == '{') { if (ch == '{' || ch == '[') {
// Measure the minimum before a '{' to allow // Measure the minimum before a '{' to allow
// folding on "} else {" // folding on "} else {"
if (levelMinCurrent > levelNext) { if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext; levelMinCurrent = levelNext;
} }
levelNext++; levelNext++;
} else if (ch == '}') { } else if (ch == '}' || ch == ']') {
levelNext--; levelNext--;
} }
} }
@@ -1180,19 +1391,36 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
} }
} }
void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) { void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTable &preprocessorDefinitions) {
// Evaluate defined() statements to either 0 or 1 // Remove whitespace tokens
for (size_t i=0; (i+2)<tokens.size();) { tokens.erase(std::remove_if(tokens.begin(), tokens.end(), OnlySpaceOrTab), tokens.end());
if ((tokens[i] == "defined") && (tokens[i+1] == "(")) {
// Evaluate defined statements to either 0 or 1
for (size_t i=0; (i+1)<tokens.size();) {
if (tokens[i] == "defined") {
const char *val = "0"; const char *val = "0";
if (tokens[i+2] == ")") { if (tokens[i+1] == "(") {
// defined() if (((i + 2)<tokens.size()) && (tokens[i + 2] == ")")) {
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3); // defined()
} else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) { tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3);
// defined(<int>) } else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) {
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4); // defined(<identifier>)
val = "1"; SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+2]);
if (it != preprocessorDefinitions.end()) {
val = "1";
}
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4);
} else {
// Spurious '(' so erase as more likely to result in false
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 2);
}
} else {
// defined <identifier>
SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+1]);
if (it != preprocessorDefinitions.end()) {
val = "1";
}
} }
tokens[i] = val; tokens[i] = val;
} else { } else {
@@ -1200,21 +1428,82 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
} }
} }
// Evaluate identifiers
const size_t maxIterations = 100;
size_t iterations = 0; // Limit number of iterations in case there is a recursive macro.
for (size_t i = 0; (i<tokens.size()) && (iterations < maxIterations);) {
iterations++;
if (setWordStart.Contains(static_cast<unsigned char>(tokens[i][0]))) {
SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i]);
if (it != preprocessorDefinitions.end()) {
// Tokenize value
std::vector<std::string> macroTokens = Tokenize(it->second.value);
if (it->second.IsMacro()) {
if ((i + 1 < tokens.size()) && (tokens.at(i + 1) == "(")) {
// Create map of argument name to value
std::vector<std::string> argumentNames = StringSplit(it->second.arguments, ',');
std::map<std::string, std::string> arguments;
size_t arg = 0;
size_t tok = i+2;
while ((tok < tokens.size()) && (arg < argumentNames.size()) && (tokens.at(tok) != ")")) {
if (tokens.at(tok) != ",") {
arguments[argumentNames.at(arg)] = tokens.at(tok);
arg++;
}
tok++;
}
// Remove invocation
tokens.erase(tokens.begin() + i, tokens.begin() + tok + 1);
// Substitute values into macro
macroTokens.erase(std::remove_if(macroTokens.begin(), macroTokens.end(), OnlySpaceOrTab), macroTokens.end());
for (size_t iMacro = 0; iMacro < macroTokens.size();) {
if (setWordStart.Contains(static_cast<unsigned char>(macroTokens[iMacro][0]))) {
std::map<std::string, std::string>::const_iterator itFind = arguments.find(macroTokens[iMacro]);
if (itFind != arguments.end()) {
// TODO: Possible that value will be expression so should insert tokenized form
macroTokens[iMacro] = itFind->second;
}
}
iMacro++;
}
// Insert results back into tokens
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
} else {
i++;
}
} else {
// Remove invocation
tokens.erase(tokens.begin() + i);
// Insert results back into tokens
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
}
} else {
// Identifier not found
tokens.erase(tokens.begin() + i);
}
} else {
i++;
}
}
// Find bracketed subexpressions and recurse on them // Find bracketed subexpressions and recurse on them
std::vector<std::string>::iterator itBracket = std::find(tokens.begin(), tokens.end(), "("); BracketPair bracketPair = FindBracketPair(tokens);
std::vector<std::string>::iterator itEndBracket = std::find(tokens.begin(), tokens.end(), ")"); while (bracketPair.itBracket != tokens.end()) {
while ((itBracket != tokens.end()) && (itEndBracket != tokens.end()) && (itEndBracket > itBracket)) { std::vector<std::string> inBracket(bracketPair.itBracket + 1, bracketPair.itEndBracket);
std::vector<std::string> inBracket(itBracket + 1, itEndBracket); EvaluateTokens(inBracket, preprocessorDefinitions);
EvaluateTokens(inBracket);
// The insertion is done before the removal because there were failures with the opposite approach // The insertion is done before the removal because there were failures with the opposite approach
tokens.insert(itBracket, inBracket.begin(), inBracket.end()); tokens.insert(bracketPair.itBracket, inBracket.begin(), inBracket.end());
itBracket = std::find(tokens.begin(), tokens.end(), "(");
itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
tokens.erase(itBracket, itEndBracket + 1);
itBracket = std::find(tokens.begin(), tokens.end(), "("); bracketPair = FindBracketPair(tokens);
itEndBracket = std::find(tokens.begin(), tokens.end(), ")"); tokens.erase(bracketPair.itBracket, bracketPair.itEndBracket + 1);
bracketPair = FindBracketPair(tokens);
} }
// Evaluate logical negations // Evaluate logical negations
@@ -1283,45 +1572,51 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
} }
} }
bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions) { std::vector<std::string> LexerCPP::Tokenize(const std::string &expr) const {
// Break into tokens, replacing with definitions // Break into tokens
std::string word;
std::vector<std::string> tokens; std::vector<std::string> tokens;
const char *cp = expr.c_str(); const char *cp = expr.c_str();
for (;;) { while (*cp) {
std::string word;
if (setWord.Contains(static_cast<unsigned char>(*cp))) { if (setWord.Contains(static_cast<unsigned char>(*cp))) {
// Identifiers and numbers
while (setWord.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
}
} else if (IsSpaceOrTab(*cp)) {
while (IsSpaceOrTab(*cp)) {
word += *cp;
cp++;
}
} else if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
word += *cp; word += *cp;
cp++;
if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
}
} else if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
}
} else { } else {
std::map<std::string, std::string>::const_iterator it = preprocessorDefinitions.find(word); // Should handle strings, characters, and comments here
if (it != preprocessorDefinitions.end()) { word += *cp;
tokens.push_back(it->second); cp++;
} else if (!word.empty() && ((word[0] >= '0' && word[0] <= '9') || (word == "defined"))) {
tokens.push_back(word);
}
word = "";
if (!*cp) {
break;
}
if ((*cp != ' ') && (*cp != '\t')) {
std::string op(cp, 1);
if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
if (setRelOp.Contains(static_cast<unsigned char>(cp[1]))) {
op += cp[1];
cp++;
}
} else if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
if (setLogicalOp.Contains(static_cast<unsigned char>(cp[1]))) {
op += cp[1];
cp++;
}
}
tokens.push_back(op);
}
} }
cp++; tokens.push_back(word);
} }
return tokens;
}
EvaluateTokens(tokens); bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions) {
std::vector<std::string> tokens = Tokenize(expr);
EvaluateTokens(tokens, preprocessorDefinitions);
// "0" or "" -> false else true // "0" or "" -> false else true
bool isFalse = tokens.empty() || bool isFalse = tokens.empty() ||

View File

@@ -31,11 +31,8 @@ using namespace Scintilla;
#endif #endif
static bool IsSpaceEquiv(int state) { static bool IsSpaceEquiv(int state) {
return (state <= SCE_COFFEESCRIPT_COMMENTDOC return (state == SCE_COFFEESCRIPT_DEFAULT
// including SCE_COFFEESCRIPT_DEFAULT, SCE_COFFEESCRIPT_COMMENT, SCE_COFFEESCRIPT_COMMENTLINE || state == SCE_COFFEESCRIPT_COMMENTLINE
|| state == SCE_COFFEESCRIPT_COMMENTLINEDOC
|| state == SCE_COFFEESCRIPT_COMMENTDOCKEYWORD
|| state == SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR
|| state == SCE_COFFEESCRIPT_COMMENTBLOCK || state == SCE_COFFEESCRIPT_COMMENTBLOCK
|| state == SCE_COFFEESCRIPT_VERBOSE_REGEX || state == SCE_COFFEESCRIPT_VERBOSE_REGEX
|| state == SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT || state == SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT
@@ -88,51 +85,16 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
WordList &keywords = *keywordlists[0]; WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1]; WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3]; WordList &keywords4 = *keywordlists[3];
// property styling.within.preprocessor
// For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default)
// or only from the initial # to the end of the command word(1).
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); CharacterSet setWordStart(CharacterSet::setAlpha, "_$@", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._$", 0x80, true);
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
// property lexer.cpp.allow.dollars
// Set to 0 to disallow the '$' character in identifiers with the cpp lexer.
if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
setWordStart.Add('$');
setWord.Add('$');
}
int chPrevNonWhite = ' '; int chPrevNonWhite = ' ';
int visibleChars = 0; int visibleChars = 0;
bool lastWordWasUUID = false;
int styleBeforeDCKeyword = SCE_COFFEESCRIPT_DEFAULT;
bool continuationLine = false;
bool isIncludePreprocessor = false;
if (initStyle == SCE_COFFEESCRIPT_PREPROCESSOR) {
// Set continuationLine if last character of previous line is '\'
int lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0) {
int chBack = styler.SafeGetCharAt(startPos-1, 0);
int chBack2 = styler.SafeGetCharAt(startPos-2, 0);
int lineEndChar = '!';
if (chBack2 == '\r' && chBack == '\n') {
lineEndChar = styler.SafeGetCharAt(startPos-3, 0);
} else if (chBack == '\n' || chBack == '\r') {
lineEndChar = chBack2;
}
continuationLine = lineEndChar == '\\';
}
}
// look back to set chPrevNonWhite properly for better regex colouring // look back to set chPrevNonWhite properly for better regex colouring
int endPos = startPos + length; int endPos = startPos + length;
@@ -158,23 +120,9 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) { if (sc.atLineStart) {
// Reset states to begining of colourise so no surprises // Reset states to beginning of colourise so no surprises
// if different sets of lines lexed. // if different sets of lines lexed.
visibleChars = 0; visibleChars = 0;
lastWordWasUUID = false;
isIncludePreprocessor = false;
}
// Handle line continuation generically.
if (sc.ch == '\\') {
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
continuationLine = true;
continue;
}
} }
// Determine if the current state should terminate. // Determine if the current state should terminate.
@@ -193,7 +141,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
char s[1000]; char s[1000];
sc.GetCurrent(s, sizeof(s)); sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) { if (keywords.InList(s)) {
lastWordWasUUID = strcmp(s, "uuid") == 0;
sc.ChangeState(SCE_COFFEESCRIPT_WORD); sc.ChangeState(SCE_COFFEESCRIPT_WORD);
} else if (keywords2.InList(s)) { } else if (keywords2.InList(s)) {
sc.ChangeState(SCE_COFFEESCRIPT_WORD2); sc.ChangeState(SCE_COFFEESCRIPT_WORD2);
@@ -210,74 +157,13 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
sc.SetState(SCE_COFFEESCRIPT_DEFAULT); sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
} }
break; break;
case SCE_COFFEESCRIPT_PREPROCESSOR:
if (sc.atLineStart && !continuationLine) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (stylingWithinPreprocessor) {
if (IsASpace(sc.ch)) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
} else {
if (sc.Match('/', '*') || sc.Match('/', '/')) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
}
break;
case SCE_COFFEESCRIPT_COMMENT:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_COFFEESCRIPT_COMMENTDOC:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
// Verify that we have the conditions to mark a comment-doc-keyword
if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) {
styleBeforeDCKeyword = SCE_COFFEESCRIPT_COMMENTDOC;
sc.SetState(SCE_COFFEESCRIPT_COMMENTDOCKEYWORD);
}
}
break;
case SCE_COFFEESCRIPT_COMMENTLINE: case SCE_COFFEESCRIPT_COMMENTLINE:
if (sc.atLineStart) { if (sc.atLineStart) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT); sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
} }
break; break;
case SCE_COFFEESCRIPT_COMMENTLINEDOC:
if (sc.atLineStart) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
// Verify that we have the conditions to mark a comment-doc-keyword
if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) {
styleBeforeDCKeyword = SCE_COFFEESCRIPT_COMMENTLINEDOC;
sc.SetState(SCE_COFFEESCRIPT_COMMENTDOCKEYWORD);
}
}
break;
case SCE_COFFEESCRIPT_COMMENTDOCKEYWORD:
if ((styleBeforeDCKeyword == SCE_COFFEESCRIPT_COMMENTDOC) && sc.Match('*', '/')) {
sc.ChangeState(SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR);
sc.Forward();
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (!setDoxygen.Contains(sc.ch)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) {
sc.ChangeState(SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR);
}
sc.SetState(styleBeforeDCKeyword);
}
break;
case SCE_COFFEESCRIPT_STRING: case SCE_COFFEESCRIPT_STRING:
if (isIncludePreprocessor) { if (sc.ch == '\\') {
if (sc.ch == '>') {
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
isIncludePreprocessor = false;
}
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward(); sc.Forward();
} }
@@ -314,20 +200,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
sc.SetState(SCE_COFFEESCRIPT_DEFAULT); sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
} }
break; break;
case SCE_COFFEESCRIPT_VERBATIM:
if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
}
}
break;
case SCE_COFFEESCRIPT_UUID:
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_COFFEESCRIPT_COMMENTBLOCK: case SCE_COFFEESCRIPT_COMMENTBLOCK:
if (sc.Match("###")) { if (sc.Match("###")) {
sc.Forward(); sc.Forward();
@@ -357,30 +229,10 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
// Determine if a new state should be entered. // Determine if a new state should be entered.
if (sc.state == SCE_COFFEESCRIPT_DEFAULT) { if (sc.state == SCE_COFFEESCRIPT_DEFAULT) {
if (sc.Match('@', '\"')) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_COFFEESCRIPT_VERBATIM); sc.SetState(SCE_COFFEESCRIPT_NUMBER);
sc.Forward(); } else if (setWordStart.Contains(sc.ch)) {
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_COFFEESCRIPT_IDENTIFIER);
if (lastWordWasUUID) {
sc.SetState(SCE_COFFEESCRIPT_UUID);
lastWordWasUUID = false;
} else {
sc.SetState(SCE_COFFEESCRIPT_NUMBER);
}
} else if (setWordStart.Contains(sc.ch) || (sc.ch == '@') || (sc.ch == '$')) {
if (lastWordWasUUID) {
sc.SetState(SCE_COFFEESCRIPT_UUID);
lastWordWasUUID = false;
} else {
sc.SetState(SCE_COFFEESCRIPT_IDENTIFIER);
}
} else if (sc.Match('/', '*')) {
if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style
sc.SetState(SCE_COFFEESCRIPT_COMMENTDOC);
} else {
sc.SetState(SCE_COFFEESCRIPT_COMMENT);
}
sc.Forward(); // Eat the * so it isn't used for the end of the comment
} else if (sc.Match("///")) { } else if (sc.Match("///")) {
sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX); sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX);
sc.Forward(); sc.Forward();
@@ -393,9 +245,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
sc.SetState(SCE_COFFEESCRIPT_STRING); sc.SetState(SCE_COFFEESCRIPT_STRING);
isIncludePreprocessor = false; // ensure that '>' won't end the string
} else if (isIncludePreprocessor && sc.ch == '<') {
sc.SetState(SCE_COFFEESCRIPT_STRING);
} else if (sc.ch == '\'') { } else if (sc.ch == '\'') {
sc.SetState(SCE_COFFEESCRIPT_CHARACTER); sc.SetState(SCE_COFFEESCRIPT_CHARACTER);
} else if (sc.ch == '#') { } else if (sc.ch == '#') {
@@ -403,7 +252,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
sc.SetState(SCE_COFFEESCRIPT_COMMENTBLOCK); sc.SetState(SCE_COFFEESCRIPT_COMMENTBLOCK);
sc.Forward(); sc.Forward();
sc.Forward(); sc.Forward();
} else { } else {
sc.SetState(SCE_COFFEESCRIPT_COMMENTLINE); sc.SetState(SCE_COFFEESCRIPT_COMMENTLINE);
} }
@@ -416,7 +264,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
chPrevNonWhite = sc.ch; chPrevNonWhite = sc.ch;
visibleChars++; visibleChars++;
} }
continuationLine = false;
} }
sc.Complete(); sc.Complete();
} }
@@ -428,10 +275,6 @@ static bool IsCommentLine(int line, Accessor &styler) {
char ch = styler[i]; char ch = styler[i];
if (ch == '#') if (ch == '#')
return true; return true;
else if (ch == '/'
&& i < eol_pos - 1
&& styler[i + 1] == '*')
return true;
else if (ch != ' ' && ch != '\t') else if (ch != ' ' && ch != '\t')
return false; return false;
} }
@@ -563,6 +406,9 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
static const char *const csWordLists[] = { static const char *const csWordLists[] = {
"Keywords", "Keywords",
"Secondary keywords",
"Unused",
"Global classes",
0, 0,
}; };

View File

@@ -0,0 +1,355 @@
// Scintilla source code edit control
/** @file LexDMIS.cxx
** Lexer for DMIS.
**/
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// Copyright 2013-2014 by Andreas Tscharner <andy@vis.ethz.ch>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cctype>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static const char *const DMISWordListDesc[] = {
"DMIS Major Words",
"DMIS Minor Words",
"Unsupported DMIS Major Words",
"Unsupported DMIS Minor Words",
"Keywords for code folding start",
"Corresponding keywords for code folding end",
0
};
class LexerDMIS : public ILexer
{
private:
char *m_wordListSets;
WordList m_majorWords;
WordList m_minorWords;
WordList m_unsupportedMajor;
WordList m_unsupportedMinor;
WordList m_codeFoldingStart;
WordList m_codeFoldingEnd;
char * SCI_METHOD UpperCase(char *item);
void SCI_METHOD InitWordListSets(void);
public:
LexerDMIS(void);
virtual ~LexerDMIS(void);
int SCI_METHOD Version() const {
return lvOriginal;
}
void SCI_METHOD Release() {
delete this;
}
const char * SCI_METHOD PropertyNames() {
return NULL;
}
int SCI_METHOD PropertyType(const char *) {
return -1;
}
const char * SCI_METHOD DescribeProperty(const char *) {
return NULL;
}
int SCI_METHOD PropertySet(const char *, const char *) {
return -1;
}
int SCI_METHOD WordListSet(int n, const char *wl);
void * SCI_METHOD PrivateCall(int, void *) {
return NULL;
}
static ILexer *LexerFactoryDMIS() {
return new LexerDMIS;
}
const char * SCI_METHOD DescribeWordListSets();
void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
};
char * SCI_METHOD LexerDMIS::UpperCase(char *item)
{
char *itemStart;
itemStart = item;
while (item && *item) {
*item = toupper(*item);
item++;
};
return itemStart;
}
void SCI_METHOD LexerDMIS::InitWordListSets(void)
{
size_t totalLen = 0;
for (int i=0; DMISWordListDesc[i]; i++) {
totalLen += strlen(DMISWordListDesc[i]);
totalLen++;
};
totalLen++;
this->m_wordListSets = new char[totalLen];
memset(this->m_wordListSets, 0, totalLen);
for (int i=0; DMISWordListDesc[i]; i++) {
strcat(this->m_wordListSets, DMISWordListDesc[i]);
strcat(this->m_wordListSets, "\n");
};
}
LexerDMIS::LexerDMIS(void) {
this->InitWordListSets();
this->m_majorWords.Clear();
this->m_minorWords.Clear();
this->m_unsupportedMajor.Clear();
this->m_unsupportedMinor.Clear();
this->m_codeFoldingStart.Clear();
this->m_codeFoldingEnd.Clear();
}
LexerDMIS::~LexerDMIS(void) {
delete[] this->m_wordListSets;
}
int SCI_METHOD LexerDMIS::WordListSet(int n, const char *wl)
{
switch (n) {
case 0:
this->m_majorWords.Clear();
this->m_majorWords.Set(wl);
break;
case 1:
this->m_minorWords.Clear();
this->m_minorWords.Set(wl);
break;
case 2:
this->m_unsupportedMajor.Clear();
this->m_unsupportedMajor.Set(wl);
break;
case 3:
this->m_unsupportedMinor.Clear();
this->m_unsupportedMinor.Set(wl);
break;
case 4:
this->m_codeFoldingStart.Clear();
this->m_codeFoldingStart.Set(wl);
break;
case 5:
this->m_codeFoldingEnd.Clear();
this->m_codeFoldingEnd.Set(wl);
break;
default:
return -1;
break;
}
return 0;
}
const char * SCI_METHOD LexerDMIS::DescribeWordListSets()
{
return this->m_wordListSets;
}
void SCI_METHOD LexerDMIS::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess)
{
const unsigned int MAX_STR_LEN = 100;
LexAccessor styler(pAccess);
StyleContext scCTX(startPos, lengthDoc, initStyle, styler);
CharacterSet setDMISNumber(CharacterSet::setDigits, ".-+eE");
CharacterSet setDMISWordStart(CharacterSet::setAlpha, "-234", 0x80, true);
CharacterSet setDMISWord(CharacterSet::setAlpha);
bool isIFLine = false;
for (; scCTX.More(); scCTX.Forward()) {
if (scCTX.atLineEnd) {
isIFLine = false;
};
switch (scCTX.state) {
case SCE_DMIS_DEFAULT:
if (scCTX.Match('$', '$')) {
scCTX.SetState(SCE_DMIS_COMMENT);
scCTX.Forward();
};
if (scCTX.Match('\'')) {
scCTX.SetState(SCE_DMIS_STRING);
};
if (IsADigit(scCTX.ch) || ((scCTX.Match('-') || scCTX.Match('+')) && IsADigit(scCTX.chNext))) {
scCTX.SetState(SCE_DMIS_NUMBER);
break;
};
if (setDMISWordStart.Contains(scCTX.ch)) {
scCTX.SetState(SCE_DMIS_KEYWORD);
};
if (scCTX.Match('(') && (!isIFLine)) {
scCTX.SetState(SCE_DMIS_LABEL);
};
break;
case SCE_DMIS_COMMENT:
if (scCTX.atLineEnd) {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
break;
case SCE_DMIS_STRING:
if (scCTX.Match('\'')) {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
break;
case SCE_DMIS_NUMBER:
if (!setDMISNumber.Contains(scCTX.ch)) {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
break;
case SCE_DMIS_KEYWORD:
if (!setDMISWord.Contains(scCTX.ch)) {
char tmpStr[MAX_STR_LEN];
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
scCTX.GetCurrent(tmpStr, (MAX_STR_LEN-1));
strncpy(tmpStr, this->UpperCase(tmpStr), (MAX_STR_LEN-1));
if (this->m_minorWords.InList(tmpStr)) {
scCTX.ChangeState(SCE_DMIS_MINORWORD);
};
if (this->m_majorWords.InList(tmpStr)) {
isIFLine = (strcmp(tmpStr, "IF") == 0);
scCTX.ChangeState(SCE_DMIS_MAJORWORD);
};
if (this->m_unsupportedMajor.InList(tmpStr)) {
scCTX.ChangeState(SCE_DMIS_UNSUPPORTED_MAJOR);
};
if (this->m_unsupportedMinor.InList(tmpStr)) {
scCTX.ChangeState(SCE_DMIS_UNSUPPORTED_MINOR);
};
if (scCTX.Match('(') && (!isIFLine)) {
scCTX.SetState(SCE_DMIS_LABEL);
} else {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
};
break;
case SCE_DMIS_LABEL:
if (scCTX.Match(')')) {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
break;
};
};
scCTX.Complete();
}
void SCI_METHOD LexerDMIS::Fold(unsigned int startPos, int lengthDoc, int, IDocument *pAccess)
{
const int MAX_STR_LEN = 100;
LexAccessor styler(pAccess);
unsigned int endPos = startPos + lengthDoc;
char chNext = styler[startPos];
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int strPos = 0;
bool foldWordPossible = false;
CharacterSet setDMISFoldWord(CharacterSet::setAlpha);
char *tmpStr;
tmpStr = new char[MAX_STR_LEN];
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
for (unsigned int i=startPos; i<endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i+1);
bool atEOL = ((ch == '\r' && chNext != '\n') || (ch == '\n'));
if (strPos >= (MAX_STR_LEN-1)) {
strPos = MAX_STR_LEN-1;
};
int style = styler.StyleAt(i);
bool noFoldPos = ((style == SCE_DMIS_COMMENT) || (style == SCE_DMIS_STRING));
if (foldWordPossible) {
if (setDMISFoldWord.Contains(ch)) {
tmpStr[strPos++] = ch;
} else {
tmpStr = this->UpperCase(tmpStr);
if (this->m_codeFoldingStart.InList(tmpStr) && (!noFoldPos)) {
levelCurrent++;
};
if (this->m_codeFoldingEnd.InList(tmpStr) && (!noFoldPos)) {
levelCurrent--;
};
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
strPos = 0;
foldWordPossible = false;
};
} else {
if (setDMISFoldWord.Contains(ch)) {
tmpStr[strPos++] = ch;
foldWordPossible = true;
};
};
if (atEOL || (i == (endPos-1))) {
int lev = levelPrev;
if (levelCurrent > levelPrev) {
lev |= SC_FOLDLEVELHEADERFLAG;
};
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
};
lineCurrent++;
levelPrev = levelCurrent;
};
};
delete[] tmpStr;
}
LexerModule lmDMIS(SCLEX_DMIS, LexerDMIS::LexerFactoryDMIS, "DMIS", DMISWordListDesc);

View File

@@ -7,10 +7,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable: 4786) #pragma warning(disable: 4786)

View File

@@ -6,10 +6,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include "ILexer.h" #include "ILexer.h"
#include "Scintilla.h" #include "Scintilla.h"

View File

@@ -1,7 +1,7 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file LexFortran.cxx /** @file LexFortran.cxx
** Lexer for Fortran. ** Lexer for Fortran.
** Writen by Chuan-jian Shen, Last changed Sep. 2003 ** Written by Chuan-jian Shen, Last changed Sep. 2003
**/ **/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
@@ -455,11 +455,11 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) { if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) {
// Remove delta for do-label // Remove delta for do-label
levelDeltaNext -= wordLevelDelta; levelDeltaNext -= wordLevelDelta;
}
} }
}
strcpy(prevWord, s); strcpy(prevWord, s);
} }
} }
if (atEOL) { if (atEOL) {
int lev = levelCurrent; int lev = levelCurrent;
if (visibleChars == 0 && foldCompact) if (visibleChars == 0 && foldCompact)

View File

@@ -576,8 +576,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
WordList &keywords5 = *keywordlists[4]; WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers styler.StartAt(startPos);
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
char prevWord[200]; char prevWord[200];
prevWord[0] = '\0'; prevWord[0] = '\0';
char phpStringDelimiter[200]; // PHP is not limited in length, we are char phpStringDelimiter[200]; // PHP is not limited in length, we are
@@ -609,7 +608,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (startPos == 0) if (startPos == 0)
state = SCE_H_DEFAULT; state = SCE_H_DEFAULT;
} }
styler.StartAt(startPos, static_cast<char>(STYLE_MAX)); styler.StartAt(startPos);
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
int lineState; int lineState;
@@ -811,8 +810,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} }
styler.SetLineState(lineCurrent, styler.SetLineState(lineCurrent,
((inScriptType & 0x03) << 0) | ((inScriptType & 0x03) << 0) |
((tagOpened & 0x01) << 2) | ((tagOpened ? 1 : 0) << 2) |
((tagClosing & 0x01) << 3) | ((tagClosing ? 1 : 0) << 3) |
((aspScript & 0x0F) << 4) | ((aspScript & 0x0F) << 4) |
((clientScript & 0x0F) << 8) | ((clientScript & 0x0F) << 8) |
((beforePreProc & 0xFF) << 12)); ((beforePreProc & 0xFF) << 12));
@@ -823,19 +822,27 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
// handle start of Mako comment line // handle start of Mako comment line
if (isMako && ch == '#' && chNext == '#') { if (isMako && ch == '#' && chNext == '#') {
makoComment = 1; makoComment = 1;
state = SCE_HP_COMMENTLINE;
} }
// handle end of Mako comment line // handle end of Mako comment line
else if (isMako && makoComment && (ch == '\r' || ch == '\n')) { else if (isMako && makoComment && (ch == '\r' || ch == '\n')) {
makoComment = 0; makoComment = 0;
styler.ColourTo(i, SCE_HP_COMMENTLINE); styler.ColourTo(i, StateToPrint);
state = SCE_HP_DEFAULT; if (scriptLanguage == eScriptPython) {
state = SCE_HP_DEFAULT;
} else {
state = SCE_H_DEFAULT;
}
} }
// Allow falling through to mako handling code if newline is going to end a block // Allow falling through to mako handling code if newline is going to end a block
if (((ch == '\r' && chNext != '\n') || (ch == '\n')) && if (((ch == '\r' && chNext != '\n') || (ch == '\n')) &&
(!isMako || (0 != strcmp(makoBlockType, "%")))) { (!isMako || (0 != strcmp(makoBlockType, "%")))) {
} }
// Ignore everything in mako comment until the line ends
else if (isMako && makoComment) {
}
// generic end of script processing // generic end of script processing
else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) { else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) {
@@ -2180,6 +2187,6 @@ static const char * const phpscriptWordListDesc[] = {
0, 0,
}; };
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc, 8); LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc);
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc, 8); LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 8); LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc);

View File

@@ -38,9 +38,9 @@
#include "Accessor.h" #include "Accessor.h"
#include "StyleContext.h" #include "StyleContext.h"
#include "CharacterSet.h" #include "CharacterSet.h"
#include "CharacterCategory.h"
#include "LexerModule.h" #include "LexerModule.h"
#include "OptionSet.h" #include "OptionSet.h"
#include "CharacterCategory.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;

File diff suppressed because it is too large Load Diff

View File

@@ -359,7 +359,7 @@ static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - un
WordList *[], Accessor &styler) WordList *[], Accessor &styler)
{ {
/* Based on CMake's folder */ /* Based on CMake's folder */
/* Exiting if folding isnt enabled */ /* Exiting if folding isnt enabled */
if ( styler.GetPropertyInt("fold") == 0 ) if ( styler.GetPropertyInt("fold") == 0 )
return; return;

View File

@@ -4,6 +4,7 @@
**/ **/
// Copyright 2004 by Manfred Becker <manfred@becker-trdf.de> // Copyright 2004 by Manfred Becker <manfred@becker-trdf.de>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
// Edited by Lee Wilmott (24-Jun-2014) added support for block comments
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -54,6 +55,10 @@ static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
if (sc.atLineEnd) { if (sc.atLineEnd) {
sc.SetState(SCE_KIX_DEFAULT); sc.SetState(SCE_KIX_DEFAULT);
} }
} else if (sc.state == SCE_KIX_COMMENTSTREAM) {
if (sc.ch == '/' && sc.chPrev == '*') {
sc.ForwardSetState(SCE_KIX_DEFAULT);
}
} else if (sc.state == SCE_KIX_STRING1) { } else if (sc.state == SCE_KIX_STRING1) {
// This is a doubles quotes string // This is a doubles quotes string
if (sc.ch == '\"') { if (sc.ch == '\"') {
@@ -104,6 +109,8 @@ static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
if (sc.state == SCE_KIX_DEFAULT) { if (sc.state == SCE_KIX_DEFAULT) {
if (sc.ch == ';') { if (sc.ch == ';') {
sc.SetState(SCE_KIX_COMMENT); sc.SetState(SCE_KIX_COMMENT);
} else if (sc.ch == '/' && sc.chNext == '*') {
sc.SetState(SCE_KIX_COMMENTSTREAM);
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
sc.SetState(SCE_KIX_STRING1); sc.SetState(SCE_KIX_STRING1);
} else if (sc.ch == '\'') { } else if (sc.ch == '\'') {

View File

@@ -60,7 +60,7 @@ private:
if (static_cast<int>(modes.size()) > numLines * 2 + 256) if (static_cast<int>(modes.size()) > numLines * 2 + 256)
modes.resize(numLines + 128); modes.resize(numLines + 128);
} }
vector<latexFoldSave> saves; vector<latexFoldSave> saves;
void setSave(int line, const latexFoldSave &save) { void setSave(int line, const latexFoldSave &save) {
if (line >= static_cast<int>(saves.size())) saves.resize(line + 1); if (line >= static_cast<int>(saves.size())) saves.resize(line + 1);
@@ -192,7 +192,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
int state = initStyle; int state = initStyle;
if (state == SCE_L_ERROR || state == SCE_L_SHORTCMD || state == SCE_L_SPECIAL) // should not happen if (state == SCE_L_ERROR || state == SCE_L_SHORTCMD || state == SCE_L_SPECIAL) // should not happen
latexStateReset(mode, state); latexStateReset(mode, state);
char chNext = styler.SafeGetCharAt(startPos); char chNext = styler.SafeGetCharAt(startPos);
char chVerbatimDelim = '\0'; char chVerbatimDelim = '\0';
styler.StartSegment(startPos); styler.StartSegment(startPos);
@@ -207,7 +207,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
continue; continue;
} }
if (ch == '\r' || ch == '\n') if (ch == '\r' || ch == '\n')
setMode(styler.GetLine(i), mode); setMode(styler.GetLine(i), mode);
@@ -256,7 +256,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
state = SCE_L_COMMENT; state = SCE_L_COMMENT;
break; break;
} }
break; break;
// These 3 will never be reached. // These 3 will never be reached.
case SCE_L_ERROR: case SCE_L_ERROR:
case SCE_L_SPECIAL: case SCE_L_SPECIAL:
@@ -400,7 +400,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
mode = 0; mode = 0;
state = SCE_L_DEFAULT; state = SCE_L_DEFAULT;
} else { // This may not be an error, e.g. \begin{equation}\text{$a$}\end{equation} } else { // This may not be an error, e.g. \begin{equation}\text{$a$}\end{equation}
styler.ColourTo(i, SCE_L_SHORTCMD); styler.ColourTo(i, SCE_L_SHORTCMD);
} }
break; break;

View File

@@ -141,7 +141,7 @@ static void ColouriseLuaDoc(
char s[100]; char s[100];
while (setWord.Contains(c = sc.GetRelative(ln))) { // get potential label while (setWord.Contains(c = sc.GetRelative(ln))) { // get potential label
if (i < 90) if (i < 90)
s[i++] = c; s[i++] = static_cast<char>(c);
ln++; ln++;
} }
s[i] = '\0'; int lbl = ln; s[i] = '\0'; int lbl = ln;

View File

@@ -12,6 +12,9 @@
** - added ... displayed as a comment ** - added ... displayed as a comment
** - removed unused IsAWord functions ** - removed unused IsAWord functions
** - added some comments ** - added some comments
**
** Changes by John Donoghue 2014/08/01
** - fix allowed transpose ' after {} operator
**/ **/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
@@ -64,7 +67,7 @@ static void ColouriseMatlabOctaveDoc(
styler.StartAt(startPos); styler.StartAt(startPos);
// boolean for when the ' is allowed to be transpose vs the start/end // boolean for when the ' is allowed to be transpose vs the start/end
// of a string // of a string
bool transpose = false; bool transpose = false;
@@ -82,14 +85,14 @@ static void ColouriseMatlabOctaveDoc(
for (; sc.More(); sc.Forward(), column++) { for (; sc.More(); sc.Forward(), column++) {
if(sc.atLineStart) { if(sc.atLineStart) {
// set the line state to the current commentDepth // set the line state to the current commentDepth
curLine = styler.GetLine(sc.currentPos); curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, commentDepth); styler.SetLineState(curLine, commentDepth);
// reset the column to 0, nonSpace to -1 (not set) // reset the column to 0, nonSpace to -1 (not set)
column = 0; column = 0;
nonSpaceColumn = -1; nonSpaceColumn = -1;
} }
// save the column position of first non space character in a line // save the column position of first non space character in a line
@@ -108,7 +111,7 @@ static void ColouriseMatlabOctaveDoc(
sc.ForwardSetState(SCE_MATLAB_DEFAULT); sc.ForwardSetState(SCE_MATLAB_DEFAULT);
transpose = true; transpose = true;
} else if(sc.ch == '.' && sc.chNext == '.') { } else if(sc.ch == '.' && sc.chNext == '.') {
// we werent an operator, but a '...' // we werent an operator, but a '...'
sc.ChangeState(SCE_MATLAB_COMMENT); sc.ChangeState(SCE_MATLAB_COMMENT);
transpose = false; transpose = false;
} else { } else {
@@ -161,8 +164,8 @@ static void ColouriseMatlabOctaveDoc(
} else if (sc.state == SCE_MATLAB_COMMENT) { } else if (sc.state == SCE_MATLAB_COMMENT) {
// end or start of a nested a block 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) {
if(commentDepth > 0) commentDepth --; if(commentDepth > 0) commentDepth --;
curLine = styler.GetLine(sc.currentPos); curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, commentDepth); styler.SetLineState(curLine, commentDepth);
sc.Forward(); sc.Forward();
@@ -174,7 +177,7 @@ static void ColouriseMatlabOctaveDoc(
} }
else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column) else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column)
{ {
commentDepth ++; commentDepth ++;
curLine = styler.GetLine(sc.currentPos); curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, commentDepth); styler.SetLineState(curLine, commentDepth);
@@ -218,7 +221,7 @@ static void ColouriseMatlabOctaveDoc(
} else if (isalpha(sc.ch)) { } else if (isalpha(sc.ch)) {
sc.SetState(SCE_MATLAB_KEYWORD); sc.SetState(SCE_MATLAB_KEYWORD);
} else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '@' || sc.ch == '\\') { } else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '@' || sc.ch == '\\') {
if (sc.ch == ')' || sc.ch == ']') { if (sc.ch == ')' || sc.ch == ']' || sc.ch == '}') {
transpose = true; transpose = true;
} else { } else {
transpose = false; transpose = false;

View File

@@ -570,4 +570,4 @@ static const char * const mysqlWordListDesc[] = {
0 0
}; };
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc, 7); LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc);

View File

@@ -41,7 +41,7 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
int curLine = styler.GetLine(startPos); int curLine = styler.GetLine(startPos);
// the line state holds the last state on or before the line that isn't the default style // the line state holds the last state on or before the line that isn't the default style
int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : SCE_PO_DEFAULT; int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : SCE_PO_DEFAULT;
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
// whether we should leave a state // whether we should leave a state
switch (sc.state) { switch (sc.state) {
@@ -57,19 +57,19 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
// on its own like a keyword rather than changing the whole flags style // on its own like a keyword rather than changing the whole flags style
sc.ChangeState(SCE_PO_FUZZY); sc.ChangeState(SCE_PO_FUZZY);
break; break;
case SCE_PO_MSGCTXT: case SCE_PO_MSGCTXT:
case SCE_PO_MSGID: case SCE_PO_MSGID:
case SCE_PO_MSGSTR: case SCE_PO_MSGSTR:
if (isspacechar(sc.ch)) if (isspacechar(sc.ch))
sc.SetState(SCE_PO_DEFAULT); sc.SetState(SCE_PO_DEFAULT);
break; break;
case SCE_PO_ERROR: case SCE_PO_ERROR:
if (sc.atLineEnd) if (sc.atLineEnd)
sc.SetState(SCE_PO_DEFAULT); sc.SetState(SCE_PO_DEFAULT);
break; break;
case SCE_PO_MSGCTXT_TEXT: case SCE_PO_MSGCTXT_TEXT:
case SCE_PO_MSGID_TEXT: case SCE_PO_MSGID_TEXT:
case SCE_PO_MSGSTR_TEXT: case SCE_PO_MSGSTR_TEXT:
@@ -92,7 +92,7 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
} }
break; break;
} }
// whether we should enter a new state // whether we should enter a new state
if (sc.state == SCE_PO_DEFAULT) { if (sc.state == SCE_PO_DEFAULT) {
// forward to the first non-white character on the line // forward to the first non-white character on the line
@@ -103,11 +103,11 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
// and anyway the styling don't use line state for comments // and anyway the styling don't use line state for comments
if (curLineState == SCE_PO_COMMENT) if (curLineState == SCE_PO_COMMENT)
curLineState = SCE_PO_DEFAULT; curLineState = SCE_PO_DEFAULT;
while (sc.More() && ! sc.atLineEnd && isspacechar(sc.ch)) while (sc.More() && ! sc.atLineEnd && isspacechar(sc.ch))
sc.Forward(); sc.Forward();
} }
if (atLineStart && sc.ch == '#') { if (atLineStart && sc.ch == '#') {
if (sc.chNext == '.') if (sc.chNext == '.')
sc.SetState(SCE_PO_PROGRAMMER_COMMENT); sc.SetState(SCE_PO_PROGRAMMER_COMMENT);
@@ -134,11 +134,11 @@ static void ColourisePODoc(unsigned int startPos, int length, int initStyle, Wor
sc.SetState(SCE_PO_ERROR); sc.SetState(SCE_PO_ERROR);
} else if (! isspacechar(sc.ch)) } else if (! isspacechar(sc.ch))
sc.SetState(SCE_PO_ERROR); sc.SetState(SCE_PO_ERROR);
if (sc.state != SCE_PO_DEFAULT) if (sc.state != SCE_PO_DEFAULT)
curLineState = sc.state; curLineState = sc.state;
} }
if (sc.atLineEnd) { if (sc.atLineEnd) {
// Update the line state, so it can be seen by next line // Update the line state, so it can be seen by next line
curLine = styler.GetLine(sc.currentPos); curLine = styler.GetLine(sc.currentPos);
@@ -163,7 +163,7 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce
return; return;
bool foldCompact = styler.GetPropertyInt("fold.compact") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact") != 0;
bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int curLine = styler.GetLine(startPos); int curLine = styler.GetLine(startPos);
int lineState = styler.GetLineState(curLine); int lineState = styler.GetLineState(curLine);
@@ -172,17 +172,17 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce
int nextLevel; int nextLevel;
int visible = 0; int visible = 0;
int chNext = styler[startPos]; int chNext = styler[startPos];
for (unsigned int i = startPos; i < endPos; i++) { for (unsigned int i = startPos; i < endPos; i++) {
int ch = chNext; int ch = chNext;
chNext = styler.SafeGetCharAt(i+1); chNext = styler.SafeGetCharAt(i+1);
if (! isspacechar(ch)) { if (! isspacechar(ch)) {
visible++; visible++;
} else if ((ch == '\r' && chNext != '\n') || ch == '\n' || i+1 >= endPos) { } else if ((ch == '\r' && chNext != '\n') || ch == '\n' || i+1 >= endPos) {
int lvl = level; int lvl = level;
int nextLine = curLine + 1; int nextLine = curLine + 1;
nextLineState = styler.GetLineState(nextLine); nextLineState = styler.GetLineState(nextLine);
if ((lineState != SCE_PO_COMMENT || foldComment) && if ((lineState != SCE_PO_COMMENT || foldComment) &&
nextLineState == lineState && nextLineState == lineState &&
@@ -190,14 +190,14 @@ static void FoldPODoc(unsigned int startPos, int length, int, WordList *[], Acce
nextLevel = SC_FOLDLEVELBASE + 1; nextLevel = SC_FOLDLEVELBASE + 1;
else else
nextLevel = SC_FOLDLEVELBASE; nextLevel = SC_FOLDLEVELBASE;
if (nextLevel > level) if (nextLevel > level)
lvl |= SC_FOLDLEVELHEADERFLAG; lvl |= SC_FOLDLEVELHEADERFLAG;
if (visible == 0 && foldCompact) if (visible == 0 && foldCompact)
lvl |= SC_FOLDLEVELWHITEFLAG; lvl |= SC_FOLDLEVELWHITEFLAG;
styler.SetLevel(curLine, lvl); styler.SetLevel(curLine, lvl);
lineState = nextLineState; lineState = nextLineState;
curLine = nextLine; curLine = nextLine;
level = nextLevel; level = nextLevel;

View File

@@ -6,6 +6,12 @@
** The License.txt file describes the conditions under which this software may be distributed. ** The License.txt file describes the conditions under which this software may be distributed.
**/ **/
// Previous releases of this lexer included support for marking token starts with
// a style byte indicator. This was used by the wxGhostscript IDE/debugger.
// Style byte indicators were removed in version 3.4.3.
// Anyone wanting to restore this functionality for wxGhostscript using 'modern'
// indicators can examine the earlier source in the Mercurial repository.
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@@ -72,7 +78,6 @@ static void ColourisePSDoc(
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
bool tokenizing = styler.GetPropertyInt("ps.tokenize") != 0;
int pslevel = styler.GetPropertyInt("ps.level", 3); int pslevel = styler.GetPropertyInt("ps.level", 3);
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
int nestTextCurrent = 0; int nestTextCurrent = 0;
@@ -83,15 +88,6 @@ static void ColourisePSDoc(
bool numHasExponent = false; bool numHasExponent = false;
bool numHasSign = false; bool numHasSign = false;
// Clear out existing tokenization
if (tokenizing && length > 0) {
styler.StartAt(startPos, static_cast<char>(INDIC2_MASK));
styler.ColourTo(startPos + length-1, 0);
styler.Flush();
styler.StartAt(startPos);
styler.StartSegment(startPos);
}
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) if (sc.atLineStart)
lineCurrent = styler.GetLine(sc.currentPos); lineCurrent = styler.GetLine(sc.currentPos);
@@ -196,7 +192,6 @@ static void ColourisePSDoc(
// Determine if a new state should be entered. // Determine if a new state should be entered.
if (sc.state == SCE_C_DEFAULT) { if (sc.state == SCE_C_DEFAULT) {
unsigned int tokenpos = sc.currentPos;
if (sc.ch == '[' || sc.ch == ']') { if (sc.ch == '[' || sc.ch == ']') {
sc.SetState(SCE_PS_PAREN_ARRAY); sc.SetState(SCE_PS_PAREN_ARRAY);
@@ -262,17 +257,6 @@ static void ColourisePSDoc(
} else if (!IsAWhitespaceChar(sc.ch)) { } else if (!IsAWhitespaceChar(sc.ch)) {
sc.SetState(SCE_PS_NAME); sc.SetState(SCE_PS_NAME);
} }
// Mark the start of tokens
if (tokenizing && sc.state != SCE_C_DEFAULT && sc.state != SCE_PS_COMMENT &&
sc.state != SCE_PS_DSC_COMMENT && sc.state != SCE_PS_DSC_VALUE) {
styler.Flush();
styler.StartAt(tokenpos, static_cast<char>(INDIC2_MASK));
styler.ColourTo(tokenpos, INDIC2_MASK);
styler.Flush();
styler.StartAt(tokenpos);
styler.StartSegment(tokenpos);
}
} }
if (sc.atLineEnd) if (sc.atLineEnd)
@@ -296,11 +280,10 @@ static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
int levelNext = levelCurrent; int levelNext = levelCurrent;
char chNext = styler[startPos]; char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos); int styleNext = styler.StyleAt(startPos);
int style;
for (unsigned int i = startPos; i < endPos; i++) { for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext; char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
style = styleNext; int style = styleNext;
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac?? bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac??
if ((style & 31) == SCE_PS_PAREN_PROC) { if ((style & 31) == SCE_PS_PAREN_PROC) {

View File

@@ -662,7 +662,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
} else if (initStyle == SCE_PL_POD } else if (initStyle == SCE_PL_POD
|| initStyle == SCE_PL_POD_VERB || initStyle == SCE_PL_POD_VERB
) { ) {
// POD backtracking finds preceeding blank lines and goes back past them // POD backtracking finds preceding blank lines and goes back past them
int ln = styler.GetLine(startPos); int ln = styler.GetLine(startPos);
if (ln > 0) { if (ln > 0) {
initStyle = styler.StyleAt(styler.LineStart(--ln)); initStyle = styler.StyleAt(styler.LineStart(--ln));
@@ -1159,12 +1159,12 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
sc.ForwardSetState(SCE_PL_DEFAULT); sc.ForwardSetState(SCE_PL_DEFAULT);
HereDoc.State = 3; HereDoc.State = 3;
} else { } else {
// invalid indentifier; inexact fallback, but hey // invalid identifier; inexact fallback, but hey
sc.ChangeState(SCE_PL_IDENTIFIER); sc.ChangeState(SCE_PL_IDENTIFIER);
sc.SetState(SCE_PL_DEFAULT); sc.SetState(SCE_PL_DEFAULT);
} }
} else { } else {
sc.ChangeState(SCE_PL_DEFAULT); // invalid indentifier sc.ChangeState(SCE_PL_DEFAULT); // invalid identifier
} }
backFlag = BACK_NONE; backFlag = BACK_NONE;
break; break;
@@ -1726,4 +1726,4 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
styler.SetLevel(lineCurrent, levelPrev | flagsNext); styler.SetLevel(lineCurrent, levelPrev | flagsNext);
} }
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc, 8); LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc);

View File

@@ -0,0 +1,416 @@
// Scintilla source code edit control
/**
* @file LexRegistry.cxx
* @date July 26 2014
* @brief Lexer for Windows registration files(.reg)
* @author nkmathew
*
* The License.txt file describes the conditions under which this software may be
* distributed.
*
*/
#include <cstdlib>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static const char *const RegistryWordListDesc[] = {
0
};
struct OptionsRegistry {
bool foldCompact;
bool fold;
OptionsRegistry() {
foldCompact = false;
fold = false;
}
};
struct OptionSetRegistry : public OptionSet<OptionsRegistry> {
OptionSetRegistry() {
DefineProperty("fold.compact", &OptionsRegistry::foldCompact);
DefineProperty("fold", &OptionsRegistry::fold);
DefineWordListSets(RegistryWordListDesc);
}
};
class LexerRegistry : public ILexer {
OptionsRegistry options;
OptionSetRegistry optSetRegistry;
static bool IsStringState(int state) {
return (state == SCE_REG_VALUENAME || state == SCE_REG_STRING);
}
static bool IsKeyPathState(int state) {
return (state == SCE_REG_ADDEDKEY || state == SCE_REG_DELETEDKEY);
}
static bool AtValueType(LexAccessor &styler, int start) {
int i = 0;
while (i < 10) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
if (curr == ':') {
return true;
} else if (!curr) {
return false;
}
}
return false;
}
static bool IsNextNonWhitespace(LexAccessor &styler, int start, char ch) {
int i = 0;
while (i < 100) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
char next = styler.SafeGetCharAt(start+i+1, '\0');
bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (curr == ch) {
return true;
} else if (!isspacechar(curr) || atEOL) {
return false;
}
}
return false;
}
// Looks for the equal sign at the end of the string
static bool AtValueName(LexAccessor &styler, int start) {
bool atEOL = false;
int i = 0;
bool escaped = false;
while (!atEOL) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
char next = styler.SafeGetCharAt(start+i+1, '\0');
atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (escaped) {
escaped = false;
continue;
}
escaped = curr == '\\';
if (curr == '"') {
return IsNextNonWhitespace(styler, start+i, '=');
} else if (!curr) {
return false;
}
}
return false;
}
static bool AtKeyPathEnd(LexAccessor &styler, int start) {
bool atEOL = false;
int i = 0;
while (!atEOL) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
char next = styler.SafeGetCharAt(start+i+1, '\0');
atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (curr == ']' || !curr) {
// There's still at least one or more square brackets ahead
return false;
}
}
return true;
}
static bool AtGUID(LexAccessor &styler, int start) {
int count = 8;
int portion = 0;
int offset = 1;
char digit = '\0';
while (portion < 5) {
int i = 0;
while (i < count) {
digit = styler.SafeGetCharAt(start+offset);
if (!(isxdigit(digit) || digit == '-')) {
return false;
}
offset++;
i++;
}
portion++;
count = (portion == 4) ? 13 : 5;
}
digit = styler.SafeGetCharAt(start+offset);
if (digit == '}') {
return true;
} else {
return false;
}
}
public:
LexerRegistry() {}
virtual ~LexerRegistry() {}
virtual int SCI_METHOD Version() const {
return lvOriginal;
}
virtual void SCI_METHOD Release() {
delete this;
}
virtual const char *SCI_METHOD PropertyNames() {
return optSetRegistry.PropertyNames();
}
virtual int SCI_METHOD PropertyType(const char *name) {
return optSetRegistry.PropertyType(name);
}
virtual const char *SCI_METHOD DescribeProperty(const char *name) {
return optSetRegistry.DescribeProperty(name);
}
virtual int SCI_METHOD PropertySet(const char *key, const char *val) {
if (optSetRegistry.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
virtual int SCI_METHOD WordListSet(int, const char *) {
return -1;
}
virtual void *SCI_METHOD PrivateCall(int, void *) {
return 0;
}
static ILexer *LexerFactoryRegistry() {
return new LexerRegistry;
}
virtual const char *SCI_METHOD DescribeWordListSets() {
return optSetRegistry.DescribeWordListSets();
}
virtual void SCI_METHOD Lex(unsigned startPos,
int length,
int initStyle,
IDocument *pAccess);
virtual void SCI_METHOD Fold(unsigned startPos,
int length,
int initStyle,
IDocument *pAccess);
};
void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
int length,
int initStyle,
IDocument *pAccess) {
int beforeGUID = SCE_REG_DEFAULT;
int beforeEscape = SCE_REG_DEFAULT;
CharacterSet setOperators = CharacterSet(CharacterSet::setNone, "-,.=:\\@()");
LexAccessor styler(pAccess);
StyleContext context(startPos, length, initStyle, styler);
bool highlight = true;
bool afterEqualSign = false;
while (context.More()) {
if (context.atLineStart) {
int currPos = static_cast<int>(context.currentPos);
bool continued = styler[currPos-3] == '\\';
highlight = continued ? true : false;
}
switch (context.state) {
case SCE_REG_COMMENT:
if (context.atLineEnd) {
context.SetState(SCE_REG_DEFAULT);
}
break;
case SCE_REG_VALUENAME:
case SCE_REG_STRING: {
int currPos = static_cast<int>(context.currentPos);
if (context.ch == '"') {
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == '\\') {
beforeEscape = context.state;
context.SetState(SCE_REG_ESCAPED);
context.Forward();
} else if (context.ch == '{') {
if (AtGUID(styler, currPos)) {
beforeGUID = context.state;
context.SetState(SCE_REG_STRING_GUID);
}
}
if (context.state == SCE_REG_STRING &&
context.ch == '%' &&
(isdigit(context.chNext) || context.chNext == '*')) {
context.SetState(SCE_REG_PARAMETER);
}
}
break;
case SCE_REG_PARAMETER:
context.ForwardSetState(SCE_REG_STRING);
if (context.ch == '"') {
context.ForwardSetState(SCE_REG_DEFAULT);
}
break;
case SCE_REG_VALUETYPE:
if (context.ch == ':') {
context.SetState(SCE_REG_DEFAULT);
afterEqualSign = false;
}
break;
case SCE_REG_HEXDIGIT:
case SCE_REG_OPERATOR:
context.SetState(SCE_REG_DEFAULT);
break;
case SCE_REG_DELETEDKEY:
case SCE_REG_ADDEDKEY: {
int currPos = static_cast<int>(context.currentPos);
if (context.ch == ']' && AtKeyPathEnd(styler, currPos)) {
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == '{') {
if (AtGUID(styler, currPos)) {
beforeGUID = context.state;
context.SetState(SCE_REG_KEYPATH_GUID);
}
}
}
break;
case SCE_REG_ESCAPED:
if (context.ch == '"') {
context.SetState(beforeEscape);
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == '\\') {
context.Forward();
} else {
context.SetState(beforeEscape);
beforeEscape = SCE_REG_DEFAULT;
}
break;
case SCE_REG_STRING_GUID:
case SCE_REG_KEYPATH_GUID: {
if (context.ch == '}') {
context.ForwardSetState(beforeGUID);
beforeGUID = SCE_REG_DEFAULT;
}
int currPos = static_cast<int>(context.currentPos);
if (context.ch == '"' && IsStringState(context.state)) {
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == ']' &&
AtKeyPathEnd(styler, currPos) &&
IsKeyPathState(context.state)) {
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == '\\' && IsStringState(context.state)) {
beforeEscape = context.state;
context.SetState(SCE_REG_ESCAPED);
context.Forward();
}
}
break;
}
// Determine if a new state should be entered.
if (context.state == SCE_REG_DEFAULT) {
int currPos = static_cast<int>(context.currentPos);
if (context.ch == ';') {
context.SetState(SCE_REG_COMMENT);
} else if (context.ch == '"') {
if (AtValueName(styler, currPos)) {
context.SetState(SCE_REG_VALUENAME);
} else {
context.SetState(SCE_REG_STRING);
}
} else if (context.ch == '[') {
if (IsNextNonWhitespace(styler, currPos, '-')) {
context.SetState(SCE_REG_DELETEDKEY);
} else {
context.SetState(SCE_REG_ADDEDKEY);
}
} else if (context.ch == '=') {
afterEqualSign = true;
highlight = true;
} else if (afterEqualSign) {
bool wordStart = isalpha(context.ch) && !isalpha(context.chPrev);
if (wordStart && AtValueType(styler, currPos)) {
context.SetState(SCE_REG_VALUETYPE);
}
} else if (isxdigit(context.ch) && highlight) {
context.SetState(SCE_REG_HEXDIGIT);
}
highlight = (context.ch == '@') ? true : highlight;
if (setOperators.Contains(context.ch) && highlight) {
context.SetState(SCE_REG_OPERATOR);
}
}
context.Forward();
}
context.Complete();
}
// Folding similar to that of FoldPropsDoc in LexOthers
void SCI_METHOD LexerRegistry::Fold(unsigned startPos,
int length,
int,
IDocument *pAccess) {
if (!options.fold) {
return;
}
LexAccessor styler(pAccess);
int currLine = styler.GetLine(startPos);
int visibleChars = 0;
unsigned endPos = startPos + length;
bool atKeyPath = false;
for (unsigned i = startPos; i < endPos; i++) {
atKeyPath = IsKeyPathState(styler.StyleAt(i)) ? true : atKeyPath;
char curr = styler.SafeGetCharAt(i);
char next = styler.SafeGetCharAt(i+1);
bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (atEOL || i == (endPos-1)) {
int level = SC_FOLDLEVELBASE;
if (currLine > 0) {
int prevLevel = styler.LevelAt(currLine-1);
if (prevLevel & SC_FOLDLEVELHEADERFLAG) {
level += 1;
} else {
level = prevLevel;
}
}
if (!visibleChars && options.foldCompact) {
level |= SC_FOLDLEVELWHITEFLAG;
} else if (atKeyPath) {
level = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
}
if (level != styler.LevelAt(currLine)) {
styler.SetLevel(currLine, level);
}
currLine++;
visibleChars = 0;
atKeyPath = false;
}
if (!isspacechar(curr)) {
visibleChars++;
}
}
// Make the folding reach the last line in the file
int level = SC_FOLDLEVELBASE;
if (currLine > 0) {
int prevLevel = styler.LevelAt(currLine-1);
if (prevLevel & SC_FOLDLEVELHEADERFLAG) {
level += 1;
} else {
level = prevLevel;
}
}
styler.SetLevel(currLine, level);
}
LexerModule lmRegistry(SCLEX_REGISTRY,
LexerRegistry::LexerFactoryRegistry,
"registry",
RegistryWordListDesc);

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
#include "Scintilla.h" #include "Scintilla.h"
#include "SciLexer.h" #include "SciLexer.h"
#include "PropSetSimple.h"
#include "WordList.h" #include "WordList.h"
#include "LexAccessor.h" #include "LexAccessor.h"
#include "Accessor.h" #include "Accessor.h"
@@ -28,7 +29,6 @@
#include "CharacterSet.h" #include "CharacterSet.h"
#include "LexerModule.h" #include "LexerModule.h"
#include "OptionSet.h" #include "OptionSet.h"
#include "PropSetSimple.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
@@ -230,7 +230,9 @@ static void ScanIdentifier(Accessor& styler, int& pos, WordList *keywords) {
} }
} }
static void ScanDigits(Accessor& styler, int& pos, int base) { /* Scans a sequence of digits, returning true if it found any. */
static bool ScanDigits(Accessor& styler, int& pos, int base) {
int old_pos = pos;
for (;;) { for (;;) {
int c = styler.SafeGetCharAt(pos, '\0'); int c = styler.SafeGetCharAt(pos, '\0');
if (IsADigit(c, base) || c == '_') if (IsADigit(c, base) || c == '_')
@@ -238,13 +240,17 @@ static void ScanDigits(Accessor& styler, int& pos, int base) {
else else
break; break;
} }
return old_pos != pos;
} }
/* Scans an integer and floating point literals. */
static void ScanNumber(Accessor& styler, int& pos) { static void ScanNumber(Accessor& styler, int& pos) {
int base = 10; int base = 10;
int c = styler.SafeGetCharAt(pos, '\0'); int c = styler.SafeGetCharAt(pos, '\0');
int n = styler.SafeGetCharAt(pos + 1, '\0'); int n = styler.SafeGetCharAt(pos + 1, '\0');
bool error = false; bool error = false;
/* Scan the prefix, thus determining the base.
* 10 is default if there's no prefix. */
if (c == '0' && n == 'x') { if (c == '0' && n == 'x') {
pos += 2; pos += 2;
base = 16; base = 16;
@@ -255,14 +261,17 @@ static void ScanNumber(Accessor& styler, int& pos) {
pos += 2; pos += 2;
base = 8; base = 8;
} }
int old_pos = pos;
ScanDigits(styler, pos, base); /* Scan initial digits. The literal is malformed if there are none. */
error |= !ScanDigits(styler, pos, base);
/* See if there's an integer suffix. We mimic the Rust's lexer
* and munch it even if there was an error above. */
c = styler.SafeGetCharAt(pos, '\0'); c = styler.SafeGetCharAt(pos, '\0');
if (c == 'u' || c == 'i') { if (c == 'u' || c == 'i') {
pos++; pos++;
c = styler.SafeGetCharAt(pos, '\0'); c = styler.SafeGetCharAt(pos, '\0');
n = styler.SafeGetCharAt(pos + 1, '\0'); n = styler.SafeGetCharAt(pos + 1, '\0');
if (c == '8') { if (c == '8' || c == 's') {
pos++; pos++;
} else if (c == '1' && n == '6') { } else if (c == '1' && n == '6') {
pos += 2; pos += 2;
@@ -270,15 +279,25 @@ static void ScanNumber(Accessor& styler, int& pos) {
pos += 2; pos += 2;
} else if (c == '6' && n == '4') { } else if (c == '6' && n == '4') {
pos += 2; pos += 2;
} else {
error = true;
} }
} else { /* See if it's a floating point literal. These literals have to be base 10.
*/
} else if (!error) {
/* If there's a period, it's a floating point literal unless it's
* followed by an identifier (meaning this is a method call, e.g.
* `1.foo()`) or another period, in which case it's a range (e.g. 1..2)
*/
n = styler.SafeGetCharAt(pos + 1, '\0'); n = styler.SafeGetCharAt(pos + 1, '\0');
if (c == '.' && !(IsIdentifierStart(n) || n == '.')) { if (c == '.' && !(IsIdentifierStart(n) || n == '.')) {
error |= base != 10; error |= base != 10;
pos++; pos++;
/* It's ok to have no digits after the period. */
ScanDigits(styler, pos, 10); ScanDigits(styler, pos, 10);
} }
/* Look for the exponentiation. */
c = styler.SafeGetCharAt(pos, '\0'); c = styler.SafeGetCharAt(pos, '\0');
if (c == 'e' || c == 'E') { if (c == 'e' || c == 'E') {
error |= base != 10; error |= base != 10;
@@ -286,13 +305,11 @@ static void ScanNumber(Accessor& styler, int& pos) {
c = styler.SafeGetCharAt(pos, '\0'); c = styler.SafeGetCharAt(pos, '\0');
if (c == '-' || c == '+') if (c == '-' || c == '+')
pos++; pos++;
int old_pos = pos; /* It is invalid to have no digits in the exponent. */
ScanDigits(styler, pos, 10); error |= !ScanDigits(styler, pos, 10);
if (old_pos == pos) {
error = true;
}
} }
/* Scan the floating point suffix. */
c = styler.SafeGetCharAt(pos, '\0'); c = styler.SafeGetCharAt(pos, '\0');
if (c == 'f') { if (c == 'f') {
error |= base != 10; error |= base != 10;
@@ -308,9 +325,7 @@ static void ScanNumber(Accessor& styler, int& pos) {
} }
} }
} }
if (old_pos == pos) {
error = true;
}
if (error) if (error)
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
else else
@@ -351,7 +366,7 @@ static bool IsValidCharacterEscape(int c) {
} }
static bool IsValidStringEscape(int c) { static bool IsValidStringEscape(int c) {
return IsValidCharacterEscape(c) || c == '\n'; return IsValidCharacterEscape(c) || c == '\n' || c == '\r';
} }
static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool stop_asap) { static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool stop_asap) {
@@ -373,12 +388,12 @@ static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool s
/* This is overly permissive for character literals in order to accept UTF-8 encoded /* This is overly permissive for character literals in order to accept UTF-8 encoded
* character literals. */ * character literals. */
static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos) { static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos, bool ascii_only) {
pos++; pos++;
int c = styler.SafeGetCharAt(pos, '\0'); int c = styler.SafeGetCharAt(pos, '\0');
int n = styler.SafeGetCharAt(pos + 1, '\0'); int n = styler.SafeGetCharAt(pos + 1, '\0');
bool done = false; bool done = false;
bool valid_lifetime = IsIdentifierStart(c); bool valid_lifetime = !ascii_only && IsIdentifierStart(c);
bool valid_char = true; bool valid_char = true;
bool first = true; bool first = true;
while (!done) { while (!done) {
@@ -390,10 +405,10 @@ static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos) {
} else if (n == 'x') { } else if (n == 'x') {
pos += 2; pos += 2;
valid_char = ScanNumericEscape(styler, pos, 2, false); valid_char = ScanNumericEscape(styler, pos, 2, false);
} else if (n == 'u') { } else if (n == 'u' && !ascii_only) {
pos += 2; pos += 2;
valid_char = ScanNumericEscape(styler, pos, 4, false); valid_char = ScanNumericEscape(styler, pos, 4, false);
} else if (n == 'U') { } else if (n == 'U' && !ascii_only) {
pos += 2; pos += 2;
valid_char = ScanNumericEscape(styler, pos, 8, false); valid_char = ScanNumericEscape(styler, pos, 8, false);
} else { } else {
@@ -412,7 +427,10 @@ static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos) {
done = true; done = true;
break; break;
default: default:
if (!IsIdentifierContinue(c) && !first) { if (ascii_only && !IsASCII((char)c)) {
done = true;
valid_char = false;
} else if (!IsIdentifierContinue(c) && !first) {
done = true; done = true;
} else { } else {
pos++; pos++;
@@ -433,7 +451,7 @@ static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos) {
styler.ColourTo(pos - 1, SCE_RUST_LIFETIME); styler.ColourTo(pos - 1, SCE_RUST_LIFETIME);
} else if (valid_char) { } else if (valid_char) {
pos++; pos++;
styler.ColourTo(pos - 1, SCE_RUST_CHARACTER); styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTECHARACTER : SCE_RUST_CHARACTER);
} else { } else {
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
} }
@@ -542,7 +560,7 @@ static void ScanComments(Accessor &styler, int& pos, int max) {
ResumeBlockComment(styler, pos, max, UnknownComment, 1); ResumeBlockComment(styler, pos, max, UnknownComment, 1);
} }
static void ResumeString(Accessor &styler, int& pos, int max) { static void ResumeString(Accessor &styler, int& pos, int max, bool ascii_only) {
int c = styler.SafeGetCharAt(pos, '\0'); int c = styler.SafeGetCharAt(pos, '\0');
bool error = false; bool error = false;
while (c != '"' && !error) { while (c != '"' && !error) {
@@ -559,10 +577,10 @@ static void ResumeString(Accessor &styler, int& pos, int max) {
} else if (n == 'x') { } else if (n == 'x') {
pos += 2; pos += 2;
error = !ScanNumericEscape(styler, pos, 2, true); error = !ScanNumericEscape(styler, pos, 2, true);
} else if (n == 'u') { } else if (n == 'u' && !ascii_only) {
pos += 2; pos += 2;
error = !ScanNumericEscape(styler, pos, 4, true); error = !ScanNumericEscape(styler, pos, 4, true);
} else if (n == 'U') { } else if (n == 'U' && !ascii_only) {
pos += 2; pos += 2;
error = !ScanNumericEscape(styler, pos, 8, true); error = !ScanNumericEscape(styler, pos, 8, true);
} else { } else {
@@ -570,16 +588,19 @@ static void ResumeString(Accessor &styler, int& pos, int max) {
error = true; error = true;
} }
} else { } else {
pos++; if (ascii_only && !IsASCII((char)c))
error = true;
else
pos++;
} }
c = styler.SafeGetCharAt(pos, '\0'); c = styler.SafeGetCharAt(pos, '\0');
} }
if (!error) if (!error)
pos++; pos++;
styler.ColourTo(pos - 1, SCE_RUST_STRING); styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRING : SCE_RUST_STRING);
} }
static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes) { static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes, bool ascii_only) {
for (;;) { for (;;) {
if (pos == styler.LineEnd(styler.GetLine(pos))) if (pos == styler.LineEnd(styler.GetLine(pos)))
styler.SetLineState(styler.GetLine(pos), num_hashes); styler.SetLineState(styler.GetLine(pos), num_hashes);
@@ -594,19 +615,20 @@ static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes)
} }
if (trailing_num_hashes == num_hashes) { if (trailing_num_hashes == num_hashes) {
styler.SetLineState(styler.GetLine(pos), 0); styler.SetLineState(styler.GetLine(pos), 0);
styler.ColourTo(pos - 1, SCE_RUST_STRINGR);
break; break;
} }
} else if (pos >= max) { } else if (pos >= max) {
styler.ColourTo(pos - 1, SCE_RUST_STRINGR);
break; break;
} else { } else {
if (ascii_only && !IsASCII((char)c))
break;
pos++; pos++;
} }
} }
styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRINGR : SCE_RUST_STRINGR);
} }
static void ScanRawString(Accessor &styler, int& pos, int max) { static void ScanRawString(Accessor &styler, int& pos, int max, bool ascii_only) {
pos++; pos++;
int num_hashes = 0; int num_hashes = 0;
while (styler.SafeGetCharAt(pos, '\0') == '#') { while (styler.SafeGetCharAt(pos, '\0') == '#') {
@@ -617,7 +639,7 @@ static void ScanRawString(Accessor &styler, int& pos, int max) {
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
} else { } else {
pos++; pos++;
ResumeRawString(styler, pos, max, num_hashes); ResumeRawString(styler, pos, max, num_hashes, ascii_only);
} }
} }
@@ -635,9 +657,13 @@ void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle,
} else if (initStyle == SCE_RUST_COMMENTLINE || initStyle == SCE_RUST_COMMENTLINEDOC) { } else if (initStyle == SCE_RUST_COMMENTLINE || initStyle == SCE_RUST_COMMENTLINEDOC) {
ResumeLineComment(styler, pos, max, initStyle == SCE_RUST_COMMENTLINEDOC ? DocComment : NotDocComment); ResumeLineComment(styler, pos, max, initStyle == SCE_RUST_COMMENTLINEDOC ? DocComment : NotDocComment);
} else if (initStyle == SCE_RUST_STRING) { } else if (initStyle == SCE_RUST_STRING) {
ResumeString(styler, pos, max); ResumeString(styler, pos, max, false);
} else if (initStyle == SCE_RUST_BYTESTRING) {
ResumeString(styler, pos, max, true);
} else if (initStyle == SCE_RUST_STRINGR) { } else if (initStyle == SCE_RUST_STRINGR) {
ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1)); ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1), false);
} else if (initStyle == SCE_RUST_BYTESTRINGR) {
ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1), true);
} }
while (pos < max) { while (pos < max) {
@@ -645,7 +671,7 @@ void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle,
int n = styler.SafeGetCharAt(pos + 1, '\0'); int n = styler.SafeGetCharAt(pos + 1, '\0');
int n2 = styler.SafeGetCharAt(pos + 2, '\0'); int n2 = styler.SafeGetCharAt(pos + 2, '\0');
if (pos == 0 && c == '#' && n == '!') { if (pos == 0 && c == '#' && n == '!' && n2 != '[') {
pos += 2; pos += 2;
ResumeLineComment(styler, pos, max, NotDocComment); ResumeLineComment(styler, pos, max, NotDocComment);
} else if (IsWhitespace(c)) { } else if (IsWhitespace(c)) {
@@ -653,7 +679,16 @@ void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle,
} else if (c == '/' && (n == '/' || n == '*')) { } else if (c == '/' && (n == '/' || n == '*')) {
ScanComments(styler, pos, max); ScanComments(styler, pos, max);
} else if (c == 'r' && (n == '#' || n == '"')) { } else if (c == 'r' && (n == '#' || n == '"')) {
ScanRawString(styler, pos, max); ScanRawString(styler, pos, max, false);
} else if (c == 'b' && n == 'r' && (n2 == '#' || n2 == '"')) {
pos++;
ScanRawString(styler, pos, max, true);
} else if (c == 'b' && n == '"') {
pos += 2;
ResumeString(styler, pos, max, true);
} else if (c == 'b' && n == '\'') {
pos++;
ScanCharacterLiteralOrLifetime(styler, pos, true);
} else if (IsIdentifierStart(c)) { } else if (IsIdentifierStart(c)) {
ScanIdentifier(styler, pos, keywords); ScanIdentifier(styler, pos, keywords);
} else if (IsADigit(c)) { } else if (IsADigit(c)) {
@@ -668,10 +703,10 @@ void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle,
pos++; pos++;
styler.ColourTo(pos - 1, SCE_RUST_OPERATOR); styler.ColourTo(pos - 1, SCE_RUST_OPERATOR);
} else if (c == '\'') { } else if (c == '\'') {
ScanCharacterLiteralOrLifetime(styler, pos); ScanCharacterLiteralOrLifetime(styler, pos, false);
} else if (c == '"') { } else if (c == '"') {
pos++; pos++;
ResumeString(styler, pos, max); ResumeString(styler, pos, max, false);
} else { } else {
pos++; pos++;
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);

View File

@@ -54,12 +54,12 @@ static inline bool IsADoxygenChar(int ch) {
ch == '}' || ch == '[' || ch == ']'); ch == '}' || ch == '[' || ch == ']');
} }
static inline bool IsANumberChar(int ch) { static inline bool IsANumberChar(int ch, int chPrev) {
// Not exactly following number definition (several dots are seen as OK, etc.) // Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases. // but probably enough in most cases.
return (ch < 0x80) && return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' || (isdigit(ch) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+'); ch == '.' || ((ch == '-' || ch == '+') && chPrev < 0x80 && toupper(chPrev) == 'E'));
} }
typedef unsigned int sql_state_t; typedef unsigned int sql_state_t;
@@ -444,6 +444,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
int styleBeforeDCKeyword = SCE_SQL_DEFAULT; int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
int offset = 0; int offset = 0;
for (; sc.More(); sc.Forward(), offset++) { for (; sc.More(); sc.Forward(), offset++) {
// Determine if the current state should terminate. // Determine if the current state should terminate.
switch (sc.state) { switch (sc.state) {
@@ -452,7 +453,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
break; break;
case SCE_SQL_NUMBER: case SCE_SQL_NUMBER:
// We stop the number definition on non-numerical non-dot non-eE non-sign char // We stop the number definition on non-numerical non-dot non-eE non-sign char
if (!IsANumberChar(sc.ch)) { if (!IsANumberChar(sc.ch, sc.chPrev)) {
sc.SetState(SCE_SQL_DEFAULT); sc.SetState(SCE_SQL_DEFAULT);
} }
break; break;
@@ -556,11 +557,45 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
} }
} }
break; break;
case SCE_SQL_QOPERATOR:
// Locate the unique Q operator character
sc.Complete();
char qOperator = 0x00;
for (int styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) {
if (styler.StyleAt(styleStartPos - 1) != SCE_SQL_QOPERATOR) {
qOperator = styler.SafeGetCharAt(styleStartPos + 2);
break;
}
}
char qComplement = 0x00;
if (qOperator == '<') {
qComplement = '>';
} else if (qOperator == '(') {
qComplement = ')';
} else if (qOperator == '{') {
qComplement = '}';
} else if (qOperator == '[') {
qComplement = ']';
} else {
qComplement = qOperator;
}
if (sc.Match(qComplement, '\'')) {
sc.Forward();
sc.ForwardSetState(SCE_SQL_DEFAULT);
}
break;
} }
// Determine if a new state should be entered. // Determine if a new state should be entered.
if (sc.state == SCE_SQL_DEFAULT) { if (sc.state == SCE_SQL_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (sc.Match('q', '\'') || sc.Match('Q', '\'')) {
sc.SetState(SCE_SQL_QOPERATOR);
sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) ||
((sc.ch == '-' || sc.ch == '+') && IsADigit(sc.chNext) && !IsADigit(sc.chPrev))) {
sc.SetState(SCE_SQL_NUMBER); sc.SetState(SCE_SQL_NUMBER);
} else if (IsAWordStart(sc.ch)) { } else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_SQL_IDENTIFIER); sc.SetState(SCE_SQL_IDENTIFIER);

View File

@@ -33,9 +33,9 @@ static void ClassifySTTXTWord(WordList *keywordlists[], StyleContext &sc)
char s[256] = { 0 }; char s[256] = { 0 };
sc.GetCurrentLowered(s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s));
if ((*keywordlists[0]).InList(s)) { if ((*keywordlists[0]).InList(s)) {
sc.ChangeState(SCE_STTXT_KEYWORD); sc.ChangeState(SCE_STTXT_KEYWORD);
} }
else if ((*keywordlists[1]).InList(s)) { else if ((*keywordlists[1]).InList(s)) {
sc.ChangeState(SCE_STTXT_TYPE); sc.ChangeState(SCE_STTXT_TYPE);
@@ -72,8 +72,8 @@ static void ColouriseSTTXTDoc (unsigned int startPos, int length, int initStyle,
CharacterSet setOperator(CharacterSet::setNone,",.+-*/:;<=>[]()%&"); CharacterSet setOperator(CharacterSet::setNone,",.+-*/:;<=>[]()%&");
CharacterSet setDataTime(CharacterSet::setDigits,"_.-:dmshDMSH"); CharacterSet setDataTime(CharacterSet::setDigits,"_.-:dmshDMSH");
for ( ; sc.More() ; sc.Forward()) for ( ; sc.More() ; sc.Forward())
{ {
if(sc.atLineStart && sc.state != SCE_STTXT_COMMENT) if(sc.atLineStart && sc.state != SCE_STTXT_COMMENT)
sc.SetState(SCE_STTXT_DEFAULT); sc.SetState(SCE_STTXT_DEFAULT);
@@ -181,7 +181,7 @@ static void ColouriseSTTXTDoc (unsigned int startPos, int length, int initStyle,
else if (setOperator.Contains(sc.ch)) else if (setOperator.Contains(sc.ch))
sc.SetState(SCE_STTXT_OPERATOR); sc.SetState(SCE_STTXT_OPERATOR);
} }
} }
if (sc.state == SCE_STTXT_IDENTIFIER && setWord.Contains(sc.chPrev)) if (sc.state == SCE_STTXT_IDENTIFIER && setWord.Contains(sc.chPrev))
ClassifySTTXTWord(keywordlists, sc); ClassifySTTXTWord(keywordlists, sc);
@@ -355,7 +355,7 @@ static void FoldSTTXTDoc(unsigned int startPos, int length, int initStyle, WordL
} }
if ( foldComment && atEOL && ( IsCommentLine(lineCurrent, styler,false) if ( foldComment && atEOL && ( IsCommentLine(lineCurrent, styler,false)
|| IsCommentLine(lineCurrent,styler,true))) { || IsCommentLine(lineCurrent,styler,true))) {
if(!IsCommentLine(lineCurrent-1, styler,true) && IsCommentLine(lineCurrent+1, styler,true)) if(!IsCommentLine(lineCurrent-1, styler,true) && IsCommentLine(lineCurrent+1, styler,true))
levelCurrent++; levelCurrent++;
if (IsCommentLine(lineCurrent-1, styler,true) && !IsCommentLine(lineCurrent+1, styler,true)) if (IsCommentLine(lineCurrent-1, styler,true) && !IsCommentLine(lineCurrent+1, styler,true))
levelCurrent--; levelCurrent--;

View File

@@ -127,11 +127,10 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
} }
} }
styler.StartAt(startPos, 127); styler.StartAt(startPos);
WordList &keywords = *keywordlists[0]; WordList &keywords = *keywordlists[0];
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
char prevWord[200]; char prevWord[200];
prevWord[0] = '\0'; prevWord[0] = '\0';
if (length == 0) return; if (length == 0) return;
@@ -143,37 +142,9 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
char chPrev2 = ' '; char chPrev2 = ' ';
char chNext = styler[startPos]; char chNext = styler[startPos];
styler.StartSegment(startPos); styler.StartSegment(startPos);
bool atStartLine = true;
int spaceFlags = 0;
for (int i = startPos; i < lengthDoc; i++) for (int i = startPos; i < lengthDoc; i++)
{ {
if (atStartLine)
{
char chBad = static_cast<char>(64);
char chGood = static_cast<char>(0);
char chFlags = chGood;
if (whingeLevel == 1)
{
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
}
else if (whingeLevel == 2)
{
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
}
else if (whingeLevel == 3)
{
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
}
else if (whingeLevel == 4)
{
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
}
styler.SetFlags(chFlags, static_cast<char>(state));
atStartLine = false;
}
char ch = chNext; char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
@@ -185,7 +156,6 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
{ {
styler.ColourTo(i, state); styler.ColourTo(i, state);
} }
atStartLine = true;
} }
if (styler.IsLeadByte(ch)) if (styler.IsLeadByte(ch))

View File

@@ -8,10 +8,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include "ILexer.h" #include "ILexer.h"
#include "Scintilla.h" #include "Scintilla.h"

View File

@@ -30,7 +30,7 @@ using namespace Scintilla;
// Extended to accept accented characters // Extended to accept accented characters
static inline bool IsAWordChar(int ch) { static inline bool IsAWordChar(int ch) {
return ch >= 0x80 || return ch >= 0x80 ||
(isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator (isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator
} }
static inline bool IsAWordStart(int ch) { static inline bool IsAWordStart(int ch) {
@@ -49,17 +49,18 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k
#define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT) #define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT)
bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool commentLevel = false; bool commentLevel = false;
bool subBrace = false; // substitution begin with a brace ${.....} bool subBrace = false; // substitution begin with a brace ${.....}
enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf, enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,
LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 } lineState = LS_DEFAULT; LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32
} lineState = LS_DEFAULT;
bool prevSlash = false; bool prevSlash = false;
int currentLevel = 0; int currentLevel = 0;
bool expected = 0; bool expected = 0;
bool subParen = 0; bool subParen = 0;
int currentLine = styler.GetLine(startPos); int currentLine = styler.GetLine(startPos);
if (currentLine > 0) if (currentLine > 0)
currentLine--; currentLine--;
length += startPos - styler.LineStart(currentLine); length += startPos - styler.LineStart(currentLine);
// make sure lines overlap // make sure lines overlap
startPos = styler.LineStart(currentLine); startPos = styler.LineStart(currentLine);
@@ -71,14 +72,14 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k
WordList &keywords5 = *keywordlists[4]; WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5]; WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6]; WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7]; WordList &keywords8 = *keywordlists[7];
WordList &keywords9 = *keywordlists[8]; WordList &keywords9 = *keywordlists[8];
if (currentLine > 0) { if (currentLine > 0) {
int ls = styler.GetLineState(currentLine - 1); int ls = styler.GetLineState(currentLine - 1);
lineState = tLineState(ls & LS_MASK_STATE); lineState = tLineState(ls & LS_MASK_STATE);
expected = LS_COMMAND_EXPECTED == tLineState(ls & LS_COMMAND_EXPECTED); expected = LS_COMMAND_EXPECTED == tLineState(ls & LS_COMMAND_EXPECTED);
subBrace = LS_BRACE_ONLY == tLineState(ls & LS_BRACE_ONLY); subBrace = LS_BRACE_ONLY == tLineState(ls & LS_BRACE_ONLY);
currentLevel = styler.LevelAt(currentLine - 1) >> 17; currentLevel = styler.LevelAt(currentLine - 1) >> 17;
commentLevel = (styler.LevelAt(currentLine - 1) >> 16) & 1; commentLevel = (styler.LevelAt(currentLine - 1) >> 16) & 1;
} else } else
@@ -86,105 +87,104 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k
bool visibleChars = false; bool visibleChars = false;
int previousLevel = currentLevel; int previousLevel = currentLevel;
StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler); StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler);
for (; ; sc.Forward()) { for (; ; sc.Forward()) {
next: next:
if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac
continue; continue;
bool atEnd = !sc.More(); // make sure we coloured the last word bool atEnd = !sc.More(); // make sure we coloured the last word
if (lineState != LS_DEFAULT) { if (lineState != LS_DEFAULT) {
sc.SetState(SCE_TCL_DEFAULT); sc.SetState(SCE_TCL_DEFAULT);
if (lineState == LS_OPEN_COMMENT) if (lineState == LS_OPEN_COMMENT)
sc.SetState(SCE_TCL_COMMENTLINE); sc.SetState(SCE_TCL_COMMENTLINE);
else if (lineState == LS_OPEN_DOUBLE_QUOTE) else if (lineState == LS_OPEN_DOUBLE_QUOTE)
sc.SetState(SCE_TCL_IN_QUOTE); sc.SetState(SCE_TCL_IN_QUOTE);
else if (lineState == LS_COMMENT_BOX && (sc.ch == '#' || (sc.ch == ' ' && sc.chNext=='#'))) else if (lineState == LS_COMMENT_BOX && (sc.ch == '#' || (sc.ch == ' ' && sc.chNext=='#')))
sc.SetState(SCE_TCL_COMMENT_BOX); sc.SetState(SCE_TCL_COMMENT_BOX);
lineState = LS_DEFAULT; lineState = LS_DEFAULT;
} }
if (subBrace) { // ${ overrides every thing even \ except } if (subBrace) { // ${ overrides every thing even \ except }
if (sc.ch == '}') { if (sc.ch == '}') {
subBrace = false; subBrace = false;
sc.SetState(SCE_TCL_OPERATOR); sc.SetState(SCE_TCL_OPERATOR);
sc.ForwardSetState(SCE_TCL_DEFAULT); sc.ForwardSetState(SCE_TCL_DEFAULT);
goto next; goto next;
} } else
else sc.SetState(SCE_TCL_SUB_BRACE);
sc.SetState(SCE_TCL_SUB_BRACE); if (!sc.atLineEnd)
if (!sc.atLineEnd) continue;
continue; } else if (sc.state == SCE_TCL_DEFAULT || sc.state ==SCE_TCL_OPERATOR) {
} else if (sc.state == SCE_TCL_DEFAULT || sc.state ==SCE_TCL_OPERATOR) { expected &= isspacechar(static_cast<unsigned char>(sc.ch)) || IsAWordStart(sc.ch) || sc.ch =='#';
expected &= isspacechar(static_cast<unsigned char>(sc.ch)) || IsAWordStart(sc.ch) || sc.ch =='#'; } else if (sc.state == SCE_TCL_SUBSTITUTION) {
} else if (sc.state == SCE_TCL_SUBSTITUTION) { switch (sc.ch) {
switch(sc.ch) { case '(':
case '(': subParen=true;
subParen=true; sc.SetState(SCE_TCL_OPERATOR);
sc.SetState(SCE_TCL_OPERATOR); sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
sc.ForwardSetState(SCE_TCL_SUBSTITUTION); continue;
continue; case ')':
case ')': sc.SetState(SCE_TCL_OPERATOR);
sc.SetState(SCE_TCL_OPERATOR); subParen=false;
subParen=false; continue;
continue; case '$':
case '$': continue;
continue; case ',':
case ',': sc.SetState(SCE_TCL_OPERATOR);
sc.SetState(SCE_TCL_OPERATOR); if (subParen)
if (subParen) sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
sc.ForwardSetState(SCE_TCL_SUBSTITUTION); continue;
continue; default :
default : // maybe spaces should be allowed ???
// maybe spaces should be allowed ??? if (!IsAWordChar(sc.ch)) { // probably the code is wrong
if (!IsAWordChar(sc.ch)) { // probably the code is wrong sc.SetState(SCE_TCL_DEFAULT);
sc.SetState(SCE_TCL_DEFAULT); subParen = 0;
subParen = 0; }
} break;
break; }
} } else if (isComment(sc.state)) {
} else if (isComment(sc.state)) { } else if (!IsAWordChar(sc.ch)) {
} else if (!IsAWordChar(sc.ch)) { if ((sc.state == SCE_TCL_IDENTIFIER && expected) || sc.state == SCE_TCL_MODIFIER) {
if ((sc.state == SCE_TCL_IDENTIFIER && expected) || sc.state == SCE_TCL_MODIFIER) { char w[100];
char w[100]; char *s=w;
char *s=w; sc.GetCurrent(w, sizeof(w));
sc.GetCurrent(w, sizeof(w)); if (w[strlen(w)-1]=='\r')
if (w[strlen(w)-1]=='\r') w[strlen(w)-1]=0;
w[strlen(w)-1]=0; while (*s == ':') // ignore leading : like in ::set a 10
while(*s == ':') // ignore leading : like in ::set a 10 ++s;
++s; bool quote = sc.state == SCE_TCL_IN_QUOTE;
bool quote = sc.state == SCE_TCL_IN_QUOTE; if (commentLevel || expected) {
if (commentLevel || expected) { if (keywords.InList(s)) {
if (keywords.InList(s)) { sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD);
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD); } else if (keywords2.InList(s)) {
} else if (keywords2.InList(s)) { sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD2);
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD2); } else if (keywords3.InList(s)) {
} else if (keywords3.InList(s)) { sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD3);
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD3); } else if (keywords4.InList(s)) {
} else if (keywords4.InList(s)) { sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD4);
sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD4); } else if (sc.GetRelative(-static_cast<int>(strlen(s))-1) == '{' &&
} else if (sc.GetRelative(-static_cast<int>(strlen(s))-1) == '{' && keywords5.InList(s) && sc.ch == '}') { // {keyword} exactly no spaces
keywords5.InList(s) && sc.ch == '}') { // {keyword} exactly no spaces sc.ChangeState(SCE_TCL_EXPAND);
sc.ChangeState(SCE_TCL_EXPAND); }
} if (keywords6.InList(s)) {
if (keywords6.InList(s)) { sc.ChangeState(SCE_TCL_WORD5);
sc.ChangeState(SCE_TCL_WORD5); } else if (keywords7.InList(s)) {
} else if (keywords7.InList(s)) { sc.ChangeState(SCE_TCL_WORD6);
sc.ChangeState(SCE_TCL_WORD6); } else if (keywords8.InList(s)) {
} else if (keywords8.InList(s)) { sc.ChangeState(SCE_TCL_WORD7);
sc.ChangeState(SCE_TCL_WORD7); } else if (keywords9.InList(s)) {
} else if (keywords9.InList(s)) { sc.ChangeState(SCE_TCL_WORD8);
sc.ChangeState(SCE_TCL_WORD8); }
} }
} expected = false;
expected = false; sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT);
sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT); } else if (sc.state == SCE_TCL_MODIFIER || sc.state == SCE_TCL_IDENTIFIER) {
} else if (sc.state == SCE_TCL_MODIFIER || sc.state == SCE_TCL_IDENTIFIER) { sc.SetState(SCE_TCL_DEFAULT);
sc.SetState(SCE_TCL_DEFAULT); }
} }
}
if (atEnd) if (atEnd)
break; break;
if (sc.atLineEnd) { if (sc.atLineEnd) {
lineState = LS_DEFAULT; lineState = LS_DEFAULT;
currentLine = styler.GetLine(sc.currentPos); currentLine = styler.GetLine(sc.currentPos);
if (foldComment && sc.state!=SCE_TCL_COMMENT && isComment(sc.state)) { if (foldComment && sc.state!=SCE_TCL_COMMENT && isComment(sc.state)) {
if (currentLevel == 0) { if (currentLevel == 0) {
@@ -206,45 +206,45 @@ next:
styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16)); styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16));
// Update the line state, so it can be seen by next line // Update the line state, so it can be seen by next line
if (sc.state == SCE_TCL_IN_QUOTE) if (sc.state == SCE_TCL_IN_QUOTE) {
lineState = LS_OPEN_DOUBLE_QUOTE; lineState = LS_OPEN_DOUBLE_QUOTE;
else { } else {
if (prevSlash) { if (prevSlash) {
if (isComment(sc.state)) if (isComment(sc.state))
lineState = LS_OPEN_COMMENT; lineState = LS_OPEN_COMMENT;
} else if (sc.state == SCE_TCL_COMMENT_BOX) } else if (sc.state == SCE_TCL_COMMENT_BOX)
lineState = LS_COMMENT_BOX; lineState = LS_COMMENT_BOX;
} }
styler.SetLineState(currentLine, styler.SetLineState(currentLine,
(subBrace ? LS_BRACE_ONLY : 0) | (subBrace ? LS_BRACE_ONLY : 0) |
(expected ? LS_COMMAND_EXPECTED : 0) | lineState); (expected ? LS_COMMAND_EXPECTED : 0) | lineState);
if (lineState == LS_COMMENT_BOX) if (lineState == LS_COMMENT_BOX)
sc.ForwardSetState(SCE_TCL_COMMENT_BOX); sc.ForwardSetState(SCE_TCL_COMMENT_BOX);
else if (lineState == LS_OPEN_DOUBLE_QUOTE) else if (lineState == LS_OPEN_DOUBLE_QUOTE)
sc.ForwardSetState(SCE_TCL_IN_QUOTE); sc.ForwardSetState(SCE_TCL_IN_QUOTE);
else else
sc.ForwardSetState(SCE_TCL_DEFAULT); sc.ForwardSetState(SCE_TCL_DEFAULT);
prevSlash = false; prevSlash = false;
previousLevel = currentLevel; previousLevel = currentLevel;
goto next; goto next;
} }
if (prevSlash) { if (prevSlash) {
prevSlash = false; prevSlash = false;
if (sc.ch == '#' && IsANumberChar(sc.chNext)) if (sc.ch == '#' && IsANumberChar(sc.chNext))
sc.ForwardSetState(SCE_TCL_NUMBER); sc.ForwardSetState(SCE_TCL_NUMBER);
continue; continue;
} }
prevSlash = sc.ch == '\\'; prevSlash = sc.ch == '\\';
if (isComment(sc.state)) if (isComment(sc.state))
continue; continue;
if (sc.atLineStart) { if (sc.atLineStart) {
visibleChars = false; visibleChars = false;
if (sc.state!=SCE_TCL_IN_QUOTE && !isComment(sc.state)) if (sc.state!=SCE_TCL_IN_QUOTE && !isComment(sc.state))
{ {
sc.SetState(SCE_TCL_DEFAULT); sc.SetState(SCE_TCL_DEFAULT);
expected = IsAWordStart(sc.ch)|| isspacechar(static_cast<unsigned char>(sc.ch)); expected = IsAWordStart(sc.ch)|| isspacechar(static_cast<unsigned char>(sc.ch));
} }
} }
switch (sc.state) { switch (sc.state) {
@@ -259,28 +259,28 @@ next:
goto next; goto next;
} else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') { } else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') {
sc.SetState(SCE_TCL_OPERATOR); sc.SetState(SCE_TCL_OPERATOR);
expected = sc.ch == '['; expected = sc.ch == '[';
sc.ForwardSetState(SCE_TCL_IN_QUOTE); sc.ForwardSetState(SCE_TCL_IN_QUOTE);
goto next; goto next;
} }
continue; continue;
case SCE_TCL_OPERATOR: case SCE_TCL_OPERATOR:
sc.SetState(SCE_TCL_DEFAULT); sc.SetState(SCE_TCL_DEFAULT);
break; break;
} }
if (sc.ch == '#') { if (sc.ch == '#') {
if (visibleChars) { if (visibleChars) {
if (sc.state != SCE_TCL_IN_QUOTE && expected) if (sc.state != SCE_TCL_IN_QUOTE && expected)
sc.SetState(SCE_TCL_COMMENT); sc.SetState(SCE_TCL_COMMENT);
} else { } else {
sc.SetState(SCE_TCL_COMMENTLINE); sc.SetState(SCE_TCL_COMMENTLINE);
if (sc.chNext == '~') if (sc.chNext == '~')
sc.SetState(SCE_TCL_BLOCK_COMMENT); sc.SetState(SCE_TCL_BLOCK_COMMENT);
if (sc.atLineStart && (sc.chNext == '#' || sc.chNext == '-')) if (sc.atLineStart && (sc.chNext == '#' || sc.chNext == '-'))
sc.SetState(SCE_TCL_COMMENT_BOX); sc.SetState(SCE_TCL_COMMENT_BOX);
} }
} }
if (!isspacechar(static_cast<unsigned char>(sc.ch))) { if (!isspacechar(static_cast<unsigned char>(sc.ch))) {
visibleChars = true; visibleChars = true;
@@ -293,7 +293,7 @@ next:
// Determine if a new state should be entered. // Determine if a new state should be entered.
if (sc.state == SCE_TCL_DEFAULT) { if (sc.state == SCE_TCL_DEFAULT) {
if (IsAWordStart(sc.ch)) { if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_TCL_IDENTIFIER); sc.SetState(SCE_TCL_IDENTIFIER);
} else if (IsADigit(sc.ch) && !IsAWordChar(sc.chPrev)) { } else if (IsADigit(sc.ch) && !IsAWordChar(sc.chPrev)) {
sc.SetState(SCE_TCL_NUMBER); sc.SetState(SCE_TCL_NUMBER);
@@ -313,39 +313,38 @@ next:
--currentLevel; --currentLevel;
break; break;
case '[': case '[':
expected = true; expected = true;
case ']': case ']':
case '(': case '(':
case ')': case ')':
sc.SetState(SCE_TCL_OPERATOR); sc.SetState(SCE_TCL_OPERATOR);
break; break;
case ';': case ';':
expected = true; expected = true;
break; break;
case '$': case '$':
subParen = 0; subParen = 0;
if (sc.chNext != '{') { if (sc.chNext != '{') {
sc.SetState(SCE_TCL_SUBSTITUTION); sc.SetState(SCE_TCL_SUBSTITUTION);
} } else {
else { sc.SetState(SCE_TCL_OPERATOR); // $
sc.SetState(SCE_TCL_OPERATOR); // $ sc.Forward(); // {
sc.Forward(); // { sc.ForwardSetState(SCE_TCL_SUB_BRACE);
sc.ForwardSetState(SCE_TCL_SUB_BRACE); subBrace = true;
subBrace = true; }
} break;
break; case '#':
case '#': if ((isspacechar(static_cast<unsigned char>(sc.chPrev))||
if ((isspacechar(static_cast<unsigned char>(sc.chPrev))|| isoperator(static_cast<char>(sc.chPrev))) && IsADigit(sc.chNext,0x10))
isoperator(static_cast<char>(sc.chPrev))) && IsADigit(sc.chNext,0x10)) sc.SetState(SCE_TCL_NUMBER);
sc.SetState(SCE_TCL_NUMBER); break;
break; case '-':
case '-': sc.SetState(IsADigit(sc.chNext)? SCE_TCL_NUMBER: SCE_TCL_MODIFIER);
sc.SetState(IsADigit(sc.chNext)? SCE_TCL_NUMBER: SCE_TCL_MODIFIER); break;
break; default:
default: if (isoperator(static_cast<char>(sc.ch))) {
if (isoperator(static_cast<char>(sc.ch))) { sc.SetState(SCE_TCL_OPERATOR);
sc.SetState(SCE_TCL_OPERATOR); }
}
} }
} }
} }
@@ -353,18 +352,18 @@ next:
sc.Complete(); sc.Complete();
} }
static const char * const tclWordListDesc[] = { static const char *const tclWordListDesc[] = {
"TCL Keywords", "TCL Keywords",
"TK Keywords", "TK Keywords",
"iTCL Keywords", "iTCL Keywords",
"tkCommands", "tkCommands",
"expand" "expand",
"user1", "user1",
"user2", "user2",
"user3", "user3",
"user4", "user4",
0 0
}; };
// this code supports folding in the colourizer // this code supports folding in the colourizer
LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc); LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc);

View File

@@ -12,10 +12,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include "ILexer.h" #include "ILexer.h"
#include "Scintilla.h" #include "Scintilla.h"
@@ -72,6 +72,7 @@ static void ColouriseVHDLDoc(
WordList &User = *keywordlists[6]; WordList &User = *keywordlists[6];
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
bool isExtendedId = false; // true when parsing an extended identifier
for (; sc.More(); sc.Forward()) for (; sc.More(); sc.Forward())
{ {
@@ -84,7 +85,7 @@ static void ColouriseVHDLDoc(
sc.SetState(SCE_VHDL_DEFAULT); sc.SetState(SCE_VHDL_DEFAULT);
} }
} else if (sc.state == SCE_VHDL_IDENTIFIER) { } else if (sc.state == SCE_VHDL_IDENTIFIER) {
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { if (!isExtendedId && (!IsAWordChar(sc.ch) || (sc.ch == '.'))) {
char s[100]; char s[100];
sc.GetCurrentLowered(s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s));
if (Keywords.InList(s)) { if (Keywords.InList(s)) {
@@ -103,6 +104,10 @@ static void ColouriseVHDLDoc(
sc.ChangeState(SCE_VHDL_USERWORD); sc.ChangeState(SCE_VHDL_USERWORD);
} }
sc.SetState(SCE_VHDL_DEFAULT); sc.SetState(SCE_VHDL_DEFAULT);
} else if (isExtendedId && ((sc.ch == '\\') || sc.atLineEnd)) {
// extended identifiers are terminated by backslash, check for end of line in case we have invalid syntax
isExtendedId = false;
sc.ForwardSetState(SCE_VHDL_DEFAULT);
} }
} else if (sc.state == SCE_VHDL_COMMENT || sc.state == SCE_VHDL_COMMENTLINEBANG) { } else if (sc.state == SCE_VHDL_COMMENT || sc.state == SCE_VHDL_COMMENTLINEBANG) {
if (sc.atLineEnd) { if (sc.atLineEnd) {
@@ -119,6 +124,11 @@ static void ColouriseVHDLDoc(
sc.ChangeState(SCE_VHDL_STRINGEOL); sc.ChangeState(SCE_VHDL_STRINGEOL);
sc.ForwardSetState(SCE_VHDL_DEFAULT); sc.ForwardSetState(SCE_VHDL_DEFAULT);
} }
} else if (sc.state == SCE_VHDL_BLOCK_COMMENT){
if(sc.ch == '*' && sc.chNext == '/'){
sc.Forward();
sc.ForwardSetState(SCE_VHDL_DEFAULT);
}
} }
// Determine if a new state should be entered. // Determine if a new state should be entered.
@@ -132,8 +142,13 @@ static void ColouriseVHDLDoc(
sc.SetState(SCE_VHDL_COMMENTLINEBANG); sc.SetState(SCE_VHDL_COMMENTLINEBANG);
else else
sc.SetState(SCE_VHDL_COMMENT); sc.SetState(SCE_VHDL_COMMENT);
} else if (sc.Match('/', '*')){
sc.SetState(SCE_VHDL_BLOCK_COMMENT);
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
sc.SetState(SCE_VHDL_STRING); sc.SetState(SCE_VHDL_STRING);
} else if (sc.ch == '\\') {
isExtendedId = true;
sc.SetState(SCE_VHDL_IDENTIFIER);
} else if (isoperator(static_cast<char>(sc.ch))) { } else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_VHDL_OPERATOR); sc.SetState(SCE_VHDL_OPERATOR);
} }
@@ -155,6 +170,39 @@ static bool IsCommentLine(int line, Accessor &styler) {
} }
return false; return false;
} }
static bool IsCommentBlockStart(int line, Accessor &styler)
{
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
char chNext = styler[i+1];
char style = styler.StyleAt(i);
if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '/') && (chNext == '*'))
return true;
}
return false;
}
static bool IsCommentBlockEnd(int line, Accessor &styler)
{
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
char chNext = styler[i+1];
char style = styler.StyleAt(i);
if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '*') && (chNext == '/'))
return true;
}
return false;
}
static bool IsCommentStyle(char style)
{
return style == SCE_VHDL_BLOCK_COMMENT || style == SCE_VHDL_COMMENT || style == SCE_VHDL_COMMENTLINEBANG;
}
//============================================================================= //=============================================================================
// Folding the code // Folding the code
@@ -167,7 +215,7 @@ static void FoldNoBoxVHDLDoc(
// Decided it would be smarter to have the lexer have all keywords included. Therefore I // Decided it would be smarter to have the lexer have all keywords included. Therefore I
// don't check if the style for the keywords that I use to adjust the levels. // don't check if the style for the keywords that I use to adjust the levels.
char words[] = char words[] =
"architecture begin case component else elsif end entity generate loop package process record then " "architecture begin block case component else elsif end entity generate loop package process record then "
"procedure function when"; "procedure function when";
WordList keywords; WordList keywords;
keywords.Set(words); keywords.Set(words);
@@ -207,14 +255,14 @@ static void FoldNoBoxVHDLDoc(
char chPrev = styler.SafeGetCharAt(j-1); char chPrev = styler.SafeGetCharAt(j-1);
int style = styler.StyleAt(j); int style = styler.StyleAt(j);
int stylePrev = styler.StyleAt(j-1); int stylePrev = styler.StyleAt(j-1);
if ((stylePrev != SCE_VHDL_COMMENT) && (stylePrev != SCE_VHDL_STRING)) if ((!IsCommentStyle(style)) && (stylePrev != SCE_VHDL_STRING))
{ {
if(IsAWordChar(chPrev) && !IsAWordChar(ch)) if(IsAWordChar(chPrev) && !IsAWordChar(ch))
{ {
end = j-1; end = j-1;
} }
} }
if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING)) if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{ {
if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0)) if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0))
{ {
@@ -236,7 +284,7 @@ static void FoldNoBoxVHDLDoc(
{ {
char ch = styler.SafeGetCharAt(j); char ch = styler.SafeGetCharAt(j);
int style = styler.StyleAt(j); int style = styler.StyleAt(j);
if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING)) if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{ {
if((ch == ';') && (strcmp(prevWord, "end") == 0)) if((ch == ';') && (strcmp(prevWord, "end") == 0))
{ {
@@ -268,15 +316,29 @@ static void FoldNoBoxVHDLDoc(
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) if (foldComment && atEOL)
{ {
if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler)) if(IsCommentLine(lineCurrent, styler))
{ {
levelNext++; if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler))
{
levelNext++;
}
else if(IsCommentLine(lineCurrent-1, styler) && !IsCommentLine(lineCurrent+1, styler))
{
levelNext--;
}
} }
else if(IsCommentLine(lineCurrent-1, styler) && !IsCommentLine(lineCurrent+1, styler)) else
{ {
levelNext--; if (IsCommentBlockStart(lineCurrent, styler) && !IsCommentBlockEnd(lineCurrent, styler))
{
levelNext++;
}
else if (IsCommentBlockEnd(lineCurrent, styler) && !IsCommentBlockStart(lineCurrent, styler))
{
levelNext--;
}
} }
} }
@@ -289,7 +351,7 @@ static void FoldNoBoxVHDLDoc(
} }
} }
if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING)) if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{ {
if((ch == ';') && (strcmp(prevWord, "end") == 0)) if((ch == ';') && (strcmp(prevWord, "end") == 0))
{ {
@@ -301,7 +363,7 @@ static void FoldNoBoxVHDLDoc(
lastStart = i; lastStart = i;
} }
if(iswordchar(ch) && !iswordchar(chNext)) { if(IsAWordChar(ch) && !IsAWordChar(chNext)) {
char s[32]; char s[32];
unsigned int k; unsigned int k;
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) { for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
@@ -314,9 +376,8 @@ static void FoldNoBoxVHDLDoc(
if ( if (
strcmp(s, "architecture") == 0 || strcmp(s, "architecture") == 0 ||
strcmp(s, "case") == 0 || strcmp(s, "case") == 0 ||
strcmp(s, "component") == 0 ||
strcmp(s, "entity") == 0 ||
strcmp(s, "generate") == 0 || strcmp(s, "generate") == 0 ||
strcmp(s, "block") == 0 ||
strcmp(s, "loop") == 0 || strcmp(s, "loop") == 0 ||
strcmp(s, "package") ==0 || strcmp(s, "package") ==0 ||
strcmp(s, "process") == 0 || strcmp(s, "process") == 0 ||
@@ -330,6 +391,33 @@ static void FoldNoBoxVHDLDoc(
} }
levelNext++; levelNext++;
} }
} else if (
strcmp(s, "component") == 0 ||
strcmp(s, "entity") == 0 ||
strcmp(s, "configuration") == 0 )
{
if (strcmp(prevWord, "end") != 0 && lastStart)
{ // check for instantiated unit by backward searching for the colon.
unsigned pos = lastStart;
char chAtPos, styleAtPos;
do{// skip white spaces
pos--;
styleAtPos = styler.StyleAt(pos);
chAtPos = styler.SafeGetCharAt(pos);
}while(pos>0 &&
(chAtPos == ' ' || chAtPos == '\t' ||
chAtPos == '\n' || chAtPos == '\r' ||
IsCommentStyle(styleAtPos)));
// check for a colon (':') before the instantiated units "entity", "component" or "configuration". Don't fold thereafter.
if (chAtPos != ':')
{
if (levelMinCurrentElse > levelNext) {
levelMinCurrentElse = levelNext;
}
levelNext++;
}
}
} else if ( } else if (
strcmp(s, "procedure") == 0 || strcmp(s, "procedure") == 0 ||
strcmp(s, "function") == 0) strcmp(s, "function") == 0)
@@ -338,19 +426,19 @@ static void FoldNoBoxVHDLDoc(
{ // This code checks to see if the procedure / function is a definition within a "package" { // This code checks to see if the procedure / function is a definition within a "package"
// rather than the actual code in the body. // rather than the actual code in the body.
int BracketLevel = 0; int BracketLevel = 0;
for(int j=i+1; j<styler.Length(); j++) for(int pos=i+1; pos<styler.Length(); pos++)
{ {
int LocalStyle = styler.StyleAt(j); int styleAtPos = styler.StyleAt(pos);
char LocalCh = styler.SafeGetCharAt(j); char chAtPos = styler.SafeGetCharAt(pos);
if(LocalCh == '(') BracketLevel++; if(chAtPos == '(') BracketLevel++;
if(LocalCh == ')') BracketLevel--; if(chAtPos == ')') BracketLevel--;
if( if(
(BracketLevel == 0) && (BracketLevel == 0) &&
(LocalStyle != SCE_VHDL_COMMENT) && (!IsCommentStyle(styleAtPos)) &&
(LocalStyle != SCE_VHDL_STRING) && (styleAtPos != SCE_VHDL_STRING) &&
!iswordchar(styler.SafeGetCharAt(j-1)) && !iswordchar(styler.SafeGetCharAt(pos-1)) &&
styler.Match(j, "is") && styler.Match(pos, "is") &&
!iswordchar(styler.SafeGetCharAt(j+2))) !iswordchar(styler.SafeGetCharAt(pos+2)))
{ {
if (levelMinCurrentElse > levelNext) { if (levelMinCurrentElse > levelNext) {
levelMinCurrentElse = levelNext; levelMinCurrentElse = levelNext;
@@ -358,7 +446,7 @@ static void FoldNoBoxVHDLDoc(
levelNext++; levelNext++;
break; break;
} }
if((BracketLevel == 0) && (LocalCh == ';')) if((BracketLevel == 0) && (chAtPos == ';'))
{ {
break; break;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -13,10 +13,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable: 4786) #pragma warning(disable: 4786)
@@ -396,7 +396,7 @@ void SCI_METHOD LexerVisualProlog::Lex(unsigned int startPos, int length, int in
if (sc.atLineEnd) { if (sc.atLineEnd) {
// Update the line state, so it can be seen by next line // Update the line state, so it can be seen by next line
int lineState = 0; int lineState = 0;
if (SCE_VISUALPROLOG_STRING_VERBATIM_EOL == sc.state) { if (SCE_VISUALPROLOG_STRING_VERBATIM_EOL == sc.state) {
lineState = closingQuote; lineState = closingQuote;
} else if (SCE_VISUALPROLOG_COMMENT_BLOCK == sc.state) { } else if (SCE_VISUALPROLOG_COMMENT_BLOCK == sc.state) {
lineState = nestLevel; lineState = nestLevel;

View File

@@ -8,9 +8,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include "ILexer.h" #include "ILexer.h"
#include "Scintilla.h" #include "Scintilla.h"

View File

@@ -3287,7 +3287,7 @@ const int nRanges = ELEMENTS(catRanges);
// Initial version has 3249 entries and adds about 13K to the executable. // Initial version has 3249 entries and adds about 13K to the executable.
// The array is in ascending order so can be searched using binary search. // The array is in ascending order so can be searched using binary search.
// Therefore the average call takes log2(3249) = 12 comparisons. // Therefore the average call takes log2(3249) = 12 comparisons.
// For speed, it may be an useful to make a linear table for the common values, // For speed, it may be useful to make a linear table for the common values,
// possibly for 0..0xff for most Western European text or 0..0xfff for most // possibly for 0..0xff for most Western European text or 0..0xfff for most
// alphabetic languages. // alphabetic languages.

View File

@@ -9,8 +9,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include "CharacterSet.h" #include "CharacterSet.h"

View File

@@ -29,11 +29,8 @@ private:
int codePage; int codePage;
enum EncodingType encodingType; enum EncodingType encodingType;
int lenDoc; int lenDoc;
int mask;
char styleBuf[bufferSize]; char styleBuf[bufferSize];
int validLen; int validLen;
char chFlags;
char chWhile;
unsigned int startSeg; unsigned int startSeg;
int startPosStyling; int startPosStyling;
int documentVersion; int documentVersion;
@@ -58,9 +55,12 @@ public:
codePage(pAccess->CodePage()), codePage(pAccess->CodePage()),
encodingType(enc8bit), encodingType(enc8bit),
lenDoc(pAccess->Length()), lenDoc(pAccess->Length()),
mask(127), validLen(0), chFlags(0), chWhile(0), validLen(0),
startSeg(0), startPosStyling(0), startSeg(0), startPosStyling(0),
documentVersion(pAccess->Version()) { documentVersion(pAccess->Version()) {
// Prevent warnings by static analyzers about uninitialized buf and styleBuf.
buf[0] = 0;
styleBuf[0] = 0;
switch (codePage) { switch (codePage) {
case 65001: case 65001:
encodingType = encUnicode; encodingType = encUnicode;
@@ -111,7 +111,7 @@ public:
return true; return true;
} }
char StyleAt(int position) const { char StyleAt(int position) const {
return static_cast<char>(pAccess->StyleAt(position) & mask); return static_cast<char>(pAccess->StyleAt(position));
} }
int GetLine(int position) const { int GetLine(int position) const {
return pAccess->LineFromPosition(position); return pAccess->LineFromPosition(position);
@@ -152,16 +152,10 @@ public:
return pAccess->SetLineState(line, state); return pAccess->SetLineState(line, state);
} }
// Style setting // Style setting
void StartAt(unsigned int start, char chMask=31) { void StartAt(unsigned int start) {
// Store the mask specified for use with StyleAt. pAccess->StartStyling(start, '\377');
mask = chMask;
pAccess->StartStyling(start, chMask);
startPosStyling = start; startPosStyling = start;
} }
void SetFlags(char chFlags_, char chWhile_) {
chFlags = chFlags_;
chWhile = chWhile_;
}
unsigned int GetStartSegment() const { unsigned int GetStartSegment() const {
return startSeg; return startSeg;
} }
@@ -182,9 +176,6 @@ public:
// Too big for buffer so send directly // Too big for buffer so send directly
pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr)); pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
} else { } else {
if (chAttr != chWhile)
chFlags = 0;
chAttr = static_cast<char>(chAttr | chFlags);
for (unsigned int i = startSeg; i <= pos; i++) { for (unsigned int i = startSeg; i <= pos; i++) {
assert((startPosStyling + validLen) < Length()); assert((startPosStyling + validLen) < Length());
styleBuf[validLen++] = static_cast<char>(chAttr); styleBuf[validLen++] = static_cast<char>(chAttr);

View File

@@ -8,9 +8,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include "ILexer.h" #include "ILexer.h"
#include "Scintilla.h" #include "Scintilla.h"

View File

@@ -8,9 +8,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <string> #include <string>
@@ -34,28 +34,24 @@ LexerModule::LexerModule(int language_,
LexerFunction fnLexer_, LexerFunction fnLexer_,
const char *languageName_, const char *languageName_,
LexerFunction fnFolder_, LexerFunction fnFolder_,
const char *const wordListDescriptions_[], const char *const wordListDescriptions_[]) :
int styleBits_) :
language(language_), language(language_),
fnLexer(fnLexer_), fnLexer(fnLexer_),
fnFolder(fnFolder_), fnFolder(fnFolder_),
fnFactory(0), fnFactory(0),
wordListDescriptions(wordListDescriptions_), wordListDescriptions(wordListDescriptions_),
styleBits(styleBits_),
languageName(languageName_) { languageName(languageName_) {
} }
LexerModule::LexerModule(int language_, LexerModule::LexerModule(int language_,
LexerFactoryFunction fnFactory_, LexerFactoryFunction fnFactory_,
const char *languageName_, const char *languageName_,
const char * const wordListDescriptions_[], const char * const wordListDescriptions_[]) :
int styleBits_) :
language(language_), language(language_),
fnLexer(0), fnLexer(0),
fnFolder(0), fnFolder(0),
fnFactory(fnFactory_), fnFactory(fnFactory_),
wordListDescriptions(wordListDescriptions_), wordListDescriptions(wordListDescriptions_),
styleBits(styleBits_),
languageName(languageName_) { languageName(languageName_) {
} }
@@ -82,10 +78,6 @@ const char *LexerModule::GetWordListDescription(int index) const {
} }
} }
int LexerModule::GetStyleBitsNeeded() const {
return styleBits;
}
ILexer *LexerModule::Create() const { ILexer *LexerModule::Create() const {
if (fnFactory) if (fnFactory)
return fnFactory(); return fnFactory();

View File

@@ -31,7 +31,6 @@ protected:
LexerFunction fnFolder; LexerFunction fnFolder;
LexerFactoryFunction fnFactory; LexerFactoryFunction fnFactory;
const char * const * wordListDescriptions; const char * const * wordListDescriptions;
int styleBits;
public: public:
const char *languageName; const char *languageName;
@@ -39,13 +38,11 @@ public:
LexerFunction fnLexer_, LexerFunction fnLexer_,
const char *languageName_=0, const char *languageName_=0,
LexerFunction fnFolder_=0, LexerFunction fnFolder_=0,
const char * const wordListDescriptions_[] = NULL, const char * const wordListDescriptions_[] = NULL);
int styleBits_=5);
LexerModule(int language_, LexerModule(int language_,
LexerFactoryFunction fnFactory_, LexerFactoryFunction fnFactory_,
const char *languageName_, const char *languageName_,
const char * const wordListDescriptions_[] = NULL, const char * const wordListDescriptions_[] = NULL);
int styleBits_=8);
virtual ~LexerModule() { virtual ~LexerModule() {
} }
int GetLanguage() const { return language; } int GetLanguage() const { return language; }
@@ -54,8 +51,6 @@ public:
int GetNumWordLists() const; int GetNumWordLists() const;
const char *GetWordListDescription(int index) const; const char *GetWordListDescription(int index) const;
int GetStyleBitsNeeded() const;
ILexer *Create() const; ILexer *Create() const;
virtual void Lex(unsigned int startPos, int length, int initStyle, virtual void Lex(unsigned int startPos, int length, int initStyle,
@@ -72,7 +67,12 @@ inline int Maximum(int a, int b) {
// Shut up annoying Visual C++ warnings: // Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable: 4244 4309 4514 4710) #pragma warning(disable: 4244 4309 4456 4457)
#endif
// Turn off shadow warnings for lexers as may be maintained by others
#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wshadow"
#endif #endif
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE

View File

@@ -8,9 +8,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include "ILexer.h" #include "ILexer.h"
#include "Scintilla.h" #include "Scintilla.h"

View File

@@ -8,9 +8,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <string> #include <string>

View File

@@ -11,11 +11,6 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#ifdef _MSC_VER
// Visual C++ doesn't like unreachable code in its own headers.
#pragma warning(disable: 4018 4100 4245 4511 4512 4663 4702)
#endif
#include <string> #include <string>
#include <map> #include <map>

View File

@@ -8,8 +8,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include "ILexer.h" #include "ILexer.h"

View File

@@ -66,7 +66,7 @@ public:
int widthNext; int widthNext;
StyleContext(unsigned int startPos, unsigned int length, StyleContext(unsigned int startPos, unsigned int length,
int initStyle, LexAccessor &styler_, char chMask=31) : int initStyle, LexAccessor &styler_, char chMask='\377') :
styler(styler_), styler(styler_),
multiByteAccess(0), multiByteAccess(0),
endPos(startPos + length), endPos(startPos + length),
@@ -86,7 +86,7 @@ public:
if (styler.Encoding() != enc8bit) { if (styler.Encoding() != enc8bit) {
multiByteAccess = styler.MultiByteAccess(); multiByteAccess = styler.MultiByteAccess();
} }
styler.StartAt(startPos, chMask); styler.StartAt(startPos /*, chMask*/);
styler.StartSegment(startPos); styler.StartSegment(startPos);
currentLine = styler.GetLine(startPos); currentLine = styler.GetLine(startPos);
lineStartNext = styler.LineStart(currentLine+1); lineStartNext = styler.LineStart(currentLine+1);

View File

@@ -166,7 +166,8 @@ public:
} }
const WordClassifier &Classifier(int baseStyle) const { const WordClassifier &Classifier(int baseStyle) const {
return classifiers[BlockFromBaseStyle(baseStyle)]; const int block = BlockFromBaseStyle(baseStyle);
return classifiers[block >= 0 ? block : 0];
} }
}; };

View File

@@ -8,8 +8,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <ctype.h>
#include <algorithm> #include <algorithm>
@@ -69,6 +69,8 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
WordList::WordList(bool onlyLineEnds_) : WordList::WordList(bool onlyLineEnds_) :
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) { words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {
// Prevent warnings by static analyzers about uninitialized starts.
starts[0] = -1;
} }
WordList::~WordList() { WordList::~WordList() {

View File

@@ -167,7 +167,9 @@ void AutoComplete::SetList(const char *list) {
char item[maxItemLen]; char item[maxItemLen];
for (size_t i = 0; i < sortMatrix.size(); ++i) { for (size_t i = 0; i < sortMatrix.size(); ++i) {
int wordLen = IndexSort.indices[sortMatrix[i] * 2 + 2] - IndexSort.indices[sortMatrix[i] * 2]; int wordLen = IndexSort.indices[sortMatrix[i] * 2 + 2] - IndexSort.indices[sortMatrix[i] * 2];
strncpy(item, list + IndexSort.indices[sortMatrix[i] * 2], wordLen); if (wordLen > maxItemLen-2)
wordLen = maxItemLen - 2;
memcpy(item, list + IndexSort.indices[sortMatrix[i] * 2], wordLen);
if ((i+1) == sortMatrix.size()) { if ((i+1) == sortMatrix.size()) {
// Last item so remove separator if present // Last item so remove separator if present
if ((wordLen > 0) && (item[wordLen-1] == separator)) if ((wordLen > 0) && (item[wordLen-1] == separator))

View File

@@ -65,7 +65,7 @@ public:
void SetSeparator(char separator_); void SetSeparator(char separator_);
char GetSeparator() const; char GetSeparator() const;
/// The typesep character is used for seperating the word from the type /// The typesep character is used for separating the word from the type
void SetTypesep(char separator_); void SetTypesep(char separator_);
char GetTypesep() const; char GetTypesep() const;

View File

@@ -109,13 +109,15 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int endSeg = ends[seg]; int endSeg = ends[seg];
if (endSeg > startSeg) { if (endSeg > startSeg) {
if (IsArrowCharacter(s[startSeg])) { if (IsArrowCharacter(s[startSeg])) {
xEnd = x + widthArrow;
bool upArrow = s[startSeg] == '\001'; bool upArrow = s[startSeg] == '\001';
rcClient.left = x; rcClient.left = static_cast<XYPOSITION>(x);
rcClient.right = rcClient.left + widthArrow; rcClient.right = static_cast<XYPOSITION>(xEnd);
if (draw) { if (draw) {
const int halfWidth = widthArrow / 2 - 3; const int halfWidth = widthArrow / 2 - 3;
const int centreX = rcClient.left + widthArrow / 2 - 1; const int quarterWidth = halfWidth / 2;
const int centreY = (rcClient.top + rcClient.bottom) / 2; const int centreX = x + widthArrow / 2 - 1;
const int centreY = static_cast<int>(rcClient.top + rcClient.bottom) / 2;
surface->FillRectangle(rcClient, colourBG); surface->FillRectangle(rcClient, colourBG);
PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1, PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1,
rcClient.right - 2, rcClient.bottom - 1); rcClient.right - 2, rcClient.bottom - 1);
@@ -123,21 +125,20 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
if (upArrow) { // Up arrow if (upArrow) { // Up arrow
Point pts[] = { Point pts[] = {
Point(centreX - halfWidth, centreY + halfWidth / 2), Point::FromInts(centreX - halfWidth, centreY + quarterWidth),
Point(centreX + halfWidth, centreY + halfWidth / 2), Point::FromInts(centreX + halfWidth, centreY + quarterWidth),
Point(centreX, centreY - halfWidth + halfWidth / 2), Point::FromInts(centreX, centreY - halfWidth + quarterWidth),
}; };
surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
} else { // Down arrow } else { // Down arrow
Point pts[] = { Point pts[] = {
Point(centreX - halfWidth, centreY - halfWidth / 2), Point::FromInts(centreX - halfWidth, centreY - quarterWidth),
Point(centreX + halfWidth, centreY - halfWidth / 2), Point::FromInts(centreX + halfWidth, centreY - quarterWidth),
Point(centreX, centreY + halfWidth - halfWidth / 2), Point::FromInts(centreX, centreY + halfWidth - quarterWidth),
}; };
surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
} }
} }
xEnd = rcClient.right;
offsetMain = xEnd; offsetMain = xEnd;
if (upArrow) { if (upArrow) {
rectUp = rcClient; rectUp = rcClient;
@@ -147,11 +148,11 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
} else if (IsTabCharacter(s[startSeg])) { } else if (IsTabCharacter(s[startSeg])) {
xEnd = NextTabPos(x); xEnd = NextTabPos(x);
} else { } else {
xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg); xEnd = x + RoundXYPosition(surface->WidthText(font, s + startSeg, endSeg - startSeg));
if (draw) { if (draw) {
rcClient.left = x; rcClient.left = static_cast<XYPOSITION>(x);
rcClient.right = xEnd; rcClient.right = static_cast<XYPOSITION>(xEnd);
surface->DrawTextTransparent(rcClient, font, ytext, surface->DrawTextTransparent(rcClient, font, static_cast<XYPOSITION>(ytext),
s+startSeg, endSeg - startSeg, s+startSeg, endSeg - startSeg,
highlight ? colourSel : colourUnSel); highlight ? colourSel : colourUnSel);
} }
@@ -164,16 +165,16 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
PRectangle rcClientPos = wCallTip.GetClientPosition(); PRectangle rcClientPos = wCallTip.GetClientPosition();
PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left,
rcClientPos.bottom - rcClientPos.top); rcClientPos.bottom - rcClientPos.top);
PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);
// To make a nice small call tip window, it is only sized to fit most normal characters without accents // To make a nice small call tip window, it is only sized to fit most normal characters without accents
int ascent = surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font); int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font));
// For each line... // For each line...
// Draw the definition in three parts: before highlight, highlighted, after highlight // Draw the definition in three parts: before highlight, highlighted, after highlight
int ytext = rcClient.top + ascent + 1; int ytext = static_cast<int>(rcClient.top) + ascent + 1;
rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1; rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1;
const char *chunkVal = val.c_str(); const char *chunkVal = val.c_str();
bool moreChunks = true; bool moreChunks = true;
@@ -185,8 +186,8 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
chunkEnd = chunkVal + strlen(chunkVal); chunkEnd = chunkVal + strlen(chunkVal);
moreChunks = false; moreChunks = false;
} }
int chunkOffset = chunkVal - val.c_str(); int chunkOffset = static_cast<int>(chunkVal - val.c_str());
int chunkLength = chunkEnd - chunkVal; int chunkLength = static_cast<int>(chunkEnd - chunkVal);
int chunkEndOffset = chunkOffset + chunkLength; int chunkEndOffset = chunkOffset + chunkLength;
int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset); int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset);
thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset); thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset);
@@ -194,7 +195,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset); int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset);
thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset); thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset);
thisEndHighlight -= chunkOffset; thisEndHighlight -= chunkOffset;
rcClient.top = ytext - ascent - 1; rcClient.top = static_cast<XYPOSITION>(ytext - ascent - 1);
int x = insetX; // start each line at this inset int x = insetX; // start each line at this inset
@@ -217,9 +218,9 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
if (val.empty()) if (val.empty())
return; return;
PRectangle rcClientPos = wCallTip.GetClientPosition(); PRectangle rcClientPos = wCallTip.GetClientPosition();
PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left,
rcClientPos.bottom - rcClientPos.top); rcClientPos.bottom - rcClientPos.top);
PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1);
surfaceWindow->FillRectangle(rcClient, colourBG); surfaceWindow->FillRectangle(rcClient, colourBG);
@@ -229,13 +230,13 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
#ifndef __APPLE__ #ifndef __APPLE__
// OSX doesn't put borders on "help tags" // OSX doesn't put borders on "help tags"
// Draw a raised border around the edges of the window // Draw a raised border around the edges of the window
surfaceWindow->MoveTo(0, rcClientSize.bottom - 1); surfaceWindow->MoveTo(0, static_cast<int>(rcClientSize.bottom) - 1);
surfaceWindow->PenColour(colourShade); surfaceWindow->PenColour(colourShade);
surfaceWindow->LineTo(rcClientSize.right - 1, rcClientSize.bottom - 1); surfaceWindow->LineTo(static_cast<int>(rcClientSize.right) - 1, static_cast<int>(rcClientSize.bottom) - 1);
surfaceWindow->LineTo(rcClientSize.right - 1, 0); surfaceWindow->LineTo(static_cast<int>(rcClientSize.right) - 1, 0);
surfaceWindow->PenColour(colourLight); surfaceWindow->PenColour(colourLight);
surfaceWindow->LineTo(0, 0); surfaceWindow->LineTo(0, 0);
surfaceWindow->LineTo(0, rcClientSize.bottom - 1); surfaceWindow->LineTo(0, static_cast<int>(rcClientSize.bottom) - 1);
#endif #endif
} }
@@ -264,7 +265,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *
endHighlight = 0; endHighlight = 0;
inCallTipMode = true; inCallTipMode = true;
posStartCallTip = pos; posStartCallTip = pos;
int deviceHeight = surfaceMeasure->DeviceHeightFont(size); XYPOSITION deviceHeight = static_cast<XYPOSITION>(surfaceMeasure->DeviceHeightFont(size));
FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet); FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet);
font.Create(fp); font.Create(fp);
// Look for multiple lines in the text // Look for multiple lines in the text
@@ -280,12 +281,12 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *
look = newline + 1; look = newline + 1;
numLines++; numLines++;
} }
lineHeight = surfaceMeasure->Height(font); lineHeight = RoundXYPosition(surfaceMeasure->Height(font));
// The returned // The returned
// rectangle is aligned to the right edge of the last arrow encountered in // rectangle is aligned to the right edge of the last arrow encountered in
// the tip text, else to the tip text left edge. // the tip text, else to the tip text left edge.
int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + borderHeight * 2; int height = lineHeight * numLines - static_cast<int>(surfaceMeasure->InternalLeading(font)) + borderHeight * 2;
delete surfaceMeasure; delete surfaceMeasure;
if (above) { if (above) {
return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset); return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset);

View File

@@ -35,48 +35,48 @@ int symmetricCaseConversionRanges[] = {
//lower, upper, range length, range pitch //lower, upper, range length, range pitch
//++Autogenerated -- start of section automatically generated //++Autogenerated -- start of section automatically generated
//**\(\*\n\) //**\(\*\n\)
97,65,26,1, 97,65,26,1,
224,192,23,1, 224,192,23,1,
248,216,7,1, 248,216,7,1,
257,256,24,2, 257,256,24,2,
314,313,8,2, 314,313,8,2,
331,330,23,2, 331,330,23,2,
462,461,8,2, 462,461,8,2,
479,478,9,2, 479,478,9,2,
505,504,20,2, 505,504,20,2,
547,546,9,2, 547,546,9,2,
583,582,5,2, 583,582,5,2,
945,913,17,1, 945,913,17,1,
963,931,9,1, 963,931,9,1,
985,984,12,2, 985,984,12,2,
1072,1040,32,1, 1072,1040,32,1,
1104,1024,16,1, 1104,1024,16,1,
1121,1120,17,2, 1121,1120,17,2,
1163,1162,27,2, 1163,1162,27,2,
1218,1217,7,2, 1218,1217,7,2,
1233,1232,44,2, 1233,1232,44,2,
1377,1329,38,1, 1377,1329,38,1,
7681,7680,75,2, 7681,7680,75,2,
7841,7840,48,2, 7841,7840,48,2,
7936,7944,8,1, 7936,7944,8,1,
7952,7960,6,1, 7952,7960,6,1,
7968,7976,8,1, 7968,7976,8,1,
7984,7992,8,1, 7984,7992,8,1,
8000,8008,6,1, 8000,8008,6,1,
8032,8040,8,1, 8032,8040,8,1,
8560,8544,16,1, 8560,8544,16,1,
9424,9398,26,1, 9424,9398,26,1,
11312,11264,47,1, 11312,11264,47,1,
11393,11392,50,2, 11393,11392,50,2,
11520,4256,38,1, 11520,4256,38,1,
42561,42560,23,2, 42561,42560,23,2,
42625,42624,12,2, 42625,42624,12,2,
42787,42786,7,2, 42787,42786,7,2,
42803,42802,31,2, 42803,42802,31,2,
42879,42878,5,2, 42879,42878,5,2,
42913,42912,5,2, 42913,42912,5,2,
65345,65313,26,1, 65345,65313,26,1,
66600,66560,40,1, 66600,66560,40,1,
//--Autogenerated -- end of section automatically generated //--Autogenerated -- end of section automatically generated
}; };
@@ -88,138 +88,138 @@ int symmetricCaseConversions[] = {
//lower, upper //lower, upper
//++Autogenerated -- start of section automatically generated //++Autogenerated -- start of section automatically generated
//**1 \(\*\n\) //**1 \(\*\n\)
255,376, 255,376,
307,306, 307,306,
309,308, 309,308,
311,310, 311,310,
378,377, 378,377,
380,379, 380,379,
382,381, 382,381,
384,579, 384,579,
387,386, 387,386,
389,388, 389,388,
392,391, 392,391,
396,395, 396,395,
402,401, 402,401,
405,502, 405,502,
409,408, 409,408,
410,573, 410,573,
414,544, 414,544,
417,416, 417,416,
419,418, 419,418,
421,420, 421,420,
424,423, 424,423,
429,428, 429,428,
432,431, 432,431,
436,435, 436,435,
438,437, 438,437,
441,440, 441,440,
445,444, 445,444,
447,503, 447,503,
454,452, 454,452,
457,455, 457,455,
460,458, 460,458,
477,398, 477,398,
499,497, 499,497,
501,500, 501,500,
572,571, 572,571,
575,11390, 575,11390,
576,11391, 576,11391,
578,577, 578,577,
592,11375, 592,11375,
593,11373, 593,11373,
594,11376, 594,11376,
595,385, 595,385,
596,390, 596,390,
598,393, 598,393,
599,394, 599,394,
601,399, 601,399,
603,400, 603,400,
608,403, 608,403,
611,404, 611,404,
613,42893, 613,42893,
614,42922, 614,42922,
616,407, 616,407,
617,406, 617,406,
619,11362, 619,11362,
623,412, 623,412,
625,11374, 625,11374,
626,413, 626,413,
629,415, 629,415,
637,11364, 637,11364,
640,422, 640,422,
643,425, 643,425,
648,430, 648,430,
649,580, 649,580,
650,433, 650,433,
651,434, 651,434,
652,581, 652,581,
658,439, 658,439,
881,880, 881,880,
883,882, 883,882,
887,886, 887,886,
891,1021, 891,1021,
892,1022, 892,1022,
893,1023, 893,1023,
940,902, 940,902,
941,904, 941,904,
942,905, 942,905,
943,906, 943,906,
972,908, 972,908,
973,910, 973,910,
974,911, 974,911,
983,975, 983,975,
1010,1017, 1010,1017,
1016,1015, 1016,1015,
1019,1018, 1019,1018,
1231,1216, 1231,1216,
7545,42877, 7545,42877,
7549,11363, 7549,11363,
8017,8025, 8017,8025,
8019,8027, 8019,8027,
8021,8029, 8021,8029,
8023,8031, 8023,8031,
8048,8122, 8048,8122,
8049,8123, 8049,8123,
8050,8136, 8050,8136,
8051,8137, 8051,8137,
8052,8138, 8052,8138,
8053,8139, 8053,8139,
8054,8154, 8054,8154,
8055,8155, 8055,8155,
8056,8184, 8056,8184,
8057,8185, 8057,8185,
8058,8170, 8058,8170,
8059,8171, 8059,8171,
8060,8186, 8060,8186,
8061,8187, 8061,8187,
8112,8120, 8112,8120,
8113,8121, 8113,8121,
8144,8152, 8144,8152,
8145,8153, 8145,8153,
8160,8168, 8160,8168,
8161,8169, 8161,8169,
8165,8172, 8165,8172,
8526,8498, 8526,8498,
8580,8579, 8580,8579,
11361,11360, 11361,11360,
11365,570, 11365,570,
11366,574, 11366,574,
11368,11367, 11368,11367,
11370,11369, 11370,11369,
11372,11371, 11372,11371,
11379,11378, 11379,11378,
11382,11381, 11382,11381,
11500,11499, 11500,11499,
11502,11501, 11502,11501,
11507,11506, 11507,11506,
11559,4295, 11559,4295,
11565,4301, 11565,4301,
42874,42873, 42874,42873,
42876,42875, 42876,42875,
42892,42891, 42892,42891,
42897,42896, 42897,42896,
42899,42898, 42899,42898,
//--Autogenerated -- end of section automatically generated //--Autogenerated -- end of section automatically generated
}; };

View File

@@ -8,9 +8,9 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include "CaseFolder.h"
#include "CaseConvert.h" #include "CaseConvert.h"
#include "UniConversion.h" #include "UniConversion.h"
#include "CaseFolder.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;

View File

@@ -8,9 +8,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <vector> #include <vector>
@@ -90,6 +90,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmBaan); LINK_LEXER(lmBaan);
LINK_LEXER(lmBash); LINK_LEXER(lmBash);
LINK_LEXER(lmBatch); LINK_LEXER(lmBatch);
LINK_LEXER(lmBibTeX);
LINK_LEXER(lmBlitzBasic); LINK_LEXER(lmBlitzBasic);
LINK_LEXER(lmBullant); LINK_LEXER(lmBullant);
LINK_LEXER(lmCaml); LINK_LEXER(lmCaml);
@@ -106,6 +107,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmD); LINK_LEXER(lmD);
LINK_LEXER(lmDiff); LINK_LEXER(lmDiff);
LINK_LEXER(lmDMAP); LINK_LEXER(lmDMAP);
LINK_LEXER(lmDMIS);
LINK_LEXER(lmECL); LINK_LEXER(lmECL);
LINK_LEXER(lmEiffel); LINK_LEXER(lmEiffel);
LINK_LEXER(lmEiffelkw); LINK_LEXER(lmEiffelkw);
@@ -121,6 +123,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmGui4Cli); LINK_LEXER(lmGui4Cli);
LINK_LEXER(lmHaskell); LINK_LEXER(lmHaskell);
LINK_LEXER(lmHTML); LINK_LEXER(lmHTML);
LINK_LEXER(lmIHex);
LINK_LEXER(lmInno); LINK_LEXER(lmInno);
LINK_LEXER(lmKix); LINK_LEXER(lmKix);
LINK_LEXER(lmKVIrc); LINK_LEXER(lmKVIrc);
@@ -162,6 +165,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmPython); LINK_LEXER(lmPython);
LINK_LEXER(lmR); LINK_LEXER(lmR);
LINK_LEXER(lmREBOL); LINK_LEXER(lmREBOL);
LINK_LEXER(lmRegistry);
LINK_LEXER(lmRuby); LINK_LEXER(lmRuby);
LINK_LEXER(lmRust); LINK_LEXER(lmRust);
LINK_LEXER(lmScriptol); LINK_LEXER(lmScriptol);
@@ -171,12 +175,14 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmSpecman); LINK_LEXER(lmSpecman);
LINK_LEXER(lmSpice); LINK_LEXER(lmSpice);
LINK_LEXER(lmSQL); LINK_LEXER(lmSQL);
LINK_LEXER(lmSrec);
LINK_LEXER(lmSTTXT); LINK_LEXER(lmSTTXT);
LINK_LEXER(lmTACL); LINK_LEXER(lmTACL);
LINK_LEXER(lmTADS3); LINK_LEXER(lmTADS3);
LINK_LEXER(lmTAL); LINK_LEXER(lmTAL);
LINK_LEXER(lmTCL); LINK_LEXER(lmTCL);
LINK_LEXER(lmTCMD); LINK_LEXER(lmTCMD);
LINK_LEXER(lmTEHex);
LINK_LEXER(lmTeX); LINK_LEXER(lmTeX);
LINK_LEXER(lmTxt2tags); LINK_LEXER(lmTxt2tags);
LINK_LEXER(lmVB); LINK_LEXER(lmVB);

View File

@@ -10,6 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdexcept>
#include <algorithm> #include <algorithm>
#include "Platform.h" #include "Platform.h"
@@ -144,6 +145,7 @@ UndoHistory::UndoHistory() {
currentAction = 0; currentAction = 0;
undoSequenceDepth = 0; undoSequenceDepth = 0;
savePoint = 0; savePoint = 0;
tentativePoint = -1;
actions[currentAction].Create(startAction); actions[currentAction].Create(startAction);
} }
@@ -194,7 +196,7 @@ const char *UndoHistory::AppendAction(actionType at, int position, const char *d
// Visual Studio 2013 Code Analysis wrongly believes actions can be NULL at its next reference // Visual Studio 2013 Code Analysis wrongly believes actions can be NULL at its next reference
__analysis_assume(actions); __analysis_assume(actions);
#endif #endif
if (currentAction == savePoint) { if ((currentAction == savePoint) || (currentAction == tentativePoint)) {
currentAction++; currentAction++;
} else if (!actions[currentAction].mayCoalesce) { } else if (!actions[currentAction].mayCoalesce) {
// Not allowed to coalesce if this set // Not allowed to coalesce if this set
@@ -282,6 +284,7 @@ void UndoHistory::DeleteUndoHistory() {
currentAction = 0; currentAction = 0;
actions[currentAction].Create(startAction); actions[currentAction].Create(startAction);
savePoint = 0; savePoint = 0;
tentativePoint = -1;
} }
void UndoHistory::SetSavePoint() { void UndoHistory::SetSavePoint() {
@@ -292,6 +295,26 @@ bool UndoHistory::IsSavePoint() const {
return savePoint == currentAction; return savePoint == currentAction;
} }
void UndoHistory::TentativeStart() {
tentativePoint = currentAction;
}
void UndoHistory::TentativeCommit() {
tentativePoint = -1;
// Truncate undo history
maxAction = currentAction;
}
int UndoHistory::TentativeSteps() {
// Drop any trailing startAction
if (actions[currentAction].at == startAction && currentAction > 0)
currentAction--;
if (tentativePoint >= 0)
return currentAction - tentativePoint;
else
return -1;
}
bool UndoHistory::CanUndo() const { bool UndoHistory::CanUndo() const {
return (currentAction > 0) && (maxAction > 0); return (currentAction > 0) && (maxAction > 0);
} }
@@ -356,7 +379,7 @@ char CellBuffer::CharAt(int position) const {
} }
void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) const { void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) const {
if (lengthRetrieve < 0) if (lengthRetrieve <= 0)
return; return;
if (position < 0) if (position < 0)
return; return;
@@ -413,25 +436,24 @@ const char *CellBuffer::InsertString(int position, const char *s, int insertLeng
return data; return data;
} }
bool CellBuffer::SetStyleAt(int position, char styleValue, char mask) { bool CellBuffer::SetStyleAt(int position, char styleValue) {
styleValue &= mask;
char curVal = style.ValueAt(position); char curVal = style.ValueAt(position);
if ((curVal & mask) != styleValue) { if (curVal != styleValue) {
style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue)); style.SetValueAt(position, styleValue);
return true; return true;
} else { } else {
return false; return false;
} }
} }
bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue, char mask) { bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue) {
bool changed = false; bool changed = false;
PLATFORM_ASSERT(lengthStyle == 0 || PLATFORM_ASSERT(lengthStyle == 0 ||
(lengthStyle > 0 && lengthStyle + position <= style.Length())); (lengthStyle > 0 && lengthStyle + position <= style.Length()));
while (lengthStyle--) { while (lengthStyle--) {
char curVal = style.ValueAt(position); char curVal = style.ValueAt(position);
if ((curVal & mask) != styleValue) { if (curVal != styleValue) {
style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue)); style.SetValueAt(position, styleValue);
changed = true; changed = true;
} }
position++; position++;
@@ -506,6 +528,22 @@ bool CellBuffer::IsSavePoint() const {
return uh.IsSavePoint(); return uh.IsSavePoint();
} }
void CellBuffer::TentativeStart() {
uh.TentativeStart();
}
void CellBuffer::TentativeCommit() {
uh.TentativeCommit();
}
int CellBuffer::TentativeSteps() {
return uh.TentativeSteps();
}
bool CellBuffer::TentativeActive() const {
return uh.TentativeActive();
}
// Without undo // Without undo
void CellBuffer::InsertLine(int line, int position, bool lineStart) { void CellBuffer::InsertLine(int line, int position, bool lineStart) {
@@ -749,6 +787,10 @@ const Action &CellBuffer::GetUndoStep() const {
void CellBuffer::PerformUndoStep() { void CellBuffer::PerformUndoStep() {
const Action &actionStep = uh.GetUndoStep(); const Action &actionStep = uh.GetUndoStep();
if (actionStep.at == insertAction) { if (actionStep.at == insertAction) {
if (substance.Length() < actionStep.lenData) {
throw std::runtime_error(
"CellBuffer::PerformUndoStep: deletion must be less than document length.");
}
BasicDeleteChars(actionStep.position, actionStep.lenData); BasicDeleteChars(actionStep.position, actionStep.lenData);
} else if (actionStep.at == removeAction) { } else if (actionStep.at == removeAction) {
BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData);

View File

@@ -95,6 +95,7 @@ class UndoHistory {
int currentAction; int currentAction;
int undoSequenceDepth; int undoSequenceDepth;
int savePoint; int savePoint;
int tentativePoint;
void EnsureUndoRoom(); void EnsureUndoRoom();
@@ -117,6 +118,12 @@ public:
void SetSavePoint(); void SetSavePoint();
bool IsSavePoint() const; bool IsSavePoint() const;
// Tentative actions are used for input composition so that it can be undone cleanly
void TentativeStart();
void TentativeCommit();
bool TentativeActive() const { return tentativePoint >= 0; }
int TentativeSteps();
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
/// called that many times. Similarly for redo. /// called that many times. Similarly for redo.
bool CanUndo() const; bool CanUndo() const;
@@ -180,8 +187,8 @@ public:
/// Setting styles for positions outside the range of the buffer is safe and has no effect. /// Setting styles for positions outside the range of the buffer is safe and has no effect.
/// @return true if the style of a character is changed. /// @return true if the style of a character is changed.
bool SetStyleAt(int position, char styleValue, char mask='\377'); bool SetStyleAt(int position, char styleValue);
bool SetStyleFor(int position, int length, char styleValue, char mask); bool SetStyleFor(int position, int length, char styleValue);
const char *DeleteChars(int position, int deleteLength, bool &startSequence); const char *DeleteChars(int position, int deleteLength, bool &startSequence);
@@ -193,6 +200,11 @@ public:
void SetSavePoint(); void SetSavePoint();
bool IsSavePoint() const; bool IsSavePoint() const;
void TentativeStart();
void TentativeCommit();
bool TentativeActive() const;
int TentativeSteps();
bool SetUndoCollection(bool collectUndo); bool SetUndoCollection(bool collectUndo);
bool IsCollectingUndo() const; bool IsCollectingUndo() const;
void BeginUndoAction(); void BeginUndoAction();

View File

@@ -14,11 +14,6 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4514)
#endif
CharClassify::CharClassify() { CharClassify::CharClassify() {
SetDefaultCharClasses(true); SetDefaultCharClasses(true);
} }

View File

@@ -76,6 +76,10 @@ int ContractionState::DisplayFromDoc(int lineDoc) const {
} }
} }
int ContractionState::DisplayLastFromDoc(int lineDoc) const {
return DisplayFromDoc(lineDoc) + GetHeight(lineDoc) - 1;
}
int ContractionState::DocFromDisplay(int lineDisplay) const { int ContractionState::DocFromDisplay(int lineDisplay) const {
if (OneToOne()) { if (OneToOne()) {
return lineDisplay; return lineDisplay;
@@ -146,8 +150,8 @@ bool ContractionState::GetVisible(int lineDoc) const {
} }
} }
bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible_) { bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool isVisible) {
if (OneToOne() && visible_) { if (OneToOne() && isVisible) {
return false; return false;
} else { } else {
EnsureData(); EnsureData();
@@ -155,9 +159,9 @@ bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible
Check(); Check();
if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) { if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) {
for (int line = lineDocStart; line <= lineDocEnd; line++) { for (int line = lineDocStart; line <= lineDocEnd; line++) {
if (GetVisible(line) != visible_) { if (GetVisible(line) != isVisible) {
int difference = visible_ ? heights->ValueAt(line) : -heights->ValueAt(line); int difference = isVisible ? heights->ValueAt(line) : -heights->ValueAt(line);
visible->SetValueAt(line, visible_ ? 1 : 0); visible->SetValueAt(line, isVisible ? 1 : 0);
displayLines->InsertText(line, difference); displayLines->InsertText(line, difference);
delta += difference; delta += difference;
} }
@@ -187,13 +191,13 @@ bool ContractionState::GetExpanded(int lineDoc) const {
} }
} }
bool ContractionState::SetExpanded(int lineDoc, bool expanded_) { bool ContractionState::SetExpanded(int lineDoc, bool isExpanded) {
if (OneToOne() && expanded_) { if (OneToOne() && isExpanded) {
return false; return false;
} else { } else {
EnsureData(); EnsureData();
if (expanded_ != (expanded->ValueAt(lineDoc) == 1)) { if (isExpanded != (expanded->ValueAt(lineDoc) == 1)) {
expanded->SetValueAt(lineDoc, expanded_ ? 1 : 0); expanded->SetValueAt(lineDoc, isExpanded ? 1 : 0);
Check(); Check();
return true; return true;
} else { } else {

View File

@@ -39,6 +39,7 @@ public:
int LinesInDoc() const; int LinesInDoc() const;
int LinesDisplayed() const; int LinesDisplayed() const;
int DisplayFromDoc(int lineDoc) const; int DisplayFromDoc(int lineDoc) const;
int DisplayLastFromDoc(int lineDoc) const;
int DocFromDisplay(int lineDisplay) const; int DocFromDisplay(int lineDisplay) const;
void InsertLine(int lineDoc); void InsertLine(int lineDoc);
@@ -47,11 +48,11 @@ public:
void DeleteLines(int lineDoc, int lineCount); void DeleteLines(int lineDoc, int lineCount);
bool GetVisible(int lineDoc) const; bool GetVisible(int lineDoc) const;
bool SetVisible(int lineDocStart, int lineDocEnd, bool visible); bool SetVisible(int lineDocStart, int lineDocEnd, bool isVisible);
bool HiddenLines() const; bool HiddenLines() const;
bool GetExpanded(int lineDoc) const; bool GetExpanded(int lineDoc) const;
bool SetExpanded(int lineDoc, bool expanded); bool SetExpanded(int lineDoc, bool isExpanded);
int ContractedNext(int lineDocStart) const; int ContractedNext(int lineDocStart) const;
int GetHeight(int lineDoc) const; int GetHeight(int lineDoc) const;

View File

@@ -163,7 +163,9 @@ int DecorationList::AllOnFor(int position) const {
int mask = 0; int mask = 0;
for (Decoration *deco=root; deco; deco = deco->next) { for (Decoration *deco=root; deco; deco = deco->next) {
if (deco->rs.ValueAt(position)) { if (deco->rs.ValueAt(position)) {
mask |= 1 << deco->indicator; if (deco->indicator < INDIC_IME) {
mask |= 1 << deco->indicator;
}
} }
} }
return mask; return mask;

View File

@@ -8,30 +8,36 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <stdexcept>
#include <string> #include <string>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#ifdef CXX11_REGEX
#include <regex>
#endif
#include "Platform.h" #include "Platform.h"
#include "ILexer.h" #include "ILexer.h"
#include "Scintilla.h" #include "Scintilla.h"
#include "CharacterSet.h"
#include "SplitVector.h" #include "SplitVector.h"
#include "Partitioning.h" #include "Partitioning.h"
#include "RunStyles.h" #include "RunStyles.h"
#include "CellBuffer.h" #include "CellBuffer.h"
#include "PerLine.h" #include "PerLine.h"
#include "CharClassify.h" #include "CharClassify.h"
#include "CharacterSet.h"
#include "Decoration.h" #include "Decoration.h"
#include "CaseFolder.h" #include "CaseFolder.h"
#include "Document.h" #include "Document.h"
#include "RESearch.h" #include "RESearch.h"
#include "UniConversion.h" #include "UniConversion.h"
#include "UnicodeFromUTF8.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
@@ -58,7 +64,7 @@ void LexInterface::Colourise(int start, int end) {
int styleStart = 0; int styleStart = 0;
if (start > 0) if (start > 0)
styleStart = pdoc->StyleAt(start - 1) & pdoc->stylingBitsMask; styleStart = pdoc->StyleAt(start - 1);
if (len > 0) { if (len > 0) {
instance->Lex(start, len, styleStart, pdoc); instance->Lex(start, len, styleStart, pdoc);
@@ -90,14 +96,12 @@ Document::Document() {
#endif #endif
dbcsCodePage = 0; dbcsCodePage = 0;
lineEndBitSet = SC_LINE_END_TYPE_DEFAULT; lineEndBitSet = SC_LINE_END_TYPE_DEFAULT;
stylingBits = 5;
stylingBitsMask = 0x1F;
stylingMask = 0;
endStyled = 0; endStyled = 0;
styleClock = 0; styleClock = 0;
enteredModification = 0; enteredModification = 0;
enteredStyling = 0; enteredStyling = 0;
enteredReadOnlyCount = 0; enteredReadOnlyCount = 0;
insertionSet = false;
tabInChars = 8; tabInChars = 8;
indentInChars = 0; indentInChars = 0;
actualIndentInChars = 8; actualIndentInChars = 8;
@@ -211,6 +215,65 @@ void Document::SetSavePoint() {
NotifySavePoint(true); NotifySavePoint(true);
} }
void Document::TentativeUndo() {
CheckReadOnly();
if (enteredModification == 0) {
enteredModification++;
if (!cb.IsReadOnly()) {
bool startSavePoint = cb.IsSavePoint();
bool multiLine = false;
int steps = cb.TentativeSteps();
//Platform::DebugPrintf("Steps=%d\n", steps);
for (int step = 0; step < steps; step++) {
const int prevLinesTotal = LinesTotal();
const Action &action = cb.GetUndoStep();
if (action.at == removeAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else if (action.at == containerAction) {
DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO);
dm.token = action.position;
NotifyModified(dm);
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
}
cb.PerformUndoStep();
if (action.at != containerAction) {
ModifiedAt(action.position);
}
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
modFlags |= SC_MOD_INSERTTEXT;
} else if (action.at == insertAction) {
modFlags |= SC_MOD_DELETETEXT;
}
if (steps > 1)
modFlags |= SC_MULTISTEPUNDOREDO;
const int linesAdded = LinesTotal() - prevLinesTotal;
if (linesAdded != 0)
multiLine = true;
if (step == steps - 1) {
modFlags |= SC_LASTSTEPINUNDOREDO;
if (multiLine)
modFlags |= SC_MULTILINEUNDOREDO;
}
NotifyModified(DocModification(modFlags, action.position, action.lenData,
linesAdded, action.data));
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
cb.TentativeCommit();
}
enteredModification--;
}
}
int Document::GetMark(int line) { int Document::GetMark(int line) {
return static_cast<LineMarkers *>(perLineData[ldMarkers])->MarkValue(line); return static_cast<LineMarkers *>(perLineData[ldMarkers])->MarkValue(line);
} }
@@ -278,6 +341,10 @@ int SCI_METHOD Document::LineStart(int line) const {
return cb.LineStart(line); return cb.LineStart(line);
} }
bool Document::IsLineStartPosition(int position) const {
return LineStart(LineFromPosition(position)) == position;
}
int SCI_METHOD Document::LineEnd(int line) const { int SCI_METHOD Document::LineEnd(int line) const {
if (line >= LinesTotal() - 1) { if (line >= LinesTotal() - 1) {
return LineStart(line + 1); return LineStart(line + 1);
@@ -544,7 +611,7 @@ bool Document::InGoodUTF8(int pos, int &start, int &end) const {
// When lines are terminated with \r\n pairs which should be treated as one character. // When lines are terminated with \r\n pairs which should be treated as one character.
// When displaying DBCS text such as Japanese. // When displaying DBCS text such as Japanese.
// If moving, move the position in the indicated direction. // If moving, move the position in the indicated direction.
int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) const {
//Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir); //Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir);
// If out of range, just return minimum/maximum value. // If out of range, just return minimum/maximum value.
if (pos <= 0) if (pos <= 0)
@@ -700,19 +767,6 @@ bool Document::NextCharacter(int &pos, int moveDir) const {
} }
} }
static inline int UnicodeFromBytes(const unsigned char *us) {
if (us[0] < 0xC2) {
return us[0];
} else if (us[0] < 0xE0) {
return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F);
} else if (us[0] < 0xF0) {
return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F);
} else if (us[0] < 0xF5) {
return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F);
}
return us[0];
}
// Return -1 on out-of-bounds // Return -1 on out-of-bounds
int SCI_METHOD Document::GetRelativePosition(int positionStart, int characterOffset) const { int SCI_METHOD Document::GetRelativePosition(int positionStart, int characterOffset) const {
int pos = positionStart; int pos = positionStart;
@@ -733,6 +787,27 @@ int SCI_METHOD Document::GetRelativePosition(int positionStart, int characterOff
return pos; return pos;
} }
int Document::GetRelativePositionUTF16(int positionStart, int characterOffset) const {
int pos = positionStart;
if (dbcsCodePage) {
const int increment = (characterOffset > 0) ? 1 : -1;
while (characterOffset != 0) {
const int posNext = NextPosition(pos, increment);
if (posNext == pos)
return INVALID_POSITION;
if (abs(pos-posNext) > 3) // 4 byte character = 2*UTF16.
characterOffset -= increment;
pos = posNext;
characterOffset -= increment;
}
} else {
pos = positionStart + characterOffset;
if ((pos < 0) || (pos > Length()))
return INVALID_POSITION;
}
return pos;
}
int SCI_METHOD Document::GetCharacterAndWidth(int position, int *pWidth) const { int SCI_METHOD Document::GetCharacterAndWidth(int position, int *pWidth) const {
int character; int character;
int bytesInCharacter = 1; int bytesInCharacter = 1;
@@ -753,7 +828,7 @@ int SCI_METHOD Document::GetCharacterAndWidth(int position, int *pWidth) const {
character = 0xDC80 + leadByte; character = 0xDC80 + leadByte;
} else { } else {
bytesInCharacter = utf8status & UTF8MaskWidth; bytesInCharacter = utf8status & UTF8MaskWidth;
character = UnicodeFromBytes(charBytes); character = UnicodeFromUTF8(charBytes);
} }
} }
} else { } else {
@@ -880,6 +955,8 @@ void Document::CheckReadOnly() {
// SetStyleAt does not change the persistent state of a document // SetStyleAt does not change the persistent state of a document
bool Document::DeleteChars(int pos, int len) { bool Document::DeleteChars(int pos, int len) {
if (pos < 0)
return false;
if (len <= 0) if (len <= 0)
return false; return false;
if ((pos + len) > Length()) if ((pos + len) > Length())
@@ -919,37 +996,56 @@ bool Document::DeleteChars(int pos, int len) {
/** /**
* Insert a string with a length. * Insert a string with a length.
*/ */
bool Document::InsertString(int position, const char *s, int insertLength) { int Document::InsertString(int position, const char *s, int insertLength) {
if (insertLength <= 0) { if (insertLength <= 0) {
return false; return 0;
}
CheckReadOnly(); // Application may change read only state here
if (cb.IsReadOnly()) {
return 0;
} }
CheckReadOnly();
if (enteredModification != 0) { if (enteredModification != 0) {
return false; return 0;
} else {
enteredModification++;
if (!cb.IsReadOnly()) {
NotifyModified(
DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
position, insertLength,
0, s));
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
bool startSequence = false;
const char *text = cb.InsertString(position, s, insertLength, startSequence);
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
ModifiedAt(position);
NotifyModified(
DocModification(
SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0),
position, insertLength,
LinesTotal() - prevLinesTotal, text));
}
enteredModification--;
} }
return !cb.IsReadOnly(); enteredModification++;
insertionSet = false;
insertion.clear();
NotifyModified(
DocModification(
SC_MOD_INSERTCHECK,
position, insertLength,
0, s));
if (insertionSet) {
s = insertion.c_str();
insertLength = static_cast<int>(insertion.length());
}
NotifyModified(
DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
position, insertLength,
0, s));
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
bool startSequence = false;
const char *text = cb.InsertString(position, s, insertLength, startSequence);
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
ModifiedAt(position);
NotifyModified(
DocModification(
SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0),
position, insertLength,
LinesTotal() - prevLinesTotal, text));
if (insertionSet) { // Free memory as could be large
std::string().swap(insertion);
}
enteredModification--;
return insertLength;
}
void Document::ChangeInsertion(const char *s, int length) {
insertionSet = true;
insertion.assign(s, length);
} }
int SCI_METHOD Document::AddData(char *data, int length) { int SCI_METHOD Document::AddData(char *data, int length) {
@@ -1113,22 +1209,6 @@ int Document::Redo() {
return newPos; return newPos;
} }
/**
* Insert a single character.
*/
bool Document::InsertChar(int pos, char ch) {
char chs[1];
chs[0] = ch;
return InsertString(pos, chs, 1);
}
/**
* Insert a null terminated string.
*/
bool Document::InsertCString(int position, const char *s) {
return InsertString(position, s, static_cast<int>(s ? strlen(s) : 0));
}
void Document::DelChar(int pos) { void Document::DelChar(int pos) {
DeleteChars(pos, LenChar(pos)); DeleteChars(pos, LenChar(pos));
} }
@@ -1183,7 +1263,7 @@ int SCI_METHOD Document::GetLineIndentation(int line) {
return indent; return indent;
} }
void Document::SetLineIndentation(int line, int indent) { int Document::SetLineIndentation(int line, int indent) {
int indentOfLine = GetLineIndentation(line); int indentOfLine = GetLineIndentation(line);
if (indent < 0) if (indent < 0)
indent = 0; indent = 0;
@@ -1193,7 +1273,10 @@ void Document::SetLineIndentation(int line, int indent) {
int indentPos = GetLineIndentPosition(line); int indentPos = GetLineIndentPosition(line);
UndoGroup ug(this); UndoGroup ug(this);
DeleteChars(thisLineStart, indentPos - thisLineStart); DeleteChars(thisLineStart, indentPos - thisLineStart);
InsertCString(thisLineStart, linebuf.c_str()); return thisLineStart + InsertString(thisLineStart, linebuf.c_str(),
static_cast<int>(linebuf.length()));
} else {
return GetLineIndentPosition(line);
} }
} }
@@ -1232,7 +1315,7 @@ int Document::GetColumn(int pos) {
return column; return column;
} }
int Document::CountCharacters(int startPos, int endPos) { int Document::CountCharacters(int startPos, int endPos) const {
startPos = MovePositionOutsideChar(startPos, 1, false); startPos = MovePositionOutsideChar(startPos, 1, false);
endPos = MovePositionOutsideChar(endPos, -1, false); endPos = MovePositionOutsideChar(endPos, -1, false);
int count = 0; int count = 0;
@@ -1246,6 +1329,21 @@ int Document::CountCharacters(int startPos, int endPos) {
return count; return count;
} }
int Document::CountUTF16(int startPos, int endPos) const {
startPos = MovePositionOutsideChar(startPos, 1, false);
endPos = MovePositionOutsideChar(endPos, -1, false);
int count = 0;
int i = startPos;
while (i < endPos) {
count++;
const int next = NextPosition(i, 1);
if ((next - i) > 3)
count++;
i = next;
}
return count;
}
int Document::FindColumn(int line, int column) { int Document::FindColumn(int line, int column) {
int position = LineStart(line); int position = LineStart(line);
if ((line >= 0) && (line < LinesTotal())) { if ((line >= 0) && (line < LinesTotal())) {
@@ -1325,21 +1423,21 @@ void Document::ConvertLineEnds(int eolModeSet) {
} else { } else {
// CR // CR
if (eolModeSet == SC_EOL_CRLF) { if (eolModeSet == SC_EOL_CRLF) {
InsertString(pos + 1, "\n", 1); // Insert LF pos += InsertString(pos + 1, "\n", 1); // Insert LF
pos++;
} else if (eolModeSet == SC_EOL_LF) { } else if (eolModeSet == SC_EOL_LF) {
InsertString(pos, "\n", 1); // Insert LF pos += InsertString(pos, "\n", 1); // Insert LF
DeleteChars(pos + 1, 1); // Delete CR DeleteChars(pos, 1); // Delete CR
pos--;
} }
} }
} else if (cb.CharAt(pos) == '\n') { } else if (cb.CharAt(pos) == '\n') {
// LF // LF
if (eolModeSet == SC_EOL_CRLF) { if (eolModeSet == SC_EOL_CRLF) {
InsertString(pos, "\r", 1); // Insert CR pos += InsertString(pos, "\r", 1); // Insert CR
pos++;
} else if (eolModeSet == SC_EOL_CR) { } else if (eolModeSet == SC_EOL_CR) {
InsertString(pos, "\r", 1); // Insert CR pos += InsertString(pos, "\r", 1); // Insert CR
DeleteChars(pos + 1, 1); // Delete LF DeleteChars(pos, 1); // Delete LF
pos--;
} }
} }
} }
@@ -1521,6 +1619,25 @@ void Document::SetCaseFolder(CaseFolder *pcf_) {
pcf = pcf_; pcf = pcf_;
} }
Document::CharacterExtracted Document::ExtractCharacter(int position) const {
const unsigned char leadByte = static_cast<unsigned char>(cb.CharAt(position));
if (UTF8IsAscii(leadByte)) {
// Common case: ASCII character
return CharacterExtracted(leadByte, 1);
}
const int widthCharBytes = UTF8BytesOfLead[leadByte];
unsigned char charBytes[UTF8MaxBytes] = { leadByte, 0, 0, 0 };
for (int b=1; b<widthCharBytes; b++)
charBytes[b] = static_cast<unsigned char>(cb.CharAt(position + b));
int utf8status = UTF8Classify(charBytes, widthCharBytes);
if (utf8status & UTF8MaskInvalid) {
// Treat as invalid and use up just one byte
return CharacterExtracted(unicodeReplacementChar, 1);
} else {
return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth);
}
}
/** /**
* Find text in document, supporting both forward and backward * Find text in document, supporting both forward and backward
* searches (just pass minPos > maxPos to do a backward search) * searches (just pass minPos > maxPos to do a backward search)
@@ -1705,13 +1822,7 @@ int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *bu
return charClass.GetCharsOfClass(characterClass, buffer); return charClass.GetCharsOfClass(characterClass, buffer);
} }
void Document::SetStylingBits(int bits) { void SCI_METHOD Document::StartStyling(int position, char) {
stylingBits = bits;
stylingBitsMask = (1 << stylingBits) - 1;
}
void SCI_METHOD Document::StartStyling(int position, char mask) {
stylingMask = mask;
endStyled = position; endStyled = position;
} }
@@ -1720,9 +1831,8 @@ bool SCI_METHOD Document::SetStyleFor(int length, char style) {
return false; return false;
} else { } else {
enteredStyling++; enteredStyling++;
style &= stylingMask;
int prevEndStyled = endStyled; int prevEndStyled = endStyled;
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { if (cb.SetStyleFor(endStyled, length, style)) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, length); prevEndStyled, length);
NotifyModified(mh); NotifyModified(mh);
@@ -1743,7 +1853,7 @@ bool SCI_METHOD Document::SetStyles(int length, const char *styles) {
int endMod = 0; int endMod = 0;
for (int iPos = 0; iPos < length; iPos++, endStyled++) { for (int iPos = 0; iPos < length; iPos++, endStyled++) {
PLATFORM_ASSERT(endStyled < Length()); PLATFORM_ASSERT(endStyled < Length());
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) { if (cb.SetStyleAt(endStyled, styles[iPos])) {
if (!didChange) { if (!didChange) {
startMod = endStyled; startMod = endStyled;
} }
@@ -2073,7 +2183,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
char chSeek = BraceOpposite(chBrace); char chSeek = BraceOpposite(chBrace);
if (chSeek == '\0') if (chSeek == '\0')
return - 1; return - 1;
char styBrace = static_cast<char>(StyleAt(position) & stylingBitsMask); char styBrace = static_cast<char>(StyleAt(position));
int direction = -1; int direction = -1;
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
direction = 1; direction = 1;
@@ -2081,7 +2191,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
position = NextPosition(position, direction); position = NextPosition(position, direction);
while ((position >= 0) && (position < Length())) { while ((position >= 0) && (position < Length())) {
char chAtPos = CharAt(position); char chAtPos = CharAt(position);
char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask); char styAtPos = static_cast<char>(StyleAt(position));
if ((position > GetEndStyled()) || (styAtPos == styBrace)) { if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
if (chAtPos == chBrace) if (chAtPos == chBrace)
depth++; depth++;
@@ -2119,6 +2229,61 @@ private:
std::string substituted; std::string substituted;
}; };
namespace {
/**
* RESearchRange keeps track of search range.
*/
class RESearchRange {
public:
const Document *doc;
int increment;
int startPos;
int endPos;
int lineRangeStart;
int lineRangeEnd;
int lineRangeBreak;
RESearchRange(const Document *doc_, int minPos, int maxPos) : doc(doc_) {
increment = (minPos <= maxPos) ? 1 : -1;
// Range endpoints should not be inside DBCS characters, but just in case, move them.
startPos = doc->MovePositionOutsideChar(minPos, 1, false);
endPos = doc->MovePositionOutsideChar(maxPos, 1, false);
lineRangeStart = doc->LineFromPosition(startPos);
lineRangeEnd = doc->LineFromPosition(endPos);
if ((increment == 1) &&
(startPos >= doc->LineEnd(lineRangeStart)) &&
(lineRangeStart < lineRangeEnd)) {
// the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = doc->LineStart(lineRangeStart);
} else if ((increment == -1) &&
(startPos <= doc->LineStart(lineRangeStart)) &&
(lineRangeStart > lineRangeEnd)) {
// the start position is at beginning of line.
lineRangeStart--;
startPos = doc->LineEnd(lineRangeStart);
}
lineRangeBreak = lineRangeEnd + increment;
}
Range LineRange(int line) const {
Range range(doc->LineStart(line), doc->LineEnd(line));
if (increment == 1) {
if (line == lineRangeStart)
range.start = startPos;
if (line == lineRangeEnd)
range.end = endPos;
} else {
if (line == lineRangeEnd)
range.start = endPos;
if (line == lineRangeStart)
range.end = startPos;
}
return range;
}
};
// Define a way for the Regular Expression code to access the document // Define a way for the Regular Expression code to access the document
class DocumentIndexer : public CharacterIndexer { class DocumentIndexer : public CharacterIndexer {
Document *pdoc; Document *pdoc;
@@ -2139,18 +2304,376 @@ public:
} }
}; };
#ifdef CXX11_REGEX
class ByteIterator : public std::iterator<std::bidirectional_iterator_tag, char> {
public:
const Document *doc;
Position position;
ByteIterator(const Document *doc_ = 0, Position position_ = 0) : doc(doc_), position(position_) {
}
ByteIterator(const ByteIterator &other) {
doc = other.doc;
position = other.position;
}
ByteIterator &operator=(const ByteIterator &other) {
if (this != &other) {
doc = other.doc;
position = other.position;
}
return *this;
}
char operator*() const {
return doc->CharAt(position);
}
ByteIterator &operator++() {
position++;
return *this;
}
ByteIterator operator++(int) {
ByteIterator retVal(*this);
position++;
return retVal;
}
ByteIterator &operator--() {
position--;
return *this;
}
bool operator==(const ByteIterator &other) const {
return doc == other.doc && position == other.position;
}
bool operator!=(const ByteIterator &other) const {
return doc != other.doc || position != other.position;
}
int Pos() const {
return position;
}
int PosRoundUp() const {
return position;
}
};
// On Windows, wchar_t is 16 bits wide and on Unix it is 32 bits wide.
// Would be better to use sizeof(wchar_t) or similar to differentiate
// but easier for now to hard-code platforms.
// C++11 has char16_t and char32_t but neither Clang nor Visual C++
// appear to allow specializing basic_regex over these.
#ifdef _WIN32
#define WCHAR_T_IS_16 1
#else
#define WCHAR_T_IS_16 0
#endif
#if WCHAR_T_IS_16
// On Windows, report non-BMP characters as 2 separate surrogates as that
// matches wregex since it is based on wchar_t.
class UTF8Iterator : public std::iterator<std::bidirectional_iterator_tag, wchar_t> {
// These 3 fields determine the iterator position and are used for comparisons
const Document *doc;
Position position;
size_t characterIndex;
// Remaining fields are derived from the determining fields so are excluded in comparisons
unsigned int lenBytes;
size_t lenCharacters;
wchar_t buffered[2];
public:
UTF8Iterator(const Document *doc_ = 0, Position position_ = 0) :
doc(doc_), position(position_), characterIndex(0), lenBytes(0), lenCharacters(0) {
buffered[0] = 0;
buffered[1] = 0;
if (doc) {
ReadCharacter();
}
}
UTF8Iterator(const UTF8Iterator &other) {
doc = other.doc;
position = other.position;
characterIndex = other.characterIndex;
lenBytes = other.lenBytes;
lenCharacters = other.lenCharacters;
buffered[0] = other.buffered[0];
buffered[1] = other.buffered[1];
}
UTF8Iterator &operator=(const UTF8Iterator &other) {
if (this != &other) {
doc = other.doc;
position = other.position;
characterIndex = other.characterIndex;
lenBytes = other.lenBytes;
lenCharacters = other.lenCharacters;
buffered[0] = other.buffered[0];
buffered[1] = other.buffered[1];
}
return *this;
}
wchar_t operator*() const {
assert(lenCharacters != 0);
return buffered[characterIndex];
}
UTF8Iterator &operator++() {
if ((characterIndex + 1) < (lenCharacters)) {
characterIndex++;
} else {
position += lenBytes;
ReadCharacter();
characterIndex = 0;
}
return *this;
}
UTF8Iterator operator++(int) {
UTF8Iterator retVal(*this);
if ((characterIndex + 1) < (lenCharacters)) {
characterIndex++;
} else {
position += lenBytes;
ReadCharacter();
characterIndex = 0;
}
return retVal;
}
UTF8Iterator &operator--() {
if (characterIndex) {
characterIndex--;
} else {
position = doc->NextPosition(position, -1);
ReadCharacter();
characterIndex = lenCharacters - 1;
}
return *this;
}
bool operator==(const UTF8Iterator &other) const {
// Only test the determining fields, not the character widths and values derived from this
return doc == other.doc &&
position == other.position &&
characterIndex == other.characterIndex;
}
bool operator!=(const UTF8Iterator &other) const {
// Only test the determining fields, not the character widths and values derived from this
return doc != other.doc ||
position != other.position ||
characterIndex != other.characterIndex;
}
int Pos() const {
return position;
}
int PosRoundUp() const {
if (characterIndex)
return position + lenBytes; // Force to end of character
else
return position;
}
private:
void ReadCharacter() {
Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position);
lenBytes = charExtracted.widthBytes;
if (charExtracted.character == unicodeReplacementChar) {
lenCharacters = 1;
buffered[0] = static_cast<wchar_t>(charExtracted.character);
} else {
lenCharacters = UTF16FromUTF32Character(charExtracted.character, buffered);
}
}
};
#else
// On Unix, report non-BMP characters as single characters
class UTF8Iterator : public std::iterator<std::bidirectional_iterator_tag, wchar_t> {
const Document *doc;
Position position;
public:
UTF8Iterator(const Document *doc_=0, Position position_=0) : doc(doc_), position(position_) {
}
UTF8Iterator(const UTF8Iterator &other) {
doc = other.doc;
position = other.position;
}
UTF8Iterator &operator=(const UTF8Iterator &other) {
if (this != &other) {
doc = other.doc;
position = other.position;
}
return *this;
}
wchar_t operator*() const {
Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position);
return charExtracted.character;
}
UTF8Iterator &operator++() {
position = doc->NextPosition(position, 1);
return *this;
}
UTF8Iterator operator++(int) {
UTF8Iterator retVal(*this);
position = doc->NextPosition(position, 1);
return retVal;
}
UTF8Iterator &operator--() {
position = doc->NextPosition(position, -1);
return *this;
}
bool operator==(const UTF8Iterator &other) const {
return doc == other.doc && position == other.position;
}
bool operator!=(const UTF8Iterator &other) const {
return doc != other.doc || position != other.position;
}
int Pos() const {
return position;
}
int PosRoundUp() const {
return position;
}
};
#endif
std::regex_constants::match_flag_type MatchFlags(const Document *doc, int startPos, int endPos) {
std::regex_constants::match_flag_type flagsMatch = std::regex_constants::match_default;
if (!doc->IsLineStartPosition(startPos))
flagsMatch |= std::regex_constants::match_not_bol;
if (!doc->IsLineEndPosition(endPos))
flagsMatch |= std::regex_constants::match_not_eol;
return flagsMatch;
}
template<typename Iterator, typename Regex>
bool MatchOnLines(const Document *doc, const Regex &regexp, const RESearchRange &resr, RESearch &search) {
bool matched = false;
std::match_results<Iterator> match;
// MSVC and libc++ have problems with ^ and $ matching line ends inside a range
// If they didn't then the line by line iteration could be removed for the forwards
// case and replaced with the following 4 lines:
// Iterator uiStart(doc, startPos);
// Iterator uiEnd(doc, endPos);
// flagsMatch = MatchFlags(doc, startPos, endPos);
// matched = std::regex_search(uiStart, uiEnd, match, regexp, flagsMatch);
// Line by line.
for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) {
const Range lineRange = resr.LineRange(line);
Iterator itStart(doc, lineRange.start);
Iterator itEnd(doc, lineRange.end);
std::regex_constants::match_flag_type flagsMatch = MatchFlags(doc, lineRange.start, lineRange.end);
matched = std::regex_search(itStart, itEnd, match, regexp, flagsMatch);
// Check for the last match on this line.
if (matched) {
if (resr.increment == -1) {
while (matched) {
Iterator itNext(doc, match[0].second.PosRoundUp());
flagsMatch = MatchFlags(doc, itNext.Pos(), lineRange.end);
std::match_results<Iterator> matchNext;
matched = std::regex_search(itNext, itEnd, matchNext, regexp, flagsMatch);
if (matched) {
if (match[0].first == match[0].second) {
// Empty match means failure so exit
return false;
}
match = matchNext;
}
}
matched = true;
}
break;
}
}
if (matched) {
for (size_t co = 0; co < match.size(); co++) {
search.bopat[co] = match[co].first.Pos();
search.eopat[co] = match[co].second.PosRoundUp();
size_t lenMatch = search.eopat[co] - search.bopat[co];
search.pat[co].resize(lenMatch);
for (size_t iPos = 0; iPos < lenMatch; iPos++) {
search.pat[co][iPos] = doc->CharAt(iPos + search.bopat[co]);
}
}
}
return matched;
}
long Cxx11RegexFindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, int *length, RESearch &search) {
const RESearchRange resr(doc, minPos, maxPos);
try {
//ElapsedTime et;
std::regex::flag_type flagsRe = std::regex::ECMAScript;
// Flags that apper to have no effect:
// | std::regex::collate | std::regex::extended;
if (!caseSensitive)
flagsRe = flagsRe | std::regex::icase;
// Clear the RESearch so can fill in matches
search.Clear();
bool matched = false;
if (SC_CP_UTF8 == doc->dbcsCodePage) {
unsigned int lenS = static_cast<unsigned int>(strlen(s));
std::vector<wchar_t> ws(lenS + 1);
#if WCHAR_T_IS_16
size_t outLen = UTF16FromUTF8(s, lenS, &ws[0], lenS);
#else
size_t outLen = UTF32FromUTF8(s, lenS, reinterpret_cast<unsigned int *>(&ws[0]), lenS);
#endif
ws[outLen] = 0;
std::wregex regexp;
#if defined(__APPLE__)
// Using a UTF-8 locale doesn't change to Unicode over a byte buffer so '.'
// is one byte not one character.
// However, on OS X this makes wregex act as Unicode
std::locale localeU("en_US.UTF-8");
regexp.imbue(localeU);
#endif
regexp.assign(&ws[0], flagsRe);
matched = MatchOnLines<UTF8Iterator>(doc, regexp, resr, search);
} else {
std::regex regexp;
regexp.assign(s, flagsRe);
matched = MatchOnLines<ByteIterator>(doc, regexp, resr, search);
}
int posMatch = -1;
if (matched) {
posMatch = search.bopat[0];
*length = search.eopat[0] - search.bopat[0];
}
// Example - search in doc/ScintillaHistory.html for
// [[:upper:]]eta[[:space:]]
// On MacBook, normally around 1 second but with locale imbued -> 14 seconds.
//double durSearch = et.Duration(true);
//Platform::DebugPrintf("Search:%9.6g \n", durSearch);
return posMatch;
} catch (std::regex_error &) {
// Failed to create regular expression
throw RegexError();
} catch (...) {
// Failed in some other way
return -1;
}
}
#endif
}
long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s, long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool, bool, int flags, bool caseSensitive, bool, bool, int flags,
int *length) { int *length) {
bool posix = (flags & SCFIND_POSIX) != 0;
int increment = (minPos <= maxPos) ? 1 : -1;
int startPos = minPos; #ifdef CXX11_REGEX
int endPos = maxPos; if (flags & SCFIND_CXX11REGEX) {
return Cxx11RegexFindText(doc, minPos, maxPos, s,
caseSensitive, length, search);
}
#endif
// Range endpoints should not be inside DBCS characters, but just in case, move them. const RESearchRange resr(doc, minPos, maxPos);
startPos = doc->MovePositionOutsideChar(startPos, 1, false);
endPos = doc->MovePositionOutsideChar(endPos, 1, false); const bool posix = (flags & SCFIND_POSIX) != 0;
const char *errmsg = search.Compile(s, *length, caseSensitive, posix); const char *errmsg = search.Compile(s, *length, caseSensitive, posix);
if (errmsg) { if (errmsg) {
@@ -2160,50 +2683,34 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
// Replace first '.' with '-' in each property file variable reference: // Replace first '.' with '-' in each property file variable reference:
// Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
// Replace: $(\1-\2) // Replace: $(\1-\2)
int lineRangeStart = doc->LineFromPosition(startPos);
int lineRangeEnd = doc->LineFromPosition(endPos);
if ((increment == 1) &&
(startPos >= doc->LineEnd(lineRangeStart)) &&
(lineRangeStart < lineRangeEnd)) {
// the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = doc->LineStart(lineRangeStart);
} else if ((increment == -1) &&
(startPos <= doc->LineStart(lineRangeStart)) &&
(lineRangeStart > lineRangeEnd)) {
// the start position is at beginning of line.
lineRangeStart--;
startPos = doc->LineEnd(lineRangeStart);
}
int pos = -1; int pos = -1;
int lenRet = 0; int lenRet = 0;
char searchEnd = s[*length - 1]; const char searchEnd = s[*length - 1];
char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0'; const char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0';
int lineRangeBreak = lineRangeEnd + increment; for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) {
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = doc->LineStart(line); int startOfLine = doc->LineStart(line);
int endOfLine = doc->LineEnd(line); int endOfLine = doc->LineEnd(line);
if (increment == 1) { if (resr.increment == 1) {
if (line == lineRangeStart) { if (line == resr.lineRangeStart) {
if ((startPos != startOfLine) && (s[0] == '^')) if ((resr.startPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if start position after start of line continue; // Can't match start of line if start position after start of line
startOfLine = startPos; startOfLine = resr.startPos;
} }
if (line == lineRangeEnd) { if (line == resr.lineRangeEnd) {
if ((endPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\')) if ((resr.endPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
continue; // Can't match end of line if end position before end of line continue; // Can't match end of line if end position before end of line
endOfLine = endPos; endOfLine = resr.endPos;
} }
} else { } else {
if (line == lineRangeEnd) { if (line == resr.lineRangeEnd) {
if ((endPos != startOfLine) && (s[0] == '^')) if ((resr.endPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if end position after start of line continue; // Can't match start of line if end position after start of line
startOfLine = endPos; startOfLine = resr.endPos;
} }
if (line == lineRangeStart) { if (line == resr.lineRangeStart) {
if ((startPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\')) if ((resr.startPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
continue; // Can't match end of line if start position before end of line continue; // Can't match end of line if start position before end of line
endOfLine = startPos; endOfLine = resr.startPos;
} }
} }
@@ -2215,7 +2722,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
search.eopat[0] = doc->MovePositionOutsideChar(search.eopat[0], 1, false); search.eopat[0] = doc->MovePositionOutsideChar(search.eopat[0], 1, false);
lenRet = search.eopat[0] - search.bopat[0]; lenRet = search.eopat[0] - search.bopat[0];
// There can be only one start of a line, so no need to look for last match in line // There can be only one start of a line, so no need to look for last match in line
if ((increment == -1) && (s[0] != '^')) { if ((resr.increment == -1) && (s[0] != '^')) {
// Check for the last match on this line. // Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop int repetitions = 1000; // Break out of infinite loop
while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) { while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) {

View File

@@ -39,10 +39,22 @@ public:
start(start_), end(end_) { start(start_), end(end_) {
} }
bool operator==(const Range &other) const {
return (start == other.start) && (end == other.end);
}
bool Valid() const { bool Valid() const {
return (start != invalidPosition) && (end != invalidPosition); return (start != invalidPosition) && (end != invalidPosition);
} }
Position First() const {
return (start <= end) ? start : end;
}
Position Last() const {
return (start > end) ? start : end;
}
// Is the position within the range? // Is the position within the range?
bool Contains(Position pos) const { bool Contains(Position pos) const {
if (start < end) { if (start < end) {
@@ -176,6 +188,10 @@ public:
} }
}; };
struct RegexError : public std::runtime_error {
RegexError() : std::runtime_error("regex failure") {}
};
/** /**
*/ */
class Document : PerLine, public IDocumentWithLineEnd, public ILoader { class Document : PerLine, public IDocumentWithLineEnd, public ILoader {
@@ -191,9 +207,6 @@ public:
bool operator==(const WatcherWithUserData &other) const { bool operator==(const WatcherWithUserData &other) const {
return (watcher == other.watcher) && (userData == other.userData); return (watcher == other.watcher) && (userData == other.userData);
} }
bool operator!=(const WatcherWithUserData &other) const {
return !(*this == other);
}
}; };
private: private:
@@ -201,13 +214,15 @@ private:
CellBuffer cb; CellBuffer cb;
CharClassify charClass; CharClassify charClass;
CaseFolder *pcf; CaseFolder *pcf;
char stylingMask;
int endStyled; int endStyled;
int styleClock; int styleClock;
int enteredModification; int enteredModification;
int enteredStyling; int enteredStyling;
int enteredReadOnlyCount; int enteredReadOnlyCount;
bool insertionSet;
std::string insertion;
std::vector<WatcherWithUserData> watchers; std::vector<WatcherWithUserData> watchers;
// ldSize is not real data - it is for dimensions and loops // ldSize is not real data - it is for dimensions and loops
@@ -221,9 +236,6 @@ public:
LexInterface *pli; LexInterface *pli;
int stylingBits;
int stylingBitsMask;
int eolMode; int eolMode;
/// Can also be SC_CP_UTF8 to enable UTF-8 mode /// Can also be SC_CP_UTF8 to enable UTF-8 mode
int dbcsCodePage; int dbcsCodePage;
@@ -263,10 +275,11 @@ public:
bool IsCrLf(int pos) const; bool IsCrLf(int pos) const;
int LenChar(int pos); int LenChar(int pos);
bool InGoodUTF8(int pos, int &start, int &end) const; bool InGoodUTF8(int pos, int &start, int &end) const;
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const;
int NextPosition(int pos, int moveDir) const; int NextPosition(int pos, int moveDir) const;
bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed
int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const; int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const;
int GetRelativePositionUTF16(int positionStart, int characterOffset) const;
int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const; int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const;
int SCI_METHOD CodePage() const; int SCI_METHOD CodePage() const;
bool SCI_METHOD IsDBCSLeadByte(char ch) const; bool SCI_METHOD IsDBCSLeadByte(char ch) const;
@@ -277,7 +290,8 @@ public:
void ModifiedAt(int pos); void ModifiedAt(int pos);
void CheckReadOnly(); void CheckReadOnly();
bool DeleteChars(int pos, int len); bool DeleteChars(int pos, int len);
bool InsertString(int position, const char *s, int insertLength); int InsertString(int position, const char *s, int insertLength);
void ChangeInsertion(const char *s, int length);
int SCI_METHOD AddData(char *data, int length); int SCI_METHOD AddData(char *data, int length);
void * SCI_METHOD ConvertToDocument(); void * SCI_METHOD ConvertToDocument();
int Undo(); int Undo();
@@ -294,15 +308,22 @@ public:
void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); } void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); }
void SetSavePoint(); void SetSavePoint();
bool IsSavePoint() const { return cb.IsSavePoint(); } bool IsSavePoint() const { return cb.IsSavePoint(); }
void TentativeStart() { cb.TentativeStart(); }
void TentativeCommit() { cb.TentativeCommit(); }
void TentativeUndo();
bool TentativeActive() const { return cb.TentativeActive(); }
const char * SCI_METHOD BufferPointer() { return cb.BufferPointer(); } const char * SCI_METHOD BufferPointer() { return cb.BufferPointer(); }
const char *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); } const char *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); }
int GapPosition() const { return cb.GapPosition(); } int GapPosition() const { return cb.GapPosition(); }
int SCI_METHOD GetLineIndentation(int line); int SCI_METHOD GetLineIndentation(int line);
void SetLineIndentation(int line, int indent); int SetLineIndentation(int line, int indent);
int GetLineIndentPosition(int line) const; int GetLineIndentPosition(int line) const;
int GetColumn(int position); int GetColumn(int position);
int CountCharacters(int startPos, int endPos); int CountCharacters(int startPos, int endPos) const;
int CountUTF16(int startPos, int endPos) const;
int FindColumn(int line, int column); int FindColumn(int line, int column);
void Indent(bool forwards, int lineBottom, int lineTop); void Indent(bool forwards, int lineBottom, int lineTop);
static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted); static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted);
@@ -310,8 +331,6 @@ public:
void SetReadOnly(bool set) { cb.SetReadOnly(set); } void SetReadOnly(bool set) { cb.SetReadOnly(set); }
bool IsReadOnly() const { return cb.IsReadOnly(); } bool IsReadOnly() const { return cb.IsReadOnly(); }
bool InsertChar(int pos, char ch);
bool InsertCString(int position, const char *s);
void DelChar(int pos); void DelChar(int pos);
void DelCharBack(int pos); void DelCharBack(int pos);
@@ -332,6 +351,7 @@ public:
void DeleteAllMarks(int markerNum); void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle); int LineFromHandle(int markerHandle);
int SCI_METHOD LineStart(int line) const; int SCI_METHOD LineStart(int line) const;
bool IsLineStartPosition(int position) const;
int SCI_METHOD LineEnd(int line) const; int SCI_METHOD LineEnd(int line) const;
int LineEndPosition(int position) const; int LineEndPosition(int position) const;
bool IsLineEndPosition(int position) const; bool IsLineEndPosition(int position) const;
@@ -351,6 +371,16 @@ public:
int NextWordEnd(int pos, int delta); int NextWordEnd(int pos, int delta);
int SCI_METHOD Length() const { return cb.Length(); } int SCI_METHOD Length() const { return cb.Length(); }
void Allocate(int newSize) { cb.Allocate(newSize); } void Allocate(int newSize) { cb.Allocate(newSize); }
struct CharacterExtracted {
unsigned int character;
unsigned int widthBytes;
CharacterExtracted(unsigned int character_, unsigned int widthBytes_) :
character(character_), widthBytes(widthBytes_) {
}
};
CharacterExtracted ExtractCharacter(int position) const;
bool MatchesWordOptions(bool word, bool wordStart, int pos, int length) const; bool MatchesWordOptions(bool word, bool wordStart, int pos, int length) const;
bool HasCaseFolder(void) const; bool HasCaseFolder(void) const;
void SetCaseFolder(CaseFolder *pcf_); void SetCaseFolder(CaseFolder *pcf_);
@@ -361,8 +391,7 @@ public:
void SetDefaultCharClasses(bool includeWordClass); void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass); void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
int GetCharsOfClass(CharClassify::cc charClass, unsigned char *buffer); int GetCharsOfClass(CharClassify::cc characterClass, unsigned char *buffer);
void SetStylingBits(int bits);
void SCI_METHOD StartStyling(int position, char mask); void SCI_METHOD StartStyling(int position, char mask);
bool SCI_METHOD SetStyleFor(int length, char style); bool SCI_METHOD SetStyleFor(int length, char style);
bool SCI_METHOD SetStyles(int length, const char *styles); bool SCI_METHOD SetStyles(int length, const char *styles);
@@ -393,7 +422,7 @@ public:
void AnnotationSetStyles(int line, const unsigned char *styles); void AnnotationSetStyles(int line, const unsigned char *styles);
int AnnotationLines(int line) const; int AnnotationLines(int line) const;
void AnnotationClearAll(); void AnnotationClearAll();
bool AddWatcher(DocWatcher *watcher, void *userData); bool AddWatcher(DocWatcher *watcher, void *userData);
bool RemoveWatcher(DocWatcher *watcher, void *userData); bool RemoveWatcher(DocWatcher *watcher, void *userData);

View File

@@ -0,0 +1,77 @@
// Scintilla source code edit control
/** @file EditModel.cxx
** Defines the editor state that must be visible to EditorView.
**/
// Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <ctype.h>
#include <stdexcept>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <memory>
#include "Platform.h"
#include "ILexer.h"
#include "Scintilla.h"
#include "StringCopy.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "ContractionState.h"
#include "CellBuffer.h"
#include "KeyMap.h"
#include "Indicator.h"
#include "XPM.h"
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "CaseFolder.h"
#include "Document.h"
#include "UniConversion.h"
#include "Selection.h"
#include "PositionCache.h"
#include "EditModel.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
Caret::Caret() :
active(false), on(false), period(500) {}
EditModel::EditModel() {
inOverstrike = false;
xOffset = 0;
trackLineWidth = false;
posDrag = SelectionPosition(invalidPosition);
braces[0] = invalidPosition;
braces[1] = invalidPosition;
bracesMatchStyle = STYLE_BRACEBAD;
highlightGuideColumn = 0;
primarySelection = true;
imeInteraction = imeWindowed;
foldFlags = 0;
hotspot = Range(invalidPosition);
hoverIndicatorPos = invalidPosition;
wrapWidth = LineLayout::wrapWidthInfinite;
pdoc = new Document();
pdoc->AddRef();
}
EditModel::~EditModel() {
pdoc->Release();
pdoc = 0;
}

View File

@@ -0,0 +1,70 @@
// Scintilla source code edit control
/** @file EditModel.h
** Defines the editor state that must be visible to EditorView.
**/
// Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef EDITMODEL_H
#define EDITMODEL_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
*/
class Caret {
public:
bool active;
bool on;
int period;
Caret();
};
class EditModel {
// Private so EditModel objects can not be copied
EditModel(const EditModel &);
EditModel &operator=(const EditModel &);
public:
bool inOverstrike;
int xOffset; ///< Horizontal scrolled amount in pixels
bool trackLineWidth;
SpecialRepresentations reprs;
Caret caret;
SelectionPosition posDrag;
Position braces[2];
int bracesMatchStyle;
int highlightGuideColumn;
Selection sel;
bool primarySelection;
enum IMEInteraction { imeWindowed, imeInline } imeInteraction;
int foldFlags;
ContractionState cs;
// Hotspot support
Range hotspot;
int hoverIndicatorPos;
// Wrapping support
int wrapWidth;
Document *pdoc;
EditModel();
virtual ~EditModel();
virtual int TopLineOfMain() const = 0;
virtual Point GetVisibleOriginInMain() const = 0;
virtual int LinesOnScreen() const = 0;
virtual Range GetHotSpotRange() const = 0;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,174 @@
// Scintilla source code edit control
/** @file EditView.h
** Defines the appearance of the main text area of the editor window.
**/
// Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef EDITVIEW_H
#define EDITVIEW_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
struct PrintParameters {
int magnification;
int colourMode;
WrapMode wrapState;
PrintParameters();
};
/**
* The view may be drawn in separate phases.
*/
enum DrawPhase {
drawBack = 0x1,
drawIndicatorsBack = 0x2,
drawText = 0x4,
drawIndentationGuides = 0x8,
drawIndicatorsFore = 0x10,
drawSelectionTranslucent = 0x20,
drawLineTranslucent = 0x40,
drawFoldLines = 0x80,
drawCarets = 0x100,
drawAll = 0x1FF
};
bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st);
int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st);
void DrawTextNoClipPhase(Surface *surface, PRectangle rc, const Style &style, XYPOSITION ybase,
const char *s, int len, DrawPhase phase);
void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText,
const StyledText &st, size_t start, size_t length, DrawPhase phase);
typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid);
/**
* EditView draws the main text area.
*/
class EditView {
public:
PrintParameters printParameters;
PerLine *ldTabstops;
int tabWidthMinimumPixels;
bool hideSelection;
bool drawOverstrikeCaret;
/** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
* the screen. This avoids flashing but is about 30% slower. */
bool bufferedDraw;
/** In phasesTwo mode, drawing is performed in two phases, first the background
* and then the foreground. This avoids chopping off characters that overlap the next run.
* In multiPhaseDraw mode, drawing is performed in multiple phases with each phase drawing
* one feature over the whole drawing area, instead of within one line. This allows text to
* overlap from one line to the next. */
enum PhasesDraw { phasesOne, phasesTwo, phasesMultiple };
PhasesDraw phasesDraw;
int lineWidthMaxSeen;
bool additionalCaretsBlink;
bool additionalCaretsVisible;
bool imeCaretBlockOverride;
Surface *pixmapLine;
Surface *pixmapIndentGuide;
Surface *pixmapIndentGuideHighlight;
LineLayoutCache llc;
PositionCache posCache;
int tabArrowHeight; // draw arrow heads this many pixels above/below line midpoint
/** Some platforms, notably PLAT_CURSES, do not support Scintilla's native
* DrawTabArrow function for drawing tab characters. Allow those platforms to
* override it instead of creating a new method in the Surface class that
* existing platforms must implement as empty. */
DrawTabArrowFn customDrawTabArrow;
DrawWrapMarkerFn customDrawWrapMarker;
EditView();
virtual ~EditView();
bool SetTwoPhaseDraw(bool twoPhaseDraw);
bool SetPhasesDraw(int phases);
bool LinesOverlap() const;
void ClearAllTabstops();
XYPOSITION NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const;
bool ClearTabstops(int line);
bool AddTabstop(int line, int x);
int GetNextTabstop(int line, int x) const;
void LinesAddedOrRemoved(int lineOfPos, int linesAdded);
void DropGraphics(bool freeObjects);
void AllocateGraphics(const ViewStyle &vsDraw);
void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw);
LineLayout *RetrieveLineLayout(int lineNumber, const EditModel &model);
void LayoutLine(const EditModel &model, int line, Surface *surface, const ViewStyle &vstyle,
LineLayout *ll, int width = LineLayout::wrapWidthInfinite);
Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, int topLine, const ViewStyle &vs);
SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, Point pt, bool canReturnInvalid,
bool charPosition, bool virtualSpace, const ViewStyle &vs);
SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, int lineDoc, int x, const ViewStyle &vs);
int DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs);
int StartEndDisplayLine(Surface *surface, const EditModel &model, int pos, bool start, const ViewStyle &vs);
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
void DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine,
int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
ColourOptional background);
void DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
int line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase);
void DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line,
int xStart, PRectangle rcLine, int subLine) const;
void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine,
Range lineRange, int posLineStart, int xStart,
int subLine, ColourOptional background) const;
void DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int lineVisible,
PRectangle rcLine, Range lineRange, int posLineStart, int xStart,
int subLine, ColourOptional background);
void DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
int line, int lineVisible, PRectangle rcLine, int xStart, int subLine);
void DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line,
int lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase);
void PaintText(Surface *surfaceWindow, const EditModel &model, PRectangle rcArea, PRectangle rcClient,
const ViewStyle &vsDraw);
long FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure,
const EditModel &model, const ViewStyle &vs);
};
/**
* Convenience class to ensure LineLayout objects are always disposed.
*/
class AutoLineLayout {
LineLayoutCache &llc;
LineLayout *ll;
AutoLineLayout &operator=(const AutoLineLayout &);
public:
AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {}
~AutoLineLayout() {
llc.Dispose(ll);
ll = 0;
}
LineLayout *operator->() const {
return ll;
}
operator LineLayout *() const {
return ll;
}
void Set(LineLayout *ll_) {
llc.Dispose(ll);
ll = ll_;
}
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -12,17 +12,6 @@
namespace Scintilla { namespace Scintilla {
#endif #endif
/**
*/
class Caret {
public:
bool active;
bool on;
int period;
Caret();
};
/** /**
*/ */
class Timer { class Timer {
@@ -47,7 +36,7 @@ public:
/** /**
* When platform has a way to generate an event before painting, * When platform has a way to generate an event before painting,
* accumulate needed styling range and other work items in * accumulate needed styling range and other work items in
* WorkNeeded to avoid unnecessary work inside paint handler * WorkNeeded to avoid unnecessary work inside paint handler
*/ */
class WorkNeeded { class WorkNeeded {
@@ -160,16 +149,9 @@ struct WrapPending {
} }
}; };
struct PrintParameters {
int magnification;
int colourMode;
WrapMode wrapState;
PrintParameters();
};
/** /**
*/ */
class Editor : public DocWatcher { class Editor : public EditModel, public DocWatcher {
// Private so Editor objects can not be copied // Private so Editor objects can not be copied
Editor(const Editor &); Editor(const Editor &);
Editor &operator=(const Editor &); Editor &operator=(const Editor &);
@@ -189,32 +171,17 @@ protected: // ScintillaBase subclass needs access to much of Editor
Point sizeRGBAImage; Point sizeRGBAImage;
float scaleRGBAImage; float scaleRGBAImage;
PrintParameters printParameters; MarginView marginView;
EditView view;
int cursorMode; int cursorMode;
// Highlight current folding block
HighlightDelimiter highlightDelimiter;
bool hasFocus; bool hasFocus;
bool hideSelection;
bool inOverstrike;
bool drawOverstrikeCaret;
bool mouseDownCaptures; bool mouseDownCaptures;
/** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
* the screen. This avoids flashing but is about 30% slower. */
bool bufferedDraw;
/** In twoPhaseDraw mode, drawing is performed in two phases, first the background
* and then the foreground. This avoids chopping off characters that overlap the next run. */
bool twoPhaseDraw;
int xOffset; ///< Horizontal scrolled amount in pixels
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret
bool horizontalScrollBarVisible; bool horizontalScrollBarVisible;
int scrollWidth; int scrollWidth;
bool trackLineWidth;
int lineWidthMaxSeen;
bool verticalScrollBarVisible; bool verticalScrollBarVisible;
bool endAtLastLine; bool endAtLastLine;
int caretSticky; int caretSticky;
@@ -223,25 +190,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool multipleSelection; bool multipleSelection;
bool additionalSelectionTyping; bool additionalSelectionTyping;
int multiPasteMode; int multiPasteMode;
bool additionalCaretsBlink;
bool additionalCaretsVisible;
int virtualSpaceOptions; int virtualSpaceOptions;
Surface *pixmapLine;
Surface *pixmapSelMargin;
Surface *pixmapSelPattern;
Surface *pixmapSelPatternOffset1;
Surface *pixmapIndentGuide;
Surface *pixmapIndentGuideHighlight;
LineLayoutCache llc;
PositionCache posCache;
SpecialRepresentations reprs;
KeyMap kmap; KeyMap kmap;
Caret caret;
Timer timer; Timer timer;
Timer autoScrollTimer; Timer autoScrollTimer;
enum { autoScrollDelay = 200 }; enum { autoScrollDelay = 200 };
@@ -250,6 +203,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
Point lastClick; Point lastClick;
unsigned int lastClickTime; unsigned int lastClickTime;
Point doubleClickCloseThreshold;
int dwellDelay; int dwellDelay;
int ticksToDwell; int ticksToDwell;
bool dwelling; bool dwelling;
@@ -257,7 +211,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
Point ptMouseLast; Point ptMouseLast;
enum { ddNone, ddInitial, ddDragging } inDragDrop; enum { ddNone, ddInitial, ddDragging } inDragDrop;
bool dropWentOutside; bool dropWentOutside;
SelectionPosition posDrag;
SelectionPosition posDrop; SelectionPosition posDrop;
int hotSpotClickPos; int hotSpotClickPos;
int lastXChosen; int lastXChosen;
@@ -274,9 +227,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
int lengthForEncode; int lengthForEncode;
int needUpdateUI; int needUpdateUI;
Position braces[2];
int bracesMatchStyle;
int highlightGuideColumn;
enum { notPainting, painting, paintAbandoned } paintState; enum { notPainting, painting, paintAbandoned } paintState;
bool paintAbandonedByStyling; bool paintAbandonedByStyling;
@@ -288,8 +238,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
int modEventMask; int modEventMask;
SelectionText drag; SelectionText drag;
Selection sel;
bool primarySelection;
int caretXPolicy; int caretXPolicy;
int caretXSlop; ///< Ensure this many pixels visible on both sides of caret int caretXSlop; ///< Ensure this many pixels visible on both sides of caret
@@ -304,22 +252,13 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool recordingMacro; bool recordingMacro;
int foldFlags;
int foldAutomatic; int foldAutomatic;
ContractionState cs;
// Hotspot support
int hsStart;
int hsEnd;
// Wrapping support // Wrapping support
int wrapWidth;
WrapPending wrapPending; WrapPending wrapPending;
bool convertPastes; bool convertPastes;
Document *pdoc;
Editor(); Editor();
virtual ~Editor(); virtual ~Editor();
virtual void Initialise() = 0; virtual void Initialise() = 0;
@@ -334,34 +273,34 @@ protected: // ScintillaBase subclass needs access to much of Editor
// The top left visible point in main window coordinates. Will be 0,0 except for // The top left visible point in main window coordinates. Will be 0,0 except for
// scroll views where it will be equivalent to the current scroll position. // scroll views where it will be equivalent to the current scroll position.
virtual Point GetVisibleOriginInMain(); virtual Point GetVisibleOriginInMain() const;
Point DocumentPointFromView(Point ptView); // Convert a point from view space to document Point DocumentPointFromView(Point ptView) const; // Convert a point from view space to document
int TopLineOfMain() const; // Return the line at Main's y coordinate 0 int TopLineOfMain() const; // Return the line at Main's y coordinate 0
virtual PRectangle GetClientRectangle(); virtual PRectangle GetClientRectangle() const;
virtual PRectangle GetClientDrawingRectangle(); virtual PRectangle GetClientDrawingRectangle();
PRectangle GetTextRectangle(); PRectangle GetTextRectangle() const;
int LinesOnScreen(); virtual int LinesOnScreen() const;
int LinesToScroll(); int LinesToScroll() const;
int MaxScrollPos(); int MaxScrollPos() const;
SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const; SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const;
Point LocationFromPosition(SelectionPosition pos); Point LocationFromPosition(SelectionPosition pos);
Point LocationFromPosition(int pos); Point LocationFromPosition(int pos);
int XFromPosition(int pos); int XFromPosition(int pos);
int XFromPosition(SelectionPosition sp); int XFromPosition(SelectionPosition sp);
SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true); SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true);
int PositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false); int PositionFromLocation(Point pt, bool canReturnInvalid = false, bool charPosition = false);
SelectionPosition SPositionFromLineX(int lineDoc, int x); SelectionPosition SPositionFromLineX(int lineDoc, int x);
int PositionFromLineX(int line, int x); int PositionFromLineX(int line, int x);
int LineFromLocation(Point pt) const; int LineFromLocation(Point pt) const;
void SetTopLine(int topLineNew); void SetTopLine(int topLineNew);
bool AbandonPaint(); virtual bool AbandonPaint();
virtual void RedrawRect(PRectangle rc); virtual void RedrawRect(PRectangle rc);
virtual void DiscardOverdraw(); virtual void DiscardOverdraw();
virtual void Redraw(); virtual void Redraw();
void RedrawSelMargin(int line=-1, bool allAfter=false); void RedrawSelMargin(int line=-1, bool allAfter=false);
PRectangle RectangleFromRange(int start, int end); PRectangle RectangleFromRange(Range r, int overlap);
void InvalidateRange(int start, int end); void InvalidateRange(int start, int end);
bool UserVirtualSpace() const { bool UserVirtualSpace() const {
@@ -384,8 +323,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool SelectionContainsProtected(); bool SelectionContainsProtected();
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const;
SelectionPosition MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd=true) const; SelectionPosition MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd=true) const;
int MovePositionTo(SelectionPosition newPos, Selection::selTypes sel=Selection::noSel, bool ensureVisible=true); int MovePositionTo(SelectionPosition newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true);
int MovePositionTo(int newPos, Selection::selTypes sel=Selection::noSel, bool ensureVisible=true); int MovePositionTo(int newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true);
SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir); SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir);
SelectionPosition MovePositionSoVisible(int pos, int moveDir); SelectionPosition MovePositionSoVisible(int pos, int moveDir);
Point PointMainCaret(); Point PointMainCaret();
@@ -420,6 +359,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void ScrollRange(SelectionRange range); void ScrollRange(SelectionRange range);
void ShowCaretAtCurrentPosition(); void ShowCaretAtCurrentPosition();
void DropCaret(); void DropCaret();
void CaretSetPeriod(int period);
void InvalidateCaret(); void InvalidateCaret();
virtual void UpdateSystemCaret(); virtual void UpdateSystemCaret();
@@ -431,31 +371,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void LinesJoin(); void LinesJoin();
void LinesSplit(int pixelWidth); void LinesSplit(int pixelWidth);
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const;
void PaintSelMargin(Surface *surface, PRectangle &rc); void PaintSelMargin(Surface *surface, PRectangle &rc);
LineLayout *RetrieveLineLayout(int lineNumber);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite);
ColourDesired SelectionBackground(ViewStyle &vsDraw, bool main) const;
ColourDesired TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const;
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
static void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);
void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart,
bool overrideBackground, ColourDesired background,
bool drawWrapMark, ColourDesired wrapColour);
static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, ViewStyle &vsDraw,
int xStart, PRectangle rcLine, LineLayout *ll, int subLine);
void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under);
void DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine,
int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour);
void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
void RefreshPixMaps(Surface *surfaceWindow); void RefreshPixMaps(Surface *surfaceWindow);
void Paint(Surface *surfaceWindow, PRectangle rcArea); void Paint(Surface *surfaceWindow, PRectangle rcArea);
long FormatRange(bool draw, Sci_RangeToFormat *pfr); long FormatRange(bool draw, Sci_RangeToFormat *pfr);
@@ -471,9 +387,12 @@ protected: // ScintillaBase subclass needs access to much of Editor
void FilterSelections(); void FilterSelections();
int InsertSpace(int position, unsigned int spaces); int InsertSpace(int position, unsigned int spaces);
void AddChar(char ch); void AddChar(char ch);
virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false);
void InsertPaste(SelectionPosition selStart, const char *text, int len); void FillVirtualSpace();
void ClearSelection(bool retainMultipleSelections=false); void InsertPaste(const char *text, int len);
enum PasteShape { pasteStream=0, pasteRectangular = 1, pasteLine = 2 };
void InsertPasteShape(const char *text, int len, PasteShape shape);
void ClearSelection(bool retainMultipleSelections = false);
void ClearAll(); void ClearAll();
void ClearDocumentStyle(); void ClearDocumentStyle();
void Cut(); void Cut();
@@ -486,7 +405,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
void SelectAll(); void SelectAll();
void Undo(); void Undo();
void Redo(); void Redo();
void DelChar();
void DelCharBack(bool allowLineStartDeletion); void DelCharBack(bool allowLineStartDeletion);
virtual void ClaimSelection() = 0; virtual void ClaimSelection() = 0;
@@ -529,7 +447,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void ContainerNeedsUpdate(int flags); void ContainerNeedsUpdate(int flags);
void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false); void PageMove(int direction, Selection::selTypes selt=Selection::noSel, bool stuttered = false);
enum { cmSame, cmUpper, cmLower }; enum { cmSame, cmUpper, cmLower };
virtual std::string CaseMapString(const std::string &s, int caseMapping); virtual std::string CaseMapString(const std::string &s, int caseMapping);
void ChangeCaseOfSelection(int caseMapping); void ChangeCaseOfSelection(int caseMapping);
@@ -537,8 +455,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Duplicate(bool forLine); void Duplicate(bool forLine);
virtual void CancelModes(); virtual void CancelModes();
void NewLine(); void NewLine();
void CursorUpOrDown(int direction, Selection::selTypes sel=Selection::noSel); void CursorUpOrDown(int direction, Selection::selTypes selt=Selection::noSel);
void ParaUpOrDown(int direction, Selection::selTypes sel=Selection::noSel); void ParaUpOrDown(int direction, Selection::selTypes selt=Selection::noSel);
int StartEndDisplayLine(int pos, bool start); int StartEndDisplayLine(int pos, bool start);
virtual int KeyCommand(unsigned int iMessage); virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/); virtual int KeyDefault(int /* key */, int /*modifiers*/);
@@ -568,7 +486,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
/** PositionInSelection returns true if position in selection. */ /** PositionInSelection returns true if position in selection. */
bool PositionInSelection(int pos); bool PositionInSelection(int pos);
bool PointInSelection(Point pt); bool PointInSelection(Point pt);
bool PointInSelMargin(Point pt); bool PointInSelMargin(Point pt) const;
Window::Cursor GetMarginCursor(Point pt) const; Window::Cursor GetMarginCursor(Point pt) const;
void TrimAndSetSelection(int currentPos_, int anchor_); void TrimAndSetSelection(int currentPos_, int anchor_);
void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine); void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine);
@@ -583,7 +501,13 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Tick(); void Tick();
bool Idle(); bool Idle();
virtual void SetTicking(bool on) = 0; virtual void SetTicking(bool on);
enum TickReason { tickCaret, tickScroll, tickWiden, tickDwell, tickPlatform };
virtual void TickFor(TickReason reason);
virtual bool FineTickerAvailable();
virtual bool FineTickerRunning(TickReason reason);
virtual void FineTickerStart(TickReason reason, int millis, int tolerance);
virtual void FineTickerCancel(TickReason reason);
virtual bool SetIdle(bool) { return false; } virtual bool SetIdle(bool) { return false; }
virtual void SetMouseCapture(bool on) = 0; virtual void SetMouseCapture(bool on) = 0;
virtual bool HaveMouseCapture() = 0; virtual bool HaveMouseCapture() = 0;
@@ -620,7 +544,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool PositionIsHotspot(int position) const; bool PositionIsHotspot(int position) const;
bool PointIsHotspot(Point pt); bool PointIsHotspot(Point pt);
void SetHotSpotRange(Point *pt); void SetHotSpotRange(Point *pt);
void GetHotSpotRange(int &hsStart, int &hsEnd) const; Range GetHotSpotRange() const;
void SetHoverIndicatorPosition(int position);
void SetHoverIndicatorPoint(Point pt);
int CodePage() const; int CodePage() const;
virtual bool ValidCodePage(int /* codePage */) const { return true; } virtual bool ValidCodePage(int /* codePage */) const { return true; }

View File

@@ -8,8 +8,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <string> #include <string>

View File

@@ -11,8 +11,8 @@
#include "Platform.h" #include "Platform.h"
#include "Scintilla.h" #include "Scintilla.h"
#include "XPM.h"
#include "Indicator.h" #include "Indicator.h"
#include "XPM.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
@@ -20,17 +20,24 @@ using namespace Scintilla;
static PRectangle PixelGridAlign(const PRectangle &rc) { static PRectangle PixelGridAlign(const PRectangle &rc) {
// Move left and right side to nearest pixel to avoid blurry visuals // Move left and right side to nearest pixel to avoid blurry visuals
return PRectangle(int(rc.left + 0.5), rc.top, int(rc.right + 0.5), rc.bottom); return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom));
} }
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState, int value) const {
surface->PenColour(fore); StyleAndColour sacDraw = sacNormal;
int ymid = (rc.bottom + rc.top) / 2; if (Flags() & SC_INDICFLAG_VALUEFORE) {
if (style == INDIC_SQUIGGLE) { sacDraw.fore = value & SC_INDICVALUEMASK;
}
if (drawState == drawHover) {
sacDraw = sacHover;
}
surface->PenColour(sacDraw.fore);
int ymid = static_cast<int>(rc.bottom + rc.top) / 2;
if (sacDraw.style == INDIC_SQUIGGLE) {
int x = int(rc.left+0.5); int x = int(rc.left+0.5);
int xLast = int(rc.right+0.5); int xLast = int(rc.right+0.5);
int y = 0; int y = 0;
surface->MoveTo(x, rc.top + y); surface->MoveTo(x, static_cast<int>(rc.top) + y);
while (x < xLast) { while (x < xLast) {
if ((x + 2) > xLast) { if ((x + 2) > xLast) {
if (xLast > x) if (xLast > x)
@@ -40,41 +47,41 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
x += 2; x += 2;
y = 2 - y; y = 2 - y;
} }
surface->LineTo(x, rc.top + y); surface->LineTo(x, static_cast<int>(rc.top) + y);
} }
} else if (style == INDIC_SQUIGGLEPIXMAP) { } else if (sacDraw.style == INDIC_SQUIGGLEPIXMAP) {
PRectangle rcSquiggle = PixelGridAlign(rc); PRectangle rcSquiggle = PixelGridAlign(rc);
int width = Platform::Minimum(4000, rcSquiggle.Width()); int width = Platform::Minimum(4000, static_cast<int>(rcSquiggle.Width()));
RGBAImage image(width, 3, 1.0, 0); RGBAImage image(width, 3, 1.0, 0);
enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f }; enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f };
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
if (x%2) { if (x%2) {
// Two halfway columns have a full pixel in middle flanked by light pixels // Two halfway columns have a full pixel in middle flanked by light pixels
image.SetPixel(x, 0, fore, alphaSide); image.SetPixel(x, 0, sacDraw.fore, alphaSide);
image.SetPixel(x, 1, fore, alphaFull); image.SetPixel(x, 1, sacDraw.fore, alphaFull);
image.SetPixel(x, 2, fore, alphaSide); image.SetPixel(x, 2, sacDraw.fore, alphaSide);
} else { } else {
// Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre // Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre
image.SetPixel(x, (x%4) ? 0 : 2, fore, alphaFull); image.SetPixel(x, (x % 4) ? 0 : 2, sacDraw.fore, alphaFull);
image.SetPixel(x, 1, fore, alphaSide2); image.SetPixel(x, 1, sacDraw.fore, alphaSide2);
} }
} }
surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels()); surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels());
} else if (style == INDIC_SQUIGGLELOW) { } else if (sacDraw.style == INDIC_SQUIGGLELOW) {
surface->MoveTo(rc.left, rc.top); surface->MoveTo(static_cast<int>(rc.left), static_cast<int>(rc.top));
int x = rc.left + 3; int x = static_cast<int>(rc.left) + 3;
int y = 0; int y = 0;
while (x < rc.right) { while (x < rc.right) {
surface->LineTo(x-1, rc.top + y); surface->LineTo(x - 1, static_cast<int>(rc.top) + y);
y = 1 - y; y = 1 - y;
surface->LineTo(x, rc.top + y); surface->LineTo(x, static_cast<int>(rc.top) + y);
x += 3; x += 3;
} }
surface->LineTo(rc.right, rc.top + y); // Finish the line surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rc.top) + y); // Finish the line
} else if (style == INDIC_TT) { } else if (sacDraw.style == INDIC_TT) {
surface->MoveTo(rc.left, ymid); surface->MoveTo(static_cast<int>(rc.left), ymid);
int x = rc.left + 5; int x = static_cast<int>(rc.left) + 5;
while (x < rc.right) { while (x < rc.right) {
surface->LineTo(x, ymid); surface->LineTo(x, ymid);
surface->MoveTo(x-3, ymid); surface->MoveTo(x-3, ymid);
@@ -83,81 +90,91 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
surface->MoveTo(x, ymid); surface->MoveTo(x, ymid);
x += 5; x += 5;
} }
surface->LineTo(rc.right, ymid); // Finish the line surface->LineTo(static_cast<int>(rc.right), ymid); // Finish the line
if (x - 3 <= rc.right) { if (x - 3 <= rc.right) {
surface->MoveTo(x-3, ymid); surface->MoveTo(x-3, ymid);
surface->LineTo(x-3, ymid+2); surface->LineTo(x-3, ymid+2);
} }
} else if (style == INDIC_DIAGONAL) { } else if (sacDraw.style == INDIC_DIAGONAL) {
int x = rc.left; int x = static_cast<int>(rc.left);
while (x < rc.right) { while (x < rc.right) {
surface->MoveTo(x, rc.top+2); surface->MoveTo(x, static_cast<int>(rc.top) + 2);
int endX = x+3; int endX = x+3;
int endY = rc.top - 1; int endY = static_cast<int>(rc.top) - 1;
if (endX > rc.right) { if (endX > rc.right) {
endY += endX - rc.right; endY += endX - static_cast<int>(rc.right);
endX = rc.right; endX = static_cast<int>(rc.right);
} }
surface->LineTo(endX, endY); surface->LineTo(endX, endY);
x += 4; x += 4;
} }
} else if (style == INDIC_STRIKE) { } else if (sacDraw.style == INDIC_STRIKE) {
surface->MoveTo(rc.left, rc.top - 4); surface->MoveTo(static_cast<int>(rc.left), static_cast<int>(rc.top) - 4);
surface->LineTo(rc.right, rc.top - 4); surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rc.top) - 4);
} else if (style == INDIC_HIDDEN) { } else if ((sacDraw.style == INDIC_HIDDEN) || (sacDraw.style == INDIC_TEXTFORE)) {
// Draw nothing // Draw nothing
} else if (style == INDIC_BOX) { } else if (sacDraw.style == INDIC_BOX) {
surface->MoveTo(rc.left, ymid+1); surface->MoveTo(static_cast<int>(rc.left), ymid + 1);
surface->LineTo(rc.right, ymid+1); surface->LineTo(static_cast<int>(rc.right), ymid + 1);
surface->LineTo(rc.right, rcLine.top+1); surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rcLine.top) + 1);
surface->LineTo(rc.left, rcLine.top+1); surface->LineTo(static_cast<int>(rc.left), static_cast<int>(rcLine.top) + 1);
surface->LineTo(rc.left, ymid+1); surface->LineTo(static_cast<int>(rc.left), ymid + 1);
} else if (style == INDIC_ROUNDBOX || style == INDIC_STRAIGHTBOX) { } else if (sacDraw.style == INDIC_ROUNDBOX ||
sacDraw.style == INDIC_STRAIGHTBOX ||
sacDraw.style == INDIC_FULLBOX) {
PRectangle rcBox = rcLine; PRectangle rcBox = rcLine;
rcBox.top = rcLine.top + 1; if (sacDraw.style != INDIC_FULLBOX)
rcBox.top = rcLine.top + 1;
rcBox.left = rc.left; rcBox.left = rc.left;
rcBox.right = rc.right; rcBox.right = rc.right;
surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore, fillAlpha, fore, outlineAlpha, 0); surface->AlphaRectangle(rcBox, (sacDraw.style == INDIC_ROUNDBOX) ? 1 : 0,
} else if (style == INDIC_DOTBOX) { sacDraw.fore, fillAlpha, sacDraw.fore, outlineAlpha, 0);
} else if (sacDraw.style == INDIC_DOTBOX) {
PRectangle rcBox = PixelGridAlign(rc); PRectangle rcBox = PixelGridAlign(rc);
rcBox.top = rcLine.top + 1; rcBox.top = rcLine.top + 1;
rcBox.bottom = rcLine.bottom; rcBox.bottom = rcLine.bottom;
// Cap width at 4000 to avoid large allocations when mistakes made // Cap width at 4000 to avoid large allocations when mistakes made
int width = Platform::Minimum(rcBox.Width(), 4000); int width = Platform::Minimum(static_cast<int>(rcBox.Width()), 4000);
RGBAImage image(width, rcBox.Height(), 1.0, 0); RGBAImage image(width, static_cast<int>(rcBox.Height()), 1.0, 0);
// Draw horizontal lines top and bottom // Draw horizontal lines top and bottom
for (int x=0; x<width; x++) { for (int x=0; x<width; x++) {
for (int y=0; y<rcBox.Height(); y += rcBox.Height()-1) { for (int y = 0; y<static_cast<int>(rcBox.Height()); y += static_cast<int>(rcBox.Height()) - 1) {
image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha); image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
} }
} }
// Draw vertical lines left and right // Draw vertical lines left and right
for (int y=1; y<rcBox.Height(); y++) { for (int y = 1; y<static_cast<int>(rcBox.Height()); y++) {
for (int x=0; x<width; x += width-1) { for (int x=0; x<width; x += width-1) {
image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha); image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
} }
} }
surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels()); surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels());
} else if (style == INDIC_DASH) { } else if (sacDraw.style == INDIC_DASH) {
int x = rc.left; int x = static_cast<int>(rc.left);
while (x < rc.right) { while (x < rc.right) {
surface->MoveTo(x, ymid); surface->MoveTo(x, ymid);
surface->LineTo(Platform::Minimum(x + 4, rc.right), ymid); surface->LineTo(Platform::Minimum(x + 4, static_cast<int>(rc.right)), ymid);
x += 7; x += 7;
} }
} else if (style == INDIC_DOTS) { } else if (sacDraw.style == INDIC_DOTS) {
int x = rc.left; int x = static_cast<int>(rc.left);
while (x < rc.right) { while (x < static_cast<int>(rc.right)) {
PRectangle rcDot(x, ymid, x+1, ymid+1); PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1);
surface->FillRectangle(rcDot, fore); surface->FillRectangle(rcDot, sacDraw.fore);
x += 2; x += 2;
} }
} else if (style == INDIC_COMPOSITIONTHICK) { } else if (sacDraw.style == INDIC_COMPOSITIONTHICK) {
PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom); PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom);
surface->FillRectangle(rcComposition, fore); surface->FillRectangle(rcComposition, sacDraw.fore);
} else if (sacDraw.style == INDIC_COMPOSITIONTHIN) {
PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom-1);
surface->FillRectangle(rcComposition, sacDraw.fore);
} else { // Either INDIC_PLAIN or unknown } else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid); surface->MoveTo(static_cast<int>(rc.left), ymid);
surface->LineTo(rc.right, ymid); surface->LineTo(static_cast<int>(rc.right), ymid);
} }
} }
void Indicator::SetFlags(int attributes_) {
attributes = attributes_;
}

View File

@@ -12,18 +12,45 @@
namespace Scintilla { namespace Scintilla {
#endif #endif
struct StyleAndColour {
int style;
ColourDesired fore;
StyleAndColour() : style(INDIC_PLAIN), fore(0, 0, 0) {
}
StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) : style(style_), fore(fore_) {
}
bool operator==(const StyleAndColour &other) const {
return (style == other.style) && (fore == other.fore);
}
};
/** /**
*/ */
class Indicator { class Indicator {
public: public:
int style; enum DrawState { drawNormal, drawHover };
StyleAndColour sacNormal;
StyleAndColour sacHover;
bool under; bool under;
ColourDesired fore;
int fillAlpha; int fillAlpha;
int outlineAlpha; int outlineAlpha;
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) { int attributes;
Indicator() : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) {
} }
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) :
sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState, int value) const;
bool IsDynamic() const {
return !(sacNormal == sacHover);
}
bool OverridesTextFore() const {
return sacNormal.style == INDIC_TEXTFORE || sacHover.style == INDIC_TEXTFORE;
}
int Flags() const {
return attributes;
}
void SetFlags(int attributes_);
}; };
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE

View File

@@ -37,58 +37,63 @@ void LineMarker::SetXPM(const char *const *linesForm) {
void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage) { void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage) {
delete image; delete image;
image = new RGBAImage(sizeRGBAImage.x, sizeRGBAImage.y, scale, pixelsRGBAImage); image = new RGBAImage(static_cast<int>(sizeRGBAImage.x), static_cast<int>(sizeRGBAImage.y), scale, pixelsRGBAImage);
markType = SC_MARK_RGBAIMAGE; markType = SC_MARK_RGBAIMAGE;
} }
static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) {
PRectangle rc; PRectangle rc = PRectangle::FromInts(
rc.left = centreX - armSize; centreX - armSize,
rc.top = centreY - armSize; centreY - armSize,
rc.right = centreX + armSize + 1; centreX + armSize + 1,
rc.bottom = centreY + armSize + 1; centreY + armSize + 1);
surface->RectangleDraw(rc, back, fore); surface->RectangleDraw(rc, back, fore);
} }
static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) {
PRectangle rcCircle; PRectangle rcCircle = PRectangle::FromInts(
rcCircle.left = centreX - armSize; centreX - armSize,
rcCircle.top = centreY - armSize; centreY - armSize,
rcCircle.right = centreX + armSize + 1; centreX + armSize + 1,
rcCircle.bottom = centreY + armSize + 1; centreY + armSize + 1);
surface->Ellipse(rcCircle, back, fore); surface->Ellipse(rcCircle, back, fore);
} }
static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) {
PRectangle rcV(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1); PRectangle rcV = PRectangle::FromInts(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1);
surface->FillRectangle(rcV, fore); surface->FillRectangle(rcV, fore);
PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1); PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1);
surface->FillRectangle(rcH, fore); surface->FillRectangle(rcH, fore);
} }
static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) {
PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1); PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1);
surface->FillRectangle(rcH, fore); surface->FillRectangle(rcH, fore);
} }
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) { void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const {
ColourDesired head = back; if (customDraw != NULL) {
ColourDesired body = back; customDraw(surface, rcWhole, fontForCharacter, tFold, marginStyle, this);
ColourDesired tail = back; return;
}
ColourDesired colourHead = back;
ColourDesired colourBody = back;
ColourDesired colourTail = back;
switch (tFold) { switch (tFold) {
case LineMarker::head : case LineMarker::head :
case LineMarker::headWithTail : case LineMarker::headWithTail :
head = backSelected; colourHead = backSelected;
tail = backSelected; colourTail = backSelected;
break; break;
case LineMarker::body : case LineMarker::body :
head = backSelected; colourHead = backSelected;
body = backSelected; colourBody = backSelected;
break; break;
case LineMarker::tail : case LineMarker::tail :
body = backSelected; colourBody = backSelected;
tail = backSelected; colourTail = backSelected;
break; break;
default : default :
// LineMarker::undefined // LineMarker::undefined
@@ -102,9 +107,9 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
if ((markType == SC_MARK_RGBAIMAGE) && (image)) { if ((markType == SC_MARK_RGBAIMAGE) && (image)) {
// Make rectangle just large enough to fit image centred on centre of rcWhole // Make rectangle just large enough to fit image centred on centre of rcWhole
PRectangle rcImage; PRectangle rcImage;
rcImage.top = static_cast<int>(((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2); rcImage.top = ((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2;
rcImage.bottom = rcImage.top + image->GetScaledHeight(); rcImage.bottom = rcImage.top + image->GetScaledHeight();
rcImage.left = static_cast<int>(((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2); rcImage.left = ((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2;
rcImage.right = rcImage.left + image->GetScaledWidth(); rcImage.right = rcImage.left + image->GetScaledWidth();
surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels()); surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels());
return; return;
@@ -113,17 +118,17 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
PRectangle rc = rcWhole; PRectangle rc = rcWhole;
rc.top++; rc.top++;
rc.bottom--; rc.bottom--;
int minDim = Platform::Minimum(rc.Width(), rc.Height()); int minDim = Platform::Minimum(static_cast<int>(rc.Width()), static_cast<int>(rc.Height()));
minDim--; // Ensure does not go beyond edge minDim--; // Ensure does not go beyond edge
int centreX = floor((rc.right + rc.left) / 2.0); int centreX = static_cast<int>(floor((rc.right + rc.left) / 2.0));
int centreY = floor((rc.bottom + rc.top) / 2.0); int centreY = static_cast<int>(floor((rc.bottom + rc.top) / 2.0));
int dimOn2 = minDim / 2; int dimOn2 = minDim / 2;
int dimOn4 = minDim / 4; int dimOn4 = minDim / 4;
int blobSize = dimOn2-1; int blobSize = dimOn2-1;
int armSize = dimOn2-2; int armSize = dimOn2-2;
if (marginStyle == SC_MARGIN_NUMBER || marginStyle == SC_MARGIN_TEXT || marginStyle == SC_MARGIN_RTEXT) { if (marginStyle == SC_MARGIN_NUMBER || marginStyle == SC_MARGIN_TEXT || marginStyle == SC_MARGIN_RTEXT) {
// On textual margins move marker to the left to try to avoid overlapping the text // On textual margins move marker to the left to try to avoid overlapping the text
centreX = rc.left + dimOn2 + 1; centreX = static_cast<int>(rc.left) + dimOn2 + 1;
} }
if (markType == SC_MARK_ROUNDRECT) { if (markType == SC_MARK_ROUNDRECT) {
PRectangle rcRounded = rc; PRectangle rcRounded = rc;
@@ -131,51 +136,51 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
rcRounded.right = rc.right - 1; rcRounded.right = rc.right - 1;
surface->RoundedRectangle(rcRounded, fore, back); surface->RoundedRectangle(rcRounded, fore, back);
} else if (markType == SC_MARK_CIRCLE) { } else if (markType == SC_MARK_CIRCLE) {
PRectangle rcCircle; PRectangle rcCircle = PRectangle::FromInts(
rcCircle.left = centreX - dimOn2; centreX - dimOn2,
rcCircle.top = centreY - dimOn2; centreY - dimOn2,
rcCircle.right = centreX + dimOn2; centreX + dimOn2,
rcCircle.bottom = centreY + dimOn2; centreY + dimOn2);
surface->Ellipse(rcCircle, fore, back); surface->Ellipse(rcCircle, fore, back);
} else if (markType == SC_MARK_ARROW) { } else if (markType == SC_MARK_ARROW) {
Point pts[] = { Point pts[] = {
Point(centreX - dimOn4, centreY - dimOn2), Point::FromInts(centreX - dimOn4, centreY - dimOn2),
Point(centreX - dimOn4, centreY + dimOn2), Point::FromInts(centreX - dimOn4, centreY + dimOn2),
Point(centreX + dimOn2 - dimOn4, centreY), Point::FromInts(centreX + dimOn2 - dimOn4, centreY),
}; };
surface->Polygon(pts, ELEMENTS(pts), fore, back); surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else if (markType == SC_MARK_ARROWDOWN) { } else if (markType == SC_MARK_ARROWDOWN) {
Point pts[] = { Point pts[] = {
Point(centreX - dimOn2, centreY - dimOn4), Point::FromInts(centreX - dimOn2, centreY - dimOn4),
Point(centreX + dimOn2, centreY - dimOn4), Point::FromInts(centreX + dimOn2, centreY - dimOn4),
Point(centreX, centreY + dimOn2 - dimOn4), Point::FromInts(centreX, centreY + dimOn2 - dimOn4),
}; };
surface->Polygon(pts, ELEMENTS(pts), fore, back); surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else if (markType == SC_MARK_PLUS) { } else if (markType == SC_MARK_PLUS) {
Point pts[] = { Point pts[] = {
Point(centreX - armSize, centreY - 1), Point::FromInts(centreX - armSize, centreY - 1),
Point(centreX - 1, centreY - 1), Point::FromInts(centreX - 1, centreY - 1),
Point(centreX - 1, centreY - armSize), Point::FromInts(centreX - 1, centreY - armSize),
Point(centreX + 1, centreY - armSize), Point::FromInts(centreX + 1, centreY - armSize),
Point(centreX + 1, centreY - 1), Point::FromInts(centreX + 1, centreY - 1),
Point(centreX + armSize, centreY -1), Point::FromInts(centreX + armSize, centreY -1),
Point(centreX + armSize, centreY +1), Point::FromInts(centreX + armSize, centreY +1),
Point(centreX + 1, centreY + 1), Point::FromInts(centreX + 1, centreY + 1),
Point(centreX + 1, centreY + armSize), Point::FromInts(centreX + 1, centreY + armSize),
Point(centreX - 1, centreY + armSize), Point::FromInts(centreX - 1, centreY + armSize),
Point(centreX - 1, centreY + 1), Point::FromInts(centreX - 1, centreY + 1),
Point(centreX - armSize, centreY + 1), Point::FromInts(centreX - armSize, centreY + 1),
}; };
surface->Polygon(pts, ELEMENTS(pts), fore, back); surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else if (markType == SC_MARK_MINUS) { } else if (markType == SC_MARK_MINUS) {
Point pts[] = { Point pts[] = {
Point(centreX - armSize, centreY - 1), Point::FromInts(centreX - armSize, centreY - 1),
Point(centreX + armSize, centreY -1), Point::FromInts(centreX + armSize, centreY -1),
Point(centreX + armSize, centreY +1), Point::FromInts(centreX + armSize, centreY +1),
Point(centreX - armSize, centreY + 1), Point::FromInts(centreX - armSize, centreY + 1),
}; };
surface->Polygon(pts, ELEMENTS(pts), fore, back); surface->Polygon(pts, ELEMENTS(pts), fore, back);
@@ -192,69 +197,69 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
// An invisible marker so don't draw anything // An invisible marker so don't draw anything
} else if (markType == SC_MARK_VLINE) { } else if (markType == SC_MARK_VLINE) {
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
} else if (markType == SC_MARK_LCORNER) { } else if (markType == SC_MARK_LCORNER) {
surface->PenColour(tail); surface->PenColour(colourTail);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY); surface->LineTo(centreX, centreY);
surface->LineTo(rc.right - 1, centreY); surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
} else if (markType == SC_MARK_TCORNER) { } else if (markType == SC_MARK_TCORNER) {
surface->PenColour(tail); surface->PenColour(colourTail);
surface->MoveTo(centreX, centreY); surface->MoveTo(centreX, centreY);
surface->LineTo(rc.right - 1, centreY); surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY + 1); surface->LineTo(centreX, centreY + 1);
surface->PenColour(head); surface->PenColour(colourHead);
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
} else if (markType == SC_MARK_LCORNERCURVE) { } else if (markType == SC_MARK_LCORNERCURVE) {
surface->PenColour(tail); surface->PenColour(colourTail);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY-3); surface->LineTo(centreX, centreY-3);
surface->LineTo(centreX+3, centreY); surface->LineTo(centreX+3, centreY);
surface->LineTo(rc.right - 1, centreY); surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
} else if (markType == SC_MARK_TCORNERCURVE) { } else if (markType == SC_MARK_TCORNERCURVE) {
surface->PenColour(tail); surface->PenColour(colourTail);
surface->MoveTo(centreX, centreY-3); surface->MoveTo(centreX, centreY-3);
surface->LineTo(centreX+3, centreY); surface->LineTo(centreX+3, centreY);
surface->LineTo(rc.right - 1, centreY); surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY-2); surface->LineTo(centreX, centreY-2);
surface->PenColour(head); surface->PenColour(colourHead);
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
} else if (markType == SC_MARK_BOXPLUS) { } else if (markType == SC_MARK_BOXPLUS) {
DrawBox(surface, centreX, centreY, blobSize, fore, head); DrawBox(surface, centreX, centreY, blobSize, fore, colourHead);
DrawPlus(surface, centreX, centreY, blobSize, tail); DrawPlus(surface, centreX, centreY, blobSize, colourTail);
} else if (markType == SC_MARK_BOXPLUSCONNECTED) { } else if (markType == SC_MARK_BOXPLUSCONNECTED) {
if (tFold == LineMarker::headWithTail) if (tFold == LineMarker::headWithTail)
surface->PenColour(tail); surface->PenColour(colourTail);
else else
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, centreY + blobSize); surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY - blobSize); surface->LineTo(centreX, centreY - blobSize);
DrawBox(surface, centreX, centreY, blobSize, fore, head); DrawBox(surface, centreX, centreY, blobSize, fore, colourHead);
DrawPlus(surface, centreX, centreY, blobSize, tail); DrawPlus(surface, centreX, centreY, blobSize, colourTail);
if (tFold == LineMarker::body) { if (tFold == LineMarker::body) {
surface->PenColour(tail); surface->PenColour(colourTail);
surface->MoveTo(centreX + 1, centreY + blobSize); surface->MoveTo(centreX + 1, centreY + blobSize);
surface->LineTo(centreX + blobSize + 1, centreY + blobSize); surface->LineTo(centreX + blobSize + 1, centreY + blobSize);
@@ -265,27 +270,27 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
surface->LineTo(centreX + blobSize + 1, centreY - blobSize); surface->LineTo(centreX + blobSize + 1, centreY - blobSize);
} }
} else if (markType == SC_MARK_BOXMINUS) { } else if (markType == SC_MARK_BOXMINUS) {
DrawBox(surface, centreX, centreY, blobSize, fore, head); DrawBox(surface, centreX, centreY, blobSize, fore, colourHead);
DrawMinus(surface, centreX, centreY, blobSize, tail); DrawMinus(surface, centreX, centreY, blobSize, colourTail);
surface->PenColour(head); surface->PenColour(colourHead);
surface->MoveTo(centreX, centreY + blobSize); surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
} else if (markType == SC_MARK_BOXMINUSCONNECTED) { } else if (markType == SC_MARK_BOXMINUSCONNECTED) {
DrawBox(surface, centreX, centreY, blobSize, fore, head); DrawBox(surface, centreX, centreY, blobSize, fore, colourHead);
DrawMinus(surface, centreX, centreY, blobSize, tail); DrawMinus(surface, centreX, centreY, blobSize, colourTail);
surface->PenColour(head); surface->PenColour(colourHead);
surface->MoveTo(centreX, centreY + blobSize); surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY - blobSize); surface->LineTo(centreX, centreY - blobSize);
if (tFold == LineMarker::body) { if (tFold == LineMarker::body) {
surface->PenColour(tail); surface->PenColour(colourTail);
surface->MoveTo(centreX + 1, centreY + blobSize); surface->MoveTo(centreX + 1, centreY + blobSize);
surface->LineTo(centreX + blobSize + 1, centreY + blobSize); surface->LineTo(centreX + blobSize + 1, centreY + blobSize);
@@ -296,43 +301,43 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
surface->LineTo(centreX + blobSize + 1, centreY - blobSize); surface->LineTo(centreX + blobSize + 1, centreY - blobSize);
} }
} else if (markType == SC_MARK_CIRCLEPLUS) { } else if (markType == SC_MARK_CIRCLEPLUS) {
DrawCircle(surface, centreX, centreY, blobSize, fore, head); DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead);
DrawPlus(surface, centreX, centreY, blobSize, tail); DrawPlus(surface, centreX, centreY, blobSize, colourTail);
} else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) { } else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) {
if (tFold == LineMarker::headWithTail) if (tFold == LineMarker::headWithTail)
surface->PenColour(tail); surface->PenColour(colourTail);
else else
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, centreY + blobSize); surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY - blobSize); surface->LineTo(centreX, centreY - blobSize);
DrawCircle(surface, centreX, centreY, blobSize, fore, head); DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead);
DrawPlus(surface, centreX, centreY, blobSize, tail); DrawPlus(surface, centreX, centreY, blobSize, colourTail);
} else if (markType == SC_MARK_CIRCLEMINUS) { } else if (markType == SC_MARK_CIRCLEMINUS) {
surface->PenColour(head); surface->PenColour(colourHead);
surface->MoveTo(centreX, centreY + blobSize); surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
DrawCircle(surface, centreX, centreY, blobSize, fore, head); DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead);
DrawMinus(surface, centreX, centreY, blobSize, tail); DrawMinus(surface, centreX, centreY, blobSize, colourTail);
} else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) { } else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) {
surface->PenColour(head); surface->PenColour(colourHead);
surface->MoveTo(centreX, centreY + blobSize); surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom); surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
surface->PenColour(body); surface->PenColour(colourBody);
surface->MoveTo(centreX, rcWhole.top); surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY - blobSize); surface->LineTo(centreX, centreY - blobSize);
DrawCircle(surface, centreX, centreY, blobSize, fore, head); DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead);
DrawMinus(surface, centreX, centreY, blobSize, tail); DrawMinus(surface, centreX, centreY, blobSize, colourTail);
} else if (markType >= SC_MARK_CHARACTER) { } else if (markType >= SC_MARK_CHARACTER) {
char character[1]; char character[1];
@@ -344,11 +349,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
character, 1, fore, back); character, 1, fore, back);
} else if (markType == SC_MARK_DOTDOTDOT) { } else if (markType == SC_MARK_DOTDOTDOT) {
int right = centreX - 6; XYPOSITION right = static_cast<XYPOSITION>(centreX - 6);
for (int b=0; b<3; b++) { for (int b=0; b<3; b++) {
PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2); PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2);
surface->FillRectangle(rcBlob, fore); surface->FillRectangle(rcBlob, fore);
right += 5; right += 5.0f;
} }
} else if (markType == SC_MARK_ARROWS) { } else if (markType == SC_MARK_ARROWS) {
surface->PenColour(fore); surface->PenColour(fore);
@@ -363,14 +368,14 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
} }
} else if (markType == SC_MARK_SHORTARROW) { } else if (markType == SC_MARK_SHORTARROW) {
Point pts[] = { Point pts[] = {
Point(centreX, centreY + dimOn2), Point::FromInts(centreX, centreY + dimOn2),
Point(centreX + dimOn2, centreY), Point::FromInts(centreX + dimOn2, centreY),
Point(centreX, centreY - dimOn2), Point::FromInts(centreX, centreY - dimOn2),
Point(centreX, centreY - dimOn4), Point::FromInts(centreX, centreY - dimOn4),
Point(centreX - dimOn4, centreY - dimOn4), Point::FromInts(centreX - dimOn4, centreY - dimOn4),
Point(centreX - dimOn4, centreY + dimOn4), Point::FromInts(centreX - dimOn4, centreY + dimOn4),
Point(centreX, centreY + dimOn4), Point::FromInts(centreX, centreY + dimOn4),
Point(centreX, centreY + dimOn2), Point::FromInts(centreX, centreY + dimOn2),
}; };
surface->Polygon(pts, ELEMENTS(pts), fore, back); surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else if (markType == SC_MARK_LEFTRECT) { } else if (markType == SC_MARK_LEFTRECT) {
@@ -380,11 +385,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
} else if (markType == SC_MARK_BOOKMARK) { } else if (markType == SC_MARK_BOOKMARK) {
int halfHeight = minDim / 3; int halfHeight = minDim / 3;
Point pts[] = { Point pts[] = {
Point(rc.left, centreY-halfHeight), Point::FromInts(static_cast<int>(rc.left), centreY-halfHeight),
Point(rc.right-3, centreY-halfHeight), Point::FromInts(static_cast<int>(rc.right) - 3, centreY - halfHeight),
Point(rc.right-3-halfHeight, centreY), Point::FromInts(static_cast<int>(rc.right) - 3 - halfHeight, centreY),
Point(rc.right-3, centreY+halfHeight), Point::FromInts(static_cast<int>(rc.right) - 3, centreY + halfHeight),
Point(rc.left, centreY+halfHeight), Point::FromInts(static_cast<int>(rc.left), centreY + halfHeight),
}; };
surface->Polygon(pts, ELEMENTS(pts), fore, back); surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else { // SC_MARK_FULLRECT } else { // SC_MARK_FULLRECT

View File

@@ -12,6 +12,8 @@
namespace Scintilla { namespace Scintilla {
#endif #endif
typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker);
/** /**
*/ */
class LineMarker { class LineMarker {
@@ -25,6 +27,11 @@ public:
int alpha; int alpha;
XPM *pxpm; XPM *pxpm;
RGBAImage *image; RGBAImage *image;
/** Some platforms, notably PLAT_CURSES, do not support Scintilla's native
* Draw function for drawing line markers. Allow those platforms to override
* it instead of creating a new method(s) in the Surface class that existing
* platforms must implement as empty. */
DrawLineMarkerFn customDraw;
LineMarker() { LineMarker() {
markType = SC_MARK_CIRCLE; markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0); fore = ColourDesired(0,0,0);
@@ -33,6 +40,7 @@ public:
alpha = SC_ALPHA_NOALPHA; alpha = SC_ALPHA_NOALPHA;
pxpm = NULL; pxpm = NULL;
image = NULL; image = NULL;
customDraw = NULL;
} }
LineMarker(const LineMarker &) { LineMarker(const LineMarker &) {
// Defined to avoid pxpm being blindly copied, not as a complete copy constructor // Defined to avoid pxpm being blindly copied, not as a complete copy constructor
@@ -43,6 +51,7 @@ public:
alpha = SC_ALPHA_NOALPHA; alpha = SC_ALPHA_NOALPHA;
pxpm = NULL; pxpm = NULL;
image = NULL; image = NULL;
customDraw = NULL;
} }
~LineMarker() { ~LineMarker() {
delete pxpm; delete pxpm;
@@ -60,13 +69,14 @@ public:
pxpm = NULL; pxpm = NULL;
delete image; delete image;
image = NULL; image = NULL;
customDraw = NULL;
} }
return *this; return *this;
} }
void SetXPM(const char *textForm); void SetXPM(const char *textForm);
void SetXPM(const char *const *linesForm); void SetXPM(const char *const *linesForm);
void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage);
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle); void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const;
}; };
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE

View File

@@ -0,0 +1,470 @@
// Scintilla source code edit control
/** @file MarginView.cxx
** Defines the appearance of the editor margin.
**/
// Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <ctype.h>
#include <stdexcept>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <memory>
#include "Platform.h"
#include "ILexer.h"
#include "Scintilla.h"
#include "StringCopy.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "ContractionState.h"
#include "CellBuffer.h"
#include "KeyMap.h"
#include "Indicator.h"
#include "XPM.h"
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "CaseFolder.h"
#include "Document.h"
#include "UniConversion.h"
#include "Selection.h"
#include "PositionCache.h"
#include "EditModel.h"
#include "MarginView.h"
#include "EditView.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
void DrawWrapMarker(Surface *surface, PRectangle rcPlace,
bool isEndMarker, ColourDesired wrapColour) {
surface->PenColour(wrapColour);
enum { xa = 1 }; // gap before start
int w = static_cast<int>(rcPlace.right - rcPlace.left) - xa - 1;
bool xStraight = isEndMarker; // x-mirrored symbol for start marker
int x0 = static_cast<int>(xStraight ? rcPlace.left : rcPlace.right - 1);
int y0 = static_cast<int>(rcPlace.top);
int dy = static_cast<int>(rcPlace.bottom - rcPlace.top) / 5;
int y = static_cast<int>(rcPlace.bottom - rcPlace.top) / 2 + dy;
struct Relative {
Surface *surface;
int xBase;
int xDir;
int yBase;
int yDir;
void MoveTo(int xRelative, int yRelative) {
surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative);
}
void LineTo(int xRelative, int yRelative) {
surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative);
}
};
Relative rel = { surface, x0, xStraight ? 1 : -1, y0, 1 };
// arrow head
rel.MoveTo(xa, y);
rel.LineTo(xa + 2 * w / 3, y - dy);
rel.MoveTo(xa, y);
rel.LineTo(xa + 2 * w / 3, y + dy);
// arrow body
rel.MoveTo(xa, y);
rel.LineTo(xa + w, y);
rel.LineTo(xa + w, y - 2 * dy);
rel.LineTo(xa - 1, // on windows lineto is exclusive endpoint, perhaps GTK not...
y - 2 * dy);
}
MarginView::MarginView() {
pixmapSelMargin = 0;
pixmapSelPattern = 0;
pixmapSelPatternOffset1 = 0;
wrapMarkerPaddingRight = 3;
customDrawWrapMarker = NULL;
}
void MarginView::DropGraphics(bool freeObjects) {
if (freeObjects) {
delete pixmapSelMargin;
pixmapSelMargin = 0;
delete pixmapSelPattern;
pixmapSelPattern = 0;
delete pixmapSelPatternOffset1;
pixmapSelPatternOffset1 = 0;
} else {
if (pixmapSelMargin)
pixmapSelMargin->Release();
if (pixmapSelPattern)
pixmapSelPattern->Release();
if (pixmapSelPatternOffset1)
pixmapSelPatternOffset1->Release();
}
}
void MarginView::AllocateGraphics(const ViewStyle &vsDraw) {
if (!pixmapSelMargin)
pixmapSelMargin = Surface::Allocate(vsDraw.technology);
if (!pixmapSelPattern)
pixmapSelPattern = Surface::Allocate(vsDraw.technology);
if (!pixmapSelPatternOffset1)
pixmapSelPatternOffset1 = Surface::Allocate(vsDraw.technology);
}
void MarginView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) {
if (!pixmapSelPattern->Initialised()) {
const int patternSize = 8;
pixmapSelPattern->InitPixMap(patternSize, patternSize, surfaceWindow, wid);
pixmapSelPatternOffset1->InitPixMap(patternSize, patternSize, surfaceWindow, wid);
// This complex procedure is to reproduce the checkerboard dithered pattern used by windows
// for scroll bars and Visual Studio for its selection margin. The colour of this pattern is half
// way between the chrome colour and the chrome highlight colour making a nice transition
// between the window chrome and the content area. And it works in low colour depths.
PRectangle rcPattern = PRectangle::FromInts(0, 0, patternSize, patternSize);
// Initialize default colours based on the chrome colour scheme. Typically the highlight is white.
ColourDesired colourFMFill = vsDraw.selbar;
ColourDesired colourFMStripes = vsDraw.selbarlight;
if (!(vsDraw.selbarlight == ColourDesired(0xff, 0xff, 0xff))) {
// User has chosen an unusual chrome colour scheme so just use the highlight edge colour.
// (Typically, the highlight colour is white.)
colourFMFill = vsDraw.selbarlight;
}
if (vsDraw.foldmarginColour.isSet) {
// override default fold margin colour
colourFMFill = vsDraw.foldmarginColour;
}
if (vsDraw.foldmarginHighlightColour.isSet) {
// override default fold margin highlight colour
colourFMStripes = vsDraw.foldmarginHighlightColour;
}
pixmapSelPattern->FillRectangle(rcPattern, colourFMFill);
pixmapSelPatternOffset1->FillRectangle(rcPattern, colourFMStripes);
for (int y = 0; y < patternSize; y++) {
for (int x = y % 2; x < patternSize; x += 2) {
PRectangle rcPixel = PRectangle::FromInts(x, y, x + 1, y + 1);
pixmapSelPattern->FillRectangle(rcPixel, colourFMStripes);
pixmapSelPatternOffset1->FillRectangle(rcPixel, colourFMFill);
}
}
}
}
static int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault, const ViewStyle &vs) {
if (vs.markers[markerCheck].markType == SC_MARK_EMPTY)
return markerDefault;
return markerCheck;
}
void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin,
const EditModel &model, const ViewStyle &vs) {
PRectangle rcSelMargin = rcMargin;
rcSelMargin.right = rcMargin.left;
if (rcSelMargin.bottom < rc.bottom)
rcSelMargin.bottom = rc.bottom;
Point ptOrigin = model.GetVisibleOriginInMain();
FontAlias fontLineNumber = vs.styles[STYLE_LINENUMBER].font;
for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) {
if (vs.ms[margin].width > 0) {
rcSelMargin.left = rcSelMargin.right;
rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width;
if (vs.ms[margin].style != SC_MARGIN_NUMBER) {
if (vs.ms[margin].mask & SC_MASK_FOLDERS) {
// Required because of special way brush is created for selection margin
// Ensure patterns line up when scrolling with separate margin view
// by choosing correctly aligned variant.
bool invertPhase = static_cast<int>(ptOrigin.y) & 1;
surface->FillRectangle(rcSelMargin,
invertPhase ? *pixmapSelPattern : *pixmapSelPatternOffset1);
} else {
ColourDesired colour;
switch (vs.ms[margin].style) {
case SC_MARGIN_BACK:
colour = vs.styles[STYLE_DEFAULT].back;
break;
case SC_MARGIN_FORE:
colour = vs.styles[STYLE_DEFAULT].fore;
break;
default:
colour = vs.styles[STYLE_LINENUMBER].back;
break;
}
surface->FillRectangle(rcSelMargin, colour);
}
} else {
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back);
}
const int lineStartPaint = static_cast<int>(rcMargin.top + ptOrigin.y) / vs.lineHeight;
int visibleLine = model.TopLineOfMain() + lineStartPaint;
int yposScreen = lineStartPaint * vs.lineHeight - static_cast<int>(ptOrigin.y);
// Work out whether the top line is whitespace located after a
// lessening of fold level which implies a 'fold tail' but which should not
// be displayed until the last of a sequence of whitespace.
bool needWhiteClosure = false;
if (vs.ms[margin].mask & SC_MASK_FOLDERS) {
int level = model.pdoc->GetLevel(model.cs.DocFromDisplay(visibleLine));
if (level & SC_FOLDLEVELWHITEFLAG) {
int lineBack = model.cs.DocFromDisplay(visibleLine);
int levelPrev = level;
while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) {
lineBack--;
levelPrev = model.pdoc->GetLevel(lineBack);
}
if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) {
if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK))
needWhiteClosure = true;
}
}
if (highlightDelimiter.isEnabled) {
int lastLine = model.cs.DocFromDisplay(topLine + model.LinesOnScreen()) + 1;
model.pdoc->GetHighlightDelimiters(highlightDelimiter, model.pdoc->LineFromPosition(model.sel.MainCaret()), lastLine);
}
}
// Old code does not know about new markers needed to distinguish all cases
const int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID,
SC_MARKNUM_FOLDEROPEN, vs);
const int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND,
SC_MARKNUM_FOLDER, vs);
while ((visibleLine < model.cs.LinesDisplayed()) && yposScreen < rc.bottom) {
PLATFORM_ASSERT(visibleLine < model.cs.LinesDisplayed());
const int lineDoc = model.cs.DocFromDisplay(visibleLine);
PLATFORM_ASSERT(model.cs.GetVisible(lineDoc));
const int firstVisibleLine = model.cs.DisplayFromDoc(lineDoc);
const int lastVisibleLine = model.cs.DisplayLastFromDoc(lineDoc);
const bool firstSubLine = visibleLine == firstVisibleLine;
const bool lastSubLine = visibleLine == lastVisibleLine;
int marks = model.pdoc->GetMark(lineDoc);
if (!firstSubLine)
marks = 0;
bool headWithTail = false;
if (vs.ms[margin].mask & SC_MASK_FOLDERS) {
// Decide which fold indicator should be displayed
const int level = model.pdoc->GetLevel(lineDoc);
const int levelNext = model.pdoc->GetLevel(lineDoc + 1);
const int levelNum = level & SC_FOLDLEVELNUMBERMASK;
const int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK;
if (level & SC_FOLDLEVELHEADERFLAG) {
if (firstSubLine) {
if (levelNum < levelNextNum) {
if (model.cs.GetExpanded(lineDoc)) {
if (levelNum == SC_FOLDLEVELBASE)
marks |= 1 << SC_MARKNUM_FOLDEROPEN;
else
marks |= 1 << folderOpenMid;
} else {
if (levelNum == SC_FOLDLEVELBASE)
marks |= 1 << SC_MARKNUM_FOLDER;
else
marks |= 1 << folderEnd;
}
} else if (levelNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
} else {
if (levelNum < levelNextNum) {
if (model.cs.GetExpanded(lineDoc)) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
} else if (levelNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
} else if (levelNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
}
needWhiteClosure = false;
const int firstFollowupLine = model.cs.DocFromDisplay(model.cs.DisplayFromDoc(lineDoc + 1));
const int firstFollowupLineLevel = model.pdoc->GetLevel(firstFollowupLine);
const int secondFollowupLineLevelNum = model.pdoc->GetLevel(firstFollowupLine + 1) & SC_FOLDLEVELNUMBERMASK;
if (!model.cs.GetExpanded(lineDoc)) {
if ((firstFollowupLineLevel & SC_FOLDLEVELWHITEFLAG) &&
(levelNum > secondFollowupLineLevelNum))
needWhiteClosure = true;
if (highlightDelimiter.IsFoldBlockHighlighted(firstFollowupLine))
headWithTail = true;
}
} else if (level & SC_FOLDLEVELWHITEFLAG) {
if (needWhiteClosure) {
if (levelNext & SC_FOLDLEVELWHITEFLAG) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
} else if (levelNextNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
needWhiteClosure = false;
} else {
marks |= 1 << SC_MARKNUM_FOLDERTAIL;
needWhiteClosure = false;
}
} else if (levelNum > SC_FOLDLEVELBASE) {
if (levelNextNum < levelNum) {
if (levelNextNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
} else {
marks |= 1 << SC_MARKNUM_FOLDERTAIL;
}
} else {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
}
} else if (levelNum > SC_FOLDLEVELBASE) {
if (levelNextNum < levelNum) {
needWhiteClosure = false;
if (levelNext & SC_FOLDLEVELWHITEFLAG) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
needWhiteClosure = true;
} else if (lastSubLine) {
if (levelNextNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
} else {
marks |= 1 << SC_MARKNUM_FOLDERTAIL;
}
} else {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
} else {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
}
}
marks &= vs.ms[margin].mask;
PRectangle rcMarker = rcSelMargin;
rcMarker.top = static_cast<XYPOSITION>(yposScreen);
rcMarker.bottom = static_cast<XYPOSITION>(yposScreen + vs.lineHeight);
if (vs.ms[margin].style == SC_MARGIN_NUMBER) {
if (firstSubLine) {
char number[100] = "";
if (lineDoc >= 0)
sprintf(number, "%d", lineDoc + 1);
if (model.foldFlags & (SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE)) {
if (model.foldFlags & SC_FOLDFLAG_LEVELNUMBERS) {
int lev = model.pdoc->GetLevel(lineDoc);
sprintf(number, "%c%c %03X %03X",
(lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_',
(lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_',
lev & SC_FOLDLEVELNUMBERMASK,
lev >> 16
);
} else {
int state = model.pdoc->GetLineState(lineDoc);
sprintf(number, "%0X", state);
}
}
PRectangle rcNumber = rcMarker;
// Right justify
XYPOSITION width = surface->WidthText(fontLineNumber, number, static_cast<int>(strlen(number)));
XYPOSITION xpos = rcNumber.right - width - vs.marginNumberPadding;
rcNumber.left = xpos;
DrawTextNoClipPhase(surface, rcNumber, vs.styles[STYLE_LINENUMBER],
rcNumber.top + vs.maxAscent, number, static_cast<int>(strlen(number)), drawAll);
} else if (vs.wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) {
PRectangle rcWrapMarker = rcMarker;
rcWrapMarker.right -= wrapMarkerPaddingRight;
rcWrapMarker.left = rcWrapMarker.right - vs.styles[STYLE_LINENUMBER].aveCharWidth;
if (customDrawWrapMarker == NULL) {
DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore);
} else {
customDrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore);
}
}
} else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) {
const StyledText stMargin = model.pdoc->MarginStyledText(lineDoc);
if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) {
if (firstSubLine) {
surface->FillRectangle(rcMarker,
vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back);
if (vs.ms[margin].style == SC_MARGIN_RTEXT) {
int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin);
rcMarker.left = rcMarker.right - width - 3;
}
DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker,
stMargin, 0, stMargin.length, drawAll);
} else {
// if we're displaying annotation lines, color the margin to match the associated document line
const int annotationLines = model.pdoc->AnnotationLines(lineDoc);
if (annotationLines && (visibleLine > lastVisibleLine - annotationLines)) {
surface->FillRectangle(rcMarker, vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back);
}
}
}
}
if (marks) {
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if (marks & 1) {
LineMarker::typeOfFold tFold = LineMarker::undefined;
if ((vs.ms[margin].mask & SC_MASK_FOLDERS) && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) {
if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) {
tFold = LineMarker::body;
} else if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) {
if (firstSubLine) {
tFold = headWithTail ? LineMarker::headWithTail : LineMarker::head;
} else {
if (model.cs.GetExpanded(lineDoc) || headWithTail) {
tFold = LineMarker::body;
} else {
tFold = LineMarker::undefined;
}
}
} else if (highlightDelimiter.IsTailOfFoldBlock(lineDoc)) {
tFold = LineMarker::tail;
}
}
vs.markers[markBit].Draw(surface, rcMarker, fontLineNumber, tFold, vs.ms[margin].style);
}
marks >>= 1;
}
}
visibleLine++;
yposScreen += vs.lineHeight;
}
}
}
PRectangle rcBlankMargin = rcMargin;
rcBlankMargin.left = rcSelMargin.right;
surface->FillRectangle(rcBlankMargin, vs.styles[STYLE_DEFAULT].back);
}
#ifdef SCI_NAMESPACE
}
#endif

View File

@@ -0,0 +1,50 @@
// Scintilla source code edit control
/** @file MarginView.h
** Defines the appearance of the editor margin.
**/
// Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef MARGINVIEW_H
#define MARGINVIEW_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);
typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);
/**
* MarginView draws the margins.
*/
class MarginView {
public:
Surface *pixmapSelMargin;
Surface *pixmapSelPattern;
Surface *pixmapSelPatternOffset1;
// Highlight current folding block
HighlightDelimiter highlightDelimiter;
int wrapMarkerPaddingRight; // right-most pixel padding of wrap markers
/** Some platforms, notably PLAT_CURSES, do not support Scintilla's native
* DrawWrapMarker function for drawing wrap markers. Allow those platforms to
* override it instead of creating a new method in the Surface class that
* existing platforms must implement as empty. */
DrawWrapMarkerFn customDrawWrapMarker;
MarginView();
void DropGraphics(bool freeObjects);
void AllocateGraphics(const ViewStyle &vsDraw);
void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw);
void PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin,
const EditModel &model, const ViewStyle &vs);
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@@ -7,6 +7,7 @@
#include <string.h> #include <string.h>
#include <vector>
#include <algorithm> #include <algorithm>
#include "Platform.h" #include "Platform.h"
@@ -484,3 +485,72 @@ int LineAnnotation::Lines(int line) const {
else else
return 0; return 0;
} }
LineTabstops::~LineTabstops() {
Init();
}
void LineTabstops::Init() {
for (int line = 0; line < tabstops.Length(); line++) {
delete tabstops[line];
}
tabstops.DeleteAll();
}
void LineTabstops::InsertLine(int line) {
if (tabstops.Length()) {
tabstops.EnsureLength(line);
tabstops.Insert(line, 0);
}
}
void LineTabstops::RemoveLine(int line) {
if (tabstops.Length() > line) {
delete tabstops[line];
tabstops.Delete(line);
}
}
bool LineTabstops::ClearTabstops(int line) {
if (line < tabstops.Length()) {
TabstopList *tl = tabstops[line];
if (tl) {
tl->clear();
return true;
}
}
return false;
}
bool LineTabstops::AddTabstop(int line, int x) {
tabstops.EnsureLength(line + 1);
if (!tabstops[line]) {
tabstops[line] = new TabstopList();
}
TabstopList *tl = tabstops[line];
if (tl) {
// tabstop positions are kept in order - insert in the right place
std::vector<int>::iterator it = std::lower_bound(tl->begin(), tl->end(), x);
// don't insert duplicates
if (it == tl->end() || *it != x) {
tl->insert(it, x);
return true;
}
}
return false;
}
int LineTabstops::GetNextTabstop(int line, int x) const {
if (line < tabstops.Length()) {
TabstopList *tl = tabstops[line];
if (tl) {
for (size_t i = 0; i < tl->size(); i++) {
if ((*tl)[i] > x) {
return (*tl)[i];
}
}
}
}
return 0;
}

View File

@@ -112,6 +112,23 @@ public:
int Lines(int line) const; int Lines(int line) const;
}; };
typedef std::vector<int> TabstopList;
class LineTabstops : public PerLine {
SplitVector<TabstopList *> tabstops;
public:
LineTabstops() {
}
virtual ~LineTabstops();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
bool ClearTabstops(int line);
bool AddTabstop(int line, int x);
int GetNextTabstop(int line, int x) const;
};
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
} }
#endif #endif

View File

@@ -10,6 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stdexcept>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map> #include <map>
@@ -17,6 +18,7 @@
#include "Platform.h" #include "Platform.h"
#include "ILexer.h"
#include "Scintilla.h" #include "Scintilla.h"
#include "SplitVector.h" #include "SplitVector.h"
@@ -32,7 +34,6 @@
#include "ViewStyle.h" #include "ViewStyle.h"
#include "CharClassify.h" #include "CharClassify.h"
#include "Decoration.h" #include "Decoration.h"
#include "ILexer.h"
#include "CaseFolder.h" #include "CaseFolder.h"
#include "Document.h" #include "Document.h"
#include "UniConversion.h" #include "UniConversion.h"
@@ -54,16 +55,12 @@ LineLayout::LineLayout(int maxLineLength_) :
validity(llInvalid), validity(llInvalid),
xHighlightGuide(0), xHighlightGuide(0),
highlightColumn(0), highlightColumn(0),
psel(NULL),
containsCaret(false), containsCaret(false),
edgeColumn(0), edgeColumn(0),
chars(0), chars(0),
styles(0), styles(0),
styleBitsSet(0),
indicators(0),
positions(0), positions(0),
hsStart(0), hotspot(0,0),
hsEnd(0),
widthLine(wrapWidthInfinite), widthLine(wrapWidthInfinite),
lines(1), lines(1),
wrapIndent(0) { wrapIndent(0) {
@@ -81,7 +78,6 @@ void LineLayout::Resize(int maxLineLength_) {
Free(); Free();
chars = new char[maxLineLength_ + 1]; chars = new char[maxLineLength_ + 1];
styles = new unsigned char[maxLineLength_ + 1]; styles = new unsigned char[maxLineLength_ + 1];
indicators = new char[maxLineLength_ + 1];
// Extra position allocated as sometimes the Windows // Extra position allocated as sometimes the Windows
// GetTextExtentExPoint API writes an extra element. // GetTextExtentExPoint API writes an extra element.
positions = new XYPOSITION[maxLineLength_ + 1 + 1]; positions = new XYPOSITION[maxLineLength_ + 1 + 1];
@@ -94,8 +90,6 @@ void LineLayout::Free() {
chars = 0; chars = 0;
delete []styles; delete []styles;
styles = 0; styles = 0;
delete []indicators;
indicators = 0;
delete []positions; delete []positions;
positions = 0; positions = 0;
delete []lineStarts; delete []lineStarts;
@@ -153,7 +147,7 @@ void LineLayout::SetLineStart(int line, int start) {
lineStarts[line] = start; lineStarts[line] = start;
} }
void LineLayout::SetBracesHighlight(Range rangeLine, Position braces[], void LineLayout::SetBracesHighlight(Range rangeLine, const Position braces[],
char bracesMatchStyle, int xHighlight, bool ignoreStyle) { char bracesMatchStyle, int xHighlight, bool ignoreStyle) {
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
int braceOffset = braces[0] - rangeLine.start; int braceOffset = braces[0] - rangeLine.start;
@@ -175,7 +169,7 @@ void LineLayout::SetBracesHighlight(Range rangeLine, Position braces[],
} }
} }
void LineLayout::RestoreBracesHighlight(Range rangeLine, Position braces[], bool ignoreStyle) { void LineLayout::RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle) {
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
int braceOffset = braces[0] - rangeLine.start; int braceOffset = braces[0] - rangeLine.start;
if (braceOffset < numCharsInLine) { if (braceOffset < numCharsInLine) {
@@ -232,7 +226,7 @@ Point LineLayout::PointFromPosition(int posInLine, int lineHeight) const {
for (int subLine = 0; subLine < lines; subLine++) { for (int subLine = 0; subLine < lines; subLine++) {
const Range rangeSubLine = SubLineRange(subLine); const Range rangeSubLine = SubLineRange(subLine);
if (posInLine >= rangeSubLine.start) { if (posInLine >= rangeSubLine.start) {
pt.y = subLine*lineHeight; pt.y = static_cast<XYPOSITION>(subLine*lineHeight);
if (posInLine <= rangeSubLine.end) { if (posInLine <= rangeSubLine.end) {
pt.x = positions[posInLine] - positions[rangeSubLine.start]; pt.x = positions[posInLine] - positions[rangeSubLine.start];
if (rangeSubLine.start != 0) // Wrapped lines may be indented if (rangeSubLine.start != 0) // Wrapped lines may be indented
@@ -410,11 +404,11 @@ void SpecialRepresentations::ClearRepresentation(const char *charBytes) {
} }
} }
Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) { const Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) const {
PLATFORM_ASSERT(len <= 4); PLATFORM_ASSERT(len <= 4);
if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])]) if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])])
return 0; return 0;
MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, len)); MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len));
if (it != mapReprs.end()) { if (it != mapReprs.end()) {
return &(it->second); return &(it->second);
} }
@@ -445,13 +439,12 @@ void BreakFinder::Insert(int val) {
} }
} }
BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, int posLineStart_,
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_) : int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) :
ll(ll_), ll(ll_),
lineStart(lineStart_), lineRange(lineRange_),
lineEnd(lineEnd_),
posLineStart(posLineStart_), posLineStart(posLineStart_),
nextBreak(lineStart_), nextBreak(lineRange_.start),
saeCurrentPos(0), saeCurrentPos(0),
saeNext(0), saeNext(0),
subBreak(-1), subBreak(-1),
@@ -462,18 +455,18 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
// Search for first visible break // Search for first visible break
// First find the first visible character // First find the first visible character
if (xStart > 0.0f) if (xStart > 0.0f)
nextBreak = ll->FindBefore(xStart, lineStart, lineEnd); nextBreak = ll->FindBefore(static_cast<XYPOSITION>(xStart), lineRange.start, lineRange.end);
// Now back to a style break // Now back to a style break
while ((nextBreak > lineStart) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) { while ((nextBreak > lineRange.start) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) {
nextBreak--; nextBreak--;
} }
if (breakForSelection) { if (breakForSelection) {
SelectionPosition posStart(posLineStart); SelectionPosition posStart(posLineStart);
SelectionPosition posEnd(posLineStart + lineEnd); SelectionPosition posEnd(posLineStart + lineRange.end);
SelectionSegment segmentLine(posStart, posEnd); SelectionSegment segmentLine(posStart, posEnd);
for (size_t r=0; r<ll->psel->Count(); r++) { for (size_t r=0; r<psel->Count(); r++) {
SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine); SelectionSegment portion = psel->Range(r).Intersect(segmentLine);
if (!(portion.start == portion.end)) { if (!(portion.start == portion.end)) {
if (portion.start.IsValid()) if (portion.start.IsValid())
Insert(portion.start.Position() - posLineStart); Insert(portion.start.Position() - posLineStart);
@@ -482,9 +475,19 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
} }
} }
} }
if (pvsDraw && pvsDraw->indicatorsSetFore > 0) {
for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) {
if (pvsDraw->indicators[deco->indicator].OverridesTextFore()) {
int startPos = deco->rs.EndRun(posLineStart);
while (startPos < (posLineStart + lineRange.end)) {
Insert(startPos - posLineStart);
startPos = deco->rs.EndRun(startPos);
}
}
}
}
Insert(ll->edgeColumn); Insert(ll->edgeColumn);
Insert(lineEnd); Insert(lineRange.end);
saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1; saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1;
} }
@@ -494,19 +497,19 @@ BreakFinder::~BreakFinder() {
TextSegment BreakFinder::Next() { TextSegment BreakFinder::Next() {
if (subBreak == -1) { if (subBreak == -1) {
int prev = nextBreak; int prev = nextBreak;
while (nextBreak < lineEnd) { while (nextBreak < lineRange.end) {
int charWidth = 1; int charWidth = 1;
if (encodingFamily == efUnicode) if (encodingFamily == efUnicode)
charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineEnd - nextBreak); charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineRange.end - nextBreak);
else if (encodingFamily == efDBCS) else if (encodingFamily == efDBCS)
charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1; charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1;
Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth); const Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth);
if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) || if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) ||
repr || repr ||
(nextBreak == saeNext)) { (nextBreak == saeNext)) {
while ((nextBreak >= saeNext) && (saeNext < lineEnd)) { while ((nextBreak >= saeNext) && (saeNext < lineRange.end)) {
saeCurrentPos++; saeCurrentPos++;
saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineEnd; saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineRange.end;
} }
if ((nextBreak > prev) || repr) { if ((nextBreak > prev) || repr) {
// Have a segment to report // Have a segment to report
@@ -547,7 +550,7 @@ TextSegment BreakFinder::Next() {
} }
bool BreakFinder::More() const { bool BreakFinder::More() const {
return (subBreak >= 0) || (nextBreak < lineEnd); return (subBreak >= 0) || (nextBreak < lineRange.end);
} }
PositionCacheEntry::PositionCacheEntry() : PositionCacheEntry::PositionCacheEntry() :
@@ -563,9 +566,9 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
if (s_ && positions_) { if (s_ && positions_) {
positions = new XYPOSITION[len + (len / 4) + 1]; positions = new XYPOSITION[len + (len / 4) + 1];
for (unsigned int i=0; i<len; i++) { for (unsigned int i=0; i<len; i++) {
positions[i] = static_cast<XYPOSITION>(positions_[i]); positions[i] = positions_[i];
} }
memcpy(reinterpret_cast<char *>(positions + len), s_, len); memcpy(reinterpret_cast<char *>(reinterpret_cast<void *>(positions + len)), s_, len);
} }
} }
@@ -584,7 +587,7 @@ void PositionCacheEntry::Clear() {
bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
unsigned int len_, XYPOSITION *positions_) const { unsigned int len_, XYPOSITION *positions_) const {
if ((styleNumber == styleNumber_) && (len == len_) && if ((styleNumber == styleNumber_) && (len == len_) &&
(memcmp(reinterpret_cast<char *>(positions + len), s_, len)== 0)) { (memcmp(reinterpret_cast<char *>(reinterpret_cast<void *>(positions + len)), s_, len)== 0)) {
for (unsigned int i=0; i<len; i++) { for (unsigned int i=0; i<len; i++) {
positions_[i] = positions[i]; positions_[i] = positions[i];
} }
@@ -594,7 +597,7 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
} }
} }
int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) { unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) {
unsigned int ret = s[0] << 7; unsigned int ret = s[0] << 7;
for (unsigned int i=0; i<len_; i++) { for (unsigned int i=0; i<len_; i++) {
ret *= 1000003; ret *= 1000003;
@@ -642,22 +645,22 @@ void PositionCache::SetSize(size_t size_) {
pces.resize(size_); pces.resize(size_);
} }
void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, void PositionCache::MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber,
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) { const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc) {
allClear = false; allClear = false;
int probe = -1; size_t probe = pces.size(); // Out of bounds
if ((!pces.empty()) && (len < 30)) { if ((!pces.empty()) && (len < 30)) {
// Only store short strings in the cache so it doesn't churn with // Only store short strings in the cache so it doesn't churn with
// long comments with only a single comment. // long comments with only a single comment.
// Two way associative: try two probe positions. // Two way associative: try two probe positions.
int hashValue = PositionCacheEntry::Hash(styleNumber, s, len); unsigned int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
probe = static_cast<int>(hashValue % pces.size()); probe = hashValue % pces.size();
if (pces[probe].Retrieve(styleNumber, s, len, positions)) { if (pces[probe].Retrieve(styleNumber, s, len, positions)) {
return; return;
} }
int probe2 = static_cast<int>((hashValue * 37) % pces.size()); unsigned int probe2 = (hashValue * 37) % pces.size();
if (pces[probe2].Retrieve(styleNumber, s, len, positions)) { if (pces[probe2].Retrieve(styleNumber, s, len, positions)) {
return; return;
} }
@@ -672,7 +675,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
XYPOSITION xStartSegment = 0; XYPOSITION xStartSegment = 0;
while (startSegment < len) { while (startSegment < len) {
unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision); unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision);
surface->MeasureWidths(vstyle.styles[styleNumber].font, s + startSegment, lenSegment, positions + startSegment); FontAlias fontStyle = vstyle.styles[styleNumber].font;
surface->MeasureWidths(fontStyle, s + startSegment, lenSegment, positions + startSegment);
for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) { for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) {
positions[startSegment + inSeg] += xStartSegment; positions[startSegment + inSeg] += xStartSegment;
} }
@@ -680,9 +684,11 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
startSegment += lenSegment; startSegment += lenSegment;
} }
} else { } else {
surface->MeasureWidths(vstyle.styles[styleNumber].font, s, len, positions); FontAlias fontStyle = vstyle.styles[styleNumber].font;
surface->MeasureWidths(fontStyle, s, len, positions);
} }
if (probe >= 0) { if (probe < pces.size()) {
// Store into cache
clock++; clock++;
if (clock > 60000) { if (clock > 60000) {
// Since there are only 16 bits for the clock, wrap it round and // Since there are only 16 bits for the clock, wrap it round and

View File

@@ -34,19 +34,15 @@ public:
enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity; enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
int xHighlightGuide; int xHighlightGuide;
bool highlightColumn; bool highlightColumn;
Selection *psel;
bool containsCaret; bool containsCaret;
int edgeColumn; int edgeColumn;
char *chars; char *chars;
unsigned char *styles; unsigned char *styles;
int styleBitsSet;
char *indicators;
XYPOSITION *positions; XYPOSITION *positions;
char bracePreviousStyles[2]; char bracePreviousStyles[2];
// Hotspot support // Hotspot support
int hsStart; Range hotspot;
int hsEnd;
// Wrapped line support // Wrapped line support
int widthLine; int widthLine;
@@ -63,9 +59,9 @@ public:
Range SubLineRange(int line) const; Range SubLineRange(int line) const;
bool InLine(int offset, int line) const; bool InLine(int offset, int line) const;
void SetLineStart(int line, int start); void SetLineStart(int line, int start);
void SetBracesHighlight(Range rangeLine, Position braces[], void SetBracesHighlight(Range rangeLine, const Position braces[],
char bracesMatchStyle, int xHighlight, bool ignoreStyle); char bracesMatchStyle, int xHighlight, bool ignoreStyle);
void RestoreBracesHighlight(Range rangeLine, Position braces[], bool ignoreStyle); void RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle);
int FindBefore(XYPOSITION x, int lower, int upper) const; int FindBefore(XYPOSITION x, int lower, int upper) const;
int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const; int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const;
Point PointFromPosition(int posInLine, int lineHeight) const; Point PointFromPosition(int posInLine, int lineHeight) const;
@@ -108,10 +104,10 @@ class PositionCacheEntry {
public: public:
PositionCacheEntry(); PositionCacheEntry();
~PositionCacheEntry(); ~PositionCacheEntry();
void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock); void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_);
void Clear(); void Clear();
bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const; bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const;
static int Hash(unsigned int styleNumber_, const char *s, unsigned int len); static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len);
bool NewerThan(const PositionCacheEntry &other) const; bool NewerThan(const PositionCacheEntry &other) const;
void ResetClock(); void ResetClock();
}; };
@@ -132,7 +128,7 @@ public:
SpecialRepresentations(); SpecialRepresentations();
void SetRepresentation(const char *charBytes, const char *value); void SetRepresentation(const char *charBytes, const char *value);
void ClearRepresentation(const char *charBytes); void ClearRepresentation(const char *charBytes);
Representation *RepresentationFromCharacter(const char *charBytes, size_t len); const Representation *RepresentationFromCharacter(const char *charBytes, size_t len) const;
bool Contains(const char *charBytes, size_t len) const; bool Contains(const char *charBytes, size_t len) const;
void Clear(); void Clear();
}; };
@@ -140,8 +136,8 @@ public:
struct TextSegment { struct TextSegment {
int start; int start;
int length; int length;
Representation *representation; const Representation *representation;
TextSegment(int start_=0, int length_=0, Representation *representation_=0) : TextSegment(int start_=0, int length_=0, const Representation *representation_=0) :
start(start_), length(length_), representation(representation_) { start(start_), length(length_), representation(representation_) {
} }
int end() const { int end() const {
@@ -151,18 +147,17 @@ struct TextSegment {
// Class to break a line of text into shorter runs at sensible places. // Class to break a line of text into shorter runs at sensible places.
class BreakFinder { class BreakFinder {
LineLayout *ll; const LineLayout *ll;
int lineStart; Range lineRange;
int lineEnd;
int posLineStart; int posLineStart;
int nextBreak; int nextBreak;
std::vector<int> selAndEdge; std::vector<int> selAndEdge;
unsigned int saeCurrentPos; unsigned int saeCurrentPos;
int saeNext; int saeNext;
int subBreak; int subBreak;
Document *pdoc; const Document *pdoc;
EncodingFamily encodingFamily; EncodingFamily encodingFamily;
SpecialRepresentations *preprs; const SpecialRepresentations *preprs;
void Insert(int val); void Insert(int val);
// Private so BreakFinder objects can not be copied // Private so BreakFinder objects can not be copied
BreakFinder(const BreakFinder &); BreakFinder(const BreakFinder &);
@@ -172,8 +167,8 @@ public:
enum { lengthStartSubdivision = 300 }; enum { lengthStartSubdivision = 300 };
// Try to make each subdivided run lengthEachSubdivision or shorter. // Try to make each subdivided run lengthEachSubdivision or shorter.
enum { lengthEachSubdivision = 100 }; enum { lengthEachSubdivision = 100 };
BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, BreakFinder(const LineLayout *ll_, const Selection *psel, Range rangeLine_, int posLineStart_,
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_); int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw);
~BreakFinder(); ~BreakFinder();
TextSegment Next(); TextSegment Next();
bool More() const; bool More() const;
@@ -191,7 +186,7 @@ public:
void Clear(); void Clear();
void SetSize(size_t size_); void SetSize(size_t size_);
size_t GetSize() const { return pces.size(); } size_t GetSize() const { return pces.size(); }
void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, void MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber,
const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc); const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc);
}; };

View File

@@ -203,15 +203,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <algorithm>
#include "CharClassify.h" #include "CharClassify.h"
#include "RESearch.h" #include "RESearch.h"
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4514)
#endif
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
#endif #endif
@@ -256,22 +252,18 @@ const char bitarr[] = { 1, 2, 4, 8, 16, 32, 64, '\200' };
RESearch::RESearch(CharClassify *charClassTable) { RESearch::RESearch(CharClassify *charClassTable) {
failure = 0; failure = 0;
charClass = charClassTable; charClass = charClassTable;
Init(); sta = NOP; /* status of lastpat */
bol = 0;
std::fill(bittab, bittab + BITBLK, 0);
std::fill(tagstk, tagstk + MAXTAG, 0);
std::fill(nfa, nfa + MAXNFA, 0);
Clear();
} }
RESearch::~RESearch() { RESearch::~RESearch() {
Clear(); Clear();
} }
void RESearch::Init() {
sta = NOP; /* status of lastpat */
bol = 0;
for (int i = 0; i < MAXTAG; i++)
pat[i].clear();
for (int j = 0; j < BITBLK; j++)
bittab[j] = 0;
}
void RESearch::Clear() { void RESearch::Clear() {
for (int i = 0; i < MAXTAG; i++) { for (int i = 0; i < MAXTAG; i++) {
pat[i].clear(); pat[i].clear();
@@ -284,10 +276,9 @@ void RESearch::GrabMatches(CharacterIndexer &ci) {
for (unsigned int i = 0; i < MAXTAG; i++) { for (unsigned int i = 0; i < MAXTAG; i++) {
if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) { if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
unsigned int len = eopat[i] - bopat[i]; unsigned int len = eopat[i] - bopat[i];
pat[i] = std::string(len+1, '\0'); pat[i].resize(len);
for (unsigned int j = 0; j < len; j++) for (unsigned int j = 0; j < len; j++)
pat[i][j] = ci.CharAt(bopat[i] + j); pat[i][j] = ci.CharAt(bopat[i] + j);
pat[i][len] = '\0';
} }
} }
} }
@@ -351,8 +342,8 @@ static int GetHexaChar(unsigned char hd1, unsigned char hd2) {
/** /**
* Called when the parser finds a backslash not followed * Called when the parser finds a backslash not followed
* by a valid expression (like \( in non-Posix mode). * by a valid expression (like \( in non-Posix mode).
* @param pattern: pointer on the char after the backslash. * @param pattern : pointer on the char after the backslash.
* @param incr: (out) number of chars to skip after expression evaluation. * @param incr : (out) number of chars to skip after expression evaluation.
* @return the char if it resolves to a simple char, * @return the char if it resolves to a simple char,
* or -1 for a char class. In this case, bittab is changed. * or -1 for a char class. In this case, bittab is changed.
*/ */
@@ -789,7 +780,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
c = *(ap+1); c = *(ap+1);
while ((lp < endp) && (static_cast<unsigned char>(ci.CharAt(lp)) != c)) while ((lp < endp) && (static_cast<unsigned char>(ci.CharAt(lp)) != c))
lp++; lp++;
if (lp >= endp) /* if EOS, fail, else fall thru. */ if (lp >= endp) /* if EOS, fail, else fall through. */
return 0; return 0;
default: /* regular matching all the way. */ default: /* regular matching all the way. */
while (lp < endp) { while (lp < endp) {
@@ -819,7 +810,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
* *
* special case optimizations: (nfa[n], nfa[n+1]) * special case optimizations: (nfa[n], nfa[n+1])
* CLO ANY * CLO ANY
* We KNOW .* will match everything upto the * We KNOW .* will match everything up to the
* end of line. Thus, directly go to the end of * end of line. Thus, directly go to the end of
* line, without recursive PMatch calls. As in * line, without recursive PMatch calls. As in
* the other closure cases, the remaining pattern * the other closure cases, the remaining pattern

Some files were not shown because too many files have changed in this diff Show More