Merge branch with the changes upgrading to Scintilla 3.5.5.
Closes #16776.
This commit is contained in:
28
Makefile.in
28
Makefile.in
@@ -236,6 +236,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
wxscintilla_LexBaan.o \
|
||||
wxscintilla_LexBash.o \
|
||||
wxscintilla_LexBasic.o \
|
||||
wxscintilla_LexBibTeX.o \
|
||||
wxscintilla_LexBullant.o \
|
||||
wxscintilla_LexCaml.o \
|
||||
wxscintilla_LexCLW.o \
|
||||
@@ -249,6 +250,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
wxscintilla_LexCSS.o \
|
||||
wxscintilla_LexD.o \
|
||||
wxscintilla_LexDMAP.o \
|
||||
wxscintilla_LexDMIS.o \
|
||||
wxscintilla_LexECL.o \
|
||||
wxscintilla_LexEiffel.o \
|
||||
wxscintilla_LexErlang.o \
|
||||
@@ -259,6 +261,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
wxscintilla_LexGAP.o \
|
||||
wxscintilla_LexGui4Cli.o \
|
||||
wxscintilla_LexHaskell.o \
|
||||
wxscintilla_LexHex.o \
|
||||
wxscintilla_LexHTML.o \
|
||||
wxscintilla_LexInno.o \
|
||||
wxscintilla_LexKix.o \
|
||||
@@ -294,6 +297,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
wxscintilla_LexPython.o \
|
||||
wxscintilla_LexR.o \
|
||||
wxscintilla_LexRebol.o \
|
||||
wxscintilla_LexRegistry.o \
|
||||
wxscintilla_LexRuby.o \
|
||||
wxscintilla_LexRust.o \
|
||||
wxscintilla_LexScriptol.o \
|
||||
@@ -336,11 +340,14 @@ WXSCINTILLA_OBJECTS = \
|
||||
wxscintilla_ContractionState.o \
|
||||
wxscintilla_Decoration.o \
|
||||
wxscintilla_Document.o \
|
||||
wxscintilla_EditModel.o \
|
||||
wxscintilla_EditView.o \
|
||||
wxscintilla_Editor.o \
|
||||
wxscintilla_ExternalLexer.o \
|
||||
wxscintilla_Indicator.o \
|
||||
wxscintilla_KeyMap.o \
|
||||
wxscintilla_LineMarker.o \
|
||||
wxscintilla_MarginView.o \
|
||||
wxscintilla_PerLine.o \
|
||||
wxscintilla_PositionCache.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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/PerLine.cxx
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
src/stc/scintilla/lexers/LexBaan.cxx
|
||||
src/stc/scintilla/lexers/LexBash.cxx
|
||||
src/stc/scintilla/lexers/LexBasic.cxx
|
||||
src/stc/scintilla/lexers/LexBibTeX.cxx
|
||||
src/stc/scintilla/lexers/LexBullant.cxx
|
||||
src/stc/scintilla/lexers/LexCaml.cxx
|
||||
src/stc/scintilla/lexers/LexCLW.cxx
|
||||
@@ -82,6 +83,7 @@
|
||||
src/stc/scintilla/lexers/LexCSS.cxx
|
||||
src/stc/scintilla/lexers/LexD.cxx
|
||||
src/stc/scintilla/lexers/LexDMAP.cxx
|
||||
src/stc/scintilla/lexers/LexDMIS.cxx
|
||||
src/stc/scintilla/lexers/LexECL.cxx
|
||||
src/stc/scintilla/lexers/LexEiffel.cxx
|
||||
src/stc/scintilla/lexers/LexErlang.cxx
|
||||
@@ -92,6 +94,7 @@
|
||||
src/stc/scintilla/lexers/LexGAP.cxx
|
||||
src/stc/scintilla/lexers/LexGui4Cli.cxx
|
||||
src/stc/scintilla/lexers/LexHaskell.cxx
|
||||
src/stc/scintilla/lexers/LexHex.cxx
|
||||
src/stc/scintilla/lexers/LexHTML.cxx
|
||||
src/stc/scintilla/lexers/LexInno.cxx
|
||||
src/stc/scintilla/lexers/LexKix.cxx
|
||||
@@ -127,6 +130,7 @@
|
||||
src/stc/scintilla/lexers/LexPython.cxx
|
||||
src/stc/scintilla/lexers/LexR.cxx
|
||||
src/stc/scintilla/lexers/LexRebol.cxx
|
||||
src/stc/scintilla/lexers/LexRegistry.cxx
|
||||
src/stc/scintilla/lexers/LexRuby.cxx
|
||||
src/stc/scintilla/lexers/LexRust.cxx
|
||||
src/stc/scintilla/lexers/LexScriptol.cxx
|
||||
@@ -169,11 +173,14 @@
|
||||
src/stc/scintilla/src/ContractionState.cxx
|
||||
src/stc/scintilla/src/Decoration.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/ExternalLexer.cxx
|
||||
src/stc/scintilla/src/Indicator.cxx
|
||||
src/stc/scintilla/src/KeyMap.cxx
|
||||
src/stc/scintilla/src/LineMarker.cxx
|
||||
src/stc/scintilla/src/MarginView.cxx
|
||||
src/stc/scintilla/src/PerLine.cxx
|
||||
src/stc/scintilla/src/PositionCache.cxx
|
||||
src/stc/scintilla/src/RESearch.cxx
|
||||
|
||||
@@ -217,6 +217,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexBaan.obj \
|
||||
$(OBJS)\wxscintilla_LexBash.obj \
|
||||
$(OBJS)\wxscintilla_LexBasic.obj \
|
||||
$(OBJS)\wxscintilla_LexBibTeX.obj \
|
||||
$(OBJS)\wxscintilla_LexBullant.obj \
|
||||
$(OBJS)\wxscintilla_LexCaml.obj \
|
||||
$(OBJS)\wxscintilla_LexCLW.obj \
|
||||
@@ -230,6 +231,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexCSS.obj \
|
||||
$(OBJS)\wxscintilla_LexD.obj \
|
||||
$(OBJS)\wxscintilla_LexDMAP.obj \
|
||||
$(OBJS)\wxscintilla_LexDMIS.obj \
|
||||
$(OBJS)\wxscintilla_LexECL.obj \
|
||||
$(OBJS)\wxscintilla_LexEiffel.obj \
|
||||
$(OBJS)\wxscintilla_LexErlang.obj \
|
||||
@@ -240,6 +242,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexGAP.obj \
|
||||
$(OBJS)\wxscintilla_LexGui4Cli.obj \
|
||||
$(OBJS)\wxscintilla_LexHaskell.obj \
|
||||
$(OBJS)\wxscintilla_LexHex.obj \
|
||||
$(OBJS)\wxscintilla_LexHTML.obj \
|
||||
$(OBJS)\wxscintilla_LexInno.obj \
|
||||
$(OBJS)\wxscintilla_LexKix.obj \
|
||||
@@ -275,6 +278,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexPython.obj \
|
||||
$(OBJS)\wxscintilla_LexR.obj \
|
||||
$(OBJS)\wxscintilla_LexRebol.obj \
|
||||
$(OBJS)\wxscintilla_LexRegistry.obj \
|
||||
$(OBJS)\wxscintilla_LexRuby.obj \
|
||||
$(OBJS)\wxscintilla_LexRust.obj \
|
||||
$(OBJS)\wxscintilla_LexScriptol.obj \
|
||||
@@ -317,11 +321,14 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_ContractionState.obj \
|
||||
$(OBJS)\wxscintilla_Decoration.obj \
|
||||
$(OBJS)\wxscintilla_Document.obj \
|
||||
$(OBJS)\wxscintilla_EditModel.obj \
|
||||
$(OBJS)\wxscintilla_EditView.obj \
|
||||
$(OBJS)\wxscintilla_Editor.obj \
|
||||
$(OBJS)\wxscintilla_ExternalLexer.obj \
|
||||
$(OBJS)\wxscintilla_Indicator.obj \
|
||||
$(OBJS)\wxscintilla_KeyMap.obj \
|
||||
$(OBJS)\wxscintilla_LineMarker.obj \
|
||||
$(OBJS)\wxscintilla_MarginView.obj \
|
||||
$(OBJS)\wxscintilla_PerLine.obj \
|
||||
$(OBJS)\wxscintilla_PositionCache.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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PerLine.cxx
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexBaan.o \
|
||||
$(OBJS)\wxscintilla_LexBash.o \
|
||||
$(OBJS)\wxscintilla_LexBasic.o \
|
||||
$(OBJS)\wxscintilla_LexBibTeX.o \
|
||||
$(OBJS)\wxscintilla_LexBullant.o \
|
||||
$(OBJS)\wxscintilla_LexCaml.o \
|
||||
$(OBJS)\wxscintilla_LexCLW.o \
|
||||
@@ -218,6 +219,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexCSS.o \
|
||||
$(OBJS)\wxscintilla_LexD.o \
|
||||
$(OBJS)\wxscintilla_LexDMAP.o \
|
||||
$(OBJS)\wxscintilla_LexDMIS.o \
|
||||
$(OBJS)\wxscintilla_LexECL.o \
|
||||
$(OBJS)\wxscintilla_LexEiffel.o \
|
||||
$(OBJS)\wxscintilla_LexErlang.o \
|
||||
@@ -228,6 +230,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexGAP.o \
|
||||
$(OBJS)\wxscintilla_LexGui4Cli.o \
|
||||
$(OBJS)\wxscintilla_LexHaskell.o \
|
||||
$(OBJS)\wxscintilla_LexHex.o \
|
||||
$(OBJS)\wxscintilla_LexHTML.o \
|
||||
$(OBJS)\wxscintilla_LexInno.o \
|
||||
$(OBJS)\wxscintilla_LexKix.o \
|
||||
@@ -263,6 +266,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexPython.o \
|
||||
$(OBJS)\wxscintilla_LexR.o \
|
||||
$(OBJS)\wxscintilla_LexRebol.o \
|
||||
$(OBJS)\wxscintilla_LexRegistry.o \
|
||||
$(OBJS)\wxscintilla_LexRuby.o \
|
||||
$(OBJS)\wxscintilla_LexRust.o \
|
||||
$(OBJS)\wxscintilla_LexScriptol.o \
|
||||
@@ -305,11 +309,14 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_ContractionState.o \
|
||||
$(OBJS)\wxscintilla_Decoration.o \
|
||||
$(OBJS)\wxscintilla_Document.o \
|
||||
$(OBJS)\wxscintilla_EditModel.o \
|
||||
$(OBJS)\wxscintilla_EditView.o \
|
||||
$(OBJS)\wxscintilla_Editor.o \
|
||||
$(OBJS)\wxscintilla_ExternalLexer.o \
|
||||
$(OBJS)\wxscintilla_Indicator.o \
|
||||
$(OBJS)\wxscintilla_KeyMap.o \
|
||||
$(OBJS)\wxscintilla_LineMarker.o \
|
||||
$(OBJS)\wxscintilla_MarginView.o \
|
||||
$(OBJS)\wxscintilla_PerLine.o \
|
||||
$(OBJS)\wxscintilla_PositionCache.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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexBaan.obj \
|
||||
$(OBJS)\wxscintilla_LexBash.obj \
|
||||
$(OBJS)\wxscintilla_LexBasic.obj \
|
||||
$(OBJS)\wxscintilla_LexBibTeX.obj \
|
||||
$(OBJS)\wxscintilla_LexBullant.obj \
|
||||
$(OBJS)\wxscintilla_LexCaml.obj \
|
||||
$(OBJS)\wxscintilla_LexCLW.obj \
|
||||
@@ -241,6 +242,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexCSS.obj \
|
||||
$(OBJS)\wxscintilla_LexD.obj \
|
||||
$(OBJS)\wxscintilla_LexDMAP.obj \
|
||||
$(OBJS)\wxscintilla_LexDMIS.obj \
|
||||
$(OBJS)\wxscintilla_LexECL.obj \
|
||||
$(OBJS)\wxscintilla_LexEiffel.obj \
|
||||
$(OBJS)\wxscintilla_LexErlang.obj \
|
||||
@@ -251,6 +253,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexGAP.obj \
|
||||
$(OBJS)\wxscintilla_LexGui4Cli.obj \
|
||||
$(OBJS)\wxscintilla_LexHaskell.obj \
|
||||
$(OBJS)\wxscintilla_LexHex.obj \
|
||||
$(OBJS)\wxscintilla_LexHTML.obj \
|
||||
$(OBJS)\wxscintilla_LexInno.obj \
|
||||
$(OBJS)\wxscintilla_LexKix.obj \
|
||||
@@ -286,6 +289,7 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_LexPython.obj \
|
||||
$(OBJS)\wxscintilla_LexR.obj \
|
||||
$(OBJS)\wxscintilla_LexRebol.obj \
|
||||
$(OBJS)\wxscintilla_LexRegistry.obj \
|
||||
$(OBJS)\wxscintilla_LexRuby.obj \
|
||||
$(OBJS)\wxscintilla_LexRust.obj \
|
||||
$(OBJS)\wxscintilla_LexScriptol.obj \
|
||||
@@ -328,11 +332,14 @@ WXSCINTILLA_OBJECTS = \
|
||||
$(OBJS)\wxscintilla_ContractionState.obj \
|
||||
$(OBJS)\wxscintilla_Decoration.obj \
|
||||
$(OBJS)\wxscintilla_Document.obj \
|
||||
$(OBJS)\wxscintilla_EditModel.obj \
|
||||
$(OBJS)\wxscintilla_EditView.obj \
|
||||
$(OBJS)\wxscintilla_Editor.obj \
|
||||
$(OBJS)\wxscintilla_ExternalLexer.obj \
|
||||
$(OBJS)\wxscintilla_Indicator.obj \
|
||||
$(OBJS)\wxscintilla_KeyMap.obj \
|
||||
$(OBJS)\wxscintilla_LineMarker.obj \
|
||||
$(OBJS)\wxscintilla_MarginView.obj \
|
||||
$(OBJS)\wxscintilla_PerLine.obj \
|
||||
$(OBJS)\wxscintilla_PositionCache.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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(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
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PerLine.cxx
|
||||
|
||||
|
||||
@@ -286,6 +286,12 @@
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\Document.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\EditModel.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\EditView.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\Editor.cxx">
|
||||
</File>
|
||||
@@ -337,6 +343,9 @@
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx">
|
||||
</File>
|
||||
@@ -376,6 +385,9 @@
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx">
|
||||
</File>
|
||||
@@ -409,6 +421,9 @@
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexHex.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx">
|
||||
</File>
|
||||
@@ -511,6 +526,9 @@
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRegistry.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx">
|
||||
</File>
|
||||
@@ -592,6 +610,9 @@
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\MarginView.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx">
|
||||
</File>
|
||||
|
||||
@@ -730,6 +730,14 @@
|
||||
RelativePath="..\..\src\stc\scintilla\src\Document.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\EditModel.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\EditView.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\Editor.cxx"
|
||||
>
|
||||
@@ -798,6 +806,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx"
|
||||
>
|
||||
@@ -850,6 +862,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx"
|
||||
>
|
||||
@@ -894,6 +910,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexHex.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx"
|
||||
>
|
||||
@@ -1030,6 +1050,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRegistry.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx"
|
||||
>
|
||||
@@ -1138,6 +1162,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\MarginView.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx"
|
||||
>
|
||||
|
||||
@@ -726,6 +726,14 @@
|
||||
RelativePath="..\..\src\stc\scintilla\src\Document.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\EditModel.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\EditView.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\Editor.cxx"
|
||||
>
|
||||
@@ -794,6 +802,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBasic.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexBullant.cxx"
|
||||
>
|
||||
@@ -846,6 +858,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMAP.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexDMIS.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexECL.cxx"
|
||||
>
|
||||
@@ -890,6 +906,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexHaskell.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexHex.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx"
|
||||
>
|
||||
@@ -1026,6 +1046,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRebol.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRegistry.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx"
|
||||
>
|
||||
@@ -1134,6 +1158,10 @@
|
||||
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\MarginView.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx"
|
||||
>
|
||||
|
||||
@@ -415,6 +415,8 @@
|
||||
<ClCompile Include="..\..\src\stc\scintilla\src\ContractionState.cxx" />
|
||||
<ClCompile Include="..\..\src\stc\scintilla\src\Decoration.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\ExternalLexer.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\LexBash.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\LexCLW.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\LexD.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\LexEScript.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\LexHTML.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\LexKix.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\LexR.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\LexRust.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\LexerSimple.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\PositionCache.cxx" />
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexlib\PropSetSimple.cxx" />
|
||||
|
||||
@@ -50,6 +50,12 @@
|
||||
<ClCompile Include="..\..\src\stc\scintilla\src\Document.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</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">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -101,6 +107,9 @@
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBasic.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBibTeX.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexBullant.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -140,6 +149,9 @@
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexDMAP.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexDMIS.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexECL.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -173,6 +185,9 @@
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexHaskell.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexHex.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexInno.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -275,6 +290,9 @@
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRebol.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRegistry.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\lexers\LexRuby.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -356,6 +374,9 @@
|
||||
<ClCompile Include="..\..\src\stc\scintilla\src\LineMarker.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\src\MarginView.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\stc\scintilla\src\PerLine.cxx">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -98,7 +98,7 @@ All (GUI):
|
||||
- Optimized wxRTC insertion and deletion when floating objects are present.
|
||||
- Added on-demand image loading option to wxRTC.
|
||||
- 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).
|
||||
- Improve RTL support in wxStyledTextCtrl (Zane U. Ji).
|
||||
- Add support for loading old V1 BMP files to wxImage (Artur Wieczorek).
|
||||
|
||||
@@ -75,6 +75,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
/// The SC_CP_UTF8 value can be used to enter Unicode mode.
|
||||
/// This is the same value as CP_UTF8 in Windows
|
||||
#define wxSTC_CP_UTF8 65001
|
||||
#define wxSTC_IME_WINDOWED 0
|
||||
#define wxSTC_IME_INLINE 1
|
||||
#define wxSTC_MARKER_MAX 31
|
||||
#define wxSTC_MARK_CIRCLE 0
|
||||
#define wxSTC_MARK_ROUNDRECT 1
|
||||
@@ -190,12 +192,20 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_INDIC_DOTBOX 12
|
||||
#define wxSTC_INDIC_SQUIGGLEPIXMAP 13
|
||||
#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_INDIC0_MASK 0x20
|
||||
#define wxSTC_INDIC1_MASK 0x40
|
||||
#define wxSTC_INDIC2_MASK 0x80
|
||||
#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_REAL 1
|
||||
#define wxSTC_IV_LOOKFORWARD 2
|
||||
@@ -220,6 +230,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_FIND_WORDSTART 0x00100000
|
||||
#define wxSTC_FIND_REGEXP 0x00200000
|
||||
#define wxSTC_FIND_POSIX 0x00400000
|
||||
#define wxSTC_FIND_CXX11REGEX 0x00800000
|
||||
#define wxSTC_FOLDLEVELBASE 0x400
|
||||
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000
|
||||
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000
|
||||
@@ -235,6 +246,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
|
||||
#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
|
||||
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||
#define wxSTC_FOLDFLAG_LINESTATE 0x0080
|
||||
#define wxSTC_TIME_FOREVER 10000000
|
||||
#define wxSTC_WRAP_NONE 0
|
||||
#define wxSTC_WRAP_WORD 1
|
||||
@@ -254,6 +266,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_CACHE_CARET 1
|
||||
#define wxSTC_CACHE_PAGE 2
|
||||
#define wxSTC_CACHE_DOCUMENT 3
|
||||
#define wxSTC_PHASES_ONE 0
|
||||
#define wxSTC_PHASES_TWO 1
|
||||
#define wxSTC_PHASES_MULTIPLE 2
|
||||
|
||||
/// Control font anti-aliasing.
|
||||
#define wxSTC_EFF_QUALITY_MASK 0xF
|
||||
@@ -269,6 +284,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_STATUS_OK 0
|
||||
#define wxSTC_STATUS_FAILURE 1
|
||||
#define wxSTC_STATUS_BADALLOC 2
|
||||
#define wxSTC_STATUS_WARN_START 1000
|
||||
#define wxSTC_STATUS_WARN_REGEX 1001
|
||||
#define wxSTC_CURSORNORMAL -1
|
||||
#define wxSTC_CURSORARROW 2
|
||||
#define wxSTC_CURSORWAIT 4
|
||||
@@ -309,6 +326,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_SEL_THIN 3
|
||||
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
|
||||
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
||||
#define wxSTC_MULTIAUTOC_ONCE 0
|
||||
#define wxSTC_MULTIAUTOC_EACH 1
|
||||
#define wxSTC_ORDER_PRESORTED 0
|
||||
#define wxSTC_ORDER_PERFORMSORT 1
|
||||
#define wxSTC_ORDER_CUSTOM 2
|
||||
@@ -326,12 +345,15 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_ANNOTATION_HIDDEN 0
|
||||
#define wxSTC_ANNOTATION_STANDARD 1
|
||||
#define wxSTC_ANNOTATION_BOXED 2
|
||||
#define wxSTC_ANNOTATION_INDENTED 3
|
||||
#define wxSTC_UNDO_MAY_COALESCE 1
|
||||
#define wxSTC_SCVS_NONE 0
|
||||
#define wxSTC_SCVS_RECTANGULARSELECTION 1
|
||||
#define wxSTC_SCVS_USERACCESSIBLE 2
|
||||
#define wxSTC_TECHNOLOGY_DEFAULT 0
|
||||
#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
|
||||
/// 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_CONTAINER 0x40000
|
||||
#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_SELECTION 0x2
|
||||
#define wxSTC_UPDATE_V_SCROLL 0x4
|
||||
@@ -518,6 +542,12 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_LEX_RUST 111
|
||||
#define wxSTC_LEX_DMAP 112
|
||||
#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
|
||||
/// 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_PREPROCESSORCOMMENTDOC 24
|
||||
#define wxSTC_C_USERLITERAL 25
|
||||
#define wxSTC_C_TASKMARKER 26
|
||||
#define wxSTC_C_ESCAPESEQUENCE 27
|
||||
|
||||
/// Lexical states for SCLEX_D
|
||||
#define wxSTC_D_DEFAULT 0
|
||||
@@ -1399,6 +1431,11 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_V_IDENTIFIER 11
|
||||
#define wxSTC_V_STRINGEOL 12
|
||||
#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
|
||||
#define wxSTC_KIX_DEFAULT 0
|
||||
@@ -1411,6 +1448,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_KIX_KEYWORD 7
|
||||
#define wxSTC_KIX_FUNCTIONS 8
|
||||
#define wxSTC_KIX_OPERATOR 9
|
||||
#define wxSTC_KIX_COMMENTSTREAM 10
|
||||
#define wxSTC_KIX_IDENTIFIER 31
|
||||
|
||||
/// Lexical states for SCLEX_GUI4CLI
|
||||
@@ -1521,6 +1559,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_VHDL_STDPACKAGE 12
|
||||
#define wxSTC_VHDL_STDTYPE 13
|
||||
#define wxSTC_VHDL_USERWORD 14
|
||||
#define wxSTC_VHDL_BLOCK_COMMENT 15
|
||||
|
||||
/// Lexical states for SCLEX_CAML
|
||||
#define wxSTC_CAML_DEFAULT 0
|
||||
@@ -1642,6 +1681,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_SQL_USER3 21
|
||||
#define wxSTC_SQL_USER4 22
|
||||
#define wxSTC_SQL_QUOTEDIDENTIFIER 23
|
||||
#define wxSTC_SQL_QOPERATOR 24
|
||||
|
||||
/// Lexical states for SCLEX_SMALLTALK
|
||||
#define wxSTC_ST_DEFAULT 0
|
||||
@@ -2287,6 +2327,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_RUST_LIFETIME 18
|
||||
#define wxSTC_RUST_MACRO 19
|
||||
#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
|
||||
#define wxSTC_DMAP_DEFAULT 0
|
||||
@@ -2301,6 +2344,63 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
|
||||
#define wxSTC_DMAP_WORD2 9
|
||||
#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.
|
||||
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.
|
||||
void ClearAll();
|
||||
|
||||
@@ -2745,6 +2848,7 @@ public:
|
||||
|
||||
// Retrieve the text of the line containing the caret.
|
||||
// Returns the index of the caret on the line.
|
||||
// Result is NUL-terminated.
|
||||
#ifdef SWIG
|
||||
wxString GetCurLine(int* OUTPUT);
|
||||
#else
|
||||
@@ -2784,9 +2888,24 @@ public:
|
||||
// Retrieve the visible size of a tab.
|
||||
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.
|
||||
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,
|
||||
// and optionally the fore and background colours.
|
||||
void MarkerDefine(int markerNumber, int markerSymbol,
|
||||
@@ -3025,6 +3144,24 @@ public:
|
||||
// Retrieve whether indicator drawn under or over text.
|
||||
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.
|
||||
void SetWhitespaceForeground(bool useSetting, const wxColour& fore);
|
||||
|
||||
@@ -3383,6 +3520,12 @@ public:
|
||||
// Get the position that ends the target.
|
||||
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.
|
||||
// Text is counted so it can contain NULs.
|
||||
// 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.
|
||||
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;
|
||||
|
||||
// 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.
|
||||
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.
|
||||
void SetFirstVisibleLine(int lineDisplay);
|
||||
|
||||
@@ -3627,6 +3779,7 @@ public:
|
||||
int GetMultiPaste() const;
|
||||
|
||||
// Retrieve the value of a tag from a regular expression search.
|
||||
// Result is NUL-terminated.
|
||||
wxString GetTag(int tagNumber) const;
|
||||
|
||||
// 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.
|
||||
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.
|
||||
void AutoCompSetOrder(int order);
|
||||
|
||||
@@ -4224,12 +4383,6 @@ public:
|
||||
// the range of a call to GetRangePointer.
|
||||
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.
|
||||
void IndicatorSetAlpha(int indicator, int alpha);
|
||||
|
||||
@@ -4539,6 +4692,7 @@ public:
|
||||
void SetRepresentation(const wxString& encodedCharacter, const wxString& representation);
|
||||
|
||||
// Set the way a character is drawn.
|
||||
// Result is NUL-terminated.
|
||||
wxString GetRepresentation(const wxString& encodedCharacter) const;
|
||||
|
||||
// Remove a character representation.
|
||||
@@ -4586,15 +4740,18 @@ public:
|
||||
void* PrivateLexerCall(int operation, void* pointer);
|
||||
|
||||
// Retrieve a '\n' separated list of properties understood by the current lexer.
|
||||
// Result is NUL-terminated.
|
||||
wxString PropertyNames() const;
|
||||
|
||||
// Retrieve the type of a property.
|
||||
int PropertyType(const wxString& name);
|
||||
|
||||
// Describe a property.
|
||||
// Result is NUL-terminated.
|
||||
wxString DescribeProperty(const wxString& name) const;
|
||||
|
||||
// Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
|
||||
// Result is NUL-terminated.
|
||||
wxString DescribeKeyWordSets() const;
|
||||
|
||||
// Bit set of LineEndType enumertion for which line ends beyond the standard
|
||||
@@ -4627,6 +4784,7 @@ public:
|
||||
int DistanceToSecondaryStyles() const;
|
||||
|
||||
// Get the set of base styles that can be extended with sub styles
|
||||
// Result is NUL-terminated.
|
||||
wxString GetSubStyleBases() const;
|
||||
|
||||
//}}}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
/// The SC_CP_UTF8 value can be used to enter Unicode mode.
|
||||
/// This is the same value as CP_UTF8 in Windows
|
||||
#define wxSTC_CP_UTF8 65001
|
||||
#define wxSTC_IME_WINDOWED 0
|
||||
#define wxSTC_IME_INLINE 1
|
||||
#define wxSTC_MARKER_MAX 31
|
||||
#define wxSTC_MARK_CIRCLE 0
|
||||
#define wxSTC_MARK_ROUNDRECT 1
|
||||
@@ -146,12 +148,20 @@
|
||||
#define wxSTC_INDIC_DOTBOX 12
|
||||
#define wxSTC_INDIC_SQUIGGLEPIXMAP 13
|
||||
#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_INDIC0_MASK 0x20
|
||||
#define wxSTC_INDIC1_MASK 0x40
|
||||
#define wxSTC_INDIC2_MASK 0x80
|
||||
#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_REAL 1
|
||||
#define wxSTC_IV_LOOKFORWARD 2
|
||||
@@ -176,6 +186,7 @@
|
||||
#define wxSTC_FIND_WORDSTART 0x00100000
|
||||
#define wxSTC_FIND_REGEXP 0x00200000
|
||||
#define wxSTC_FIND_POSIX 0x00400000
|
||||
#define wxSTC_FIND_CXX11REGEX 0x00800000
|
||||
#define wxSTC_FOLDLEVELBASE 0x400
|
||||
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000
|
||||
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000
|
||||
@@ -191,6 +202,7 @@
|
||||
#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
|
||||
#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
|
||||
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||
#define wxSTC_FOLDFLAG_LINESTATE 0x0080
|
||||
#define wxSTC_TIME_FOREVER 10000000
|
||||
#define wxSTC_WRAP_NONE 0
|
||||
#define wxSTC_WRAP_WORD 1
|
||||
@@ -210,6 +222,9 @@
|
||||
#define wxSTC_CACHE_CARET 1
|
||||
#define wxSTC_CACHE_PAGE 2
|
||||
#define wxSTC_CACHE_DOCUMENT 3
|
||||
#define wxSTC_PHASES_ONE 0
|
||||
#define wxSTC_PHASES_TWO 1
|
||||
#define wxSTC_PHASES_MULTIPLE 2
|
||||
|
||||
/// Control font anti-aliasing.
|
||||
#define wxSTC_EFF_QUALITY_MASK 0xF
|
||||
@@ -225,6 +240,8 @@
|
||||
#define wxSTC_STATUS_OK 0
|
||||
#define wxSTC_STATUS_FAILURE 1
|
||||
#define wxSTC_STATUS_BADALLOC 2
|
||||
#define wxSTC_STATUS_WARN_START 1000
|
||||
#define wxSTC_STATUS_WARN_REGEX 1001
|
||||
#define wxSTC_CURSORNORMAL -1
|
||||
#define wxSTC_CURSORARROW 2
|
||||
#define wxSTC_CURSORWAIT 4
|
||||
@@ -265,6 +282,8 @@
|
||||
#define wxSTC_SEL_THIN 3
|
||||
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
|
||||
#define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
||||
#define wxSTC_MULTIAUTOC_ONCE 0
|
||||
#define wxSTC_MULTIAUTOC_EACH 1
|
||||
#define wxSTC_ORDER_PRESORTED 0
|
||||
#define wxSTC_ORDER_PERFORMSORT 1
|
||||
#define wxSTC_ORDER_CUSTOM 2
|
||||
@@ -282,12 +301,15 @@
|
||||
#define wxSTC_ANNOTATION_HIDDEN 0
|
||||
#define wxSTC_ANNOTATION_STANDARD 1
|
||||
#define wxSTC_ANNOTATION_BOXED 2
|
||||
#define wxSTC_ANNOTATION_INDENTED 3
|
||||
#define wxSTC_UNDO_MAY_COALESCE 1
|
||||
#define wxSTC_SCVS_NONE 0
|
||||
#define wxSTC_SCVS_RECTANGULARSELECTION 1
|
||||
#define wxSTC_SCVS_USERACCESSIBLE 2
|
||||
#define wxSTC_TECHNOLOGY_DEFAULT 0
|
||||
#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
|
||||
/// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator,
|
||||
@@ -325,7 +347,9 @@
|
||||
#define wxSTC_MOD_CHANGEANNOTATION 0x20000
|
||||
#define wxSTC_MOD_CONTAINER 0x40000
|
||||
#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_SELECTION 0x2
|
||||
#define wxSTC_UPDATE_V_SCROLL 0x4
|
||||
@@ -474,6 +498,12 @@
|
||||
#define wxSTC_LEX_RUST 111
|
||||
#define wxSTC_LEX_DMAP 112
|
||||
#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
|
||||
/// value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -524,6 +554,8 @@
|
||||
#define wxSTC_C_PREPROCESSORCOMMENT 23
|
||||
#define wxSTC_C_PREPROCESSORCOMMENTDOC 24
|
||||
#define wxSTC_C_USERLITERAL 25
|
||||
#define wxSTC_C_TASKMARKER 26
|
||||
#define wxSTC_C_ESCAPESEQUENCE 27
|
||||
|
||||
/// Lexical states for SCLEX_D
|
||||
#define wxSTC_D_DEFAULT 0
|
||||
@@ -1355,6 +1387,11 @@
|
||||
#define wxSTC_V_IDENTIFIER 11
|
||||
#define wxSTC_V_STRINGEOL 12
|
||||
#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
|
||||
#define wxSTC_KIX_DEFAULT 0
|
||||
@@ -1367,6 +1404,7 @@
|
||||
#define wxSTC_KIX_KEYWORD 7
|
||||
#define wxSTC_KIX_FUNCTIONS 8
|
||||
#define wxSTC_KIX_OPERATOR 9
|
||||
#define wxSTC_KIX_COMMENTSTREAM 10
|
||||
#define wxSTC_KIX_IDENTIFIER 31
|
||||
|
||||
/// Lexical states for SCLEX_GUI4CLI
|
||||
@@ -1477,6 +1515,7 @@
|
||||
#define wxSTC_VHDL_STDPACKAGE 12
|
||||
#define wxSTC_VHDL_STDTYPE 13
|
||||
#define wxSTC_VHDL_USERWORD 14
|
||||
#define wxSTC_VHDL_BLOCK_COMMENT 15
|
||||
|
||||
/// Lexical states for SCLEX_CAML
|
||||
#define wxSTC_CAML_DEFAULT 0
|
||||
@@ -1598,6 +1637,7 @@
|
||||
#define wxSTC_SQL_USER3 21
|
||||
#define wxSTC_SQL_USER4 22
|
||||
#define wxSTC_SQL_QUOTEDIDENTIFIER 23
|
||||
#define wxSTC_SQL_QOPERATOR 24
|
||||
|
||||
/// Lexical states for SCLEX_SMALLTALK
|
||||
#define wxSTC_ST_DEFAULT 0
|
||||
@@ -2243,6 +2283,9 @@
|
||||
#define wxSTC_RUST_LIFETIME 18
|
||||
#define wxSTC_RUST_MACRO 19
|
||||
#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
|
||||
#define wxSTC_DMAP_DEFAULT 0
|
||||
@@ -2257,6 +2300,63 @@
|
||||
#define wxSTC_DMAP_WORD2 9
|
||||
#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 {{{
|
||||
@@ -2708,6 +2808,11 @@ public:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -2836,6 +2941,7 @@ public:
|
||||
/**
|
||||
Retrieve the text of the line containing the caret.
|
||||
Returns the index of the caret on the line.
|
||||
Result is NUL-terminated.
|
||||
*/
|
||||
wxString GetCurLine(int* linePos=NULL);
|
||||
|
||||
@@ -2892,11 +2998,36 @@ public:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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,
|
||||
and optionally the fore and background colours.
|
||||
@@ -3289,6 +3420,36 @@ public:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -3869,6 +4030,16 @@ public:
|
||||
*/
|
||||
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.
|
||||
Text is counted so it can contain NULs.
|
||||
@@ -4237,7 +4408,7 @@ public:
|
||||
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;
|
||||
|
||||
@@ -4247,6 +4418,19 @@ public:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -4264,6 +4448,7 @@ public:
|
||||
|
||||
/**
|
||||
Retrieve the value of a tag from a regular expression search.
|
||||
Result is NUL-terminated.
|
||||
*/
|
||||
wxString GetTag(int tagNumber) const;
|
||||
|
||||
@@ -5073,6 +5258,16 @@ public:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -5228,16 +5423,6 @@ public:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -5734,6 +5919,7 @@ public:
|
||||
|
||||
/**
|
||||
Set the way a character is drawn.
|
||||
Result is NUL-terminated.
|
||||
*/
|
||||
wxString GetRepresentation(const wxString& encodedCharacter) const;
|
||||
|
||||
@@ -5811,6 +5997,7 @@ public:
|
||||
|
||||
/**
|
||||
Retrieve a '\n' separated list of properties understood by the current lexer.
|
||||
Result is NUL-terminated.
|
||||
*/
|
||||
wxString PropertyNames() const;
|
||||
|
||||
@@ -5821,11 +6008,13 @@ public:
|
||||
|
||||
/**
|
||||
Describe a property.
|
||||
Result is NUL-terminated.
|
||||
*/
|
||||
wxString DescribeProperty(const wxString& name) const;
|
||||
|
||||
/**
|
||||
Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
|
||||
Result is NUL-terminated.
|
||||
*/
|
||||
wxString DescribeKeyWordSets() const;
|
||||
|
||||
@@ -5878,6 +6067,7 @@ public:
|
||||
|
||||
/**
|
||||
Get the set of base styles that can be extended with sub styles
|
||||
Result is NUL-terminated.
|
||||
*/
|
||||
wxString GetSubStyleBases() const;
|
||||
|
||||
|
||||
@@ -1643,10 +1643,11 @@ wxWX2MBbuf wx2stc(const wxString& str)
|
||||
size_t wclen = str.length();
|
||||
size_t len = UTF8Length(wcstr, wclen);
|
||||
|
||||
wxCharBuffer buffer(len+1);
|
||||
UTF8FromUTF16(wcstr, wclen, buffer.data(), len);
|
||||
|
||||
// TODO check NULL termination!!
|
||||
// The buffer object adds extra byte for the terminating NUL and we must
|
||||
// pass the total length, including this NUL, to UTF8FromUTF16() to ensure
|
||||
// that it NULL-terminates the string.
|
||||
wxCharBuffer buffer(len);
|
||||
UTF8FromUTF16(wcstr, wclen, buffer.data(), len + 1);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ void ScintillaWX::Paste() {
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertPaste(selStart, buf, len);
|
||||
InsertPaste(buf, len);
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_DATAOBJ
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
// These are all Scintilla headers
|
||||
#include "Platform.h"
|
||||
@@ -59,6 +60,9 @@
|
||||
#include "Document.h"
|
||||
#include "Selection.h"
|
||||
#include "PositionCache.h"
|
||||
#include "EditModel.h"
|
||||
#include "MarginView.h"
|
||||
#include "EditView.h"
|
||||
#include "Editor.h"
|
||||
#include "PropSetSimple.h"
|
||||
#include "ScintillaBase.h"
|
||||
@@ -113,38 +117,38 @@ public:
|
||||
~ScintillaWX();
|
||||
|
||||
// base class virtuals
|
||||
virtual void Initialise();
|
||||
virtual void Finalise();
|
||||
virtual void StartDrag();
|
||||
virtual bool SetIdle(bool on);
|
||||
virtual void SetTicking(bool on);
|
||||
virtual void SetMouseCapture(bool on);
|
||||
virtual bool HaveMouseCapture();
|
||||
virtual void ScrollText(int linesToMove);
|
||||
virtual void SetVerticalScrollPos();
|
||||
virtual void SetHorizontalScrollPos();
|
||||
virtual bool ModifyScrollBars(int nMax, int nPage);
|
||||
virtual void Copy();
|
||||
virtual void Paste();
|
||||
virtual void CopyToClipboard(const SelectionText &selectedText);
|
||||
virtual void Initialise() wxOVERRIDE;
|
||||
virtual void Finalise() wxOVERRIDE;
|
||||
virtual void StartDrag() wxOVERRIDE;
|
||||
virtual bool SetIdle(bool on) wxOVERRIDE;
|
||||
virtual void SetTicking(bool on) wxOVERRIDE;
|
||||
virtual void SetMouseCapture(bool on) wxOVERRIDE;
|
||||
virtual bool HaveMouseCapture() wxOVERRIDE;
|
||||
virtual void ScrollText(int linesToMove) wxOVERRIDE;
|
||||
virtual void SetVerticalScrollPos() wxOVERRIDE;
|
||||
virtual void SetHorizontalScrollPos() wxOVERRIDE;
|
||||
virtual bool ModifyScrollBars(int nMax, int nPage) wxOVERRIDE;
|
||||
virtual void Copy() wxOVERRIDE;
|
||||
virtual void Paste() wxOVERRIDE;
|
||||
virtual void CopyToClipboard(const SelectionText &selectedText) wxOVERRIDE;
|
||||
|
||||
virtual void CreateCallTipWindow(PRectangle rc);
|
||||
virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
|
||||
virtual void ClaimSelection();
|
||||
virtual void CreateCallTipWindow(PRectangle rc) wxOVERRIDE;
|
||||
virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true) wxOVERRIDE;
|
||||
virtual void ClaimSelection() wxOVERRIDE;
|
||||
|
||||
virtual sptr_t DefWndProc(unsigned int iMessage,
|
||||
uptr_t wParam,
|
||||
sptr_t lParam);
|
||||
sptr_t lParam) wxOVERRIDE;
|
||||
virtual sptr_t WndProc(unsigned int iMessage,
|
||||
uptr_t wParam,
|
||||
sptr_t lParam);
|
||||
sptr_t lParam) wxOVERRIDE;
|
||||
|
||||
virtual void NotifyChange();
|
||||
virtual void NotifyParent(SCNotification scn);
|
||||
virtual void NotifyChange() wxOVERRIDE;
|
||||
virtual void NotifyParent(SCNotification scn) wxOVERRIDE;
|
||||
|
||||
virtual void CancelModes();
|
||||
virtual void CancelModes() wxOVERRIDE;
|
||||
|
||||
virtual void UpdateSystemCaret();
|
||||
virtual void UpdateSystemCaret() wxOVERRIDE;
|
||||
|
||||
// Event delegates
|
||||
void DoPaint(wxDC* dc, wxRect rect);
|
||||
@@ -182,7 +186,7 @@ public:
|
||||
void FullPaint();
|
||||
void FullPaintDC(wxDC* dc);
|
||||
bool CanPaste();
|
||||
bool GetHideSelection() { return hideSelection; }
|
||||
bool GetHideSelection() { return view.hideSelection; }
|
||||
void DoScrollToLine(int line);
|
||||
void DoScrollToColumn(int column);
|
||||
void ClipChildren(wxDC& dc, PRectangle rect);
|
||||
|
||||
@@ -371,6 +371,12 @@ methodOverrideMap = {
|
||||
'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0),
|
||||
'IndicSetUnder': ('IndicatorSetUnder', 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),
|
||||
'SetWhitespaceBack' : ('SetWhitespaceBackground', 0, 0, 0),
|
||||
@@ -406,6 +412,8 @@ methodOverrideMap = {
|
||||
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
|
||||
'AutoCSetCaseInsensitiveBehaviour' : ('AutoCompSetCaseInsensitiveBehaviour', 0, 0, 0),
|
||||
'AutoCGetCaseInsensitiveBehaviour' : ('AutoCompGetCaseInsensitiveBehaviour', 0, 0, 0),
|
||||
'AutoCSetMulti' : ('AutoCompSetMulti', 0, 0, 0),
|
||||
'AutoCGetMulti' : ('AutoCompGetMulti', 0, 0, 0),
|
||||
'AutoCSetOrder' : ('AutoCompSetOrder', 0, 0, 0),
|
||||
'AutoCGetOrder' : ('AutoCompGetOrder', 0, 0, 0),
|
||||
|
||||
@@ -586,6 +594,22 @@ methodOverrideMap = {
|
||||
'GetDirectFunction' : (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),
|
||||
'CallTipSetPosStart': ('CallTipSetPosAtStart', 0, 0, 0),
|
||||
'CallTipSetHlt' : ('CallTipSetHighlight', 0, 0, 0),
|
||||
|
||||
@@ -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
|
||||
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.
|
||||
|
||||
|
||||
@@ -77,7 +77,9 @@ namespace Scintilla {
|
||||
|
||||
typedef float XYPOSITION;
|
||||
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.
|
||||
// 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.
|
||||
* 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 {
|
||||
public:
|
||||
@@ -102,6 +104,10 @@ public:
|
||||
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
|
||||
|
||||
static Point FromLong(long lpoint);
|
||||
@@ -109,7 +115,7 @@ public:
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
class PRectangle {
|
||||
@@ -119,10 +125,15 @@ public:
|
||||
XYPOSITION right;
|
||||
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_) {
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
bool operator==(PRectangle &rc) const {
|
||||
@@ -133,6 +144,11 @@ public:
|
||||
return (pt.x >= left) && (pt.x <= right) &&
|
||||
(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 {
|
||||
return (rc.left >= left) && (rc.right <= right) &&
|
||||
(rc.top >= top) && (rc.bottom <= bottom);
|
||||
@@ -255,7 +271,6 @@ struct FontParameters {
|
||||
class Font {
|
||||
protected:
|
||||
FontID fid;
|
||||
|
||||
// Private so Font objects can not be copied
|
||||
Font(const Font &);
|
||||
Font &operator=(const Font &);
|
||||
@@ -269,7 +284,6 @@ public:
|
||||
FontID GetID() { return fid; }
|
||||
// Alias another font - caller guarantees not to Release
|
||||
void SetID(FontID fid_) { fid = fid_; }
|
||||
|
||||
friend class Surface;
|
||||
friend class SurfaceImpl;
|
||||
};
|
||||
@@ -512,11 +526,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
// Shut up annoying Visual C++ warnings:
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4244 4309 4514 4710)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(SCINTILLA_QT)
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
||||
@@ -126,6 +126,12 @@
|
||||
#define SCLEX_RUST 111
|
||||
#define SCLEX_DMAP 112
|
||||
#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 SCE_P_DEFAULT 0
|
||||
#define SCE_P_COMMENTLINE 1
|
||||
@@ -169,6 +175,8 @@
|
||||
#define SCE_C_PREPROCESSORCOMMENT 23
|
||||
#define SCE_C_PREPROCESSORCOMMENTDOC 24
|
||||
#define SCE_C_USERLITERAL 25
|
||||
#define SCE_C_TASKMARKER 26
|
||||
#define SCE_C_ESCAPESEQUENCE 27
|
||||
#define SCE_D_DEFAULT 0
|
||||
#define SCE_D_COMMENT 1
|
||||
#define SCE_D_COMMENTLINE 2
|
||||
@@ -893,6 +901,11 @@
|
||||
#define SCE_V_IDENTIFIER 11
|
||||
#define SCE_V_STRINGEOL 12
|
||||
#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_COMMENT 1
|
||||
#define SCE_KIX_STRING1 2
|
||||
@@ -903,6 +916,7 @@
|
||||
#define SCE_KIX_KEYWORD 7
|
||||
#define SCE_KIX_FUNCTIONS 8
|
||||
#define SCE_KIX_OPERATOR 9
|
||||
#define SCE_KIX_COMMENTSTREAM 10
|
||||
#define SCE_KIX_IDENTIFIER 31
|
||||
#define SCE_GC_DEFAULT 0
|
||||
#define SCE_GC_COMMENTLINE 1
|
||||
@@ -999,6 +1013,7 @@
|
||||
#define SCE_VHDL_STDPACKAGE 12
|
||||
#define SCE_VHDL_STDTYPE 13
|
||||
#define SCE_VHDL_USERWORD 14
|
||||
#define SCE_VHDL_BLOCK_COMMENT 15
|
||||
#define SCE_CAML_DEFAULT 0
|
||||
#define SCE_CAML_IDENTIFIER 1
|
||||
#define SCE_CAML_TAGNAME 2
|
||||
@@ -1110,6 +1125,7 @@
|
||||
#define SCE_SQL_USER3 21
|
||||
#define SCE_SQL_USER4 22
|
||||
#define SCE_SQL_QUOTEDIDENTIFIER 23
|
||||
#define SCE_SQL_QOPERATOR 24
|
||||
#define SCE_ST_DEFAULT 0
|
||||
#define SCE_ST_STRING 1
|
||||
#define SCE_ST_NUMBER 2
|
||||
@@ -1689,6 +1705,9 @@
|
||||
#define SCE_RUST_LIFETIME 18
|
||||
#define SCE_RUST_MACRO 19
|
||||
#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_COMMENT 1
|
||||
#define SCE_DMAP_NUMBER 2
|
||||
@@ -1700,6 +1719,55 @@
|
||||
#define SCE_DMAP_WORD 8
|
||||
#define SCE_DMAP_WORD2 9
|
||||
#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 */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,9 +18,9 @@ extern "C" {
|
||||
#if defined(_WIN32)
|
||||
/* Return false on failure: */
|
||||
int Scintilla_RegisterClasses(void *hInstance);
|
||||
int Scintilla_ReleaseResources();
|
||||
int Scintilla_ReleaseResources(void);
|
||||
#endif
|
||||
int Scintilla_LinkLexers();
|
||||
int Scintilla_LinkLexers(void);
|
||||
|
||||
#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);
|
||||
|
||||
/* 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 */
|
||||
#define INVALID_POSITION -1
|
||||
#define SCI_START 2000
|
||||
@@ -61,6 +50,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCI_ADDTEXT 2001
|
||||
#define SCI_ADDSTYLEDTEXT 2002
|
||||
#define SCI_INSERTTEXT 2003
|
||||
#define SCI_CHANGEINSERTION 2672
|
||||
#define SCI_CLEARALL 2004
|
||||
#define SCI_DELETERANGE 2645
|
||||
#define SCI_CLEARDOCUMENTSTYLE 2005
|
||||
@@ -102,8 +92,15 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCI_SETBUFFEREDDRAW 2035
|
||||
#define SCI_SETTABWIDTH 2036
|
||||
#define SCI_GETTABWIDTH 2121
|
||||
#define SCI_CLEARTABSTOPS 2675
|
||||
#define SCI_ADDTABSTOP 2676
|
||||
#define SCI_GETNEXTTABSTOP 2677
|
||||
#define SC_CP_UTF8 65001
|
||||
#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 SC_MARK_CIRCLE 0
|
||||
#define SC_MARK_ROUNDRECT 1
|
||||
@@ -277,7 +274,12 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define INDIC_DOTBOX 12
|
||||
#define INDIC_SQUIGGLEPIXMAP 13
|
||||
#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 INDIC0_MASK 0x20
|
||||
#define INDIC1_MASK 0x40
|
||||
@@ -289,6 +291,15 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCI_INDICGETFORE 2083
|
||||
#define SCI_INDICSETUNDER 2510
|
||||
#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_SETWHITESPACEBACK 2085
|
||||
#define SCI_SETWHITESPACESIZE 2086
|
||||
@@ -375,6 +386,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCFIND_WORDSTART 0x00100000
|
||||
#define SCFIND_REGEXP 0x00200000
|
||||
#define SCFIND_POSIX 0x00400000
|
||||
#define SCFIND_CXX11REGEX 0x00800000
|
||||
#define SCI_FINDTEXT 2150
|
||||
#define SCI_FORMATRANGE 2151
|
||||
#define SCI_GETFIRSTVISIBLELINE 2152
|
||||
@@ -420,6 +432,8 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCI_GETTARGETSTART 2191
|
||||
#define SCI_SETTARGETEND 2192
|
||||
#define SCI_GETTARGETEND 2193
|
||||
#define SCI_SETTARGETRANGE 2686
|
||||
#define SCI_GETTARGETTEXT 2687
|
||||
#define SCI_REPLACETARGET 2194
|
||||
#define SCI_REPLACETARGETRE 2195
|
||||
#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_CONTRACTED 0x0010
|
||||
#define SC_FOLDFLAG_LEVELNUMBERS 0x0040
|
||||
#define SC_FOLDFLAG_LINESTATE 0x0080
|
||||
#define SCI_SETFOLDFLAGS 2233
|
||||
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
|
||||
#define SCI_SETTABINDENTS 2260
|
||||
@@ -526,6 +541,11 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCI_APPENDTEXT 2282
|
||||
#define SCI_GETTWOPHASEDRAW 2283
|
||||
#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_DEFAULT 0
|
||||
#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_FAILURE 1
|
||||
#define SC_STATUS_BADALLOC 2
|
||||
#define SC_STATUS_WARN_START 1000
|
||||
#define SC_STATUS_WARN_REGEX 1001
|
||||
#define SCI_SETSTATUS 2382
|
||||
#define SCI_GETSTATUS 2383
|
||||
#define SCI_SETMOUSEDOWNCAPTURES 2384
|
||||
@@ -726,6 +748,10 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
|
||||
#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634
|
||||
#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_PERFORMSORT 1
|
||||
#define SC_ORDER_CUSTOM 2
|
||||
@@ -771,8 +797,6 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCI_GETCHARACTERPOINTER 2520
|
||||
#define SCI_GETRANGEPOINTER 2643
|
||||
#define SCI_GETGAPPOSITION 2644
|
||||
#define SCI_SETKEYSUNICODE 2521
|
||||
#define SCI_GETKEYSUNICODE 2522
|
||||
#define SCI_INDICSETALPHA 2523
|
||||
#define SCI_INDICGETALPHA 2524
|
||||
#define SCI_INDICSETOUTLINEALPHA 2558
|
||||
@@ -806,6 +830,7 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define ANNOTATION_HIDDEN 0
|
||||
#define ANNOTATION_STANDARD 1
|
||||
#define ANNOTATION_BOXED 2
|
||||
#define ANNOTATION_INDENTED 3
|
||||
#define SCI_ANNOTATIONSETVISIBLE 2548
|
||||
#define SCI_ANNOTATIONGETVISIBLE 2549
|
||||
#define SCI_ANNOTATIONSETSTYLEOFFSET 2550
|
||||
@@ -885,6 +910,8 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SCI_SCROLLTOEND 2629
|
||||
#define SC_TECHNOLOGY_DEFAULT 0
|
||||
#define SC_TECHNOLOGY_DIRECTWRITE 1
|
||||
#define SC_TECHNOLOGY_DIRECTWRITERETAIN 2
|
||||
#define SC_TECHNOLOGY_DIRECTWRITEDC 3
|
||||
#define SCI_SETTECHNOLOGY 2630
|
||||
#define SCI_GETTECHNOLOGY 2631
|
||||
#define SCI_CREATELOADER 2632
|
||||
@@ -956,7 +983,9 @@ inline int isascii(int c) { return !(c & ~0x7F); }
|
||||
#define SC_MOD_CHANGEANNOTATION 0x20000
|
||||
#define SC_MOD_CONTAINER 0x40000
|
||||
#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_SELECTION 0x2
|
||||
#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.
|
||||
* So older code that treats Scintilla as a RichEdit will work. */
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
|
||||
namespace Scintilla {
|
||||
#endif
|
||||
|
||||
@@ -1117,7 +1146,7 @@ struct SCNotification {
|
||||
int updated; /* SCN_UPDATEUI */
|
||||
};
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1126,6 +1155,8 @@ struct SCNotification {
|
||||
#define SC_CP_DBCS 1
|
||||
#define SCI_SETUSEPALETTE 2039
|
||||
#define SCI_GETUSEPALETTE 2139
|
||||
#define SCI_SETKEYSUNICODE 2521
|
||||
#define SCI_GETKEYSUNICODE 2522
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -72,11 +72,11 @@
|
||||
|
||||
## Line numbers and positions start at 0.
|
||||
## 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
|
||||
## by GetLine also have a NUL appended but client code should calculate the size that
|
||||
## will be returned rather than relying upon the NUL whenever possible. Allow for the
|
||||
## extra NUL character when allocating buffers. The size to allocate for a stringresult
|
||||
## can be determined by calling with a NULL (0) pointer.
|
||||
## argument and retrieve NUL characters. APIs marked as NUL-terminated also have a
|
||||
## NUL appended but client code should calculate the size that will be returned rather
|
||||
## than relying upon the NUL whenever possible. Allow for the extra NUL character when
|
||||
## allocating buffers. The size to allocate for a stringresult (not including NUL) can be
|
||||
## determined by calling with a NULL (0) pointer.
|
||||
|
||||
cat Basics
|
||||
|
||||
@@ -98,6 +98,9 @@ fun void AddStyledText=2002(int length, cells c)
|
||||
# Insert string at a position.
|
||||
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.
|
||||
fun void ClearAll=2004(,)
|
||||
|
||||
@@ -183,6 +186,7 @@ set void SetAnchor=2026(position posAnchor,)
|
||||
|
||||
# Retrieve the text of the line containing the caret.
|
||||
# Returns the index of the caret on the line.
|
||||
# Result is NUL-terminated.
|
||||
fun int GetCurLine=2027(int length, stringresult text)
|
||||
|
||||
# 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.
|
||||
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.
|
||||
# This is the same value as CP_UTF8 in Windows
|
||||
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.
|
||||
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_
|
||||
val MARKER_MAX=31
|
||||
val SC_MARK_CIRCLE=0
|
||||
@@ -457,6 +480,7 @@ get int StyleGetSize=2485(int style,)
|
||||
|
||||
# Get the font of a style.
|
||||
# Returns the length of the fontName
|
||||
# Result is NUL-terminated.
|
||||
get int StyleGetFont=2486(int style, stringresult fontName)
|
||||
|
||||
# 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)
|
||||
|
||||
# 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)
|
||||
|
||||
# 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_SQUIGGLEPIXMAP=13
|
||||
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 INDIC0_MASK=0x20
|
||||
val INDIC1_MASK=0x40
|
||||
@@ -608,6 +637,30 @@ set void IndicSetUnder=2510(int indic, bool under)
|
||||
# Retrieve whether indicator drawn under or over text.
|
||||
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.
|
||||
fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
|
||||
|
||||
@@ -862,6 +915,7 @@ val SCFIND_MATCHCASE=0x4
|
||||
val SCFIND_WORDSTART=0x00100000
|
||||
val SCFIND_REGEXP=0x00200000
|
||||
val SCFIND_POSIX=0x00400000
|
||||
val SCFIND_CXX11REGEX=0x00800000
|
||||
|
||||
# Find some text in the document.
|
||||
fun position FindText=2150(int flags, findtext ft)
|
||||
@@ -899,6 +953,7 @@ fun void SetSel=2160(position start, position end)
|
||||
|
||||
# Retrieve the selected text.
|
||||
# Return the length of the text.
|
||||
# Result is NUL-terminated.
|
||||
fun int GetSelText=2161(, stringresult text)
|
||||
|
||||
# Retrieve a range of text.
|
||||
@@ -969,6 +1024,7 @@ fun void SetText=2181(, string text)
|
||||
|
||||
# Retrieve all the text in the document.
|
||||
# Returns number of characters retrieved.
|
||||
# Result is NUL-terminated.
|
||||
fun int GetText=2182(int length, stringresult text)
|
||||
|
||||
# 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 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.
|
||||
# Text is counted so it can contain NULs.
|
||||
# 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_CONTRACTED=0x0010
|
||||
val SC_FOLDFLAG_LEVELNUMBERS=0x0040
|
||||
val SC_FOLDFLAG_LINESTATE=0x0080
|
||||
|
||||
# Set some style options for folding.
|
||||
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.
|
||||
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(,)
|
||||
|
||||
# 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.
|
||||
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.
|
||||
|
||||
enu FontQuality=SC_EFF_
|
||||
@@ -1323,6 +1400,7 @@ set void SetMultiPaste=2614(int multiPaste,)
|
||||
get int GetMultiPaste=2615(,)
|
||||
|
||||
# Retrieve the value of a tag from a regular expression search.
|
||||
# Result is NUL-terminated.
|
||||
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.
|
||||
@@ -1624,6 +1702,8 @@ enu Status=SC_STATUS_
|
||||
val SC_STATUS_OK=0
|
||||
val SC_STATUS_FAILURE=1
|
||||
val SC_STATUS_BADALLOC=2
|
||||
val SC_STATUS_WARN_START=1000
|
||||
val SC_STATUS_WARN_REGEX=1001
|
||||
|
||||
# Change error status - 0 = OK.
|
||||
set void SetStatus=2382(int statusCode,)
|
||||
@@ -1868,6 +1948,7 @@ get int AutoCGetCurrent=2445(,)
|
||||
|
||||
# Get currently selected item text in the auto-completion list
|
||||
# Returns the length of the item text
|
||||
# Result is NUL-terminated.
|
||||
get int AutoCGetCurrentText=2610(, stringresult s)
|
||||
|
||||
enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_
|
||||
@@ -1880,6 +1961,16 @@ set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,)
|
||||
# Get auto-completion case insensitive behaviour.
|
||||
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_
|
||||
val SC_ORDER_PRESORTED=0
|
||||
val SC_ORDER_PERFORMSORT=1
|
||||
@@ -2007,12 +2098,6 @@ get int GetRangePointer=2643(int position, int rangeLength)
|
||||
# the range of a call to GetRangePointer.
|
||||
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 void IndicSetAlpha=2523(int indicator, int alpha)
|
||||
|
||||
@@ -2105,6 +2190,7 @@ enu AnnotationVisible=ANNOTATION_
|
||||
val ANNOTATION_HIDDEN=0
|
||||
val ANNOTATION_STANDARD=1
|
||||
val ANNOTATION_BOXED=2
|
||||
val ANNOTATION_INDENTED=3
|
||||
|
||||
# Set the visibility for the annotations for a view
|
||||
set void AnnotationSetVisible=2548(int visible,)
|
||||
@@ -2312,6 +2398,8 @@ fun void ScrollToEnd=2629(,)
|
||||
|
||||
val SC_TECHNOLOGY_DEFAULT=0
|
||||
val SC_TECHNOLOGY_DIRECTWRITE=1
|
||||
val SC_TECHNOLOGY_DIRECTWRITERETAIN=2
|
||||
val SC_TECHNOLOGY_DIRECTWRITEDC=3
|
||||
|
||||
# Set the technology used.
|
||||
set void SetTechnology=2630(int technology,)
|
||||
@@ -2364,6 +2452,7 @@ get int GetLineEndTypesActive=2658(,)
|
||||
set void SetRepresentation=2665(string encodedCharacter, string representation)
|
||||
|
||||
# Set the way a character is drawn.
|
||||
# Result is NUL-terminated.
|
||||
get int GetRepresentation=2666(string encodedCharacter, stringresult representation)
|
||||
|
||||
# Remove a character representation.
|
||||
@@ -2400,10 +2489,12 @@ set void SetLexerLanguage=4006(, string language)
|
||||
fun void LoadLexerLibrary=4007(, string path)
|
||||
|
||||
# Retrieve a "property" value previously set with SetProperty.
|
||||
# Result is NUL-terminated.
|
||||
get int GetProperty=4008(string key, stringresult buf)
|
||||
|
||||
# Retrieve a "property" value previously set with SetProperty,
|
||||
# with "$()" variable replacement on returned buffer.
|
||||
# Result is NUL-terminated.
|
||||
get int GetPropertyExpanded=4009(string key, stringresult buf)
|
||||
|
||||
# Retrieve a "property" value previously set with SetProperty,
|
||||
@@ -2415,12 +2506,14 @@ get int GetStyleBitsNeeded=4011(,)
|
||||
|
||||
# Retrieve the name of the lexer.
|
||||
# Return the length of the text.
|
||||
# Result is NUL-terminated.
|
||||
get int GetLexerLanguage=4012(, stringresult text)
|
||||
|
||||
# For private communication between an application and a known lexer.
|
||||
fun int PrivateLexerCall=4013(int operation, int pointer)
|
||||
|
||||
# Retrieve a '\n' separated list of properties understood by the current lexer.
|
||||
# Result is NUL-terminated.
|
||||
fun int PropertyNames=4014(, stringresult names)
|
||||
|
||||
enu TypeProperty=SC_TYPE_
|
||||
@@ -2432,9 +2525,11 @@ val SC_TYPE_STRING=2
|
||||
fun int PropertyType=4015(string name,)
|
||||
|
||||
# Describe a property.
|
||||
# Result is NUL-terminated.
|
||||
fun int DescribeProperty=4016(string name, stringresult description)
|
||||
|
||||
# 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)
|
||||
|
||||
# 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 the set of base styles that can be extended with sub styles
|
||||
# Result is NUL-terminated.
|
||||
get int GetSubStyleBases=4026(, stringresult styles)
|
||||
|
||||
# Notifications
|
||||
@@ -2494,7 +2590,9 @@ val SC_MOD_CHANGEMARGIN=0x10000
|
||||
val SC_MOD_CHANGEANNOTATION=0x20000
|
||||
val SC_MOD_CONTAINER=0x40000
|
||||
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_
|
||||
val SC_UPDATE_CONTENT=0x1
|
||||
@@ -2659,6 +2757,12 @@ val SCLEX_KVIRC=110
|
||||
val SCLEX_RUST=111
|
||||
val SCLEX_DMAP=112
|
||||
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
|
||||
# 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_PREPROCESSORCOMMENTDOC=24
|
||||
val SCE_C_USERLITERAL=25
|
||||
val SCE_C_TASKMARKER=26
|
||||
val SCE_C_ESCAPESEQUENCE=27
|
||||
# Lexical states for SCLEX_D
|
||||
lex D=SCLEX_D SCE_D_
|
||||
val SCE_D_DEFAULT=0
|
||||
@@ -3537,6 +3643,11 @@ val SCE_V_OPERATOR=10
|
||||
val SCE_V_IDENTIFIER=11
|
||||
val SCE_V_STRINGEOL=12
|
||||
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
|
||||
lex Kix=SCLEX_KIX SCE_KIX_
|
||||
val SCE_KIX_DEFAULT=0
|
||||
@@ -3549,6 +3660,7 @@ val SCE_KIX_MACRO=6
|
||||
val SCE_KIX_KEYWORD=7
|
||||
val SCE_KIX_FUNCTIONS=8
|
||||
val SCE_KIX_OPERATOR=9
|
||||
val SCE_KIX_COMMENTSTREAM=10
|
||||
val SCE_KIX_IDENTIFIER=31
|
||||
# Lexical states for SCLEX_GUI4CLI
|
||||
lex Gui4Cli=SCLEX_GUI4CLI SCE_GC_
|
||||
@@ -3659,6 +3771,7 @@ val SCE_VHDL_STDFUNCTION=11
|
||||
val SCE_VHDL_STDPACKAGE=12
|
||||
val SCE_VHDL_STDTYPE=13
|
||||
val SCE_VHDL_USERWORD=14
|
||||
val SCE_VHDL_BLOCK_COMMENT=15
|
||||
# Lexical states for SCLEX_CAML
|
||||
lex Caml=SCLEX_CAML SCE_CAML_
|
||||
val SCE_CAML_DEFAULT=0
|
||||
@@ -3780,6 +3893,7 @@ val SCE_SQL_USER2=20
|
||||
val SCE_SQL_USER3=21
|
||||
val SCE_SQL_USER4=22
|
||||
val SCE_SQL_QUOTEDIDENTIFIER=23
|
||||
val SCE_SQL_QOPERATOR=24
|
||||
# Lexical states for SCLEX_SMALLTALK
|
||||
lex Smalltalk=SCLEX_SMALLTALK SCE_ST_
|
||||
val SCE_ST_DEFAULT=0
|
||||
@@ -4425,6 +4539,9 @@ val SCE_RUST_IDENTIFIER=17
|
||||
val SCE_RUST_LIFETIME=18
|
||||
val SCE_RUST_MACRO=19
|
||||
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
|
||||
lex DMAP=SCLEX_DMAP SCE_DMAP_
|
||||
val SCE_DMAP_DEFAULT=0
|
||||
@@ -4438,6 +4555,67 @@ val SCE_DMAP_IDENTIFIER=7
|
||||
val SCE_DMAP_WORD=8
|
||||
val SCE_DMAP_WORD2=9
|
||||
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
|
||||
|
||||
@@ -4490,3 +4668,11 @@ get bool GetUsePalette=2139(,)
|
||||
# In palette mode, Scintilla uses the environment's palette calls to display
|
||||
# more colours. This may lead to ugly displays.
|
||||
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(,)
|
||||
|
||||
@@ -419,8 +419,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Forward();
|
||||
HereDoc.Quoted = true;
|
||||
HereDoc.State = 1;
|
||||
} else if (!HereDoc.Indent && sc.chNext == '-') { // <<- indent case
|
||||
HereDoc.Indent = true;
|
||||
} else if (setHereDoc.Contains(sc.chNext)) {
|
||||
// an unquoted here-doc delimiter, no special handling
|
||||
// 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) {
|
||||
sc.SetState(SCE_SH_HERE_Q);
|
||||
int prefixws = 0;
|
||||
while (IsASpace(sc.ch) && !sc.atLineEnd) { // whitespace prefix
|
||||
while (sc.ch == '\t' && !sc.atLineEnd) { // tabulation prefix
|
||||
sc.Forward();
|
||||
prefixws++;
|
||||
}
|
||||
@@ -481,7 +479,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
char s[HERE_DELIM_MAX];
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
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);
|
||||
break;
|
||||
}
|
||||
@@ -672,7 +671,12 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else if (sc.Match('<', '<')) {
|
||||
sc.SetState(SCE_SH_HERE_DELIM);
|
||||
HereDoc.State = 0;
|
||||
if (sc.GetRelative(2) == '-') { // <<- indent case
|
||||
HereDoc.Indent = true;
|
||||
sc.Forward();
|
||||
} else {
|
||||
HereDoc.Indent = false;
|
||||
}
|
||||
} else if (sc.ch == '-' && // one-char file test operators
|
||||
setSingleCharOp.Contains(sc.chNext) &&
|
||||
!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;
|
||||
unsigned int endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int skipHereCh = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
@@ -798,7 +803,15 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
// Here Document folding
|
||||
if (style == SCE_SH_HERE_DELIM) {
|
||||
if (ch == '<' && chNext == '<') {
|
||||
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) {
|
||||
levelCurrent--;
|
||||
|
||||
310
src/stc/scintilla/lexers/LexBibTeX.cxx
Normal file
310
src/stc/scintilla/lexers/LexBibTeX.cxx
Normal 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
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -36,7 +36,10 @@
|
||||
using namespace Scintilla;
|
||||
#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) ||
|
||||
// including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
|
||||
(state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) ||
|
||||
@@ -50,7 +53,7 @@ static bool IsSpaceEquiv(int state) {
|
||||
// a = b+++/ptn/...
|
||||
// Putting a space between the '++' post-inc operator and the '+' binary op
|
||||
// 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;
|
||||
while (--pos > 0) {
|
||||
char ch = styler[pos];
|
||||
@@ -61,7 +64,7 @@ static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
|
||||
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.
|
||||
int pos = (int) sc.currentPos;
|
||||
int currentLine = styler.GetLine(pos);
|
||||
@@ -83,7 +86,120 @@ static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
|
||||
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;
|
||||
int i =0;
|
||||
char ch = styler.SafeGetCharAt(start, '\n');
|
||||
@@ -100,40 +216,21 @@ static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace
|
||||
return restOfLine;
|
||||
}
|
||||
|
||||
static bool IsStreamCommentStyle(int style) {
|
||||
bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_C_COMMENT ||
|
||||
style == SCE_C_COMMENTDOC ||
|
||||
style == SCE_C_COMMENTDOCKEYWORD ||
|
||||
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 {
|
||||
int line;
|
||||
std::string key;
|
||||
std::string value;
|
||||
bool isUndef;
|
||||
PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false) :
|
||||
line(line_), key(key_), value(value_), isUndef(isUndef_) {
|
||||
std::string arguments;
|
||||
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 trackPreprocessor;
|
||||
bool updatePreprocessor;
|
||||
bool verbatimStringsAllowEscapes;
|
||||
bool triplequotedStrings;
|
||||
bool hashquotedStrings;
|
||||
bool backQuotedStrings;
|
||||
bool escapeSequence;
|
||||
bool fold;
|
||||
bool foldSyntaxBased;
|
||||
bool foldComment;
|
||||
@@ -227,8 +327,11 @@ struct OptionsCPP {
|
||||
identifiersAllowDollars = true;
|
||||
trackPreprocessor = true;
|
||||
updatePreprocessor = true;
|
||||
verbatimStringsAllowEscapes = false;
|
||||
triplequotedStrings = false;
|
||||
hashquotedStrings = false;
|
||||
backQuotedStrings = false;
|
||||
escapeSequence = false;
|
||||
fold = false;
|
||||
foldSyntaxBased = true;
|
||||
foldComment = false;
|
||||
@@ -243,12 +346,13 @@ struct OptionsCPP {
|
||||
}
|
||||
};
|
||||
|
||||
static const char *const cppWordLists[] = {
|
||||
const char *const cppWordLists[] = {
|
||||
"Primary keywords and identifiers",
|
||||
"Secondary keywords and identifiers",
|
||||
"Documentation comment keywords",
|
||||
"Global classes and typedefs",
|
||||
"Preprocessor definitions",
|
||||
"Task marker and error marker keywords",
|
||||
0,
|
||||
};
|
||||
|
||||
@@ -268,12 +372,21 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
|
||||
DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor,
|
||||
"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,
|
||||
"Set to 1 to enable highlighting of triple-quoted strings.");
|
||||
|
||||
DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings,
|
||||
"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.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 {
|
||||
bool caseSensitive;
|
||||
@@ -321,6 +436,7 @@ class LexerCPP : public ILexerWithSubStyles {
|
||||
CharacterSet setArithmethicOp;
|
||||
CharacterSet setRelOp;
|
||||
CharacterSet setLogicalOp;
|
||||
CharacterSet setWordStart;
|
||||
PPStates vlls;
|
||||
std::vector<PPDefinition> ppDefineHistory;
|
||||
WordList keywords;
|
||||
@@ -328,9 +444,26 @@ class LexerCPP : public ILexerWithSubStyles {
|
||||
WordList keywords3;
|
||||
WordList keywords4;
|
||||
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;
|
||||
OptionSetCPP osCPP;
|
||||
EscapeSequence escapeSeq;
|
||||
SparseState<std::string> rawStringTerminators;
|
||||
enum { activeFlag = 0x40 };
|
||||
enum { ssIdentifier, ssDocKeyword };
|
||||
@@ -417,8 +550,9 @@ public:
|
||||
static int MaskActive(int style) {
|
||||
return style & ~activeFlag;
|
||||
}
|
||||
void EvaluateTokens(std::vector<std::string> &tokens);
|
||||
bool EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions);
|
||||
void EvaluateTokens(std::vector<std::string> &tokens, const SymbolTable &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) {
|
||||
@@ -452,6 +586,9 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
|
||||
case 4:
|
||||
wordListN = &ppDefinitions;
|
||||
break;
|
||||
case 5:
|
||||
wordListN = &markerList;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
if (wordListN) {
|
||||
@@ -469,7 +606,16 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
|
||||
if (cpEquals) {
|
||||
std::string name(cpDefinition, cpEquals - cpDefinition);
|
||||
std::string val(cpEquals+1);
|
||||
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 {
|
||||
std::string name(cpDefinition);
|
||||
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 setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
|
||||
setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true);
|
||||
|
||||
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;
|
||||
bool lastWordWasUUID = false;
|
||||
int styleBeforeDCKeyword = SCE_C_DEFAULT;
|
||||
int styleBeforeTaskMarker = SCE_C_DEFAULT;
|
||||
bool continuationLine = false;
|
||||
bool isIncludePreprocessor = 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);
|
||||
|
||||
bool definitionsChanged = false;
|
||||
@@ -556,12 +703,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
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) {
|
||||
if (itDef->isUndef)
|
||||
preprocessorDefinitions.erase(itDef->key);
|
||||
else
|
||||
preprocessorDefinitions[itDef->key] = itDef->value;
|
||||
preprocessorDefinitions[itDef->key] = SymbolValue(itDef->value, itDef->arguments);
|
||||
}
|
||||
|
||||
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.
|
||||
if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) {
|
||||
// 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);
|
||||
}
|
||||
if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) {
|
||||
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.
|
||||
visibleChars = 0;
|
||||
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 == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
|
||||
if (valid) {
|
||||
if (literalString)
|
||||
sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet);
|
||||
else
|
||||
if (literalString) {
|
||||
if (raw) {
|
||||
// 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);
|
||||
}
|
||||
} else {
|
||||
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('*', '/')) {
|
||||
sc.Forward();
|
||||
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
|
||||
} else {
|
||||
styleBeforeTaskMarker = SCE_C_COMMENT;
|
||||
highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive);
|
||||
}
|
||||
break;
|
||||
case SCE_C_COMMENTDOC:
|
||||
@@ -742,6 +900,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
case SCE_C_COMMENTLINE:
|
||||
if (sc.atLineStart && !continuationLine) {
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
} else {
|
||||
styleBeforeTaskMarker = SCE_C_COMMENTLINE;
|
||||
highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive);
|
||||
}
|
||||
break;
|
||||
case SCE_C_COMMENTLINEDOC:
|
||||
@@ -794,9 +955,11 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
isIncludePreprocessor = false;
|
||||
}
|
||||
} else if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||
sc.Forward();
|
||||
if (options.escapeSequence) {
|
||||
sc.SetState(SCE_C_ESCAPESEQUENCE|activitySet);
|
||||
escapeSeq.resetEscapeState(sc.chNext);
|
||||
}
|
||||
sc.Forward(); // Skip all characters after the backslash
|
||||
} else if (sc.ch == '\"') {
|
||||
if (sc.chNext == '_') {
|
||||
sc.ChangeState(SCE_C_USERLITERAL|activitySet);
|
||||
@@ -805,6 +968,24 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
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:
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||
@@ -860,7 +1041,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
break;
|
||||
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 == '\"') {
|
||||
sc.Forward();
|
||||
} else {
|
||||
@@ -880,6 +1063,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
if (sc.atLineEnd || sc.ch == ')') {
|
||||
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) {
|
||||
@@ -900,6 +1089,10 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
} else if (options.hashquotedStrings && sc.Match('#', '\"')) {
|
||||
sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet);
|
||||
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))) {
|
||||
if (lastWordWasUUID) {
|
||||
sc.SetState(SCE_C_UUID|activitySet);
|
||||
@@ -1018,21 +1211,39 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
} else if (sc.Match("define")) {
|
||||
if (options.updatePreprocessor && !preproc.IsInactive()) {
|
||||
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true);
|
||||
if (restOfLine.find(")") == std::string::npos) { // Don't handle macros with arguments
|
||||
std::vector<std::string> tokens = Tokenize(restOfLine);
|
||||
std::string key;
|
||||
std::string value("1");
|
||||
if (tokens.size() >= 1) {
|
||||
key = tokens[0];
|
||||
if (tokens.size() >= 2) {
|
||||
value = tokens[1];
|
||||
}
|
||||
size_t startName = 0;
|
||||
while ((startName < restOfLine.length()) && IsSpaceOrTab(restOfLine[startName]))
|
||||
startName++;
|
||||
size_t endName = startName;
|
||||
while ((endName < restOfLine.length()) && setWord.Contains(static_cast<unsigned char>(restOfLine[endName])))
|
||||
endName++;
|
||||
std::string key = restOfLine.substr(startName, endName-startName);
|
||||
if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) {
|
||||
// Macro
|
||||
size_t endArgs = endName;
|
||||
while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')'))
|
||||
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")) {
|
||||
if (options.updatePreprocessor && !preproc.IsInactive()) {
|
||||
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, true);
|
||||
@@ -1140,14 +1351,14 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) {
|
||||
if (ch == '{') {
|
||||
if (ch == '{' || ch == '[') {
|
||||
// Measure the minimum before a '{' to allow
|
||||
// folding on "} else {"
|
||||
if (levelMinCurrent > levelNext) {
|
||||
levelMinCurrent = levelNext;
|
||||
}
|
||||
levelNext++;
|
||||
} else if (ch == '}') {
|
||||
} else if (ch == '}' || ch == ']') {
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
@@ -1180,41 +1391,119 @@ 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
|
||||
for (size_t i=0; (i+2)<tokens.size();) {
|
||||
if ((tokens[i] == "defined") && (tokens[i+1] == "(")) {
|
||||
// Remove whitespace tokens
|
||||
tokens.erase(std::remove_if(tokens.begin(), tokens.end(), OnlySpaceOrTab), tokens.end());
|
||||
|
||||
// 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";
|
||||
if (tokens[i+2] == ")") {
|
||||
if (tokens[i+1] == "(") {
|
||||
if (((i + 2)<tokens.size()) && (tokens[i + 2] == ")")) {
|
||||
// defined()
|
||||
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3);
|
||||
} else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) {
|
||||
// defined(<int>)
|
||||
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4);
|
||||
// defined(<identifier>)
|
||||
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;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
std::vector<std::string>::iterator itBracket = std::find(tokens.begin(), tokens.end(), "(");
|
||||
std::vector<std::string>::iterator itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
|
||||
while ((itBracket != tokens.end()) && (itEndBracket != tokens.end()) && (itEndBracket > itBracket)) {
|
||||
std::vector<std::string> inBracket(itBracket + 1, itEndBracket);
|
||||
EvaluateTokens(inBracket);
|
||||
BracketPair bracketPair = FindBracketPair(tokens);
|
||||
while (bracketPair.itBracket != tokens.end()) {
|
||||
std::vector<std::string> inBracket(bracketPair.itBracket + 1, bracketPair.itEndBracket);
|
||||
EvaluateTokens(inBracket, preprocessorDefinitions);
|
||||
|
||||
// The insertion is done before the removal because there were failures with the opposite approach
|
||||
tokens.insert(itBracket, inBracket.begin(), inBracket.end());
|
||||
itBracket = std::find(tokens.begin(), tokens.end(), "(");
|
||||
itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
|
||||
tokens.erase(itBracket, itEndBracket + 1);
|
||||
tokens.insert(bracketPair.itBracket, inBracket.begin(), inBracket.end());
|
||||
|
||||
itBracket = std::find(tokens.begin(), tokens.end(), "(");
|
||||
itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
|
||||
bracketPair = FindBracketPair(tokens);
|
||||
tokens.erase(bracketPair.itBracket, bracketPair.itEndBracket + 1);
|
||||
|
||||
bracketPair = FindBracketPair(tokens);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// Break into tokens, replacing with definitions
|
||||
std::string word;
|
||||
std::vector<std::string> LexerCPP::Tokenize(const std::string &expr) const {
|
||||
// Break into tokens
|
||||
std::vector<std::string> tokens;
|
||||
const char *cp = expr.c_str();
|
||||
for (;;) {
|
||||
while (*cp) {
|
||||
std::string word;
|
||||
if (setWord.Contains(static_cast<unsigned char>(*cp))) {
|
||||
// Identifiers and numbers
|
||||
while (setWord.Contains(static_cast<unsigned char>(*cp))) {
|
||||
word += *cp;
|
||||
} else {
|
||||
std::map<std::string, std::string>::const_iterator it = preprocessorDefinitions.find(word);
|
||||
if (it != preprocessorDefinitions.end()) {
|
||||
tokens.push_back(it->second);
|
||||
} else if (!word.empty() && ((word[0] >= '0' && word[0] <= '9') || (word == "defined"))) {
|
||||
tokens.push_back(word);
|
||||
cp++;
|
||||
}
|
||||
word = "";
|
||||
if (!*cp) {
|
||||
break;
|
||||
} else if (IsSpaceOrTab(*cp)) {
|
||||
while (IsSpaceOrTab(*cp)) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
}
|
||||
if ((*cp != ' ') && (*cp != '\t')) {
|
||||
std::string op(cp, 1);
|
||||
} else if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
if (setRelOp.Contains(static_cast<unsigned char>(cp[1]))) {
|
||||
op += cp[1];
|
||||
word += *cp;
|
||||
cp++;
|
||||
}
|
||||
} else if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
if (setLogicalOp.Contains(static_cast<unsigned char>(cp[1]))) {
|
||||
op += cp[1];
|
||||
word += *cp;
|
||||
cp++;
|
||||
if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
|
||||
word += *cp;
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
tokens.push_back(op);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Should handle strings, characters, and comments here
|
||||
word += *cp;
|
||||
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
|
||||
bool isFalse = tokens.empty() ||
|
||||
|
||||
@@ -31,11 +31,8 @@ using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static bool IsSpaceEquiv(int state) {
|
||||
return (state <= SCE_COFFEESCRIPT_COMMENTDOC
|
||||
// including SCE_COFFEESCRIPT_DEFAULT, SCE_COFFEESCRIPT_COMMENT, SCE_COFFEESCRIPT_COMMENTLINE
|
||||
|| state == SCE_COFFEESCRIPT_COMMENTLINEDOC
|
||||
|| state == SCE_COFFEESCRIPT_COMMENTDOCKEYWORD
|
||||
|| state == SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR
|
||||
return (state == SCE_COFFEESCRIPT_DEFAULT
|
||||
|| state == SCE_COFFEESCRIPT_COMMENTLINE
|
||||
|| state == SCE_COFFEESCRIPT_COMMENTBLOCK
|
||||
|| state == SCE_COFFEESCRIPT_VERBOSE_REGEX
|
||||
|| 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 &keywords2 = *keywordlists[1];
|
||||
WordList &keywords3 = *keywordlists[2];
|
||||
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 setCouldBePostOp(CharacterSet::setNone, "+-");
|
||||
|
||||
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
|
||||
|
||||
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('$');
|
||||
}
|
||||
CharacterSet setWordStart(CharacterSet::setAlpha, "_$@", 0x80, true);
|
||||
CharacterSet setWord(CharacterSet::setAlphaNum, "._$", 0x80, true);
|
||||
|
||||
int chPrevNonWhite = ' ';
|
||||
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
|
||||
int endPos = startPos + length;
|
||||
@@ -158,23 +120,9 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
|
||||
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.
|
||||
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.
|
||||
@@ -193,7 +141,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
char s[1000];
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
if (keywords.InList(s)) {
|
||||
lastWordWasUUID = strcmp(s, "uuid") == 0;
|
||||
sc.ChangeState(SCE_COFFEESCRIPT_WORD);
|
||||
} else if (keywords2.InList(s)) {
|
||||
sc.ChangeState(SCE_COFFEESCRIPT_WORD2);
|
||||
@@ -210,74 +157,13 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
|
||||
}
|
||||
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:
|
||||
if (sc.atLineStart) {
|
||||
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
|
||||
}
|
||||
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:
|
||||
if (isIncludePreprocessor) {
|
||||
if (sc.ch == '>') {
|
||||
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
|
||||
isIncludePreprocessor = false;
|
||||
}
|
||||
} else if (sc.ch == '\\') {
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||
sc.Forward();
|
||||
}
|
||||
@@ -314,20 +200,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
|
||||
}
|
||||
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:
|
||||
if (sc.Match("###")) {
|
||||
sc.Forward();
|
||||
@@ -357,30 +229,10 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
|
||||
// Determine if a new state should be entered.
|
||||
if (sc.state == SCE_COFFEESCRIPT_DEFAULT) {
|
||||
if (sc.Match('@', '\"')) {
|
||||
sc.SetState(SCE_COFFEESCRIPT_VERBATIM);
|
||||
sc.Forward();
|
||||
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
if (lastWordWasUUID) {
|
||||
sc.SetState(SCE_COFFEESCRIPT_UUID);
|
||||
lastWordWasUUID = false;
|
||||
} else {
|
||||
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
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 {
|
||||
} else if (setWordStart.Contains(sc.ch)) {
|
||||
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("///")) {
|
||||
sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX);
|
||||
sc.Forward();
|
||||
@@ -393,9 +245,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx
|
||||
} else if (sc.ch == '\"') {
|
||||
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 == '\'') {
|
||||
sc.SetState(SCE_COFFEESCRIPT_CHARACTER);
|
||||
} else if (sc.ch == '#') {
|
||||
@@ -403,7 +252,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
sc.SetState(SCE_COFFEESCRIPT_COMMENTBLOCK);
|
||||
sc.Forward();
|
||||
sc.Forward();
|
||||
|
||||
} else {
|
||||
sc.SetState(SCE_COFFEESCRIPT_COMMENTLINE);
|
||||
}
|
||||
@@ -416,7 +264,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|
||||
chPrevNonWhite = sc.ch;
|
||||
visibleChars++;
|
||||
}
|
||||
continuationLine = false;
|
||||
}
|
||||
sc.Complete();
|
||||
}
|
||||
@@ -428,10 +275,6 @@ static bool IsCommentLine(int line, Accessor &styler) {
|
||||
char ch = styler[i];
|
||||
if (ch == '#')
|
||||
return true;
|
||||
else if (ch == '/'
|
||||
&& i < eol_pos - 1
|
||||
&& styler[i + 1] == '*')
|
||||
return true;
|
||||
else if (ch != ' ' && ch != '\t')
|
||||
return false;
|
||||
}
|
||||
@@ -563,6 +406,9 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
|
||||
|
||||
static const char *const csWordLists[] = {
|
||||
"Keywords",
|
||||
"Secondary keywords",
|
||||
"Unused",
|
||||
"Global classes",
|
||||
0,
|
||||
};
|
||||
|
||||
|
||||
355
src/stc/scintilla/lexers/LexDMIS.cxx
Normal file
355
src/stc/scintilla/lexers/LexDMIS.cxx
Normal 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);
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4786)
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexFortran.cxx
|
||||
** 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>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
@@ -576,8 +576,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
WordList &keywords5 = *keywordlists[4];
|
||||
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
|
||||
|
||||
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers
|
||||
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
|
||||
styler.StartAt(startPos);
|
||||
char prevWord[200];
|
||||
prevWord[0] = '\0';
|
||||
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)
|
||||
state = SCE_H_DEFAULT;
|
||||
}
|
||||
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
|
||||
styler.StartAt(startPos);
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int lineState;
|
||||
@@ -811,8 +810,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
}
|
||||
styler.SetLineState(lineCurrent,
|
||||
((inScriptType & 0x03) << 0) |
|
||||
((tagOpened & 0x01) << 2) |
|
||||
((tagClosing & 0x01) << 3) |
|
||||
((tagOpened ? 1 : 0) << 2) |
|
||||
((tagClosing ? 1 : 0) << 3) |
|
||||
((aspScript & 0x0F) << 4) |
|
||||
((clientScript & 0x0F) << 8) |
|
||||
((beforePreProc & 0xFF) << 12));
|
||||
@@ -823,19 +822,27 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
// handle start of Mako comment line
|
||||
if (isMako && ch == '#' && chNext == '#') {
|
||||
makoComment = 1;
|
||||
state = SCE_HP_COMMENTLINE;
|
||||
}
|
||||
|
||||
// handle end of Mako comment line
|
||||
else if (isMako && makoComment && (ch == '\r' || ch == '\n')) {
|
||||
makoComment = 0;
|
||||
styler.ColourTo(i, SCE_HP_COMMENTLINE);
|
||||
styler.ColourTo(i, StateToPrint);
|
||||
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
|
||||
if (((ch == '\r' && chNext != '\n') || (ch == '\n')) &&
|
||||
(!isMako || (0 != strcmp(makoBlockType, "%")))) {
|
||||
}
|
||||
// Ignore everything in mako comment until the line ends
|
||||
else if (isMako && makoComment) {
|
||||
}
|
||||
|
||||
// generic end of script processing
|
||||
else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) {
|
||||
@@ -2180,6 +2187,6 @@ static const char * const phpscriptWordListDesc[] = {
|
||||
0,
|
||||
};
|
||||
|
||||
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc, 8);
|
||||
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc, 8);
|
||||
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 8);
|
||||
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc);
|
||||
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc);
|
||||
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc);
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "CharacterCategory.h"
|
||||
#include "LexerModule.h"
|
||||
#include "OptionSet.h"
|
||||
#include "CharacterCategory.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
|
||||
1045
src/stc/scintilla/lexers/LexHex.cxx
Normal file
1045
src/stc/scintilla/lexers/LexHex.cxx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@
|
||||
**/
|
||||
// Copyright 2004 by Manfred Becker <manfred@becker-trdf.de>
|
||||
// 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 <string.h>
|
||||
@@ -54,6 +55,10 @@ static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (sc.atLineEnd) {
|
||||
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) {
|
||||
// This is a doubles quotes string
|
||||
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.ch == ';') {
|
||||
sc.SetState(SCE_KIX_COMMENT);
|
||||
} else if (sc.ch == '/' && sc.chNext == '*') {
|
||||
sc.SetState(SCE_KIX_COMMENTSTREAM);
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_KIX_STRING1);
|
||||
} else if (sc.ch == '\'') {
|
||||
|
||||
@@ -141,7 +141,7 @@ static void ColouriseLuaDoc(
|
||||
char s[100];
|
||||
while (setWord.Contains(c = sc.GetRelative(ln))) { // get potential label
|
||||
if (i < 90)
|
||||
s[i++] = c;
|
||||
s[i++] = static_cast<char>(c);
|
||||
ln++;
|
||||
}
|
||||
s[i] = '\0'; int lbl = ln;
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
** - added ... displayed as a comment
|
||||
** - removed unused IsAWord functions
|
||||
** - added some comments
|
||||
**
|
||||
** Changes by John Donoghue 2014/08/01
|
||||
** - fix allowed transpose ' after {} operator
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@@ -218,7 +221,7 @@ static void ColouriseMatlabOctaveDoc(
|
||||
} else if (isalpha(sc.ch)) {
|
||||
sc.SetState(SCE_MATLAB_KEYWORD);
|
||||
} 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;
|
||||
} else {
|
||||
transpose = false;
|
||||
|
||||
@@ -570,4 +570,4 @@ static const char * const mysqlWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc, 7);
|
||||
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc);
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
** 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 <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -72,7 +78,6 @@ static void ColourisePSDoc(
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
bool tokenizing = styler.GetPropertyInt("ps.tokenize") != 0;
|
||||
int pslevel = styler.GetPropertyInt("ps.level", 3);
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int nestTextCurrent = 0;
|
||||
@@ -83,15 +88,6 @@ static void ColourisePSDoc(
|
||||
bool numHasExponent = 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()) {
|
||||
if (sc.atLineStart)
|
||||
lineCurrent = styler.GetLine(sc.currentPos);
|
||||
@@ -196,7 +192,6 @@ static void ColourisePSDoc(
|
||||
|
||||
// Determine if a new state should be entered.
|
||||
if (sc.state == SCE_C_DEFAULT) {
|
||||
unsigned int tokenpos = sc.currentPos;
|
||||
|
||||
if (sc.ch == '[' || sc.ch == ']') {
|
||||
sc.SetState(SCE_PS_PAREN_ARRAY);
|
||||
@@ -262,17 +257,6 @@ static void ColourisePSDoc(
|
||||
} else if (!IsAWhitespaceChar(sc.ch)) {
|
||||
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)
|
||||
@@ -296,11 +280,10 @@ static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
int levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style;
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
style = styleNext;
|
||||
int style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac??
|
||||
if ((style & 31) == SCE_PS_PAREN_PROC) {
|
||||
|
||||
@@ -662,7 +662,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
|
||||
} else if (initStyle == SCE_PL_POD
|
||||
|| 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);
|
||||
if (ln > 0) {
|
||||
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);
|
||||
HereDoc.State = 3;
|
||||
} else {
|
||||
// invalid indentifier; inexact fallback, but hey
|
||||
// invalid identifier; inexact fallback, but hey
|
||||
sc.ChangeState(SCE_PL_IDENTIFIER);
|
||||
sc.SetState(SCE_PL_DEFAULT);
|
||||
}
|
||||
} else {
|
||||
sc.ChangeState(SCE_PL_DEFAULT); // invalid indentifier
|
||||
sc.ChangeState(SCE_PL_DEFAULT); // invalid identifier
|
||||
}
|
||||
backFlag = BACK_NONE;
|
||||
break;
|
||||
@@ -1726,4 +1726,4 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc, 8);
|
||||
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc);
|
||||
|
||||
416
src/stc/scintilla/lexers/LexRegistry.cxx
Normal file
416
src/stc/scintilla/lexers/LexRegistry.cxx
Normal 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);
|
||||
|
||||
@@ -216,7 +216,7 @@ static void advance_char(int &i, char &ch, char &chNext, char &chNext2) {
|
||||
}
|
||||
|
||||
// precondition: startPos points to one after the EOL char
|
||||
static bool currLineContainsHereDelims(int& startPos,
|
||||
static bool currLineContainsHereDelims(int &startPos,
|
||||
Accessor &styler) {
|
||||
if (startPos <= 1)
|
||||
return false;
|
||||
@@ -249,7 +249,7 @@ static bool currLineContainsHereDelims(int& startPos,
|
||||
// to be hoisted out of the function.
|
||||
|
||||
class QuoteCls {
|
||||
public:
|
||||
public:
|
||||
int Count;
|
||||
char Up;
|
||||
char Down;
|
||||
@@ -266,13 +266,13 @@ class QuoteCls {
|
||||
Up = u;
|
||||
Down = opposite(Up);
|
||||
}
|
||||
QuoteCls(const QuoteCls& q) {
|
||||
QuoteCls(const QuoteCls &q) {
|
||||
// copy constructor -- use this for copying in
|
||||
Count = q.Count;
|
||||
Up = q.Up;
|
||||
Down = q.Down;
|
||||
}
|
||||
QuoteCls& operator=(const QuoteCls& q) { // assignment constructor
|
||||
QuoteCls &operator=(const QuoteCls &q) { // assignment constructor
|
||||
if (this != &q) {
|
||||
Count = q.Count;
|
||||
Up = q.Up;
|
||||
@@ -287,9 +287,9 @@ class QuoteCls {
|
||||
static void enterInnerExpression(int *p_inner_string_types,
|
||||
int *p_inner_expn_brace_counts,
|
||||
QuoteCls *p_inner_quotes,
|
||||
int& inner_string_count,
|
||||
int& state,
|
||||
int& brace_counts,
|
||||
int &inner_string_count,
|
||||
int &state,
|
||||
int &brace_counts,
|
||||
QuoteCls curr_quote
|
||||
) {
|
||||
p_inner_string_types[inner_string_count] = state;
|
||||
@@ -303,10 +303,10 @@ static void enterInnerExpression(int *p_inner_string_types,
|
||||
static void exitInnerExpression(int *p_inner_string_types,
|
||||
int *p_inner_expn_brace_counts,
|
||||
QuoteCls *p_inner_quotes,
|
||||
int& inner_string_count,
|
||||
int& state,
|
||||
int& brace_counts,
|
||||
QuoteCls& curr_quote
|
||||
int &inner_string_count,
|
||||
int &state,
|
||||
int &brace_counts,
|
||||
QuoteCls &curr_quote
|
||||
) {
|
||||
--inner_string_count;
|
||||
state = p_inner_string_types[inner_string_count];
|
||||
@@ -604,7 +604,7 @@ static bool sureThisIsNotHeredoc(int lt2StartPos,
|
||||
// move to the start of the first line that is not in a
|
||||
// multi-line construct
|
||||
|
||||
static void synchronizeDocStart(unsigned int& startPos,
|
||||
static void synchronizeDocStart(unsigned int &startPos,
|
||||
int &length,
|
||||
int &initStyle,
|
||||
Accessor &styler,
|
||||
@@ -705,8 +705,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
char chPrev = styler.SafeGetCharAt(startPos - 1);
|
||||
char chNext = styler.SafeGetCharAt(startPos);
|
||||
bool is_real_number = true; // Differentiate between constants and ?-sequences.
|
||||
// Ruby uses a different mask because bad indentation is marked by oring with 32
|
||||
styler.StartAt(startPos, 127);
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
|
||||
static int q_states[] = {SCE_RB_STRING_Q,
|
||||
@@ -714,8 +713,9 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
SCE_RB_STRING_QR,
|
||||
SCE_RB_STRING_QW,
|
||||
SCE_RB_STRING_QW,
|
||||
SCE_RB_STRING_QX};
|
||||
static const char* q_chars = "qQrwWx";
|
||||
SCE_RB_STRING_QX
|
||||
};
|
||||
static const char *q_chars = "qQrwWx";
|
||||
|
||||
// In most cases a value of 2 should be ample for the code in the
|
||||
// Ruby library, and the code the user is likely to enter.
|
||||
@@ -731,7 +731,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
// If anyone runs into this problem, I recommend raising this
|
||||
// value slightly higher to replacing the fixed array with a linked
|
||||
// list. Keep in mind this code will be called everytime the lexer
|
||||
// list. Keep in mind this code will be called every time the lexer
|
||||
// is invoked.
|
||||
|
||||
#define INNER_STRINGS_MAX_COUNT 5
|
||||
@@ -850,7 +850,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
chNext = chNext2;
|
||||
styler.ColourTo(i, SCE_RB_OPERATOR);
|
||||
|
||||
if (! (strchr("\"\'`_-", chNext2) || isSafeAlpha(chNext2))) {
|
||||
if (!(strchr("\"\'`_-", chNext2) || isSafeAlpha(chNext2))) {
|
||||
// It's definitely not a here-doc,
|
||||
// based on Ruby's lexer/parser in the
|
||||
// heredoc_identifier routine.
|
||||
@@ -883,13 +883,38 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
preferRE = false;
|
||||
} else if (isSafeWordcharOrHigh(chNext)) {
|
||||
state = SCE_RB_SYMBOL;
|
||||
} else if ((chNext == '@' || chNext == '$') &&
|
||||
isSafeWordcharOrHigh(chNext2)) {
|
||||
// instance and global variable followed by an identifier
|
||||
advance_char(i, ch, chNext, chNext2);
|
||||
state = SCE_RB_SYMBOL;
|
||||
} else if (((chNext == '@' && chNext2 == '@') ||
|
||||
(chNext == '$' && chNext2 == '-')) &&
|
||||
isSafeWordcharOrHigh(styler.SafeGetCharAt(i+3))) {
|
||||
// class variables and special global variable "$-IDENTCHAR"
|
||||
state = SCE_RB_SYMBOL;
|
||||
// $-IDENTCHAR doesn't continue past the IDENTCHAR
|
||||
if (chNext == '$') {
|
||||
styler.ColourTo(i+3, SCE_RB_SYMBOL);
|
||||
state = SCE_RB_DEFAULT;
|
||||
}
|
||||
i += 3;
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
chNext = styler.SafeGetCharAt(i+1);
|
||||
} else if (chNext == '$' && strchr("_~*$?!@/\\;,.=:<>\"&`'+", chNext2)) {
|
||||
// single-character special global variables
|
||||
i += 2;
|
||||
ch = chNext2;
|
||||
chNext = styler.SafeGetCharAt(i+1);
|
||||
styler.ColourTo(i, SCE_RB_SYMBOL);
|
||||
state = SCE_RB_DEFAULT;
|
||||
} else if (strchr("[*!~+-*/%=<>&^|", chNext)) {
|
||||
// Do the operator analysis in-line, looking ahead
|
||||
// Based on the table in pickaxe 2nd ed., page 339
|
||||
bool doColoring = true;
|
||||
switch (chNext) {
|
||||
case '[':
|
||||
if (chNext2 == ']' ) {
|
||||
if (chNext2 == ']') {
|
||||
char ch_tmp = styler.SafeGetCharAt(i + 3);
|
||||
if (ch_tmp == '=') {
|
||||
i += 3;
|
||||
@@ -1261,7 +1286,16 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else if (state == SCE_RB_CLASS_VAR
|
||||
|| state == SCE_RB_INSTANCE_VAR
|
||||
|| state == SCE_RB_SYMBOL) {
|
||||
if (!isSafeWordcharOrHigh(ch)) {
|
||||
if (state == SCE_RB_SYMBOL &&
|
||||
// FIDs suffices '?' and '!'
|
||||
(((ch == '!' || ch == '?') && chNext != '=') ||
|
||||
// identifier suffix '='
|
||||
(ch == '=' && (chNext != '~' && chNext != '>' &&
|
||||
(chNext != '=' || chNext2 == '>'))))) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_RB_DEFAULT;
|
||||
preferRE = false;
|
||||
} else if (!isSafeWordcharOrHigh(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
redo_char(i, ch, chNext, chNext2, state); // pass by ref
|
||||
preferRE = false;
|
||||
@@ -1313,7 +1347,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
// Only if close quoter != open quoter
|
||||
Quote.Count++;
|
||||
|
||||
} else if (ch == '#' ) {
|
||||
} else if (ch == '#') {
|
||||
if (chNext == '{'
|
||||
&& inner_string_count < INNER_STRINGS_MAX_COUNT) {
|
||||
// process #{ ... }
|
||||
@@ -1617,6 +1651,19 @@ static bool keywordDoStartsLoop(int pos,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsCommentLine(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];
|
||||
if (ch == '#')
|
||||
return true;
|
||||
else if (ch != ' ' && ch != '\t')
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Folding Ruby
|
||||
*
|
||||
@@ -1695,6 +1742,17 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
int style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
|
||||
/*Mutiline comment patch*/
|
||||
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) {
|
||||
if (!IsCommentLine(lineCurrent - 1, styler)
|
||||
&& IsCommentLine(lineCurrent + 1, styler))
|
||||
levelCurrent++;
|
||||
else if (IsCommentLine(lineCurrent - 1, styler)
|
||||
&& !IsCommentLine(lineCurrent + 1, styler))
|
||||
levelCurrent--;
|
||||
}
|
||||
|
||||
if (style == SCE_RB_COMMENTLINE) {
|
||||
if (foldComment && stylePrev != SCE_RB_COMMENTLINE) {
|
||||
if (chNext == '{') {
|
||||
@@ -1720,7 +1778,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
// Don't decrement below 0
|
||||
if (levelCurrent > 0)
|
||||
levelCurrent--;
|
||||
} else if ( !strcmp(prevWord, "if")
|
||||
} else if (!strcmp(prevWord, "if")
|
||||
|| !strcmp(prevWord, "def")
|
||||
|| !strcmp(prevWord, "class")
|
||||
|| !strcmp(prevWord, "module")
|
||||
@@ -1771,9 +1829,9 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
styler.SetLevel(lineCurrent, levelCurrent|SC_FOLDLEVELBASE);
|
||||
}
|
||||
|
||||
static const char * const rubyWordListDesc[] = {
|
||||
static const char *const rubyWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc, 6);
|
||||
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
@@ -28,7 +29,6 @@
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
#include "OptionSet.h"
|
||||
#include "PropSetSimple.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
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 (;;) {
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (IsADigit(c, base) || c == '_')
|
||||
@@ -238,13 +240,17 @@ static void ScanDigits(Accessor& styler, int& pos, int base) {
|
||||
else
|
||||
break;
|
||||
}
|
||||
return old_pos != pos;
|
||||
}
|
||||
|
||||
/* Scans an integer and floating point literals. */
|
||||
static void ScanNumber(Accessor& styler, int& pos) {
|
||||
int base = 10;
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
int n = styler.SafeGetCharAt(pos + 1, '\0');
|
||||
bool error = false;
|
||||
/* Scan the prefix, thus determining the base.
|
||||
* 10 is default if there's no prefix. */
|
||||
if (c == '0' && n == 'x') {
|
||||
pos += 2;
|
||||
base = 16;
|
||||
@@ -255,14 +261,17 @@ static void ScanNumber(Accessor& styler, int& pos) {
|
||||
pos += 2;
|
||||
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');
|
||||
if (c == 'u' || c == 'i') {
|
||||
pos++;
|
||||
c = styler.SafeGetCharAt(pos, '\0');
|
||||
n = styler.SafeGetCharAt(pos + 1, '\0');
|
||||
if (c == '8') {
|
||||
if (c == '8' || c == 's') {
|
||||
pos++;
|
||||
} else if (c == '1' && n == '6') {
|
||||
pos += 2;
|
||||
@@ -270,15 +279,25 @@ static void ScanNumber(Accessor& styler, int& pos) {
|
||||
pos += 2;
|
||||
} else if (c == '6' && n == '4') {
|
||||
pos += 2;
|
||||
}
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
/* 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');
|
||||
if (c == '.' && !(IsIdentifierStart(n) || n == '.')) {
|
||||
error |= base != 10;
|
||||
pos++;
|
||||
/* It's ok to have no digits after the period. */
|
||||
ScanDigits(styler, pos, 10);
|
||||
}
|
||||
|
||||
/* Look for the exponentiation. */
|
||||
c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (c == 'e' || c == 'E') {
|
||||
error |= base != 10;
|
||||
@@ -286,13 +305,11 @@ static void ScanNumber(Accessor& styler, int& pos) {
|
||||
c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (c == '-' || c == '+')
|
||||
pos++;
|
||||
int old_pos = pos;
|
||||
ScanDigits(styler, pos, 10);
|
||||
if (old_pos == pos) {
|
||||
error = true;
|
||||
}
|
||||
/* It is invalid to have no digits in the exponent. */
|
||||
error |= !ScanDigits(styler, pos, 10);
|
||||
}
|
||||
|
||||
/* Scan the floating point suffix. */
|
||||
c = styler.SafeGetCharAt(pos, '\0');
|
||||
if (c == 'f') {
|
||||
error |= base != 10;
|
||||
@@ -308,9 +325,7 @@ static void ScanNumber(Accessor& styler, int& pos) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (old_pos == pos) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
if (error)
|
||||
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
|
||||
else
|
||||
@@ -351,7 +366,7 @@ static bool IsValidCharacterEscape(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) {
|
||||
@@ -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
|
||||
* character literals. */
|
||||
static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos) {
|
||||
static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos, bool ascii_only) {
|
||||
pos++;
|
||||
int c = styler.SafeGetCharAt(pos, '\0');
|
||||
int n = styler.SafeGetCharAt(pos + 1, '\0');
|
||||
bool done = false;
|
||||
bool valid_lifetime = IsIdentifierStart(c);
|
||||
bool valid_lifetime = !ascii_only && IsIdentifierStart(c);
|
||||
bool valid_char = true;
|
||||
bool first = true;
|
||||
while (!done) {
|
||||
@@ -390,10 +405,10 @@ static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos) {
|
||||
} else if (n == 'x') {
|
||||
pos += 2;
|
||||
valid_char = ScanNumericEscape(styler, pos, 2, false);
|
||||
} else if (n == 'u') {
|
||||
} else if (n == 'u' && !ascii_only) {
|
||||
pos += 2;
|
||||
valid_char = ScanNumericEscape(styler, pos, 4, false);
|
||||
} else if (n == 'U') {
|
||||
} else if (n == 'U' && !ascii_only) {
|
||||
pos += 2;
|
||||
valid_char = ScanNumericEscape(styler, pos, 8, false);
|
||||
} else {
|
||||
@@ -412,7 +427,10 @@ static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos) {
|
||||
done = true;
|
||||
break;
|
||||
default:
|
||||
if (!IsIdentifierContinue(c) && !first) {
|
||||
if (ascii_only && !IsASCII((char)c)) {
|
||||
done = true;
|
||||
valid_char = false;
|
||||
} else if (!IsIdentifierContinue(c) && !first) {
|
||||
done = true;
|
||||
} else {
|
||||
pos++;
|
||||
@@ -433,7 +451,7 @@ static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos) {
|
||||
styler.ColourTo(pos - 1, SCE_RUST_LIFETIME);
|
||||
} else if (valid_char) {
|
||||
pos++;
|
||||
styler.ColourTo(pos - 1, SCE_RUST_CHARACTER);
|
||||
styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTECHARACTER : SCE_RUST_CHARACTER);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
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');
|
||||
bool error = false;
|
||||
while (c != '"' && !error) {
|
||||
@@ -559,10 +577,10 @@ static void ResumeString(Accessor &styler, int& pos, int max) {
|
||||
} else if (n == 'x') {
|
||||
pos += 2;
|
||||
error = !ScanNumericEscape(styler, pos, 2, true);
|
||||
} else if (n == 'u') {
|
||||
} else if (n == 'u' && !ascii_only) {
|
||||
pos += 2;
|
||||
error = !ScanNumericEscape(styler, pos, 4, true);
|
||||
} else if (n == 'U') {
|
||||
} else if (n == 'U' && !ascii_only) {
|
||||
pos += 2;
|
||||
error = !ScanNumericEscape(styler, pos, 8, true);
|
||||
} else {
|
||||
@@ -570,16 +588,19 @@ static void ResumeString(Accessor &styler, int& pos, int max) {
|
||||
error = true;
|
||||
}
|
||||
} else {
|
||||
if (ascii_only && !IsASCII((char)c))
|
||||
error = true;
|
||||
else
|
||||
pos++;
|
||||
}
|
||||
c = styler.SafeGetCharAt(pos, '\0');
|
||||
}
|
||||
if (!error)
|
||||
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 (;;) {
|
||||
if (pos == styler.LineEnd(styler.GetLine(pos)))
|
||||
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) {
|
||||
styler.SetLineState(styler.GetLine(pos), 0);
|
||||
styler.ColourTo(pos - 1, SCE_RUST_STRINGR);
|
||||
break;
|
||||
}
|
||||
} else if (pos >= max) {
|
||||
styler.ColourTo(pos - 1, SCE_RUST_STRINGR);
|
||||
break;
|
||||
} else {
|
||||
if (ascii_only && !IsASCII((char)c))
|
||||
break;
|
||||
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++;
|
||||
int num_hashes = 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);
|
||||
} else {
|
||||
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) {
|
||||
ResumeLineComment(styler, pos, max, initStyle == SCE_RUST_COMMENTLINEDOC ? DocComment : NotDocComment);
|
||||
} 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) {
|
||||
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) {
|
||||
@@ -645,7 +671,7 @@ void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle,
|
||||
int n = styler.SafeGetCharAt(pos + 1, '\0');
|
||||
int n2 = styler.SafeGetCharAt(pos + 2, '\0');
|
||||
|
||||
if (pos == 0 && c == '#' && n == '!') {
|
||||
if (pos == 0 && c == '#' && n == '!' && n2 != '[') {
|
||||
pos += 2;
|
||||
ResumeLineComment(styler, pos, max, NotDocComment);
|
||||
} 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 == '*')) {
|
||||
ScanComments(styler, pos, max);
|
||||
} 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)) {
|
||||
ScanIdentifier(styler, pos, keywords);
|
||||
} else if (IsADigit(c)) {
|
||||
@@ -668,10 +703,10 @@ void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle,
|
||||
pos++;
|
||||
styler.ColourTo(pos - 1, SCE_RUST_OPERATOR);
|
||||
} else if (c == '\'') {
|
||||
ScanCharacterLiteralOrLifetime(styler, pos);
|
||||
ScanCharacterLiteralOrLifetime(styler, pos, false);
|
||||
} else if (c == '"') {
|
||||
pos++;
|
||||
ResumeString(styler, pos, max);
|
||||
ResumeString(styler, pos, max, false);
|
||||
} else {
|
||||
pos++;
|
||||
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
|
||||
|
||||
@@ -54,12 +54,12 @@ static inline bool IsADoxygenChar(int 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.)
|
||||
// but probably enough in most cases.
|
||||
return (ch < 0x80) &&
|
||||
(isdigit(ch) || toupper(ch) == 'E' ||
|
||||
ch == '.' || ch == '-' || ch == '+');
|
||||
ch == '.' || ((ch == '-' || ch == '+') && chPrev < 0x80 && toupper(chPrev) == 'E'));
|
||||
}
|
||||
|
||||
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);
|
||||
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
|
||||
int offset = 0;
|
||||
|
||||
for (; sc.More(); sc.Forward(), offset++) {
|
||||
// Determine if the current state should terminate.
|
||||
switch (sc.state) {
|
||||
@@ -452,7 +453,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
|
||||
break;
|
||||
case SCE_SQL_NUMBER:
|
||||
// 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);
|
||||
}
|
||||
break;
|
||||
@@ -556,11 +557,45 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
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.
|
||||
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);
|
||||
} else if (IsAWordStart(sc.ch)) {
|
||||
sc.SetState(SCE_SQL_IDENTIFIER);
|
||||
|
||||
@@ -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];
|
||||
|
||||
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
||||
char prevWord[200];
|
||||
prevWord[0] = '\0';
|
||||
if (length == 0) return;
|
||||
@@ -143,37 +142,9 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
char chPrev2 = ' ';
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
bool atStartLine = true;
|
||||
int spaceFlags = 0;
|
||||
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;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
@@ -185,7 +156,6 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
}
|
||||
atStartLine = true;
|
||||
}
|
||||
|
||||
if (styler.IsLeadByte(ch))
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
@@ -51,7 +51,8 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k
|
||||
bool commentLevel = false;
|
||||
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,
|
||||
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;
|
||||
int currentLevel = 0;
|
||||
bool expected = 0;
|
||||
@@ -108,15 +109,14 @@ next:
|
||||
sc.SetState(SCE_TCL_OPERATOR);
|
||||
sc.ForwardSetState(SCE_TCL_DEFAULT);
|
||||
goto next;
|
||||
}
|
||||
else
|
||||
} else
|
||||
sc.SetState(SCE_TCL_SUB_BRACE);
|
||||
if (!sc.atLineEnd)
|
||||
continue;
|
||||
} 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 =='#';
|
||||
} else if (sc.state == SCE_TCL_SUBSTITUTION) {
|
||||
switch(sc.ch) {
|
||||
switch (sc.ch) {
|
||||
case '(':
|
||||
subParen=true;
|
||||
sc.SetState(SCE_TCL_OPERATOR);
|
||||
@@ -149,7 +149,7 @@ next:
|
||||
sc.GetCurrent(w, sizeof(w));
|
||||
if (w[strlen(w)-1]=='\r')
|
||||
w[strlen(w)-1]=0;
|
||||
while(*s == ':') // ignore leading : like in ::set a 10
|
||||
while (*s == ':') // ignore leading : like in ::set a 10
|
||||
++s;
|
||||
bool quote = sc.state == SCE_TCL_IN_QUOTE;
|
||||
if (commentLevel || expected) {
|
||||
@@ -206,9 +206,9 @@ next:
|
||||
styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16));
|
||||
|
||||
// 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;
|
||||
else {
|
||||
} else {
|
||||
if (prevSlash) {
|
||||
if (isComment(sc.state))
|
||||
lineState = LS_OPEN_COMMENT;
|
||||
@@ -326,8 +326,7 @@ next:
|
||||
subParen = 0;
|
||||
if (sc.chNext != '{') {
|
||||
sc.SetState(SCE_TCL_SUBSTITUTION);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sc.SetState(SCE_TCL_OPERATOR); // $
|
||||
sc.Forward(); // {
|
||||
sc.ForwardSetState(SCE_TCL_SUB_BRACE);
|
||||
@@ -353,18 +352,18 @@ next:
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static const char * const tclWordListDesc[] = {
|
||||
static const char *const tclWordListDesc[] = {
|
||||
"TCL Keywords",
|
||||
"TK Keywords",
|
||||
"iTCL Keywords",
|
||||
"tkCommands",
|
||||
"expand"
|
||||
"expand",
|
||||
"user1",
|
||||
"user2",
|
||||
"user3",
|
||||
"user4",
|
||||
0
|
||||
};
|
||||
};
|
||||
|
||||
// this code supports folding in the colourizer
|
||||
LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc);
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
@@ -72,6 +72,7 @@ static void ColouriseVHDLDoc(
|
||||
WordList &User = *keywordlists[6];
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
bool isExtendedId = false; // true when parsing an extended identifier
|
||||
|
||||
for (; sc.More(); sc.Forward())
|
||||
{
|
||||
@@ -84,7 +85,7 @@ static void ColouriseVHDLDoc(
|
||||
sc.SetState(SCE_VHDL_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_VHDL_IDENTIFIER) {
|
||||
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
|
||||
if (!isExtendedId && (!IsAWordChar(sc.ch) || (sc.ch == '.'))) {
|
||||
char s[100];
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
if (Keywords.InList(s)) {
|
||||
@@ -103,6 +104,10 @@ static void ColouriseVHDLDoc(
|
||||
sc.ChangeState(SCE_VHDL_USERWORD);
|
||||
}
|
||||
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) {
|
||||
if (sc.atLineEnd) {
|
||||
@@ -119,6 +124,11 @@ static void ColouriseVHDLDoc(
|
||||
sc.ChangeState(SCE_VHDL_STRINGEOL);
|
||||
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.
|
||||
@@ -132,8 +142,13 @@ static void ColouriseVHDLDoc(
|
||||
sc.SetState(SCE_VHDL_COMMENTLINEBANG);
|
||||
else
|
||||
sc.SetState(SCE_VHDL_COMMENT);
|
||||
} else if (sc.Match('/', '*')){
|
||||
sc.SetState(SCE_VHDL_BLOCK_COMMENT);
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_VHDL_STRING);
|
||||
} else if (sc.ch == '\\') {
|
||||
isExtendedId = true;
|
||||
sc.SetState(SCE_VHDL_IDENTIFIER);
|
||||
} else if (isoperator(static_cast<char>(sc.ch))) {
|
||||
sc.SetState(SCE_VHDL_OPERATOR);
|
||||
}
|
||||
@@ -155,6 +170,39 @@ static bool IsCommentLine(int line, Accessor &styler) {
|
||||
}
|
||||
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
|
||||
@@ -167,7 +215,7 @@ static void FoldNoBoxVHDLDoc(
|
||||
// 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.
|
||||
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";
|
||||
WordList keywords;
|
||||
keywords.Set(words);
|
||||
@@ -207,14 +255,14 @@ static void FoldNoBoxVHDLDoc(
|
||||
char chPrev = styler.SafeGetCharAt(j-1);
|
||||
int style = styler.StyleAt(j);
|
||||
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))
|
||||
{
|
||||
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))
|
||||
{
|
||||
@@ -236,7 +284,7 @@ static void FoldNoBoxVHDLDoc(
|
||||
{
|
||||
char ch = styler.SafeGetCharAt(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))
|
||||
{
|
||||
@@ -268,7 +316,9 @@ static void FoldNoBoxVHDLDoc(
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
|
||||
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
|
||||
if (foldComment && atEOL)
|
||||
{
|
||||
if(IsCommentLine(lineCurrent, styler))
|
||||
{
|
||||
if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler))
|
||||
{
|
||||
@@ -279,6 +329,18 @@ static void FoldNoBoxVHDLDoc(
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsCommentBlockStart(lineCurrent, styler) && !IsCommentBlockEnd(lineCurrent, styler))
|
||||
{
|
||||
levelNext++;
|
||||
}
|
||||
else if (IsCommentBlockEnd(lineCurrent, styler) && !IsCommentBlockStart(lineCurrent, styler))
|
||||
{
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((style == SCE_VHDL_OPERATOR) && foldAtParenthese)
|
||||
{
|
||||
@@ -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))
|
||||
{
|
||||
@@ -301,7 +363,7 @@ static void FoldNoBoxVHDLDoc(
|
||||
lastStart = i;
|
||||
}
|
||||
|
||||
if(iswordchar(ch) && !iswordchar(chNext)) {
|
||||
if(IsAWordChar(ch) && !IsAWordChar(chNext)) {
|
||||
char s[32];
|
||||
unsigned int k;
|
||||
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
|
||||
@@ -314,9 +376,8 @@ static void FoldNoBoxVHDLDoc(
|
||||
if (
|
||||
strcmp(s, "architecture") == 0 ||
|
||||
strcmp(s, "case") == 0 ||
|
||||
strcmp(s, "component") == 0 ||
|
||||
strcmp(s, "entity") == 0 ||
|
||||
strcmp(s, "generate") == 0 ||
|
||||
strcmp(s, "block") == 0 ||
|
||||
strcmp(s, "loop") == 0 ||
|
||||
strcmp(s, "package") ==0 ||
|
||||
strcmp(s, "process") == 0 ||
|
||||
@@ -330,6 +391,33 @@ static void FoldNoBoxVHDLDoc(
|
||||
}
|
||||
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 (
|
||||
strcmp(s, "procedure") == 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"
|
||||
// rather than the actual code in the body.
|
||||
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);
|
||||
char LocalCh = styler.SafeGetCharAt(j);
|
||||
if(LocalCh == '(') BracketLevel++;
|
||||
if(LocalCh == ')') BracketLevel--;
|
||||
int styleAtPos = styler.StyleAt(pos);
|
||||
char chAtPos = styler.SafeGetCharAt(pos);
|
||||
if(chAtPos == '(') BracketLevel++;
|
||||
if(chAtPos == ')') BracketLevel--;
|
||||
if(
|
||||
(BracketLevel == 0) &&
|
||||
(LocalStyle != SCE_VHDL_COMMENT) &&
|
||||
(LocalStyle != SCE_VHDL_STRING) &&
|
||||
!iswordchar(styler.SafeGetCharAt(j-1)) &&
|
||||
styler.Match(j, "is") &&
|
||||
!iswordchar(styler.SafeGetCharAt(j+2)))
|
||||
(!IsCommentStyle(styleAtPos)) &&
|
||||
(styleAtPos != SCE_VHDL_STRING) &&
|
||||
!iswordchar(styler.SafeGetCharAt(pos-1)) &&
|
||||
styler.Match(pos, "is") &&
|
||||
!iswordchar(styler.SafeGetCharAt(pos+2)))
|
||||
{
|
||||
if (levelMinCurrentElse > levelNext) {
|
||||
levelMinCurrentElse = levelNext;
|
||||
@@ -358,7 +446,7 @@ static void FoldNoBoxVHDLDoc(
|
||||
levelNext++;
|
||||
break;
|
||||
}
|
||||
if((BracketLevel == 0) && (LocalCh == ';'))
|
||||
if((BracketLevel == 0) && (chAtPos == ';'))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,10 +13,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4786)
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
@@ -3287,7 +3287,7 @@ const int nRanges = ELEMENTS(catRanges);
|
||||
// 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.
|
||||
// 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
|
||||
// alphabetic languages.
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "CharacterSet.h"
|
||||
|
||||
|
||||
@@ -29,11 +29,8 @@ private:
|
||||
int codePage;
|
||||
enum EncodingType encodingType;
|
||||
int lenDoc;
|
||||
int mask;
|
||||
char styleBuf[bufferSize];
|
||||
int validLen;
|
||||
char chFlags;
|
||||
char chWhile;
|
||||
unsigned int startSeg;
|
||||
int startPosStyling;
|
||||
int documentVersion;
|
||||
@@ -58,9 +55,12 @@ public:
|
||||
codePage(pAccess->CodePage()),
|
||||
encodingType(enc8bit),
|
||||
lenDoc(pAccess->Length()),
|
||||
mask(127), validLen(0), chFlags(0), chWhile(0),
|
||||
validLen(0),
|
||||
startSeg(0), startPosStyling(0),
|
||||
documentVersion(pAccess->Version()) {
|
||||
// Prevent warnings by static analyzers about uninitialized buf and styleBuf.
|
||||
buf[0] = 0;
|
||||
styleBuf[0] = 0;
|
||||
switch (codePage) {
|
||||
case 65001:
|
||||
encodingType = encUnicode;
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
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 {
|
||||
return pAccess->LineFromPosition(position);
|
||||
@@ -152,16 +152,10 @@ public:
|
||||
return pAccess->SetLineState(line, state);
|
||||
}
|
||||
// Style setting
|
||||
void StartAt(unsigned int start, char chMask=31) {
|
||||
// Store the mask specified for use with StyleAt.
|
||||
mask = chMask;
|
||||
pAccess->StartStyling(start, chMask);
|
||||
void StartAt(unsigned int start) {
|
||||
pAccess->StartStyling(start, '\377');
|
||||
startPosStyling = start;
|
||||
}
|
||||
void SetFlags(char chFlags_, char chWhile_) {
|
||||
chFlags = chFlags_;
|
||||
chWhile = chWhile_;
|
||||
}
|
||||
unsigned int GetStartSegment() const {
|
||||
return startSeg;
|
||||
}
|
||||
@@ -182,9 +176,6 @@ public:
|
||||
// Too big for buffer so send directly
|
||||
pAccess->SetStyleFor(pos - startSeg + 1, static_cast<char>(chAttr));
|
||||
} else {
|
||||
if (chAttr != chWhile)
|
||||
chFlags = 0;
|
||||
chAttr = static_cast<char>(chAttr | chFlags);
|
||||
for (unsigned int i = startSeg; i <= pos; i++) {
|
||||
assert((startPosStyling + validLen) < Length());
|
||||
styleBuf[validLen++] = static_cast<char>(chAttr);
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -34,28 +34,24 @@ LexerModule::LexerModule(int language_,
|
||||
LexerFunction fnLexer_,
|
||||
const char *languageName_,
|
||||
LexerFunction fnFolder_,
|
||||
const char *const wordListDescriptions_[],
|
||||
int styleBits_) :
|
||||
const char *const wordListDescriptions_[]) :
|
||||
language(language_),
|
||||
fnLexer(fnLexer_),
|
||||
fnFolder(fnFolder_),
|
||||
fnFactory(0),
|
||||
wordListDescriptions(wordListDescriptions_),
|
||||
styleBits(styleBits_),
|
||||
languageName(languageName_) {
|
||||
}
|
||||
|
||||
LexerModule::LexerModule(int language_,
|
||||
LexerFactoryFunction fnFactory_,
|
||||
const char *languageName_,
|
||||
const char * const wordListDescriptions_[],
|
||||
int styleBits_) :
|
||||
const char * const wordListDescriptions_[]) :
|
||||
language(language_),
|
||||
fnLexer(0),
|
||||
fnFolder(0),
|
||||
fnFactory(fnFactory_),
|
||||
wordListDescriptions(wordListDescriptions_),
|
||||
styleBits(styleBits_),
|
||||
languageName(languageName_) {
|
||||
}
|
||||
|
||||
@@ -82,10 +78,6 @@ const char *LexerModule::GetWordListDescription(int index) const {
|
||||
}
|
||||
}
|
||||
|
||||
int LexerModule::GetStyleBitsNeeded() const {
|
||||
return styleBits;
|
||||
}
|
||||
|
||||
ILexer *LexerModule::Create() const {
|
||||
if (fnFactory)
|
||||
return fnFactory();
|
||||
|
||||
@@ -31,7 +31,6 @@ protected:
|
||||
LexerFunction fnFolder;
|
||||
LexerFactoryFunction fnFactory;
|
||||
const char * const * wordListDescriptions;
|
||||
int styleBits;
|
||||
|
||||
public:
|
||||
const char *languageName;
|
||||
@@ -39,13 +38,11 @@ public:
|
||||
LexerFunction fnLexer_,
|
||||
const char *languageName_=0,
|
||||
LexerFunction fnFolder_=0,
|
||||
const char * const wordListDescriptions_[] = NULL,
|
||||
int styleBits_=5);
|
||||
const char * const wordListDescriptions_[] = NULL);
|
||||
LexerModule(int language_,
|
||||
LexerFactoryFunction fnFactory_,
|
||||
const char *languageName_,
|
||||
const char * const wordListDescriptions_[] = NULL,
|
||||
int styleBits_=8);
|
||||
const char * const wordListDescriptions_[] = NULL);
|
||||
virtual ~LexerModule() {
|
||||
}
|
||||
int GetLanguage() const { return language; }
|
||||
@@ -54,8 +51,6 @@ public:
|
||||
int GetNumWordLists() const;
|
||||
const char *GetWordListDescription(int index) const;
|
||||
|
||||
int GetStyleBitsNeeded() const;
|
||||
|
||||
ILexer *Create() const;
|
||||
|
||||
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:
|
||||
#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
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
#include <string.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 <map>
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
int widthNext;
|
||||
|
||||
StyleContext(unsigned int startPos, unsigned int length,
|
||||
int initStyle, LexAccessor &styler_, char chMask=31) :
|
||||
int initStyle, LexAccessor &styler_, char chMask='\377') :
|
||||
styler(styler_),
|
||||
multiByteAccess(0),
|
||||
endPos(startPos + length),
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
if (styler.Encoding() != enc8bit) {
|
||||
multiByteAccess = styler.MultiByteAccess();
|
||||
}
|
||||
styler.StartAt(startPos, chMask);
|
||||
styler.StartAt(startPos /*, chMask*/);
|
||||
styler.StartSegment(startPos);
|
||||
currentLine = styler.GetLine(startPos);
|
||||
lineStartNext = styler.LineStart(currentLine+1);
|
||||
|
||||
@@ -166,7 +166,8 @@ public:
|
||||
}
|
||||
|
||||
const WordClassifier &Classifier(int baseStyle) const {
|
||||
return classifiers[BlockFromBaseStyle(baseStyle)];
|
||||
const int block = BlockFromBaseStyle(baseStyle);
|
||||
return classifiers[block >= 0 ? block : 0];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -69,6 +69,8 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
|
||||
|
||||
WordList::WordList(bool onlyLineEnds_) :
|
||||
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {
|
||||
// Prevent warnings by static analyzers about uninitialized starts.
|
||||
starts[0] = -1;
|
||||
}
|
||||
|
||||
WordList::~WordList() {
|
||||
|
||||
@@ -167,7 +167,9 @@ void AutoComplete::SetList(const char *list) {
|
||||
char item[maxItemLen];
|
||||
for (size_t i = 0; i < sortMatrix.size(); ++i) {
|
||||
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()) {
|
||||
// Last item so remove separator if present
|
||||
if ((wordLen > 0) && (item[wordLen-1] == separator))
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
void SetSeparator(char separator_);
|
||||
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_);
|
||||
char GetTypesep() const;
|
||||
|
||||
|
||||
@@ -109,13 +109,15 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
int endSeg = ends[seg];
|
||||
if (endSeg > startSeg) {
|
||||
if (IsArrowCharacter(s[startSeg])) {
|
||||
xEnd = x + widthArrow;
|
||||
bool upArrow = s[startSeg] == '\001';
|
||||
rcClient.left = x;
|
||||
rcClient.right = rcClient.left + widthArrow;
|
||||
rcClient.left = static_cast<XYPOSITION>(x);
|
||||
rcClient.right = static_cast<XYPOSITION>(xEnd);
|
||||
if (draw) {
|
||||
const int halfWidth = widthArrow / 2 - 3;
|
||||
const int centreX = rcClient.left + widthArrow / 2 - 1;
|
||||
const int centreY = (rcClient.top + rcClient.bottom) / 2;
|
||||
const int quarterWidth = halfWidth / 2;
|
||||
const int centreX = x + widthArrow / 2 - 1;
|
||||
const int centreY = static_cast<int>(rcClient.top + rcClient.bottom) / 2;
|
||||
surface->FillRectangle(rcClient, colourBG);
|
||||
PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 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
|
||||
Point pts[] = {
|
||||
Point(centreX - halfWidth, centreY + halfWidth / 2),
|
||||
Point(centreX + halfWidth, centreY + halfWidth / 2),
|
||||
Point(centreX, centreY - halfWidth + halfWidth / 2),
|
||||
Point::FromInts(centreX - halfWidth, centreY + quarterWidth),
|
||||
Point::FromInts(centreX + halfWidth, centreY + quarterWidth),
|
||||
Point::FromInts(centreX, centreY - halfWidth + quarterWidth),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
|
||||
} else { // Down arrow
|
||||
Point pts[] = {
|
||||
Point(centreX - halfWidth, centreY - halfWidth / 2),
|
||||
Point(centreX + halfWidth, centreY - halfWidth / 2),
|
||||
Point(centreX, centreY + halfWidth - halfWidth / 2),
|
||||
Point::FromInts(centreX - halfWidth, centreY - quarterWidth),
|
||||
Point::FromInts(centreX + halfWidth, centreY - quarterWidth),
|
||||
Point::FromInts(centreX, centreY + halfWidth - quarterWidth),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
|
||||
}
|
||||
}
|
||||
xEnd = rcClient.right;
|
||||
offsetMain = xEnd;
|
||||
if (upArrow) {
|
||||
rectUp = rcClient;
|
||||
@@ -147,11 +148,11 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
} else if (IsTabCharacter(s[startSeg])) {
|
||||
xEnd = NextTabPos(x);
|
||||
} else {
|
||||
xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg);
|
||||
xEnd = x + RoundXYPosition(surface->WidthText(font, s + startSeg, endSeg - startSeg));
|
||||
if (draw) {
|
||||
rcClient.left = x;
|
||||
rcClient.right = xEnd;
|
||||
surface->DrawTextTransparent(rcClient, font, ytext,
|
||||
rcClient.left = static_cast<XYPOSITION>(x);
|
||||
rcClient.right = static_cast<XYPOSITION>(xEnd);
|
||||
surface->DrawTextTransparent(rcClient, font, static_cast<XYPOSITION>(ytext),
|
||||
s+startSeg, endSeg - startSeg,
|
||||
highlight ? colourSel : colourUnSel);
|
||||
}
|
||||
@@ -164,16 +165,16 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
|
||||
int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
|
||||
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);
|
||||
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
|
||||
int ascent = surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font);
|
||||
int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font));
|
||||
|
||||
// For each line...
|
||||
// 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;
|
||||
const char *chunkVal = val.c_str();
|
||||
bool moreChunks = true;
|
||||
@@ -185,8 +186,8 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
|
||||
chunkEnd = chunkVal + strlen(chunkVal);
|
||||
moreChunks = false;
|
||||
}
|
||||
int chunkOffset = chunkVal - val.c_str();
|
||||
int chunkLength = chunkEnd - chunkVal;
|
||||
int chunkOffset = static_cast<int>(chunkVal - val.c_str());
|
||||
int chunkLength = static_cast<int>(chunkEnd - chunkVal);
|
||||
int chunkEndOffset = chunkOffset + chunkLength;
|
||||
int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset);
|
||||
thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset);
|
||||
@@ -194,7 +195,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) {
|
||||
int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset);
|
||||
thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset);
|
||||
thisEndHighlight -= chunkOffset;
|
||||
rcClient.top = ytext - ascent - 1;
|
||||
rcClient.top = static_cast<XYPOSITION>(ytext - ascent - 1);
|
||||
|
||||
int x = insetX; // start each line at this inset
|
||||
|
||||
@@ -217,9 +218,9 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
|
||||
if (val.empty())
|
||||
return;
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -229,13 +230,13 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
|
||||
#ifndef __APPLE__
|
||||
// OSX doesn't put borders on "help tags"
|
||||
// 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->LineTo(rcClientSize.right - 1, rcClientSize.bottom - 1);
|
||||
surfaceWindow->LineTo(rcClientSize.right - 1, 0);
|
||||
surfaceWindow->LineTo(static_cast<int>(rcClientSize.right) - 1, static_cast<int>(rcClientSize.bottom) - 1);
|
||||
surfaceWindow->LineTo(static_cast<int>(rcClientSize.right) - 1, 0);
|
||||
surfaceWindow->PenColour(colourLight);
|
||||
surfaceWindow->LineTo(0, 0);
|
||||
surfaceWindow->LineTo(0, rcClientSize.bottom - 1);
|
||||
surfaceWindow->LineTo(0, static_cast<int>(rcClientSize.bottom) - 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -264,7 +265,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *
|
||||
endHighlight = 0;
|
||||
inCallTipMode = true;
|
||||
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);
|
||||
font.Create(fp);
|
||||
// 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;
|
||||
numLines++;
|
||||
}
|
||||
lineHeight = surfaceMeasure->Height(font);
|
||||
lineHeight = RoundXYPosition(surfaceMeasure->Height(font));
|
||||
|
||||
// The returned
|
||||
// rectangle is aligned to the right edge of the last arrow encountered in
|
||||
// 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;
|
||||
if (above) {
|
||||
return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset);
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "CaseFolder.h"
|
||||
#include "CaseConvert.h"
|
||||
#include "UniConversion.h"
|
||||
#include "CaseFolder.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -90,6 +90,7 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmBaan);
|
||||
LINK_LEXER(lmBash);
|
||||
LINK_LEXER(lmBatch);
|
||||
LINK_LEXER(lmBibTeX);
|
||||
LINK_LEXER(lmBlitzBasic);
|
||||
LINK_LEXER(lmBullant);
|
||||
LINK_LEXER(lmCaml);
|
||||
@@ -106,6 +107,7 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmD);
|
||||
LINK_LEXER(lmDiff);
|
||||
LINK_LEXER(lmDMAP);
|
||||
LINK_LEXER(lmDMIS);
|
||||
LINK_LEXER(lmECL);
|
||||
LINK_LEXER(lmEiffel);
|
||||
LINK_LEXER(lmEiffelkw);
|
||||
@@ -121,6 +123,7 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmGui4Cli);
|
||||
LINK_LEXER(lmHaskell);
|
||||
LINK_LEXER(lmHTML);
|
||||
LINK_LEXER(lmIHex);
|
||||
LINK_LEXER(lmInno);
|
||||
LINK_LEXER(lmKix);
|
||||
LINK_LEXER(lmKVIrc);
|
||||
@@ -162,6 +165,7 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmPython);
|
||||
LINK_LEXER(lmR);
|
||||
LINK_LEXER(lmREBOL);
|
||||
LINK_LEXER(lmRegistry);
|
||||
LINK_LEXER(lmRuby);
|
||||
LINK_LEXER(lmRust);
|
||||
LINK_LEXER(lmScriptol);
|
||||
@@ -171,12 +175,14 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmSpecman);
|
||||
LINK_LEXER(lmSpice);
|
||||
LINK_LEXER(lmSQL);
|
||||
LINK_LEXER(lmSrec);
|
||||
LINK_LEXER(lmSTTXT);
|
||||
LINK_LEXER(lmTACL);
|
||||
LINK_LEXER(lmTADS3);
|
||||
LINK_LEXER(lmTAL);
|
||||
LINK_LEXER(lmTCL);
|
||||
LINK_LEXER(lmTCMD);
|
||||
LINK_LEXER(lmTEHex);
|
||||
LINK_LEXER(lmTeX);
|
||||
LINK_LEXER(lmTxt2tags);
|
||||
LINK_LEXER(lmVB);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Platform.h"
|
||||
@@ -144,6 +145,7 @@ UndoHistory::UndoHistory() {
|
||||
currentAction = 0;
|
||||
undoSequenceDepth = 0;
|
||||
savePoint = 0;
|
||||
tentativePoint = -1;
|
||||
|
||||
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
|
||||
__analysis_assume(actions);
|
||||
#endif
|
||||
if (currentAction == savePoint) {
|
||||
if ((currentAction == savePoint) || (currentAction == tentativePoint)) {
|
||||
currentAction++;
|
||||
} else if (!actions[currentAction].mayCoalesce) {
|
||||
// Not allowed to coalesce if this set
|
||||
@@ -282,6 +284,7 @@ void UndoHistory::DeleteUndoHistory() {
|
||||
currentAction = 0;
|
||||
actions[currentAction].Create(startAction);
|
||||
savePoint = 0;
|
||||
tentativePoint = -1;
|
||||
}
|
||||
|
||||
void UndoHistory::SetSavePoint() {
|
||||
@@ -292,6 +295,26 @@ bool UndoHistory::IsSavePoint() const {
|
||||
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 {
|
||||
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 {
|
||||
if (lengthRetrieve < 0)
|
||||
if (lengthRetrieve <= 0)
|
||||
return;
|
||||
if (position < 0)
|
||||
return;
|
||||
@@ -413,25 +436,24 @@ const char *CellBuffer::InsertString(int position, const char *s, int insertLeng
|
||||
return data;
|
||||
}
|
||||
|
||||
bool CellBuffer::SetStyleAt(int position, char styleValue, char mask) {
|
||||
styleValue &= mask;
|
||||
bool CellBuffer::SetStyleAt(int position, char styleValue) {
|
||||
char curVal = style.ValueAt(position);
|
||||
if ((curVal & mask) != styleValue) {
|
||||
style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue));
|
||||
if (curVal != styleValue) {
|
||||
style.SetValueAt(position, styleValue);
|
||||
return true;
|
||||
} else {
|
||||
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;
|
||||
PLATFORM_ASSERT(lengthStyle == 0 ||
|
||||
(lengthStyle > 0 && lengthStyle + position <= style.Length()));
|
||||
while (lengthStyle--) {
|
||||
char curVal = style.ValueAt(position);
|
||||
if ((curVal & mask) != styleValue) {
|
||||
style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue));
|
||||
if (curVal != styleValue) {
|
||||
style.SetValueAt(position, styleValue);
|
||||
changed = true;
|
||||
}
|
||||
position++;
|
||||
@@ -506,6 +528,22 @@ bool CellBuffer::IsSavePoint() const {
|
||||
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
|
||||
|
||||
void CellBuffer::InsertLine(int line, int position, bool lineStart) {
|
||||
@@ -749,6 +787,10 @@ const Action &CellBuffer::GetUndoStep() const {
|
||||
void CellBuffer::PerformUndoStep() {
|
||||
const Action &actionStep = uh.GetUndoStep();
|
||||
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);
|
||||
} else if (actionStep.at == removeAction) {
|
||||
BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData);
|
||||
|
||||
@@ -95,6 +95,7 @@ class UndoHistory {
|
||||
int currentAction;
|
||||
int undoSequenceDepth;
|
||||
int savePoint;
|
||||
int tentativePoint;
|
||||
|
||||
void EnsureUndoRoom();
|
||||
|
||||
@@ -117,6 +118,12 @@ public:
|
||||
void SetSavePoint();
|
||||
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
|
||||
/// called that many times. Similarly for redo.
|
||||
bool CanUndo() const;
|
||||
@@ -180,8 +187,8 @@ public:
|
||||
|
||||
/// 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.
|
||||
bool SetStyleAt(int position, char styleValue, char mask='\377');
|
||||
bool SetStyleFor(int position, int length, char styleValue, char mask);
|
||||
bool SetStyleAt(int position, char styleValue);
|
||||
bool SetStyleFor(int position, int length, char styleValue);
|
||||
|
||||
const char *DeleteChars(int position, int deleteLength, bool &startSequence);
|
||||
|
||||
@@ -193,6 +200,11 @@ public:
|
||||
void SetSavePoint();
|
||||
bool IsSavePoint() const;
|
||||
|
||||
void TentativeStart();
|
||||
void TentativeCommit();
|
||||
bool TentativeActive() const;
|
||||
int TentativeSteps();
|
||||
|
||||
bool SetUndoCollection(bool collectUndo);
|
||||
bool IsCollectingUndo() const;
|
||||
void BeginUndoAction();
|
||||
|
||||
@@ -14,11 +14,6 @@
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
// Shut up annoying Visual C++ warnings:
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4514)
|
||||
#endif
|
||||
|
||||
CharClassify::CharClassify() {
|
||||
SetDefaultCharClasses(true);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
if (OneToOne()) {
|
||||
return lineDisplay;
|
||||
@@ -146,8 +150,8 @@ bool ContractionState::GetVisible(int lineDoc) const {
|
||||
}
|
||||
}
|
||||
|
||||
bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible_) {
|
||||
if (OneToOne() && visible_) {
|
||||
bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool isVisible) {
|
||||
if (OneToOne() && isVisible) {
|
||||
return false;
|
||||
} else {
|
||||
EnsureData();
|
||||
@@ -155,9 +159,9 @@ bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible
|
||||
Check();
|
||||
if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) {
|
||||
for (int line = lineDocStart; line <= lineDocEnd; line++) {
|
||||
if (GetVisible(line) != visible_) {
|
||||
int difference = visible_ ? heights->ValueAt(line) : -heights->ValueAt(line);
|
||||
visible->SetValueAt(line, visible_ ? 1 : 0);
|
||||
if (GetVisible(line) != isVisible) {
|
||||
int difference = isVisible ? heights->ValueAt(line) : -heights->ValueAt(line);
|
||||
visible->SetValueAt(line, isVisible ? 1 : 0);
|
||||
displayLines->InsertText(line, difference);
|
||||
delta += difference;
|
||||
}
|
||||
@@ -187,13 +191,13 @@ bool ContractionState::GetExpanded(int lineDoc) const {
|
||||
}
|
||||
}
|
||||
|
||||
bool ContractionState::SetExpanded(int lineDoc, bool expanded_) {
|
||||
if (OneToOne() && expanded_) {
|
||||
bool ContractionState::SetExpanded(int lineDoc, bool isExpanded) {
|
||||
if (OneToOne() && isExpanded) {
|
||||
return false;
|
||||
} else {
|
||||
EnsureData();
|
||||
if (expanded_ != (expanded->ValueAt(lineDoc) == 1)) {
|
||||
expanded->SetValueAt(lineDoc, expanded_ ? 1 : 0);
|
||||
if (isExpanded != (expanded->ValueAt(lineDoc) == 1)) {
|
||||
expanded->SetValueAt(lineDoc, isExpanded ? 1 : 0);
|
||||
Check();
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
int LinesInDoc() const;
|
||||
int LinesDisplayed() const;
|
||||
int DisplayFromDoc(int lineDoc) const;
|
||||
int DisplayLastFromDoc(int lineDoc) const;
|
||||
int DocFromDisplay(int lineDisplay) const;
|
||||
|
||||
void InsertLine(int lineDoc);
|
||||
@@ -47,11 +48,11 @@ public:
|
||||
void DeleteLines(int lineDoc, int lineCount);
|
||||
|
||||
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 GetExpanded(int lineDoc) const;
|
||||
bool SetExpanded(int lineDoc, bool expanded);
|
||||
bool SetExpanded(int lineDoc, bool isExpanded);
|
||||
int ContractedNext(int lineDocStart) const;
|
||||
|
||||
int GetHeight(int lineDoc) const;
|
||||
|
||||
@@ -163,9 +163,11 @@ int DecorationList::AllOnFor(int position) const {
|
||||
int mask = 0;
|
||||
for (Decoration *deco=root; deco; deco = deco->next) {
|
||||
if (deco->rs.ValueAt(position)) {
|
||||
if (deco->indicator < INDIC_IME) {
|
||||
mask |= 1 << deco->indicator;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,30 +8,36 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef CXX11_REGEX
|
||||
#include <regex>
|
||||
#endif
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
#include "CharacterSet.h"
|
||||
#include "SplitVector.h"
|
||||
#include "Partitioning.h"
|
||||
#include "RunStyles.h"
|
||||
#include "CellBuffer.h"
|
||||
#include "PerLine.h"
|
||||
#include "CharClassify.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "Decoration.h"
|
||||
#include "CaseFolder.h"
|
||||
#include "Document.h"
|
||||
#include "RESearch.h"
|
||||
#include "UniConversion.h"
|
||||
#include "UnicodeFromUTF8.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
@@ -58,7 +64,7 @@ void LexInterface::Colourise(int start, int end) {
|
||||
|
||||
int styleStart = 0;
|
||||
if (start > 0)
|
||||
styleStart = pdoc->StyleAt(start - 1) & pdoc->stylingBitsMask;
|
||||
styleStart = pdoc->StyleAt(start - 1);
|
||||
|
||||
if (len > 0) {
|
||||
instance->Lex(start, len, styleStart, pdoc);
|
||||
@@ -90,14 +96,12 @@ Document::Document() {
|
||||
#endif
|
||||
dbcsCodePage = 0;
|
||||
lineEndBitSet = SC_LINE_END_TYPE_DEFAULT;
|
||||
stylingBits = 5;
|
||||
stylingBitsMask = 0x1F;
|
||||
stylingMask = 0;
|
||||
endStyled = 0;
|
||||
styleClock = 0;
|
||||
enteredModification = 0;
|
||||
enteredStyling = 0;
|
||||
enteredReadOnlyCount = 0;
|
||||
insertionSet = false;
|
||||
tabInChars = 8;
|
||||
indentInChars = 0;
|
||||
actualIndentInChars = 8;
|
||||
@@ -211,6 +215,65 @@ void Document::SetSavePoint() {
|
||||
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) {
|
||||
return static_cast<LineMarkers *>(perLineData[ldMarkers])->MarkValue(line);
|
||||
}
|
||||
@@ -278,6 +341,10 @@ int SCI_METHOD Document::LineStart(int line) const {
|
||||
return cb.LineStart(line);
|
||||
}
|
||||
|
||||
bool Document::IsLineStartPosition(int position) const {
|
||||
return LineStart(LineFromPosition(position)) == position;
|
||||
}
|
||||
|
||||
int SCI_METHOD Document::LineEnd(int line) const {
|
||||
if (line >= LinesTotal() - 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 displaying DBCS text such as Japanese.
|
||||
// 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);
|
||||
// If out of range, just return minimum/maximum value.
|
||||
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
|
||||
int SCI_METHOD Document::GetRelativePosition(int positionStart, int characterOffset) const {
|
||||
int pos = positionStart;
|
||||
@@ -733,6 +787,27 @@ int SCI_METHOD Document::GetRelativePosition(int positionStart, int characterOff
|
||||
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 character;
|
||||
int bytesInCharacter = 1;
|
||||
@@ -753,7 +828,7 @@ int SCI_METHOD Document::GetCharacterAndWidth(int position, int *pWidth) const {
|
||||
character = 0xDC80 + leadByte;
|
||||
} else {
|
||||
bytesInCharacter = utf8status & UTF8MaskWidth;
|
||||
character = UnicodeFromBytes(charBytes);
|
||||
character = UnicodeFromUTF8(charBytes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -880,6 +955,8 @@ void Document::CheckReadOnly() {
|
||||
// SetStyleAt does not change the persistent state of a document
|
||||
|
||||
bool Document::DeleteChars(int pos, int len) {
|
||||
if (pos < 0)
|
||||
return false;
|
||||
if (len <= 0)
|
||||
return false;
|
||||
if ((pos + len) > Length())
|
||||
@@ -919,16 +996,29 @@ bool Document::DeleteChars(int pos, int len) {
|
||||
/**
|
||||
* 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) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
CheckReadOnly(); // Application may change read only state here
|
||||
if (cb.IsReadOnly()) {
|
||||
return 0;
|
||||
}
|
||||
CheckReadOnly();
|
||||
if (enteredModification != 0) {
|
||||
return false;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
enteredModification++;
|
||||
if (!cb.IsReadOnly()) {
|
||||
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,
|
||||
@@ -946,10 +1036,16 @@ bool Document::InsertString(int position, const char *s, int insertLength) {
|
||||
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 !cb.IsReadOnly();
|
||||
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) {
|
||||
@@ -1113,22 +1209,6 @@ int Document::Redo() {
|
||||
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) {
|
||||
DeleteChars(pos, LenChar(pos));
|
||||
}
|
||||
@@ -1183,7 +1263,7 @@ int SCI_METHOD Document::GetLineIndentation(int line) {
|
||||
return indent;
|
||||
}
|
||||
|
||||
void Document::SetLineIndentation(int line, int indent) {
|
||||
int Document::SetLineIndentation(int line, int indent) {
|
||||
int indentOfLine = GetLineIndentation(line);
|
||||
if (indent < 0)
|
||||
indent = 0;
|
||||
@@ -1193,7 +1273,10 @@ void Document::SetLineIndentation(int line, int indent) {
|
||||
int indentPos = GetLineIndentPosition(line);
|
||||
UndoGroup ug(this);
|
||||
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;
|
||||
}
|
||||
|
||||
int Document::CountCharacters(int startPos, int endPos) {
|
||||
int Document::CountCharacters(int startPos, int endPos) const {
|
||||
startPos = MovePositionOutsideChar(startPos, 1, false);
|
||||
endPos = MovePositionOutsideChar(endPos, -1, false);
|
||||
int count = 0;
|
||||
@@ -1246,6 +1329,21 @@ int Document::CountCharacters(int startPos, int endPos) {
|
||||
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 position = LineStart(line);
|
||||
if ((line >= 0) && (line < LinesTotal())) {
|
||||
@@ -1325,21 +1423,21 @@ void Document::ConvertLineEnds(int eolModeSet) {
|
||||
} else {
|
||||
// CR
|
||||
if (eolModeSet == SC_EOL_CRLF) {
|
||||
InsertString(pos + 1, "\n", 1); // Insert LF
|
||||
pos++;
|
||||
pos += InsertString(pos + 1, "\n", 1); // Insert LF
|
||||
} else if (eolModeSet == SC_EOL_LF) {
|
||||
InsertString(pos, "\n", 1); // Insert LF
|
||||
DeleteChars(pos + 1, 1); // Delete CR
|
||||
pos += InsertString(pos, "\n", 1); // Insert LF
|
||||
DeleteChars(pos, 1); // Delete CR
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
} else if (cb.CharAt(pos) == '\n') {
|
||||
// LF
|
||||
if (eolModeSet == SC_EOL_CRLF) {
|
||||
InsertString(pos, "\r", 1); // Insert CR
|
||||
pos++;
|
||||
pos += InsertString(pos, "\r", 1); // Insert CR
|
||||
} else if (eolModeSet == SC_EOL_CR) {
|
||||
InsertString(pos, "\r", 1); // Insert CR
|
||||
DeleteChars(pos + 1, 1); // Delete LF
|
||||
pos += InsertString(pos, "\r", 1); // Insert CR
|
||||
DeleteChars(pos, 1); // Delete LF
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1521,6 +1619,25 @@ void Document::SetCaseFolder(CaseFolder *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
|
||||
* 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);
|
||||
}
|
||||
|
||||
void Document::SetStylingBits(int bits) {
|
||||
stylingBits = bits;
|
||||
stylingBitsMask = (1 << stylingBits) - 1;
|
||||
}
|
||||
|
||||
void SCI_METHOD Document::StartStyling(int position, char mask) {
|
||||
stylingMask = mask;
|
||||
void SCI_METHOD Document::StartStyling(int position, char) {
|
||||
endStyled = position;
|
||||
}
|
||||
|
||||
@@ -1720,9 +1831,8 @@ bool SCI_METHOD Document::SetStyleFor(int length, char style) {
|
||||
return false;
|
||||
} else {
|
||||
enteredStyling++;
|
||||
style &= stylingMask;
|
||||
int prevEndStyled = endStyled;
|
||||
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
|
||||
if (cb.SetStyleFor(endStyled, length, style)) {
|
||||
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
|
||||
prevEndStyled, length);
|
||||
NotifyModified(mh);
|
||||
@@ -1743,7 +1853,7 @@ bool SCI_METHOD Document::SetStyles(int length, const char *styles) {
|
||||
int endMod = 0;
|
||||
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
|
||||
PLATFORM_ASSERT(endStyled < Length());
|
||||
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
|
||||
if (cb.SetStyleAt(endStyled, styles[iPos])) {
|
||||
if (!didChange) {
|
||||
startMod = endStyled;
|
||||
}
|
||||
@@ -2073,7 +2183,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
|
||||
char chSeek = BraceOpposite(chBrace);
|
||||
if (chSeek == '\0')
|
||||
return - 1;
|
||||
char styBrace = static_cast<char>(StyleAt(position) & stylingBitsMask);
|
||||
char styBrace = static_cast<char>(StyleAt(position));
|
||||
int direction = -1;
|
||||
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
|
||||
direction = 1;
|
||||
@@ -2081,7 +2191,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
|
||||
position = NextPosition(position, direction);
|
||||
while ((position >= 0) && (position < Length())) {
|
||||
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 (chAtPos == chBrace)
|
||||
depth++;
|
||||
@@ -2119,6 +2229,61 @@ private:
|
||||
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
|
||||
class DocumentIndexer : public CharacterIndexer {
|
||||
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 ®exp, 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,
|
||||
bool caseSensitive, bool, bool, int flags,
|
||||
int *length) {
|
||||
bool posix = (flags & SCFIND_POSIX) != 0;
|
||||
int increment = (minPos <= maxPos) ? 1 : -1;
|
||||
|
||||
int startPos = minPos;
|
||||
int endPos = maxPos;
|
||||
#ifdef CXX11_REGEX
|
||||
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.
|
||||
startPos = doc->MovePositionOutsideChar(startPos, 1, false);
|
||||
endPos = doc->MovePositionOutsideChar(endPos, 1, false);
|
||||
const RESearchRange resr(doc, minPos, maxPos);
|
||||
|
||||
const bool posix = (flags & SCFIND_POSIX) != 0;
|
||||
|
||||
const char *errmsg = search.Compile(s, *length, caseSensitive, posix);
|
||||
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:
|
||||
// Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
|
||||
// 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 lenRet = 0;
|
||||
char searchEnd = s[*length - 1];
|
||||
char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0';
|
||||
int lineRangeBreak = lineRangeEnd + increment;
|
||||
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
|
||||
const char searchEnd = s[*length - 1];
|
||||
const char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0';
|
||||
for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) {
|
||||
int startOfLine = doc->LineStart(line);
|
||||
int endOfLine = doc->LineEnd(line);
|
||||
if (increment == 1) {
|
||||
if (line == lineRangeStart) {
|
||||
if ((startPos != startOfLine) && (s[0] == '^'))
|
||||
if (resr.increment == 1) {
|
||||
if (line == resr.lineRangeStart) {
|
||||
if ((resr.startPos != startOfLine) && (s[0] == '^'))
|
||||
continue; // Can't match start of line if start position after start of line
|
||||
startOfLine = startPos;
|
||||
startOfLine = resr.startPos;
|
||||
}
|
||||
if (line == lineRangeEnd) {
|
||||
if ((endPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
|
||||
if (line == resr.lineRangeEnd) {
|
||||
if ((resr.endPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
|
||||
continue; // Can't match end of line if end position before end of line
|
||||
endOfLine = endPos;
|
||||
endOfLine = resr.endPos;
|
||||
}
|
||||
} else {
|
||||
if (line == lineRangeEnd) {
|
||||
if ((endPos != startOfLine) && (s[0] == '^'))
|
||||
if (line == resr.lineRangeEnd) {
|
||||
if ((resr.endPos != startOfLine) && (s[0] == '^'))
|
||||
continue; // Can't match start of line if end position after start of line
|
||||
startOfLine = endPos;
|
||||
startOfLine = resr.endPos;
|
||||
}
|
||||
if (line == lineRangeStart) {
|
||||
if ((startPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
|
||||
if (line == resr.lineRangeStart) {
|
||||
if ((resr.startPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
|
||||
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);
|
||||
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
|
||||
if ((increment == -1) && (s[0] != '^')) {
|
||||
if ((resr.increment == -1) && (s[0] != '^')) {
|
||||
// Check for the last match on this line.
|
||||
int repetitions = 1000; // Break out of infinite loop
|
||||
while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) {
|
||||
|
||||
@@ -39,10 +39,22 @@ public:
|
||||
start(start_), end(end_) {
|
||||
}
|
||||
|
||||
bool operator==(const Range &other) const {
|
||||
return (start == other.start) && (end == other.end);
|
||||
}
|
||||
|
||||
bool Valid() const {
|
||||
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?
|
||||
bool Contains(Position pos) const {
|
||||
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 {
|
||||
@@ -191,9 +207,6 @@ public:
|
||||
bool operator==(const WatcherWithUserData &other) const {
|
||||
return (watcher == other.watcher) && (userData == other.userData);
|
||||
}
|
||||
bool operator!=(const WatcherWithUserData &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -201,13 +214,15 @@ private:
|
||||
CellBuffer cb;
|
||||
CharClassify charClass;
|
||||
CaseFolder *pcf;
|
||||
char stylingMask;
|
||||
int endStyled;
|
||||
int styleClock;
|
||||
int enteredModification;
|
||||
int enteredStyling;
|
||||
int enteredReadOnlyCount;
|
||||
|
||||
bool insertionSet;
|
||||
std::string insertion;
|
||||
|
||||
std::vector<WatcherWithUserData> watchers;
|
||||
|
||||
// ldSize is not real data - it is for dimensions and loops
|
||||
@@ -221,9 +236,6 @@ public:
|
||||
|
||||
LexInterface *pli;
|
||||
|
||||
int stylingBits;
|
||||
int stylingBitsMask;
|
||||
|
||||
int eolMode;
|
||||
/// Can also be SC_CP_UTF8 to enable UTF-8 mode
|
||||
int dbcsCodePage;
|
||||
@@ -263,10 +275,11 @@ public:
|
||||
bool IsCrLf(int pos) const;
|
||||
int LenChar(int pos);
|
||||
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;
|
||||
bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed
|
||||
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 CodePage() const;
|
||||
bool SCI_METHOD IsDBCSLeadByte(char ch) const;
|
||||
@@ -277,7 +290,8 @@ public:
|
||||
void ModifiedAt(int pos);
|
||||
void CheckReadOnly();
|
||||
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);
|
||||
void * SCI_METHOD ConvertToDocument();
|
||||
int Undo();
|
||||
@@ -294,15 +308,22 @@ public:
|
||||
void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); }
|
||||
void SetSavePoint();
|
||||
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 *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); }
|
||||
int GapPosition() const { return cb.GapPosition(); }
|
||||
|
||||
int SCI_METHOD GetLineIndentation(int line);
|
||||
void SetLineIndentation(int line, int indent);
|
||||
int SetLineIndentation(int line, int indent);
|
||||
int GetLineIndentPosition(int line) const;
|
||||
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);
|
||||
void Indent(bool forwards, int lineBottom, int lineTop);
|
||||
static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted);
|
||||
@@ -310,8 +331,6 @@ public:
|
||||
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
|
||||
bool IsReadOnly() const { return cb.IsReadOnly(); }
|
||||
|
||||
bool InsertChar(int pos, char ch);
|
||||
bool InsertCString(int position, const char *s);
|
||||
void DelChar(int pos);
|
||||
void DelCharBack(int pos);
|
||||
|
||||
@@ -332,6 +351,7 @@ public:
|
||||
void DeleteAllMarks(int markerNum);
|
||||
int LineFromHandle(int markerHandle);
|
||||
int SCI_METHOD LineStart(int line) const;
|
||||
bool IsLineStartPosition(int position) const;
|
||||
int SCI_METHOD LineEnd(int line) const;
|
||||
int LineEndPosition(int position) const;
|
||||
bool IsLineEndPosition(int position) const;
|
||||
@@ -351,6 +371,16 @@ public:
|
||||
int NextWordEnd(int pos, int delta);
|
||||
int SCI_METHOD Length() const { return cb.Length(); }
|
||||
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 HasCaseFolder(void) const;
|
||||
void SetCaseFolder(CaseFolder *pcf_);
|
||||
@@ -361,8 +391,7 @@ public:
|
||||
|
||||
void SetDefaultCharClasses(bool includeWordClass);
|
||||
void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
|
||||
int GetCharsOfClass(CharClassify::cc charClass, unsigned char *buffer);
|
||||
void SetStylingBits(int bits);
|
||||
int GetCharsOfClass(CharClassify::cc characterClass, unsigned char *buffer);
|
||||
void SCI_METHOD StartStyling(int position, char mask);
|
||||
bool SCI_METHOD SetStyleFor(int length, char style);
|
||||
bool SCI_METHOD SetStyles(int length, const char *styles);
|
||||
|
||||
77
src/stc/scintilla/src/EditModel.cxx
Normal file
77
src/stc/scintilla/src/EditModel.cxx
Normal 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;
|
||||
}
|
||||
70
src/stc/scintilla/src/EditModel.h
Normal file
70
src/stc/scintilla/src/EditModel.h
Normal 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
|
||||
2117
src/stc/scintilla/src/EditView.cxx
Normal file
2117
src/stc/scintilla/src/EditView.cxx
Normal file
File diff suppressed because it is too large
Load Diff
174
src/stc/scintilla/src/EditView.h
Normal file
174
src/stc/scintilla/src/EditView.h
Normal 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
@@ -12,17 +12,6 @@
|
||||
namespace Scintilla {
|
||||
#endif
|
||||
|
||||
/**
|
||||
*/
|
||||
class Caret {
|
||||
public:
|
||||
bool active;
|
||||
bool on;
|
||||
int period;
|
||||
|
||||
Caret();
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
class Timer {
|
||||
@@ -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
|
||||
Editor(const Editor &);
|
||||
Editor &operator=(const Editor &);
|
||||
@@ -189,32 +171,17 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
Point sizeRGBAImage;
|
||||
float scaleRGBAImage;
|
||||
|
||||
PrintParameters printParameters;
|
||||
MarginView marginView;
|
||||
EditView view;
|
||||
|
||||
int cursorMode;
|
||||
|
||||
// Highlight current folding block
|
||||
HighlightDelimiter highlightDelimiter;
|
||||
|
||||
bool hasFocus;
|
||||
bool hideSelection;
|
||||
bool inOverstrike;
|
||||
bool drawOverstrikeCaret;
|
||||
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
|
||||
bool horizontalScrollBarVisible;
|
||||
int scrollWidth;
|
||||
bool trackLineWidth;
|
||||
int lineWidthMaxSeen;
|
||||
bool verticalScrollBarVisible;
|
||||
bool endAtLastLine;
|
||||
int caretSticky;
|
||||
@@ -223,25 +190,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
bool multipleSelection;
|
||||
bool additionalSelectionTyping;
|
||||
int multiPasteMode;
|
||||
bool additionalCaretsBlink;
|
||||
bool additionalCaretsVisible;
|
||||
|
||||
int virtualSpaceOptions;
|
||||
|
||||
Surface *pixmapLine;
|
||||
Surface *pixmapSelMargin;
|
||||
Surface *pixmapSelPattern;
|
||||
Surface *pixmapSelPatternOffset1;
|
||||
Surface *pixmapIndentGuide;
|
||||
Surface *pixmapIndentGuideHighlight;
|
||||
|
||||
LineLayoutCache llc;
|
||||
PositionCache posCache;
|
||||
SpecialRepresentations reprs;
|
||||
|
||||
KeyMap kmap;
|
||||
|
||||
Caret caret;
|
||||
Timer timer;
|
||||
Timer autoScrollTimer;
|
||||
enum { autoScrollDelay = 200 };
|
||||
@@ -250,6 +203,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
Point lastClick;
|
||||
unsigned int lastClickTime;
|
||||
Point doubleClickCloseThreshold;
|
||||
int dwellDelay;
|
||||
int ticksToDwell;
|
||||
bool dwelling;
|
||||
@@ -257,7 +211,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
Point ptMouseLast;
|
||||
enum { ddNone, ddInitial, ddDragging } inDragDrop;
|
||||
bool dropWentOutside;
|
||||
SelectionPosition posDrag;
|
||||
SelectionPosition posDrop;
|
||||
int hotSpotClickPos;
|
||||
int lastXChosen;
|
||||
@@ -274,9 +227,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
int lengthForEncode;
|
||||
|
||||
int needUpdateUI;
|
||||
Position braces[2];
|
||||
int bracesMatchStyle;
|
||||
int highlightGuideColumn;
|
||||
|
||||
enum { notPainting, painting, paintAbandoned } paintState;
|
||||
bool paintAbandonedByStyling;
|
||||
@@ -288,8 +238,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
int modEventMask;
|
||||
|
||||
SelectionText drag;
|
||||
Selection sel;
|
||||
bool primarySelection;
|
||||
|
||||
int caretXPolicy;
|
||||
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;
|
||||
|
||||
int foldFlags;
|
||||
int foldAutomatic;
|
||||
ContractionState cs;
|
||||
|
||||
// Hotspot support
|
||||
int hsStart;
|
||||
int hsEnd;
|
||||
|
||||
// Wrapping support
|
||||
int wrapWidth;
|
||||
WrapPending wrapPending;
|
||||
|
||||
bool convertPastes;
|
||||
|
||||
Document *pdoc;
|
||||
|
||||
Editor();
|
||||
virtual ~Editor();
|
||||
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
|
||||
// scroll views where it will be equivalent to the current scroll position.
|
||||
virtual Point GetVisibleOriginInMain();
|
||||
Point DocumentPointFromView(Point ptView); // Convert a point from view space to document
|
||||
virtual Point GetVisibleOriginInMain() const;
|
||||
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
|
||||
virtual PRectangle GetClientRectangle();
|
||||
virtual PRectangle GetClientRectangle() const;
|
||||
virtual PRectangle GetClientDrawingRectangle();
|
||||
PRectangle GetTextRectangle();
|
||||
PRectangle GetTextRectangle() const;
|
||||
|
||||
int LinesOnScreen();
|
||||
int LinesToScroll();
|
||||
int MaxScrollPos();
|
||||
virtual int LinesOnScreen() const;
|
||||
int LinesToScroll() const;
|
||||
int MaxScrollPos() const;
|
||||
SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const;
|
||||
Point LocationFromPosition(SelectionPosition pos);
|
||||
Point LocationFromPosition(int pos);
|
||||
int XFromPosition(int pos);
|
||||
int XFromPosition(SelectionPosition sp);
|
||||
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);
|
||||
int PositionFromLineX(int line, int x);
|
||||
int LineFromLocation(Point pt) const;
|
||||
void SetTopLine(int topLineNew);
|
||||
|
||||
bool AbandonPaint();
|
||||
virtual bool AbandonPaint();
|
||||
virtual void RedrawRect(PRectangle rc);
|
||||
virtual void DiscardOverdraw();
|
||||
virtual void Redraw();
|
||||
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);
|
||||
|
||||
bool UserVirtualSpace() const {
|
||||
@@ -384,8 +323,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
bool SelectionContainsProtected();
|
||||
int MovePositionOutsideChar(int 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(int 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 selt=Selection::noSel, bool ensureVisible=true);
|
||||
SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir);
|
||||
SelectionPosition MovePositionSoVisible(int pos, int moveDir);
|
||||
Point PointMainCaret();
|
||||
@@ -420,6 +359,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void ScrollRange(SelectionRange range);
|
||||
void ShowCaretAtCurrentPosition();
|
||||
void DropCaret();
|
||||
void CaretSetPeriod(int period);
|
||||
void InvalidateCaret();
|
||||
virtual void UpdateSystemCaret();
|
||||
|
||||
@@ -431,31 +371,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void LinesJoin();
|
||||
void LinesSplit(int pixelWidth);
|
||||
|
||||
int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const;
|
||||
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 Paint(Surface *surfaceWindow, PRectangle rcArea);
|
||||
long FormatRange(bool draw, Sci_RangeToFormat *pfr);
|
||||
@@ -471,9 +387,12 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void FilterSelections();
|
||||
int InsertSpace(int position, unsigned int spaces);
|
||||
void AddChar(char ch);
|
||||
virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);
|
||||
void InsertPaste(SelectionPosition selStart, const char *text, int len);
|
||||
void ClearSelection(bool retainMultipleSelections=false);
|
||||
virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false);
|
||||
void FillVirtualSpace();
|
||||
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 ClearDocumentStyle();
|
||||
void Cut();
|
||||
@@ -486,7 +405,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void SelectAll();
|
||||
void Undo();
|
||||
void Redo();
|
||||
void DelChar();
|
||||
void DelCharBack(bool allowLineStartDeletion);
|
||||
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 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 };
|
||||
virtual std::string CaseMapString(const std::string &s, int caseMapping);
|
||||
void ChangeCaseOfSelection(int caseMapping);
|
||||
@@ -537,8 +455,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void Duplicate(bool forLine);
|
||||
virtual void CancelModes();
|
||||
void NewLine();
|
||||
void CursorUpOrDown(int direction, Selection::selTypes sel=Selection::noSel);
|
||||
void ParaUpOrDown(int direction, Selection::selTypes sel=Selection::noSel);
|
||||
void CursorUpOrDown(int direction, Selection::selTypes selt=Selection::noSel);
|
||||
void ParaUpOrDown(int direction, Selection::selTypes selt=Selection::noSel);
|
||||
int StartEndDisplayLine(int pos, bool start);
|
||||
virtual int KeyCommand(unsigned int iMessage);
|
||||
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. */
|
||||
bool PositionInSelection(int pos);
|
||||
bool PointInSelection(Point pt);
|
||||
bool PointInSelMargin(Point pt);
|
||||
bool PointInSelMargin(Point pt) const;
|
||||
Window::Cursor GetMarginCursor(Point pt) const;
|
||||
void TrimAndSetSelection(int currentPos_, int anchor_);
|
||||
void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine);
|
||||
@@ -583,7 +501,13 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
void Tick();
|
||||
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 void SetMouseCapture(bool on) = 0;
|
||||
virtual bool HaveMouseCapture() = 0;
|
||||
@@ -620,7 +544,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
bool PositionIsHotspot(int position) const;
|
||||
bool PointIsHotspot(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;
|
||||
virtual bool ValidCodePage(int /* codePage */) const { return true; }
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "Platform.h"
|
||||
|
||||
#include "Scintilla.h"
|
||||
#include "XPM.h"
|
||||
#include "Indicator.h"
|
||||
#include "XPM.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
@@ -20,17 +20,24 @@ using namespace Scintilla;
|
||||
|
||||
static PRectangle PixelGridAlign(const PRectangle &rc) {
|
||||
// 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) {
|
||||
surface->PenColour(fore);
|
||||
int ymid = (rc.bottom + rc.top) / 2;
|
||||
if (style == INDIC_SQUIGGLE) {
|
||||
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState, int value) const {
|
||||
StyleAndColour sacDraw = sacNormal;
|
||||
if (Flags() & SC_INDICFLAG_VALUEFORE) {
|
||||
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 xLast = int(rc.right+0.5);
|
||||
int y = 0;
|
||||
surface->MoveTo(x, rc.top + y);
|
||||
surface->MoveTo(x, static_cast<int>(rc.top) + y);
|
||||
while (x < xLast) {
|
||||
if ((x + 2) > xLast) {
|
||||
if (xLast > x)
|
||||
@@ -40,41 +47,41 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
|
||||
x += 2;
|
||||
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);
|
||||
|
||||
int width = Platform::Minimum(4000, rcSquiggle.Width());
|
||||
int width = Platform::Minimum(4000, static_cast<int>(rcSquiggle.Width()));
|
||||
RGBAImage image(width, 3, 1.0, 0);
|
||||
enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f };
|
||||
for (int x = 0; x < width; x++) {
|
||||
if (x%2) {
|
||||
// Two halfway columns have a full pixel in middle flanked by light pixels
|
||||
image.SetPixel(x, 0, fore, alphaSide);
|
||||
image.SetPixel(x, 1, fore, alphaFull);
|
||||
image.SetPixel(x, 2, fore, alphaSide);
|
||||
image.SetPixel(x, 0, sacDraw.fore, alphaSide);
|
||||
image.SetPixel(x, 1, sacDraw.fore, alphaFull);
|
||||
image.SetPixel(x, 2, sacDraw.fore, alphaSide);
|
||||
} else {
|
||||
// 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, 1, fore, alphaSide2);
|
||||
image.SetPixel(x, (x % 4) ? 0 : 2, sacDraw.fore, alphaFull);
|
||||
image.SetPixel(x, 1, sacDraw.fore, alphaSide2);
|
||||
}
|
||||
}
|
||||
surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels());
|
||||
} else if (style == INDIC_SQUIGGLELOW) {
|
||||
surface->MoveTo(rc.left, rc.top);
|
||||
int x = rc.left + 3;
|
||||
} else if (sacDraw.style == INDIC_SQUIGGLELOW) {
|
||||
surface->MoveTo(static_cast<int>(rc.left), static_cast<int>(rc.top));
|
||||
int x = static_cast<int>(rc.left) + 3;
|
||||
int y = 0;
|
||||
while (x < rc.right) {
|
||||
surface->LineTo(x-1, rc.top + y);
|
||||
surface->LineTo(x - 1, static_cast<int>(rc.top) + y);
|
||||
y = 1 - y;
|
||||
surface->LineTo(x, rc.top + y);
|
||||
surface->LineTo(x, static_cast<int>(rc.top) + y);
|
||||
x += 3;
|
||||
}
|
||||
surface->LineTo(rc.right, rc.top + y); // Finish the line
|
||||
} else if (style == INDIC_TT) {
|
||||
surface->MoveTo(rc.left, ymid);
|
||||
int x = rc.left + 5;
|
||||
surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rc.top) + y); // Finish the line
|
||||
} else if (sacDraw.style == INDIC_TT) {
|
||||
surface->MoveTo(static_cast<int>(rc.left), ymid);
|
||||
int x = static_cast<int>(rc.left) + 5;
|
||||
while (x < rc.right) {
|
||||
surface->LineTo(x, 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);
|
||||
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) {
|
||||
surface->MoveTo(x-3, ymid);
|
||||
surface->LineTo(x-3, ymid+2);
|
||||
}
|
||||
} else if (style == INDIC_DIAGONAL) {
|
||||
int x = rc.left;
|
||||
} else if (sacDraw.style == INDIC_DIAGONAL) {
|
||||
int x = static_cast<int>(rc.left);
|
||||
while (x < rc.right) {
|
||||
surface->MoveTo(x, rc.top+2);
|
||||
surface->MoveTo(x, static_cast<int>(rc.top) + 2);
|
||||
int endX = x+3;
|
||||
int endY = rc.top - 1;
|
||||
int endY = static_cast<int>(rc.top) - 1;
|
||||
if (endX > rc.right) {
|
||||
endY += endX - rc.right;
|
||||
endX = rc.right;
|
||||
endY += endX - static_cast<int>(rc.right);
|
||||
endX = static_cast<int>(rc.right);
|
||||
}
|
||||
surface->LineTo(endX, endY);
|
||||
x += 4;
|
||||
}
|
||||
} else if (style == INDIC_STRIKE) {
|
||||
surface->MoveTo(rc.left, rc.top - 4);
|
||||
surface->LineTo(rc.right, rc.top - 4);
|
||||
} else if (style == INDIC_HIDDEN) {
|
||||
} else if (sacDraw.style == INDIC_STRIKE) {
|
||||
surface->MoveTo(static_cast<int>(rc.left), static_cast<int>(rc.top) - 4);
|
||||
surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rc.top) - 4);
|
||||
} else if ((sacDraw.style == INDIC_HIDDEN) || (sacDraw.style == INDIC_TEXTFORE)) {
|
||||
// Draw nothing
|
||||
} else if (style == INDIC_BOX) {
|
||||
surface->MoveTo(rc.left, ymid+1);
|
||||
surface->LineTo(rc.right, ymid+1);
|
||||
surface->LineTo(rc.right, rcLine.top+1);
|
||||
surface->LineTo(rc.left, rcLine.top+1);
|
||||
surface->LineTo(rc.left, ymid+1);
|
||||
} else if (style == INDIC_ROUNDBOX || style == INDIC_STRAIGHTBOX) {
|
||||
} else if (sacDraw.style == INDIC_BOX) {
|
||||
surface->MoveTo(static_cast<int>(rc.left), ymid + 1);
|
||||
surface->LineTo(static_cast<int>(rc.right), ymid + 1);
|
||||
surface->LineTo(static_cast<int>(rc.right), static_cast<int>(rcLine.top) + 1);
|
||||
surface->LineTo(static_cast<int>(rc.left), static_cast<int>(rcLine.top) + 1);
|
||||
surface->LineTo(static_cast<int>(rc.left), ymid + 1);
|
||||
} else if (sacDraw.style == INDIC_ROUNDBOX ||
|
||||
sacDraw.style == INDIC_STRAIGHTBOX ||
|
||||
sacDraw.style == INDIC_FULLBOX) {
|
||||
PRectangle rcBox = rcLine;
|
||||
if (sacDraw.style != INDIC_FULLBOX)
|
||||
rcBox.top = rcLine.top + 1;
|
||||
rcBox.left = rc.left;
|
||||
rcBox.right = rc.right;
|
||||
surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore, fillAlpha, fore, outlineAlpha, 0);
|
||||
} else if (style == INDIC_DOTBOX) {
|
||||
surface->AlphaRectangle(rcBox, (sacDraw.style == INDIC_ROUNDBOX) ? 1 : 0,
|
||||
sacDraw.fore, fillAlpha, sacDraw.fore, outlineAlpha, 0);
|
||||
} else if (sacDraw.style == INDIC_DOTBOX) {
|
||||
PRectangle rcBox = PixelGridAlign(rc);
|
||||
rcBox.top = rcLine.top + 1;
|
||||
rcBox.bottom = rcLine.bottom;
|
||||
// Cap width at 4000 to avoid large allocations when mistakes made
|
||||
int width = Platform::Minimum(rcBox.Width(), 4000);
|
||||
RGBAImage image(width, rcBox.Height(), 1.0, 0);
|
||||
int width = Platform::Minimum(static_cast<int>(rcBox.Width()), 4000);
|
||||
RGBAImage image(width, static_cast<int>(rcBox.Height()), 1.0, 0);
|
||||
// Draw horizontal lines top and bottom
|
||||
for (int x=0; x<width; x++) {
|
||||
for (int y=0; y<rcBox.Height(); y += rcBox.Height()-1) {
|
||||
image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
|
||||
for (int y = 0; y<static_cast<int>(rcBox.Height()); y += static_cast<int>(rcBox.Height()) - 1) {
|
||||
image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
|
||||
}
|
||||
}
|
||||
// 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) {
|
||||
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());
|
||||
} else if (style == INDIC_DASH) {
|
||||
int x = rc.left;
|
||||
} else if (sacDraw.style == INDIC_DASH) {
|
||||
int x = static_cast<int>(rc.left);
|
||||
while (x < rc.right) {
|
||||
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;
|
||||
}
|
||||
} else if (style == INDIC_DOTS) {
|
||||
int x = rc.left;
|
||||
while (x < rc.right) {
|
||||
PRectangle rcDot(x, ymid, x+1, ymid+1);
|
||||
surface->FillRectangle(rcDot, fore);
|
||||
} else if (sacDraw.style == INDIC_DOTS) {
|
||||
int x = static_cast<int>(rc.left);
|
||||
while (x < static_cast<int>(rc.right)) {
|
||||
PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1);
|
||||
surface->FillRectangle(rcDot, sacDraw.fore);
|
||||
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);
|
||||
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
|
||||
surface->MoveTo(rc.left, ymid);
|
||||
surface->LineTo(rc.right, ymid);
|
||||
surface->MoveTo(static_cast<int>(rc.left), ymid);
|
||||
surface->LineTo(static_cast<int>(rc.right), ymid);
|
||||
}
|
||||
}
|
||||
|
||||
void Indicator::SetFlags(int attributes_) {
|
||||
attributes = attributes_;
|
||||
}
|
||||
|
||||
@@ -12,18 +12,45 @@
|
||||
namespace Scintilla {
|
||||
#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 {
|
||||
public:
|
||||
int style;
|
||||
enum DrawState { drawNormal, drawHover };
|
||||
StyleAndColour sacNormal;
|
||||
StyleAndColour sacHover;
|
||||
bool under;
|
||||
ColourDesired fore;
|
||||
int fillAlpha;
|
||||
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
|
||||
|
||||
@@ -37,58 +37,63 @@ void LineMarker::SetXPM(const char *const *linesForm) {
|
||||
|
||||
void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage) {
|
||||
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;
|
||||
}
|
||||
|
||||
static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) {
|
||||
PRectangle rc;
|
||||
rc.left = centreX - armSize;
|
||||
rc.top = centreY - armSize;
|
||||
rc.right = centreX + armSize + 1;
|
||||
rc.bottom = centreY + armSize + 1;
|
||||
PRectangle rc = PRectangle::FromInts(
|
||||
centreX - armSize,
|
||||
centreY - armSize,
|
||||
centreX + armSize + 1,
|
||||
centreY + armSize + 1);
|
||||
surface->RectangleDraw(rc, back, fore);
|
||||
}
|
||||
|
||||
static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) {
|
||||
PRectangle rcCircle;
|
||||
rcCircle.left = centreX - armSize;
|
||||
rcCircle.top = centreY - armSize;
|
||||
rcCircle.right = centreX + armSize + 1;
|
||||
rcCircle.bottom = centreY + armSize + 1;
|
||||
PRectangle rcCircle = PRectangle::FromInts(
|
||||
centreX - armSize,
|
||||
centreY - armSize,
|
||||
centreX + armSize + 1,
|
||||
centreY + armSize + 1);
|
||||
surface->Ellipse(rcCircle, back, 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);
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) {
|
||||
ColourDesired head = back;
|
||||
ColourDesired body = back;
|
||||
ColourDesired tail = back;
|
||||
void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const {
|
||||
if (customDraw != NULL) {
|
||||
customDraw(surface, rcWhole, fontForCharacter, tFold, marginStyle, this);
|
||||
return;
|
||||
}
|
||||
|
||||
ColourDesired colourHead = back;
|
||||
ColourDesired colourBody = back;
|
||||
ColourDesired colourTail = back;
|
||||
|
||||
switch (tFold) {
|
||||
case LineMarker::head :
|
||||
case LineMarker::headWithTail :
|
||||
head = backSelected;
|
||||
tail = backSelected;
|
||||
colourHead = backSelected;
|
||||
colourTail = backSelected;
|
||||
break;
|
||||
case LineMarker::body :
|
||||
head = backSelected;
|
||||
body = backSelected;
|
||||
colourHead = backSelected;
|
||||
colourBody = backSelected;
|
||||
break;
|
||||
case LineMarker::tail :
|
||||
body = backSelected;
|
||||
tail = backSelected;
|
||||
colourBody = backSelected;
|
||||
colourTail = backSelected;
|
||||
break;
|
||||
default :
|
||||
// LineMarker::undefined
|
||||
@@ -102,9 +107,9 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
if ((markType == SC_MARK_RGBAIMAGE) && (image)) {
|
||||
// Make rectangle just large enough to fit image centred on centre of rcWhole
|
||||
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.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();
|
||||
surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels());
|
||||
return;
|
||||
@@ -113,17 +118,17 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
PRectangle rc = rcWhole;
|
||||
rc.top++;
|
||||
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
|
||||
int centreX = floor((rc.right + rc.left) / 2.0);
|
||||
int centreY = floor((rc.bottom + rc.top) / 2.0);
|
||||
int centreX = static_cast<int>(floor((rc.right + rc.left) / 2.0));
|
||||
int centreY = static_cast<int>(floor((rc.bottom + rc.top) / 2.0));
|
||||
int dimOn2 = minDim / 2;
|
||||
int dimOn4 = minDim / 4;
|
||||
int blobSize = dimOn2-1;
|
||||
int armSize = dimOn2-2;
|
||||
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
|
||||
centreX = rc.left + dimOn2 + 1;
|
||||
centreX = static_cast<int>(rc.left) + dimOn2 + 1;
|
||||
}
|
||||
if (markType == SC_MARK_ROUNDRECT) {
|
||||
PRectangle rcRounded = rc;
|
||||
@@ -131,51 +136,51 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
rcRounded.right = rc.right - 1;
|
||||
surface->RoundedRectangle(rcRounded, fore, back);
|
||||
} else if (markType == SC_MARK_CIRCLE) {
|
||||
PRectangle rcCircle;
|
||||
rcCircle.left = centreX - dimOn2;
|
||||
rcCircle.top = centreY - dimOn2;
|
||||
rcCircle.right = centreX + dimOn2;
|
||||
rcCircle.bottom = centreY + dimOn2;
|
||||
PRectangle rcCircle = PRectangle::FromInts(
|
||||
centreX - dimOn2,
|
||||
centreY - dimOn2,
|
||||
centreX + dimOn2,
|
||||
centreY + dimOn2);
|
||||
surface->Ellipse(rcCircle, fore, back);
|
||||
} else if (markType == SC_MARK_ARROW) {
|
||||
Point pts[] = {
|
||||
Point(centreX - dimOn4, centreY - dimOn2),
|
||||
Point(centreX - dimOn4, centreY + dimOn2),
|
||||
Point(centreX + dimOn2 - dimOn4, centreY),
|
||||
Point::FromInts(centreX - dimOn4, centreY - dimOn2),
|
||||
Point::FromInts(centreX - dimOn4, centreY + dimOn2),
|
||||
Point::FromInts(centreX + dimOn2 - dimOn4, centreY),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
|
||||
} else if (markType == SC_MARK_ARROWDOWN) {
|
||||
Point pts[] = {
|
||||
Point(centreX - dimOn2, centreY - dimOn4),
|
||||
Point(centreX + dimOn2, centreY - dimOn4),
|
||||
Point(centreX, centreY + dimOn2 - dimOn4),
|
||||
Point::FromInts(centreX - dimOn2, centreY - dimOn4),
|
||||
Point::FromInts(centreX + dimOn2, centreY - dimOn4),
|
||||
Point::FromInts(centreX, centreY + dimOn2 - dimOn4),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
|
||||
} else if (markType == SC_MARK_PLUS) {
|
||||
Point pts[] = {
|
||||
Point(centreX - armSize, centreY - 1),
|
||||
Point(centreX - 1, centreY - 1),
|
||||
Point(centreX - 1, centreY - armSize),
|
||||
Point(centreX + 1, centreY - armSize),
|
||||
Point(centreX + 1, centreY - 1),
|
||||
Point(centreX + armSize, centreY -1),
|
||||
Point(centreX + armSize, centreY +1),
|
||||
Point(centreX + 1, centreY + 1),
|
||||
Point(centreX + 1, centreY + armSize),
|
||||
Point(centreX - 1, centreY + armSize),
|
||||
Point(centreX - 1, centreY + 1),
|
||||
Point(centreX - armSize, centreY + 1),
|
||||
Point::FromInts(centreX - armSize, centreY - 1),
|
||||
Point::FromInts(centreX - 1, centreY - 1),
|
||||
Point::FromInts(centreX - 1, centreY - armSize),
|
||||
Point::FromInts(centreX + 1, centreY - armSize),
|
||||
Point::FromInts(centreX + 1, centreY - 1),
|
||||
Point::FromInts(centreX + armSize, centreY -1),
|
||||
Point::FromInts(centreX + armSize, centreY +1),
|
||||
Point::FromInts(centreX + 1, centreY + 1),
|
||||
Point::FromInts(centreX + 1, centreY + armSize),
|
||||
Point::FromInts(centreX - 1, centreY + armSize),
|
||||
Point::FromInts(centreX - 1, centreY + 1),
|
||||
Point::FromInts(centreX - armSize, centreY + 1),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
|
||||
} else if (markType == SC_MARK_MINUS) {
|
||||
Point pts[] = {
|
||||
Point(centreX - armSize, centreY - 1),
|
||||
Point(centreX + armSize, centreY -1),
|
||||
Point(centreX + armSize, centreY +1),
|
||||
Point(centreX - armSize, centreY + 1),
|
||||
Point::FromInts(centreX - armSize, centreY - 1),
|
||||
Point::FromInts(centreX + armSize, centreY -1),
|
||||
Point::FromInts(centreX + armSize, centreY +1),
|
||||
Point::FromInts(centreX - armSize, centreY + 1),
|
||||
};
|
||||
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
|
||||
|
||||
} else if (markType == SC_MARK_VLINE) {
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
} else if (markType == SC_MARK_LCORNER) {
|
||||
surface->PenColour(tail);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->PenColour(colourTail);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
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) {
|
||||
surface->PenColour(tail);
|
||||
surface->PenColour(colourTail);
|
||||
surface->MoveTo(centreX, centreY);
|
||||
surface->LineTo(rc.right - 1, centreY);
|
||||
surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY + 1);
|
||||
|
||||
surface->PenColour(head);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->PenColour(colourHead);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
} else if (markType == SC_MARK_LCORNERCURVE) {
|
||||
surface->PenColour(tail);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->PenColour(colourTail);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY-3);
|
||||
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) {
|
||||
surface->PenColour(tail);
|
||||
surface->PenColour(colourTail);
|
||||
surface->MoveTo(centreX, centreY-3);
|
||||
surface->LineTo(centreX+3, centreY);
|
||||
surface->LineTo(rc.right - 1, centreY);
|
||||
surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY-2);
|
||||
|
||||
surface->PenColour(head);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->PenColour(colourHead);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
} else if (markType == SC_MARK_BOXPLUS) {
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, head);
|
||||
DrawPlus(surface, centreX, centreY, blobSize, tail);
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, colourHead);
|
||||
DrawPlus(surface, centreX, centreY, blobSize, colourTail);
|
||||
|
||||
} else if (markType == SC_MARK_BOXPLUSCONNECTED) {
|
||||
if (tFold == LineMarker::headWithTail)
|
||||
surface->PenColour(tail);
|
||||
surface->PenColour(colourTail);
|
||||
else
|
||||
surface->PenColour(body);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY - blobSize);
|
||||
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, head);
|
||||
DrawPlus(surface, centreX, centreY, blobSize, tail);
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, colourHead);
|
||||
DrawPlus(surface, centreX, centreY, blobSize, colourTail);
|
||||
|
||||
if (tFold == LineMarker::body) {
|
||||
surface->PenColour(tail);
|
||||
surface->PenColour(colourTail);
|
||||
surface->MoveTo(centreX + 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);
|
||||
}
|
||||
} else if (markType == SC_MARK_BOXMINUS) {
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, head);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, tail);
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, colourHead);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, colourTail);
|
||||
|
||||
surface->PenColour(head);
|
||||
surface->PenColour(colourHead);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
} else if (markType == SC_MARK_BOXMINUSCONNECTED) {
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, head);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, tail);
|
||||
DrawBox(surface, centreX, centreY, blobSize, fore, colourHead);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, colourTail);
|
||||
|
||||
surface->PenColour(head);
|
||||
surface->PenColour(colourHead);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY - blobSize);
|
||||
|
||||
if (tFold == LineMarker::body) {
|
||||
surface->PenColour(tail);
|
||||
surface->PenColour(colourTail);
|
||||
surface->MoveTo(centreX + 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);
|
||||
}
|
||||
} else if (markType == SC_MARK_CIRCLEPLUS) {
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
|
||||
DrawPlus(surface, centreX, centreY, blobSize, tail);
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead);
|
||||
DrawPlus(surface, centreX, centreY, blobSize, colourTail);
|
||||
|
||||
} else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) {
|
||||
if (tFold == LineMarker::headWithTail)
|
||||
surface->PenColour(tail);
|
||||
surface->PenColour(colourTail);
|
||||
else
|
||||
surface->PenColour(body);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY - blobSize);
|
||||
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
|
||||
DrawPlus(surface, centreX, centreY, blobSize, tail);
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead);
|
||||
DrawPlus(surface, centreX, centreY, blobSize, colourTail);
|
||||
|
||||
} else if (markType == SC_MARK_CIRCLEMINUS) {
|
||||
surface->PenColour(head);
|
||||
surface->PenColour(colourHead);
|
||||
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);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, tail);
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, colourTail);
|
||||
|
||||
} else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) {
|
||||
surface->PenColour(head);
|
||||
surface->PenColour(colourHead);
|
||||
surface->MoveTo(centreX, centreY + blobSize);
|
||||
surface->LineTo(centreX, rcWhole.bottom);
|
||||
surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
|
||||
|
||||
surface->PenColour(body);
|
||||
surface->MoveTo(centreX, rcWhole.top);
|
||||
surface->PenColour(colourBody);
|
||||
surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
|
||||
surface->LineTo(centreX, centreY - blobSize);
|
||||
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, tail);
|
||||
DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead);
|
||||
DrawMinus(surface, centreX, centreY, blobSize, colourTail);
|
||||
|
||||
} else if (markType >= SC_MARK_CHARACTER) {
|
||||
char character[1];
|
||||
@@ -344,11 +349,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
character, 1, fore, back);
|
||||
|
||||
} else if (markType == SC_MARK_DOTDOTDOT) {
|
||||
int right = centreX - 6;
|
||||
XYPOSITION right = static_cast<XYPOSITION>(centreX - 6);
|
||||
for (int b=0; b<3; b++) {
|
||||
PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2);
|
||||
surface->FillRectangle(rcBlob, fore);
|
||||
right += 5;
|
||||
right += 5.0f;
|
||||
}
|
||||
} else if (markType == SC_MARK_ARROWS) {
|
||||
surface->PenColour(fore);
|
||||
@@ -363,14 +368,14 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
|
||||
}
|
||||
} else if (markType == SC_MARK_SHORTARROW) {
|
||||
Point pts[] = {
|
||||
Point(centreX, centreY + dimOn2),
|
||||
Point(centreX + dimOn2, centreY),
|
||||
Point(centreX, centreY - dimOn2),
|
||||
Point(centreX, centreY - dimOn4),
|
||||
Point(centreX - dimOn4, centreY - dimOn4),
|
||||
Point(centreX - dimOn4, centreY + dimOn4),
|
||||
Point(centreX, centreY + dimOn4),
|
||||
Point(centreX, centreY + dimOn2),
|
||||
Point::FromInts(centreX, centreY + dimOn2),
|
||||
Point::FromInts(centreX + dimOn2, centreY),
|
||||
Point::FromInts(centreX, centreY - dimOn2),
|
||||
Point::FromInts(centreX, centreY - dimOn4),
|
||||
Point::FromInts(centreX - dimOn4, centreY - dimOn4),
|
||||
Point::FromInts(centreX - dimOn4, centreY + dimOn4),
|
||||
Point::FromInts(centreX, centreY + dimOn4),
|
||||
Point::FromInts(centreX, centreY + dimOn2),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
} 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) {
|
||||
int halfHeight = minDim / 3;
|
||||
Point pts[] = {
|
||||
Point(rc.left, centreY-halfHeight),
|
||||
Point(rc.right-3, centreY-halfHeight),
|
||||
Point(rc.right-3-halfHeight, centreY),
|
||||
Point(rc.right-3, centreY+halfHeight),
|
||||
Point(rc.left, centreY+halfHeight),
|
||||
Point::FromInts(static_cast<int>(rc.left), centreY-halfHeight),
|
||||
Point::FromInts(static_cast<int>(rc.right) - 3, centreY - halfHeight),
|
||||
Point::FromInts(static_cast<int>(rc.right) - 3 - halfHeight, centreY),
|
||||
Point::FromInts(static_cast<int>(rc.right) - 3, centreY + halfHeight),
|
||||
Point::FromInts(static_cast<int>(rc.left), centreY + halfHeight),
|
||||
};
|
||||
surface->Polygon(pts, ELEMENTS(pts), fore, back);
|
||||
} else { // SC_MARK_FULLRECT
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
namespace Scintilla {
|
||||
#endif
|
||||
|
||||
typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker);
|
||||
|
||||
/**
|
||||
*/
|
||||
class LineMarker {
|
||||
@@ -25,6 +27,11 @@ public:
|
||||
int alpha;
|
||||
XPM *pxpm;
|
||||
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() {
|
||||
markType = SC_MARK_CIRCLE;
|
||||
fore = ColourDesired(0,0,0);
|
||||
@@ -33,6 +40,7 @@ public:
|
||||
alpha = SC_ALPHA_NOALPHA;
|
||||
pxpm = NULL;
|
||||
image = NULL;
|
||||
customDraw = NULL;
|
||||
}
|
||||
LineMarker(const LineMarker &) {
|
||||
// Defined to avoid pxpm being blindly copied, not as a complete copy constructor
|
||||
@@ -43,6 +51,7 @@ public:
|
||||
alpha = SC_ALPHA_NOALPHA;
|
||||
pxpm = NULL;
|
||||
image = NULL;
|
||||
customDraw = NULL;
|
||||
}
|
||||
~LineMarker() {
|
||||
delete pxpm;
|
||||
@@ -60,13 +69,14 @@ public:
|
||||
pxpm = NULL;
|
||||
delete image;
|
||||
image = NULL;
|
||||
customDraw = NULL;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
void SetXPM(const char *textForm);
|
||||
void SetXPM(const char *const *linesForm);
|
||||
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
|
||||
|
||||
470
src/stc/scintilla/src/MarginView.cxx
Normal file
470
src/stc/scintilla/src/MarginView.cxx
Normal 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
|
||||
|
||||
50
src/stc/scintilla/src/MarginView.h
Normal file
50
src/stc/scintilla/src/MarginView.h
Normal 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
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Platform.h"
|
||||
@@ -484,3 +485,72 @@ int LineAnnotation::Lines(int line) const {
|
||||
else
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -112,6 +112,23 @@ public:
|
||||
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
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -17,6 +18,7 @@
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
#include "SplitVector.h"
|
||||
@@ -32,7 +34,6 @@
|
||||
#include "ViewStyle.h"
|
||||
#include "CharClassify.h"
|
||||
#include "Decoration.h"
|
||||
#include "ILexer.h"
|
||||
#include "CaseFolder.h"
|
||||
#include "Document.h"
|
||||
#include "UniConversion.h"
|
||||
@@ -54,16 +55,12 @@ LineLayout::LineLayout(int maxLineLength_) :
|
||||
validity(llInvalid),
|
||||
xHighlightGuide(0),
|
||||
highlightColumn(0),
|
||||
psel(NULL),
|
||||
containsCaret(false),
|
||||
edgeColumn(0),
|
||||
chars(0),
|
||||
styles(0),
|
||||
styleBitsSet(0),
|
||||
indicators(0),
|
||||
positions(0),
|
||||
hsStart(0),
|
||||
hsEnd(0),
|
||||
hotspot(0,0),
|
||||
widthLine(wrapWidthInfinite),
|
||||
lines(1),
|
||||
wrapIndent(0) {
|
||||
@@ -81,7 +78,6 @@ void LineLayout::Resize(int maxLineLength_) {
|
||||
Free();
|
||||
chars = new char[maxLineLength_ + 1];
|
||||
styles = new unsigned char[maxLineLength_ + 1];
|
||||
indicators = new char[maxLineLength_ + 1];
|
||||
// Extra position allocated as sometimes the Windows
|
||||
// GetTextExtentExPoint API writes an extra element.
|
||||
positions = new XYPOSITION[maxLineLength_ + 1 + 1];
|
||||
@@ -94,8 +90,6 @@ void LineLayout::Free() {
|
||||
chars = 0;
|
||||
delete []styles;
|
||||
styles = 0;
|
||||
delete []indicators;
|
||||
indicators = 0;
|
||||
delete []positions;
|
||||
positions = 0;
|
||||
delete []lineStarts;
|
||||
@@ -153,7 +147,7 @@ void LineLayout::SetLineStart(int line, int 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) {
|
||||
if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) {
|
||||
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])) {
|
||||
int braceOffset = braces[0] - rangeLine.start;
|
||||
if (braceOffset < numCharsInLine) {
|
||||
@@ -232,7 +226,7 @@ Point LineLayout::PointFromPosition(int posInLine, int lineHeight) const {
|
||||
for (int subLine = 0; subLine < lines; subLine++) {
|
||||
const Range rangeSubLine = SubLineRange(subLine);
|
||||
if (posInLine >= rangeSubLine.start) {
|
||||
pt.y = subLine*lineHeight;
|
||||
pt.y = static_cast<XYPOSITION>(subLine*lineHeight);
|
||||
if (posInLine <= rangeSubLine.end) {
|
||||
pt.x = positions[posInLine] - positions[rangeSubLine.start];
|
||||
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);
|
||||
if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])])
|
||||
return 0;
|
||||
MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, len));
|
||||
MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len));
|
||||
if (it != mapReprs.end()) {
|
||||
return &(it->second);
|
||||
}
|
||||
@@ -445,13 +439,12 @@ void BreakFinder::Insert(int val) {
|
||||
}
|
||||
}
|
||||
|
||||
BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
|
||||
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_) :
|
||||
BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, int posLineStart_,
|
||||
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) :
|
||||
ll(ll_),
|
||||
lineStart(lineStart_),
|
||||
lineEnd(lineEnd_),
|
||||
lineRange(lineRange_),
|
||||
posLineStart(posLineStart_),
|
||||
nextBreak(lineStart_),
|
||||
nextBreak(lineRange_.start),
|
||||
saeCurrentPos(0),
|
||||
saeNext(0),
|
||||
subBreak(-1),
|
||||
@@ -462,18 +455,18 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
|
||||
// Search for first visible break
|
||||
// First find the first visible character
|
||||
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
|
||||
while ((nextBreak > lineStart) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) {
|
||||
while ((nextBreak > lineRange.start) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) {
|
||||
nextBreak--;
|
||||
}
|
||||
|
||||
if (breakForSelection) {
|
||||
SelectionPosition posStart(posLineStart);
|
||||
SelectionPosition posEnd(posLineStart + lineEnd);
|
||||
SelectionPosition posEnd(posLineStart + lineRange.end);
|
||||
SelectionSegment segmentLine(posStart, posEnd);
|
||||
for (size_t r=0; r<ll->psel->Count(); r++) {
|
||||
SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
|
||||
for (size_t r=0; r<psel->Count(); r++) {
|
||||
SelectionSegment portion = psel->Range(r).Intersect(segmentLine);
|
||||
if (!(portion.start == portion.end)) {
|
||||
if (portion.start.IsValid())
|
||||
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(lineEnd);
|
||||
Insert(lineRange.end);
|
||||
saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1;
|
||||
}
|
||||
|
||||
@@ -494,19 +497,19 @@ BreakFinder::~BreakFinder() {
|
||||
TextSegment BreakFinder::Next() {
|
||||
if (subBreak == -1) {
|
||||
int prev = nextBreak;
|
||||
while (nextBreak < lineEnd) {
|
||||
while (nextBreak < lineRange.end) {
|
||||
int charWidth = 1;
|
||||
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)
|
||||
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])) ||
|
||||
repr ||
|
||||
(nextBreak == saeNext)) {
|
||||
while ((nextBreak >= saeNext) && (saeNext < lineEnd)) {
|
||||
while ((nextBreak >= saeNext) && (saeNext < lineRange.end)) {
|
||||
saeCurrentPos++;
|
||||
saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineEnd;
|
||||
saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineRange.end;
|
||||
}
|
||||
if ((nextBreak > prev) || repr) {
|
||||
// Have a segment to report
|
||||
@@ -547,7 +550,7 @@ TextSegment BreakFinder::Next() {
|
||||
}
|
||||
|
||||
bool BreakFinder::More() const {
|
||||
return (subBreak >= 0) || (nextBreak < lineEnd);
|
||||
return (subBreak >= 0) || (nextBreak < lineRange.end);
|
||||
}
|
||||
|
||||
PositionCacheEntry::PositionCacheEntry() :
|
||||
@@ -563,9 +566,9 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
|
||||
if (s_ && positions_) {
|
||||
positions = new XYPOSITION[len + (len / 4) + 1];
|
||||
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_,
|
||||
unsigned int len_, XYPOSITION *positions_) const {
|
||||
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++) {
|
||||
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;
|
||||
for (unsigned int i=0; i<len_; i++) {
|
||||
ret *= 1000003;
|
||||
@@ -642,22 +645,22 @@ void PositionCache::SetSize(size_t 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) {
|
||||
|
||||
allClear = false;
|
||||
int probe = -1;
|
||||
size_t probe = pces.size(); // Out of bounds
|
||||
if ((!pces.empty()) && (len < 30)) {
|
||||
// Only store short strings in the cache so it doesn't churn with
|
||||
// long comments with only a single comment.
|
||||
|
||||
// Two way associative: try two probe positions.
|
||||
int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
|
||||
probe = static_cast<int>(hashValue % pces.size());
|
||||
unsigned int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
|
||||
probe = hashValue % pces.size();
|
||||
if (pces[probe].Retrieve(styleNumber, s, len, positions)) {
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
@@ -672,7 +675,8 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
|
||||
XYPOSITION xStartSegment = 0;
|
||||
while (startSegment < len) {
|
||||
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++) {
|
||||
positions[startSegment + inSeg] += xStartSegment;
|
||||
}
|
||||
@@ -680,9 +684,11 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
|
||||
startSegment += lenSegment;
|
||||
}
|
||||
} 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++;
|
||||
if (clock > 60000) {
|
||||
// Since there are only 16 bits for the clock, wrap it round and
|
||||
|
||||
@@ -34,19 +34,15 @@ public:
|
||||
enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
|
||||
int xHighlightGuide;
|
||||
bool highlightColumn;
|
||||
Selection *psel;
|
||||
bool containsCaret;
|
||||
int edgeColumn;
|
||||
char *chars;
|
||||
unsigned char *styles;
|
||||
int styleBitsSet;
|
||||
char *indicators;
|
||||
XYPOSITION *positions;
|
||||
char bracePreviousStyles[2];
|
||||
|
||||
// Hotspot support
|
||||
int hsStart;
|
||||
int hsEnd;
|
||||
Range hotspot;
|
||||
|
||||
// Wrapped line support
|
||||
int widthLine;
|
||||
@@ -63,9 +59,9 @@ public:
|
||||
Range SubLineRange(int line) const;
|
||||
bool InLine(int offset, int line) const;
|
||||
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);
|
||||
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 FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const;
|
||||
Point PointFromPosition(int posInLine, int lineHeight) const;
|
||||
@@ -108,10 +104,10 @@ class PositionCacheEntry {
|
||||
public:
|
||||
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();
|
||||
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;
|
||||
void ResetClock();
|
||||
};
|
||||
@@ -132,7 +128,7 @@ public:
|
||||
SpecialRepresentations();
|
||||
void SetRepresentation(const char *charBytes, const char *value);
|
||||
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;
|
||||
void Clear();
|
||||
};
|
||||
@@ -140,8 +136,8 @@ public:
|
||||
struct TextSegment {
|
||||
int start;
|
||||
int length;
|
||||
Representation *representation;
|
||||
TextSegment(int start_=0, int length_=0, Representation *representation_=0) :
|
||||
const Representation *representation;
|
||||
TextSegment(int start_=0, int length_=0, const Representation *representation_=0) :
|
||||
start(start_), length(length_), representation(representation_) {
|
||||
}
|
||||
int end() const {
|
||||
@@ -151,18 +147,17 @@ struct TextSegment {
|
||||
|
||||
// Class to break a line of text into shorter runs at sensible places.
|
||||
class BreakFinder {
|
||||
LineLayout *ll;
|
||||
int lineStart;
|
||||
int lineEnd;
|
||||
const LineLayout *ll;
|
||||
Range lineRange;
|
||||
int posLineStart;
|
||||
int nextBreak;
|
||||
std::vector<int> selAndEdge;
|
||||
unsigned int saeCurrentPos;
|
||||
int saeNext;
|
||||
int subBreak;
|
||||
Document *pdoc;
|
||||
const Document *pdoc;
|
||||
EncodingFamily encodingFamily;
|
||||
SpecialRepresentations *preprs;
|
||||
const SpecialRepresentations *preprs;
|
||||
void Insert(int val);
|
||||
// Private so BreakFinder objects can not be copied
|
||||
BreakFinder(const BreakFinder &);
|
||||
@@ -172,8 +167,8 @@ public:
|
||||
enum { lengthStartSubdivision = 300 };
|
||||
// Try to make each subdivided run lengthEachSubdivision or shorter.
|
||||
enum { lengthEachSubdivision = 100 };
|
||||
BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
|
||||
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_);
|
||||
BreakFinder(const LineLayout *ll_, const Selection *psel, Range rangeLine_, int posLineStart_,
|
||||
int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw);
|
||||
~BreakFinder();
|
||||
TextSegment Next();
|
||||
bool More() const;
|
||||
@@ -191,7 +186,7 @@ public:
|
||||
void Clear();
|
||||
void SetSize(size_t 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);
|
||||
};
|
||||
|
||||
|
||||
@@ -203,15 +203,11 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "CharClassify.h"
|
||||
#include "RESearch.h"
|
||||
|
||||
// Shut up annoying Visual C++ warnings:
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4514)
|
||||
#endif
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
@@ -256,22 +252,18 @@ const char bitarr[] = { 1, 2, 4, 8, 16, 32, 64, '\200' };
|
||||
RESearch::RESearch(CharClassify *charClassTable) {
|
||||
failure = 0;
|
||||
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() {
|
||||
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() {
|
||||
for (int i = 0; i < MAXTAG; i++) {
|
||||
pat[i].clear();
|
||||
@@ -284,10 +276,9 @@ void RESearch::GrabMatches(CharacterIndexer &ci) {
|
||||
for (unsigned int i = 0; i < MAXTAG; i++) {
|
||||
if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
|
||||
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++)
|
||||
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
|
||||
* by a valid expression (like \( in non-Posix mode).
|
||||
* @param pattern: pointer on the char after the backslash.
|
||||
* @param incr: (out) number of chars to skip after expression evaluation.
|
||||
* @param pattern : pointer on the char after the backslash.
|
||||
* @param incr : (out) number of chars to skip after expression evaluation.
|
||||
* @return the char if it resolves to a simple char,
|
||||
* 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);
|
||||
while ((lp < endp) && (static_cast<unsigned char>(ci.CharAt(lp)) != c))
|
||||
lp++;
|
||||
if (lp >= endp) /* if EOS, fail, else fall thru. */
|
||||
if (lp >= endp) /* if EOS, fail, else fall through. */
|
||||
return 0;
|
||||
default: /* regular matching all the way. */
|
||||
while (lp < endp) {
|
||||
@@ -819,7 +810,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
|
||||
*
|
||||
* special case optimizations: (nfa[n], nfa[n+1])
|
||||
* 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
|
||||
* line, without recursive PMatch calls. As in
|
||||
* the other closure cases, the remaining pattern
|
||||
|
||||
@@ -33,6 +33,7 @@ class RESearch {
|
||||
public:
|
||||
explicit RESearch(CharClassify *charClassTable);
|
||||
~RESearch();
|
||||
void Clear();
|
||||
void GrabMatches(CharacterIndexer &ci);
|
||||
const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix);
|
||||
int Execute(CharacterIndexer &ci, int lp, int endp);
|
||||
@@ -46,8 +47,6 @@ public:
|
||||
std::string pat[MAXTAG];
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void Clear();
|
||||
void ChSet(unsigned char c);
|
||||
void ChSetWithCase(unsigned char c, bool caseSensitive);
|
||||
int GetBackslashExpression(const char *pattern, int &incr);
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -21,12 +22,17 @@
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#ifdef SCI_LEXER
|
||||
#include "SciLexer.h"
|
||||
#endif
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
|
||||
#ifdef SCI_LEXER
|
||||
#include "LexerModule.h"
|
||||
#include "Catalogue.h"
|
||||
#endif
|
||||
|
||||
#include "SplitVector.h"
|
||||
#include "Partitioning.h"
|
||||
#include "RunStyles.h"
|
||||
@@ -39,14 +45,17 @@
|
||||
#include "LineMarker.h"
|
||||
#include "Style.h"
|
||||
#include "ViewStyle.h"
|
||||
#include "AutoComplete.h"
|
||||
#include "CharClassify.h"
|
||||
#include "Decoration.h"
|
||||
#include "CaseFolder.h"
|
||||
#include "Document.h"
|
||||
#include "Selection.h"
|
||||
#include "PositionCache.h"
|
||||
#include "EditModel.h"
|
||||
#include "MarginView.h"
|
||||
#include "EditView.h"
|
||||
#include "Editor.h"
|
||||
#include "AutoComplete.h"
|
||||
#include "ScintillaBase.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
@@ -57,6 +66,7 @@ ScintillaBase::ScintillaBase() {
|
||||
displayPopupMenu = true;
|
||||
listType = 0;
|
||||
maxListWidth = 0;
|
||||
multiAutoCMode = SC_MULTIAUTOC_ONCE;
|
||||
}
|
||||
|
||||
ScintillaBase::~ScintillaBase() {
|
||||
@@ -67,7 +77,7 @@ void ScintillaBase::Finalise() {
|
||||
popup.Destroy();
|
||||
}
|
||||
|
||||
void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
|
||||
void ScintillaBase::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) {
|
||||
bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
|
||||
if (!isFillUp) {
|
||||
Editor::AddCharUTF(s, len, treatAsDBCS);
|
||||
@@ -197,9 +207,30 @@ void ScintillaBase::AutoCompleteDoubleClick(void *p) {
|
||||
|
||||
void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) {
|
||||
UndoGroup ug(pdoc);
|
||||
if (multiAutoCMode == SC_MULTIAUTOC_ONCE) {
|
||||
pdoc->DeleteChars(startPos, removeLen);
|
||||
pdoc->InsertString(startPos, text, textLen);
|
||||
SetEmptySelection(startPos + textLen);
|
||||
const int lengthInserted = pdoc->InsertString(startPos, text, textLen);
|
||||
SetEmptySelection(startPos + lengthInserted);
|
||||
} else {
|
||||
// SC_MULTIAUTOC_EACH
|
||||
for (size_t r=0; r<sel.Count(); r++) {
|
||||
if (!RangeContainsProtected(sel.Range(r).Start().Position(),
|
||||
sel.Range(r).End().Position())) {
|
||||
int positionInsert = sel.Range(r).Start().Position();
|
||||
positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace());
|
||||
if (positionInsert - removeLen >= 0) {
|
||||
positionInsert -= removeLen;
|
||||
pdoc->DeleteChars(positionInsert, removeLen);
|
||||
}
|
||||
const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen);
|
||||
if (lengthInserted > 0) {
|
||||
sel.Range(r).caret.SetPosition(positionInsert + lengthInserted);
|
||||
sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted);
|
||||
}
|
||||
sel.Range(r).ClearVirtualSpace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
@@ -233,7 +264,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
int heightLB = ac.heightLBDefault;
|
||||
int widthLB = ac.widthLBDefault;
|
||||
if (pt.x >= rcClient.right - widthLB) {
|
||||
HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB);
|
||||
HorizontalScrollTo(static_cast<int>(xOffset + pt.x - rcClient.right + widthLB));
|
||||
Redraw();
|
||||
pt = PointMainCaret();
|
||||
}
|
||||
@@ -248,17 +279,17 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above.
|
||||
rcac.top = pt.y - heightLB;
|
||||
if (rcac.top < rcPopupBounds.top) {
|
||||
heightLB -= (rcPopupBounds.top - rcac.top);
|
||||
heightLB -= static_cast<int>(rcPopupBounds.top - rcac.top);
|
||||
rcac.top = rcPopupBounds.top;
|
||||
}
|
||||
} else {
|
||||
rcac.top = pt.y + vs.lineHeight;
|
||||
}
|
||||
rcac.right = rcac.left + widthLB;
|
||||
rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom);
|
||||
rcac.bottom = static_cast<XYPOSITION>(Platform::Minimum(static_cast<int>(rcac.top) + heightLB, static_cast<int>(rcPopupBounds.bottom)));
|
||||
ac.lb->SetPositionRelative(rcac, wMain);
|
||||
ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
|
||||
unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
|
||||
unsigned int aveCharWidth = static_cast<unsigned int>(vs.styles[STYLE_DEFAULT].aveCharWidth);
|
||||
ac.lb->SetAverageCharWidth(aveCharWidth);
|
||||
ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
|
||||
|
||||
@@ -266,8 +297,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
|
||||
// Fiddle the position of the list so it is right next to the target and wide enough for all its strings
|
||||
PRectangle rcList = ac.lb->GetDesiredRect();
|
||||
int heightAlloced = rcList.bottom - rcList.top;
|
||||
widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
|
||||
int heightAlloced = static_cast<int>(rcList.bottom - rcList.top);
|
||||
widthLB = Platform::Maximum(widthLB, static_cast<int>(rcList.right - rcList.left));
|
||||
if (maxListWidth != 0)
|
||||
widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth);
|
||||
// Make an allowance for large strings in list
|
||||
@@ -416,14 +447,14 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {
|
||||
// If the call-tip window would be out of the client
|
||||
// space
|
||||
PRectangle rcClient = GetClientRectangle();
|
||||
int offset = vs.lineHeight + rc.Height();
|
||||
int offset = vs.lineHeight + static_cast<int>(rc.Height());
|
||||
// adjust so it displays above the text.
|
||||
if (rc.bottom > rcClient.bottom) {
|
||||
if (rc.bottom > rcClient.bottom && rc.Height() < rcClient.Height()) {
|
||||
rc.top -= offset;
|
||||
rc.bottom -= offset;
|
||||
}
|
||||
// adjust so it displays below the text.
|
||||
if (rc.top < rcClient.top) {
|
||||
if (rc.top < rcClient.top && rc.Height() < rcClient.Height()) {
|
||||
rc.top += offset;
|
||||
rc.bottom += offset;
|
||||
}
|
||||
@@ -492,7 +523,6 @@ public:
|
||||
void SetLexerLanguage(const char *languageName);
|
||||
const char *DescribeWordListSets();
|
||||
void SetWordList(int n, const char *wl);
|
||||
int GetStyleBitsNeeded() const;
|
||||
const char *GetName() const;
|
||||
void *PrivateCall(int operation, void *pointer);
|
||||
const char *PropertyNames();
|
||||
@@ -557,7 +587,7 @@ void LexState::SetLexerModule(const LexerModule *lex) {
|
||||
}
|
||||
|
||||
void LexState::SetLexer(uptr_t wParam) {
|
||||
lexLanguage = wParam;
|
||||
lexLanguage = static_cast<int>(wParam);
|
||||
if (lexLanguage == SCLEX_CONTAINER) {
|
||||
SetLexerModule(0);
|
||||
} else {
|
||||
@@ -594,10 +624,6 @@ void LexState::SetWordList(int n, const char *wl) {
|
||||
}
|
||||
}
|
||||
|
||||
int LexState::GetStyleBitsNeeded() const {
|
||||
return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
|
||||
}
|
||||
|
||||
const char *LexState::GetName() const {
|
||||
return lexCurrent ? lexCurrent->languageName : "";
|
||||
}
|
||||
@@ -740,8 +766,7 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
|
||||
|
||||
void ScintillaBase::NotifyLexerChanged(Document *, void *) {
|
||||
#ifdef SCI_LEXER
|
||||
int bits = DocumentLexState()->GetStyleBitsNeeded();
|
||||
vs.EnsureStyle((1 << bits) - 1);
|
||||
vs.EnsureStyle(0xff);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -749,7 +774,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
switch (iMessage) {
|
||||
case SCI_AUTOCSHOW:
|
||||
listType = 0;
|
||||
AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
|
||||
AutoCompleteStart(static_cast<int>(wParam), reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCCANCEL:
|
||||
@@ -813,21 +838,28 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ac.ignoreCase;
|
||||
|
||||
case SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR:
|
||||
ac.ignoreCaseBehaviour = wParam;
|
||||
ac.ignoreCaseBehaviour = static_cast<unsigned int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR:
|
||||
return ac.ignoreCaseBehaviour;
|
||||
|
||||
case SCI_AUTOCSETMULTI:
|
||||
multiAutoCMode = static_cast<int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETMULTI:
|
||||
return multiAutoCMode;
|
||||
|
||||
case SCI_AUTOCSETORDER:
|
||||
ac.autoSort = wParam;
|
||||
ac.autoSort = static_cast<int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETORDER:
|
||||
return ac.autoSort;
|
||||
|
||||
case SCI_USERLISTSHOW:
|
||||
listType = wParam;
|
||||
listType = static_cast<int>(wParam);
|
||||
AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
@@ -846,25 +878,26 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ac.dropRestOfWord;
|
||||
|
||||
case SCI_AUTOCSETMAXHEIGHT:
|
||||
ac.lb->SetVisibleRows(wParam);
|
||||
ac.lb->SetVisibleRows(static_cast<int>(wParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETMAXHEIGHT:
|
||||
return ac.lb->GetVisibleRows();
|
||||
|
||||
case SCI_AUTOCSETMAXWIDTH:
|
||||
maxListWidth = wParam;
|
||||
maxListWidth = static_cast<int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETMAXWIDTH:
|
||||
return maxListWidth;
|
||||
|
||||
case SCI_REGISTERIMAGE:
|
||||
ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
|
||||
ac.lb->RegisterImage(static_cast<int>(wParam), reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_REGISTERRGBAIMAGE:
|
||||
ac.lb->RegisterRGBAImage(wParam, sizeRGBAImage.x, sizeRGBAImage.y, reinterpret_cast<unsigned char *>(lParam));
|
||||
ac.lb->RegisterRGBAImage(static_cast<int>(wParam), static_cast<int>(sizeRGBAImage.x), static_cast<int>(sizeRGBAImage.y),
|
||||
reinterpret_cast<unsigned char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_CLEARREGISTEREDIMAGES:
|
||||
@@ -879,7 +912,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ac.GetTypesep();
|
||||
|
||||
case SCI_CALLTIPSHOW:
|
||||
CallTipShow(LocationFromPosition(wParam),
|
||||
CallTipShow(LocationFromPosition(static_cast<int>(wParam)),
|
||||
reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
@@ -894,32 +927,32 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ct.posStartCallTip;
|
||||
|
||||
case SCI_CALLTIPSETPOSSTART:
|
||||
ct.posStartCallTip = wParam;
|
||||
ct.posStartCallTip = static_cast<int>(wParam);
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETHLT:
|
||||
ct.SetHighlight(wParam, lParam);
|
||||
ct.SetHighlight(static_cast<int>(wParam), static_cast<int>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETBACK:
|
||||
ct.colourBG = ColourDesired(wParam);
|
||||
ct.colourBG = ColourDesired(static_cast<long>(wParam));
|
||||
vs.styles[STYLE_CALLTIP].back = ct.colourBG;
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETFORE:
|
||||
ct.colourUnSel = ColourDesired(wParam);
|
||||
ct.colourUnSel = ColourDesired(static_cast<long>(wParam));
|
||||
vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPSETFOREHLT:
|
||||
ct.colourSel = ColourDesired(wParam);
|
||||
ct.colourSel = ColourDesired(static_cast<long>(wParam));
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
case SCI_CALLTIPUSESTYLE:
|
||||
ct.SetTabSize((int)wParam);
|
||||
ct.SetTabSize(static_cast<int>(wParam));
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
@@ -934,7 +967,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
|
||||
#ifdef SCI_LEXER
|
||||
case SCI_SETLEXER:
|
||||
DocumentLexState()->SetLexer(wParam);
|
||||
DocumentLexState()->SetLexer(static_cast<int>(wParam));
|
||||
break;
|
||||
|
||||
case SCI_GETLEXER:
|
||||
@@ -942,10 +975,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
|
||||
case SCI_COLOURISE:
|
||||
if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) {
|
||||
pdoc->ModifiedAt(wParam);
|
||||
NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam);
|
||||
pdoc->ModifiedAt(static_cast<int>(wParam));
|
||||
NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : static_cast<int>(lParam));
|
||||
} else {
|
||||
DocumentLexState()->Colourise(wParam, lParam);
|
||||
DocumentLexState()->Colourise(static_cast<int>(wParam), static_cast<int>(lParam));
|
||||
}
|
||||
Redraw();
|
||||
break;
|
||||
@@ -963,10 +996,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
reinterpret_cast<char *>(lParam));
|
||||
|
||||
case SCI_GETPROPERTYINT:
|
||||
return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), lParam);
|
||||
return DocumentLexState()->PropGetInt(reinterpret_cast<const char *>(wParam), static_cast<int>(lParam));
|
||||
|
||||
case SCI_SETKEYWORDS:
|
||||
DocumentLexState()->SetWordList(wParam, reinterpret_cast<const char *>(lParam));
|
||||
DocumentLexState()->SetWordList(static_cast<int>(wParam), reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_SETLEXERLANGUAGE:
|
||||
@@ -978,10 +1011,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
|
||||
case SCI_PRIVATELEXERCALL:
|
||||
return reinterpret_cast<sptr_t>(
|
||||
DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));
|
||||
DocumentLexState()->PrivateCall(static_cast<int>(wParam), reinterpret_cast<void *>(lParam)));
|
||||
|
||||
case SCI_GETSTYLEBITSNEEDED:
|
||||
return DocumentLexState()->GetStyleBitsNeeded();
|
||||
return 8;
|
||||
|
||||
case SCI_PROPERTYNAMES:
|
||||
return StringResult(lParam, DocumentLexState()->PropertyNames());
|
||||
@@ -990,7 +1023,8 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return DocumentLexState()->PropertyType(reinterpret_cast<const char *>(wParam));
|
||||
|
||||
case SCI_DESCRIBEPROPERTY:
|
||||
return StringResult(lParam, DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam)));
|
||||
return StringResult(lParam,
|
||||
DocumentLexState()->DescribeProperty(reinterpret_cast<const char *>(wParam)));
|
||||
|
||||
case SCI_DESCRIBEKEYWORDSETS:
|
||||
return StringResult(lParam, DocumentLexState()->DescribeWordListSets());
|
||||
@@ -999,26 +1033,27 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return DocumentLexState()->LineEndTypesSupported();
|
||||
|
||||
case SCI_ALLOCATESUBSTYLES:
|
||||
return DocumentLexState()->AllocateSubStyles(wParam, lParam);
|
||||
return DocumentLexState()->AllocateSubStyles(static_cast<int>(wParam), static_cast<int>(lParam));
|
||||
|
||||
case SCI_GETSUBSTYLESSTART:
|
||||
return DocumentLexState()->SubStylesStart(wParam);
|
||||
return DocumentLexState()->SubStylesStart(static_cast<int>(wParam));
|
||||
|
||||
case SCI_GETSUBSTYLESLENGTH:
|
||||
return DocumentLexState()->SubStylesLength(wParam);
|
||||
return DocumentLexState()->SubStylesLength(static_cast<int>(wParam));
|
||||
|
||||
case SCI_GETSTYLEFROMSUBSTYLE:
|
||||
return DocumentLexState()->StyleFromSubStyle(wParam);
|
||||
return DocumentLexState()->StyleFromSubStyle(static_cast<int>(wParam));
|
||||
|
||||
case SCI_GETPRIMARYSTYLEFROMSTYLE:
|
||||
return DocumentLexState()->PrimaryStyleFromStyle(wParam);
|
||||
return DocumentLexState()->PrimaryStyleFromStyle(static_cast<int>(wParam));
|
||||
|
||||
case SCI_FREESUBSTYLES:
|
||||
DocumentLexState()->FreeSubStyles();
|
||||
break;
|
||||
|
||||
case SCI_SETIDENTIFIERS:
|
||||
DocumentLexState()->SetIdentifiers(wParam, reinterpret_cast<const char *>(lParam));
|
||||
DocumentLexState()->SetIdentifiers(static_cast<int>(wParam),
|
||||
reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_DISTANCETOSECONDARYSTYLES:
|
||||
|
||||
@@ -38,6 +38,8 @@ protected:
|
||||
idcmdSelectAll=16
|
||||
};
|
||||
|
||||
enum { maxLenInputIME = 200 };
|
||||
|
||||
bool displayPopupMenu;
|
||||
Menu popup;
|
||||
AutoComplete ac;
|
||||
@@ -46,6 +48,7 @@ protected:
|
||||
|
||||
int listType; ///< 0 is an autocomplete list
|
||||
int maxListWidth; /// Maximum width of list, in average character widths
|
||||
int multiAutoCMode; /// Mode for autocompleting when multiple selections are present
|
||||
|
||||
#ifdef SCI_LEXER
|
||||
LexState *DocumentLexState();
|
||||
@@ -59,7 +62,7 @@ protected:
|
||||
virtual void Initialise() = 0;
|
||||
virtual void Finalise();
|
||||
|
||||
virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);
|
||||
virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false);
|
||||
void Command(int cmdId);
|
||||
virtual void CancelModes();
|
||||
virtual int KeyCommand(unsigned int iMessage);
|
||||
|
||||
@@ -81,6 +81,11 @@ int SelectionRange::Length() const {
|
||||
}
|
||||
}
|
||||
|
||||
void SelectionRange::MoveForInsertDelete(bool insertion, int startChange, int length) {
|
||||
caret.MoveForInsertDelete(insertion, startChange, length);
|
||||
anchor.MoveForInsertDelete(insertion, startChange, length);
|
||||
}
|
||||
|
||||
bool SelectionRange::Contains(int pos) const {
|
||||
if (anchor > caret)
|
||||
return (pos >= caret.Position()) && (pos <= anchor.Position());
|
||||
@@ -226,10 +231,26 @@ SelectionRange &Selection::Range(size_t r) {
|
||||
return ranges[r];
|
||||
}
|
||||
|
||||
const SelectionRange &Selection::Range(size_t r) const {
|
||||
return ranges[r];
|
||||
}
|
||||
|
||||
SelectionRange &Selection::RangeMain() {
|
||||
return ranges[mainRange];
|
||||
}
|
||||
|
||||
const SelectionRange &Selection::RangeMain() const {
|
||||
return ranges[mainRange];
|
||||
}
|
||||
|
||||
SelectionPosition Selection::Start() const {
|
||||
if (IsRectangular()) {
|
||||
return rangeRectangular.Start();
|
||||
} else {
|
||||
return ranges[mainRange].Start();
|
||||
}
|
||||
}
|
||||
|
||||
bool Selection::MoveExtends() const {
|
||||
return moveExtends;
|
||||
}
|
||||
@@ -267,8 +288,10 @@ int Selection::Length() const {
|
||||
|
||||
void Selection::MovePositions(bool insertion, int startChange, int length) {
|
||||
for (size_t i=0; i<ranges.size(); i++) {
|
||||
ranges[i].caret.MoveForInsertDelete(insertion, startChange, length);
|
||||
ranges[i].anchor.MoveForInsertDelete(insertion, startChange, length);
|
||||
ranges[i].MoveForInsertDelete(insertion, startChange, length);
|
||||
}
|
||||
if (selType == selRectangle) {
|
||||
rangeRectangular.MoveForInsertDelete(insertion, startChange, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ struct SelectionRange {
|
||||
anchor.SetVirtualSpace(0);
|
||||
caret.SetVirtualSpace(0);
|
||||
}
|
||||
void MoveForInsertDelete(bool insertion, int startChange, int length);
|
||||
bool Contains(int pos) const;
|
||||
bool Contains(SelectionPosition sp) const;
|
||||
bool ContainsCharacter(int posCharacter) const;
|
||||
@@ -156,7 +157,10 @@ public:
|
||||
size_t Main() const;
|
||||
void SetMain(size_t r);
|
||||
SelectionRange &Range(size_t r);
|
||||
const SelectionRange &Range(size_t r) const;
|
||||
SelectionRange &RangeMain();
|
||||
const SelectionRange &RangeMain() const;
|
||||
SelectionPosition Start() const;
|
||||
bool MoveExtends() const;
|
||||
void SetMoveExtends(bool moveExtends_);
|
||||
bool Empty() const;
|
||||
|
||||
@@ -19,6 +19,10 @@ using namespace Scintilla;
|
||||
FontAlias::FontAlias() {
|
||||
}
|
||||
|
||||
FontAlias::FontAlias(const FontAlias &other) : Font() {
|
||||
SetID(other.fid);
|
||||
}
|
||||
|
||||
FontAlias::~FontAlias() {
|
||||
SetID(0);
|
||||
// ~Font will not release the actual font resource since it is now 0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user