From 7e0c58e92cb173bb192444670535f49583a6bf1d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 15 Dec 2007 04:07:00 +0000 Subject: [PATCH] Update Scintilla to version 1.75 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50712 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 44 + build/bakefiles/scintilla.bkl | 11 + build/msw/makefile.bcc | 44 + build/msw/makefile.gcc | 44 + build/msw/makefile.vc | 48 +- build/msw/makefile.wat | 44 + build/msw/wx_wxscintilla.dsp | 44 + include/wx/stc/stc.h | 316 +++- src/stc/PlatWX.cpp | 25 +- src/stc/ScintillaWX.cpp | 2 +- src/stc/ScintillaWX.h | 6 +- src/stc/gen_iface.py | 32 +- src/stc/scintilla/README.txt | 2 +- src/stc/scintilla/include/Accessor.h | 1 + src/stc/scintilla/include/KeyWords.h | 8 + src/stc/scintilla/include/Platform.h | 52 +- src/stc/scintilla/include/PropSet.h | 40 +- src/stc/scintilla/include/SString.h | 9 + src/stc/scintilla/include/SciLexer.h | 136 ++ src/stc/scintilla/include/Scintilla.h | 68 +- src/stc/scintilla/include/Scintilla.iface | 303 +++- src/stc/scintilla/include/WindowAccessor.h | 11 +- src/stc/scintilla/src/AutoComplete.cxx | 4 + src/stc/scintilla/src/AutoComplete.h | 8 + src/stc/scintilla/src/CallTip.cxx | 15 + src/stc/scintilla/src/CallTip.h | 8 + src/stc/scintilla/src/CellBuffer.cxx | 636 +++---- src/stc/scintilla/src/CellBuffer.h | 101 +- src/stc/scintilla/src/CharacterSet.h | 58 + src/stc/scintilla/src/ContractionState.cxx | 354 ++-- src/stc/scintilla/src/ContractionState.h | 51 +- src/stc/scintilla/src/Decoration.cxx | 188 ++ src/stc/scintilla/src/Decoration.h | 64 + src/stc/scintilla/src/Document.cxx | 227 ++- src/stc/scintilla/src/Document.h | 45 +- src/stc/scintilla/src/DocumentAccessor.cxx | 16 +- src/stc/scintilla/src/DocumentAccessor.h | 11 +- src/stc/scintilla/src/Editor.cxx | 1890 +++++++++++--------- src/stc/scintilla/src/Editor.h | 112 +- src/stc/scintilla/src/ExternalLexer.cxx | 4 + src/stc/scintilla/src/ExternalLexer.h | 12 +- src/stc/scintilla/src/Indicator.cxx | 4 + src/stc/scintilla/src/Indicator.h | 11 +- src/stc/scintilla/src/KeyMap.cxx | 4 + src/stc/scintilla/src/KeyMap.h | 8 + src/stc/scintilla/src/KeyWords.cxx | 12 + src/stc/scintilla/src/LexAPDL.cxx | 122 +- src/stc/scintilla/src/LexASY.cxx | 270 +++ src/stc/scintilla/src/LexAU3.cxx | 25 +- src/stc/scintilla/src/LexAVE.cxx | 3 + src/stc/scintilla/src/LexAbaqus.cxx | 260 +++ src/stc/scintilla/src/LexAda.cxx | 4 + src/stc/scintilla/src/LexAsm.cxx | 3 + src/stc/scintilla/src/LexAsn1.cxx | 4 + src/stc/scintilla/src/LexBaan.cxx | 4 + src/stc/scintilla/src/LexBash.cxx | 30 +- src/stc/scintilla/src/LexBasic.cxx | 4 + src/stc/scintilla/src/LexBullant.cxx | 3 + src/stc/scintilla/src/LexCLW.cxx | 4 + src/stc/scintilla/src/LexCPP.cxx | 85 +- src/stc/scintilla/src/LexCSS.cxx | 4 + src/stc/scintilla/src/LexCaml.cxx | 4 + src/stc/scintilla/src/LexCmake.cxx | 456 +++++ src/stc/scintilla/src/LexConf.cxx | 4 + src/stc/scintilla/src/LexCrontab.cxx | 4 + src/stc/scintilla/src/LexCsound.cxx | 3 + src/stc/scintilla/src/LexD.cxx | 358 ++++ src/stc/scintilla/src/LexEScript.cxx | 3 + src/stc/scintilla/src/LexEiffel.cxx | 4 + src/stc/scintilla/src/LexErlang.cxx | 4 + src/stc/scintilla/src/LexFlagship.cxx | 4 + src/stc/scintilla/src/LexForth.cxx | 4 + src/stc/scintilla/src/LexFortran.cxx | 5 + src/stc/scintilla/src/LexGAP.cxx | 263 +++ src/stc/scintilla/src/LexGui4Cli.cxx | 4 + src/stc/scintilla/src/LexHTML.cxx | 247 ++- src/stc/scintilla/src/LexHaskell.cxx | 10 +- src/stc/scintilla/src/LexInno.cxx | 8 +- src/stc/scintilla/src/LexKix.cxx | 4 + src/stc/scintilla/src/LexLisp.cxx | 4 + src/stc/scintilla/src/LexLout.cxx | 4 + src/stc/scintilla/src/LexLua.cxx | 11 +- src/stc/scintilla/src/LexMMIXAL.cxx | 3 + src/stc/scintilla/src/LexMPT.cxx | 4 + src/stc/scintilla/src/LexMSSQL.cxx | 12 +- src/stc/scintilla/src/LexMatlab.cxx | 29 +- src/stc/scintilla/src/LexMetapost.cxx | 81 +- src/stc/scintilla/src/LexNsis.cxx | 15 +- src/stc/scintilla/src/LexOpal.cxx | 4 + src/stc/scintilla/src/LexOthers.cxx | 70 +- src/stc/scintilla/src/LexPB.cxx | 4 + src/stc/scintilla/src/LexPLM.cxx | 198 ++ src/stc/scintilla/src/LexPOV.cxx | 4 + src/stc/scintilla/src/LexPS.cxx | 6 +- src/stc/scintilla/src/LexPascal.cxx | 6 +- src/stc/scintilla/src/LexPerl.cxx | 289 ++- src/stc/scintilla/src/LexProgress.cxx | 271 +++ src/stc/scintilla/src/LexPython.cxx | 42 +- src/stc/scintilla/src/LexR.cxx | 213 +++ src/stc/scintilla/src/LexRebol.cxx | 3 + src/stc/scintilla/src/LexRuby.cxx | 270 ++- src/stc/scintilla/src/LexSQL.cxx | 6 +- src/stc/scintilla/src/LexScriptol.cxx | 4 + src/stc/scintilla/src/LexSmalltalk.cxx | 4 + src/stc/scintilla/src/LexSpecman.cxx | 3 + src/stc/scintilla/src/LexSpice.cxx | 4 + src/stc/scintilla/src/LexTADS3.cxx | 1377 +++++++------- src/stc/scintilla/src/LexTCL.cxx | 4 + src/stc/scintilla/src/LexTeX.cxx | 211 ++- src/stc/scintilla/src/LexVB.cxx | 16 +- src/stc/scintilla/src/LexVHDL.cxx | 4 + src/stc/scintilla/src/LexVerilog.cxx | 4 + src/stc/scintilla/src/LexYAML.cxx | 25 +- src/stc/scintilla/src/LineMarker.cxx | 4 + src/stc/scintilla/src/LineMarker.h | 8 + src/stc/scintilla/src/Partitioning.h | 184 ++ src/stc/scintilla/src/PositionCache.cxx | 635 +++++++ src/stc/scintilla/src/PositionCache.h | 166 ++ src/stc/scintilla/src/PropSet.cxx | 439 +---- src/stc/scintilla/src/RESearch.cxx | 394 ++-- src/stc/scintilla/src/RESearch.h | 24 +- src/stc/scintilla/src/RunStyles.cxx | 216 +++ src/stc/scintilla/src/RunStyles.h | 41 + src/stc/scintilla/src/SVector.h | 127 -- src/stc/scintilla/src/ScintillaBase.cxx | 35 +- src/stc/scintilla/src/ScintillaBase.h | 8 + src/stc/scintilla/src/SplitVector.h | 243 +++ src/stc/scintilla/src/Style.cxx | 4 + src/stc/scintilla/src/Style.h | 10 +- src/stc/scintilla/src/StyleContext.cxx | 4 + src/stc/scintilla/src/StyleContext.h | 24 +- src/stc/scintilla/src/UniConversion.cxx | 67 +- src/stc/scintilla/src/UniConversion.h | 6 +- src/stc/scintilla/src/ViewStyle.cxx | 80 +- src/stc/scintilla/src/ViewStyle.h | 24 +- src/stc/scintilla/src/WindowAccessor.cxx | 13 + src/stc/scintilla/src/XPM.cxx | 4 + src/stc/scintilla/src/XPM.h | 8 + src/stc/stc.cpp | 255 ++- src/stc/stc.cpp.in | 45 +- src/stc/stc.h.in | 27 +- 141 files changed, 10138 insertions(+), 3509 deletions(-) create mode 100644 src/stc/scintilla/src/CharacterSet.h create mode 100644 src/stc/scintilla/src/Decoration.cxx create mode 100644 src/stc/scintilla/src/Decoration.h create mode 100644 src/stc/scintilla/src/LexASY.cxx create mode 100644 src/stc/scintilla/src/LexAbaqus.cxx create mode 100644 src/stc/scintilla/src/LexCmake.cxx create mode 100644 src/stc/scintilla/src/LexD.cxx create mode 100644 src/stc/scintilla/src/LexGAP.cxx create mode 100644 src/stc/scintilla/src/LexPLM.cxx create mode 100644 src/stc/scintilla/src/LexProgress.cxx create mode 100644 src/stc/scintilla/src/LexR.cxx create mode 100644 src/stc/scintilla/src/Partitioning.h create mode 100644 src/stc/scintilla/src/PositionCache.cxx create mode 100644 src/stc/scintilla/src/PositionCache.h create mode 100644 src/stc/scintilla/src/RunStyles.cxx create mode 100644 src/stc/scintilla/src/RunStyles.h create mode 100644 src/stc/scintilla/src/SplitVector.h diff --git a/Makefile.in b/Makefile.in index 07ec1096b9..900183a320 100644 --- a/Makefile.in +++ b/Makefile.in @@ -215,6 +215,7 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_CellBuffer.o \ wxscintilla_CharClassify.o \ wxscintilla_ContractionState.o \ + wxscintilla_Decoration.o \ wxscintilla_Document.o \ wxscintilla_DocumentAccessor.o \ wxscintilla_Editor.o \ @@ -224,7 +225,9 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_KeyWords.o \ wxscintilla_LexAPDL.o \ wxscintilla_LexAU3.o \ + wxscintilla_LexASY.o \ wxscintilla_LexAVE.o \ + wxscintilla_LexAbaqus.o \ wxscintilla_LexAda.o \ wxscintilla_LexAsm.o \ wxscintilla_LexAsn1.o \ @@ -233,18 +236,21 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexBasic.o \ wxscintilla_LexBullant.o \ wxscintilla_LexCLW.o \ + wxscintilla_LexCmake.o \ wxscintilla_LexCPP.o \ wxscintilla_LexCSS.o \ wxscintilla_LexCaml.o \ wxscintilla_LexCsound.o \ wxscintilla_LexConf.o \ wxscintilla_LexCrontab.o \ + wxscintilla_LexD.o \ wxscintilla_LexEScript.o \ wxscintilla_LexEiffel.o \ wxscintilla_LexErlang.o \ wxscintilla_LexFlagship.o \ wxscintilla_LexForth.o \ wxscintilla_LexFortran.o \ + wxscintilla_LexGAP.o \ wxscintilla_LexGui4Cli.o \ wxscintilla_LexHTML.o \ wxscintilla_LexHaskell.o \ @@ -262,11 +268,14 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexOpal.o \ wxscintilla_LexOthers.o \ wxscintilla_LexPB.o \ + wxscintilla_LexPLM.o \ wxscintilla_LexPOV.o \ + wxscintilla_LexProgress.o \ wxscintilla_LexPS.o \ wxscintilla_LexPascal.o \ wxscintilla_LexPerl.o \ wxscintilla_LexPython.o \ + wxscintilla_LexR.o \ wxscintilla_LexRebol.o \ wxscintilla_LexRuby.o \ wxscintilla_LexSQL.o \ @@ -282,8 +291,10 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexVerilog.o \ wxscintilla_LexYAML.o \ wxscintilla_LineMarker.o \ + wxscintilla_PositionCache.o \ wxscintilla_PropSet.o \ wxscintilla_RESearch.o \ + wxscintilla_RunStyles.o \ wxscintilla_ScintillaBase.o \ wxscintilla_Style.o \ wxscintilla_StyleContext.o \ @@ -13235,6 +13246,9 @@ wxscintilla_CharClassify.o: $(srcdir)/src/stc/scintilla/src/CharClassify.cxx wxscintilla_ContractionState.o: $(srcdir)/src/stc/scintilla/src/ContractionState.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/ContractionState.cxx +wxscintilla_Decoration.o: $(srcdir)/src/stc/scintilla/src/Decoration.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(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 @@ -13262,9 +13276,15 @@ wxscintilla_LexAPDL.o: $(srcdir)/src/stc/scintilla/src/LexAPDL.cxx wxscintilla_LexAU3.o: $(srcdir)/src/stc/scintilla/src/LexAU3.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexAU3.cxx +wxscintilla_LexASY.o: $(srcdir)/src/stc/scintilla/src/LexASY.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexASY.cxx + wxscintilla_LexAVE.o: $(srcdir)/src/stc/scintilla/src/LexAVE.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexAVE.cxx +wxscintilla_LexAbaqus.o: $(srcdir)/src/stc/scintilla/src/LexAbaqus.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexAbaqus.cxx + wxscintilla_LexAda.o: $(srcdir)/src/stc/scintilla/src/LexAda.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexAda.cxx @@ -13289,6 +13309,9 @@ wxscintilla_LexBullant.o: $(srcdir)/src/stc/scintilla/src/LexBullant.cxx wxscintilla_LexCLW.o: $(srcdir)/src/stc/scintilla/src/LexCLW.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexCLW.cxx +wxscintilla_LexCmake.o: $(srcdir)/src/stc/scintilla/src/LexCmake.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexCmake.cxx + wxscintilla_LexCPP.o: $(srcdir)/src/stc/scintilla/src/LexCPP.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexCPP.cxx @@ -13307,6 +13330,9 @@ wxscintilla_LexConf.o: $(srcdir)/src/stc/scintilla/src/LexConf.cxx wxscintilla_LexCrontab.o: $(srcdir)/src/stc/scintilla/src/LexCrontab.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexCrontab.cxx +wxscintilla_LexD.o: $(srcdir)/src/stc/scintilla/src/LexD.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexD.cxx + wxscintilla_LexEScript.o: $(srcdir)/src/stc/scintilla/src/LexEScript.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexEScript.cxx @@ -13325,6 +13351,9 @@ wxscintilla_LexForth.o: $(srcdir)/src/stc/scintilla/src/LexForth.cxx wxscintilla_LexFortran.o: $(srcdir)/src/stc/scintilla/src/LexFortran.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexFortran.cxx +wxscintilla_LexGAP.o: $(srcdir)/src/stc/scintilla/src/LexGAP.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexGAP.cxx + wxscintilla_LexGui4Cli.o: $(srcdir)/src/stc/scintilla/src/LexGui4Cli.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexGui4Cli.cxx @@ -13376,9 +13405,15 @@ wxscintilla_LexOthers.o: $(srcdir)/src/stc/scintilla/src/LexOthers.cxx wxscintilla_LexPB.o: $(srcdir)/src/stc/scintilla/src/LexPB.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPB.cxx +wxscintilla_LexPLM.o: $(srcdir)/src/stc/scintilla/src/LexPLM.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPLM.cxx + wxscintilla_LexPOV.o: $(srcdir)/src/stc/scintilla/src/LexPOV.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPOV.cxx +wxscintilla_LexProgress.o: $(srcdir)/src/stc/scintilla/src/LexProgress.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexProgress.cxx + wxscintilla_LexPS.o: $(srcdir)/src/stc/scintilla/src/LexPS.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPS.cxx @@ -13391,6 +13426,9 @@ wxscintilla_LexPerl.o: $(srcdir)/src/stc/scintilla/src/LexPerl.cxx wxscintilla_LexPython.o: $(srcdir)/src/stc/scintilla/src/LexPython.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPython.cxx +wxscintilla_LexR.o: $(srcdir)/src/stc/scintilla/src/LexR.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexR.cxx + wxscintilla_LexRebol.o: $(srcdir)/src/stc/scintilla/src/LexRebol.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexRebol.cxx @@ -13436,12 +13474,18 @@ wxscintilla_LexYAML.o: $(srcdir)/src/stc/scintilla/src/LexYAML.cxx wxscintilla_LineMarker.o: $(srcdir)/src/stc/scintilla/src/LineMarker.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LineMarker.cxx +wxscintilla_PositionCache.o: $(srcdir)/src/stc/scintilla/src/PositionCache.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/PositionCache.cxx + wxscintilla_PropSet.o: $(srcdir)/src/stc/scintilla/src/PropSet.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/PropSet.cxx wxscintilla_RESearch.o: $(srcdir)/src/stc/scintilla/src/RESearch.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/RESearch.cxx +wxscintilla_RunStyles.o: $(srcdir)/src/stc/scintilla/src/RunStyles.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/RunStyles.cxx + wxscintilla_ScintillaBase.o: $(srcdir)/src/stc/scintilla/src/ScintillaBase.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/ScintillaBase.cxx diff --git a/build/bakefiles/scintilla.bkl b/build/bakefiles/scintilla.bkl index 4c36b10ccb..a64a2a2484 100644 --- a/build/bakefiles/scintilla.bkl +++ b/build/bakefiles/scintilla.bkl @@ -29,6 +29,7 @@ src/stc/scintilla/src/CellBuffer.cxx src/stc/scintilla/src/CharClassify.cxx src/stc/scintilla/src/ContractionState.cxx + src/stc/scintilla/src/Decoration.cxx src/stc/scintilla/src/Document.cxx src/stc/scintilla/src/DocumentAccessor.cxx src/stc/scintilla/src/Editor.cxx @@ -38,7 +39,9 @@ src/stc/scintilla/src/KeyWords.cxx src/stc/scintilla/src/LexAPDL.cxx src/stc/scintilla/src/LexAU3.cxx + src/stc/scintilla/src/LexASY.cxx src/stc/scintilla/src/LexAVE.cxx + src/stc/scintilla/src/LexAbaqus.cxx src/stc/scintilla/src/LexAda.cxx src/stc/scintilla/src/LexAsm.cxx src/stc/scintilla/src/LexAsn1.cxx @@ -47,18 +50,21 @@ src/stc/scintilla/src/LexBasic.cxx src/stc/scintilla/src/LexBullant.cxx src/stc/scintilla/src/LexCLW.cxx + src/stc/scintilla/src/LexCmake.cxx src/stc/scintilla/src/LexCPP.cxx src/stc/scintilla/src/LexCSS.cxx src/stc/scintilla/src/LexCaml.cxx src/stc/scintilla/src/LexCsound.cxx src/stc/scintilla/src/LexConf.cxx src/stc/scintilla/src/LexCrontab.cxx + src/stc/scintilla/src/LexD.cxx src/stc/scintilla/src/LexEScript.cxx src/stc/scintilla/src/LexEiffel.cxx src/stc/scintilla/src/LexErlang.cxx src/stc/scintilla/src/LexFlagship.cxx src/stc/scintilla/src/LexForth.cxx src/stc/scintilla/src/LexFortran.cxx + src/stc/scintilla/src/LexGAP.cxx src/stc/scintilla/src/LexGui4Cli.cxx src/stc/scintilla/src/LexHTML.cxx src/stc/scintilla/src/LexHaskell.cxx @@ -76,11 +82,14 @@ src/stc/scintilla/src/LexOpal.cxx src/stc/scintilla/src/LexOthers.cxx src/stc/scintilla/src/LexPB.cxx + src/stc/scintilla/src/LexPLM.cxx src/stc/scintilla/src/LexPOV.cxx + src/stc/scintilla/src/LexProgress.cxx src/stc/scintilla/src/LexPS.cxx src/stc/scintilla/src/LexPascal.cxx src/stc/scintilla/src/LexPerl.cxx src/stc/scintilla/src/LexPython.cxx + src/stc/scintilla/src/LexR.cxx src/stc/scintilla/src/LexRebol.cxx src/stc/scintilla/src/LexRuby.cxx src/stc/scintilla/src/LexSQL.cxx @@ -96,8 +105,10 @@ src/stc/scintilla/src/LexVerilog.cxx src/stc/scintilla/src/LexYAML.cxx src/stc/scintilla/src/LineMarker.cxx + src/stc/scintilla/src/PositionCache.cxx src/stc/scintilla/src/PropSet.cxx src/stc/scintilla/src/RESearch.cxx + src/stc/scintilla/src/RunStyles.cxx src/stc/scintilla/src/ScintillaBase.cxx src/stc/scintilla/src/Style.cxx src/stc/scintilla/src/StyleContext.cxx diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index ba42d620d3..ed3d877eb1 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -198,6 +198,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_CellBuffer.obj \ $(OBJS)\wxscintilla_CharClassify.obj \ $(OBJS)\wxscintilla_ContractionState.obj \ + $(OBJS)\wxscintilla_Decoration.obj \ $(OBJS)\wxscintilla_Document.obj \ $(OBJS)\wxscintilla_DocumentAccessor.obj \ $(OBJS)\wxscintilla_Editor.obj \ @@ -207,7 +208,9 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_KeyWords.obj \ $(OBJS)\wxscintilla_LexAPDL.obj \ $(OBJS)\wxscintilla_LexAU3.obj \ + $(OBJS)\wxscintilla_LexASY.obj \ $(OBJS)\wxscintilla_LexAVE.obj \ + $(OBJS)\wxscintilla_LexAbaqus.obj \ $(OBJS)\wxscintilla_LexAda.obj \ $(OBJS)\wxscintilla_LexAsm.obj \ $(OBJS)\wxscintilla_LexAsn1.obj \ @@ -216,18 +219,21 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexBasic.obj \ $(OBJS)\wxscintilla_LexBullant.obj \ $(OBJS)\wxscintilla_LexCLW.obj \ + $(OBJS)\wxscintilla_LexCmake.obj \ $(OBJS)\wxscintilla_LexCPP.obj \ $(OBJS)\wxscintilla_LexCSS.obj \ $(OBJS)\wxscintilla_LexCaml.obj \ $(OBJS)\wxscintilla_LexCsound.obj \ $(OBJS)\wxscintilla_LexConf.obj \ $(OBJS)\wxscintilla_LexCrontab.obj \ + $(OBJS)\wxscintilla_LexD.obj \ $(OBJS)\wxscintilla_LexEScript.obj \ $(OBJS)\wxscintilla_LexEiffel.obj \ $(OBJS)\wxscintilla_LexErlang.obj \ $(OBJS)\wxscintilla_LexFlagship.obj \ $(OBJS)\wxscintilla_LexForth.obj \ $(OBJS)\wxscintilla_LexFortran.obj \ + $(OBJS)\wxscintilla_LexGAP.obj \ $(OBJS)\wxscintilla_LexGui4Cli.obj \ $(OBJS)\wxscintilla_LexHTML.obj \ $(OBJS)\wxscintilla_LexHaskell.obj \ @@ -245,11 +251,14 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexOpal.obj \ $(OBJS)\wxscintilla_LexOthers.obj \ $(OBJS)\wxscintilla_LexPB.obj \ + $(OBJS)\wxscintilla_LexPLM.obj \ $(OBJS)\wxscintilla_LexPOV.obj \ + $(OBJS)\wxscintilla_LexProgress.obj \ $(OBJS)\wxscintilla_LexPS.obj \ $(OBJS)\wxscintilla_LexPascal.obj \ $(OBJS)\wxscintilla_LexPerl.obj \ $(OBJS)\wxscintilla_LexPython.obj \ + $(OBJS)\wxscintilla_LexR.obj \ $(OBJS)\wxscintilla_LexRebol.obj \ $(OBJS)\wxscintilla_LexRuby.obj \ $(OBJS)\wxscintilla_LexSQL.obj \ @@ -265,8 +274,10 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexVerilog.obj \ $(OBJS)\wxscintilla_LexYAML.obj \ $(OBJS)\wxscintilla_LineMarker.obj \ + $(OBJS)\wxscintilla_PositionCache.obj \ $(OBJS)\wxscintilla_PropSet.obj \ $(OBJS)\wxscintilla_RESearch.obj \ + $(OBJS)\wxscintilla_RunStyles.obj \ $(OBJS)\wxscintilla_ScintillaBase.obj \ $(OBJS)\wxscintilla_Style.obj \ $(OBJS)\wxscintilla_StyleContext.obj \ @@ -4895,6 +4906,9 @@ $(OBJS)\wxscintilla_CharClassify.obj: ..\..\src\stc\scintilla\src\CharClassify.c $(OBJS)\wxscintilla_ContractionState.obj: ..\..\src\stc\scintilla\src\ContractionState.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_Decoration.obj: ..\..\src\stc\scintilla\src\Decoration.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_Document.obj: ..\..\src\stc\scintilla\src\Document.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -4922,9 +4936,15 @@ $(OBJS)\wxscintilla_LexAPDL.obj: ..\..\src\stc\scintilla\src\LexAPDL.cxx $(OBJS)\wxscintilla_LexAU3.obj: ..\..\src\stc\scintilla\src\LexAU3.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexASY.obj: ..\..\src\stc\scintilla\src\LexASY.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexAVE.obj: ..\..\src\stc\scintilla\src\LexAVE.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexAbaqus.obj: ..\..\src\stc\scintilla\src\LexAbaqus.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexAda.obj: ..\..\src\stc\scintilla\src\LexAda.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -4949,6 +4969,9 @@ $(OBJS)\wxscintilla_LexBullant.obj: ..\..\src\stc\scintilla\src\LexBullant.cxx $(OBJS)\wxscintilla_LexCLW.obj: ..\..\src\stc\scintilla\src\LexCLW.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexCmake.obj: ..\..\src\stc\scintilla\src\LexCmake.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexCPP.obj: ..\..\src\stc\scintilla\src\LexCPP.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -4967,6 +4990,9 @@ $(OBJS)\wxscintilla_LexConf.obj: ..\..\src\stc\scintilla\src\LexConf.cxx $(OBJS)\wxscintilla_LexCrontab.obj: ..\..\src\stc\scintilla\src\LexCrontab.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexD.obj: ..\..\src\stc\scintilla\src\LexD.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexEScript.obj: ..\..\src\stc\scintilla\src\LexEScript.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -4985,6 +5011,9 @@ $(OBJS)\wxscintilla_LexForth.obj: ..\..\src\stc\scintilla\src\LexForth.cxx $(OBJS)\wxscintilla_LexFortran.obj: ..\..\src\stc\scintilla\src\LexFortran.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexGAP.obj: ..\..\src\stc\scintilla\src\LexGAP.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexGui4Cli.obj: ..\..\src\stc\scintilla\src\LexGui4Cli.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5036,9 +5065,15 @@ $(OBJS)\wxscintilla_LexOthers.obj: ..\..\src\stc\scintilla\src\LexOthers.cxx $(OBJS)\wxscintilla_LexPB.obj: ..\..\src\stc\scintilla\src\LexPB.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexPLM.obj: ..\..\src\stc\scintilla\src\LexPLM.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexPOV.obj: ..\..\src\stc\scintilla\src\LexPOV.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexProgress.obj: ..\..\src\stc\scintilla\src\LexProgress.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexPS.obj: ..\..\src\stc\scintilla\src\LexPS.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5051,6 +5086,9 @@ $(OBJS)\wxscintilla_LexPerl.obj: ..\..\src\stc\scintilla\src\LexPerl.cxx $(OBJS)\wxscintilla_LexPython.obj: ..\..\src\stc\scintilla\src\LexPython.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexR.obj: ..\..\src\stc\scintilla\src\LexR.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexRebol.obj: ..\..\src\stc\scintilla\src\LexRebol.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5096,12 +5134,18 @@ $(OBJS)\wxscintilla_LexYAML.obj: ..\..\src\stc\scintilla\src\LexYAML.cxx $(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_PositionCache.obj: ..\..\src\stc\scintilla\src\PositionCache.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_PropSet.obj: ..\..\src\stc\scintilla\src\PropSet.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** $(OBJS)\wxscintilla_RESearch.obj: ..\..\src\stc\scintilla\src\RESearch.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_RunStyles.obj: ..\..\src\stc\scintilla\src\RunStyles.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_ScintillaBase.obj: ..\..\src\stc\scintilla\src\ScintillaBase.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $** diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 0168247796..bd0f9a76ff 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -183,6 +183,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_CellBuffer.o \ $(OBJS)\wxscintilla_CharClassify.o \ $(OBJS)\wxscintilla_ContractionState.o \ + $(OBJS)\wxscintilla_Decoration.o \ $(OBJS)\wxscintilla_Document.o \ $(OBJS)\wxscintilla_DocumentAccessor.o \ $(OBJS)\wxscintilla_Editor.o \ @@ -192,7 +193,9 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_KeyWords.o \ $(OBJS)\wxscintilla_LexAPDL.o \ $(OBJS)\wxscintilla_LexAU3.o \ + $(OBJS)\wxscintilla_LexASY.o \ $(OBJS)\wxscintilla_LexAVE.o \ + $(OBJS)\wxscintilla_LexAbaqus.o \ $(OBJS)\wxscintilla_LexAda.o \ $(OBJS)\wxscintilla_LexAsm.o \ $(OBJS)\wxscintilla_LexAsn1.o \ @@ -201,18 +204,21 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexBasic.o \ $(OBJS)\wxscintilla_LexBullant.o \ $(OBJS)\wxscintilla_LexCLW.o \ + $(OBJS)\wxscintilla_LexCmake.o \ $(OBJS)\wxscintilla_LexCPP.o \ $(OBJS)\wxscintilla_LexCSS.o \ $(OBJS)\wxscintilla_LexCaml.o \ $(OBJS)\wxscintilla_LexCsound.o \ $(OBJS)\wxscintilla_LexConf.o \ $(OBJS)\wxscintilla_LexCrontab.o \ + $(OBJS)\wxscintilla_LexD.o \ $(OBJS)\wxscintilla_LexEScript.o \ $(OBJS)\wxscintilla_LexEiffel.o \ $(OBJS)\wxscintilla_LexErlang.o \ $(OBJS)\wxscintilla_LexFlagship.o \ $(OBJS)\wxscintilla_LexForth.o \ $(OBJS)\wxscintilla_LexFortran.o \ + $(OBJS)\wxscintilla_LexGAP.o \ $(OBJS)\wxscintilla_LexGui4Cli.o \ $(OBJS)\wxscintilla_LexHTML.o \ $(OBJS)\wxscintilla_LexHaskell.o \ @@ -230,11 +236,14 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexOpal.o \ $(OBJS)\wxscintilla_LexOthers.o \ $(OBJS)\wxscintilla_LexPB.o \ + $(OBJS)\wxscintilla_LexPLM.o \ $(OBJS)\wxscintilla_LexPOV.o \ + $(OBJS)\wxscintilla_LexProgress.o \ $(OBJS)\wxscintilla_LexPS.o \ $(OBJS)\wxscintilla_LexPascal.o \ $(OBJS)\wxscintilla_LexPerl.o \ $(OBJS)\wxscintilla_LexPython.o \ + $(OBJS)\wxscintilla_LexR.o \ $(OBJS)\wxscintilla_LexRebol.o \ $(OBJS)\wxscintilla_LexRuby.o \ $(OBJS)\wxscintilla_LexSQL.o \ @@ -250,8 +259,10 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexVerilog.o \ $(OBJS)\wxscintilla_LexYAML.o \ $(OBJS)\wxscintilla_LineMarker.o \ + $(OBJS)\wxscintilla_PositionCache.o \ $(OBJS)\wxscintilla_PropSet.o \ $(OBJS)\wxscintilla_RESearch.o \ + $(OBJS)\wxscintilla_RunStyles.o \ $(OBJS)\wxscintilla_ScintillaBase.o \ $(OBJS)\wxscintilla_Style.o \ $(OBJS)\wxscintilla_StyleContext.o \ @@ -5035,6 +5046,9 @@ $(OBJS)\wxscintilla_CharClassify.o: ../../src/stc/scintilla/src/CharClassify.cxx $(OBJS)\wxscintilla_ContractionState.o: ../../src/stc/scintilla/src/ContractionState.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_Decoration.o: ../../src/stc/scintilla/src/Decoration.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_Document.o: ../../src/stc/scintilla/src/Document.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -5062,9 +5076,15 @@ $(OBJS)\wxscintilla_LexAPDL.o: ../../src/stc/scintilla/src/LexAPDL.cxx $(OBJS)\wxscintilla_LexAU3.o: ../../src/stc/scintilla/src/LexAU3.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexASY.o: ../../src/stc/scintilla/src/LexASY.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexAVE.o: ../../src/stc/scintilla/src/LexAVE.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexAbaqus.o: ../../src/stc/scintilla/src/LexAbaqus.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexAda.o: ../../src/stc/scintilla/src/LexAda.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -5089,6 +5109,9 @@ $(OBJS)\wxscintilla_LexBullant.o: ../../src/stc/scintilla/src/LexBullant.cxx $(OBJS)\wxscintilla_LexCLW.o: ../../src/stc/scintilla/src/LexCLW.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexCmake.o: ../../src/stc/scintilla/src/LexCmake.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexCPP.o: ../../src/stc/scintilla/src/LexCPP.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -5107,6 +5130,9 @@ $(OBJS)\wxscintilla_LexConf.o: ../../src/stc/scintilla/src/LexConf.cxx $(OBJS)\wxscintilla_LexCrontab.o: ../../src/stc/scintilla/src/LexCrontab.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexD.o: ../../src/stc/scintilla/src/LexD.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexEScript.o: ../../src/stc/scintilla/src/LexEScript.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -5125,6 +5151,9 @@ $(OBJS)\wxscintilla_LexForth.o: ../../src/stc/scintilla/src/LexForth.cxx $(OBJS)\wxscintilla_LexFortran.o: ../../src/stc/scintilla/src/LexFortran.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexGAP.o: ../../src/stc/scintilla/src/LexGAP.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexGui4Cli.o: ../../src/stc/scintilla/src/LexGui4Cli.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -5176,9 +5205,15 @@ $(OBJS)\wxscintilla_LexOthers.o: ../../src/stc/scintilla/src/LexOthers.cxx $(OBJS)\wxscintilla_LexPB.o: ../../src/stc/scintilla/src/LexPB.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexPLM.o: ../../src/stc/scintilla/src/LexPLM.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexPOV.o: ../../src/stc/scintilla/src/LexPOV.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexProgress.o: ../../src/stc/scintilla/src/LexProgress.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexPS.o: ../../src/stc/scintilla/src/LexPS.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -5191,6 +5226,9 @@ $(OBJS)\wxscintilla_LexPerl.o: ../../src/stc/scintilla/src/LexPerl.cxx $(OBJS)\wxscintilla_LexPython.o: ../../src/stc/scintilla/src/LexPython.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexR.o: ../../src/stc/scintilla/src/LexR.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexRebol.o: ../../src/stc/scintilla/src/LexRebol.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -5236,12 +5274,18 @@ $(OBJS)\wxscintilla_LexYAML.o: ../../src/stc/scintilla/src/LexYAML.cxx $(OBJS)\wxscintilla_LineMarker.o: ../../src/stc/scintilla/src/LineMarker.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_PositionCache.o: ../../src/stc/scintilla/src/PositionCache.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_PropSet.o: ../../src/stc/scintilla/src/PropSet.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(OBJS)\wxscintilla_RESearch.o: ../../src/stc/scintilla/src/RESearch.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_RunStyles.o: ../../src/stc/scintilla/src/RunStyles.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_ScintillaBase.o: ../../src/stc/scintilla/src/ScintillaBase.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index a9d3be3355..28715f60e8 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -194,6 +194,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_CellBuffer.obj \ $(OBJS)\wxscintilla_CharClassify.obj \ $(OBJS)\wxscintilla_ContractionState.obj \ + $(OBJS)\wxscintilla_Decoration.obj \ $(OBJS)\wxscintilla_Document.obj \ $(OBJS)\wxscintilla_DocumentAccessor.obj \ $(OBJS)\wxscintilla_Editor.obj \ @@ -203,7 +204,9 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_KeyWords.obj \ $(OBJS)\wxscintilla_LexAPDL.obj \ $(OBJS)\wxscintilla_LexAU3.obj \ + $(OBJS)\wxscintilla_LexASY.obj \ $(OBJS)\wxscintilla_LexAVE.obj \ + $(OBJS)\wxscintilla_LexAbaqus.obj \ $(OBJS)\wxscintilla_LexAda.obj \ $(OBJS)\wxscintilla_LexAsm.obj \ $(OBJS)\wxscintilla_LexAsn1.obj \ @@ -212,18 +215,21 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexBasic.obj \ $(OBJS)\wxscintilla_LexBullant.obj \ $(OBJS)\wxscintilla_LexCLW.obj \ + $(OBJS)\wxscintilla_LexCmake.obj \ $(OBJS)\wxscintilla_LexCPP.obj \ $(OBJS)\wxscintilla_LexCSS.obj \ $(OBJS)\wxscintilla_LexCaml.obj \ $(OBJS)\wxscintilla_LexCsound.obj \ $(OBJS)\wxscintilla_LexConf.obj \ $(OBJS)\wxscintilla_LexCrontab.obj \ + $(OBJS)\wxscintilla_LexD.obj \ $(OBJS)\wxscintilla_LexEScript.obj \ $(OBJS)\wxscintilla_LexEiffel.obj \ $(OBJS)\wxscintilla_LexErlang.obj \ $(OBJS)\wxscintilla_LexFlagship.obj \ $(OBJS)\wxscintilla_LexForth.obj \ $(OBJS)\wxscintilla_LexFortran.obj \ + $(OBJS)\wxscintilla_LexGAP.obj \ $(OBJS)\wxscintilla_LexGui4Cli.obj \ $(OBJS)\wxscintilla_LexHTML.obj \ $(OBJS)\wxscintilla_LexHaskell.obj \ @@ -241,11 +247,14 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexOpal.obj \ $(OBJS)\wxscintilla_LexOthers.obj \ $(OBJS)\wxscintilla_LexPB.obj \ + $(OBJS)\wxscintilla_LexPLM.obj \ $(OBJS)\wxscintilla_LexPOV.obj \ + $(OBJS)\wxscintilla_LexProgress.obj \ $(OBJS)\wxscintilla_LexPS.obj \ $(OBJS)\wxscintilla_LexPascal.obj \ $(OBJS)\wxscintilla_LexPerl.obj \ $(OBJS)\wxscintilla_LexPython.obj \ + $(OBJS)\wxscintilla_LexR.obj \ $(OBJS)\wxscintilla_LexRebol.obj \ $(OBJS)\wxscintilla_LexRuby.obj \ $(OBJS)\wxscintilla_LexSQL.obj \ @@ -261,8 +270,10 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexVerilog.obj \ $(OBJS)\wxscintilla_LexYAML.obj \ $(OBJS)\wxscintilla_LineMarker.obj \ + $(OBJS)\wxscintilla_PositionCache.obj \ $(OBJS)\wxscintilla_PropSet.obj \ $(OBJS)\wxscintilla_RESearch.obj \ + $(OBJS)\wxscintilla_RunStyles.obj \ $(OBJS)\wxscintilla_ScintillaBase.obj \ $(OBJS)\wxscintilla_Style.obj \ $(OBJS)\wxscintilla_StyleContext.obj \ @@ -4484,7 +4495,7 @@ clean: -if exist $(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib del $(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib cd ..\..\samples $(MAKE) -f makefile.vc $(MAKEARGS) clean - cd "$(MAKEDIR)" + cd $(MAKEDIR) setup_h: $(SETUPHDIR)\wx ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h $(SETUPHDIR)\wx\setup.h $(SETUPHDIR)\wx\msw\rcdefs.h @@ -4803,7 +4814,7 @@ wxgl: $(____wxgl_namedll_DEP) $(____wxgl_namelib_DEP) sub_samples: cd ..\..\samples $(MAKE) -f makefile.vc $(MAKEARGS) all - cd "$(MAKEDIR)" + cd $(MAKEDIR) $(LIBDIRNAME): if not exist $(LIBDIRNAME) mkdir $(LIBDIRNAME) @@ -5227,6 +5238,9 @@ $(OBJS)\wxscintilla_CharClassify.obj: ..\..\src\stc\scintilla\src\CharClassify.c $(OBJS)\wxscintilla_ContractionState.obj: ..\..\src\stc\scintilla\src\ContractionState.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_Decoration.obj: ..\..\src\stc\scintilla\src\Decoration.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_Document.obj: ..\..\src\stc\scintilla\src\Document.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5254,9 +5268,15 @@ $(OBJS)\wxscintilla_LexAPDL.obj: ..\..\src\stc\scintilla\src\LexAPDL.cxx $(OBJS)\wxscintilla_LexAU3.obj: ..\..\src\stc\scintilla\src\LexAU3.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexASY.obj: ..\..\src\stc\scintilla\src\LexASY.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexAVE.obj: ..\..\src\stc\scintilla\src\LexAVE.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexAbaqus.obj: ..\..\src\stc\scintilla\src\LexAbaqus.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexAda.obj: ..\..\src\stc\scintilla\src\LexAda.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5281,6 +5301,9 @@ $(OBJS)\wxscintilla_LexBullant.obj: ..\..\src\stc\scintilla\src\LexBullant.cxx $(OBJS)\wxscintilla_LexCLW.obj: ..\..\src\stc\scintilla\src\LexCLW.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexCmake.obj: ..\..\src\stc\scintilla\src\LexCmake.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexCPP.obj: ..\..\src\stc\scintilla\src\LexCPP.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5299,6 +5322,9 @@ $(OBJS)\wxscintilla_LexConf.obj: ..\..\src\stc\scintilla\src\LexConf.cxx $(OBJS)\wxscintilla_LexCrontab.obj: ..\..\src\stc\scintilla\src\LexCrontab.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexD.obj: ..\..\src\stc\scintilla\src\LexD.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexEScript.obj: ..\..\src\stc\scintilla\src\LexEScript.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5317,6 +5343,9 @@ $(OBJS)\wxscintilla_LexForth.obj: ..\..\src\stc\scintilla\src\LexForth.cxx $(OBJS)\wxscintilla_LexFortran.obj: ..\..\src\stc\scintilla\src\LexFortran.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexGAP.obj: ..\..\src\stc\scintilla\src\LexGAP.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexGui4Cli.obj: ..\..\src\stc\scintilla\src\LexGui4Cli.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5368,9 +5397,15 @@ $(OBJS)\wxscintilla_LexOthers.obj: ..\..\src\stc\scintilla\src\LexOthers.cxx $(OBJS)\wxscintilla_LexPB.obj: ..\..\src\stc\scintilla\src\LexPB.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexPLM.obj: ..\..\src\stc\scintilla\src\LexPLM.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexPOV.obj: ..\..\src\stc\scintilla\src\LexPOV.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexProgress.obj: ..\..\src\stc\scintilla\src\LexProgress.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexPS.obj: ..\..\src\stc\scintilla\src\LexPS.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5383,6 +5418,9 @@ $(OBJS)\wxscintilla_LexPerl.obj: ..\..\src\stc\scintilla\src\LexPerl.cxx $(OBJS)\wxscintilla_LexPython.obj: ..\..\src\stc\scintilla\src\LexPython.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_LexR.obj: ..\..\src\stc\scintilla\src\LexR.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_LexRebol.obj: ..\..\src\stc\scintilla\src\LexRebol.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** @@ -5428,12 +5466,18 @@ $(OBJS)\wxscintilla_LexYAML.obj: ..\..\src\stc\scintilla\src\LexYAML.cxx $(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_PositionCache.obj: ..\..\src\stc\scintilla\src\PositionCache.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_PropSet.obj: ..\..\src\stc\scintilla\src\PropSet.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** $(OBJS)\wxscintilla_RESearch.obj: ..\..\src\stc\scintilla\src\RESearch.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** +$(OBJS)\wxscintilla_RunStyles.obj: ..\..\src\stc\scintilla\src\RunStyles.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** + $(OBJS)\wxscintilla_ScintillaBase.obj: ..\..\src\stc\scintilla\src\ScintillaBase.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $** diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index f69887ba34..a9ce3c1220 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -3135,6 +3135,7 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_CellBuffer.obj & $(OBJS)\wxscintilla_CharClassify.obj & $(OBJS)\wxscintilla_ContractionState.obj & + $(OBJS)\wxscintilla_Decoration.obj & $(OBJS)\wxscintilla_Document.obj & $(OBJS)\wxscintilla_DocumentAccessor.obj & $(OBJS)\wxscintilla_Editor.obj & @@ -3144,7 +3145,9 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_KeyWords.obj & $(OBJS)\wxscintilla_LexAPDL.obj & $(OBJS)\wxscintilla_LexAU3.obj & + $(OBJS)\wxscintilla_LexASY.obj & $(OBJS)\wxscintilla_LexAVE.obj & + $(OBJS)\wxscintilla_LexAbaqus.obj & $(OBJS)\wxscintilla_LexAda.obj & $(OBJS)\wxscintilla_LexAsm.obj & $(OBJS)\wxscintilla_LexAsn1.obj & @@ -3153,18 +3156,21 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexBasic.obj & $(OBJS)\wxscintilla_LexBullant.obj & $(OBJS)\wxscintilla_LexCLW.obj & + $(OBJS)\wxscintilla_LexCmake.obj & $(OBJS)\wxscintilla_LexCPP.obj & $(OBJS)\wxscintilla_LexCSS.obj & $(OBJS)\wxscintilla_LexCaml.obj & $(OBJS)\wxscintilla_LexCsound.obj & $(OBJS)\wxscintilla_LexConf.obj & $(OBJS)\wxscintilla_LexCrontab.obj & + $(OBJS)\wxscintilla_LexD.obj & $(OBJS)\wxscintilla_LexEScript.obj & $(OBJS)\wxscintilla_LexEiffel.obj & $(OBJS)\wxscintilla_LexErlang.obj & $(OBJS)\wxscintilla_LexFlagship.obj & $(OBJS)\wxscintilla_LexForth.obj & $(OBJS)\wxscintilla_LexFortran.obj & + $(OBJS)\wxscintilla_LexGAP.obj & $(OBJS)\wxscintilla_LexGui4Cli.obj & $(OBJS)\wxscintilla_LexHTML.obj & $(OBJS)\wxscintilla_LexHaskell.obj & @@ -3182,11 +3188,14 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexOpal.obj & $(OBJS)\wxscintilla_LexOthers.obj & $(OBJS)\wxscintilla_LexPB.obj & + $(OBJS)\wxscintilla_LexPLM.obj & $(OBJS)\wxscintilla_LexPOV.obj & + $(OBJS)\wxscintilla_LexProgress.obj & $(OBJS)\wxscintilla_LexPS.obj & $(OBJS)\wxscintilla_LexPascal.obj & $(OBJS)\wxscintilla_LexPerl.obj & $(OBJS)\wxscintilla_LexPython.obj & + $(OBJS)\wxscintilla_LexR.obj & $(OBJS)\wxscintilla_LexRebol.obj & $(OBJS)\wxscintilla_LexRuby.obj & $(OBJS)\wxscintilla_LexSQL.obj & @@ -3202,8 +3211,10 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexVerilog.obj & $(OBJS)\wxscintilla_LexYAML.obj & $(OBJS)\wxscintilla_LineMarker.obj & + $(OBJS)\wxscintilla_PositionCache.obj & $(OBJS)\wxscintilla_PropSet.obj & $(OBJS)\wxscintilla_RESearch.obj & + $(OBJS)\wxscintilla_RunStyles.obj & $(OBJS)\wxscintilla_ScintillaBase.obj & $(OBJS)\wxscintilla_Style.obj & $(OBJS)\wxscintilla_StyleContext.obj & @@ -5269,6 +5280,9 @@ $(OBJS)\wxscintilla_CharClassify.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\ $(OBJS)\wxscintilla_ContractionState.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\ContractionState.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_Decoration.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Decoration.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_Document.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Document.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -5296,9 +5310,15 @@ $(OBJS)\wxscintilla_LexAPDL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexAP $(OBJS)\wxscintilla_LexAU3.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexAU3.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexASY.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexASY.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexAVE.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexAVE.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexAbaqus.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexAbaqus.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexAda.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexAda.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -5323,6 +5343,9 @@ $(OBJS)\wxscintilla_LexBullant.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Le $(OBJS)\wxscintilla_LexCLW.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCLW.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexCmake.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCmake.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexCPP.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCPP.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -5341,6 +5364,9 @@ $(OBJS)\wxscintilla_LexConf.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCo $(OBJS)\wxscintilla_LexCrontab.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCrontab.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexD.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexD.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexEScript.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexEScript.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -5359,6 +5385,9 @@ $(OBJS)\wxscintilla_LexForth.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexF $(OBJS)\wxscintilla_LexFortran.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexFortran.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexGAP.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexGAP.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexGui4Cli.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexGui4Cli.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -5410,9 +5439,15 @@ $(OBJS)\wxscintilla_LexOthers.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Lex $(OBJS)\wxscintilla_LexPB.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPB.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexPLM.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPLM.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexPOV.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPOV.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexProgress.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexProgress.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexPS.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPS.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -5425,6 +5460,9 @@ $(OBJS)\wxscintilla_LexPerl.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPe $(OBJS)\wxscintilla_LexPython.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPython.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexR.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexR.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexRebol.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexRebol.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -5470,12 +5508,18 @@ $(OBJS)\wxscintilla_LexYAML.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexYA $(OBJS)\wxscintilla_LineMarker.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LineMarker.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_PositionCache.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\PositionCache.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_PropSet.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\PropSet.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(OBJS)\wxscintilla_RESearch.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\RESearch.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_RunStyles.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\RunStyles.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_ScintillaBase.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\ScintillaBase.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< diff --git a/build/msw/wx_wxscintilla.dsp b/build/msw/wx_wxscintilla.dsp index 415d1da004..62fce81505 100644 --- a/build/msw/wx_wxscintilla.dsp +++ b/build/msw/wx_wxscintilla.dsp @@ -255,6 +255,10 @@ SOURCE=..\..\src\stc\scintilla\src\ContractionState.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\Decoration.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\Document.cxx # End Source File # Begin Source File @@ -287,6 +291,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexAPDL.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\LexASY.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\LexAU3.cxx # End Source File # Begin Source File @@ -295,6 +303,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexAVE.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\LexAbaqus.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\LexAda.cxx # End Source File # Begin Source File @@ -339,6 +351,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexCaml.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\LexCmake.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\LexConf.cxx # End Source File # Begin Source File @@ -351,6 +367,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexCsound.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\LexD.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\LexEScript.cxx # End Source File # Begin Source File @@ -375,6 +395,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexFortran.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\LexGAP.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\LexGui4Cli.cxx # End Source File # Begin Source File @@ -443,6 +467,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexPB.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\LexPLM.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\LexPOV.cxx # End Source File # Begin Source File @@ -459,10 +487,18 @@ SOURCE=..\..\src\stc\scintilla\src\LexPerl.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\LexProgress.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\LexPython.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\LexR.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\LexRebol.cxx # End Source File # Begin Source File @@ -523,6 +559,10 @@ SOURCE=..\..\src\stc\scintilla\src\LineMarker.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\PositionCache.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\PropSet.cxx # End Source File # Begin Source File @@ -531,6 +571,10 @@ SOURCE=..\..\src\stc\scintilla\src\RESearch.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\RunStyles.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\ScintillaBase.cxx # End Source File # Begin Source File diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 1217ebace4..7014fbcb17 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -129,7 +129,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_STYLE_INDENTGUIDE 37 #define wxSTC_STYLE_CALLTIP 38 #define wxSTC_STYLE_LASTPREDEFINED 39 -#define wxSTC_STYLE_MAX 127 +#define wxSTC_STYLE_MAX 255 // Character set identifiers are used in StyleSetCharacterSet. // The values are the same as the Windows *_CHARSET values. @@ -157,7 +157,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_CASE_MIXED 0 #define wxSTC_CASE_UPPER 1 #define wxSTC_CASE_LOWER 2 -#define wxSTC_INDIC_MAX 7 + +// Indicator style enumeration and some constants #define wxSTC_INDIC_PLAIN 0 #define wxSTC_INDIC_SQUIGGLE 1 #define wxSTC_INDIC_TT 2 @@ -166,10 +167,16 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_INDIC_HIDDEN 5 #define wxSTC_INDIC_BOX 6 #define wxSTC_INDIC_ROUNDBOX 7 +#define wxSTC_INDIC_MAX 31 +#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_IV_NONE 0 +#define wxSTC_IV_REAL 1 +#define wxSTC_IV_LOOKFORWARD 2 +#define wxSTC_IV_LOOKBOTH 3 // PrintColourMode - use same colours as screen. #define wxSTC_PRINT_NORMAL 0 @@ -254,7 +261,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; // where most code reside, and the lines after the caret, eg. the body of a function. #define wxSTC_CARET_EVEN 0x08 -// Selection modes +// Selection Modes #define wxSTC_SEL_STREAM 0 #define wxSTC_SEL_RECTANGLE 1 #define wxSTC_SEL_LINES 2 @@ -262,6 +269,11 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_ALPHA_OPAQUE 255 #define wxSTC_ALPHA_NOALPHA 256 +// Caret Styles +#define wxSTC_CARETSTYLE_INVISIBLE 0 +#define wxSTC_CARETSTYLE_LINE 1 +#define wxSTC_CARETSTYLE_BLOCK 2 + // Maximum value of keywordSet parameter of SetKeyWords. #define wxSTC_KEYWORDSET_MAX 8 @@ -282,7 +294,10 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_MOD_BEFOREINSERT 0x400 #define wxSTC_MOD_BEFOREDELETE 0x800 #define wxSTC_MULTILINEUNDOREDO 0x1000 -#define wxSTC_MODEVENTMASKALL 0x1FFF +#define wxSTC_STARTACTION 0x2000 +#define wxSTC_MOD_CHANGEINDICATOR 0x4000 +#define wxSTC_MOD_CHANGELINESTATE 0x8000 +#define wxSTC_MODEVENTMASKALL 0xFFFF // Symbolic key codes and modifier flags. // ASCII and other printable characters below 256. @@ -304,6 +319,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_KEY_ADD 310 #define wxSTC_KEY_SUBTRACT 311 #define wxSTC_KEY_DIVIDE 312 +#define wxSTC_KEY_WIN 313 +#define wxSTC_KEY_RWIN 314 +#define wxSTC_KEY_MENU 315 #define wxSTC_SCMOD_NORM 0 #define wxSTC_SCMOD_SHIFT 1 #define wxSTC_SCMOD_CTRL 2 @@ -387,6 +405,14 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_LEX_INNOSETUP 76 #define wxSTC_LEX_OPAL 77 #define wxSTC_LEX_SPICE 78 +#define wxSTC_LEX_D 79 +#define wxSTC_LEX_CMAKE 80 +#define wxSTC_LEX_GAP 81 +#define wxSTC_LEX_PLM 82 +#define wxSTC_LEX_PROGRESS 83 +#define wxSTC_LEX_ABAQUS 84 +#define wxSTC_LEX_ASYMPTOTE 85 +#define wxSTC_LEX_R 86 // When a lexer specifies its language as SCLEX_AUTOMATIC it receives a // value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -432,6 +458,26 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_C_COMMENTDOCKEYWORDERROR 18 #define wxSTC_C_GLOBALCLASS 19 +// Lexical states for SCLEX_D +#define wxSTC_D_DEFAULT 0 +#define wxSTC_D_COMMENT 1 +#define wxSTC_D_COMMENTLINE 2 +#define wxSTC_D_COMMENTDOC 3 +#define wxSTC_D_COMMENTNESTED 4 +#define wxSTC_D_NUMBER 5 +#define wxSTC_D_WORD 6 +#define wxSTC_D_WORD2 7 +#define wxSTC_D_WORD3 8 +#define wxSTC_D_TYPEDEF 9 +#define wxSTC_D_STRING 10 +#define wxSTC_D_STRINGEOL 11 +#define wxSTC_D_CHARACTER 12 +#define wxSTC_D_OPERATOR 13 +#define wxSTC_D_IDENTIFIER 14 +#define wxSTC_D_COMMENTLINEDOC 15 +#define wxSTC_D_COMMENTDOCKEYWORD 16 +#define wxSTC_D_COMMENTDOCKEYWORDERROR 17 + // Lexical states for SCLEX_TCL #define wxSTC_TCL_DEFAULT 0 #define wxSTC_TCL_COMMENT 1 @@ -626,6 +672,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_PL_STRING_QR 29 #define wxSTC_PL_STRING_QW 30 #define wxSTC_PL_POD_VERB 31 +#define wxSTC_PL_SUB_PROTOTYPE 40 +#define wxSTC_PL_FORMAT_IDENT 41 +#define wxSTC_PL_FORMAT 42 // Lexical states for SCLEX_RUBY #define wxSTC_RB_DEFAULT 0 @@ -743,6 +792,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_ERR_ABSF 18 #define wxSTC_ERR_TIDY 19 #define wxSTC_ERR_JAVA_STACK 20 +#define wxSTC_ERR_VALUE 21 // Lexical states for SCLEX_BATCH #define wxSTC_BAT_DEFAULT 0 @@ -1107,6 +1157,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_YAML_DOCUMENT 6 #define wxSTC_YAML_TEXT 7 #define wxSTC_YAML_ERROR 8 +#define wxSTC_YAML_OPERATOR 9 // Lexical states for SCLEX_TEX #define wxSTC_TEX_DEFAULT 0 @@ -1355,6 +1406,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_T3_USER1 17 #define wxSTC_T3_USER2 18 #define wxSTC_T3_USER3 19 +#define wxSTC_T3_BRACE 20 // Lexical states for SCLEX_REBOL #define wxSTC_REBOL_DEFAULT 0 @@ -1512,6 +1564,124 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_SPICE_VALUE 7 #define wxSTC_SPICE_COMMENTLINE 8 +// Lexical states for SCLEX_CMAKE +#define wxSTC_CMAKE_DEFAULT 0 +#define wxSTC_CMAKE_COMMENT 1 +#define wxSTC_CMAKE_STRINGDQ 2 +#define wxSTC_CMAKE_STRINGLQ 3 +#define wxSTC_CMAKE_STRINGRQ 4 +#define wxSTC_CMAKE_COMMANDS 5 +#define wxSTC_CMAKE_PARAMETERS 6 +#define wxSTC_CMAKE_VARIABLE 7 +#define wxSTC_CMAKE_USERDEFINED 8 +#define wxSTC_CMAKE_WHILEDEF 9 +#define wxSTC_CMAKE_FOREACHDEF 10 +#define wxSTC_CMAKE_IFDEFINEDEF 11 +#define wxSTC_CMAKE_MACRODEF 12 +#define wxSTC_CMAKE_STRINGVAR 13 +#define wxSTC_CMAKE_NUMBER 14 + +// Lexical states for SCLEX_GAP +#define wxSTC_GAP_DEFAULT 0 +#define wxSTC_GAP_IDENTIFIER 1 +#define wxSTC_GAP_KEYWORD 2 +#define wxSTC_GAP_KEYWORD2 3 +#define wxSTC_GAP_KEYWORD3 4 +#define wxSTC_GAP_KEYWORD4 5 +#define wxSTC_GAP_STRING 6 +#define wxSTC_GAP_CHAR 7 +#define wxSTC_GAP_OPERATOR 8 +#define wxSTC_GAP_COMMENT 9 +#define wxSTC_GAP_NUMBER 10 +#define wxSTC_GAP_STRINGEOL 11 + +// Lexical state for SCLEX_PLM +#define wxSTC_PLM_DEFAULT 0 +#define wxSTC_PLM_COMMENT 1 +#define wxSTC_PLM_STRING 2 +#define wxSTC_PLM_NUMBER 3 +#define wxSTC_PLM_IDENTIFIER 4 +#define wxSTC_PLM_OPERATOR 5 +#define wxSTC_PLM_CONTROL 6 +#define wxSTC_PLM_KEYWORD 7 + +// Lexical state for SCLEX_PROGRESS +#define wxSTC_4GL_DEFAULT 0 +#define wxSTC_4GL_NUMBER 1 +#define wxSTC_4GL_WORD 2 +#define wxSTC_4GL_STRING 3 +#define wxSTC_4GL_CHARACTER 4 +#define wxSTC_4GL_PREPROCESSOR 5 +#define wxSTC_4GL_OPERATOR 6 +#define wxSTC_4GL_IDENTIFIER 7 +#define wxSTC_4GL_BLOCK 8 +#define wxSTC_4GL_END 9 +#define wxSTC_4GL_COMMENT1 10 +#define wxSTC_4GL_COMMENT2 11 +#define wxSTC_4GL_COMMENT3 12 +#define wxSTC_4GL_COMMENT4 13 +#define wxSTC_4GL_COMMENT5 14 +#define wxSTC_4GL_COMMENT6 15 +#define wxSTC_4GL_DEFAULT_ 16 +#define wxSTC_4GL_NUMBER_ 17 +#define wxSTC_4GL_WORD_ 18 +#define wxSTC_4GL_STRING_ 19 +#define wxSTC_4GL_CHARACTER_ 20 +#define wxSTC_4GL_PREPROCESSOR_ 21 +#define wxSTC_4GL_OPERATOR_ 22 +#define wxSTC_4GL_IDENTIFIER_ 23 +#define wxSTC_4GL_BLOCK_ 24 +#define wxSTC_4GL_END_ 25 +#define wxSTC_4GL_COMMENT1_ 26 +#define wxSTC_4GL_COMMENT2_ 27 +#define wxSTC_4GL_COMMENT3_ 28 +#define wxSTC_4GL_COMMENT4_ 29 +#define wxSTC_4GL_COMMENT5_ 30 +#define wxSTC_4GL_COMMENT6_ 31 + +// Lexical states for SCLEX_ABAQUS +#define wxSTC_ABAQUS_DEFAULT 0 +#define wxSTC_ABAQUS_COMMENT 1 +#define wxSTC_ABAQUS_COMMENTBLOCK 2 +#define wxSTC_ABAQUS_NUMBER 3 +#define wxSTC_ABAQUS_STRING 4 +#define wxSTC_ABAQUS_OPERATOR 5 +#define wxSTC_ABAQUS_WORD 6 +#define wxSTC_ABAQUS_PROCESSOR 7 +#define wxSTC_ABAQUS_COMMAND 8 +#define wxSTC_ABAQUS_SLASHCOMMAND 9 +#define wxSTC_ABAQUS_STARCOMMAND 10 +#define wxSTC_ABAQUS_ARGUMENT 11 +#define wxSTC_ABAQUS_FUNCTION 12 + +// Lexical states for SCLEX_ASYMPTOTE +#define wxSTC_ASY_DEFAULT 0 +#define wxSTC_ASY_COMMENT 1 +#define wxSTC_ASY_COMMENTLINE 2 +#define wxSTC_ASY_NUMBER 3 +#define wxSTC_ASY_WORD 4 +#define wxSTC_ASY_STRING 5 +#define wxSTC_ASY_CHARACTER 6 +#define wxSTC_ASY_OPERATOR 7 +#define wxSTC_ASY_IDENTIFIER 8 +#define wxSTC_ASY_STRINGEOL 9 +#define wxSTC_ASY_COMMENTLINEDOC 10 +#define wxSTC_ASY_WORD2 11 + +// Lexical states for SCLEX_R +#define wxSTC_R_DEFAULT 0 +#define wxSTC_R_COMMENT 1 +#define wxSTC_R_KWORD 2 +#define wxSTC_R_BASEKWORD 3 +#define wxSTC_R_OTHERKWORD 4 +#define wxSTC_R_NUMBER 5 +#define wxSTC_R_STRING 6 +#define wxSTC_R_STRING2 7 +#define wxSTC_R_OPERATOR 8 +#define wxSTC_R_IDENTIFIER 9 +#define wxSTC_R_INFIX 10 +#define wxSTC_R_INFIXEOL 11 + //----------------------------------------- // Commands that can be bound to keystrokes @@ -1651,6 +1821,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; // Delete the word to the right of the caret. #define wxSTC_CMD_DELWORDRIGHT 2336 +// Delete the word to the right of the caret, but not the trailing non-word characters. +#define wxSTC_CMD_DELWORDRIGHTEND 2518 + // Cut the line containing the caret. #define wxSTC_CMD_LINECUT 2337 @@ -1797,8 +1970,8 @@ struct SCNotification; #ifndef SWIG extern WXDLLIMPEXP_STC const wxChar* wxSTCNameStr; -class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl; -class WXDLLIMPEXP_FWD_STC wxStyledTextEvent; +class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl; +class WXDLLIMPEXP_FWD_STC wxStyledTextEvent; #endif //---------------------------------------------------------------------- @@ -2058,6 +2231,46 @@ public: // Set a style to be underlined or not. void StyleSetUnderline(int style, bool underline); + // Get the foreground colour of a style. + wxColour StyleGetForeground(int style); + + // Get the background colour of a style. + wxColour StyleGetBackground(int style); + + // Get is a style bold or not. + bool StyleGetBold(int style); + + // Get is a style italic or not. + bool StyleGetItalic(int style); + + // Get the size of characters of a style. + int StyleGetSize(int style); + + // Get the font facename of a style + wxString StyleGetFaceName(int style); + + // Get is a style to have its end of line filled or not. + bool StyleGetEOLFilled(int style); + + // Get is a style underlined or not. + bool StyleGetUnderline(int style); + + // Get is a style mixed case, or to force upper or lower case. + int StyleGetCase(int style); + + // Get the character set of the font in a style. + int StyleGetCharacterSet(int style); + + // Get is a style visible or not. + bool StyleGetVisible(int style); + + // Get is a style changeable or not (read only). + // Experimental feature, currently buggy. + bool StyleGetChangeable(int style); + + // Get is a style a hotspot or not. + bool StyleGetHotSpot(int style); + // Set a style to be mixed case, or to force upper or lower case. void StyleSetCase(int style, int caseForce); @@ -2076,6 +2289,12 @@ public: // Set the alpha of the selection. void SetSelAlpha(int alpha); + // Is the selection end of line filled? + bool GetSelEOLFilled(); + + // Set the selection to have its end of line filled or not. + void SetSelEOLFilled(bool filled); + // Set the foreground colour of the caret. void SetCaretForeground(const wxColour& fore); @@ -2123,6 +2342,12 @@ public: // Retrieve the foreground colour of an indicator. wxColour IndicatorGetForeground(int indic); + // Set an indicator to draw under text or over(default). + void IndicatorSetUnder(int indic, bool under); + + // Retrieve whether indicator drawn under or over text. + bool IndicatorGetUnder(int indic); + // Set the foreground colour of all whitespace and whether to use this setting. void SetWhitespaceForeground(bool useSetting, const wxColour& fore); @@ -2291,10 +2516,10 @@ public: bool GetUseHorizontalScrollBar(); // Show or hide indentation guides. - void SetIndentationGuides(bool show); + void SetIndentationGuides(int indentView); // Are the indentation guides visible? - bool GetIndentationGuides(); + int GetIndentationGuides(); // Set the highlighted indentation guide column. // 0 = no highlighted guide. @@ -2629,6 +2854,12 @@ public: // Retrieve the document width assumed for scrolling. int GetScrollWidth(); + // Sets whether the maximum width line displayed is used to set scroll width. + void SetScrollWidthTracking(bool tracking); + + // Retrieve whether the scroll width tracks wide lines. + bool GetScrollWidthTracking(); + // Measure the pixel width of some text in a particular style. // NUL terminated text argument. // Does not handle tab or control characters. @@ -2789,6 +3020,9 @@ public: // Delete the word to the right of the caret. void DelWordRight(); + // Delete the word to the right of the caret, but not the trailing non-word characters. + void DelWordRightEnd(); + // Cut the line containing the caret. void LineCut(); @@ -3016,15 +3250,27 @@ public: // Set a fore colour for active hotspots. void SetHotspotActiveForeground(bool useSetting, const wxColour& fore); + // Get the fore colour for active hotspots. + wxColour GetHotspotActiveForeground(); + // Set a back colour for active hotspots. void SetHotspotActiveBackground(bool useSetting, const wxColour& back); + // Get the back colour for active hotspots. + wxColour GetHotspotActiveBackground(); + // Enable / Disable underlining active hotspots. void SetHotspotActiveUnderline(bool underline); + // Get whether underlining for active hotspots. + bool GetHotspotActiveUnderline(); + // Limit hotspots to single line so hotspots on two lines don't merge. void SetHotspotSingleLine(bool singleLine); + // Get the HotspotSingleLine property + bool GetHotspotSingleLine(); + // Move caret between paragraphs (delimited by empty lines). void ParaDown(); void ParaDownExtend(); @@ -3152,6 +3398,48 @@ public: // Get the background alpha of the caret line. int GetCaretLineBackAlpha(); + // Set the style of the caret to be drawn. + void SetCaretStyle(int caretStyle); + + // Returns the current style of the caret. + int GetCaretStyle(); + + // Set the indicator used for IndicatorFillRange and IndicatorClearRange + void SetIndicatorCurrent(int indicator); + + // Get the current indicator + int GetIndicatorCurrent(); + + // Set the value used for IndicatorFillRange + void SetIndicatorValue(int value); + + // Get the current indicator vaue + int GetIndicatorValue(); + + // Turn a indicator on over a range. + void IndicatorFillRange(int position, int fillLength); + + // Turn a indicator off over a range. + void IndicatorClearRange(int position, int clearLength); + + // Are any indicators present at position? + int IndicatorAllOnFor(int position); + + // What value does a particular indicator have at at a position? + int IndicatorValueAt(int indicator, int position); + + // Where does a particular indicator start? + int IndicatorStart(int indicator, int position); + + // Where does a particular indicator end? + int IndicatorEnd(int indicator, int position); + + // Set number of entries in position cache + void SetPositionCacheSize(int size); + + // How many entries are allocated to the position cache? + int GetPositionCacheSize(); + // Start notifying the container of all key presses and commands. void StartRecord(); @@ -3213,6 +3501,9 @@ public: void StyleSetSpec(int styleNum, const wxString& spec); + // Get the font of a style. + wxFont StyleGetFont(int style); + // Set style size, face, bold, italic, and underline attributes from // a wxFont's attributes. @@ -3521,6 +3812,8 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, 1674) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, 1675) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, 1676) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_CLICK, 1677) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, 1678) END_DECLARE_EVENT_TYPES() #else enum { @@ -3549,7 +3842,9 @@ END_DECLARE_EVENT_TYPES() wxEVT_STC_HOTSPOT_CLICK, wxEVT_STC_HOTSPOT_DCLICK, wxEVT_STC_CALLTIP_CLICK, - wxEVT_STC_AUTOCOMP_SELECTION + wxEVT_STC_AUTOCOMP_SELECTION, + wxEVT_STC_INDICATOR_CLICK, + wxEVT_STC_INDICATOR_RELEASE }; #endif @@ -3584,6 +3879,9 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), #define EVT_STC_CALLTIP_CLICK(id, fn)) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), #define EVT_STC_AUTOCOMP_SELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), +#define EVT_STC_INDICATOR_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), +#define EVT_STC_INDICATOR_RELEASE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), + #endif #endif // wxUSE_STC diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 153de8cc57..46020203e9 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -21,6 +21,10 @@ #include +#if wxUSE_DISPLAY +#include "wx/display.h" +#endif + #include "wx/encconv.h" #include "wx/listctrl.h" #include "wx/mstream.h" @@ -155,7 +159,7 @@ void Font::Create(const char *faceName, int characterSet, int size, bool bold, b false, stc2wx(faceName), encoding); - font->SetNoAntiAliasing(!extraFontFlag); + //font->SetNoAntiAliasing(!extraFontFlag); id = font; } @@ -721,6 +725,19 @@ void Window::SetTitle(const char *s) { } +// Returns rectangle of monitor pt is on +PRectangle Window::GetMonitorRect(Point pt) { + wxRect rect; + if (! id) return PRectangle(); +#if wxUSE_DISPLAY + // Get the display the point is found on + int n = wxDisplay::GetFromPoint(wxPoint(pt.x, pt.y)); + wxDisplay dpy(n == wxNOT_FOUND ? 0 : n); + rect = dpy.GetGeometry(); +#endif + return PRectangleFromwxRect(rect); +} + //---------------------------------------------------------------------- // Helper classes for ListBox @@ -1543,10 +1560,10 @@ wxString stc2wx(const char* str, size_t len) if (!len) return wxEmptyString; - size_t wclen = UCS2Length(str, len); + size_t wclen = UTF16Length(str, len); wxWCharBuffer buffer(wclen+1); - size_t actualLen = UCS2FromUTF8(str, len, buffer.data(), wclen+1); + size_t actualLen = UTF16FromUTF8(str, len, buffer.data(), wclen+1); return wxString(buffer.data(), actualLen); } @@ -1565,7 +1582,7 @@ const wxWX2MBbuf wx2stc(const wxString& str) size_t len = UTF8Length(wcstr, wclen); wxCharBuffer buffer(len+1); - UTF8FromUCS2(wcstr, wclen, buffer.data(), len); + UTF8FromUTF16(wcstr, wclen, buffer.data(), len); // TODO check NULL termination!! diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 76af113dd7..48655b2966 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -334,7 +334,7 @@ void ScintillaWX::DoStartDrag() { result = source.DoDragDrop(evt.GetDragAllowMove()); if (result == wxDragMove && dropWentOutside) ClearSelection(); - inDragDrop = false; + inDragDrop = ddNone; SetDragPosition(invalidPosition); } #endif // wxUSE_DRAG_AND_DROP diff --git a/src/stc/ScintillaWX.h b/src/stc/ScintillaWX.h index 26e9c239e5..66345d16d2 100644 --- a/src/stc/ScintillaWX.h +++ b/src/stc/ScintillaWX.h @@ -36,8 +36,10 @@ #include "Accessor.h" #include "KeyWords.h" #endif +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" #include "ContractionState.h" -#include "SVector.h" #include "CellBuffer.h" #include "CallTip.h" #include "KeyMap.h" @@ -46,7 +48,9 @@ #include "Style.h" #include "ViewStyle.h" #include "AutoComplete.h" +#include "Decoration.h" #include "Document.h" +#include "PositionCache.h" #include "Editor.h" #include "ScintillaBase.h" diff --git a/src/stc/gen_iface.py b/src/stc/gen_iface.py index 37bae5033d..2dfea4c444 100644 --- a/src/stc/gen_iface.py +++ b/src/stc/gen_iface.py @@ -21,7 +21,7 @@ H_TEMPLATE = os.path.abspath('./stc.h.in') CPP_TEMPLATE = os.path.abspath('./stc.cpp.in') H_DEST = os.path.abspath('../../include/wx/stc/stc.h') CPP_DEST = os.path.abspath('./stc.cpp') -DOCSTR_DEST = os.path.abspath('../../wxPython/contrib/stc/_stc_gendocs.i') +DOCSTR_DEST = os.path.abspath('../../../wxPython/contrib/stc/_stc_gendocs.i') # Value prefixes to convert @@ -37,16 +37,17 @@ valPrefixes = [('SCI_', ''), ] # Message function values that should have a CMD_ constant generated -cmdValues = [ (2300, 2349), - 2011, +cmdValues = [ 2011, 2013, (2176, 2180), + (2300, 2349), (2390, 2393), (2395, 2396), 2404, (2413, 2416), (2426, 2442), (2450, 2455), + 2518, ] @@ -225,11 +226,27 @@ methodOverrideMap = { 'SetMarginSensitiveN' : ('SetMarginSensitive', 0, 0, 0), 'GetMarginSensitiveN' : ('GetMarginSensitive', 0, 0, 0), + + 'StyleGetFore' : ('StyleGetForeground', 0, 0, 0), + 'StyleGetBack' : ('StyleGetBackground', 0, 0, 0), 'StyleSetFore' : ('StyleSetForeground', 0, 0, 0), 'StyleSetBack' : ('StyleSetBackground', 0, 0, 0), 'SetSelFore' : ('SetSelForeground', 0, 0, 0), 'SetSelBack' : ('SetSelBackground', 0, 0, 0), 'SetCaretFore' : ('SetCaretForeground', 0, 0, 0), + 'StyleGetFont' : + ('StyleGetFaceName', + 'wxString %s(int style);', + '''wxString %s(int style) { + long msg = %s; + long len = SendMsg(msg, style, 0); + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, style, (long)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf);''', + ('Get the font facename of a style',)), 'StyleSetFont' : ('StyleSetFaceName', 0, 0, 0), 'StyleSetCharacterSet' : (None, 0, 0, 0), @@ -266,7 +283,9 @@ methodOverrideMap = { 'IndicGetStyle' : ('IndicatorGetStyle', 0, 0, 0), 'IndicSetFore' : ('IndicatorSetForeground', 0, 0, 0), 'IndicGetFore' : ('IndicatorGetForeground', 0, 0, 0), - + 'IndicSetUnder': ('IndicatorSetUnder', 0, 0, 0), + 'IndicGetUnder': ('IndicatorGetUnder', 0, 0, 0), + 'SetWhitespaceFore' : ('SetWhitespaceForeground', 0, 0, 0), 'SetWhitespaceBack' : ('SetWhitespaceBackground', 0, 0, 0), @@ -488,6 +507,8 @@ methodOverrideMap = { 'SetHotspotActiveFore' : ('SetHotspotActiveForeground', 0, 0, 0), 'SetHotspotActiveBack' : ('SetHotspotActiveBackground', 0, 0, 0), + 'GetHotspotActiveFore' : ('GetHotspotActiveForeground', 0, 0, 0), + 'GetHotspotActiveBack' : ('GetHotspotActiveBackground', 0, 0, 0), 'GetCaretLineBack' : ('GetCaretLineBackground', 0, 0, 0), 'SetCaretLineBack' : ('SetCaretLineBackground', 0, 0, 0), @@ -626,6 +647,9 @@ methodOverrideMap = { 'LoadLexerLibrary' : (None, 0,0,0), + 'SetPositionCache' : ('SetPositionCacheSize', 0, 0, 0), + 'GetPositionCache' : ('GetPositionCacheSize', 0, 0, 0), + '' : ('', 0, 0, 0), diff --git a/src/stc/scintilla/README.txt b/src/stc/scintilla/README.txt index 89ff867d44..13390ddda6 100644 --- a/src/stc/scintilla/README.txt +++ b/src/stc/scintilla/README.txt @@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source distribution. All other code needed to implement Scintilla on top of wxWindows is located in the directory above this one. -The current version of the Scintilla code is 1.70 +The current version of the Scintilla code is 1.75 diff --git a/src/stc/scintilla/include/Accessor.h b/src/stc/scintilla/include/Accessor.h index 0b2c4baee2..d9db9c7bfe 100644 --- a/src/stc/scintilla/include/Accessor.h +++ b/src/stc/scintilla/include/Accessor.h @@ -75,4 +75,5 @@ public: virtual void ColourTo(unsigned int pos, int chAttr)=0; virtual void SetLevel(int line, int level)=0; virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0; + virtual void IndicatorFill(int start, int end, int indicator, int value)=0; }; diff --git a/src/stc/scintilla/include/KeyWords.h b/src/stc/scintilla/include/KeyWords.h index 059ac0da0f..6abae59453 100644 --- a/src/stc/scintilla/include/KeyWords.h +++ b/src/stc/scintilla/include/KeyWords.h @@ -5,6 +5,10 @@ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler); @@ -51,6 +55,10 @@ public: static const LexerModule *Find(const char *languageName); }; +#ifdef SCI_NAMESPACE +} +#endif + /** * Check if a character is a space. * This is ASCII specific but is safe with chars >= 0x80. diff --git a/src/stc/scintilla/include/Platform.h b/src/stc/scintilla/include/Platform.h index 679294cad7..79be33f6ba 100644 --- a/src/stc/scintilla/include/Platform.h +++ b/src/stc/scintilla/include/Platform.h @@ -1,7 +1,7 @@ // Scintilla source code edit control /** @file Platform.h ** Interface to platform facilities. Also includes some basic utilities. - ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWidgets. + ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. @@ -12,10 +12,11 @@ // PLAT_GTK = GTK+ on Linux or Win32 // PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32 // PLAT_WIN = Win32 API on Win32 OS -// PLAT_WX is wxWidgets on any supported platform +// PLAT_WX is wxWindows on any supported platform #define PLAT_GTK 0 #define PLAT_GTK_WIN32 0 +#define PLAT_MACOSX 0 #define PLAT_WIN 0 #define PLAT_WX 0 #define PLAT_FOX 0 @@ -37,12 +38,19 @@ #define PLAT_GTK_WIN32 1 #endif +#elif defined(MACOSX) +#undef PLAT_MACOSX +#define PLAT_MACOSX 1 + #else #undef PLAT_WIN #define PLAT_WIN 1 #endif +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif // 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 @@ -114,6 +122,9 @@ public: } int Width() { return right - left; } int Height() { return bottom - top; } + bool Empty() { + return (Height() <= 0) || (Width() <= 0); + } }; /** @@ -302,8 +313,8 @@ private: Surface(const Surface &) {} Surface &operator=(const Surface &) { return *this; } public: - Surface() {} - virtual ~Surface() {} + Surface() {}; + virtual ~Surface() {}; static Surface *Allocate(); virtual void Init(WindowID wid)=0; @@ -360,9 +371,23 @@ typedef void (*CallBackAction)(void*); class Window { protected: WindowID id; +#if PLAT_MACOSX + void *windowRef; + void *control; +#endif public: - Window() : id(0), cursorLast(cursorInvalid) {} - Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) {} + Window() : id(0), cursorLast(cursorInvalid) { +#if PLAT_MACOSX + windowRef = 0; + control = 0; +#endif + } + Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) { +#if PLAT_MACOSX + windowRef = 0; + control = 0; +#endif + } virtual ~Window(); Window &operator=(WindowID id_) { id = id_; @@ -383,6 +408,11 @@ public: enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand }; void SetCursor(Cursor curs); void SetTitle(const char *s); + PRectangle GetMonitorRect(Point pt); +#if PLAT_MACOSX + void SetWindow(void *ref) { windowRef = ref; }; + void SetControl(void *_control) { control = _control; }; +#endif private: Cursor cursorLast; }; @@ -443,7 +473,7 @@ public: */ class DynamicLibrary { public: - virtual ~DynamicLibrary() {} + virtual ~DynamicLibrary() {}; /// @return Pointer to function "name", or NULL on failure. virtual Function FindFunction(const char *name) = 0; @@ -506,8 +536,16 @@ public: #ifdef NDEBUG #define PLATFORM_ASSERT(c) ((void)0) #else +#ifdef SCI_NAMESPACE +#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__)) +#else #define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__)) #endif +#endif + +#ifdef SCI_NAMESPACE +} +#endif // Shut up annoying Visual C++ warnings: #ifdef _MSC_VER diff --git a/src/stc/scintilla/include/PropSet.h b/src/stc/scintilla/include/PropSet.h index e38de7dc40..91bc7072ba 100644 --- a/src/stc/scintilla/include/PropSet.h +++ b/src/stc/scintilla/include/PropSet.h @@ -13,6 +13,10 @@ bool EqualCaseInsensitive(const char *a, const char *b); bool isprefix(const char *target, const char *prefix); +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + struct Property { unsigned int hash; char *key; @@ -29,7 +33,6 @@ protected: Property *props[hashRoots]; Property *enumnext; int enumhash; - static bool caseSensitiveFilenames; static unsigned int HashString(const char *s, size_t len) { unsigned int ret = 0; while (len--) { @@ -39,7 +42,6 @@ protected: } return ret; } - static bool IncludesVar(const char *value, const char *key); public: PropSet *superPS; @@ -49,19 +51,12 @@ public: void Set(const char *keyVal); void Unset(const char *key, int lenKey=-1); void SetMultiple(const char *s); - SString Get(const char *key); - SString GetExpanded(const char *key); - SString Expand(const char *withVars, int maxExpands=100); - int GetInt(const char *key, int defaultValue=0); - SString GetWild(const char *keybase, const char *filename); - SString GetNewExpand(const char *keybase, const char *filename=""); + SString Get(const char *key) const; + SString GetExpanded(const char *key) const; + SString Expand(const char *withVars, int maxExpands=100) const; + int GetInt(const char *key, int defaultValue=0) const; void Clear(); - char *ToString(); // Caller must delete[] the return value - bool GetFirst(char **key, char **val); - bool GetNext(char **key, char **val); - static void SetCaseSensitiveFilenames(bool caseSensitiveFilenames_) { - caseSensitiveFilenames = caseSensitiveFilenames_; - } + char *ToString() const; // Caller must delete[] the return value private: // copy-value semantics not implemented @@ -75,35 +70,30 @@ class WordList { public: // Each word contains at least one character - a empty word acts as sentinel at the end. char **words; - char **wordsNoCase; char *list; int len; bool onlyLineEnds; ///< Delimited by any white space or only line ends bool sorted; - bool sortedNoCase; int starts[256]; WordList(bool onlyLineEnds_ = false) : - words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), - sorted(false), sortedNoCase(false) {} + words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), + sorted(false) + {} ~WordList() { Clear(); } operator bool() { return len ? true : false; } - char *operator[](int ind) { return words[ind]; } void Clear(); void Set(const char *s); - char *Allocate(int size); - void SetFromAllocated(); bool InList(const char *s); bool InListAbbreviated(const char *s, const char marker); - const char *GetNearestWord(const char *wordStart, int searchLen, - bool ignoreCase = false, SString wordCharacters="", int wordIndex = -1); - char *GetNearestWords(const char *wordStart, int searchLen, - bool ignoreCase=false, char otherSeparator='\0', bool exactLen=false); }; inline bool IsAlphabetic(unsigned int ch) { return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z')); } +#ifdef SCI_NAMESPACE +} +#endif #ifdef _MSC_VER // Visual C++ doesn't like the private copy idiom for disabling diff --git a/src/stc/scintilla/include/SString.h b/src/stc/scintilla/include/SString.h index 38a206ccf2..b770afebee 100644 --- a/src/stc/scintilla/include/SString.h +++ b/src/stc/scintilla/include/SString.h @@ -8,11 +8,16 @@ #ifndef SSTRING_H #define SSTRING_H + // These functions are implemented because each platform calls them something different. int CompareCaseInsensitive(const char *a, const char *b); int CompareNCaseInsensitive(const char *a, const char *b, size_t len); bool EqualCaseInsensitive(const char *a, const char *b); +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + // Define another string class. // While it would be 'better' to use std::string, that doubles the executable size. // An SString may contain embedded nul characters. @@ -277,4 +282,8 @@ inline char *StringDup( return SContainer::StringAllocate(s, len); } +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/include/SciLexer.h b/src/stc/scintilla/include/SciLexer.h index 22d016d21c..2354aa8765 100644 --- a/src/stc/scintilla/include/SciLexer.h +++ b/src/stc/scintilla/include/SciLexer.h @@ -91,6 +91,14 @@ #define SCLEX_INNOSETUP 76 #define SCLEX_OPAL 77 #define SCLEX_SPICE 78 +#define SCLEX_D 79 +#define SCLEX_CMAKE 80 +#define SCLEX_GAP 81 +#define SCLEX_PLM 82 +#define SCLEX_PROGRESS 83 +#define SCLEX_ABAQUS 84 +#define SCLEX_ASYMPTOTE 85 +#define SCLEX_R 86 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 @@ -128,6 +136,24 @@ #define SCE_C_COMMENTDOCKEYWORD 17 #define SCE_C_COMMENTDOCKEYWORDERROR 18 #define SCE_C_GLOBALCLASS 19 +#define SCE_D_DEFAULT 0 +#define SCE_D_COMMENT 1 +#define SCE_D_COMMENTLINE 2 +#define SCE_D_COMMENTDOC 3 +#define SCE_D_COMMENTNESTED 4 +#define SCE_D_NUMBER 5 +#define SCE_D_WORD 6 +#define SCE_D_WORD2 7 +#define SCE_D_WORD3 8 +#define SCE_D_TYPEDEF 9 +#define SCE_D_STRING 10 +#define SCE_D_STRINGEOL 11 +#define SCE_D_CHARACTER 12 +#define SCE_D_OPERATOR 13 +#define SCE_D_IDENTIFIER 14 +#define SCE_D_COMMENTLINEDOC 15 +#define SCE_D_COMMENTDOCKEYWORD 16 +#define SCE_D_COMMENTDOCKEYWORDERROR 17 #define SCE_TCL_DEFAULT 0 #define SCE_TCL_COMMENT 1 #define SCE_TCL_COMMENTLINE 2 @@ -293,6 +319,9 @@ #define SCE_PL_STRING_QR 29 #define SCE_PL_STRING_QW 30 #define SCE_PL_POD_VERB 31 +#define SCE_PL_SUB_PROTOTYPE 40 +#define SCE_PL_FORMAT_IDENT 41 +#define SCE_PL_FORMAT 42 #define SCE_RB_DEFAULT 0 #define SCE_RB_ERROR 1 #define SCE_RB_COMMENTLINE 2 @@ -398,6 +427,7 @@ #define SCE_ERR_ABSF 18 #define SCE_ERR_TIDY 19 #define SCE_ERR_JAVA_STACK 20 +#define SCE_ERR_VALUE 21 #define SCE_BAT_DEFAULT 0 #define SCE_BAT_COMMENT 1 #define SCE_BAT_WORD 2 @@ -710,6 +740,7 @@ #define SCE_YAML_DOCUMENT 6 #define SCE_YAML_TEXT 7 #define SCE_YAML_ERROR 8 +#define SCE_YAML_OPERATOR 9 #define SCE_TEX_DEFAULT 0 #define SCE_TEX_SPECIAL 1 #define SCE_TEX_GROUP 2 @@ -927,6 +958,7 @@ #define SCE_T3_USER1 17 #define SCE_T3_USER2 18 #define SCE_T3_USER3 19 +#define SCE_T3_BRACE 20 #define SCE_REBOL_DEFAULT 0 #define SCE_REBOL_COMMENTLINE 1 #define SCE_REBOL_COMMENTBLOCK 2 @@ -1067,6 +1099,110 @@ #define SCE_SPICE_DELIMITER 6 #define SCE_SPICE_VALUE 7 #define SCE_SPICE_COMMENTLINE 8 +#define SCE_CMAKE_DEFAULT 0 +#define SCE_CMAKE_COMMENT 1 +#define SCE_CMAKE_STRINGDQ 2 +#define SCE_CMAKE_STRINGLQ 3 +#define SCE_CMAKE_STRINGRQ 4 +#define SCE_CMAKE_COMMANDS 5 +#define SCE_CMAKE_PARAMETERS 6 +#define SCE_CMAKE_VARIABLE 7 +#define SCE_CMAKE_USERDEFINED 8 +#define SCE_CMAKE_WHILEDEF 9 +#define SCE_CMAKE_FOREACHDEF 10 +#define SCE_CMAKE_IFDEFINEDEF 11 +#define SCE_CMAKE_MACRODEF 12 +#define SCE_CMAKE_STRINGVAR 13 +#define SCE_CMAKE_NUMBER 14 +#define SCE_GAP_DEFAULT 0 +#define SCE_GAP_IDENTIFIER 1 +#define SCE_GAP_KEYWORD 2 +#define SCE_GAP_KEYWORD2 3 +#define SCE_GAP_KEYWORD3 4 +#define SCE_GAP_KEYWORD4 5 +#define SCE_GAP_STRING 6 +#define SCE_GAP_CHAR 7 +#define SCE_GAP_OPERATOR 8 +#define SCE_GAP_COMMENT 9 +#define SCE_GAP_NUMBER 10 +#define SCE_GAP_STRINGEOL 11 +#define SCE_PLM_DEFAULT 0 +#define SCE_PLM_COMMENT 1 +#define SCE_PLM_STRING 2 +#define SCE_PLM_NUMBER 3 +#define SCE_PLM_IDENTIFIER 4 +#define SCE_PLM_OPERATOR 5 +#define SCE_PLM_CONTROL 6 +#define SCE_PLM_KEYWORD 7 +#define SCE_4GL_DEFAULT 0 +#define SCE_4GL_NUMBER 1 +#define SCE_4GL_WORD 2 +#define SCE_4GL_STRING 3 +#define SCE_4GL_CHARACTER 4 +#define SCE_4GL_PREPROCESSOR 5 +#define SCE_4GL_OPERATOR 6 +#define SCE_4GL_IDENTIFIER 7 +#define SCE_4GL_BLOCK 8 +#define SCE_4GL_END 9 +#define SCE_4GL_COMMENT1 10 +#define SCE_4GL_COMMENT2 11 +#define SCE_4GL_COMMENT3 12 +#define SCE_4GL_COMMENT4 13 +#define SCE_4GL_COMMENT5 14 +#define SCE_4GL_COMMENT6 15 +#define SCE_4GL_DEFAULT_ 16 +#define SCE_4GL_NUMBER_ 17 +#define SCE_4GL_WORD_ 18 +#define SCE_4GL_STRING_ 19 +#define SCE_4GL_CHARACTER_ 20 +#define SCE_4GL_PREPROCESSOR_ 21 +#define SCE_4GL_OPERATOR_ 22 +#define SCE_4GL_IDENTIFIER_ 23 +#define SCE_4GL_BLOCK_ 24 +#define SCE_4GL_END_ 25 +#define SCE_4GL_COMMENT1_ 26 +#define SCE_4GL_COMMENT2_ 27 +#define SCE_4GL_COMMENT3_ 28 +#define SCE_4GL_COMMENT4_ 29 +#define SCE_4GL_COMMENT5_ 30 +#define SCE_4GL_COMMENT6_ 31 +#define SCE_ABAQUS_DEFAULT 0 +#define SCE_ABAQUS_COMMENT 1 +#define SCE_ABAQUS_COMMENTBLOCK 2 +#define SCE_ABAQUS_NUMBER 3 +#define SCE_ABAQUS_STRING 4 +#define SCE_ABAQUS_OPERATOR 5 +#define SCE_ABAQUS_WORD 6 +#define SCE_ABAQUS_PROCESSOR 7 +#define SCE_ABAQUS_COMMAND 8 +#define SCE_ABAQUS_SLASHCOMMAND 9 +#define SCE_ABAQUS_STARCOMMAND 10 +#define SCE_ABAQUS_ARGUMENT 11 +#define SCE_ABAQUS_FUNCTION 12 +#define SCE_ASY_DEFAULT 0 +#define SCE_ASY_COMMENT 1 +#define SCE_ASY_COMMENTLINE 2 +#define SCE_ASY_NUMBER 3 +#define SCE_ASY_WORD 4 +#define SCE_ASY_STRING 5 +#define SCE_ASY_CHARACTER 6 +#define SCE_ASY_OPERATOR 7 +#define SCE_ASY_IDENTIFIER 8 +#define SCE_ASY_STRINGEOL 9 +#define SCE_ASY_COMMENTLINEDOC 10 +#define SCE_ASY_WORD2 11 +#define SCE_R_DEFAULT 0 +#define SCE_R_COMMENT 1 +#define SCE_R_KWORD 2 +#define SCE_R_BASEKWORD 3 +#define SCE_R_OTHERKWORD 4 +#define SCE_R_NUMBER 5 +#define SCE_R_STRING 6 +#define SCE_R_STRING2 7 +#define SCE_R_OPERATOR 8 +#define SCE_R_IDENTIFIER 9 +#define SCE_R_INFIX 10 +#define SCE_R_INFIXEOL 11 #define SCLEX_ASP 29 #define SCLEX_PHP 30 //--Autogenerated -- end of section automatically generated from Scintilla.iface diff --git a/src/stc/scintilla/include/Scintilla.h b/src/stc/scintilla/include/Scintilla.h index 3a57da6ae2..6fde15267d 100644 --- a/src/stc/scintilla/include/Scintilla.h +++ b/src/stc/scintilla/include/Scintilla.h @@ -159,7 +159,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define STYLE_INDENTGUIDE 37 #define STYLE_CALLTIP 38 #define STYLE_LASTPREDEFINED 39 -#define STYLE_MAX 127 +#define STYLE_MAX 255 #define SC_CHARSET_ANSI 0 #define SC_CHARSET_DEFAULT 1 #define SC_CHARSET_BALTIC 186 @@ -194,6 +194,19 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_CASE_MIXED 0 #define SC_CASE_UPPER 1 #define SC_CASE_LOWER 2 +#define SCI_STYLEGETFORE 2481 +#define SCI_STYLEGETBACK 2482 +#define SCI_STYLEGETBOLD 2483 +#define SCI_STYLEGETITALIC 2484 +#define SCI_STYLEGETSIZE 2485 +#define SCI_STYLEGETFONT 2486 +#define SCI_STYLEGETEOLFILLED 2487 +#define SCI_STYLEGETUNDERLINE 2488 +#define SCI_STYLEGETCASE 2489 +#define SCI_STYLEGETCHARACTERSET 2490 +#define SCI_STYLEGETVISIBLE 2491 +#define SCI_STYLEGETCHANGEABLE 2492 +#define SCI_STYLEGETHOTSPOT 2493 #define SCI_STYLESETCASE 2060 #define SCI_STYLESETCHARACTERSET 2066 #define SCI_STYLESETHOTSPOT 2409 @@ -201,6 +214,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETSELBACK 2068 #define SCI_GETSELALPHA 2477 #define SCI_SETSELALPHA 2478 +#define SCI_GETSELEOLFILLED 2479 +#define SCI_SETSELEOLFILLED 2480 #define SCI_SETCARETFORE 2069 #define SCI_ASSIGNCMDKEY 2070 #define SCI_CLEARCMDKEY 2071 @@ -212,7 +227,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETWORDCHARS 2077 #define SCI_BEGINUNDOACTION 2078 #define SCI_ENDUNDOACTION 2079 -#define INDIC_MAX 7 #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 @@ -221,6 +235,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define INDIC_HIDDEN 5 #define INDIC_BOX 6 #define INDIC_ROUNDBOX 7 +#define INDIC_MAX 31 +#define INDIC_CONTAINER 8 #define INDIC0_MASK 0x20 #define INDIC1_MASK 0x40 #define INDIC2_MASK 0x80 @@ -229,6 +245,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_INDICGETSTYLE 2081 #define SCI_INDICSETFORE 2082 #define SCI_INDICGETFORE 2083 +#define SCI_INDICSETUNDER 2510 +#define SCI_INDICGETUNDER 2511 #define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEBACK 2085 #define SCI_SETSTYLEBITS 2090 @@ -280,6 +298,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETCOLUMN 2129 #define SCI_SETHSCROLLBAR 2130 #define SCI_GETHSCROLLBAR 2131 +#define SC_IV_NONE 0 +#define SC_IV_REAL 1 +#define SC_IV_LOOKFORWARD 2 +#define SC_IV_LOOKBOTH 3 #define SCI_SETINDENTATIONGUIDES 2132 #define SCI_GETINDENTATIONGUIDES 2133 #define SCI_SETHIGHLIGHTGUIDE 2134 @@ -430,6 +452,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETLAYOUTCACHE 2273 #define SCI_SETSCROLLWIDTH 2274 #define SCI_GETSCROLLWIDTH 2275 +#define SCI_SETSCROLLWIDTHTRACKING 2516 +#define SCI_GETSCROLLWIDTHTRACKING 2517 #define SCI_TEXTWIDTH 2276 #define SCI_SETENDATLASTLINE 2277 #define SCI_GETENDATLASTLINE 2278 @@ -481,6 +505,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_ZOOMOUT 2334 #define SCI_DELWORDLEFT 2335 #define SCI_DELWORDRIGHT 2336 +#define SCI_DELWORDRIGHTEND 2518 #define SCI_LINECUT 2337 #define SCI_LINEDELETE 2338 #define SCI_LINETRANSPOSE 2339 @@ -566,9 +591,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETPRINTWRAPMODE 2406 #define SCI_GETPRINTWRAPMODE 2407 #define SCI_SETHOTSPOTACTIVEFORE 2410 +#define SCI_GETHOTSPOTACTIVEFORE 2494 #define SCI_SETHOTSPOTACTIVEBACK 2411 +#define SCI_GETHOTSPOTACTIVEBACK 2495 #define SCI_SETHOTSPOTACTIVEUNDERLINE 2412 +#define SCI_GETHOTSPOTACTIVEUNDERLINE 2496 #define SCI_SETHOTSPOTSINGLELINE 2421 +#define SCI_GETHOTSPOTSINGLELINE 2497 #define SCI_PARADOWN 2413 #define SCI_PARADOWNEXTEND 2414 #define SCI_PARAUP 2415 @@ -620,6 +649,23 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_ALPHA_NOALPHA 256 #define SCI_SETCARETLINEBACKALPHA 2470 #define SCI_GETCARETLINEBACKALPHA 2471 +#define CARETSTYLE_INVISIBLE 0 +#define CARETSTYLE_LINE 1 +#define CARETSTYLE_BLOCK 2 +#define SCI_SETCARETSTYLE 2512 +#define SCI_GETCARETSTYLE 2513 +#define SCI_SETINDICATORCURRENT 2500 +#define SCI_GETINDICATORCURRENT 2501 +#define SCI_SETINDICATORVALUE 2502 +#define SCI_GETINDICATORVALUE 2503 +#define SCI_INDICATORFILLRANGE 2504 +#define SCI_INDICATORCLEARRANGE 2505 +#define SCI_INDICATORALLONFOR 2506 +#define SCI_INDICATORVALUEAT 2507 +#define SCI_INDICATORSTART 2508 +#define SCI_INDICATOREND 2509 +#define SCI_SETPOSITIONCACHE 2514 +#define SCI_GETPOSITIONCACHE 2515 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 @@ -647,7 +693,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MOD_BEFOREINSERT 0x400 #define SC_MOD_BEFOREDELETE 0x800 #define SC_MULTILINEUNDOREDO 0x1000 -#define SC_MODEVENTMASKALL 0x1FFF +#define SC_STARTACTION 0x2000 +#define SC_MOD_CHANGEINDICATOR 0x4000 +#define SC_MOD_CHANGELINESTATE 0x8000 +#define SC_MODEVENTMASKALL 0xFFFF #define SCEN_CHANGE 768 #define SCEN_SETFOCUS 512 #define SCEN_KILLFOCUS 256 @@ -668,6 +717,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCK_ADD 310 #define SCK_SUBTRACT 311 #define SCK_DIVIDE 312 +#define SCK_WIN 313 +#define SCK_RWIN 314 +#define SCK_MENU 315 #define SCMOD_NORM 0 #define SCMOD_SHIFT 1 #define SCMOD_CTRL 2 @@ -694,12 +746,18 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_HOTSPOTDOUBLECLICK 2020 #define SCN_CALLTIPCLICK 2021 #define SCN_AUTOCSELECTION 2022 +#define SCN_INDICATORCLICK 2023 +#define SCN_INDICATORRELEASE 2024 //--Autogenerated -- end of section automatically generated from Scintilla.iface // These structures are defined to be exactly the same shape as the Win32 // CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. // So older code that treats Scintilla as a RichEdit will work. +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + struct CharacterRange { long cpMin; long cpMax; @@ -761,6 +819,10 @@ struct SCNotification { int y; // SCN_DWELLSTART, SCN_DWELLEND }; +#ifdef SCI_NAMESPACE +} +#endif + // Deprecation section listing all API features that are deprecated and will // will be removed completely in a future version. // To enable these features define INCLUDE_DEPRECATED_FEATURES diff --git a/src/stc/scintilla/include/Scintilla.iface b/src/stc/scintilla/include/Scintilla.iface index 9540e0de1a..a6626d2335 100644 --- a/src/stc/scintilla/include/Scintilla.iface +++ b/src/stc/scintilla/include/Scintilla.iface @@ -360,7 +360,7 @@ val STYLE_CONTROLCHAR=36 val STYLE_INDENTGUIDE=37 val STYLE_CALLTIP=38 val STYLE_LASTPREDEFINED=39 -val STYLE_MAX=127 +val STYLE_MAX=255 # Character set identifiers are used in StyleSetCharacterSet. # The values are the same as the Windows *_CHARSET values. @@ -421,6 +421,48 @@ enu CaseVisible=SC_CASE_ val SC_CASE_MIXED=0 val SC_CASE_UPPER=1 val SC_CASE_LOWER=2 + +# Get the foreground colour of a style. +get colour StyleGetFore=2481(int style,) + +# Get the background colour of a style. +get colour StyleGetBack=2482(int style,) + +# Get is a style bold or not. +get bool StyleGetBold=2483(int style,) + +# Get is a style italic or not. +get bool StyleGetItalic=2484(int style,) + +# Get the size of characters of a style. +get int StyleGetSize=2485(int style,) + +# Get the font of a style. +# Returns the length of the fontName +fun int StyleGetFont=2486(int style, stringresult fontName) + +# Get is a style to have its end of line filled or not. +get bool StyleGetEOLFilled=2487(int style,) + +# Get is a style underlined or not. +get bool StyleGetUnderline=2488(int style,) + +# Get is a style mixed case, or to force upper or lower case. +get int StyleGetCase=2489(int style,) + +# Get the character set of the font in a style. +get int StyleGetCharacterSet=2490(int style,) + +# Get is a style visible or not. +get bool StyleGetVisible=2491(int style,) + +# Get is a style changeable or not (read only). +# Experimental feature, currently buggy. +get bool StyleGetChangeable=2492(int style,) + +# Get is a style a hotspot or not. +get bool StyleGetHotSpot=2493(int style,) + # Set a style to be mixed case, or to force upper or lower case. set void StyleSetCase=2060(int style, int caseForce) @@ -442,6 +484,12 @@ get int GetSelAlpha=2477(,) # Set the alpha of the selection. set void SetSelAlpha=2478(int alpha,) +# Is the selection end of line filled? +get bool GetSelEOLFilled=2479(,) + +# Set the selection to have its end of line filled or not. +set void SetSelEOLFilled=2480(bool filled,) + # Set the foreground colour of the caret. set void SetCaretFore=2069(colour fore,) @@ -477,8 +525,8 @@ fun void BeginUndoAction=2078(,) # End a sequence of actions that is undone and redone as a unit. fun void EndUndoAction=2079(,) +# Indicator style enumeration and some constants enu IndicatorStyle=INDIC_ -val INDIC_MAX=7 val INDIC_PLAIN=0 val INDIC_SQUIGGLE=1 val INDIC_TT=2 @@ -487,6 +535,8 @@ val INDIC_STRIKE=4 val INDIC_HIDDEN=5 val INDIC_BOX=6 val INDIC_ROUNDBOX=7 +val INDIC_MAX=31 +val INDIC_CONTAINER=8 val INDIC0_MASK=0x20 val INDIC1_MASK=0x40 val INDIC2_MASK=0x80 @@ -504,6 +554,12 @@ set void IndicSetFore=2082(int indic, colour fore) # Retrieve the foreground colour of an indicator. get colour IndicGetFore=2083(int indic,) +# Set an indicator to draw under text or over(default). +set void IndicSetUnder=2510(int indic, bool under) + +# Retrieve whether indicator drawn under or over text. +get bool IndicGetUnder=2511(int indic,) + # Set the foreground colour of all whitespace and whether to use this setting. fun void SetWhitespaceFore=2084(bool useSetting, colour fore) @@ -671,11 +727,17 @@ set void SetHScrollBar=2130(bool show,) # Is the horizontal scroll bar visible? get bool GetHScrollBar=2131(,) +enu IndentView=SC_IV_ +val SC_IV_NONE=0 +val SC_IV_REAL=1 +val SC_IV_LOOKFORWARD=2 +val SC_IV_LOOKBOTH=3 + # Show or hide indentation guides. -set void SetIndentationGuides=2132(bool show,) +set void SetIndentationGuides=2132(int indentView,) # Are the indentation guides visible? -get bool GetIndentationGuides=2133(,) +get int GetIndentationGuides=2133(,) # Set the highlighted indentation guide column. # 0 = no highlighted guide. @@ -1087,6 +1149,12 @@ set void SetScrollWidth=2274(int pixelWidth,) # Retrieve the document width assumed for scrolling. get int GetScrollWidth=2275(,) +# Sets whether the maximum width line displayed is used to set scroll width. +set void SetScrollWidthTracking=2516(bool tracking,) + +# Retrieve whether the scroll width tracks wide lines. +get bool GetScrollWidthTracking=2517(,) + # Measure the pixel width of some text in a particular style. # NUL terminated text argument. # Does not handle tab or control characters. @@ -1250,6 +1318,9 @@ fun void DelWordLeft=2335(,) # Delete the word to the right of the caret. fun void DelWordRight=2336(,) +# Delete the word to the right of the caret, but not the trailing non-word characters. +fun void DelWordRightEnd=2518(,) + # Cut the line containing the caret. fun void LineCut=2337(,) @@ -1505,15 +1576,27 @@ get int GetPrintWrapMode=2407(,) # Set a fore colour for active hotspots. set void SetHotspotActiveFore=2410(bool useSetting, colour fore) +# Get the fore colour for active hotspots. +get colour GetHotspotActiveFore=2494(,) + # Set a back colour for active hotspots. set void SetHotspotActiveBack=2411(bool useSetting, colour back) +# Get the back colour for active hotspots. +get colour GetHotspotActiveBack=2495(,) + # Enable / Disable underlining active hotspots. set void SetHotspotActiveUnderline=2412(bool underline,) +# Get whether underlining for active hotspots. +get bool GetHotspotActiveUnderline=2496(,) + # Limit hotspots to single line so hotspots on two lines don't merge. set void SetHotspotSingleLine=2421(bool singleLine,) +# Get the HotspotSingleLine property +get bool GetHotspotSingleLine=2497(,) + # Move caret between paragraphs (delimited by empty lines). fun void ParaDown=2413(,) fun void ParaDownExtend=2414(,) @@ -1534,7 +1617,7 @@ fun void CopyRange=2419(position start, position end) # Copy argument text to the clipboard. fun void CopyText=2420(int length, string text) -# Selection modes +# Selection Modes enu SelectionMode=SC_SEL_ val SC_SEL_STREAM=0 val SC_SEL_RECTANGLE=1 @@ -1667,6 +1750,54 @@ set void SetCaretLineBackAlpha=2470(int alpha,) # Get the background alpha of the caret line. get int GetCaretLineBackAlpha=2471(,) +# Caret Styles +enu CaretStyle=CARETSTYLE_ +val CARETSTYLE_INVISIBLE=0 +val CARETSTYLE_LINE=1 +val CARETSTYLE_BLOCK=2 + +# Set the style of the caret to be drawn. +set void SetCaretStyle=2512(int caretStyle,) + +# Returns the current style of the caret. +get int GetCaretStyle=2513(,) + +# Set the indicator used for IndicatorFillRange and IndicatorClearRange +set void SetIndicatorCurrent=2500(int indicator,) + +# Get the current indicator +get int GetIndicatorCurrent=2501(,) + +# Set the value used for IndicatorFillRange +set void SetIndicatorValue=2502(int value,) + +# Get the current indicator vaue +get int GetIndicatorValue=2503(,) + +# Turn a indicator on over a range. +fun void IndicatorFillRange=2504(int position, int fillLength) + +# Turn a indicator off over a range. +fun void IndicatorClearRange=2505(int position, int clearLength) + +# Are any indicators present at position? +fun int IndicatorAllOnFor=2506(int position,) + +# What value does a particular indicator have at at a position? +fun int IndicatorValueAt=2507(int indicator, int position) + +# Where does a particular indicator start? +fun int IndicatorStart=2508(int indicator, int position) + +# Where does a particular indicator end? +fun int IndicatorEnd=2509(int indicator, int position) + +# Set number of entries in position cache +set void SetPositionCache=2514(int size,) + +# How many entries are allocated to the position cache? +get int GetPositionCache=2515(,) + # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) @@ -1729,7 +1860,10 @@ val SC_MOD_CHANGEMARKER=0x200 val SC_MOD_BEFOREINSERT=0x400 val SC_MOD_BEFOREDELETE=0x800 val SC_MULTILINEUNDOREDO=0x1000 -val SC_MODEVENTMASKALL=0x1FFF +val SC_STARTACTION=0x2000 +val SC_MOD_CHANGEINDICATOR=0x4000 +val SC_MOD_CHANGELINESTATE=0x8000 +val SC_MODEVENTMASKALL=0xFFFF # For compatibility, these go through the COMMAND notification rather than NOTIFY # and should have had exactly the same values as the EN_* constants. @@ -1761,6 +1895,9 @@ val SCK_RETURN=13 val SCK_ADD=310 val SCK_SUBTRACT=311 val SCK_DIVIDE=312 +val SCK_WIN=313 +val SCK_RWIN=314 +val SCK_MENU=315 enu KeyMod=SCMOD_ val SCMOD_NORM=0 @@ -1848,6 +1985,14 @@ val SCLEX_FREEBASIC=75 val SCLEX_INNOSETUP=76 val SCLEX_OPAL=77 val SCLEX_SPICE=78 +val SCLEX_D=79 +val SCLEX_CMAKE=80 +val SCLEX_GAP=81 +val SCLEX_PLM=82 +val SCLEX_PROGRESS=83 +val SCLEX_ABAQUS=84 +val SCLEX_ASYMPTOTE=85 +val SCLEX_R=86 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -1894,6 +2039,26 @@ val SCE_C_WORD2=16 val SCE_C_COMMENTDOCKEYWORD=17 val SCE_C_COMMENTDOCKEYWORDERROR=18 val SCE_C_GLOBALCLASS=19 +# Lexical states for SCLEX_D +lex D=SCLEX_D SCE_D_ +val SCE_D_DEFAULT=0 +val SCE_D_COMMENT=1 +val SCE_D_COMMENTLINE=2 +val SCE_D_COMMENTDOC=3 +val SCE_D_COMMENTNESTED=4 +val SCE_D_NUMBER=5 +val SCE_D_WORD=6 +val SCE_D_WORD2=7 +val SCE_D_WORD3=8 +val SCE_D_TYPEDEF=9 +val SCE_D_STRING=10 +val SCE_D_STRINGEOL=11 +val SCE_D_CHARACTER=12 +val SCE_D_OPERATOR=13 +val SCE_D_IDENTIFIER=14 +val SCE_D_COMMENTLINEDOC=15 +val SCE_D_COMMENTDOCKEYWORD=16 +val SCE_D_COMMENTDOCKEYWORDERROR=17 # Lexical states for SCLEX_TCL lex TCL=SCLEX_TCL SCE_TCL_ val SCE_TCL_DEFAULT=0 @@ -2080,6 +2245,9 @@ val SCE_PL_STRING_QX=28 val SCE_PL_STRING_QR=29 val SCE_PL_STRING_QW=30 val SCE_PL_POD_VERB=31 +val SCE_PL_SUB_PROTOTYPE=40 +val SCE_PL_FORMAT_IDENT=41 +val SCE_PL_FORMAT=42 # Lexical states for SCLEX_RUBY lex Ruby=SCLEX_RUBY SCE_RB_ val SCE_RB_DEFAULT=0 @@ -2199,6 +2367,7 @@ val SCE_ERR_IFORT=17 val SCE_ERR_ABSF=18 val SCE_ERR_TIDY=19 val SCE_ERR_JAVA_STACK=20 +val SCE_ERR_VALUE=21 # Lexical states for SCLEX_BATCH lex Batch=SCLEX_BATCH SCE_BAT_ val SCE_BAT_DEFAULT=0 @@ -2564,6 +2733,7 @@ val SCE_YAML_REFERENCE=5 val SCE_YAML_DOCUMENT=6 val SCE_YAML_TEXT=7 val SCE_YAML_ERROR=8 +val SCE_YAML_OPERATOR=9 # Lexical states for SCLEX_TEX lex TeX=SCLEX_TEX SCE_TEX_ val SCE_TEX_DEFAULT=0 @@ -2813,6 +2983,7 @@ val SCE_T3_HTML_STRING=16 val SCE_T3_USER1=17 val SCE_T3_USER2=18 val SCE_T3_USER3=19 +val SCE_T3_BRACE=20 # Lexical states for SCLEX_REBOL lex Rebol=SCLEX_REBOL SCE_REBOL_ val SCE_REBOL_DEFAULT=0 @@ -2969,6 +3140,124 @@ val SCE_SPICE_NUMBER=5 val SCE_SPICE_DELIMITER=6 val SCE_SPICE_VALUE=7 val SCE_SPICE_COMMENTLINE=8 +# Lexical states for SCLEX_CMAKE +lex CMAKE=SCLEX_CMAKE SCE_CMAKE_ +val SCE_CMAKE_DEFAULT=0 +val SCE_CMAKE_COMMENT=1 +val SCE_CMAKE_STRINGDQ=2 +val SCE_CMAKE_STRINGLQ=3 +val SCE_CMAKE_STRINGRQ=4 +val SCE_CMAKE_COMMANDS=5 +val SCE_CMAKE_PARAMETERS=6 +val SCE_CMAKE_VARIABLE=7 +val SCE_CMAKE_USERDEFINED=8 +val SCE_CMAKE_WHILEDEF=9 +val SCE_CMAKE_FOREACHDEF=10 +val SCE_CMAKE_IFDEFINEDEF=11 +val SCE_CMAKE_MACRODEF=12 +val SCE_CMAKE_STRINGVAR=13 +val SCE_CMAKE_NUMBER=14 +# Lexical states for SCLEX_GAP +lex Gap=SCLEX_GAP SCE_GAP_ +val SCE_GAP_DEFAULT=0 +val SCE_GAP_IDENTIFIER=1 +val SCE_GAP_KEYWORD=2 +val SCE_GAP_KEYWORD2=3 +val SCE_GAP_KEYWORD3=4 +val SCE_GAP_KEYWORD4=5 +val SCE_GAP_STRING=6 +val SCE_GAP_CHAR=7 +val SCE_GAP_OPERATOR=8 +val SCE_GAP_COMMENT=9 +val SCE_GAP_NUMBER=10 +val SCE_GAP_STRINGEOL=11 +# Lexical state for SCLEX_PLM +lex PLM=SCLEX_PLM SCE_PLM_ +val SCE_PLM_DEFAULT=0 +val SCE_PLM_COMMENT=1 +val SCE_PLM_STRING=2 +val SCE_PLM_NUMBER=3 +val SCE_PLM_IDENTIFIER=4 +val SCE_PLM_OPERATOR=5 +val SCE_PLM_CONTROL=6 +val SCE_PLM_KEYWORD=7 +# Lexical state for SCLEX_PROGRESS +lex Progress=SCLEX_PROGRESS SCE_4GL_ +val SCE_4GL_DEFAULT=0 +val SCE_4GL_NUMBER=1 +val SCE_4GL_WORD=2 +val SCE_4GL_STRING=3 +val SCE_4GL_CHARACTER=4 +val SCE_4GL_PREPROCESSOR=5 +val SCE_4GL_OPERATOR=6 +val SCE_4GL_IDENTIFIER=7 +val SCE_4GL_BLOCK=8 +val SCE_4GL_END=9 +val SCE_4GL_COMMENT1=10 +val SCE_4GL_COMMENT2=11 +val SCE_4GL_COMMENT3=12 +val SCE_4GL_COMMENT4=13 +val SCE_4GL_COMMENT5=14 +val SCE_4GL_COMMENT6=15 +val SCE_4GL_DEFAULT_=16 +val SCE_4GL_NUMBER_=17 +val SCE_4GL_WORD_=18 +val SCE_4GL_STRING_=19 +val SCE_4GL_CHARACTER_=20 +val SCE_4GL_PREPROCESSOR_=21 +val SCE_4GL_OPERATOR_=22 +val SCE_4GL_IDENTIFIER_=23 +val SCE_4GL_BLOCK_=24 +val SCE_4GL_END_=25 +val SCE_4GL_COMMENT1_=26 +val SCE_4GL_COMMENT2_=27 +val SCE_4GL_COMMENT3_=28 +val SCE_4GL_COMMENT4_=29 +val SCE_4GL_COMMENT5_=30 +val SCE_4GL_COMMENT6_=31 +# Lexical states for SCLEX_ABAQUS +lex ABAQUS=SCLEX_ABAQUS SCE_ABAQUS_ +val SCE_ABAQUS_DEFAULT=0 +val SCE_ABAQUS_COMMENT=1 +val SCE_ABAQUS_COMMENTBLOCK=2 +val SCE_ABAQUS_NUMBER=3 +val SCE_ABAQUS_STRING=4 +val SCE_ABAQUS_OPERATOR=5 +val SCE_ABAQUS_WORD=6 +val SCE_ABAQUS_PROCESSOR=7 +val SCE_ABAQUS_COMMAND=8 +val SCE_ABAQUS_SLASHCOMMAND=9 +val SCE_ABAQUS_STARCOMMAND=10 +val SCE_ABAQUS_ARGUMENT=11 +val SCE_ABAQUS_FUNCTION=12 +# Lexical states for SCLEX_ASYMPTOTE +lex Asymptote=SCLEX_ASYMPTOTE SCE_ASY_ +val SCE_ASY_DEFAULT=0 +val SCE_ASY_COMMENT=1 +val SCE_ASY_COMMENTLINE=2 +val SCE_ASY_NUMBER=3 +val SCE_ASY_WORD=4 +val SCE_ASY_STRING=5 +val SCE_ASY_CHARACTER=6 +val SCE_ASY_OPERATOR=7 +val SCE_ASY_IDENTIFIER=8 +val SCE_ASY_STRINGEOL=9 +val SCE_ASY_COMMENTLINEDOC=10 +val SCE_ASY_WORD2=11 +# Lexical states for SCLEX_R +lex R=SCLEX_R SCE_R_ +val SCE_R_DEFAULT=0 +val SCE_R_COMMENT=1 +val SCE_R_KWORD=2 +val SCE_R_BASEKWORD=3 +val SCE_R_OTHERKWORD=4 +val SCE_R_NUMBER=5 +val SCE_R_STRING=6 +val SCE_R_STRING2=7 +val SCE_R_OPERATOR=8 +val SCE_R_IDENTIFIER=9 +val SCE_R_INFIX=10 +val SCE_R_INFIXEOL=11 # Events @@ -2995,6 +3284,8 @@ evt void HotSpotClick=2019(int modifiers, int position) evt void HotSpotDoubleClick=2020(int modifiers, int position) evt void CallTipClick=2021(int position) evt void AutoCSelection=2022(string text) +evt void IndicatorClick=2023(int modifiers, int position) +evt void IndicatorRelease=2024(int modifiers, int position) cat Deprecated diff --git a/src/stc/scintilla/include/WindowAccessor.h b/src/stc/scintilla/include/WindowAccessor.h index 3d59cd1531..e107a0659c 100644 --- a/src/stc/scintilla/include/WindowAccessor.h +++ b/src/stc/scintilla/include/WindowAccessor.h @@ -6,6 +6,10 @@ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + /** */ class WindowAccessor : public Accessor { @@ -48,10 +52,15 @@ public: } void StartAt(unsigned int start, char chMask=31); - void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; } + void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; unsigned int GetStartSegment() { return startSeg; } void StartSegment(unsigned int pos); void ColourTo(unsigned int pos, int chAttr); void SetLevel(int line, int level); int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); + void IndicatorFill(int start, int end, int indicator, int value); }; + +#ifdef SCI_NAMESPACE +} +#endif diff --git a/src/stc/scintilla/src/AutoComplete.cxx b/src/stc/scintilla/src/AutoComplete.cxx index 753adca779..af6154ea13 100644 --- a/src/stc/scintilla/src/AutoComplete.cxx +++ b/src/stc/scintilla/src/AutoComplete.cxx @@ -14,6 +14,10 @@ #include "PropSet.h" #include "AutoComplete.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + AutoComplete::AutoComplete() : active(false), separator(' '), diff --git a/src/stc/scintilla/src/AutoComplete.h b/src/stc/scintilla/src/AutoComplete.h index 10577ca380..b10cdce82f 100644 --- a/src/stc/scintilla/src/AutoComplete.h +++ b/src/stc/scintilla/src/AutoComplete.h @@ -8,6 +8,10 @@ #ifndef AUTOCOMPLETE_H #define AUTOCOMPLETE_H +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + /** */ class AutoComplete { @@ -67,4 +71,8 @@ public: void Select(const char *word); }; +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/src/CallTip.cxx b/src/stc/scintilla/src/CallTip.cxx index f4bc5f83c4..9f5f884764 100644 --- a/src/stc/scintilla/src/CallTip.cxx +++ b/src/stc/scintilla/src/CallTip.cxx @@ -12,6 +12,11 @@ #include "Scintilla.h" #include "CallTip.h" +#include + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif static const int insetX = 5; // text inset in x from calltip border static const int widthArrow = 14; @@ -29,8 +34,14 @@ CallTip::CallTip() { tabSize = 0; useStyleCallTip = false; // for backwards compatibility +#ifdef __APPLE__ + // proper apple colours for the default + colourBG.desired = ColourDesired(0xff, 0xff, 0xc6); + colourUnSel.desired = ColourDesired(0, 0, 0); +#else colourBG.desired = ColourDesired(0xff, 0xff, 0xff); colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80); +#endif colourSel.desired = ColourDesired(0, 0, 0x80); colourShade.desired = ColourDesired(0, 0, 0); colourLight.desired = ColourDesired(0xc0, 0xc0, 0xc0); @@ -170,6 +181,7 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { char *chunkVal = val; bool moreChunks = true; int maxWidth = 0; + while (moreChunks) { char *chunkEnd = strchr(chunkVal, '\n'); if (chunkEnd == NULL) { @@ -217,6 +229,8 @@ void CallTip::PaintCT(Surface *surfaceWindow) { offsetMain = insetX; // initial alignment assuming no arrows PaintContents(surfaceWindow, true); +#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->PenColour(colourShade.allocated); @@ -225,6 +239,7 @@ void CallTip::PaintCT(Surface *surfaceWindow) { surfaceWindow->PenColour(colourLight.allocated); surfaceWindow->LineTo(0, 0); surfaceWindow->LineTo(0, rcClientSize.bottom - 1); +#endif } void CallTip::MouseClick(Point pt) { diff --git a/src/stc/scintilla/src/CallTip.h b/src/stc/scintilla/src/CallTip.h index 9848a10af9..bdf1123c74 100644 --- a/src/stc/scintilla/src/CallTip.h +++ b/src/stc/scintilla/src/CallTip.h @@ -8,6 +8,10 @@ #ifndef CALLTIP_H #define CALLTIP_H +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + /** */ class CallTip { @@ -76,4 +80,8 @@ public: void SetForeBack(const ColourPair &fore, const ColourPair &back); }; +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/src/CellBuffer.cxx b/src/stc/scintilla/src/CellBuffer.cxx index 1109a17fbe..6d04e04c91 100644 --- a/src/stc/scintilla/src/CellBuffer.cxx +++ b/src/stc/scintilla/src/CellBuffer.cxx @@ -13,9 +13,14 @@ #include "Platform.h" #include "Scintilla.h" -#include "SVector.h" +#include "SplitVector.h" +#include "Partitioning.h" #include "CellBuffer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + MarkerHandleSet::MarkerHandleSet() { root = 0; } @@ -30,7 +35,7 @@ MarkerHandleSet::~MarkerHandleSet() { root = 0; } -int MarkerHandleSet::Length() { +int MarkerHandleSet::Length() const { int c = 0; MarkerHandleNumber *mhn = root; while (mhn) { @@ -40,7 +45,7 @@ int MarkerHandleSet::Length() { return c; } -int MarkerHandleSet::NumberFromHandle(int handle) { +int MarkerHandleSet::NumberFromHandle(int handle) const { MarkerHandleNumber *mhn = root; while (mhn) { if (mhn->handle == handle) { @@ -51,7 +56,7 @@ int MarkerHandleSet::NumberFromHandle(int handle) { return - 1; } -int MarkerHandleSet::MarkValue() { +int MarkerHandleSet::MarkValue() const { unsigned int m = 0; MarkerHandleNumber *mhn = root; while (mhn) { @@ -61,7 +66,7 @@ int MarkerHandleSet::MarkValue() { return m; } -bool MarkerHandleSet::Contains(int handle) { +bool MarkerHandleSet::Contains(int handle) const { MarkerHandleNumber *mhn = root; while (mhn) { if (mhn->handle == handle) { @@ -90,7 +95,7 @@ void MarkerHandleSet::RemoveHandle(int handle) { if (mhn->handle == handle) { *pmhn = mhn->next; delete mhn; - return ; + return; } pmhn = &((*pmhn)->next); } @@ -121,210 +126,154 @@ void MarkerHandleSet::CombineWith(MarkerHandleSet *other) { other->root = 0; } -LineVector::LineVector() { - linesData = 0; - lines = 0; - size = 0; - levels = 0; - sizeLevels = 0; +LineVector::LineVector() : starts(256) { handleCurrent = 1; - growSize = 1000; Init(); } LineVector::~LineVector() { - for (int line = 0; line < lines; line++) { - delete linesData[line].handleSet; - linesData[line].handleSet = 0; + starts.DeleteAll(); + for (int line = 0; line < markers.Length(); line++) { + delete markers[line]; + markers[line] = 0; } - delete []linesData; - linesData = 0; - delete []levels; - levels = 0; + markers.DeleteAll(); + levels.DeleteAll(); } void LineVector::Init() { - for (int line = 0; line < lines; line++) { - delete linesData[line].handleSet; - linesData[line].handleSet = 0; - } - delete []linesData; - linesData = new LineData[static_cast(growSize)]; - size = growSize; - lines = 1; - delete []levels; - levels = 0; - sizeLevels = 0; -} - -void LineVector::Expand(int sizeNew) { - LineData *linesDataNew = new LineData[sizeNew]; - if (linesDataNew) { - for (int i = 0; i < size; i++) - linesDataNew[i] = linesData[i]; - // Do not delete handleSets here as they are transferred to new linesData - delete []linesData; - linesData = linesDataNew; - size = sizeNew; - } else { - Platform::DebugPrintf("No memory available\n"); - // TODO: Blow up + starts.DeleteAll(); + for (int line = 0; line < markers.Length(); line++) { + delete markers[line]; + markers[line] = 0; } - + markers.DeleteAll(); + levels.DeleteAll(); } void LineVector::ExpandLevels(int sizeNew) { - if (sizeNew == -1) - sizeNew = size; - int *levelsNew = new int[sizeNew]; - if (levelsNew) { - int i = 0; - for (; i < sizeLevels; i++) - levelsNew[i] = levels[i]; - for (; i < sizeNew; i++) - levelsNew[i] = SC_FOLDLEVELBASE; - delete []levels; - levels = levelsNew; - sizeLevels = sizeNew; - } else { - Platform::DebugPrintf("No memory available\n"); - // TODO: Blow up - } - + levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE); } void LineVector::ClearLevels() { - delete []levels; - levels = 0; - sizeLevels = 0; -} - -void LineVector::InsertValue(int pos, int value) { - //Platform::DebugPrintf("InsertValue[%d] = %d\n", pos, value); - if ((lines + 2) >= size) { - if (growSize * 6 < size) - growSize *= 2; - Expand(size + growSize); - if (levels) { - ExpandLevels(size + growSize); - } - } - lines++; - for (int i = lines; i > pos; i--) { - linesData[i] = linesData[i - 1]; - } - linesData[pos].startPosition = value; - linesData[pos].handleSet = 0; - if (levels) { - for (int j = lines; j > pos; j--) { - levels[j] = levels[j - 1]; + levels.DeleteAll(); +} + +int LineVector::SetLevel(int line, int level) { + int prev = 0; + if ((line >= 0) && (line < Lines())) { + if (!levels.Length()) { + ExpandLevels(Lines() + 1); } - if (pos == 0) { - levels[pos] = SC_FOLDLEVELBASE; - } else if (pos == (lines - 1)) { // Last line will not be a folder - levels[pos] = SC_FOLDLEVELBASE; - } else { - levels[pos] = levels[pos - 1]; + prev = levels[line]; + if (prev != level) { + levels[line] = level; } } + return prev; +} + +int LineVector::GetLevel(int line) { + if (levels.Length() && (line >= 0) && (line < Lines())) { + return levels[line]; + } else { + return SC_FOLDLEVELBASE; + } +} + +void LineVector::InsertText(int line, int delta) { + starts.InsertText(line, delta); } -void LineVector::SetValue(int pos, int value) { - //Platform::DebugPrintf("SetValue[%d] = %d\n", pos, value); - if ((pos + 2) >= size) { - //Platform::DebugPrintf("Resize %d %d\n", size,pos); - Expand(pos + growSize); - //Platform::DebugPrintf("end Resize %d %d\n", size,pos); - lines = pos; - if (levels) { - ExpandLevels(pos + growSize); +void LineVector::InsertLine(int line, int position) { + starts.InsertPartition(line, position); + if (markers.Length()) { + markers.Insert(line, 0); + } + if (levels.Length()) { + int level = SC_FOLDLEVELBASE; + if ((line > 0) && (line < Lines())) { + level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG; } + levels.InsertValue(line, 1, level); } - linesData[pos].startPosition = value; } -void LineVector::Remove(int pos) { - //Platform::DebugPrintf("Remove %d\n", pos); +void LineVector::SetLineStart(int line, int position) { + starts.SetPartitionStartPosition(line, position); +} + +void LineVector::RemoveLine(int line) { + starts.RemovePartition(line); // Retain the markers from the deleted line by oring them into the previous line - if (pos > 0) { - MergeMarkers(pos - 1); - } - for (int i = pos; i < lines; i++) { - linesData[i] = linesData[i + 1]; + if (markers.Length()) { + if (line > 0) { + MergeMarkers(line - 1); + } + markers.Delete(line); } - if (levels) { + if (levels.Length()) { // Move up following lines but merge header flag from this line // to line before to avoid a temporary disappearence causing expansion. - int firstHeader = levels[pos] & SC_FOLDLEVELHEADERFLAG; - for (int j = pos; j < lines; j++) { - levels[j] = levels[j + 1]; - } - if (pos > 0) - levels[pos-1] |= firstHeader; + int firstHeader = levels[line] & SC_FOLDLEVELHEADERFLAG; + levels.Delete(line); + if (line > 0) + levels[line-1] |= firstHeader; } - lines--; } int LineVector::LineFromPosition(int pos) { - //Platform::DebugPrintf("LineFromPostion %d lines=%d end = %d\n", pos, lines, linesData[lines].startPosition); - if (lines == 0) + return starts.PartitionFromPosition(pos); +} + +int LineVector::MarkValue(int line) { + if (markers.Length() && markers[line]) + return markers[line]->MarkValue(); + else return 0; - //Platform::DebugPrintf("LineFromPosition %d\n", pos); - if (pos >= linesData[lines].startPosition) - return lines - 1; - int lower = 0; - int upper = lines; - do { - int middle = (upper + lower + 1) / 2; // Round high - if (pos < linesData[middle].startPosition) { - upper = middle - 1; - } else { - lower = middle; - } - } while (lower < upper); - //Platform::DebugPrintf("LineFromPostion %d %d %d\n", pos, lower, linesData[lower].startPosition, linesData[lower > 1 ? lower - 1 : 0].startPosition); - return lower; } int LineVector::AddMark(int line, int markerNum) { handleCurrent++; - if (!linesData[line].handleSet) { + if (!markers.Length()) { + // No existing markers so allocate one element per line + markers.InsertValue(0, Lines(), 0); + } + if (!markers[line]) { // Need new structure to hold marker handle - linesData[line].handleSet = new MarkerHandleSet; - if (!linesData[line].handleSet) + markers[line] = new MarkerHandleSet(); + if (!markers[line]) return - 1; } - linesData[line].handleSet->InsertHandle(handleCurrent, markerNum); + markers[line]->InsertHandle(handleCurrent, markerNum); return handleCurrent; } void LineVector::MergeMarkers(int pos) { - if (linesData[pos + 1].handleSet != NULL) { - if (linesData[pos].handleSet == NULL ) - linesData[pos].handleSet = new MarkerHandleSet; - linesData[pos].handleSet->CombineWith(linesData[pos + 1].handleSet); - delete linesData[pos + 1].handleSet; - linesData[pos + 1].handleSet = NULL; + if (markers[pos + 1] != NULL) { + if (markers[pos] == NULL) + markers[pos] = new MarkerHandleSet; + markers[pos]->CombineWith(markers[pos + 1]); + delete markers[pos + 1]; + markers[pos + 1] = NULL; } } void LineVector::DeleteMark(int line, int markerNum, bool all) { - if (linesData[line].handleSet) { + if (markers.Length() && markers[line]) { if (markerNum == -1) { - delete linesData[line].handleSet; - linesData[line].handleSet = 0; + delete markers[line]; + markers[line] = NULL; } else { - bool performedDeletion = - linesData[line].handleSet->RemoveNumber(markerNum); + bool performedDeletion = markers[line]->RemoveNumber(markerNum); while (all && performedDeletion) { - performedDeletion = - linesData[line].handleSet->RemoveNumber(markerNum); + performedDeletion = markers[line]->RemoveNumber(markerNum); } - if (linesData[line].handleSet->Length() == 0) { - delete linesData[line].handleSet; - linesData[line].handleSet = 0; + if (markers[line]->Length() == 0) { + delete markers[line]; + markers[line] = NULL; } } } @@ -333,23 +282,25 @@ void LineVector::DeleteMark(int line, int markerNum, bool all) { void LineVector::DeleteMarkFromHandle(int markerHandle) { int line = LineFromHandle(markerHandle); if (line >= 0) { - linesData[line].handleSet->RemoveHandle(markerHandle); - if (linesData[line].handleSet->Length() == 0) { - delete linesData[line].handleSet; - linesData[line].handleSet = 0; + markers[line]->RemoveHandle(markerHandle); + if (markers[line]->Length() == 0) { + delete markers[line]; + markers[line] = NULL; } } } int LineVector::LineFromHandle(int markerHandle) { - for (int line = 0; line < lines; line++) { - if (linesData[line].handleSet) { - if (linesData[line].handleSet->Contains(markerHandle)) { - return line; + if (markers.Length()) { + for (int line = 0; line < Lines(); line++) { + if (markers[line]) { + if (markers[line]->Contains(markerHandle)) { + return line; + } } } } - return - 1; + return -1; } Action::Action() { @@ -437,7 +388,7 @@ void UndoHistory::EnsureUndoRoom() { int lenActionsNew = lenActions * 2; Action *actionsNew = new Action[lenActionsNew]; if (!actionsNew) - return ; + return; for (int act = 0; act <= currentAction; act++) actionsNew[act].Grab(&actions[act]); delete []actions; @@ -446,7 +397,8 @@ void UndoHistory::EnsureUndoRoom() { } } -void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) { +void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData, + bool &startSequence) { EnsureUndoRoom(); //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); //Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at, @@ -454,6 +406,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng if (currentAction < savePoint) { savePoint = -1; } + int oldCurrentAction = currentAction; if (currentAction >= 1) { if (0 == undoSequenceDepth) { // Top level actions may not always be coalesced @@ -486,7 +439,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng currentAction++; } } else { - //Platform::DebugPrintf("action coalesced\n"); + // Action coalesced. } } else { @@ -497,6 +450,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng } else { currentAction++; } + startSequence = oldCurrentAction != currentAction; actions[currentAction].Create(at, position, data, lengthData); currentAction++; actions[currentAction].Create(startAction); @@ -517,6 +471,7 @@ void UndoHistory::BeginUndoAction() { } void UndoHistory::EndUndoAction() { + PLATFORM_ASSERT(undoSequenceDepth > 0); EnsureUndoRoom(); undoSequenceDepth--; if (0 == undoSequenceDepth) { @@ -600,132 +555,51 @@ void UndoHistory::CompletedRedoStep() { currentAction++; } -CellBuffer::CellBuffer(int initialLength) { - body = new char[initialLength]; - size = initialLength; - length = 0; - part1len = 0; - gaplen = initialLength; - part2body = body + gaplen; +CellBuffer::CellBuffer() { readOnly = false; collectingUndo = true; - growSize = 4000; } CellBuffer::~CellBuffer() { - delete []body; - body = 0; -} - -void CellBuffer::GapTo(int position) { - if (position == part1len) - return ; - if (position < part1len) { - int diff = part1len - position; - //Platform::DebugPrintf("Move gap backwards to %d diff = %d part1len=%d length=%d \n", position,diff, part1len, length); - for (int i = 0; i < diff; i++) - body[part1len + gaplen - i - 1] = body[part1len - i - 1]; - } else { // position > part1len - int diff = position - part1len; - //Platform::DebugPrintf("Move gap forwards to %d diff =%d\n", position,diff); - for (int i = 0; i < diff; i++) - body[part1len + i] = body[part1len + gaplen + i]; - } - part1len = position; - part2body = body + gaplen; -} - -void CellBuffer::RoomFor(int insertionLength) { - //Platform::DebugPrintf("need room %d %d\n", gaplen, insertionLength); - if (gaplen <= insertionLength) { - //Platform::DebugPrintf("need room %d %d\n", gaplen, insertionLength); - if (growSize * 6 < size) - growSize *= 2; - int newSize = size + insertionLength + growSize; - Allocate(newSize); - } } -// To make it easier to write code that uses ByteAt, a position outside the range of the buffer -// can be retrieved. All characters outside the range have the value '\0'. -char CellBuffer::ByteAt(int position) { - if (position < part1len) { - if (position < 0) { - return '\0'; - } else { - return body[position]; - } - } else { - if (position >= length) { - return '\0'; - } else { - return part2body[position]; - } - } -} - -void CellBuffer::SetByteAt(int position, char ch) { - - if (position < 0) { - //Platform::DebugPrintf("Bad position %d\n",position); - return ; - } - if (position >= length + 11) { - Platform::DebugPrintf("Very Bad position %d of %d\n", position, length); - //exit(2); - return ; - } - if (position >= length) { - //Platform::DebugPrintf("Bad position %d of %d\n",position,length); - return ; - } - - if (position < part1len) { - body[position] = ch; - } else { - part2body[position] = ch; - } -} - -char CellBuffer::CharAt(int position) { - return ByteAt(position*2); +char CellBuffer::CharAt(int position) const { + return substance.ValueAt(position); } void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) { if (lengthRetrieve < 0) - return ; + return; if (position < 0) - return ; - int bytePos = position * 2; - if ((bytePos + lengthRetrieve * 2) > length) { - Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n", bytePos, - lengthRetrieve, length); - return ; + return; + if ((position + lengthRetrieve) > substance.Length()) { + Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n", position, + lengthRetrieve, substance.Length()); + return; } - GapTo(0); // Move the buffer so its easy to subscript into it - char *pb = part2body + bytePos; - while (lengthRetrieve--) { - *buffer++ = *pb; - pb += 2; + + for (int i=0; i((curVal & ~mask) | style)); +bool CellBuffer::SetStyleAt(int position, char styleValue, char mask) { + styleValue &= mask; + char curVal = style.ValueAt(position); + if ((curVal & mask) != styleValue) { + style.SetValueAt(position, static_cast((curVal & ~mask) | styleValue)); return true; } else { return false; } } -bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mask) { - int bytePos = position * 2 + 1; +bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue, char mask) { bool changed = false; PLATFORM_ASSERT(lengthStyle == 0 || - (lengthStyle > 0 && lengthStyle + position < length)); + (lengthStyle > 0 && lengthStyle + position <= style.Length())); while (lengthStyle--) { - char curVal = ByteAt(bytePos); - if ((curVal & mask) != style) { - SetByteAt(bytePos, static_cast((curVal & ~mask) | style)); + char curVal = style.ValueAt(position); + if ((curVal & mask) != styleValue) { + style.SetValueAt(position, static_cast((curVal & ~mask) | styleValue)); changed = true; } - bytePos += 2; + position++; } return changed; } -const char *CellBuffer::DeleteChars(int position, int deleteLength) { +// The char* returned is to an allocation owned by the undo history +const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startSequence) { // InsertString and DeleteChars are the bottleneck though which all changes occur PLATFORM_ASSERT(deleteLength > 0); char *data = 0; if (!readOnly) { if (collectingUndo) { // Save into the undo/redo stack, but only the characters - not the formatting - data = new char[deleteLength / 2]; - for (int i = 0; i < deleteLength / 2; i++) { - data[i] = ByteAt(position + i * 2); + data = new char[deleteLength]; + for (int i = 0; i < deleteLength; i++) { + data[i] = substance.ValueAt(position + i); } - uh.AppendAction(removeAction, position / 2, data, deleteLength / 2); + uh.AppendAction(removeAction, position, data, deleteLength, startSequence); } BasicDeleteChars(position, deleteLength); @@ -779,39 +653,26 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength) { return data; } -int CellBuffer::ByteLength() { - return length; -} - -int CellBuffer::Length() { - return ByteLength() / 2; +int CellBuffer::Length() const { + return substance.Length(); } void CellBuffer::Allocate(int newSize) { - if (newSize > length) { - GapTo(length); - char *newBody = new char[newSize]; - memcpy(newBody, body, length); - delete []body; - body = newBody; - gaplen += newSize - size; - part2body = body + gaplen; - size = newSize; - } + substance.ReAllocate(newSize); + style.ReAllocate(newSize); } -int CellBuffer::Lines() { - //Platform::DebugPrintf("Lines = %d\n", lv.lines); - return lv.lines; +int CellBuffer::Lines() const { + return lv.Lines(); } -int CellBuffer::LineStart(int line) { +int CellBuffer::LineStart(int line) const { if (line < 0) return 0; - else if (line > lv.lines) + else if (line >= Lines()) return Length(); else - return lv.linesData[line].startPosition; + return lv.LineStart(line); } bool CellBuffer::IsReadOnly() { @@ -831,14 +692,14 @@ bool CellBuffer::IsSavePoint() { } int CellBuffer::AddMark(int line, int markerNum) { - if ((line >= 0) && (line < lv.lines)) { + if ((line >= 0) && (line < Lines())) { return lv.AddMark(line, markerNum); } return - 1; } void CellBuffer::DeleteMark(int line, int markerNum) { - if ((line >= 0) && (line < lv.lines)) { + if ((line >= 0) && (line < Lines())) { lv.DeleteMark(line, markerNum, false); } } @@ -848,13 +709,13 @@ void CellBuffer::DeleteMarkFromHandle(int markerHandle) { } int CellBuffer::GetMark(int line) { - if ((line >= 0) && (line < lv.lines) && (lv.linesData[line].handleSet)) - return lv.linesData[line].handleSet->MarkValue(); + if ((line >= 0) && (line < Lines())) + return lv.MarkValue(line); return 0; } void CellBuffer::DeleteAllMarks(int markerNum) { - for (int line = 0; line < lv.lines; line++) { + for (int line = 0; line < Lines(); line++) { lv.DeleteMark(line, markerNum, true); } } @@ -865,119 +726,101 @@ int CellBuffer::LineFromHandle(int markerHandle) { // Without undo -void CellBuffer::BasicInsertString(int position, char *s, int insertLength) { - //Platform::DebugPrintf("Inserting at %d for %d\n", position, insertLength); +void CellBuffer::InsertLine(int line, int position) { + lv.InsertLine(line, position); + if (lineStates.Length()) { + lineStates.Insert(line, 0); + } +} + +void CellBuffer::RemoveLine(int line) { + lv.RemoveLine(line); + if (lineStates.Length()) { + lineStates.Delete(line); + } +} + +void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) { if (insertLength == 0) - return ; + return; PLATFORM_ASSERT(insertLength > 0); - RoomFor(insertLength); - GapTo(position); - memcpy(body + part1len, s, insertLength); - length += insertLength; - part1len += insertLength; - gaplen -= insertLength; - part2body = body + gaplen; + substance.InsertFromArray(position, s, 0, insertLength); + style.InsertValue(position, insertLength, 0); - int lineInsert = lv.LineFromPosition(position / 2) + 1; + int lineInsert = lv.LineFromPosition(position) + 1; // Point all the lines after the insertion point further along in the buffer - for (int lineAfter = lineInsert; lineAfter <= lv.lines; lineAfter++) { - lv.linesData[lineAfter].startPosition += insertLength / 2; - } - char chPrev = ' '; - if ((position - 2) >= 0) - chPrev = ByteAt(position - 2); - char chAfter = ' '; - if ((position + insertLength) < length) - chAfter = ByteAt(position + insertLength); + lv.InsertText(lineInsert-1, insertLength); + char chPrev = substance.ValueAt(position - 1); + char chAfter = substance.ValueAt(position + insertLength); if (chPrev == '\r' && chAfter == '\n') { - //Platform::DebugPrintf("Splitting a crlf pair at %d\n", lineInsert); // Splitting up a crlf pair at position - lv.InsertValue(lineInsert, position / 2); + InsertLine(lineInsert, position); lineInsert++; } char ch = ' '; - for (int i = 0; i < insertLength; i += 2) { + for (int i = 0; i < insertLength; i++) { ch = s[i]; if (ch == '\r') { - //Platform::DebugPrintf("Inserting cr at %d\n", lineInsert); - lv.InsertValue(lineInsert, (position + i) / 2 + 1); + InsertLine(lineInsert, (position + i) + 1); lineInsert++; } else if (ch == '\n') { if (chPrev == '\r') { - //Platform::DebugPrintf("Patching cr before lf at %d\n", lineInsert-1); // Patch up what was end of line - lv.SetValue(lineInsert - 1, (position + i) / 2 + 1); + lv.SetLineStart(lineInsert - 1, (position + i) + 1); } else { - //Platform::DebugPrintf("Inserting lf at %d\n", lineInsert); - lv.InsertValue(lineInsert, (position + i) / 2 + 1); + InsertLine(lineInsert, (position + i) + 1); lineInsert++; } } chPrev = ch; } - // Joining two lines where last insertion is cr and following text starts with lf + // Joining two lines where last insertion is cr and following substance starts with lf if (chAfter == '\n') { if (ch == '\r') { - //Platform::DebugPrintf("Joining cr before lf at %d\n", lineInsert-1); // End of line already in buffer so drop the newly created one - lv.Remove(lineInsert - 1); + RemoveLine(lineInsert - 1); } } } void CellBuffer::BasicDeleteChars(int position, int deleteLength) { - //Platform::DebugPrintf("Deleting at %d for %d\n", position, deleteLength); if (deleteLength == 0) - return ; + return; - if ((position == 0) && (deleteLength == length)) { + if ((position == 0) && (deleteLength == substance.Length())) { // If whole buffer is being deleted, faster to reinitialise lines data // than to delete each line. - //printf("Whole buffer being deleted\n"); lv.Init(); } else { // Have to fix up line positions before doing deletion as looking at text in buffer // to work out which lines have been removed - int lineRemove = lv.LineFromPosition(position / 2) + 1; - // Point all the lines after the insertion point further along in the buffer - for (int lineAfter = lineRemove; lineAfter <= lv.lines; lineAfter++) { - lv.linesData[lineAfter].startPosition -= deleteLength / 2; - } - char chPrev = ' '; - if (position >= 2) - chPrev = ByteAt(position - 2); + int lineRemove = lv.LineFromPosition(position) + 1; + lv.InsertText(lineRemove-1, - (deleteLength)); + char chPrev = substance.ValueAt(position - 1); char chBefore = chPrev; - char chNext = ' '; - if (position < length) - chNext = ByteAt(position); + char chNext = substance.ValueAt(position); bool ignoreNL = false; if (chPrev == '\r' && chNext == '\n') { - //Platform::DebugPrintf("Deleting lf after cr, move line end to cr at %d\n", lineRemove); // Move back one - lv.SetValue(lineRemove, position / 2); + lv.SetLineStart(lineRemove, position); lineRemove++; ignoreNL = true; // First \n is not real deletion } char ch = chNext; - for (int i = 0; i < deleteLength; i += 2) { - chNext = ' '; - if ((position + i + 2) < length) - chNext = ByteAt(position + i + 2); - //Platform::DebugPrintf("Deleting %d %x\n", i, ch); + for (int i = 0; i < deleteLength; i++) { + chNext = substance.ValueAt(position + i + 1); if (ch == '\r') { if (chNext != '\n') { - //Platform::DebugPrintf("Removing cr end of line\n"); - lv.Remove(lineRemove); + RemoveLine(lineRemove); } } else if (ch == '\n') { if (ignoreNL) { ignoreNL = false; // Further \n are real deletions } else { - //Platform::DebugPrintf("Removing lf end of line\n"); - lv.Remove(lineRemove); + RemoveLine(lineRemove); } } @@ -985,20 +828,15 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) { } // May have to fix up end if last deletion causes cr to be next to lf // or removes one of a crlf pair - char chAfter = ' '; - if ((position + deleteLength) < length) - chAfter = ByteAt(position + deleteLength); + char chAfter = substance.ValueAt(position + deleteLength); if (chBefore == '\r' && chAfter == '\n') { - //d.printf("Joining cr before lf at %d\n", lineRemove); // Using lineRemove-1 as cr ended line before start of deletion - lv.Remove(lineRemove - 1); - lv.SetValue(lineRemove - 1, position / 2 + 1); + RemoveLine(lineRemove - 1); + lv.SetLineStart(lineRemove - 1, position + 1); } } - GapTo(position); - length -= deleteLength; - gaplen += deleteLength; - part2body = body + gaplen; + substance.DeleteRange(position, deleteLength); + style.DeleteRange(position, deleteLength); } bool CellBuffer::SetUndoCollection(bool collectUndo) { @@ -1038,15 +876,9 @@ const Action &CellBuffer::GetUndoStep() const { void CellBuffer::PerformUndoStep() { const Action &actionStep = uh.GetUndoStep(); if (actionStep.at == insertAction) { - BasicDeleteChars(actionStep.position*2, actionStep.lenData*2); + BasicDeleteChars(actionStep.position, actionStep.lenData); } else if (actionStep.at == removeAction) { - char *styledData = new char[actionStep.lenData * 2]; - for (int i = 0; i < actionStep.lenData; i++) { - styledData[i*2] = actionStep.data[i]; - styledData[i*2 + 1] = 0; - } - BasicInsertString(actionStep.position*2, styledData, actionStep.lenData*2); - delete []styledData; + BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); } uh.CompletedUndoStep(); } @@ -1066,26 +898,22 @@ const Action &CellBuffer::GetRedoStep() const { void CellBuffer::PerformRedoStep() { const Action &actionStep = uh.GetRedoStep(); if (actionStep.at == insertAction) { - char *styledData = new char[actionStep.lenData * 2]; - for (int i = 0; i < actionStep.lenData; i++) { - styledData[i*2] = actionStep.data[i]; - styledData[i*2 + 1] = 0; - } - BasicInsertString(actionStep.position*2, styledData, actionStep.lenData*2); - delete []styledData; + BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); } else if (actionStep.at == removeAction) { - BasicDeleteChars(actionStep.position*2, actionStep.lenData*2); + BasicDeleteChars(actionStep.position, actionStep.lenData); } uh.CompletedRedoStep(); } int CellBuffer::SetLineState(int line, int state) { + lineStates.EnsureLength(line + 1); int stateOld = lineStates[line]; lineStates[line] = state; return stateOld; } int CellBuffer::GetLineState(int line) { + lineStates.EnsureLength(line + 1); return lineStates[line]; } @@ -1094,25 +922,11 @@ int CellBuffer::GetMaxLineState() { } int CellBuffer::SetLevel(int line, int level) { - int prev = 0; - if ((line >= 0) && (line < lv.lines)) { - if (!lv.levels) { - lv.ExpandLevels(); - } - prev = lv.levels[line]; - if (lv.levels[line] != level) { - lv.levels[line] = level; - } - } - return prev; + return lv.SetLevel(line, level); } int CellBuffer::GetLevel(int line) { - if (lv.levels && (line >= 0) && (line < lv.lines)) { - return lv.levels[line]; - } else { - return SC_FOLDLEVELBASE; - } + return lv.GetLevel(line); } void CellBuffer::ClearLevels() { diff --git a/src/stc/scintilla/src/CellBuffer.h b/src/stc/scintilla/src/CellBuffer.h index bb81fd5722..4f654a8fd9 100644 --- a/src/stc/scintilla/src/CellBuffer.h +++ b/src/stc/scintilla/src/CellBuffer.h @@ -8,6 +8,10 @@ #ifndef CELLBUFFER_H #define CELLBUFFER_H +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + /** * This holds the marker identifier and the marker type to display. * MarkerHandleNumbers are members of lists. @@ -27,54 +31,51 @@ class MarkerHandleSet { public: MarkerHandleSet(); ~MarkerHandleSet(); - int Length(); - int NumberFromHandle(int handle); - int MarkValue(); ///< Bit set of marker numbers. - bool Contains(int handle); + int Length() const; + int NumberFromHandle(int handle) const; + int MarkValue() const; ///< Bit set of marker numbers. + bool Contains(int handle) const; bool InsertHandle(int handle, int markerNum); void RemoveHandle(int handle); bool RemoveNumber(int markerNum); void CombineWith(MarkerHandleSet *other); }; -/** - * Each line stores the starting position of the first character of the line in the cell buffer - * and potentially a marker handle set. Often a line will not have any attached markers. - */ -struct LineData { - int startPosition; - MarkerHandleSet *handleSet; - LineData() : startPosition(0), handleSet(0) { - } -}; - /** * The line vector contains information about each of the lines in a cell buffer. */ class LineVector { -public: - int growSize; - int lines; - LineData *linesData; - int size; - int *levels; - int sizeLevels; + Partitioning starts; + SplitVector markers; + SplitVector levels; /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big. int handleCurrent; +public: + LineVector(); ~LineVector(); void Init(); - void Expand(int sizeNew); void ExpandLevels(int sizeNew=-1); void ClearLevels(); - void InsertValue(int pos, int value); - void SetValue(int pos, int value); - void Remove(int pos); + int SetLevel(int line, int level); + int GetLevel(int line); + + void InsertText(int line, int delta); + void InsertLine(int line, int position); + void SetLineStart(int line, int position); + void RemoveLine(int line); + int Lines() const { + return starts.Partitions(); + } int LineFromPosition(int pos); + int LineStart(int line) const { + return starts.PositionFromPartition(line); + } + int MarkValue(int line); int AddMark(int line, int marker); void MergeMarkers(int pos); void DeleteMark(int line, int markerNum, bool all); @@ -119,7 +120,7 @@ public: UndoHistory(); ~UndoHistory(); - void AppendAction(actionType at, int position, char *data, int length); + void AppendAction(actionType at, int position, char *data, int length, bool &startSequence); void BeginUndoAction(); void EndUndoAction(); @@ -150,54 +151,42 @@ public: */ class CellBuffer { private: - char *body; ///< The cell buffer itself. - int size; ///< Allocated size of the buffer. - int length; ///< Total length of the data. - int part1len; ///< Length of the first part. - int gaplen; ///< Length of the gap between the two parts. - char *part2body; ///< The second part of the cell buffer. - ///< Doesn't point after the gap but set so that - ///< part2body[position] is consistent with body[position]. + SplitVector substance; + SplitVector style; bool readOnly; - int growSize; bool collectingUndo; UndoHistory uh; LineVector lv; - SVector lineStates; - - void GapTo(int position); - void RoomFor(int insertionLength); - - inline char ByteAt(int position); - void SetByteAt(int position, char ch); + SplitVector lineStates; public: - CellBuffer(int initialLength = 4000); + CellBuffer(); ~CellBuffer(); /// Retrieving positions outside the range of the buffer works and returns 0 - char CharAt(int position); + char CharAt(int position) const; void GetCharRange(char *buffer, int position, int lengthRetrieve); char StyleAt(int position); - int ByteLength(); - int Length(); + int Length() const; void Allocate(int newSize); - int Lines(); - int LineStart(int line); + int Lines() const; + int LineStart(int line) const; int LineFromPosition(int pos) { return lv.LineFromPosition(pos); } - const char *InsertString(int position, char *s, int insertLength); + void InsertLine(int line, int position); + void RemoveLine(int line); + const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); /// 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 style, char mask='\377'); - bool SetStyleFor(int position, int length, char style, char mask); + bool SetStyleAt(int position, char styleValue, char mask='\377'); + bool SetStyleFor(int position, int length, char styleValue, char mask); - const char *DeleteChars(int position, int deleteLength); + const char *DeleteChars(int position, int deleteLength, bool &startSequence); bool IsReadOnly(); void SetReadOnly(bool set); @@ -216,7 +205,7 @@ public: int LineFromHandle(int markerHandle); /// Actions without undo - void BasicInsertString(int position, char *s, int insertLength); + void BasicInsertString(int position, const char *s, int insertLength); void BasicDeleteChars(int position, int deleteLength); bool SetUndoCollection(bool collectUndo); @@ -245,6 +234,8 @@ public: void ClearLevels(); }; -#define CELL_SIZE 2 +#ifdef SCI_NAMESPACE +} +#endif #endif diff --git a/src/stc/scintilla/src/CharacterSet.h b/src/stc/scintilla/src/CharacterSet.h new file mode 100644 index 0000000000..4e8ffbdf6f --- /dev/null +++ b/src/stc/scintilla/src/CharacterSet.h @@ -0,0 +1,58 @@ +// Scintilla source code edit control +/** @file CharacterSet.h + ** Encapsulates a set of characters. Used to test if a character is within a set. + **/ +// Copyright 2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +class CharacterSet { + int size; + bool valueAfter; + bool *bset; +public: + enum setBase { + setNone=0, + setLower=1, + setUpper=2, + setDigits=4, + setAlpha=setLower|setUpper, + setAlphaNum=setAlpha|setDigits + }; + CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) { + size = size_; + valueAfter = valueAfter_; + bset = new bool[size]; + for (int i=0; i < size; i++) { + bset[i] = false; + } + AddString(initialSet); + if (base & setLower) + AddString("abcdefghijklmnopqrstuvwxyz"); + if (base & setUpper) + AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + if (base & setDigits) + AddString("0123456789"); + } + ~CharacterSet() { + delete []bset; + bset = 0; + size = 0; + } + void Add(int val) { + PLATFORM_ASSERT(val >= 0); + PLATFORM_ASSERT(val < size); + bset[val] = true; + } + void AddString(const char *CharacterSet) { + for (const char *cp=CharacterSet; *cp; cp++) { + int val = static_cast(*cp); + PLATFORM_ASSERT(val >= 0); + PLATFORM_ASSERT(val < size); + bset[val] = true; + } + } + bool Contains(int val) const { + PLATFORM_ASSERT(val >= 0); + return (val < size) ? bset[val] : valueAfter; + } +}; diff --git a/src/stc/scintilla/src/ContractionState.cxx b/src/stc/scintilla/src/ContractionState.cxx index 3d021b080b..08de5cf1f7 100644 --- a/src/stc/scintilla/src/ContractionState.cxx +++ b/src/stc/scintilla/src/ContractionState.cxx @@ -1,289 +1,251 @@ // Scintilla source code edit control /** @file ContractionState.cxx - ** Manages visibility of lines for folding. + ** Manages visibility of lines for folding and wrapping. **/ -// Copyright 1998-2001 by Neil Hodgson +// Copyright 1998-2007 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +#include + #include "Platform.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" #include "ContractionState.h" -OneLine::OneLine() { - displayLine = 0; - //docLine = 0; - visible = true; - height = 1; - expanded = true; -} +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif -ContractionState::ContractionState() { - lines = 0; - size = 0; - linesInDoc = 1; - linesInDisplay = 1; - valid = false; - docLines = 0; - sizeDocLines = 0; +ContractionState::ContractionState() : visible(0), expanded(0), heights(0), displayLines(0), linesInDocument(1) { + //InsertLine(0); } ContractionState::~ContractionState() { Clear(); } -void ContractionState::MakeValid() const { - if (!valid) { - // Could be cleverer by keeping the index of the last still valid entry - // rather than invalidating all. - linesInDisplay = 0; - for (int lineInDoc=0; lineInDocPartitions() - 1; + } } int ContractionState::LinesDisplayed() const { - if (size != 0) { - MakeValid(); + if (OneToOne()) { + return linesInDocument; + } else { + return displayLines->PositionFromPartition(LinesInDoc()); } - return linesInDisplay; } int ContractionState::DisplayFromDoc(int lineDoc) const { - if (size == 0) { + if (OneToOne()) { return lineDoc; + } else { + if (lineDoc > displayLines->Partitions()) + lineDoc = displayLines->Partitions(); + return displayLines->PositionFromPartition(lineDoc); } - MakeValid(); - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - return lines[lineDoc].displayLine; - } - return -1; } int ContractionState::DocFromDisplay(int lineDisplay) const { - if (lineDisplay <= 0) - return 0; - if (lineDisplay >= linesInDisplay) - return linesInDoc; - if (size == 0) + if (OneToOne()) { return lineDisplay; - MakeValid(); - if (docLines) { // Valid allocation - return docLines[lineDisplay]; } else { - return 0; + if (lineDisplay <= 0) { + return 0; + } + if (lineDisplay > LinesDisplayed()) { + return displayLines->PartitionFromPosition(LinesDisplayed()); + } + int lineDoc = displayLines->PartitionFromPosition(lineDisplay); + PLATFORM_ASSERT(GetVisible(lineDoc)); + return lineDoc; } } -void ContractionState::Grow(int sizeNew) { - OneLine *linesNew = new OneLine[sizeNew]; - if (linesNew) { - int i = 0; - for (; i < size; i++) { - linesNew[i] = lines[i]; - } - for (; i < sizeNew; i++) { - linesNew[i].displayLine = i; - } - delete []lines; - lines = linesNew; - size = sizeNew; - valid = false; +void ContractionState::InsertLine(int lineDoc) { + if (OneToOne()) { + linesInDocument++; } else { - Platform::DebugPrintf("No memory available\n"); - // TODO: Blow up + visible->InsertSpace(lineDoc, 1); + visible->SetValueAt(lineDoc, 1); + expanded->InsertSpace(lineDoc, 1); + expanded->SetValueAt(lineDoc, 1); + heights->InsertSpace(lineDoc, 1); + heights->SetValueAt(lineDoc, 1); + int lineDisplay = DisplayFromDoc(lineDoc); + displayLines->InsertPartition(lineDoc, lineDisplay); + displayLines->InsertText(lineDoc, 1); } } void ContractionState::InsertLines(int lineDoc, int lineCount) { - if (size == 0) { - linesInDoc += lineCount; - linesInDisplay += lineCount; - return; - } - //Platform::DebugPrintf("InsertLine[%d] = %d\n", lineDoc); - if ((linesInDoc + lineCount + 2) >= size) { - Grow(linesInDoc + lineCount + growSize); + for (int l = 0; l < lineCount; l++) { + InsertLine(lineDoc + l); } - linesInDoc += lineCount; - for (int i = linesInDoc; i >= lineDoc + lineCount; i--) { - lines[i].visible = lines[i - lineCount].visible; - lines[i].height = lines[i - lineCount].height; - linesInDisplay += lines[i].height; - lines[i].expanded = lines[i - lineCount].expanded; - } - for (int d=0;dInsertText(lineDoc, -heights->ValueAt(lineDoc)); + } + displayLines->RemovePartition(lineDoc); + visible->DeleteRange(lineDoc, 1); + expanded->DeleteRange(lineDoc, 1); + heights->DeleteRange(lineDoc, 1); } - valid = false; } void ContractionState::DeleteLines(int lineDoc, int lineCount) { - if (size == 0) { - linesInDoc -= lineCount; - linesInDisplay -= lineCount; - return; - } - int deltaDisplayed = 0; - for (int d=0;d= 0) && (lineDoc < linesInDoc)) { - return lines[lineDoc].visible; } else { - return false; + if (lineDoc >= visible->Length()) + return true; + return visible->ValueAt(lineDoc) == 1; } } -bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible) { - if (lineDocStart == 0) - lineDocStart++; - if (lineDocStart > lineDocEnd) +bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible_) { + if (OneToOne() && visible_) { return false; - if (size == 0) { - Grow(linesInDoc + growSize); - } - // TODO: modify docLine members to mirror displayLine - int delta = 0; - // Change lineDocs - if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < linesInDoc)) { - for (int line=lineDocStart; line <= lineDocEnd; line++) { - if (lines[line].visible != visible) { - delta += visible ? lines[line].height : -lines[line].height; - lines[line].visible = visible; + } else { + EnsureData(); + int delta = 0; + 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); + displayLines->InsertText(line, difference); + delta += difference; + } } + } else { + return false; } + Check(); + return delta != 0; } - linesInDisplay += delta; - valid = false; - return delta != 0; } bool ContractionState::GetExpanded(int lineDoc) const { - if (size == 0) + if (OneToOne()) { return true; - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - return lines[lineDoc].expanded; } else { - return false; + Check(); + return expanded->ValueAt(lineDoc) == 1; } } -bool ContractionState::SetExpanded(int lineDoc, bool expanded) { - if (size == 0) { - if (expanded) { - // If in completely expanded state then setting - // one line to expanded has no effect. - return false; - } - Grow(linesInDoc + growSize); - } - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - if (lines[lineDoc].expanded != expanded) { - lines[lineDoc].expanded = expanded; +bool ContractionState::SetExpanded(int lineDoc, bool expanded_) { + if (OneToOne() && expanded_) { + return false; + } else { + EnsureData(); + if (expanded_ != (expanded->ValueAt(lineDoc) == 1)) { + expanded->SetValueAt(lineDoc, expanded_ ? 1 : 0); + Check(); return true; + } else { + Check(); + return false; } } - return false; } int ContractionState::GetHeight(int lineDoc) const { - if (size == 0) + if (OneToOne()) { return 1; - if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { - return lines[lineDoc].height; } else { - return 1; + return heights->ValueAt(lineDoc); } } // Set the number of display lines needed for this line. // Return true if this is a change. bool ContractionState::SetHeight(int lineDoc, int height) { - if (lineDoc > linesInDoc) + if (OneToOne() && (height == 1)) { return false; - if (size == 0) { - if (height == 1) { - // If in completely expanded state then all lines - // assumed to have height of one so no effect here. + } else { + EnsureData(); + if (GetHeight(lineDoc) != height) { + if (GetVisible(lineDoc)) { + displayLines->InsertText(lineDoc, height - GetHeight(lineDoc)); + } + heights->SetValueAt(lineDoc, height); + Check(); + return true; + } else { + Check(); return false; } - Grow(linesInDoc + growSize); - } - if (lines[lineDoc].height != height) { - lines[lineDoc].height = height; - valid = false; - return true; - } else { - return false; } } void ContractionState::ShowAll() { - delete []lines; - lines = 0; - size = 0; - - delete []docLines; - docLines = 0; - sizeDocLines = 0; - - linesInDisplay = linesInDoc; + int lines = LinesInDoc(); + Clear(); + linesInDocument = lines; +} + +// Debugging checks + +void ContractionState::Check() const { +#ifdef CHECK_CORRECTNESS + for (int vline = 0;vline < LinesDisplayed(); vline++) { + const int lineDoc = DocFromDisplay(vline); + PLATFORM_ASSERT(GetVisible(lineDoc)); + } + for (int lineDoc = 0;lineDoc < LinesInDoc(); lineDoc++) { + const int displayThis = DisplayFromDoc(lineDoc); + const int displayNext = DisplayFromDoc(lineDoc + 1); + const int height = displayNext - displayThis; + PLATFORM_ASSERT(height >= 0); + if (GetVisible(lineDoc)) { + PLATFORM_ASSERT(GetHeight(lineDoc) == height); + } else { + PLATFORM_ASSERT(0 == height); + } + } +#endif } diff --git a/src/stc/scintilla/src/ContractionState.h b/src/stc/scintilla/src/ContractionState.h index e15ee3bbe6..ba62975128 100644 --- a/src/stc/scintilla/src/ContractionState.h +++ b/src/stc/scintilla/src/ContractionState.h @@ -1,40 +1,34 @@ // Scintilla source code edit control /** @file ContractionState.h - ** Manages visibility of lines for folding. + ** Manages visibility of lines for folding and wrapping. **/ -// Copyright 1998-2001 by Neil Hodgson +// Copyright 1998-2007 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef CONTRACTIONSTATE_H #define CONTRACTIONSTATE_H -/** - */ -class OneLine { -public: - int displayLine; ///< Position within set of visible lines - //int docLine; ///< Inverse of @a displayLine - int height; ///< Number of display lines needed to show all of the line - bool visible; - bool expanded; - - OneLine(); - virtual ~OneLine() {} -}; +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif /** */ class ContractionState { - void Grow(int sizeNew); - enum { growSize = 4000 }; - int linesInDoc; - mutable int linesInDisplay; - mutable OneLine *lines; - int size; - mutable int *docLines; - mutable int sizeDocLines; - mutable bool valid; - void MakeValid() const; + // These contain 1 element for every document line. + RunStyles *visible; + RunStyles *expanded; + RunStyles *heights; + Partitioning *displayLines; + int linesInDocument; + + void EnsureData(); + + bool OneToOne() const { + // True when each document line is exactly one display line so need for + // complex data structures. + return visible == 0; + } public: ContractionState(); @@ -47,7 +41,9 @@ public: int DisplayFromDoc(int lineDoc) const; int DocFromDisplay(int lineDisplay) const; + void InsertLine(int lineDoc); void InsertLines(int lineDoc, int lineCount); + void DeleteLine(int lineDoc); void DeleteLines(int lineDoc, int lineCount); bool GetVisible(int lineDoc) const; @@ -60,6 +56,11 @@ public: bool SetHeight(int lineDoc, int height); void ShowAll(); + void Check() const; }; +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/src/Decoration.cxx b/src/stc/scintilla/src/Decoration.cxx new file mode 100644 index 0000000000..e4ac0e07c6 --- /dev/null +++ b/src/stc/scintilla/src/Decoration.cxx @@ -0,0 +1,188 @@ +/** @file Decoration.cxx + ** Visual elements added over text. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "Decoration.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) { +} + +Decoration::~Decoration() { +} + +bool Decoration::Empty() { + return rs.starts->Partitions() == 1; +} + +DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0), + lengthDocument(0), root(0), clickNotified(false) { +} + +DecorationList::~DecorationList() { + Decoration *deco = root; + while (deco) { + Decoration *decoNext = deco->next; + delete deco; + deco = decoNext; + } + root = 0; + current = 0; +} + +Decoration *DecorationList::DecorationFromIndicator(int indicator) { + for (Decoration *deco=root; deco; deco = deco->next) { + if (deco->indicator == indicator) { + return deco; + } + } + return 0; +} + +Decoration *DecorationList::Create(int indicator, int length) { + currentIndicator = indicator; + Decoration *decoNew = new Decoration(indicator); + decoNew->rs.InsertSpace(0, length); + + Decoration *decoPrev = 0; + Decoration *deco = root; + + while (deco && (deco->indicator < indicator)) { + decoPrev = deco; + deco = deco->next; + } + if (decoPrev == 0) { + decoNew->next = root; + root = decoNew; + } else { + decoNew->next = deco; + decoPrev->next = decoNew; + } + return decoNew; +} + +void DecorationList::Delete(int indicator) { + Decoration *decoToDelete = 0; + if (root) { + if (root->indicator == indicator) { + decoToDelete = root; + root = root->next; + } else { + Decoration *deco=root; + while (deco->next && !decoToDelete) { + if (deco->next && deco->next->indicator == indicator) { + decoToDelete = deco->next; + deco->next = decoToDelete->next; + } else { + deco = deco->next; + } + } + } + } + if (decoToDelete) { + delete decoToDelete; + current = 0; + } +} + +void DecorationList::SetCurrentIndicator(int indicator) { + currentIndicator = indicator; + current = DecorationFromIndicator(indicator); + currentValue = 1; +} + +void DecorationList::SetCurrentValue(int value) { + currentValue = value ? value : 1; +} + +bool DecorationList::FillRange(int &position, int value, int &fillLength) { + if (!current) { + current = DecorationFromIndicator(currentIndicator); + if (!current) { + current = Create(currentIndicator, lengthDocument); + } + } + bool changed = current->rs.FillRange(position, value, fillLength); + if (current->Empty()) { + Delete(currentIndicator); + } + return changed; +} + +void DecorationList::InsertSpace(int position, int insertLength) { + lengthDocument += insertLength; + for (Decoration *deco=root; deco; deco = deco->next) { + deco->rs.InsertSpace(position, insertLength); + } +} + +void DecorationList::DeleteRange(int position, int deleteLength) { + lengthDocument -= deleteLength; + Decoration *deco; + for (deco=root; deco; deco = deco->next) { + deco->rs.DeleteRange(position, deleteLength); + } + DeleteAnyEmpty(); +} + +void DecorationList::DeleteAnyEmpty() { + Decoration *deco = root; + while (deco) { + if (deco->Empty()) { + Delete(deco->indicator); + deco = root; + } else { + deco = deco->next; + } + } +} + +int DecorationList::AllOnFor(int position) { + int mask = 0; + for (Decoration *deco=root; deco; deco = deco->next) { + if (deco->rs.ValueAt(position)) { + mask |= 1 << deco->indicator; + } + } + return mask; +} + +int DecorationList::ValueAt(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.ValueAt(position); + } + return 0; +} + +int DecorationList::Start(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.StartRun(position); + } + return 0; +} + +int DecorationList::End(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.EndRun(position); + } + return 0; +} diff --git a/src/stc/scintilla/src/Decoration.h b/src/stc/scintilla/src/Decoration.h new file mode 100644 index 0000000000..2809641afd --- /dev/null +++ b/src/stc/scintilla/src/Decoration.h @@ -0,0 +1,64 @@ +/** @file Decoration.h + ** Visual elements added over text. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef DECORATION_H +#define DECORATION_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class Decoration { +public: + Decoration *next; + RunStyles rs; + int indicator; + + Decoration(int indicator_); + ~Decoration(); + + bool Empty(); +}; + +class DecorationList { + int currentIndicator; + int currentValue; + Decoration *current; + int lengthDocument; + Decoration *DecorationFromIndicator(int indicator); + Decoration *Create(int indicator, int length); + void Delete(int indicator); + void DeleteAnyEmpty(); +public: + Decoration *root; + bool clickNotified; + + DecorationList(); + ~DecorationList(); + + void SetCurrentIndicator(int indicator); + int GetCurrentIndicator() { return currentIndicator; } + + void SetCurrentValue(int value); + int GetCurrentValue() { return currentValue; } + + // Returns true if some values may have changed + bool FillRange(int &position, int value, int &fillLength); + + void InsertSpace(int position, int insertLength); + void DeleteRange(int position, int deleteLength); + + int AllOnFor(int position); + int ValueAt(int indicator, int position); + int Start(int indicator, int position); + int End(int indicator, int position); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/src/stc/scintilla/src/Document.cxx b/src/stc/scintilla/src/Document.cxx index 92be92691c..ff8d0fbcfc 100644 --- a/src/stc/scintilla/src/Document.cxx +++ b/src/stc/scintilla/src/Document.cxx @@ -13,12 +13,19 @@ #include "Platform.h" #include "Scintilla.h" -#include "SVector.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" #include "CellBuffer.h" #include "CharClassify.h" +#include "Decoration.h" #include "Document.h" #include "RESearch.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + // This is ASCII specific but is safe with chars >= 0x80 static inline bool isspacechar(unsigned char ch) { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); @@ -53,7 +60,8 @@ Document::Document() { stylingMask = 0; endStyled = 0; styleClock = 0; - enteredCount = 0; + enteredModification = 0; + enteredStyling = 0; enteredReadOnlyCount = 0; tabInChars = 8; indentInChars = 0; @@ -104,7 +112,6 @@ void Document::SetSavePoint() { int Document::AddMark(int line, int markerNum) { int prev = cb.AddMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); return prev; } @@ -115,14 +122,12 @@ void Document::AddMarkSet(int line, int valueSet) { if (m & 1) cb.AddMark(line, i); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); } void Document::DeleteMark(int line, int markerNum) { cb.DeleteMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); } @@ -140,11 +145,11 @@ void Document::DeleteAllMarks(int markerNum) { NotifyModified(mh); } -int Document::LineStart(int line) { +int Document::LineStart(int line) const { return cb.LineStart(line); } -int Document::LineEnd(int line) { +int Document::LineEnd(int line) const { if (line == LinesTotal() - 1) { return LineStart(line + 1); } else { @@ -182,8 +187,7 @@ int Document::SetLevel(int line, int level) { int prev = cb.SetLevel(line, level); if (prev != level) { DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, - LineStart(line), 0, 0, 0); - mh.line = line; + LineStart(line), 0, 0, 0, line); mh.foldLevelNow = level; mh.foldLevelPrev = prev; NotifyModified(mh); @@ -261,7 +265,9 @@ int Document::LenChar(int pos) { if (ch < 0x80) return 1; int len = 2; - if (ch >= (0x80 + 0x40 + 0x20)) + if (ch >= (0x80 + 0x40 + 0x20 + 0x10)) + len = 4; + else if (ch >= (0x80 + 0x40 + 0x20)) len = 3; int lengthDoc = Length(); if ((pos + len) > lengthDoc) @@ -281,6 +287,55 @@ int Document::LenChar(int pos) { } } +static bool IsTrailByte(int ch) { + return (ch >= 0x80) && (ch < (0x80 + 0x40)); +} + +static int BytesFromLead(int leadByte) { + if (leadByte > 0xF4) { + // Characters longer than 4 bytes not possible in current UTF-8 + return 0; + } else if (leadByte >= 0xF0) { + return 4; + } else if (leadByte >= 0xE0) { + return 3; + } else if (leadByte >= 0xC2) { + return 2; + } + return 0; +} + +bool Document::InGoodUTF8(int pos, int &start, int &end) { + int lead = pos; + while ((lead>0) && (pos-lead < 4) && IsTrailByte(static_cast(cb.CharAt(lead-1)))) + lead--; + start = 0; + if (lead > 0) { + start = lead-1; + } + int leadByte = static_cast(cb.CharAt(start)); + int bytes = BytesFromLead(leadByte); + if (bytes == 0) { + return false; + } else { + int trailBytes = bytes - 1; + int len = pos - lead + 1; + if (len > trailBytes) + // pos too far from lead + return false; + // Check that there are enough trails for this lead + int trail = pos + 1; + while ((trail-lead(cb.CharAt(trail)))) { + return false; + } + trail++; + } + end = start + bytes; + return true; + } +} + // Normalise a position so that it is not halfway through a two byte character. // This can occur in two situations - // When lines are terminated with \r\n pairs which should be treated as one character. @@ -307,13 +362,14 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { if (dbcsCodePage) { if (SC_CP_UTF8 == dbcsCodePage) { unsigned char ch = static_cast(cb.CharAt(pos)); - while ((pos > 0) && (pos < Length()) && (ch >= 0x80) && (ch < (0x80 + 0x40))) { - // ch is a trail byte + int startUTF = pos; + int endUTF = pos; + if (IsTrailByte(ch) && InGoodUTF8(pos, startUTF, endUTF)) { + // ch is a trail byte within a UTF-8 character if (moveDir > 0) - pos++; + pos = endUTF; else - pos--; - ch = static_cast(cb.CharAt(pos)); + pos = startUTF; } } else { // Anchor DBCS calculations at start of line because start of line can @@ -358,20 +414,19 @@ void Document::CheckReadOnly() { } } -// Document only modified by gateways DeleteChars, InsertStyledString, Undo, Redo, and SetStyleAt. +// Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt. // SetStyleAt does not change the persistent state of a document -// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number bool Document::DeleteChars(int pos, int len) { if (len == 0) return false; if ((pos + len) > Length()) return false; CheckReadOnly(); - if (enteredCount != 0) { + if (enteredModification != 0) { return false; } else { - enteredCount++; + enteredModification++; if (!cb.IsReadOnly()) { NotifyModified( DocModification( @@ -380,7 +435,8 @@ bool Document::DeleteChars(int pos, int len) { 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); - const char *text = cb.DeleteChars(pos * 2, len * 2); + bool startSequence = false; + const char *text = cb.DeleteChars(pos, len, startSequence); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); if ((pos < Length()) || (pos == 0)) @@ -389,43 +445,47 @@ bool Document::DeleteChars(int pos, int len) { ModifiedAt(pos-1); NotifyModified( DocModification( - SC_MOD_DELETETEXT | SC_PERFORMED_USER, + SC_MOD_DELETETEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), pos, len, LinesTotal() - prevLinesTotal, text)); } - enteredCount--; + enteredModification--; } return !cb.IsReadOnly(); } /** - * Insert a styled string (char/style pairs) with a length. + * Insert a string with a length. */ -bool Document::InsertStyledString(int position, char *s, int insertLength) { +bool Document::InsertString(int position, const char *s, int insertLength) { + if (insertLength <= 0) { + return false; + } CheckReadOnly(); - if (enteredCount != 0) { + if (enteredModification != 0) { return false; } else { - enteredCount++; + enteredModification++; if (!cb.IsReadOnly()) { NotifyModified( DocModification( SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, - position / 2, insertLength / 2, + position, insertLength, 0, s)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); - const char *text = cb.InsertString(position, s, insertLength); + bool startSequence = false; + const char *text = cb.InsertString(position, s, insertLength, startSequence); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); - ModifiedAt(position / 2); + ModifiedAt(position); NotifyModified( DocModification( - SC_MOD_INSERTTEXT | SC_PERFORMED_USER, - position / 2, insertLength / 2, + SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), + position, insertLength, LinesTotal() - prevLinesTotal, text)); } - enteredCount--; + enteredModification--; } return !cb.IsReadOnly(); } @@ -433,8 +493,8 @@ bool Document::InsertStyledString(int position, char *s, int insertLength) { int Document::Undo() { int newPos = -1; CheckReadOnly(); - if (enteredCount == 0) { - enteredCount++; + if (enteredModification == 0) { + enteredModification++; if (!cb.IsReadOnly()) { bool startSavePoint = cb.IsSavePoint(); bool multiLine = false; @@ -481,7 +541,7 @@ int Document::Undo() { if (startSavePoint != endSavePoint) NotifySavePoint(endSavePoint); } - enteredCount--; + enteredModification--; } return newPos; } @@ -489,8 +549,8 @@ int Document::Undo() { int Document::Redo() { int newPos = -1; CheckReadOnly(); - if (enteredCount == 0) { - enteredCount++; + if (enteredModification == 0) { + enteredModification++; if (!cb.IsReadOnly()) { bool startSavePoint = cb.IsSavePoint(); bool multiLine = false; @@ -535,7 +595,7 @@ int Document::Redo() { if (startSavePoint != endSavePoint) NotifySavePoint(endSavePoint); } - enteredCount--; + enteredModification--; } return newPos; } @@ -544,39 +604,18 @@ int Document::Redo() { * Insert a single character. */ bool Document::InsertChar(int pos, char ch) { - char chs[2]; + char chs[1]; chs[0] = ch; - chs[1] = 0; - return InsertStyledString(pos*2, chs, 2); + return InsertString(pos, chs, 1); } /** * Insert a null terminated string. */ -bool Document::InsertString(int position, const char *s) { +bool Document::InsertCString(int position, const char *s) { return InsertString(position, s, strlen(s)); } -/** - * Insert a string with a length. - */ -bool Document::InsertString(int position, const char *s, size_t insertLength) { - bool changed = false; - if (insertLength > 0) { - char *sWithStyle = new char[insertLength * 2]; - if (sWithStyle) { - for (size_t i = 0; i < insertLength; i++) { - sWithStyle[i*2] = s[i]; - sWithStyle[i*2 + 1] = 0; - } - changed = InsertStyledString(position*2, sWithStyle, - static_cast(insertLength*2)); - delete []sWithStyle; - } - } - return changed; -} - void Document::ChangeChar(int pos, char ch) { DeleteChars(pos, 1); InsertChar(pos, ch); @@ -653,12 +692,12 @@ void Document::SetLineIndentation(int line, int indent) { int indentPos = GetLineIndentPosition(line); BeginUndoAction(); DeleteChars(thisLineStart, indentPos - thisLineStart); - InsertString(thisLineStart, linebuf); + InsertCString(thisLineStart, linebuf); EndUndoAction(); } } -int Document::GetLineIndentPosition(int line) { +int Document::GetLineIndentPosition(int line) const { if (line < 0) return 0; int pos = LineStart(line); @@ -682,9 +721,11 @@ int Document::GetColumn(int pos) { return column; } else if (ch == '\n') { return column; + } else if (i >= Length()) { + return column; } else { column++; - i = MovePositionOutsideChar(i + 1, 1); + i = MovePositionOutsideChar(i + 1, 1, false); } } } @@ -706,7 +747,7 @@ int Document::FindColumn(int line, int column) { return position; } else { columnCurrent++; - position = MovePositionOutsideChar(position + 1, 1); + position = MovePositionOutsideChar(position + 1, 1, false); } } } @@ -797,7 +838,7 @@ void Document::ConvertLineEnds(int eolModeSet) { EndUndoAction(); } -bool Document::IsWhiteLine(int line) { +bool Document::IsWhiteLine(int line) const { int currentChar = LineStart(line); int endLine = LineEnd(line); while (currentChar < endLine) { @@ -854,7 +895,7 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) pos--; } else { - if (!onlyWordCharacters) + if (!onlyWordCharacters && pos < Length()) ccStart = WordCharClass(cb.CharAt(pos)); while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) pos++; @@ -1242,7 +1283,7 @@ const char *Document::SubstituteByPosition(const char *text, int *length) { return substituted; } -int Document::LinesTotal() { +int Document::LinesTotal() const { return cb.Lines(); } @@ -1275,11 +1316,7 @@ void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCh void Document::SetStylingBits(int bits) { stylingBits = bits; - stylingBitsMask = 0; - for (int bit = 0; bit < stylingBits; bit++) { - stylingBitsMask <<= 1; - stylingBitsMask |= 1; - } + stylingBitsMask = (1 << stylingBits) - 1; } void Document::StartStyling(int position, char mask) { @@ -1288,10 +1325,10 @@ void Document::StartStyling(int position, char mask) { } bool Document::SetStyleFor(int length, char style) { - if (enteredCount != 0) { + if (enteredStyling != 0) { return false; } else { - enteredCount++; + enteredStyling++; style &= stylingMask; int prevEndStyled = endStyled; if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { @@ -1300,16 +1337,16 @@ bool Document::SetStyleFor(int length, char style) { NotifyModified(mh); } endStyled += length; - enteredCount--; + enteredStyling--; return true; } } bool Document::SetStyles(int length, char *styles) { - if (enteredCount != 0) { + if (enteredStyling != 0) { return false; } else { - enteredCount++; + enteredStyling++; bool didChange = false; int startMod = 0; int endMod = 0; @@ -1328,26 +1365,39 @@ bool Document::SetStyles(int length, char *styles) { startMod, endMod - startMod + 1); NotifyModified(mh); } - enteredCount--; + enteredStyling--; return true; } } -bool Document::EnsureStyledTo(int pos) { - if (pos > GetEndStyled()) { +void Document::EnsureStyledTo(int pos) { + if ((enteredStyling == 0) && (pos > GetEndStyled())) { IncrementStyleClock(); // Ask the watchers to style, and stop as soon as one responds. for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) { watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos); } } - return pos <= GetEndStyled(); +} + +int Document::SetLineState(int line, int state) { + int statePrevious = cb.SetLineState(line, state); + if (state != statePrevious) { + DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); + NotifyModified(mh); + } + return statePrevious; } void Document::IncrementStyleClock() { - styleClock++; - if (styleClock > 0x100000) { - styleClock = 0; + styleClock = (styleClock + 1) % 0x100000; +} + +void Document::DecorationFillRange(int position, int value, int fillLength) { + if (decorations.FillRange(position, value, fillLength)) { + DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER, + position, fillLength); + NotifyModified(mh); } } @@ -1408,6 +1458,11 @@ void Document::NotifySavePoint(bool atSavePoint) { } void Document::NotifyModified(DocModification mh) { + if (mh.modificationType & SC_MOD_INSERTTEXT) { + decorations.InsertSpace(mh.position, mh.length); + } else if (mh.modificationType & SC_MOD_DELETETEXT) { + decorations.DeleteRange(mh.position, mh.length); + } for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData); } diff --git a/src/stc/scintilla/src/Document.h b/src/stc/scintilla/src/Document.h index 15ba096b8a..a36c4aafee 100644 --- a/src/stc/scintilla/src/Document.h +++ b/src/stc/scintilla/src/Document.h @@ -8,6 +8,10 @@ #ifndef DOCUMENT_H #define DOCUMENT_H +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + /** * A Position is a position within a document between two characters or at the beginning or end. * Sometimes used as a character index where it identifies the character after the position. @@ -28,10 +32,10 @@ public: Range(Position pos=0) : start(pos), end(pos) { - } + }; Range(Position start_, Position end_) : start(start_), end(end_) { - } + }; bool Valid() const { return (start != invalidPosition) && (end != invalidPosition); @@ -97,7 +101,8 @@ private: char stylingMask; int endStyled; int styleClock; - int enteredCount; + int enteredModification; + int enteredStyling; int enteredReadOnlyCount; WatcherWithUserData *watchers; @@ -121,6 +126,8 @@ public: bool tabIndents; bool backspaceUnindents; + DecorationList decorations; + Document(); virtual ~Document(); @@ -131,12 +138,14 @@ public: int ClampPositionIntoDocument(int pos); bool IsCrLf(int pos); int LenChar(int pos); + bool InGoodUTF8(int pos, int &start, int &end); int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); // Gateways to modifying document void ModifiedAt(int pos); + void CheckReadOnly(); bool DeleteChars(int pos, int len); - bool InsertStyledString(int position, char *s, int insertLength); + bool InsertString(int position, const char *s, int insertLength); int Undo(); int Redo(); bool CanUndo() { return cb.CanUndo(); } @@ -153,7 +162,7 @@ public: int GetLineIndentation(int line); void SetLineIndentation(int line, int indent); - int GetLineIndentPosition(int line); + int GetLineIndentPosition(int line) const; int GetColumn(int position); int FindColumn(int line, int column); void Indent(bool forwards, int lineBottom, int lineTop); @@ -163,8 +172,7 @@ public: bool IsReadOnly() { return cb.IsReadOnly(); } bool InsertChar(int pos, char ch); - bool InsertString(int position, const char *s); - bool InsertString(int position, const char *s, size_t insertLength); + bool InsertCString(int position, const char *s); void ChangeChar(int pos, char ch); void DelChar(int pos); void DelCharBack(int pos); @@ -181,8 +189,8 @@ public: void DeleteMarkFromHandle(int markerHandle); void DeleteAllMarks(int markerNum); int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); } - int LineStart(int line); - int LineEnd(int line); + int LineStart(int line) const; + int LineEnd(int line) const; int LineEndPosition(int position); int VCHomePosition(int position); @@ -196,13 +204,13 @@ public: int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); int NextWordStart(int pos, int delta); int NextWordEnd(int pos, int delta); - int Length() { return cb.Length(); } - void Allocate(int newSize) { cb.Allocate(newSize*2); } + int Length() const { return cb.Length(); } + void Allocate(int newSize) { cb.Allocate(newSize); } long FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length); long FindText(int iMessage, unsigned long wParam, long lParam); const char *SubstituteByPosition(const char *text, int *length); - int LinesTotal(); + int LinesTotal() const; void ChangeCase(Range r, bool makeUpperCase); @@ -213,11 +221,12 @@ public: bool SetStyleFor(int length, char style); bool SetStyles(int length, char *styles); int GetEndStyled() { return endStyled; } - bool EnsureStyledTo(int pos); + void EnsureStyledTo(int pos); int GetStyleClock() { return styleClock; } void IncrementStyleClock(); + void DecorationFillRange(int position, int value, int fillLength); - int SetLineState(int line, int state) { return cb.SetLineState(line, state); } + int SetLineState(int line, int state); int GetLineState(int line) { return cb.GetLineState(line); } int GetMaxLineState() { return cb.GetMaxLineState(); } @@ -230,15 +239,13 @@ public: int WordPartLeft(int pos); int WordPartRight(int pos); int ExtendStyleRange(int pos, int delta, bool singleLine = false); - bool IsWhiteLine(int line); + bool IsWhiteLine(int line) const; int ParaUp(int pos); int ParaDown(int pos); int IndentSize() { return actualIndentInChars; } int BraceMatch(int position, int maxReStyle); private: - void CheckReadOnly(); - CharClassify::cc WordCharClass(unsigned char ch); bool IsWordStartAt(int pos); bool IsWordEndAt(int pos); @@ -302,4 +309,8 @@ public: virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0; }; +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/src/DocumentAccessor.cxx b/src/stc/scintilla/src/DocumentAccessor.cxx index c695c5f510..a25979dc2c 100644 --- a/src/stc/scintilla/src/DocumentAccessor.cxx +++ b/src/stc/scintilla/src/DocumentAccessor.cxx @@ -13,14 +13,21 @@ #include "Platform.h" #include "PropSet.h" -#include "SVector.h" #include "Accessor.h" #include "DocumentAccessor.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" #include "CellBuffer.h" #include "Scintilla.h" #include "CharClassify.h" +#include "Decoration.h" #include "Document.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + DocumentAccessor::~DocumentAccessor() { } @@ -103,8 +110,9 @@ void DocumentAccessor::StartSegment(unsigned int pos) { void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) { // Only perform styling if non empty range if (pos != startSeg - 1) { + PLATFORM_ASSERT(pos >= startSeg); if (pos < startSeg) { - Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos); + return; } if (validLen + (pos - startSeg + 1) >= bufferSize) @@ -185,3 +193,7 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI return indent; } +void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int value) { + pdoc->decorations.SetCurrentIndicator(indicator); + pdoc->DecorationFillRange(start, value, end - start); +} diff --git a/src/stc/scintilla/src/DocumentAccessor.h b/src/stc/scintilla/src/DocumentAccessor.h index 0b94978c2d..a3a939d0d3 100644 --- a/src/stc/scintilla/src/DocumentAccessor.h +++ b/src/stc/scintilla/src/DocumentAccessor.h @@ -6,6 +6,10 @@ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + class Document; /** @@ -58,10 +62,15 @@ public: WindowID GetWindow() { return id; } void StartAt(unsigned int start, char chMask=31); - void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; } + void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; unsigned int GetStartSegment() { return startSeg; } void StartSegment(unsigned int pos); void ColourTo(unsigned int pos, int chAttr); void SetLevel(int line, int level); int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); + void IndicatorFill(int start, int end, int indicator, int value); }; + +#ifdef SCI_NAMESPACE +} +#endif diff --git a/src/stc/scintilla/src/Editor.cxx b/src/stc/scintilla/src/Editor.cxx index a69194f97e..9107102ff6 100644 --- a/src/stc/scintilla/src/Editor.cxx +++ b/src/stc/scintilla/src/Editor.cxx @@ -17,8 +17,10 @@ #endif #include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" #include "ContractionState.h" -#include "SVector.h" #include "CellBuffer.h" #include "KeyMap.h" #include "Indicator.h" @@ -27,17 +29,23 @@ #include "Style.h" #include "ViewStyle.h" #include "CharClassify.h" +#include "Decoration.h" #include "Document.h" +#include "PositionCache.h" #include "Editor.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + /* return whether this modification represents an operation that may reasonably be deferred (not done now OR [possibly] at all) */ static bool CanDeferToLastStep(const DocModification& mh) { - if (mh.modificationType & (SC_MOD_BEFOREINSERT|SC_MOD_BEFOREDELETE)) + if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) return true; // CAN skip - if (!(mh.modificationType & (SC_PERFORMED_UNDO|SC_PERFORMED_REDO))) + if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) return false; // MUST do if (mh.modificationType & SC_MULTISTEPUNDOREDO) return true; // CAN skip @@ -46,7 +54,7 @@ static bool CanDeferToLastStep(const DocModification& mh) { static bool CanEliminate(const DocModification& mh) { return - (mh.modificationType & (SC_MOD_BEFOREINSERT|SC_MOD_BEFOREDELETE)) != 0; + (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; } /* @@ -55,281 +63,24 @@ static bool CanEliminate(const DocModification& mh) { */ static bool IsLastStep(const DocModification& mh) { return - (mh.modificationType & (SC_PERFORMED_UNDO|SC_PERFORMED_REDO)) != 0 - && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 - && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0 - && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; + (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 + && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 + && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0 + && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; } Caret::Caret() : -active(false), on(false), period(500) {} + active(false), on(false), period(500) {} Timer::Timer() : -ticking(false), ticksToWait(0), tickerID(0) {} + ticking(false), ticksToWait(0), tickerID(0) {} Idler::Idler() : -state(false), idlerID(0) {} - -LineLayout::LineLayout(int maxLineLength_) : - lineStarts(0), - lenLineStarts(0), - lineNumber(-1), - inCache(false), - maxLineLength(-1), - numCharsInLine(0), - validity(llInvalid), - xHighlightGuide(0), - highlightColumn(0), - selStart(0), - selEnd(0), - containsCaret(false), - edgeColumn(0), - chars(0), - styles(0), - styleBitsSet(0), - indicators(0), - positions(0), - hsStart(0), - hsEnd(0), - widthLine(wrapWidthInfinite), - lines(1) { - Resize(maxLineLength_); -} - -LineLayout::~LineLayout() { - Free(); -} - -void LineLayout::Resize(int maxLineLength_) { - if (maxLineLength_ > 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 int[maxLineLength_ + 1 + 1]; - maxLineLength = maxLineLength_; - } -} - -void LineLayout::Free() { - delete []chars; - chars = 0; - delete []styles; - styles = 0; - delete []indicators; - indicators = 0; - delete []positions; - positions = 0; - delete []lineStarts; - lineStarts = 0; -} - -void LineLayout::Invalidate(validLevel validity_) { - if (validity > validity_) - validity = validity_; -} - -void LineLayout::SetLineStart(int line, int start) { - if ((line >= lenLineStarts) && (line != 0)) { - int newMaxLines = line + 20; - int *newLineStarts = new int[newMaxLines]; - if (!newLineStarts) - return; - for (int i = 0; i < newMaxLines; i++) { - if (i < lenLineStarts) - newLineStarts[i] = lineStarts[i]; - else - newLineStarts[i] = 0; - } - delete []lineStarts; - lineStarts = newLineStarts; - lenLineStarts = newMaxLines; - } - lineStarts[line] = start; -} - -void LineLayout::SetBracesHighlight(Range rangeLine, Position braces[], - char bracesMatchStyle, int xHighlight) { - if (rangeLine.ContainsCharacter(braces[0])) { - int braceOffset = braces[0] - rangeLine.start; - if (braceOffset < numCharsInLine) { - bracePreviousStyles[0] = styles[braceOffset]; - styles[braceOffset] = bracesMatchStyle; - } - } - if (rangeLine.ContainsCharacter(braces[1])) { - int braceOffset = braces[1] - rangeLine.start; - if (braceOffset < numCharsInLine) { - bracePreviousStyles[1] = styles[braceOffset]; - styles[braceOffset] = bracesMatchStyle; - } - } - if ((braces[0] >= rangeLine.start && braces[1] <= rangeLine.end) || - (braces[1] >= rangeLine.start && braces[0] <= rangeLine.end)) { - xHighlightGuide = xHighlight; - } -} - -void LineLayout::RestoreBracesHighlight(Range rangeLine, Position braces[]) { - if (rangeLine.ContainsCharacter(braces[0])) { - int braceOffset = braces[0] - rangeLine.start; - if (braceOffset < numCharsInLine) { - styles[braceOffset] = bracePreviousStyles[0]; - } - } - if (rangeLine.ContainsCharacter(braces[1])) { - int braceOffset = braces[1] - rangeLine.start; - if (braceOffset < numCharsInLine) { - styles[braceOffset] = bracePreviousStyles[1]; - } - } - xHighlightGuide = 0; -} - -LineLayoutCache::LineLayoutCache() : - level(0), length(0), size(0), cache(0), - allInvalidated(false), styleClock(-1), useCount(0) { - Allocate(0); -} - -LineLayoutCache::~LineLayoutCache() { - Deallocate(); -} - -void LineLayoutCache::Allocate(int length_) { - PLATFORM_ASSERT(cache == NULL); - allInvalidated = false; - length = length_; - size = length; - if (size > 1) { - size = (size / 16 + 1) * 16; - } - if (size > 0) { - cache = new LineLayout * [size]; - } - for (int i = 0; i < size; i++) - cache[i] = 0; -} - -void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) { - PLATFORM_ASSERT(useCount == 0); - int lengthForLevel = 0; - if (level == llcCaret) { - lengthForLevel = 1; - } else if (level == llcPage) { - lengthForLevel = linesOnScreen + 1; - } else if (level == llcDocument) { - lengthForLevel = linesInDoc; - } - if (lengthForLevel > size) { - Deallocate(); - Allocate(lengthForLevel); - } else { - if (lengthForLevel < length) { - for (int i = lengthForLevel; i < length; i++) { - delete cache[i]; - cache[i] = 0; - } - } - length = lengthForLevel; - } - PLATFORM_ASSERT(length == lengthForLevel); - PLATFORM_ASSERT(cache != NULL || length == 0); -} - -void LineLayoutCache::Deallocate() { - PLATFORM_ASSERT(useCount == 0); - for (int i = 0; i < length; i++) - delete cache[i]; - delete []cache; - cache = 0; - length = 0; - size = 0; -} - -void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) { - if (cache && !allInvalidated) { - for (int i = 0; i < length; i++) { - if (cache[i]) { - cache[i]->Invalidate(validity_); - } - } - if (validity_ == LineLayout::llInvalid) { - allInvalidated = true; - } - } -} - -void LineLayoutCache::SetLevel(int level_) { - allInvalidated = false; - if ((level_ != -1) && (level != level_)) { - level = level_; - Deallocate(); - } -} - -LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, - int linesOnScreen, int linesInDoc) { - AllocateForLevel(linesOnScreen, linesInDoc); - if (styleClock != styleClock_) { - Invalidate(LineLayout::llCheckTextAndStyle); - styleClock = styleClock_; - } - allInvalidated = false; - int pos = -1; - LineLayout *ret = 0; - if (level == llcCaret) { - pos = 0; - } else if (level == llcPage) { - if (lineNumber == lineCaret) { - pos = 0; - } else if (length > 1) { - pos = 1 + (lineNumber % (length - 1)); - } - } else if (level == llcDocument) { - pos = lineNumber; - } - if (pos >= 0) { - PLATFORM_ASSERT(useCount == 0); - if (cache && (pos < length)) { - if (cache[pos]) { - if ((cache[pos]->lineNumber != lineNumber) || - (cache[pos]->maxLineLength < maxChars)) { - delete cache[pos]; - cache[pos] = 0; - } - } - if (!cache[pos]) { - cache[pos] = new LineLayout(maxChars); - } - if (cache[pos]) { - cache[pos]->lineNumber = lineNumber; - cache[pos]->inCache = true; - ret = cache[pos]; - useCount++; - } - } - } - - if (!ret) { - ret = new LineLayout(maxChars); - ret->lineNumber = lineNumber; - } + state(false), idlerID(0) {} - return ret; -} - -void LineLayoutCache::Dispose(LineLayout *ll) { - allInvalidated = false; - if (ll) { - if (!ll->inCache) { - delete ll; - } else { - useCount--; - } - } +static inline bool IsControlCharacter(int ch) { + // iscntrl returns true for lots of chars > 127 which are displayable + return ch >= 0 && ch < ' '; } Editor::Editor() { @@ -358,7 +109,7 @@ Editor::Editor() { dwelling = false; ptMouseLast.x = 0; ptMouseLast.y = 0; - inDragDrop = false; + inDragDrop = ddNone; dropWentOutside = false; posDrag = invalidPosition; posDrop = invalidPosition; @@ -386,6 +137,8 @@ Editor::Editor() { xCaretMargin = 50; horizontalScrollBarVisible = true; scrollWidth = 2000; + trackLineWidth = false; + lineWidthMaxSeen = 0; verticalScrollBarVisible = true; endAtLastLine = true; caretSticky = false; @@ -442,6 +195,7 @@ Editor::Editor() { hsEnd = -1; llc.SetLevel(LineLayoutCache::llcCaret); + posCache.SetSize(0x400); } Editor::~Editor() { @@ -474,6 +228,7 @@ void Editor::InvalidateStyleData() { palette.Release(); DropGraphics(); llc.Invalidate(LineLayout::llInvalid); + posCache.Clear(); if (selType == selRectangle) { xStartSelect = XFromPosition(anchor); xEndSelect = XFromPosition(currentPos); @@ -519,10 +274,7 @@ int Editor::LinesOnScreen() { PRectangle rcClient = GetClientRectangle(); int htClient = rcClient.bottom - rcClient.top; //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); - int n = htClient / vs.lineHeight; - if (n < 0) - n = 0; - return n; + return htClient / vs.lineHeight; } int Editor::LinesToScroll() { @@ -549,11 +301,6 @@ int Editor::MaxScrollPos() { } } -static inline bool IsControlCharacter(int ch) { - // iscntrl returns true for lots of chars > 127 which are displayable - return ch >= 0 && ch < ' '; -} - const char *ControlCharacterString(unsigned char ch) { const char *reps[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", @@ -593,6 +340,10 @@ public: } }; +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + /** * Allows to iterate through the lines of a selection. * Althought it can be called for a stream selection, in most cases @@ -671,6 +422,10 @@ public: } }; +#ifdef SCI_NAMESPACE +} +#endif + Point Editor::LocationFromPosition(int pos) { Point pt; RefreshStyleData(); @@ -725,10 +480,6 @@ void Editor::SetTopLine(int topLineNew) { posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine)); } -static inline bool IsEOLChar(char ch) { - return (ch == '\r') || (ch == '\n'); -} - int Editor::PositionFromLocation(Point pt) { RefreshStyleData(); pt.x = pt.x - vs.fixedColumnWidth + xOffset; @@ -751,18 +502,19 @@ int Editor::PositionFromLocation(Point pt) { int subLine = visibleLine - lineStartSet; if (subLine < ll->lines) { int lineStart = ll->LineStart(subLine); - int lineEnd = ll->LineStart(subLine + 1); + int lineEnd = ll->LineLastVisible(subLine); int subLineStart = ll->positions[lineStart]; if (actualWrapVisualStartIndent != 0) { if (lineStart != 0) // Wrapped pt.x -= actualWrapVisualStartIndent * vs.aveCharWidth; } - for (int i = lineStart; i < lineEnd; i++) { - if (pt.x < (((ll->positions[i] + ll->positions[i + 1]) / 2) - subLineStart) || - IsEOLChar(ll->chars[i])) { + int i = ll->FindBefore(pt.x + subLineStart, lineStart, lineEnd); + while (i < lineEnd) { + if ((pt.x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { return pdoc->MovePositionOutsideChar(i + posLineStart, 1); } + i++; } return lineEnd + posLineStart; } @@ -800,18 +552,19 @@ int Editor::PositionFromLocationClose(Point pt) { int subLine = visibleLine - lineStartSet; if (subLine < ll->lines) { int lineStart = ll->LineStart(subLine); - int lineEnd = ll->LineStart(subLine + 1); + int lineEnd = ll->LineLastVisible(subLine); int subLineStart = ll->positions[lineStart]; if (actualWrapVisualStartIndent != 0) { if (lineStart != 0) // Wrapped pt.x -= actualWrapVisualStartIndent * vs.aveCharWidth; } - for (int i = lineStart; i < lineEnd; i++) { - if (pt.x < (((ll->positions[i] + ll->positions[i + 1]) / 2) - subLineStart) || - IsEOLChar(ll->chars[i])) { + int i = ll->FindBefore(pt.x + subLineStart, lineStart, lineEnd); + while (i < lineEnd) { + if ((pt.x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { return pdoc->MovePositionOutsideChar(i + posLineStart, 1); } + i++; } if (pt.x < (ll->positions[lineEnd] - subLineStart)) { return pdoc->MovePositionOutsideChar(lineEnd + posLineStart, 1); @@ -840,19 +593,20 @@ int Editor::PositionFromLineX(int lineDoc, int x) { retVal = ll->numCharsInLine + posLineStart; int subLine = 0; int lineStart = ll->LineStart(subLine); - int lineEnd = ll->LineStart(subLine + 1); + int lineEnd = ll->LineLastVisible(subLine); int subLineStart = ll->positions[lineStart]; if (actualWrapVisualStartIndent != 0) { if (lineStart != 0) // Wrapped x -= actualWrapVisualStartIndent * vs.aveCharWidth; } - for (int i = lineStart; i < lineEnd; i++) { - if (x < (((ll->positions[i] + ll->positions[i + 1]) / 2) - subLineStart) || - IsEOLChar(ll->chars[i])) { + int i = ll->FindBefore(x + subLineStart, lineStart, lineEnd); + while (i < lineEnd) { + if ((x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { retVal = pdoc->MovePositionOutsideChar(i + posLineStart, 1); break; } + i++; } } return retVal; @@ -1126,7 +880,7 @@ void Editor::ScrollTo(int line, bool moveThumb) { ShowCaretAtCurrentPosition(); // Perform redraw rather than scroll if many lines would be redrawn anyway. #ifndef UNDER_CE - if (abs(linesToMove) <= 10) { + if ((abs(linesToMove) <= 10) && (paintState == notPainting)) { ScrollText(linesToMove); } else { Redraw(); @@ -1161,13 +915,13 @@ void Editor::MoveCaretInsideView(bool ensureVisible) { Point pt = LocationFromPosition(currentPos); if (pt.y < rcClient.top) { MovePositionTo(PositionFromLocation( - Point(lastXChosen, rcClient.top)), - noSel, ensureVisible); + Point(lastXChosen, rcClient.top)), + noSel, ensureVisible); } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen() - 1) * vs.lineHeight; MovePositionTo(PositionFromLocation( - Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)), - noSel, ensureVisible); + Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)), + noSel, ensureVisible); } } @@ -1440,6 +1194,10 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { xOffsetNew = pt.x + xOffset - rcClient.left; } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) { xOffsetNew = pt.x + xOffset - rcClient.right + 1; + if (vs.caretStyle == CARETSTYLE_BLOCK) { + // Ensure we can see a good portion of the block caret + xOffsetNew += vs.aveCharWidth; + } } if (xOffsetNew < 0) { xOffsetNew = 0; @@ -1448,7 +1206,7 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { xOffset = xOffsetNew; if (xOffsetNew > 0) { PRectangle rcText = GetTextRectangle(); - if (horizontalScrollBarVisible == true && + if (horizontalScrollBarVisible && rcText.Width() + xOffset > scrollWidth) { scrollWidth = xOffset + rcText.Width(); SetScrollBars(); @@ -1505,6 +1263,16 @@ void Editor::NeedWrapping(int docLineStart, int docLineEnd) { } } +bool Editor::WrapOneLine(Surface *surface, int lineToWrap) { + AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap)); + int linesWrapped = 1; + if (ll) { + LayoutLine(lineToWrap, surface, vs, ll, wrapWidth); + linesWrapped = ll->lines; + } + return cs.SetHeight(lineToWrap, linesWrapped); +} + // Check if wrapping needed and perform any needed wrapping. // fullwrap: if true, all lines which need wrapping will be done, // in this single call. @@ -1526,9 +1294,9 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { } } if (!fullWrap && priorityWrapLineStart >= 0 && - // .. and if the paint window is outside pending wraps - (((priorityWrapLineStart + linesInOneCall) < wrapStart) || - (priorityWrapLineStart > wrapEnd))) { + // .. and if the paint window is outside pending wraps + (((priorityWrapLineStart + linesInOneCall) < wrapStart) || + (priorityWrapLineStart > wrapEnd))) { // No priority wrap pending return false; } @@ -1581,13 +1349,7 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { // Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap); // Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd); while (lineToWrap < lastLineToWrap) { - AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap)); - int linesWrapped = 1; - if (ll) { - LayoutLine(lineToWrap, surface, vs, ll, wrapWidth); - linesWrapped = ll->lines; - } - if (cs.SetHeight(lineToWrap, linesWrapped)) { + if (WrapOneLine(surface, lineToWrap)) { wrapOccurred = true; } lineToWrap++; @@ -1628,6 +1390,7 @@ void Editor::LinesJoin() { if (prevNonWS) { // Ensure at least one space separating previous lines pdoc->InsertChar(pos, ' '); + targetEnd++; } } else { prevNonWS = pdoc->CharAt(pos) != ' '; @@ -1664,8 +1427,8 @@ void Editor::LinesSplit(int pixelWidth) { unsigned int posLineStart = pdoc->LineStart(line); LayoutLine(line, surface, vs, ll, pixelWidth); for (int subLine = 1; subLine < ll->lines; subLine++) { - pdoc->InsertString(posLineStart + (subLine - 1) * strlen(eol) + - ll->LineStart(subLine), eol); + pdoc->InsertCString(posLineStart + (subLine - 1) * strlen(eol) + + ll->LineStart(subLine), eol); targetEnd += static_cast(strlen(eol)); } } @@ -1766,9 +1529,9 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { // Old code does not know about new markers needed to distinguish all cases int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, - SC_MARKNUM_FOLDEROPEN); + SC_MARKNUM_FOLDEROPEN); int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND, - SC_MARKNUM_FOLDER); + SC_MARKNUM_FOLDER); while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) { @@ -1853,11 +1616,11 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { int lev = pdoc->GetLevel(lineDoc); sprintf(number, "%c%c %03X %03X", - (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', - (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - lev & SC_FOLDLEVELNUMBERMASK, - lev >> 16 - ); + (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', + (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', + lev & SC_FOLDLEVELNUMBERMASK, + lev >> 16 + ); } PRectangle rcNumber = rcMarker; // Right justify @@ -1865,9 +1628,9 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { int xpos = rcNumber.right - width - 3; rcNumber.left = xpos; surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font, - rcNumber.top + vs.maxAscent, number, istrlen(number), - vs.styles[STYLE_LINENUMBER].fore.allocated, - vs.styles[STYLE_LINENUMBER].back.allocated); + rcNumber.top + vs.maxAscent, number, istrlen(number), + vs.styles[STYLE_LINENUMBER].fore.allocated, + vs.styles[STYLE_LINENUMBER].back.allocated); } if (marks) { @@ -1911,17 +1674,69 @@ void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) { surface->LineTo(xhead, ymid + ydiff); } -static bool IsSpaceOrTab(char ch) { - return ch == ' ' || ch == '\t'; -} - LineLayout *Editor::RetrieveLineLayout(int lineNumber) { int posLineStart = pdoc->LineStart(lineNumber); int posLineEnd = pdoc->LineStart(lineNumber + 1); + PLATFORM_ASSERT(posLineEnd >= posLineStart); int lineCaret = pdoc->LineFromPosition(currentPos); return llc.Retrieve(lineNumber, lineCaret, - posLineEnd - posLineStart, pdoc->GetStyleClock(), - LinesOnScreen() + 1, pdoc->LinesTotal()); + posLineEnd - posLineStart, pdoc->GetStyleClock(), + LinesOnScreen() + 1, pdoc->LinesTotal()); +} + +static bool GoodTrailByte(int v) { + return (v >= 0x80) && (v < 0xc0); +} + +bool BadUTF(const char *s, int len, int &trailBytes) { + if (trailBytes) { + trailBytes--; + return false; + } + const unsigned char *us = reinterpret_cast(s); + if (*us < 0x80) { + // Single bytes easy + return false; + } else if (*us > 0xF4) { + // Characters longer than 4 bytes not possible in current UTF-8 + return true; + } else if (*us >= 0xF0) { + // 4 bytes + if (len < 4) + return true; + if (GoodTrailByte(us[1]) && GoodTrailByte(us[2]) && GoodTrailByte(us[3])) { + trailBytes = 3; + return false; + } else { + return true; + } + } else if (*us >= 0xE0) { + // 3 bytes + if (len < 3) + return true; + if (GoodTrailByte(us[1]) && GoodTrailByte(us[2])) { + trailBytes = 2; + return false; + } else { + return true; + } + } else if (*us >= 0xC2) { + // 2 bytes + if (len < 2) + return true; + if (GoodTrailByte(us[1])) { + trailBytes = 1; + return false; + } else { + return true; + } + } else if (*us >= 0xC0) { + // Overlong encoding + return true; + } else { + // Trail byte + return true; + } } /** @@ -1932,7 +1747,9 @@ LineLayout *Editor::RetrieveLineLayout(int lineNumber) { void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width) { if (!ll) return; + PLATFORM_ASSERT(line < pdoc->LinesTotal()); + PLATFORM_ASSERT(ll->chars != NULL); int posLineStart = pdoc->LineStart(line); int posLineEnd = pdoc->LineStart(line + 1); // If the line is very long, limit the treatment to a length that should fit in the viewport @@ -1960,18 +1777,18 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou char chDoc = pdoc->CharAt(charInDoc); styleByte = pdoc->StyleAt(charInDoc); allSame = allSame && - (ll->styles[numCharsInLine] == static_cast(styleByte & styleMask)); + (ll->styles[numCharsInLine] == static_cast(styleByte & styleMask)); allSame = allSame && - (ll->indicators[numCharsInLine] == static_cast(styleByte & ~styleMask)); + (ll->indicators[numCharsInLine] == static_cast(styleByte & ~styleMask)); if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed) allSame = allSame && - (ll->chars[numCharsInLine] == chDoc); + (ll->chars[numCharsInLine] == chDoc); else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) allSame = allSame && - (ll->chars[numCharsInLine] == static_cast(tolower(chDoc))); + (ll->chars[numCharsInLine] == static_cast(tolower(chDoc))); else // Style::caseUpper allSame = allSame && - (ll->chars[numCharsInLine] == static_cast(toupper(chDoc))); + (ll->chars[numCharsInLine] == static_cast(toupper(chDoc))); numCharsInLine++; } allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled @@ -2033,31 +1850,40 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou int ctrlCharWidth[32] = {0}; bool isControlNext = IsControlCharacter(ll->chars[0]); + int trailBytes = 0; + bool isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars, numCharsInLine, trailBytes); for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) { bool isControl = isControlNext; isControlNext = IsControlCharacter(ll->chars[charInLine + 1]); + bool isBadUTF = isBadUTFNext; + isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars + charInLine + 1, numCharsInLine - charInLine - 1, trailBytes); if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) || - isControl || isControlNext) { + isControl || isControlNext || isBadUTF || isBadUTFNext) { ll->positions[startseg] = 0; if (vstyle.styles[ll->styles[charInLine]].visible) { if (isControl) { if (ll->chars[charInLine] == '\t') { ll->positions[charInLine + 1] = ((((startsegx + 2) / - tabWidth) + 1) * tabWidth) - startsegx; + tabWidth) + 1) * tabWidth) - startsegx; } else if (controlCharSymbol < 32) { if (ctrlCharWidth[ll->chars[charInLine]] == 0) { const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]); // +3 For a blank on front and rounded edge each side: ctrlCharWidth[ll->chars[charInLine]] = - surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3; + surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3; } ll->positions[charInLine + 1] = ctrlCharWidth[ll->chars[charInLine]]; } else { char cc[2] = { static_cast(controlCharSymbol), '\0' }; surface->MeasureWidths(ctrlCharsFont, cc, 1, - ll->positions + startseg + 1); + ll->positions + startseg + 1); } lastSegItalics = false; + } else if (isBadUTF) { + char hexits[3]; + sprintf(hexits, "%2X", ll->chars[charInLine] & 0xff); + ll->positions[charInLine + 1] = + surface->WidthText(ctrlCharsFont, hexits, istrlen(hexits)) + 3; } else { // Regular character int lenSeg = charInLine - startseg + 1; if ((lenSeg == 1) && (' ' == ll->chars[startseg])) { @@ -2066,8 +1892,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou ll->positions[charInLine + 1] = vstyle.styles[ll->styles[charInLine]].spaceWidth; } else { lastSegItalics = vstyle.styles[ll->styles[charInLine]].italic; - surface->MeasureWidths(vstyle.styles[ll->styles[charInLine]].font, ll->chars + startseg, - lenSeg, ll->positions + startseg + 1); + posCache.MeasureWidths(surface, vstyle, ll->styles[charInLine], ll->chars + startseg, + lenSeg, ll->positions + startseg + 1); } } } else { // invisible @@ -2106,8 +1932,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou } ll->lines = 0; // Calculate line start positions based upon width. - // For now this is simplistic - wraps on byte rather than character and - // in the middle of words. Should search for spaces or style changes. int lastGoodBreak = 0; int lastLineStart = 0; int startOffset = 0; @@ -2118,12 +1942,12 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou // Try moving to start of last character if (p > 0) { lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; + - posLineStart; } if (lastGoodBreak == lastLineStart) { // Ensure at least one character on line. lastGoodBreak = pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1) - - posLineStart; + - posLineStart; } } lastLineStart = lastGoodBreak; @@ -2138,7 +1962,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou if (p > 0) { if (wrapState == eWrapChar) { lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; + - posLineStart; p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; continue; } else if (ll->styles[p] != ll->styles[p - 1]) { @@ -2160,7 +1984,7 @@ ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw) { } ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground, - ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) { + ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) { if (inSelection) { if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { return SelectionBackground(vsDraw); @@ -2172,7 +1996,7 @@ ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackgroun return vsDraw.edgecolour.allocated; if (inHotspot && vsDraw.hotspotBackgroundSet) return vsDraw.hotspotBackground.allocated; - if (overrideBackground) + if (overrideBackground && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) return background; } return vsDraw.styles[styleMain].back.allocated; @@ -2182,11 +2006,11 @@ void Editor::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, Point from(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); PRectangle rcCopyArea(start + 1, rcSegment.top, start + 2, rcSegment.bottom); surface->Copy(rcCopyArea, from, - highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); + highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); } void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, - bool isEndMarker, ColourAllocated wrapColour) { + bool isEndMarker, ColourAllocated wrapColour) { surface->PenColour(wrapColour); enum { xa = 1 }; // gap before start @@ -2209,10 +2033,10 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, int yBase; int yDir; void MoveTo(int xRelative, int yRelative) { - surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative); + surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative); } void LineTo(int xRelative, int yRelative) { - surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); + surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); } }; Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1}; @@ -2228,7 +2052,7 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, 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); + y - 2 * dy); } static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) { @@ -2238,9 +2062,9 @@ static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocate } void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll, - int line, int lineEnd, int xStart, int subLine, int subLineStart, - bool overrideBackground, ColourAllocated background, - bool drawWrapMarkEnd, ColourAllocated wrapColour) { + int line, int lineEnd, int xStart, int subLine, int subLineStart, + bool overrideBackground, ColourAllocated background, + bool drawWrapMarkEnd, ColourAllocated wrapColour) { int styleMask = pdoc->stylingBitsMask; PRectangle rcSegment = rcLine; @@ -2251,7 +2075,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin rcSegment.right = xEol + vsDraw.aveCharWidth + xStart; int posLineEnd = pdoc->LineStart(line + 1); bool eolInSelection = (subLine == (ll->lines - 1)) && - (posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd); + (posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd); if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { surface->FillRectangle(rcSegment, SelectionBackground(vsDraw)); @@ -2276,6 +2100,21 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); } + if (vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw)); + } else { + if (overrideBackground) { + surface->FillRectangle(rcSegment, background); + } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); + } else { + surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); + } + if (vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) { + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha); + } + } + if (drawWrapMarkEnd) { PRectangle rcPlace = rcSegment; @@ -2291,8 +2130,99 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin } } +void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under) { + // Draw decorators + const int posLineStart = pdoc->LineStart(line); + const int lineStart = ll->LineStart(subLine); + const int subLineStart = ll->positions[lineStart]; + const int posLineEnd = posLineStart + lineEnd; + + if (!under) { + // Draw indicators + // foreach indicator... + for (int indicnum = 0, mask = 1 << pdoc->stylingBits; mask < 0x100; indicnum++) { + if (!(mask & ll->styleBitsSet)) { + mask <<= 1; + continue; + } + int startPos = -1; + // foreach style pos in line... + for (int indicPos = lineStart; indicPos <= lineEnd; indicPos++) { + // look for starts... + if (startPos < 0) { + // NOT in indicator run, looking for START + if (indicPos < lineEnd && (ll->indicators[indicPos] & mask)) + startPos = indicPos; + } + // ... or ends + if (startPos >= 0) { + // IN indicator run, looking for END + if (indicPos >= lineEnd || !(ll->indicators[indicPos] & mask)) { + // AT end of indicator run, DRAW it! + PRectangle rcIndic( + ll->positions[startPos] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent, + ll->positions[indicPos] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent + 3); + vsDraw.indicators[indicnum].Draw(surface, rcIndic, rcLine); + // RESET control var + startPos = -1; + } + } + } + mask <<= 1; + } + } + + for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { + if (under == vsDraw.indicators[deco->indicator].under) { + int startPos = posLineStart + lineStart; + if (!deco->rs.ValueAt(startPos)) { + startPos = deco->rs.EndRun(startPos); + } + while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) { + int endPos = deco->rs.EndRun(startPos); + if (endPos > posLineEnd) + endPos = posLineEnd; + PRectangle rcIndic( + ll->positions[startPos - posLineStart] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent, + ll->positions[endPos - posLineStart] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent + 3); + vsDraw.indicators[deco->indicator].Draw(surface, rcIndic, rcLine); + startPos = deco->rs.EndRun(endPos); + } + } + } +} + +void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment, + const char *s, ColourAllocated textBack, ColourAllocated textFore, bool twoPhaseDraw) { + if (!twoPhaseDraw) { + surface->FillRectangle(rcSegment, textBack); + } + Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; + int normalCharHeight = surface->Ascent(ctrlCharsFont) - + surface->InternalLeading(ctrlCharsFont); + PRectangle rcCChar = rcSegment; + rcCChar.left = rcCChar.left + 1; + rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; + rcCChar.bottom = rcSegment.top + vsDraw.maxAscent + 1; + PRectangle rcCentral = rcCChar; + rcCentral.top++; + rcCentral.bottom--; + surface->FillRectangle(rcCentral, textFore); + PRectangle rcChar = rcCChar; + rcChar.left++; + rcChar.right--; + surface->DrawTextClipped(rcChar, ctrlCharsFont, + rcSegment.top + vsDraw.maxAscent, s, istrlen(s), + textBack, textFore); +} + void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, - PRectangle rcLine, LineLayout *ll, int subLine) { + PRectangle rcLine, LineLayout *ll, int subLine) { PRectangle rcSegment = rcLine; @@ -2317,7 +2247,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis int marks = pdoc->GetMark(line); for (int markBit = 0; (markBit < 32) && marks; markBit++) { if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) && - (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { background = vsDraw.markers[markBit].back.allocated; overrideBackground = true; } @@ -2330,7 +2260,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis if (marksMasked) { for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) && - (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { overrideBackground = true; background = vsDraw.markers[markBit].back.allocated; } @@ -2341,7 +2271,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis } bool drawWhitespaceBackground = (vsDraw.viewWhitespace != wsInvisible) && - (!overrideBackground) && (vsDraw.whitespaceBackgroundSet); + (!overrideBackground) && (vsDraw.whitespaceBackgroundSet); bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. int indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth; @@ -2357,6 +2287,10 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis lineEnd = ll->LineStart(subLine + 1); } + ColourAllocated wrapColour = vsDraw.styles[STYLE_DEFAULT].fore.allocated; + if (vsDraw.whitespaceForegroundSet) + wrapColour = vsDraw.whitespaceForeground.allocated; + bool drawWrapMarkEnd = false; if (wrapVisualFlags & SC_WRAPVISUALFLAG_END) { @@ -2380,7 +2314,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis rcPlace.right = rcPlace.left + actualWrapVisualStartIndent * vsDraw.aveCharWidth; // default bgnd here.. - surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); + surface->FillRectangle(rcSegment, overrideBackground ? background : + vsDraw.styles[STYLE_DEFAULT].back.allocated); // main line style would be below but this would be inconsistent with end markers // also would possibly not be the style at wrap point @@ -2394,273 +2329,283 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis else rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; - DrawWrapMarker(surface, rcPlace, false, vsDraw.whitespaceForeground.allocated); + DrawWrapMarker(surface, rcPlace, false, wrapColour); } xStart += actualWrapVisualStartIndent * vsDraw.aveCharWidth; } } - int i; + // Does not take margin into account but not significant + int xStartVisible = subLineStart - xStart; + + BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); + int next = bfBack.First(); // Background drawing loop - for (i = lineStart; twoPhaseDraw && (i < lineEnd); i++) { + while (twoPhaseDraw && (next < lineEnd)) { + startseg = next; + next = bfBack.Next(); + int i = next - 1; int iDoc = i + posLineStart; - // If there is the end of a style run for any reason - if ((ll->styles[i] != ll->styles[i + 1]) || - i == (lineEnd - 1) || - IsControlCharacter(ll->chars[i]) || IsControlCharacter(ll->chars[i + 1]) || - ((ll->selStart != ll->selEnd) && ((iDoc + 1 == ll->selStart) || (iDoc + 1 == ll->selEnd))) || - (i == (ll->edgeColumn - 1))) { - rcSegment.left = ll->positions[startseg] + xStart - subLineStart; - rcSegment.right = ll->positions[i + 1] + xStart - subLineStart; - // Only try to draw if really visible - enhances performance by not calling environment to - // draw strings that are completely past the right side of the window. - if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { - int styleMain = ll->styles[i]; - bool inSelection = (iDoc >= ll->selStart) && (iDoc < ll->selEnd) && (ll->selStart != ll->selEnd); - bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); - ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); - if (ll->chars[i] == '\t') { - // Tab display - if (drawWhitespaceBackground && - (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) - textBack = vsDraw.whitespaceBackground.allocated; - surface->FillRectangle(rcSegment, textBack); - } else if (IsControlCharacter(ll->chars[i])) { - // Control character display - inIndentation = false; - surface->FillRectangle(rcSegment, textBack); - } else { - // Normal text display - surface->FillRectangle(rcSegment, textBack); - if (vsDraw.viewWhitespace != wsInvisible || - (inIndentation && vsDraw.viewIndentationGuides)) { - for (int cpos = 0; cpos <= i - startseg; cpos++) { - if (ll->chars[cpos + startseg] == ' ') { - if (drawWhitespaceBackground && - (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { - PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, - ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom); - surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground.allocated); - } - } else { - inIndentation = false; + + rcSegment.left = ll->positions[startseg] + xStart - subLineStart; + rcSegment.right = ll->positions[i + 1] + xStart - subLineStart; + // Only try to draw if really visible - enhances performance by not calling environment to + // draw strings that are completely past the right side of the window. + if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { + // Clip to line rectangle, since may have a huge position which will not work with some platforms + rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); + rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); + + int styleMain = ll->styles[i]; + bool inSelection = (iDoc >= ll->selStart) && (iDoc < ll->selEnd) && (ll->selStart != ll->selEnd); + bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); + ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); + if (ll->chars[i] == '\t') { + // Tab display + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) + textBack = vsDraw.whitespaceBackground.allocated; + surface->FillRectangle(rcSegment, textBack); + } else if (IsControlCharacter(ll->chars[i])) { + // Control character display + inIndentation = false; + surface->FillRectangle(rcSegment, textBack); + } else { + // Normal text display + surface->FillRectangle(rcSegment, textBack); + if (vsDraw.viewWhitespace != wsInvisible || + (inIndentation && vsDraw.viewIndentationGuides == ivReal)) { + for (int cpos = 0; cpos <= i - startseg; cpos++) { + if (ll->chars[cpos + startseg] == ' ') { + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { + PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, + ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom); + surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground.allocated); } + } else { + inIndentation = false; } } } - } else if (rcSegment.left > rcLine.right) { - break; } - startseg = i + 1; + } else if (rcSegment.left > rcLine.right) { + break; } } if (twoPhaseDraw) { DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd, xStart, subLine, subLineStart, overrideBackground, background, - drawWrapMarkEnd, vsDraw.whitespaceForeground.allocated); + drawWrapMarkEnd, wrapColour); + } + + DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, true); + + if (vsDraw.edgeState == EDGE_LINE) { + int edgeX = theEdge * vsDraw.spaceWidth; + rcSegment.left = edgeX + xStart; + rcSegment.right = rcSegment.left + 1; + surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated); } inIndentation = subLine == 0; // Do not handle indentation except on first subline. - startseg = ll->LineStart(subLine); // Foreground drawing loop - for (i = lineStart; i < lineEnd; i++) { + BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); + next = bfFore.First(); + + while (next < lineEnd) { + + startseg = next; + next = bfFore.Next(); + int i = next - 1; int iDoc = i + posLineStart; - // If there is the end of a style run for any reason - if ((ll->styles[i] != ll->styles[i + 1]) || - i == (lineEnd - 1) || - IsControlCharacter(ll->chars[i]) || IsControlCharacter(ll->chars[i + 1]) || - ((ll->selStart != ll->selEnd) && ((iDoc + 1 == ll->selStart) || (iDoc + 1 == ll->selEnd))) || - (i == (ll->edgeColumn - 1))) { - rcSegment.left = ll->positions[startseg] + xStart - subLineStart; - rcSegment.right = ll->positions[i + 1] + xStart - subLineStart; - // Only try to draw if really visible - enhances performance by not calling environment to - // draw strings that are completely past the right side of the window. - if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { - int styleMain = ll->styles[i]; - ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated; - Font &textFont = vsDraw.styles[styleMain].font; - //hotspot foreground - if (ll->hsStart != -1 && iDoc >= ll->hsStart && iDoc < hsEnd) { - if (vsDraw.hotspotForegroundSet) - textFore = vsDraw.hotspotForeground.allocated; + + rcSegment.left = ll->positions[startseg] + xStart - subLineStart; + rcSegment.right = ll->positions[i + 1] + xStart - subLineStart; + // Only try to draw if really visible - enhances performance by not calling environment to + // draw strings that are completely past the right side of the window. + if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { + int styleMain = ll->styles[i]; + ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated; + Font &textFont = vsDraw.styles[styleMain].font; + //hotspot foreground + if (ll->hsStart != -1 && iDoc >= ll->hsStart && iDoc < hsEnd) { + if (vsDraw.hotspotForegroundSet) + textFore = vsDraw.hotspotForeground.allocated; + } + bool inSelection = (iDoc >= ll->selStart) && (iDoc < ll->selEnd) && (ll->selStart != ll->selEnd); + if (inSelection && (vsDraw.selforeset)) { + textFore = vsDraw.selforeground.allocated; + } + bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); + ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); + if (ll->chars[i] == '\t') { + // Tab display + if (!twoPhaseDraw) { + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) + textBack = vsDraw.whitespaceBackground.allocated; + surface->FillRectangle(rcSegment, textBack); } - bool inSelection = (iDoc >= ll->selStart) && (iDoc < ll->selEnd) && (ll->selStart != ll->selEnd); - if (inSelection && (vsDraw.selforeset)) { - textFore = vsDraw.selforeground.allocated; + if ((vsDraw.viewWhitespace != wsInvisible) || + (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { + if (vsDraw.whitespaceForegroundSet) + textFore = vsDraw.whitespaceForeground.allocated; + surface->PenColour(textFore); } - bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); - ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); - if (ll->chars[i] == '\t') { - // Tab display - if (!twoPhaseDraw) { - if (drawWhitespaceBackground && - (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) - textBack = vsDraw.whitespaceBackground.allocated; - surface->FillRectangle(rcSegment, textBack); - } - if ((vsDraw.viewWhitespace != wsInvisible) || ((inIndentation && vsDraw.viewIndentationGuides))) { - if (vsDraw.whitespaceForegroundSet) - textFore = vsDraw.whitespaceForeground.allocated; - surface->PenColour(textFore); - } - if (inIndentation && vsDraw.viewIndentationGuides) { - for (int xIG = ll->positions[i] / indentWidth * indentWidth; xIG < ll->positions[i + 1]; xIG += indentWidth) { - if (xIG >= ll->positions[i] && xIG > 0) { - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIG + xStart, rcSegment, - (ll->xHighlightGuide == xIG)); - } - } - } - if (vsDraw.viewWhitespace != wsInvisible) { - if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { - PRectangle rcTab(rcSegment.left + 1, rcSegment.top + 4, - rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); - DrawTabArrow(surface, rcTab, rcSegment.top + vsDraw.lineHeight / 2); + if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { + for (int xIG = ll->positions[i] / indentWidth * indentWidth; xIG < ll->positions[i + 1]; xIG += indentWidth) { + if (xIG >= ll->positions[i] && xIG > 0) { + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIG + xStart, rcSegment, + (ll->xHighlightGuide == xIG)); } } - } else if (IsControlCharacter(ll->chars[i])) { - // Control character display - inIndentation = false; - if (controlCharSymbol < 32) { - // Draw the character - const char *ctrlChar = ControlCharacterString(ll->chars[i]); - if (!twoPhaseDraw) { - surface->FillRectangle(rcSegment, textBack); - } - int normalCharHeight = surface->Ascent(ctrlCharsFont) - - surface->InternalLeading(ctrlCharsFont); - PRectangle rcCChar = rcSegment; - rcCChar.left = rcCChar.left + 1; - rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; - rcCChar.bottom = rcSegment.top + vsDraw.maxAscent + 1; - PRectangle rcCentral = rcCChar; - rcCentral.top++; - rcCentral.bottom--; - surface->FillRectangle(rcCentral, textFore); - PRectangle rcChar = rcCChar; - rcChar.left++; - rcChar.right--; - surface->DrawTextClipped(rcChar, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, ctrlChar, istrlen(ctrlChar), - textBack, textFore); - } else { - char cc[2] = { static_cast(controlCharSymbol), '\0' }; - surface->DrawTextNoClip(rcSegment, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, - cc, 1, textBack, textFore); + } + if (vsDraw.viewWhitespace != wsInvisible) { + if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { + PRectangle rcTab(rcSegment.left + 1, rcSegment.top + 4, + rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); + DrawTabArrow(surface, rcTab, rcSegment.top + vsDraw.lineHeight / 2); } + } + } else if (IsControlCharacter(ll->chars[i])) { + // Control character display + inIndentation = false; + if (controlCharSymbol < 32) { + // Draw the character + const char *ctrlChar = ControlCharacterString(ll->chars[i]); + DrawTextBlob(surface, vsDraw, rcSegment, ctrlChar, textBack, textFore, twoPhaseDraw); } else { - // Normal text display - if (vsDraw.styles[styleMain].visible) { - if (twoPhaseDraw) { - surface->DrawTextTransparent(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, - i - startseg + 1, textFore); - } else { - surface->DrawTextNoClip(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, - i - startseg + 1, textFore, textBack); - } + char cc[2] = { static_cast(controlCharSymbol), '\0' }; + surface->DrawTextNoClip(rcSegment, ctrlCharsFont, + rcSegment.top + vsDraw.maxAscent, + cc, 1, textBack, textFore); + } + } else if ((i == startseg) && (static_cast(ll->chars[i]) >= 0x80) && IsUnicodeMode()) { + char hexits[3]; + sprintf(hexits, "%2X", ll->chars[i] & 0xff); + DrawTextBlob(surface, vsDraw, rcSegment, hexits, textBack, textFore, twoPhaseDraw); + } else { + // Normal text display + if (vsDraw.styles[styleMain].visible) { + if (twoPhaseDraw) { + surface->DrawTextTransparent(rcSegment, textFont, + rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, + i - startseg + 1, textFore); + } else { + surface->DrawTextNoClip(rcSegment, textFont, + rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, + i - startseg + 1, textFore, textBack); } - if (vsDraw.viewWhitespace != wsInvisible || - (inIndentation && vsDraw.viewIndentationGuides)) { - for (int cpos = 0; cpos <= i - startseg; cpos++) { - if (ll->chars[cpos + startseg] == ' ') { - if (vsDraw.viewWhitespace != wsInvisible) { - if (vsDraw.whitespaceForegroundSet) - textFore = vsDraw.whitespaceForeground.allocated; - if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { - int xmid = (ll->positions[cpos + startseg] + ll->positions[cpos + startseg + 1]) / 2; - if (!twoPhaseDraw && drawWhitespaceBackground && - (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { - textBack = vsDraw.whitespaceBackground.allocated; - PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom); - surface->FillRectangle(rcSpace, textBack); - } - PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0); - rcDot.right = rcDot.left + 1; - rcDot.bottom = rcDot.top + 1; - surface->FillRectangle(rcDot, textFore); + } + if (vsDraw.viewWhitespace != wsInvisible || + (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { + for (int cpos = 0; cpos <= i - startseg; cpos++) { + if (ll->chars[cpos + startseg] == ' ') { + if (vsDraw.viewWhitespace != wsInvisible) { + if (vsDraw.whitespaceForegroundSet) + textFore = vsDraw.whitespaceForeground.allocated; + if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { + int xmid = (ll->positions[cpos + startseg] + ll->positions[cpos + startseg + 1]) / 2; + if (!twoPhaseDraw && drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { + textBack = vsDraw.whitespaceBackground.allocated; + PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom); + surface->FillRectangle(rcSpace, textBack); } + PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0); + rcDot.right = rcDot.left + 1; + rcDot.bottom = rcDot.top + 1; + surface->FillRectangle(rcDot, textFore); } - if (inIndentation && vsDraw.viewIndentationGuides) { - int startSpace = ll->positions[cpos + startseg]; - if (startSpace > 0 && (startSpace % indentWidth == 0)) { - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, startSpace + xStart, rcSegment, - (ll->xHighlightGuide == ll->positions[cpos + startseg])); - } + } + if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { + int startSpace = ll->positions[cpos + startseg]; + if (startSpace > 0 && (startSpace % indentWidth == 0)) { + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, startSpace + xStart, rcSegment, + (ll->xHighlightGuide == ll->positions[cpos + startseg])); } - } else { - inIndentation = false; } + } else { + inIndentation = false; } } } - if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd ) { - PRectangle rcUL = rcSegment; - rcUL.top = rcUL.top + vsDraw.maxAscent + 1; - rcUL.bottom = rcUL.top + 1; - if (vsDraw.hotspotForegroundSet) - surface->FillRectangle(rcUL, vsDraw.hotspotForeground.allocated); - else - surface->FillRectangle(rcUL, textFore); - } else if (vsDraw.styles[styleMain].underline) { - PRectangle rcUL = rcSegment; - rcUL.top = rcUL.top + vsDraw.maxAscent + 1; - rcUL.bottom = rcUL.top + 1; + } + if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd ) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + if (vsDraw.hotspotForegroundSet) + surface->FillRectangle(rcUL, vsDraw.hotspotForeground.allocated); + else surface->FillRectangle(rcUL, textFore); - } - } else if (rcSegment.left > rcLine.right) { - break; + } else if (vsDraw.styles[styleMain].underline) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + surface->FillRectangle(rcUL, textFore); } - startseg = i + 1; + } else if (rcSegment.left > rcLine.right) { + break; } } + if ((vsDraw.viewIndentationGuides == ivLookForward || vsDraw.viewIndentationGuides == ivLookBoth) + && (subLine == 0)) { + int indentSpace = pdoc->GetLineIndentation(line); + // Find the most recent line with some text - // Draw indicators - // foreach indicator... - for (int indicnum = 0, mask = 1 << pdoc->stylingBits; mask < 0x100; indicnum++) { - if (!(mask & ll->styleBitsSet)) { - mask <<= 1; - continue; - } - int startPos = -1; - // foreach style pos in line... - for (int indicPos = lineStart; indicPos <= lineEnd; indicPos++) { - // look for starts... - if (startPos < 0) { - // NOT in indicator run, looking for START - if (indicPos < lineEnd && (ll->indicators[indicPos] & mask)) - startPos = indicPos; + int lineLastWithText = line; + while (lineLastWithText > 0 && pdoc->IsWhiteLine(lineLastWithText)) { + lineLastWithText--; + } + if (lineLastWithText < line) { + // This line is empty, so use indentation of last line with text + int indentLastWithText = pdoc->GetLineIndentation(lineLastWithText); + int isFoldHeader = pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG; + if (isFoldHeader) { + // Level is one more level than parent + indentLastWithText += pdoc->IndentSize(); } - // ... or ends - if (startPos >= 0) { - // IN indicator run, looking for END - if (indicPos >= lineEnd || !(ll->indicators[indicPos] & mask)) { - // AT end of indicator run, DRAW it! - PRectangle rcIndic( - ll->positions[startPos] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent, - ll->positions[indicPos] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent + 3); - vsDraw.indicators[indicnum].Draw(surface, rcIndic, rcLine); - // RESET control var - startPos = -1; + if (vsDraw.viewIndentationGuides == ivLookForward) { + // In viLookForward mode, previous line only used if it is a fold header + if (isFoldHeader) { + indentSpace = Platform::Maximum(indentSpace, indentLastWithText); } + } else { // viLookBoth + indentSpace = Platform::Maximum(indentSpace, indentLastWithText); } } - mask <<= 1; + + int lineNextWithText = line; + while (lineNextWithText < pdoc->LinesTotal() && pdoc->IsWhiteLine(lineNextWithText)) { + lineNextWithText++; + } + if (lineNextWithText > line) { + // This line is empty, so use indentation of last line with text + indentSpace = Platform::Maximum(indentSpace, + pdoc->GetLineIndentation(lineNextWithText)); + } + + for (int indentPos = pdoc->IndentSize(); indentPos < indentSpace; indentPos += pdoc->IndentSize()) { + int xIndent = indentPos * vsDraw.spaceWidth; + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, + (ll->xHighlightGuide == xIndent)); + } } + + DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, false); + // End of the drawing of the current line if (!twoPhaseDraw) { DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd, xStart, subLine, subLineStart, overrideBackground, background, - drawWrapMarkEnd, vsDraw.whitespaceForeground.allocated); + drawWrapMarkEnd, wrapColour); } if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) && (ll->selStart >= 0) && (ll->selEnd >= 0)) { int startPosSel = (ll->selStart < posLineStart) ? posLineStart : ll->selStart; @@ -2668,17 +2613,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis if (startPosSel < endPosSel) { rcSegment.left = xStart + ll->positions[startPosSel - posLineStart] - subLineStart; rcSegment.right = xStart + ll->positions[endPosSel - posLineStart] - subLineStart; + rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); + rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha); } } - if (vsDraw.edgeState == EDGE_LINE) { - int edgeX = theEdge * vsDraw.spaceWidth; - rcSegment.left = edgeX + xStart; - rcSegment.right = rcSegment.left + 1; - surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated); - } - // Draw any translucent whole line states rcSegment.left = xStart; rcSegment.right = rcLine.right - 1; @@ -2705,6 +2645,61 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis } } +void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret) { + + int lineStart = ll->LineStart(subLine); + int posBefore = posCaret; + int posAfter = MovePositionOutsideChar(posCaret + 1, 1); + int numCharsToDraw = posAfter - posCaret; + + // Work out where the starting and ending offsets are. We need to + // see if the previous character shares horizontal space, such as a + // glyph / combining character. If so we'll need to draw that too. + int offsetFirstChar = offset; + int offsetLastChar = offset + (posAfter - posCaret); + while ((offsetLastChar - numCharsToDraw) >= lineStart) { + if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - numCharsToDraw]) > 0) { + // The char does not share horizontal space + break; + } + // Char shares horizontal space, update the numChars to draw + // Update posBefore to point to the prev char + posBefore = MovePositionOutsideChar(posBefore - 1, -1); + numCharsToDraw = posAfter - posBefore; + offsetFirstChar = offset - (posCaret - posBefore); + } + + // See if the next character shares horizontal space, if so we'll + // need to draw that too. + numCharsToDraw = offsetLastChar - offsetFirstChar; + while ((offsetLastChar < ll->LineStart(subLine + 1)) && (offsetLastChar <= ll->numCharsInLine)) { + // Update posAfter to point to the 2nd next char, this is where + // the next character ends, and 2nd next begins. We'll need + // to compare these two + posBefore = posAfter; + posAfter = MovePositionOutsideChar(posAfter + 1, 1); + offsetLastChar = offset + (posAfter - posCaret); + if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - (posAfter - posBefore)]) > 0) { + // The char does not share horizontal space + break; + } + // Char shares horizontal space, update the numChars to draw + numCharsToDraw = offsetLastChar - offsetFirstChar; + } + + // We now know what to draw, update the caret drawing rectangle + rcCaret.left = ll->positions[offsetFirstChar] - ll->positions[ll->LineStart(subLine)] + xStart; + rcCaret.right = ll->positions[offsetFirstChar+numCharsToDraw] - ll->positions[ll->LineStart(subLine)] + xStart; + + // This character is where the caret block is, we override the colours + // (inversed) for drawing the caret here. + int styleMain = ll->styles[offsetFirstChar]; + surface->DrawTextClipped(rcCaret, vsDraw.styles[styleMain].font, + rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar, + numCharsToDraw, vsDraw.styles[styleMain].back.allocated, + vsDraw.caretcolour.allocated); +} + void Editor::RefreshPixMaps(Surface *surfaceWindow) { if (!pixmapSelPattern->Initialised()) { const int patternSize = 8; @@ -2764,9 +2759,9 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) { if (!pixmapLine->Initialised()) { PRectangle rcClient = GetClientRectangle(); pixmapLine->InitPixMap(rcClient.Width(), vs.lineHeight, - surfaceWindow, wMain.GetID()); + surfaceWindow, wMain.GetID()); pixmapSelMargin->InitPixMap(vs.fixedColumnWidth, - rcClient.Height(), surfaceWindow, wMain.GetID()); + rcClient.Height(), surfaceWindow, wMain.GetID()); } } } @@ -2927,7 +2922,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { Range rangeLine(pdoc->LineStart(lineDoc), pdoc->LineStart(lineDoc + 1)); // Highlight the current braces if any ll->SetBracesHighlight(rangeLine, braces, static_cast(bracesMatchStyle), - highlightGuideColumn * vs.spaceWidth); + highlightGuideColumn * vs.spaceWidth); // Draw the line DrawLine(surface, vs, lineDoc, visibleLine, xStart, rcLine, ll, subLine); @@ -2997,8 +2992,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { // Draw the Caret if (lineDoc == lineCaret) { int offset = Platform::Minimum(posCaret - rangeLine.start, ll->maxLineLength); - if ((offset >= ll->LineStart(subLine)) && - ((offset < ll->LineStart(subLine + 1)) || offset == ll->numCharsInLine)) { + if (ll->InLine(offset, subLine)) { int xposCaret = ll->positions[offset] - ll->positions[ll->LineStart(subLine)] + xStart; if (actualWrapVisualStartIndent != 0) { @@ -3006,35 +3000,57 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { if (lineStart != 0) // Wrapped xposCaret += actualWrapVisualStartIndent * vs.aveCharWidth; } - int widthOverstrikeCaret; - if (posCaret == pdoc->Length()) { // At end of document - widthOverstrikeCaret = vs.aveCharWidth; - } else if ((posCaret - rangeLine.start) >= ll->numCharsInLine) { // At end of line - widthOverstrikeCaret = vs.aveCharWidth; - } else { - widthOverstrikeCaret = ll->positions[offset + 1] - ll->positions[offset]; - } - if (widthOverstrikeCaret < 3) // Make sure its visible - widthOverstrikeCaret = 3; - if (((caret.active && caret.on) || (posDrag >= 0)) && xposCaret >= 0) { - PRectangle rcCaret = rcLine; + if ((xposCaret >= 0) && (vs.caretWidth > 0) && (vs.caretStyle != CARETSTYLE_INVISIBLE) && + ((posDrag >= 0) || (caret.active && caret.on))) { + bool caretAtEOF = false; + bool caretAtEOL = false; + bool drawBlockCaret = false; + int widthOverstrikeCaret; int caretWidthOffset = 0; - if ((offset > 0) && (vs.caretWidth > 1)) + PRectangle rcCaret = rcLine; + + if (posCaret == pdoc->Length()) { // At end of document + caretAtEOF = true; + widthOverstrikeCaret = vs.aveCharWidth; + } else if ((posCaret - rangeLine.start) >= ll->numCharsInLine) { // At end of line + caretAtEOL = true; + widthOverstrikeCaret = vs.aveCharWidth; + } else { + widthOverstrikeCaret = ll->positions[offset + 1] - ll->positions[offset]; + } + if (widthOverstrikeCaret < 3) // Make sure its visible + widthOverstrikeCaret = 3; + + if (offset > ll->LineStart(subLine)) caretWidthOffset = 1; // Move back so overlaps both character cells. if (posDrag >= 0) { + /* Dragging text, use a line caret */ rcCaret.left = xposCaret - caretWidthOffset; rcCaret.right = rcCaret.left + vs.caretWidth; - } else { - if (inOverstrike) { - rcCaret.top = rcCaret.bottom - 2; - rcCaret.left = xposCaret + 1; - rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1; + } else if (inOverstrike) { + /* Overstrike (insert mode), use a modified bar caret */ + rcCaret.top = rcCaret.bottom - 2; + rcCaret.left = xposCaret + 1; + rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1; + } else if (vs.caretStyle == CARETSTYLE_BLOCK) { + /* Block caret */ + rcCaret.left = xposCaret; + if (!caretAtEOL && !caretAtEOF && (ll->chars[offset] != '\t') && !(IsControlCharacter(ll->chars[offset]))) { + drawBlockCaret = true; + rcCaret.right = xposCaret + widthOverstrikeCaret; } else { - rcCaret.left = xposCaret - caretWidthOffset; - rcCaret.right = rcCaret.left + vs.caretWidth; + rcCaret.right = xposCaret + vs.aveCharWidth; } + } else { + /* Line caret */ + rcCaret.left = xposCaret - caretWidthOffset; + rcCaret.right = rcCaret.left + vs.caretWidth; + } + if (drawBlockCaret) { + DrawBlockCaret(surface, vs, ll, subLine, xStart, offset, posCaret, rcCaret); + } else { + surface->FillRectangle(rcCaret, vs.caretcolour.allocated); } - surface->FillRectangle(rcCaret, vs.caretcolour.allocated); } } } @@ -3042,7 +3058,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { if (bufferedDraw) { Point from(vs.fixedColumnWidth, 0); PRectangle rcCopyArea(vs.fixedColumnWidth, yposScreen, - rcClient.right, yposScreen + vs.lineHeight); + rcClient.right, yposScreen + vs.lineHeight); surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); } //durCopy += et.Duration(true); @@ -3054,6 +3070,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { yposScreen += vs.lineHeight; visibleLine++; + + lineWidthMaxSeen = Platform::Maximum( + lineWidthMaxSeen, ll->positions[ll->numCharsInLine]); //gdk_flush(); } ll.Set(0); @@ -3113,6 +3132,9 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { return 0; } + // Can't use measurements cached for screen + posCache.Clear(); + ViewStyle vsPrint(vs); // Modify the view style for printing as do not normally want any of the transient features to be printed @@ -3128,7 +3150,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { vsPrint.showMarkedLines = false; vsPrint.fixedColumnWidth = 0; vsPrint.zoomLevel = printMagnification; - vsPrint.viewIndentationGuides = false; + vsPrint.viewIndentationGuides = ivNone; // Don't show the selection when printing vsPrint.selbackset = false; vsPrint.selforeset = false; @@ -3138,7 +3160,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { vsPrint.showCaretLineBackground = false; // Set colours for printing according to users settings - for (int sty = 0;sty <= STYLE_MAX;sty++) { + for (size_t sty = 0;sty < vsPrint.stylesSize;sty++) { if (printColourMode == SC_PRINT_INVERTLIGHT) { vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired); vsPrint.styles[sty].back.desired = InvertedLight(vsPrint.styles[sty].back.desired); @@ -3157,16 +3179,17 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { vsPrint.styles[STYLE_LINENUMBER].back.desired = ColourDesired(0xff, 0xff, 0xff); vsPrint.Refresh(*surfaceMeasure); - // Ensure colours are set up - vsPrint.RefreshColourPalette(palette, true); - vsPrint.RefreshColourPalette(palette, false); // Determining width must hapen after fonts have been realised in Refresh int lineNumberWidth = 0; if (lineNumberIndex >= 0) { lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, - "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace)); + "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace)); vsPrint.ms[lineNumberIndex].width = lineNumberWidth; + vsPrint.Refresh(*surfaceMeasure); // Recalculate fixedColumnWidth } + // Ensure colours are set up + vsPrint.RefreshColourPalette(palette, true); + vsPrint.RefreshColourPalette(palette, false); int linePrintStart = pdoc->LineFromPosition(pfr->chrg.cpMin); int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; @@ -3185,14 +3208,14 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { // Ensure we are styled to where we are formatting. pdoc->EnsureStyledTo(endPosPrint); - int xStart = vsPrint.fixedColumnWidth + pfr->rc.left + lineNumberWidth; + int xStart = vsPrint.fixedColumnWidth + pfr->rc.left; int ypos = pfr->rc.top; int lineDoc = linePrintStart; int nPrintPos = pfr->chrg.cpMin; int visibleLine = 0; - int widthPrint = pfr->rc.Width() - lineNumberWidth; + int widthPrint = pfr->rc.Width() - vsPrint.fixedColumnWidth; if (printWrapState == eWrapNone) widthPrint = LineLayout::wrapWidthInfinite; @@ -3214,7 +3237,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { ll.containsCaret = false; PRectangle rcLine; - rcLine.left = pfr->rc.left + lineNumberWidth; + rcLine.left = pfr->rc.left; rcLine.top = ypos; rcLine.right = pfr->rc.right - 1; rcLine.bottom = ypos + vsPrint.lineHeight; @@ -3243,13 +3266,13 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { PRectangle rcNumber = rcLine; rcNumber.right = rcNumber.left + lineNumberWidth; // Right justify - rcNumber.left -= surfaceMeasure->WidthText( - vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number)); + rcNumber.left = rcNumber.right - surfaceMeasure->WidthText( + vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number)); surface->FlushCachedState(); surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, - ypos + vsPrint.maxAscent, number, istrlen(number), - vsPrint.styles[STYLE_LINENUMBER].fore.allocated, - vsPrint.styles[STYLE_LINENUMBER].back.allocated); + ypos + vsPrint.maxAscent, number, istrlen(number), + vsPrint.styles[STYLE_LINENUMBER].fore.allocated, + vsPrint.styles[STYLE_LINENUMBER].back.allocated); } // Draw the line @@ -3276,6 +3299,9 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) { ++lineDoc; } + // Clear cache so measurements are not used for screen + posCache.Clear(); + return nPrintPos; } @@ -3337,6 +3363,7 @@ void Editor::AddChar(char ch) { AddCharUTF(s, 1); } +// AddCharUTF inserts an array of bytes which may or may not be in UTF-8. void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { bool wasSelection = currentPos != anchor; ClearSelection(); @@ -3356,6 +3383,14 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { if (charReplaceAction) { pdoc->EndUndoAction(); } + // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information + if (wrapState != eWrapNone) { + AutoSurface surface(this); + if (surface) { + WrapOneLine(surface, pdoc->LineFromPosition(currentPos)); + } + SetScrollBars(); + } EnsureCaretVisible(); // Avoid blinking during rapid typing: ShowCaretAtCurrentPosition(); @@ -3365,7 +3400,7 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { if (treatAsDBCS) { NotifyChar((static_cast(s[0]) << 8) | - static_cast(s[1])); + static_cast(s[1])); } else { int byte = static_cast(s[0]); if ((byte < 0xC0) || (1 == len)) { @@ -3452,6 +3487,7 @@ void Editor::ClearDocumentStyle() { } void Editor::Cut() { + pdoc->CheckReadOnly(); if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) { Copy(); ClearSelection(); @@ -3615,9 +3651,13 @@ void Editor::NotifyModifyAttempt() { NotifyParent(scn); } -void Editor::NotifyDoubleClick(Point, bool) { +void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { SCNotification scn = {0}; scn.nmhdr.code = SCN_DOUBLECLICK; + scn.line = LineFromLocation(pt); + scn.position = PositionFromLocationClose(pt); + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0); NotifyParent(scn); } @@ -3626,7 +3666,7 @@ void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, boo scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; scn.position = position; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); NotifyParent(scn); } @@ -3635,7 +3675,7 @@ void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) scn.nmhdr.code = SCN_HOTSPOTCLICK; scn.position = position; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); NotifyParent(scn); } @@ -3651,6 +3691,18 @@ void Editor::NotifyPainted() { NotifyParent(scn); } +void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt) { + int mask = pdoc->decorations.AllOnFor(position); + if ((click && mask) || pdoc->decorations.clickNotified) { + SCNotification scn = {0}; + pdoc->decorations.clickNotified = click; + scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE; + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0); + scn.position = position; + NotifyParent(scn); + } +} + bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { int marginClicked = -1; int x = 0; @@ -3663,7 +3715,7 @@ bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { SCNotification scn = {0}; scn.nmhdr.code = SCN_MARGINCLICK; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); scn.position = pdoc->LineStart(LineFromLocation(pt)); scn.margin = marginClicked; NotifyParent(scn); @@ -3715,7 +3767,7 @@ void Editor::NotifySavePoint(Document*, void *, bool atSavePoint) { } void Editor::CheckModificationForWrap(DocModification mh) { - if (mh.modificationType & (SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT)) { + if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { llc.Invalidate(LineLayout::llCheckTextAndStyle); if (wrapState != eWrapNone) { int lineDoc = pdoc->LineFromPosition(mh.position); @@ -3753,8 +3805,19 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { if (paintState == painting) { CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); } - if (mh.modificationType & SC_MOD_CHANGESTYLE) { - pdoc->IncrementStyleClock(); + if (mh.modificationType & SC_MOD_CHANGELINESTATE) { + if (paintState == painting) { + CheckForChangeOutsidePaint( + Range(pdoc->LineStart(mh.line), pdoc->LineStart(mh.line + 1))); + } else { + // Could check that change is before last visible line. + Redraw(); + } + } + if (mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) { + if (mh.modificationType & SC_MOD_CHANGESTYLE) { + pdoc->IncrementStyleClock(); + } if (paintState == notPainting) { if (mh.position < pdoc->LineStart(topLine)) { // Styling performed before this view @@ -3763,7 +3826,9 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { InvalidateRange(mh.position, mh.position + mh.length); } } - llc.Invalidate(LineLayout::llCheckTextAndStyle); + if (mh.modificationType & SC_MOD_CHANGESTYLE) { + llc.Invalidate(LineLayout::llCheckTextAndStyle); + } } else { // Move selection and brace highlights if (mh.modificationType & SC_MOD_INSERTTEXT) { @@ -3845,7 +3910,7 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { // If client wants to see this modification if (mh.modificationType & modEventMask) { - if ((mh.modificationType & SC_MOD_CHANGESTYLE) == 0) { + if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { // Real modification made to text of document. NotifyChange(); // Send EN_CHANGE } @@ -3943,6 +4008,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar case SCI_VCHOMEWRAPEXTEND: case SCI_DELWORDLEFT: case SCI_DELWORDRIGHT: + case SCI_DELWORDRIGHTEND: case SCI_DELLINELEFT: case SCI_DELLINERIGHT: case SCI_LINECOPY: @@ -3972,8 +4038,8 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar case SCI_SELECTIONDUPLICATE: break; - // Filter out all others like display changes. Also, newlines are redundant - // with char insert messages. + // Filter out all others like display changes. Also, newlines are redundant + // with char insert messages. case SCI_NEWLINE: default: // printf("Filtered out %ld of macro recording\n", iMessage); @@ -4001,7 +4067,10 @@ void Editor::PageMove(int direction, selTypes sel, bool stuttered) { // I consider only the caretYSlop, and ignore the caretYPolicy-- is that a problem? int currentLine = pdoc->LineFromPosition(currentPos); int topStutterLine = topLine + caretYSlop; - int bottomStutterLine = topLine + LinesToScroll() - caretYSlop; + int bottomStutterLine = + pdoc->LineFromPosition(PositionFromLocation( + Point(lastXChosen, direction * vs.lineHeight * LinesToScroll()))) + - caretYSlop - 1; if (stuttered && (direction < 0 && currentLine > topStutterLine)) { topLineNew = topLine; @@ -4015,9 +4084,9 @@ void Editor::PageMove(int direction, selTypes sel, bool stuttered) { Point pt = LocationFromPosition(currentPos); topLineNew = Platform::Clamp( - topLine + direction * LinesToScroll(), 0, MaxScrollPos()); + topLine + direction * LinesToScroll(), 0, MaxScrollPos()); newPos = PositionFromLocation( - Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll()))); + Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll()))); } if (topLineNew != topLine) { @@ -4036,7 +4105,7 @@ void Editor::ChangeCaseOfSelection(bool makeUpperCase) { int startAnchor = anchor; if (selType == selStream) { pdoc->ChangeCase(Range(SelectionStart(), SelectionEnd()), - makeUpperCase); + makeUpperCase); SetSelection(startCurrent, startAnchor); } else { SelectionLineIterator lineIterator(this, false); @@ -4054,32 +4123,23 @@ void Editor::ChangeCaseOfSelection(bool makeUpperCase) { void Editor::LineTranspose() { int line = pdoc->LineFromPosition(currentPos); if (line > 0) { + pdoc->BeginUndoAction(); int startPrev = pdoc->LineStart(line - 1); int endPrev = pdoc->LineEnd(line - 1); int start = pdoc->LineStart(line); int end = pdoc->LineEnd(line); - int startNext = pdoc->LineStart(line + 1); - if (end < pdoc->Length()) { - end = startNext; - char *thisLine = CopyRange(start, end); - pdoc->DeleteChars(start, end - start); - if (pdoc->InsertString(startPrev, thisLine, end - start)) { - MovePositionTo(startPrev + end - start); - } - delete []thisLine; - } else { - // Last line so line has no line end - char *thisLine = CopyRange(start, end); - char *prevEnd = CopyRange(endPrev, start); - pdoc->DeleteChars(endPrev, end - endPrev); - pdoc->InsertString(startPrev, thisLine, end - start); - if (pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev)) { - MovePositionTo(startPrev + end - endPrev); - } - delete []thisLine; - delete []prevEnd; - } - + char *line1 = CopyRange(startPrev, endPrev); + int len1 = endPrev - startPrev; + char *line2 = CopyRange(start, end); + int len2 = end - start; + pdoc->DeleteChars(start, len2); + pdoc->DeleteChars(startPrev, len1); + pdoc->InsertString(startPrev, line2, len2); + pdoc->InsertString(start - len1 + len2, line1, len1); + MovePositionTo(start - len1 + len2); + delete []line1; + delete []line2; + pdoc->EndUndoAction(); } } @@ -4097,7 +4157,7 @@ void Editor::Duplicate(bool forLine) { char *text = CopyRange(start, end); if (forLine) { const char *eol = StringFromEOLMode(pdoc->eolMode); - pdoc->InsertString(end, eol); + pdoc->InsertCString(end, eol); pdoc->InsertString(end + istrlen(eol), text, end - start); } else { pdoc->InsertString(end, text, end - start); @@ -4117,7 +4177,7 @@ void Editor::NewLine() { } else if (pdoc->eolMode == SC_EOL_CR) { eol = "\r"; } // else SC_EOL_LF -> "\n" already set - if (pdoc->InsertString(currentPos, eol)) { + if (pdoc->InsertCString(currentPos, eol)) { SetEmptySelection(currentPos + istrlen(eol)); while (*eol) { NotifyChar(*eol); @@ -4125,6 +4185,7 @@ void Editor::NewLine() { } } SetLastXChosen(); + SetScrollBars(); EnsureCaretVisible(); // Avoid blinking during rapid typing: ShowCaretAtCurrentPosition(); @@ -4133,7 +4194,7 @@ void Editor::NewLine() { void Editor::CursorUpOrDown(int direction, selTypes sel) { Point pt = LocationFromPosition(currentPos); int posNew = PositionFromLocation( - Point(lastXChosen, pt.y + direction * vs.lineHeight)); + Point(lastXChosen, pt.y + direction * vs.lineHeight)); if (direction < 0) { // Line wrapping may lead to a location on the same line, so // seek back if that is the case. @@ -4346,7 +4407,7 @@ int Editor::KeyCommand(unsigned int iMessage) { int endPos = MovePositionSoVisible(StartEndDisplayLine(currentPos, false), 1); int realEndPos = pdoc->LineEndPosition(currentPos); if (endPos > realEndPos // if moved past visible EOLs - || currentPos >= endPos) // if at end of display line already + || currentPos >= endPos) // if at end of display line already endPos = realEndPos; MovePositionTo(endPos); SetLastXChosen(); @@ -4356,7 +4417,7 @@ int Editor::KeyCommand(unsigned int iMessage) { int endPos = MovePositionSoVisible(StartEndDisplayLine(currentPos, false), 1); int realEndPos = pdoc->LineEndPosition(currentPos); if (endPos > realEndPos // if moved past visible EOLs - || currentPos >= endPos) // if at end of display line already + || currentPos >= endPos) // if at end of display line already endPos = realEndPos; MovePositionTo(endPos, selStream); SetLastXChosen(); @@ -4509,6 +4570,11 @@ int Editor::KeyCommand(unsigned int iMessage) { pdoc->DeleteChars(currentPos, endWord - currentPos); } break; + case SCI_DELWORDRIGHTEND: { + int endWord = pdoc->NextWordEnd(currentPos, 1); + pdoc->DeleteChars(currentPos, endWord - currentPos); + } + break; case SCI_DELLINELEFT: { int line = pdoc->LineFromPosition(currentPos); int start = pdoc->LineStart(line); @@ -4526,7 +4592,7 @@ int Editor::KeyCommand(unsigned int iMessage) { int lineStart = pdoc->LineFromPosition(SelectionStart()); int lineEnd = pdoc->LineFromPosition(SelectionEnd()); CopyRangeToClipboard(pdoc->LineStart(lineStart), - pdoc->LineStart(lineEnd + 1)); + pdoc->LineStart(lineEnd + 1)); } break; case SCI_LINECUT: { @@ -4579,22 +4645,22 @@ int Editor::KeyCommand(unsigned int iMessage) { break; case SCI_HOMEDISPLAY: MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, true), -1)); + StartEndDisplayLine(currentPos, true), -1)); SetLastXChosen(); break; case SCI_HOMEDISPLAYEXTEND: MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, true), -1), selStream); + StartEndDisplayLine(currentPos, true), -1), selStream); SetLastXChosen(); break; case SCI_LINEENDDISPLAY: MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, false), 1)); + StartEndDisplayLine(currentPos, false), 1)); SetLastXChosen(); break; case SCI_LINEENDDISPLAYEXTEND: MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, false), 1), selStream); + StartEndDisplayLine(currentPos, false), 1), selStream); SetLastXChosen(); break; } @@ -4608,7 +4674,7 @@ int Editor::KeyDefault(int, int) { int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { DwellEnd(false); int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); + (alt ? SCI_ALT : 0); int msg = kmap.Find(key, modifiers); if (msg) { if (consumed) @@ -4649,7 +4715,7 @@ void Editor::Indent(bool forwards) { SetEmptySelection(currentPos + 1); } else { int numSpaces = (pdoc->tabInChars) - - (pdoc->GetColumn(currentPos) % (pdoc->tabInChars)); + (pdoc->GetColumn(currentPos) % (pdoc->tabInChars)); if (numSpaces < 1) numSpaces = pdoc->tabInChars; for (int i = 0; i < numSpaces; i++) { @@ -4670,7 +4736,7 @@ void Editor::Indent(bool forwards) { pdoc->EndUndoAction(); } else { int newColumn = ((pdoc->GetColumn(currentPos) - 1) / pdoc->tabInChars) * - pdoc->tabInChars; + pdoc->tabInChars; if (newColumn < 0) newColumn = 0; int newPos = currentPos; @@ -4709,19 +4775,19 @@ void Editor::Indent(bool forwards) { * @return The position of the found text, -1 if not found. */ long Editor::FindText( - uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, - ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. - sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range. + uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, + ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. + sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range. TextToFind *ft = reinterpret_cast(lParam); int lengthFound = istrlen(ft->lpstrText); int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + (wParam & SCFIND_POSIX) != 0, + &lengthFound); if (pos != -1) { ft->chrgText.cpMin = pos; ft->chrgText.cpMax = pos + lengthFound; @@ -4752,7 +4818,7 @@ void Editor::SearchAnchor() { long Editor::SearchText( unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV. uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, - ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. + ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. sptr_t lParam) { ///< The text to search for. const char *txt = reinterpret_cast(lParam); @@ -4760,20 +4826,20 @@ long Editor::SearchText( int lengthFound = istrlen(txt); if (iMessage == SCI_SEARCHNEXT) { pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + (wParam & SCFIND_POSIX) != 0, + &lengthFound); } else { pos = pdoc->FindText(searchAnchor, 0, txt, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + (wParam & SCFIND_POSIX) != 0, + &lengthFound); } if (pos != -1) { @@ -4790,12 +4856,12 @@ long Editor::SearchText( long Editor::SearchInTarget(const char *text, int length) { int lengthFound = length; int pos = pdoc->FindText(targetStart, targetEnd, text, - (searchFlags & SCFIND_MATCHCASE) != 0, - (searchFlags & SCFIND_WHOLEWORD) != 0, - (searchFlags & SCFIND_WORDSTART) != 0, - (searchFlags & SCFIND_REGEXP) != 0, - (searchFlags & SCFIND_POSIX) != 0, - &lengthFound); + (searchFlags & SCFIND_MATCHCASE) != 0, + (searchFlags & SCFIND_WHOLEWORD) != 0, + (searchFlags & SCFIND_WORDSTART) != 0, + (searchFlags & SCFIND_REGEXP) != 0, + (searchFlags & SCFIND_POSIX) != 0, + &lengthFound); if (pos != -1) { targetStart = pos; targetEnd = pos + lengthFound; @@ -4838,7 +4904,7 @@ char *Editor::CopyRange(int start, int end) { void Editor::CopySelectionFromRange(SelectionText *ss, int start, int end) { ss->Set(CopyRange(start, end), end - start + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); } void Editor::CopySelectionRange(SelectionText *ss) { @@ -4864,8 +4930,8 @@ void Editor::CopySelectionRange(SelectionText *ss) { lineIterator.Reset(); while (lineIterator.Iterate()) { for (int i = lineIterator.startPos; - i < lineIterator.endPos; - i++) { + i < lineIterator.endPos; + i++) { text[j++] = pdoc->CharAt(i); } if (selType != selLines) { @@ -4881,7 +4947,7 @@ void Editor::CopySelectionRange(SelectionText *ss) { } } ss->Set(text, size + 1, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet, selType == selRectangle); + vs.styles[STYLE_DEFAULT].characterSet, selType == selRectangle); } } @@ -4890,14 +4956,14 @@ void Editor::CopyRangeToClipboard(int start, int end) { end = pdoc->ClampPositionIntoDocument(end); SelectionText selectedText; selectedText.Set(CopyRange(start, end), end - start + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); CopyToClipboard(selectedText); } void Editor::CopyText(int length, const char *text) { SelectionText selectedText; selectedText.Copy(text, length + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false); CopyToClipboard(selectedText); } @@ -4922,6 +4988,13 @@ void Editor::DisplayCursor(Window::Cursor c) { wMain.SetCursor(static_cast(cursorMode)); } +bool Editor::DragThreshold(Point ptStart, Point ptNow) { + int xMove = ptStart.x - ptNow.x; + int yMove = ptStart.y - ptNow.y; + int distanceSquared = xMove * xMove + yMove * yMove; + return distanceSquared > 16; +} + void Editor::StartDrag() { // Always handled by subclasses //SetMouseCapture(true); @@ -4929,8 +5002,8 @@ void Editor::StartDrag() { } void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) { - //Platform::DebugPrintf("DropAt %d\n", inDragDrop); - if (inDragDrop) + //Platform::DebugPrintf("DropAt %d %d\n", inDragDrop, position); + if (inDragDrop == ddDragging) dropWentOutside = false; int positionWasInSelection = PositionInSelection(position); @@ -4938,7 +5011,7 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul bool positionOnEdgeOfSelection = (position == SelectionStart()) || (position == SelectionEnd()); - if ((!inDragDrop) || !(0 == positionWasInSelection) || + if ((inDragDrop != ddDragging) || !(0 == positionWasInSelection) || (positionOnEdgeOfSelection && !moving)) { int selStart = SelectionStart(); @@ -4947,7 +5020,7 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul pdoc->BeginUndoAction(); int positionAfterDeletion = position; - if (inDragDrop && moving) { + if ((inDragDrop == ddDragging) && moving) { // Remove dragged out text if (rectangular || selType == selLines) { SelectionLineIterator lineIterator(this); @@ -4976,12 +5049,12 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul SetEmptySelection(position); } else { position = MovePositionOutsideChar(position, currentPos - position); - if (pdoc->InsertString(position, value)) { + if (pdoc->InsertCString(position, value)) { SetSelection(position + istrlen(value), position); } pdoc->EndUndoAction(); } - } else if (inDragDrop) { + } else if (inDragDrop == ddDragging) { SetEmptySelection(position); } } @@ -5061,13 +5134,13 @@ bool Editor::PointInSelMargin(Point pt) { void Editor::LineSelection(int lineCurrent_, int lineAnchor_) { if (lineAnchor_ < lineCurrent_) { SetSelection(pdoc->LineStart(lineCurrent_ + 1), - pdoc->LineStart(lineAnchor_)); + pdoc->LineStart(lineAnchor_)); } else if (lineAnchor_ > lineCurrent_) { SetSelection(pdoc->LineStart(lineCurrent_), - pdoc->LineStart(lineAnchor_ + 1)); + pdoc->LineStart(lineAnchor_ + 1)); } else { // Same line, select it SetSelection(pdoc->LineStart(lineAnchor_ + 1), - pdoc->LineStart(lineAnchor_)); + pdoc->LineStart(lineAnchor_)); } } @@ -5083,17 +5156,19 @@ void Editor::DwellEnd(bool mouseMoved) { } void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { - //Platform::DebugPrintf("Scintilla:ButtonDown %d %d = %d alt=%d\n", curTime, lastClickTime, curTime - lastClickTime, alt); + //Platform::DebugPrintf("ButtonDown %d %d = %d alt=%d %d\n", curTime, lastClickTime, curTime - lastClickTime, alt, inDragDrop); ptMouseLast = pt; int newPos = PositionFromLocation(pt); newPos = MovePositionOutsideChar(newPos, currentPos - newPos); - inDragDrop = false; + inDragDrop = ddNone; moveExtendsSelection = false; bool processed = NotifyMarginClick(pt, shift, ctrl, alt); if (processed) return; + NotifyIndicatorClick(true, newPos, shift, ctrl, alt); + bool inSelMargin = PointInSelMargin(pt); if (shift & !inSelMargin) { SetSelection(newPos); @@ -5119,10 +5194,10 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b if (selectionType == selWord) { if (currentPos >= originalAnchorPos) { // Moved forward SetSelection(pdoc->ExtendWordSelect(currentPos, 1), - pdoc->ExtendWordSelect(originalAnchorPos, -1)); + pdoc->ExtendWordSelect(originalAnchorPos, -1)); } else { // Moved backward SetSelection(pdoc->ExtendWordSelect(currentPos, -1), - pdoc->ExtendWordSelect(originalAnchorPos, 1)); + pdoc->ExtendWordSelect(originalAnchorPos, 1)); } } else if (selectionType == selLine) { lineAnchor = LineFromLocation(pt); @@ -5133,7 +5208,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b } //Platform::DebugPrintf("Double click: %d - %d\n", anchor, currentPos); if (doubleClick) { - NotifyDoubleClick(pt, shift); + NotifyDoubleClick(pt, shift, ctrl, alt); if (PositionIsHotspot(newPos)) NotifyHotSpotDoubleClicked(newPos, shift, ctrl, alt); } @@ -5150,7 +5225,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b // Single click in margin: select whole line LineSelection(lineAnchor, lineAnchor); SetSelection(pdoc->LineStart(lineAnchor + 1), - pdoc->LineStart(lineAnchor)); + pdoc->LineStart(lineAnchor)); } else { // Single shift+click in margin: select from line anchor to clicked line if (anchor > currentPos) @@ -5170,16 +5245,14 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b NotifyHotSpotClicked(newPos, shift, ctrl, alt); } if (!shift) { - inDragDrop = PointInSelection(pt) && !SelectionEmpty(); + if (PointInSelection(pt) && !SelectionEmpty()) + inDragDrop = ddInitial; + else + inDragDrop = ddNone; } - if (inDragDrop) { - SetMouseCapture(false); - SetDragPosition(newPos); - CopySelectionRange(&drag); - StartDrag(); - } else { + SetMouseCapture(true); + if (inDragDrop != ddInitial) { SetDragPosition(invalidPosition); - SetMouseCapture(true); if (!shift) { SetEmptySelection(newPos); } @@ -5248,6 +5321,20 @@ void Editor::ButtonMove(Point pt) { if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) { DwellEnd(true); } + + int movePos = PositionFromLocation(pt); + movePos = MovePositionOutsideChar(movePos, currentPos - movePos); + + if (inDragDrop == ddInitial) { + if (DragThreshold(ptMouseLast, pt)) { + SetMouseCapture(false); + SetDragPosition(movePos); + CopySelectionRange(&drag); + StartDrag(); + } + return; + } + ptMouseLast = pt; //Platform::DebugPrintf("Move %d %d\n", pt.x, pt.y); if (HaveMouseCapture()) { @@ -5259,8 +5346,6 @@ void Editor::ButtonMove(Point pt) { autoScrollTimer.ticksToWait = autoScrollDelay; // Adjust selection - int movePos = PositionFromLocation(pt); - movePos = MovePositionOutsideChar(movePos, currentPos - movePos); if (posDrag >= 0) { SetDragPosition(movePos); } else { @@ -5280,10 +5365,10 @@ void Editor::ButtonMove(Point pt) { // being unmade. } else if (movePos > originalAnchorPos) { // Moved forward SetSelection(pdoc->ExtendWordSelect(movePos, 1), - pdoc->ExtendWordSelect(originalAnchorPos, -1)); + pdoc->ExtendWordSelect(originalAnchorPos, -1)); } else { // Moved backward SetSelection(pdoc->ExtendWordSelect(movePos, -1), - pdoc->ExtendWordSelect(originalAnchorPos, 1)); + pdoc->ExtendWordSelect(originalAnchorPos, 1)); } } else { // Continue selecting by line @@ -5336,7 +5421,13 @@ void Editor::ButtonMove(Point pt) { } void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { - //Platform::DebugPrintf("ButtonUp %d\n", HaveMouseCapture()); + //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); + int newPos = PositionFromLocation(pt); + newPos = MovePositionOutsideChar(newPos, currentPos - newPos); + if (inDragDrop == ddInitial) { + inDragDrop = ddNone; + SetEmptySelection(newPos); + } if (HaveMouseCapture()) { if (PointInSelMargin(pt)) { DisplayCursor(Window::cursorReverseArrow); @@ -5348,7 +5439,8 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { SetMouseCapture(false); int newPos = PositionFromLocation(pt); newPos = MovePositionOutsideChar(newPos, currentPos - newPos); - if (inDragDrop) { + NotifyIndicatorClick(false, newPos, false, false, false); + if (inDragDrop == ddDragging) { int selStart = SelectionStart(); int selEnd = SelectionEnd(); if (selStart < selEnd) { @@ -5387,7 +5479,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { if (selType == selStream) { SetLastXChosen(); } - inDragDrop = false; + inDragDrop = ddNone; EnsureCaretVisible(false); } } @@ -5409,6 +5501,10 @@ void Editor::Tick() { } } } + if (horizontalScrollBarVisible && trackLineWidth && (lineWidthMaxSeen > scrollWidth)) { + scrollWidth = lineWidthMaxSeen; + SetScrollBars(); + } if ((dwellDelay < SC_TIME_FOREVER) && (ticksToDwell > 0) && (!HaveMouseCapture())) { @@ -5456,7 +5552,11 @@ void Editor::SetFocusState(bool focusState) { } bool Editor::PaintContains(PRectangle rc) { - return rcPaint.Contains(rc); + if (rc.Empty()) { + return true; + } else { + return rcPaint.Contains(rc); + } } bool Editor::PaintContainsMargin() { @@ -5626,7 +5726,7 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { SetVerticalScrollPos(); Redraw(); } else if ((lineDisplay > topLine + LinesOnScreen() - 1) || - ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { + ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); SetVerticalScrollPos(); Redraw(); @@ -5647,8 +5747,10 @@ int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) { length = istrlen(text); if (replacePatterns) { text = pdoc->SubstituteByPosition(text, &length); - if (!text) + if (!text) { + pdoc->EndUndoAction(); return 0; + } } if (targetStart != targetEnd) pdoc->DeleteChars(targetStart, targetEnd - targetStart); @@ -5682,6 +5784,26 @@ int Editor::WrapCount(int line) { } } +void Editor::AddStyledText(char *buffer, int appendLength) { + // The buffer consists of alternating character bytes and style bytes + size_t textLength = appendLength / 2; + char *text = new char[textLength]; + if (text) { + size_t i; + for (i = 0;i < textLength;i++) { + text[i] = buffer[i*2]; + } + pdoc->InsertString(CurrentPosition(), text, textLength); + for (i = 0;i < textLength;i++) { + text[i] = buffer[i*2+1]; + } + pdoc->StartStyling(CurrentPosition(), static_cast(0xff)); + pdoc->SetStyles(textLength, text); + delete []text; + } + SetEmptySelection(currentPos + textLength); +} + static bool ValidMargin(unsigned long wParam) { return wParam < ViewStyle::margins; } @@ -5690,6 +5812,89 @@ static char *CharPtrFromSPtr(sptr_t lParam) { return reinterpret_cast(lParam); } +void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + vs.EnsureStyle(wParam); + switch (iMessage) { + case SCI_STYLESETFORE: + vs.styles[wParam].fore.desired = ColourDesired(lParam); + break; + case SCI_STYLESETBACK: + vs.styles[wParam].back.desired = ColourDesired(lParam); + break; + case SCI_STYLESETBOLD: + vs.styles[wParam].bold = lParam != 0; + break; + case SCI_STYLESETITALIC: + vs.styles[wParam].italic = lParam != 0; + break; + case SCI_STYLESETEOLFILLED: + vs.styles[wParam].eolFilled = lParam != 0; + break; + case SCI_STYLESETSIZE: + vs.styles[wParam].size = lParam; + break; + case SCI_STYLESETFONT: + if (lParam != 0) { + vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam)); + } + break; + case SCI_STYLESETUNDERLINE: + vs.styles[wParam].underline = lParam != 0; + break; + case SCI_STYLESETCASE: + vs.styles[wParam].caseForce = static_cast(lParam); + break; + case SCI_STYLESETCHARACTERSET: + vs.styles[wParam].characterSet = lParam; + break; + case SCI_STYLESETVISIBLE: + vs.styles[wParam].visible = lParam != 0; + break; + case SCI_STYLESETCHANGEABLE: + vs.styles[wParam].changeable = lParam != 0; + break; + case SCI_STYLESETHOTSPOT: + vs.styles[wParam].hotspot = lParam != 0; + break; + } + InvalidateStyleRedraw(); +} + +sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + vs.EnsureStyle(wParam); + switch (iMessage) { + case SCI_STYLEGETFORE: + return vs.styles[wParam].fore.desired.AsLong(); + case SCI_STYLEGETBACK: + return vs.styles[wParam].back.desired.AsLong(); + case SCI_STYLEGETBOLD: + return vs.styles[wParam].bold ? 1 : 0; + case SCI_STYLEGETITALIC: + return vs.styles[wParam].italic ? 1 : 0; + case SCI_STYLEGETEOLFILLED: + return vs.styles[wParam].eolFilled ? 1 : 0; + case SCI_STYLEGETSIZE: + return vs.styles[wParam].size; + case SCI_STYLEGETFONT: + if (lParam != 0) + strcpy(CharPtrFromSPtr(lParam), vs.styles[wParam].fontName); + return strlen(vs.styles[wParam].fontName); + case SCI_STYLEGETUNDERLINE: + return vs.styles[wParam].underline ? 1 : 0; + case SCI_STYLEGETCASE: + return static_cast(vs.styles[wParam].caseForce); + case SCI_STYLEGETCHARACTERSET: + return vs.styles[wParam].characterSet; + case SCI_STYLEGETVISIBLE: + return vs.styles[wParam].visible ? 1 : 0; + case SCI_STYLEGETCHANGEABLE: + return vs.styles[wParam].changeable ? 1 : 0; + case SCI_STYLEGETHOTSPOT: + return vs.styles[wParam].hotspot ? 1 : 0; + } + return 0; +} + sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); @@ -5718,7 +5923,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { pdoc->BeginUndoAction(); pdoc->DeleteChars(0, pdoc->Length()); SetEmptySelection(0); - pdoc->InsertString(0, CharPtrFromSPtr(lParam)); + pdoc->InsertCString(0, CharPtrFromSPtr(lParam)); pdoc->EndUndoAction(); return 1; } @@ -5868,7 +6073,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { pdoc->BeginUndoAction(); ClearSelection(); char *replacement = CharPtrFromSPtr(lParam); - pdoc->InsertString(currentPos, replacement); + pdoc->InsertCString(currentPos, replacement); pdoc->EndUndoAction(); SetEmptySelection(currentPos + istrlen(replacement)); EnsureCaretVisible(); @@ -5919,10 +6124,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return searchFlags; case SCI_POSITIONBEFORE: - return pdoc->MovePositionOutsideChar(wParam-1, -1, true); + return pdoc->MovePositionOutsideChar(wParam - 1, -1, true); case SCI_POSITIONAFTER: - return pdoc->MovePositionOutsideChar(wParam+1, 1, true); + return pdoc->MovePositionOutsideChar(wParam + 1, 1, true); case SCI_LINESCROLL: ScrollTo(topLine + lParam); @@ -6024,13 +6229,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return 0; } - case SCI_ADDSTYLEDTEXT: { - if (lParam == 0) - return 0; - pdoc->InsertStyledString(CurrentPosition() * 2, CharPtrFromSPtr(lParam), wParam); - SetEmptySelection(currentPos + wParam / 2); - return 0; - } + case SCI_ADDSTYLEDTEXT: + if (lParam) + AddStyledText(CharPtrFromSPtr(lParam), wParam); + return 0; case SCI_INSERTTEXT: { if (lParam == 0) @@ -6040,7 +6242,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { insertPos = CurrentPosition(); int newCurrent = CurrentPosition(); char *sz = CharPtrFromSPtr(lParam); - pdoc->InsertString(insertPos, sz); + pdoc->InsertCString(insertPos, sz); if (newCurrent > insertPos) newCurrent += istrlen(sz); SetEmptySelection(newCurrent); @@ -6410,9 +6612,17 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETLAYOUTCACHE: return llc.GetLevel(); + case SCI_SETPOSITIONCACHE: + posCache.SetSize(wParam); + break; + + case SCI_GETPOSITIONCACHE: + return posCache.GetSize(); + case SCI_SETSCROLLWIDTH: PLATFORM_ASSERT(wParam > 0); if ((wParam > 0) && (wParam != static_cast(scrollWidth))) { + lineWidthMaxSeen = 0; scrollWidth = wParam; SetScrollBars(); } @@ -6421,6 +6631,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETSCROLLWIDTH: return scrollWidth; + case SCI_SETSCROLLWIDTHTRACKING: + trackLineWidth = wParam != 0; + break; + + case SCI_GETSCROLLWIDTHTRACKING: + return trackLineWidth; + case SCI_LINESJOIN: LinesJoin(); break; @@ -6430,7 +6647,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_TEXTWIDTH: - PLATFORM_ASSERT(wParam <= STYLE_MAX); + PLATFORM_ASSERT(wParam < vs.stylesSize); PLATFORM_ASSERT(lParam); return TextWidth(wParam, CharPtrFromSPtr(lParam)); @@ -6491,7 +6708,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return verticalScrollBarVisible; case SCI_SETINDENTATIONGUIDES: - vs.viewIndentationGuides = wParam != 0; + vs.viewIndentationGuides = IndentView(wParam); Redraw(); break; @@ -6659,91 +6876,42 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_STYLESETFORE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].fore.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETBACK: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].back.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETBOLD: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].bold = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETITALIC: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].italic = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETEOLFILLED: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].eolFilled = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETSIZE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].size = lParam; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETFONT: - if (lParam == 0) - return 0; - if (wParam <= STYLE_MAX) { - vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam)); - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETUNDERLINE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].underline = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETCASE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].caseForce = static_cast(lParam); - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETCHARACTERSET: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].characterSet = lParam; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETVISIBLE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].visible = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETCHANGEABLE: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].changeable = lParam != 0; - InvalidateStyleRedraw(); - } - break; case SCI_STYLESETHOTSPOT: - if (wParam <= STYLE_MAX) { - vs.styles[wParam].hotspot = lParam != 0; - InvalidateStyleRedraw(); - } - break; + StyleSetMessage(iMessage, wParam, lParam); + break; + + case SCI_STYLEGETFORE: + case SCI_STYLEGETBACK: + case SCI_STYLEGETBOLD: + case SCI_STYLEGETITALIC: + case SCI_STYLEGETEOLFILLED: + case SCI_STYLEGETSIZE: + case SCI_STYLEGETFONT: + case SCI_STYLEGETUNDERLINE: + case SCI_STYLEGETCASE: + case SCI_STYLEGETCHARACTERSET: + case SCI_STYLEGETVISIBLE: + case SCI_STYLEGETCHANGEABLE: + case SCI_STYLEGETHOTSPOT: + return StyleGetMessage(iMessage, wParam, lParam); case SCI_STYLERESETDEFAULT: vs.ResetDefaultStyle(); InvalidateStyleRedraw(); break; case SCI_SETSTYLEBITS: + vs.EnsureStyle((1 << wParam) - 1); pdoc->SetStylingBits(wParam); break; @@ -6899,6 +7067,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETSELALPHA: return vs.selAlpha; + case SCI_GETSELEOLFILLED: + return vs.selEOLFilled; + + case SCI_SETSELEOLFILLED: + vs.selEOLFilled = wParam != 0; + InvalidateStyleRedraw(); + break; + case SCI_SETWHITESPACEFORE: vs.whitespaceForegroundSet = wParam != 0; vs.whitespaceForeground.desired = ColourDesired(lParam); @@ -6919,6 +7095,18 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETCARETFORE: return vs.caretcolour.desired.AsLong(); + case SCI_SETCARETSTYLE: + if (wParam >= CARETSTYLE_INVISIBLE && wParam <= CARETSTYLE_BLOCK) + vs.caretStyle = wParam; + else + /* Default to the line caret */ + vs.caretStyle = CARETSTYLE_LINE; + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETSTYLE: + return vs.caretStyle; + case SCI_SETCARETWIDTH: if (wParam <= 0) vs.caretWidth = 0; @@ -6934,12 +7122,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_ASSIGNCMDKEY: kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), - Platform::HighShortFromLong(wParam), lParam); + Platform::HighShortFromLong(wParam), lParam); break; case SCI_CLEARCMDKEY: kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), - Platform::HighShortFromLong(wParam), SCI_NULL); + Platform::HighShortFromLong(wParam), SCI_NULL); break; case SCI_CLEARALLCMDKEYS: @@ -6966,6 +7154,47 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_INDICGETFORE: return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fore.desired.AsLong() : 0; + case SCI_INDICSETUNDER: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].under = lParam != 0; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETUNDER: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; + + case SCI_SETINDICATORCURRENT: + pdoc->decorations.SetCurrentIndicator(wParam); + break; + case SCI_GETINDICATORCURRENT: + return pdoc->decorations.GetCurrentIndicator(); + case SCI_SETINDICATORVALUE: + pdoc->decorations.SetCurrentValue(wParam); + break; + case SCI_GETINDICATORVALUE: + return pdoc->decorations.GetCurrentValue(); + + case SCI_INDICATORFILLRANGE: + pdoc->DecorationFillRange(wParam, pdoc->decorations.GetCurrentValue(), lParam); + break; + + case SCI_INDICATORCLEARRANGE: + pdoc->DecorationFillRange(wParam, 0, lParam); + break; + + case SCI_INDICATORALLONFOR: + return pdoc->decorations.AllOnFor(wParam); + + case SCI_INDICATORVALUEAT: + return pdoc->decorations.ValueAt(wParam, lParam); + + case SCI_INDICATORSTART: + return pdoc->decorations.Start(wParam, lParam); + + case SCI_INDICATOREND: + return pdoc->decorations.End(wParam, lParam); + case SCI_LINEDOWN: case SCI_LINEDOWNEXTEND: case SCI_PARADOWN: @@ -7023,6 +7252,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_ZOOMOUT: case SCI_DELWORDLEFT: case SCI_DELWORDRIGHT: + case SCI_DELWORDRIGHTEND: case SCI_DELLINELEFT: case SCI_DELLINERIGHT: case SCI_LINECOPY: @@ -7267,22 +7497,34 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { InvalidateStyleRedraw(); break; + case SCI_GETHOTSPOTACTIVEFORE: + return vs.hotspotForeground.desired.AsLong(); + case SCI_SETHOTSPOTACTIVEBACK: vs.hotspotBackgroundSet = wParam != 0; vs.hotspotBackground.desired = ColourDesired(lParam); InvalidateStyleRedraw(); break; + case SCI_GETHOTSPOTACTIVEBACK: + return vs.hotspotBackground.desired.AsLong(); + case SCI_SETHOTSPOTACTIVEUNDERLINE: vs.hotspotUnderline = wParam != 0; InvalidateStyleRedraw(); break; + case SCI_GETHOTSPOTACTIVEUNDERLINE: + return vs.hotspotUnderline ? 1 : 0; + case SCI_SETHOTSPOTSINGLELINE: vs.hotspotSingleLine = wParam != 0; InvalidateStyleRedraw(); break; + case SCI_GETHOTSPOTSINGLELINE: + return vs.hotspotSingleLine ? 1 : 0; + case SCI_SETPASTECONVERTENDINGS: convertPastes = wParam != 0; break; diff --git a/src/stc/scintilla/src/Editor.h b/src/stc/scintilla/src/Editor.h index fe7be268ae..049cc373f5 100644 --- a/src/stc/scintilla/src/Editor.h +++ b/src/stc/scintilla/src/Editor.h @@ -8,6 +8,10 @@ #ifndef EDITOR_H #define EDITOR_H +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + /** */ class Caret { @@ -41,92 +45,6 @@ public: Idler(); }; -/** - */ -class LineLayout { -private: - friend class LineLayoutCache; - int *lineStarts; - int lenLineStarts; - /// Drawing is only performed for @a maxLineLength characters on each line. - int lineNumber; - bool inCache; -public: - enum { wrapWidthInfinite = 0x7ffffff }; - int maxLineLength; - int numCharsInLine; - enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity; - int xHighlightGuide; - bool highlightColumn; - int selStart; - int selEnd; - bool containsCaret; - int edgeColumn; - char *chars; - unsigned char *styles; - int styleBitsSet; - char *indicators; - int *positions; - char bracePreviousStyles[2]; - - // Hotspot support - int hsStart; - int hsEnd; - - // Wrapped line support - int widthLine; - int lines; - - LineLayout(int maxLineLength_); - virtual ~LineLayout(); - void Resize(int maxLineLength_); - void Free(); - void Invalidate(validLevel validity_); - int LineStart(int line) { - if (line <= 0) { - return 0; - } else if ((line >= lines) || !lineStarts) { - return numCharsInLine; - } else { - return lineStarts[line]; - } - } - void SetLineStart(int line, int start); - void SetBracesHighlight(Range rangeLine, Position braces[], - char bracesMatchStyle, int xHighlight); - void RestoreBracesHighlight(Range rangeLine, Position braces[]); -}; - -/** - */ -class LineLayoutCache { - int level; - int length; - int size; - LineLayout **cache; - bool allInvalidated; - int styleClock; - int useCount; - void Allocate(int length_); - void AllocateForLevel(int linesOnScreen, int linesInDoc); -public: - LineLayoutCache(); - virtual ~LineLayoutCache(); - void Deallocate(); - enum { - llcNone=SC_CACHE_NONE, - llcCaret=SC_CACHE_CARET, - llcPage=SC_CACHE_PAGE, - llcDocument=SC_CACHE_DOCUMENT - }; - void Invalidate(LineLayout::validLevel validity_); - void SetLevel(int level_); - int GetLevel() { return level; } - LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, - int linesOnScreen, int linesInDoc); - void Dispose(LineLayout *ll); -}; - /** * Hold a piece of text selected for copying or dragging. * The text is expected to hold a terminating '\0' and this is counted in len. @@ -218,6 +136,8 @@ protected: // ScintillaBase subclass needs access to much of Editor int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret bool horizontalScrollBarVisible; int scrollWidth; + bool trackLineWidth; + int lineWidthMaxSeen; bool verticalScrollBarVisible; bool endAtLastLine; bool caretSticky; @@ -229,6 +149,7 @@ protected: // ScintillaBase subclass needs access to much of Editor Surface *pixmapIndentGuideHighlight; LineLayoutCache llc; + PositionCache posCache; KeyMap kmap; @@ -246,7 +167,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool dwelling; enum { selChar, selWord, selLine } selectionType; Point ptMouseLast; - bool inDragDrop; + enum { ddNone, ddInitial, ddDragging } inDragDrop; bool dropWentOutside; int posDrag; int posDrop; @@ -378,6 +299,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void UpdateSystemCaret(); void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge); + bool WrapOneLine(Surface *surface, int lineToWrap); bool WrapLines(bool fullWrap, int priorityWrapLineStart); void LinesJoin(); void LinesSplit(int pixelWidth); @@ -395,8 +317,11 @@ protected: // ScintillaBase subclass needs access to much of Editor int line, int lineEnd, int xStart, int subLine, int subLineStart, bool overrideBackground, ColourAllocated background, bool drawWrapMark, ColourAllocated wrapColour); + void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under); void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, PRectangle rcLine, LineLayout *ll, int subLine=0); + void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret); void RefreshPixMaps(Surface *surfaceWindow); void Paint(Surface *surfaceWindow, PRectangle rcArea); long FormatRange(bool draw, RangeToFormat *pfr); @@ -413,7 +338,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); void ClearSelection(); void ClearAll(); - void ClearDocumentStyle(); + void ClearDocumentStyle(); void Cut(); void PasteRectangular(int pos, const char *ptr, int len); virtual void Copy() = 0; @@ -436,11 +361,12 @@ protected: // ScintillaBase subclass needs access to much of Editor void NotifyMove(int position); void NotifySavePoint(bool isSavePoint); void NotifyModifyAttempt(); - virtual void NotifyDoubleClick(Point pt, bool shift); + virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt); void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt); void NotifyUpdateUI(); void NotifyPainted(); + void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt); bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt); void NotifyNeedShown(int pos, int len); void NotifyDwelling(Point pt, bool state); @@ -486,6 +412,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void CopyText(int length, const char *text); void SetDragPosition(int newPos); virtual void DisplayCursor(Window::Cursor c); + virtual bool DragThreshold(Point ptStart, Point ptNow); virtual void StartDrag(); void DropAt(int position, const char *value, bool moving, bool rectangular); /** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after. @@ -527,8 +454,11 @@ protected: // ScintillaBase subclass needs access to much of Editor int CodePage() const; virtual bool ValidCodePage(int /* codePage */) const { return true; } int WrapCount(int line); + void AddStyledText(char *buffer, int appendLength); virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; + void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); public: // Public so the COM thunks can access it. @@ -579,4 +509,8 @@ public: } }; +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/src/ExternalLexer.cxx b/src/stc/scintilla/src/ExternalLexer.cxx index acf45bc2d5..0344debd78 100644 --- a/src/stc/scintilla/src/ExternalLexer.cxx +++ b/src/stc/scintilla/src/ExternalLexer.cxx @@ -21,6 +21,10 @@ #include "KeyWords.h" #include "ExternalLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + LexerManager *LexerManager::theInstance = NULL; //------------------------------------------ diff --git a/src/stc/scintilla/src/ExternalLexer.h b/src/stc/scintilla/src/ExternalLexer.h index 1a595ff513..55e127b40a 100644 --- a/src/stc/scintilla/src/ExternalLexer.h +++ b/src/stc/scintilla/src/ExternalLexer.h @@ -11,7 +11,11 @@ #if PLAT_WIN #define EXT_LEXER_DECL __stdcall #else -#define EXT_LEXER_DECL +#define EXT_LEXER_DECL +#endif + +#ifdef SCI_NAMESPACE +namespace Scintilla { #endif // External Lexer function definitions... @@ -37,7 +41,7 @@ public: const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ strncpy(name, languageName_, sizeof(name)); languageName = name; - } + }; virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const; virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, @@ -92,4 +96,8 @@ public: ~LMMinder(); }; +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/src/Indicator.cxx b/src/stc/scintilla/src/Indicator.cxx index 7624a4a525..139e2b0eab 100644 --- a/src/stc/scintilla/src/Indicator.cxx +++ b/src/stc/scintilla/src/Indicator.cxx @@ -10,6 +10,10 @@ #include "Scintilla.h" #include "Indicator.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { surface->PenColour(fore.allocated); int ymid = (rc.bottom + rc.top) / 2; diff --git a/src/stc/scintilla/src/Indicator.h b/src/stc/scintilla/src/Indicator.h index 716db1051f..2081db544e 100644 --- a/src/stc/scintilla/src/Indicator.h +++ b/src/stc/scintilla/src/Indicator.h @@ -8,15 +8,24 @@ #ifndef INDICATOR_H #define INDICATOR_H +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + /** */ class Indicator { public: int style; + bool under; ColourPair fore; - Indicator() : style(INDIC_PLAIN), fore(ColourDesired(0,0,0)) { + Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)) { } void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); }; +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/src/KeyMap.cxx b/src/stc/scintilla/src/KeyMap.cxx index bfa6e2d789..c223d5b59a 100644 --- a/src/stc/scintilla/src/KeyMap.cxx +++ b/src/stc/scintilla/src/KeyMap.cxx @@ -11,6 +11,10 @@ #include "KeyMap.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + KeyMap::KeyMap() : kmap(0), len(0), alloc(0) { for (int i = 0; MapDefault[i].key; i++) { AssignCmdKey(MapDefault[i].key, diff --git a/src/stc/scintilla/src/KeyMap.h b/src/stc/scintilla/src/KeyMap.h index 364df684f6..fd9005de84 100644 --- a/src/stc/scintilla/src/KeyMap.h +++ b/src/stc/scintilla/src/KeyMap.h @@ -8,6 +8,10 @@ #ifndef KEYTOCOMMAND_H #define KEYTOCOMMAND_H +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + #define SCI_NORM 0 #define SCI_SHIFT SCMOD_SHIFT #define SCI_CTRL SCMOD_CTRL @@ -40,4 +44,8 @@ public: unsigned int Find(int key, int modifiers); // 0 returned on failure }; +#ifdef SCI_NAMESPACE +} +#endif + #endif diff --git a/src/stc/scintilla/src/KeyWords.cxx b/src/stc/scintilla/src/KeyWords.cxx index f82eb7df67..29538d57b5 100644 --- a/src/stc/scintilla/src/KeyWords.cxx +++ b/src/stc/scintilla/src/KeyWords.cxx @@ -19,6 +19,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + const LexerModule *LexerModule::base = 0; int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1; @@ -137,11 +141,13 @@ int Scintilla_LinkLexers() { //++Autogenerated -- run src/LexGen.py to regenerate //**\(\tLINK_LEXER(\*);\n\) + LINK_LEXER(lmAbaqus); LINK_LEXER(lmAda); LINK_LEXER(lmAns1); LINK_LEXER(lmAPDL); LINK_LEXER(lmAsm); LINK_LEXER(lmASP); + LINK_LEXER(lmASY); LINK_LEXER(lmAU3); LINK_LEXER(lmAVE); LINK_LEXER(lmBaan); @@ -152,11 +158,13 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmCaml); LINK_LEXER(lmClw); LINK_LEXER(lmClwNoCase); + LINK_LEXER(lmCmake); LINK_LEXER(lmConf); LINK_LEXER(lmCPP); LINK_LEXER(lmCPPNoCase); LINK_LEXER(lmCsound); LINK_LEXER(lmCss); + LINK_LEXER(lmD); LINK_LEXER(lmDiff); LINK_LEXER(lmEiffel); LINK_LEXER(lmEiffelkw); @@ -168,6 +176,7 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmForth); LINK_LEXER(lmFortran); LINK_LEXER(lmFreeBasic); + LINK_LEXER(lmGAP); LINK_LEXER(lmGui4Cli); LINK_LEXER(lmHaskell); LINK_LEXER(lmHTML); @@ -193,11 +202,14 @@ int Scintilla_LinkLexers() { LINK_LEXER(lmPerl); LINK_LEXER(lmPHP); LINK_LEXER(lmPHPSCRIPT); + LINK_LEXER(lmPLM); LINK_LEXER(lmPOV); + LINK_LEXER(lmProgress); LINK_LEXER(lmProps); LINK_LEXER(lmPS); LINK_LEXER(lmPureBasic); LINK_LEXER(lmPython); + LINK_LEXER(lmR); LINK_LEXER(lmREBOL); LINK_LEXER(lmRuby); LINK_LEXER(lmScriptol); diff --git a/src/stc/scintilla/src/LexAPDL.cxx b/src/stc/scintilla/src/LexAPDL.cxx index 1cf263e501..7bf597b42c 100644 --- a/src/stc/scintilla/src/LexAPDL.cxx +++ b/src/stc/scintilla/src/LexAPDL.cxx @@ -21,6 +21,9 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif static inline bool IsAWordChar(const int ch) { return (ch < 0x80 && (isalnum(ch) || ch == '_')); @@ -123,6 +126,123 @@ static void ColouriseAPDLDoc(unsigned int startPos, int length, int initStyle, W sc.Complete(); } +//------------------------------------------------------------------------------ +// 06-27-07 Sergio Lucato +// - Included code folding for Ansys APDL lexer +// - Copyied from LexBasic.cxx and modified for APDL +//------------------------------------------------------------------------------ + +/* Bits: + * 1 - whitespace + * 2 - operator + * 4 - identifier + * 8 - decimal digit + * 16 - hex digit + * 32 - bin digit + */ +static int character_classification[128] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 10, 6, + 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, + 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4, + 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0 +}; + +static bool IsSpace(int c) { + return c < 128 && (character_classification[c] & 1); +} + +static bool IsIdentifier(int c) { + return c < 128 && (character_classification[c] & 4); +} + +static int LowerCase(int c) +{ + if (c >= 'A' && c <= 'Z') + return 'a' + c - 'A'; + return c; +} + +static int CheckAPDLFoldPoint(char const *token, int &level) { + if (!strcmp(token, "*if") || + !strcmp(token, "*do") || + !strcmp(token, "*dowhile") ) { + level |= SC_FOLDLEVELHEADERFLAG; + return 1; + } + if (!strcmp(token, "*endif") || + !strcmp(token, "*enddo") ) { + return -1; + } + return 0; +} + +static void FoldAPDLDoc(unsigned int startPos, int length, int, + WordList *[], Accessor &styler) { + + int line = styler.GetLine(startPos); + int level = styler.LevelAt(line); + int go = 0, done = 0; + int endPos = startPos + length; + char word[256]; + int wordlen = 0; + int i; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + // Scan for tokens at the start of the line (they may include + // whitespace, for tokens like "End Function" + for (i = startPos; i < endPos; i++) { + int c = styler.SafeGetCharAt(i); + if (!done && !go) { + if (wordlen) { // are we scanning a token already? + word[wordlen] = static_cast(LowerCase(c)); + if (!IsIdentifier(c)) { // done with token + word[wordlen] = '\0'; + go = CheckAPDLFoldPoint(word, level); + if (!go) { + // Treat any whitespace as single blank, for + // things like "End Function". + if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) { + word[wordlen] = ' '; + if (wordlen < 255) + wordlen++; + } + else // done with this line + done = 1; + } + } else if (wordlen < 255) { + wordlen++; + } + } else { // start scanning at first non-whitespace character + if (!IsSpace(c)) { + if (IsIdentifier(c)) { + word[0] = static_cast(LowerCase(c)); + wordlen = 1; + } else // done with this line + done = 1; + } + } + } + if (c == '\n') { // line end + if (!done && wordlen == 0 && foldCompact) // line was only space + level |= SC_FOLDLEVELWHITEFLAG; + if (level != styler.LevelAt(line)) + styler.SetLevel(line, level); + level += go; + line++; + // reset state + wordlen = 0; + level &= ~SC_FOLDLEVELHEADERFLAG; + level &= ~SC_FOLDLEVELWHITEFLAG; + go = 0; + done = 0; + } + } +} + static const char * const apdlWordListDesc[] = { "processors", "commands", @@ -133,4 +253,4 @@ static const char * const apdlWordListDesc[] = { 0 }; -LexerModule lmAPDL(SCLEX_APDL, ColouriseAPDLDoc, "apdl", 0, apdlWordListDesc); +LexerModule lmAPDL(SCLEX_APDL, ColouriseAPDLDoc, "apdl", FoldAPDLDoc, apdlWordListDesc); diff --git a/src/stc/scintilla/src/LexASY.cxx b/src/stc/scintilla/src/LexASY.cxx new file mode 100644 index 0000000000..5bf979fd37 --- /dev/null +++ b/src/stc/scintilla/src/LexASY.cxx @@ -0,0 +1,270 @@ +// Scintilla source code edit control +//Author: instanton (email: soft_share126com) +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" +#include "CharacterSet.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + + CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); + CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); + + int visibleChars = 0; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + if (sc.atLineStart) { + if (sc.state == SCE_ASY_STRING) { + sc.SetState(SCE_ASY_STRING); + } + visibleChars = 0; + } + + 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. + switch (sc.state) { + case SCE_ASY_OPERATOR: + sc.SetState(SCE_ASY_DEFAULT); + break; + case SCE_ASY_NUMBER: + if (!setWord.Contains(sc.ch)) { + sc.SetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_IDENTIFIER: + if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { + char s[1000]; + sc.GetCurrentLowered(s, sizeof(s)); + if (keywords.InList(s)) { + sc.ChangeState(SCE_ASY_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_ASY_WORD2); + } + sc.SetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_COMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_COMMENTLINE: + if (sc.atLineStart) { + sc.SetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_STRING: + if (sc.atLineEnd) { + sc.ChangeState(SCE_ASY_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_CHARACTER: + if (sc.atLineEnd) { + sc.ChangeState(SCE_ASY_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_ASY_DEFAULT); + } + break; + } + + // Determine if a new state should be entered. + if (sc.state == SCE_ASY_DEFAULT) { + if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { + sc.SetState(SCE_ASY_IDENTIFIER); + } else if (sc.Match('/', '*')) { + sc.SetState(SCE_ASY_COMMENT); + sc.Forward(); // + } else if (sc.Match('/', '/')) { + sc.SetState(SCE_ASY_COMMENTLINE); + } else if (sc.ch == '\"') { + sc.SetState(SCE_ASY_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_ASY_CHARACTER); + } else if (sc.ch == '#' && visibleChars == 0) { + do { + sc.Forward(); + } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); + if (sc.atLineEnd) { + sc.SetState(SCE_ASY_DEFAULT); + } + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_ASY_OPERATOR); + } + } + + } + sc.Complete(); +} + +static bool IsAsyCommentStyle(int style) { + return style == SCE_ASY_COMMENT; +} + + +static inline bool isASYidentifier(int ch) { + return + ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ; +} + +static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) +{ + int length=0; + char ch=styler.SafeGetCharAt(pos); + *word=0; + + while(isASYidentifier(ch) && length<100){ + word[length]=ch; + length++; + ch=styler.SafeGetCharAt(pos+length); + } + word[length]=0; + return length; +} + +static bool IsASYDrawingLine(int line, Accessor &styler) { + int pos = styler.LineStart(line); + int eol_pos = styler.LineStart(line + 1) - 1; + + int startpos = pos; + char buffer[100]=""; + + while (startpos 0) + levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + int levelMinCurrent = levelCurrent; + int levelNext = levelCurrent; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (foldComment && IsAsyCommentStyle(style)) { + if (!IsAsyCommentStyle(stylePrev) && (stylePrev != SCE_ASY_COMMENTLINEDOC)) { + levelNext++; + } else if (!IsAsyCommentStyle(styleNext) && (styleNext != SCE_ASY_COMMENTLINEDOC) && !atEOL) { + levelNext--; + } + } + if (style == SCE_ASY_OPERATOR) { + if (ch == '{') { + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + levelNext++; + } else if (ch == '}') { + levelNext--; + } + } + + if (atEOL && IsASYDrawingLine(lineCurrent, styler)){ + if (lineCurrent==0 && IsASYDrawingLine(lineCurrent + 1, styler)) + levelNext++; + else if (lineCurrent!=0 && !IsASYDrawingLine(lineCurrent - 1, styler) + && IsASYDrawingLine(lineCurrent + 1, styler) + ) + levelNext++; + else if (lineCurrent!=0 && IsASYDrawingLine(lineCurrent - 1, styler) && + !IsASYDrawingLine(lineCurrent+1, styler)) + levelNext--; + } + + if (atEOL) { + int levelUse = levelCurrent; + if (foldAtElse) { + levelUse = levelMinCurrent; + } + int lev = levelUse | levelNext << 16; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if (levelUse < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelCurrent = levelNext; + levelMinCurrent = levelCurrent; + visibleChars = 0; + } + if (!IsASpace(ch)) + visibleChars++; + } +} + +static const char * const asyWordLists[] = { + "Primary keywords and identifiers", + "Secondary keywords and identifiers", + 0, + }; + +LexerModule lmASY(SCLEX_ASYMPTOTE, ColouriseAsyDoc, "asy", FoldAsyDoc, asyWordLists); diff --git a/src/stc/scintilla/src/LexAU3.cxx b/src/stc/scintilla/src/LexAU3.cxx index 2bc2e0f4bc..cedf261f5c 100644 --- a/src/stc/scintilla/src/LexAU3.cxx +++ b/src/stc/scintilla/src/LexAU3.cxx @@ -42,6 +42,9 @@ // Sep 27, 2005 - Fixed the SentKey lexing logic in case of multiple sentkeys. // Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions. // Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF) +// Mar 9, 2007 - Fixed bug with + following a String getting the wrong Color. +// Jun 20, 2007 - Fixed Commentblock issue when LF's are used as EOL. +// Jul 26, 2007 - Fixed #endregion undetected bug. // // Copyright for Scintilla: 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. @@ -62,6 +65,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + static inline bool IsTypeCharacter(const int ch) { return ch == '$'; @@ -246,7 +253,12 @@ static void ColouriseAU3Doc(unsigned int startPos, //Reset at line end if (sc.atLineEnd) { ci=0; - sc.SetState(SCE_AU3_COMMENTBLOCK); + if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) + if (sc.atLineEnd) + sc.SetState(SCE_AU3_DEFAULT); + else + sc.SetState(SCE_AU3_COMMENTBLOCK); + break; } //skip rest of line when a ; is encountered if (sc.chPrev == ';') { @@ -265,12 +277,12 @@ static void ColouriseAU3Doc(unsigned int startPos, break; } if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && strcmp(s, "#comments") == 0))) { - if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) - sc.SetState(SCE_AU3_COMMENT); // set to comment line for the rest of the line + if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) + sc.SetState(SCE_AU3_COMMENT); // set to comment line for the rest of the line else ci=2; // line doesn't begin with #CE so skip the rest of the line } - break; + break; } case SCE_AU3_COMMENT: { @@ -304,6 +316,7 @@ static void ColouriseAU3Doc(unsigned int startPos, { sc.ChangeState(SCE_AU3_COMMENTBLOCK); sc.SetState(SCE_AU3_COMMENTBLOCK); + break; } else if (keywords.InList(s)) { sc.ChangeState(SCE_AU3_KEYWORD); @@ -424,6 +437,7 @@ static void ColouriseAU3Doc(unsigned int startPos, { sc.ForwardSetState(SCE_AU3_DEFAULT); si=0; + break; } if (sc.atLineEnd) { @@ -433,6 +447,7 @@ static void ColouriseAU3Doc(unsigned int startPos, if (!IsContinuationLine(lineCurrent,styler)) { sc.SetState(SCE_AU3_DEFAULT); + break; } } // find Sendkeys in a STRING @@ -686,7 +701,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc // vars for getting first word to check for keywords bool FirstWordStart = false; bool FirstWordEnd = false; - char szKeyword[10]=""; + char szKeyword[11]=""; int szKeywordlen = 0; char szThen[5]=""; int szThenlen = 0; diff --git a/src/stc/scintilla/src/LexAVE.cxx b/src/stc/scintilla/src/LexAVE.cxx index e30ee7dc9e..2b7029b1ac 100644 --- a/src/stc/scintilla/src/LexAVE.cxx +++ b/src/stc/scintilla/src/LexAVE.cxx @@ -22,6 +22,9 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif static inline bool IsAWordChar(const int ch) { diff --git a/src/stc/scintilla/src/LexAbaqus.cxx b/src/stc/scintilla/src/LexAbaqus.cxx new file mode 100644 index 0000000000..194b84c516 --- /dev/null +++ b/src/stc/scintilla/src/LexAbaqus.cxx @@ -0,0 +1,260 @@ +// Scintilla source code edit control +/** @file LexABAQUS.cxx + ** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz. + ** By Sergio Lucato. + **/ +// The License.txt file describes the conditions under which this software may be distributed. + +// Code folding copyied and modified from LexBasic.cxx + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80 && (isalnum(ch) || ch == '_')); +} + +static inline bool IsAnOperator(char ch) { + // '.' left out as it is used to make up numbers + if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || + ch == '(' || ch == ')' || ch == '=' || ch == '^' || + ch == '[' || ch == ']' || ch == '<' || ch == '&' || + ch == '>' || ch == ',' || ch == '|' || ch == '~' || + ch == '$' || ch == ':' || ch == '%') + return true; + return false; +} + +static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + int stringStart = ' '; + + WordList &processors = *keywordlists[0]; + WordList &commands = *keywordlists[1]; + WordList &slashcommands = *keywordlists[2]; + WordList &starcommands = *keywordlists[3]; + WordList &arguments = *keywordlists[4]; + WordList &functions = *keywordlists[5]; + + // Do not leak onto next line + initStyle = SCE_ABAQUS_DEFAULT; + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + // Determine if the current state should terminate. + if (sc.state == SCE_ABAQUS_NUMBER) { + if (!(IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') || + ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { + sc.SetState(SCE_ABAQUS_DEFAULT); + } + } else if (sc.state == SCE_ABAQUS_COMMENT) { + if (sc.atLineEnd) { + sc.SetState(SCE_ABAQUS_DEFAULT); + } + } else if (sc.state == SCE_ABAQUS_COMMENTBLOCK) { + if (sc.atLineEnd) { + if (sc.ch == '\r') { + sc.Forward(); + } + sc.ForwardSetState(SCE_ABAQUS_DEFAULT); + } + } else if (sc.state == SCE_ABAQUS_STRING) { + if (sc.atLineEnd) { + sc.SetState(SCE_ABAQUS_DEFAULT); + } else if ((sc.ch == '\'' && stringStart == '\'') || (sc.ch == '\"' && stringStart == '\"')) { + sc.ForwardSetState(SCE_ABAQUS_DEFAULT); + } + } else if (sc.state == SCE_ABAQUS_WORD) { + if (!IsAWordChar(sc.ch)) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + if (processors.InList(s)) { + sc.ChangeState(SCE_ABAQUS_PROCESSOR); + } else if (slashcommands.InList(s)) { + sc.ChangeState(SCE_ABAQUS_SLASHCOMMAND); + } else if (starcommands.InList(s)) { + sc.ChangeState(SCE_ABAQUS_STARCOMMAND); + } else if (commands.InList(s)) { + sc.ChangeState(SCE_ABAQUS_COMMAND); + } else if (arguments.InList(s)) { + sc.ChangeState(SCE_ABAQUS_ARGUMENT); + } else if (functions.InList(s)) { + sc.ChangeState(SCE_ABAQUS_FUNCTION); + } + sc.SetState(SCE_ABAQUS_DEFAULT); + } + } else if (sc.state == SCE_ABAQUS_OPERATOR) { + if (!IsAnOperator(static_cast(sc.ch))) { + sc.SetState(SCE_ABAQUS_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_ABAQUS_DEFAULT) { + if (sc.ch == '*' && sc.chNext == '*') { + sc.SetState(SCE_ABAQUS_COMMENTBLOCK); + } else if (sc.ch == '!') { + sc.SetState(SCE_ABAQUS_COMMENT); + } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_ABAQUS_NUMBER); + } else if (sc.ch == '\'' || sc.ch == '\"') { + sc.SetState(SCE_ABAQUS_STRING); + stringStart = sc.ch; + } else if (IsAWordChar(sc.ch) || ((sc.ch == '*' || sc.ch == '/') && !isgraph(sc.chPrev))) { + sc.SetState(SCE_ABAQUS_WORD); + } else if (IsAnOperator(static_cast(sc.ch))) { + sc.SetState(SCE_ABAQUS_OPERATOR); + } + } + } + sc.Complete(); +} + +//------------------------------------------------------------------------------ +// This copyied and modified from LexBasic.cxx +//------------------------------------------------------------------------------ + +/* Bits: + * 1 - whitespace + * 2 - operator + * 4 - identifier + * 8 - decimal digit + * 16 - hex digit + * 32 - bin digit + */ +static int character_classification[128] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 10, 6, + 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, + 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4, + 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0 +}; + +static bool IsSpace(int c) { + return c < 128 && (character_classification[c] & 1); +} + +static bool IsIdentifier(int c) { + return c < 128 && (character_classification[c] & 4); +} + +static int LowerCase(int c) +{ + if (c >= 'A' && c <= 'Z') + return 'a' + c - 'A'; + return c; +} + +static int CheckABAQUSFoldPoint(char const *token, int &level) { + if (!strcmp(token, "*step") || + !strcmp(token, "*part") || + !strcmp(token, "*instance") || + !strcmp(token, "*assembly") || + !strcmp(token, "***region") ) { + level |= SC_FOLDLEVELHEADERFLAG; + return 1; + } + if (!strcmp(token, "*end step") || + !strcmp(token, "*end part") || + !strcmp(token, "*end instance") || + !strcmp(token, "*end assembly") || + !strcmp(token, "***end region") ) { + return -1; + } + return 0; +} + +static void FoldABAQUSDoc(unsigned int startPos, int length, int, + WordList *[], Accessor &styler) { + + int line = styler.GetLine(startPos); + int level = styler.LevelAt(line); + int go = 0, done = 0; + int endPos = startPos + length; + char word[256]; + int wordlen = 0; + int i; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + // Scan for tokens at the start of the line (they may include + // whitespace, for tokens like "End Function" + for (i = startPos; i < endPos; i++) { + int c = styler.SafeGetCharAt(i); + if (!done && !go) { + if (wordlen) { // are we scanning a token already? + word[wordlen] = static_cast(LowerCase(c)); + if (!IsIdentifier(c)) { // done with token + word[wordlen] = '\0'; + go = CheckABAQUSFoldPoint(word, level); + if (!go) { + // Treat any whitespace as single blank, for + // things like "End Function". + if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) { + word[wordlen] = ' '; + if (wordlen < 255) + wordlen++; + } + else // done with this line + done = 1; + } + } else if (wordlen < 255) { + wordlen++; + } + } else { // start scanning at first non-whitespace character + if (!IsSpace(c)) { + if (IsIdentifier(c)) { + word[0] = static_cast(LowerCase(c)); + wordlen = 1; + } else // done with this line + done = 1; + } + } + } + if (c == '\n') { // line end + if (!done && wordlen == 0 && foldCompact) // line was only space + level |= SC_FOLDLEVELWHITEFLAG; + if (level != styler.LevelAt(line)) + styler.SetLevel(line, level); + level += go; + line++; + // reset state + wordlen = 0; + level &= ~SC_FOLDLEVELHEADERFLAG; + level &= ~SC_FOLDLEVELWHITEFLAG; + go = 0; + done = 0; + } + } +} + +static const char * const abaqusWordListDesc[] = { + "processors", + "commands", + "slashommands", + "starcommands", + "arguments", + "functions", + 0 +}; + +LexerModule lmAbaqus(SCLEX_ABAQUS, ColouriseABAQUSDoc, "abaqus", FoldABAQUSDoc, abaqusWordListDesc); diff --git a/src/stc/scintilla/src/LexAda.cxx b/src/stc/scintilla/src/LexAda.cxx index 0227ce1108..f6c9e7ee7a 100644 --- a/src/stc/scintilla/src/LexAda.cxx +++ b/src/stc/scintilla/src/LexAda.cxx @@ -19,6 +19,10 @@ #include "SciLexer.h" #include "SString.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + /* * Interface */ diff --git a/src/stc/scintilla/src/LexAsm.cxx b/src/stc/scintilla/src/LexAsm.cxx index 93e0b37180..9dd4df4565 100644 --- a/src/stc/scintilla/src/LexAsm.cxx +++ b/src/stc/scintilla/src/LexAsm.cxx @@ -23,6 +23,9 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || diff --git a/src/stc/scintilla/src/LexAsn1.cxx b/src/stc/scintilla/src/LexAsn1.cxx index 1600e6329d..36f1d5dc2e 100644 --- a/src/stc/scintilla/src/LexAsn1.cxx +++ b/src/stc/scintilla/src/LexAsn1.cxx @@ -20,6 +20,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + // Some char test functions static bool isAsn1Number(int ch) { diff --git a/src/stc/scintilla/src/LexBaan.cxx b/src/stc/scintilla/src/LexBaan.cxx index 3a36eb8f27..a6847db71a 100644 --- a/src/stc/scintilla/src/LexBaan.cxx +++ b/src/stc/scintilla/src/LexBaan.cxx @@ -21,6 +21,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '$' || ch == ':'); } diff --git a/src/stc/scintilla/src/LexBash.cxx b/src/stc/scintilla/src/LexBash.cxx index e9c31d6b38..f0376b9474 100644 --- a/src/stc/scintilla/src/LexBash.cxx +++ b/src/stc/scintilla/src/LexBash.cxx @@ -2,7 +2,7 @@ /** @file LexBash.cxx ** Lexer for Bash. **/ -// Copyright 2004-2005 by Neil Hodgson +// Copyright 2004-2007 by Neil Hodgson // Adapted from LexPerl by Kein-Hong Man 2004 // The License.txt file describes the conditions under which this software may be distributed. @@ -20,14 +20,24 @@ #include "Scintilla.h" #include "SciLexer.h" +// define this if you want 'invalid octals' to be marked as errors +// usually, this is not a good idea, permissive lexing is better +#undef PEDANTIC_OCTAL + #define BASH_BASE_ERROR 65 #define BASH_BASE_DECIMAL 66 #define BASH_BASE_HEX 67 +#ifdef PEDANTIC_OCTAL #define BASH_BASE_OCTAL 68 #define BASH_BASE_OCTAL_ERROR 69 +#endif #define HERE_DELIM_MAX 256 +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + static inline int translateBashDigit(char ch) { if (ch >= '0' && ch <= '9') { return ch - '0'; @@ -273,7 +283,11 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, ch = chNext; chNext = chNext2; } else if (isdigit(chNext)) { +#ifdef PEDANTIC_OCTAL numBase = BASH_BASE_OCTAL; +#else + numBase = BASH_BASE_HEX; +#endif } } } else if (iswordstart(ch)) { @@ -338,7 +352,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, HereDoc.Indent = false; } else if (ch == '-' // file test operators && isSingleCharOp(chNext) - && !isalnum((chNext2 = styler.SafeGetCharAt(i+2)))) { + && !isalnum((chNext2 = styler.SafeGetCharAt(i+2))) + && isspace(chPrev)) { styler.ColourTo(i + 1, SCE_SH_WORD); state = SCE_SH_DEFAULT; i++; @@ -364,14 +379,16 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, // hex digit 0-9a-fA-F } else goto numAtEnd; +#ifdef PEDANTIC_OCTAL } else if (numBase == BASH_BASE_OCTAL || numBase == BASH_BASE_OCTAL_ERROR) { if (digit > 7) { if (digit <= 9) { - numBase = BASH_BASE_OCTAL_ERROR; + numBase = BASH_BASE_OCTAL_ERROR; } else goto numAtEnd; } +#endif } else if (numBase == BASH_BASE_ERROR) { if (digit > 9) goto numAtEnd; @@ -389,8 +406,11 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, } } else { numAtEnd: - if (numBase == BASH_BASE_ERROR || - numBase == BASH_BASE_OCTAL_ERROR) + if (numBase == BASH_BASE_ERROR +#ifdef PEDANTIC_OCTAL + || numBase == BASH_BASE_OCTAL_ERROR +#endif + ) state = SCE_SH_ERROR; styler.ColourTo(i - 1, state); state = SCE_SH_DEFAULT; diff --git a/src/stc/scintilla/src/LexBasic.cxx b/src/stc/scintilla/src/LexBasic.cxx index 79ba2b8911..1c5d7b4259 100644 --- a/src/stc/scintilla/src/LexBasic.cxx +++ b/src/stc/scintilla/src/LexBasic.cxx @@ -31,6 +31,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + /* Bits: * 1 - whitespace * 2 - operator diff --git a/src/stc/scintilla/src/LexBullant.cxx b/src/stc/scintilla/src/LexBullant.cxx index 902f89c1e4..cc60cd2fc6 100644 --- a/src/stc/scintilla/src/LexBullant.cxx +++ b/src/stc/scintilla/src/LexBullant.cxx @@ -15,6 +15,9 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; diff --git a/src/stc/scintilla/src/LexCLW.cxx b/src/stc/scintilla/src/LexCLW.cxx index e28e4b13b4..624ef0f2ba 100644 --- a/src/stc/scintilla/src/LexCLW.cxx +++ b/src/stc/scintilla/src/LexCLW.cxx @@ -21,6 +21,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + // Is an end of line character inline bool IsEOL(const int ch) { diff --git a/src/stc/scintilla/src/LexCPP.cxx b/src/stc/scintilla/src/LexCPP.cxx index bf089d6cff..bf351280fe 100644 --- a/src/stc/scintilla/src/LexCPP.cxx +++ b/src/stc/scintilla/src/LexCPP.cxx @@ -19,28 +19,11 @@ #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" +#include "CharacterSet.h" -#define KEYWORD_BOXHEADER 1 -#define KEYWORD_FOLDCONTRACTED 2 - -static bool IsOKBeforeRE(int ch) { - return (ch == '(') || (ch == '=') || (ch == ','); -} - -static inline bool IsAWordChar(int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); -} - -static inline bool IsAWordStart(int ch) { - return (ch < 0x80) && (isalpha(ch) || ch == '_'); -} - -static inline bool IsADoxygenChar(int ch) { - return (ch < 0x80 && islower(ch)) || ch == '$' || ch == '@' || - ch == '\\' || ch == '&' || ch == '<' || - ch == '>' || ch == '#' || ch == '{' || - ch == '}' || ch == '[' || ch == ']'; -} +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif static bool IsSpaceEquiv(int state) { return (state <= SCE_C_COMMENTDOC) || @@ -49,6 +32,24 @@ static bool IsSpaceEquiv(int state) { (state == SCE_C_COMMENTDOCKEYWORDERROR); } +// Preconditions: sc.currentPos points to a character after '+' or '-'. +// The test for pos reaching 0 should be redundant, +// and is in only for safety measures. +// Limitation: this code will give the incorrect answer for code like +// 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, Accessor &styler) { + int pos = (int) sc.currentPos; + while (--pos > 0) { + char ch = styler[pos]; + if (ch == '+' || ch == '-') { + return styler[pos - 1] == ch; + } + } + return false; +} + static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler, bool caseSensitive) { @@ -59,6 +60,18 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; + CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); + CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); + + CharacterSet setDoxygen(CharacterSet::setLower, "$@\\&<>#{}[]"); + + CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); + CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); + if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) { + setWordStart.Add('$'); + setWord.Add('$'); + } + int chPrevNonWhite = ' '; int visibleChars = 0; bool lastWordWasUUID = false; @@ -97,7 +110,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo if (sc.atLineStart) { if (sc.state == SCE_C_STRING) { - // Prevent SCE_C_STRINGEOL from leaking back to previous line which + // Prevent SCE_C_STRINGEOL from leaking back to previous line which // ends with a line continuation by locking in the state upto this position. sc.SetState(SCE_C_STRING); } @@ -126,12 +139,12 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo break; case SCE_C_NUMBER: // We accept almost anything because of hex. and number suffixes - if (!IsAWordChar(sc.ch)) { + if (!setWord.Contains(sc.ch)) { sc.SetState(SCE_C_DEFAULT); } break; case SCE_C_IDENTIFIER: - if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { + if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { char s[1000]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); @@ -201,14 +214,14 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT); - } else if (!IsADoxygenChar(sc.ch)) { + } else if (!setDoxygen.Contains(sc.ch)) { char s[100]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); } else { sc.GetCurrentLowered(s, sizeof(s)); } - if (!isspace(sc.ch) || !keywords3.InList(s + 1)) { + if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); } sc.SetState(styleBeforeDCKeyword); @@ -283,7 +296,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo } else { sc.SetState(SCE_C_NUMBER); } - } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) { + } else if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { if (lastWordWasUUID) { sc.SetState(SCE_C_UUID); lastWordWasUUID = false; @@ -303,7 +316,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo sc.SetState(SCE_C_COMMENTLINEDOC); else sc.SetState(SCE_C_COMMENTLINE); - } else if (sc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) { + } else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite) && + (!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) { sc.SetState(SCE_C_REGEX); // JavaScript's RegEx } else if (sc.ch == '\"') { sc.SetState(SCE_C_STRING); @@ -343,8 +357,8 @@ static bool IsStreamCommentStyle(int style) { // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". -static void FoldNoBoxCppDoc(unsigned int startPos, int length, int initStyle, - Accessor &styler) { +static void FoldCppDoc(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; @@ -368,9 +382,9 @@ static void FoldNoBoxCppDoc(unsigned int startPos, int length, int initStyle, styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsStreamCommentStyle(style)) { - if (!IsStreamCommentStyle(stylePrev)) { + if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) { levelNext++; - } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } @@ -428,16 +442,11 @@ static void FoldNoBoxCppDoc(unsigned int startPos, int length, int initStyle, levelMinCurrent = levelCurrent; visibleChars = 0; } - if (!isspacechar(ch)) + if (!IsASpace(ch)) visibleChars++; } } -static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[], - Accessor &styler) { - FoldNoBoxCppDoc(startPos, length, initStyle, styler); -} - static const char * const cppWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", diff --git a/src/stc/scintilla/src/LexCSS.cxx b/src/stc/scintilla/src/LexCSS.cxx index 963a7b3ef7..f5c112d6f1 100644 --- a/src/stc/scintilla/src/LexCSS.cxx +++ b/src/stc/scintilla/src/LexCSS.cxx @@ -22,6 +22,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + static inline bool IsAWordChar(const unsigned int ch) { return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character diff --git a/src/stc/scintilla/src/LexCaml.cxx b/src/stc/scintilla/src/LexCaml.cxx index 5f4fad5fb8..539eee0de7 100644 --- a/src/stc/scintilla/src/LexCaml.cxx +++ b/src/stc/scintilla/src/LexCaml.cxx @@ -42,6 +42,10 @@ static const int baseT[24] = { 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,16 /* M - X */ }; +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + #ifdef BUILD_AS_EXTERNAL_LEXER /* (actually seems to work!) diff --git a/src/stc/scintilla/src/LexCmake.cxx b/src/stc/scintilla/src/LexCmake.cxx new file mode 100644 index 0000000000..f63eb399f7 --- /dev/null +++ b/src/stc/scintilla/src/LexCmake.cxx @@ -0,0 +1,456 @@ +// Scintilla source code edit control +/** @file LexCmake.cxx + ** Lexer for Cmake + **/ +// Copyright 2007 by Cristian Adam +// based on the NSIS lexer +// The License.txt file describes the conditions under which this software may be distributed. +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static bool isCmakeNumber(char ch) +{ + return(ch >= '0' && ch <= '9'); +} + +static bool isCmakeChar(char ch) +{ + return(ch == '.' ) || (ch == '_' ) || isCmakeNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); +} + +static bool isCmakeLetter(char ch) +{ + return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); +} + +static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) +{ + int nNextLine = -1; + for ( unsigned int i = start; i < end; i++ ) { + char cNext = styler.SafeGetCharAt( i ); + if ( cNext == '\n' ) { + nNextLine = i+1; + break; + } + } + + if ( nNextLine == -1 ) // We never foudn the next line... + return false; + + for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) { + char cNext = styler.SafeGetCharAt( firstChar ); + if ( cNext == ' ' ) + continue; + if ( cNext == '\t' ) + continue; + if ( styler.Match(firstChar, "ELSE") || styler.Match(firstChar, "else")) + return true; + break; + } + + return false; +} + +static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse) +{ + // If the word is too long, it is not what we are looking for + if ( end - start > 20 ) + return foldlevel; + + int newFoldlevel = foldlevel; + + char s[20]; // The key word we are looking for has atmost 13 characters + for (unsigned int i = 0; i < end - start + 1 && i < 19; i++) { + s[i] = static_cast( styler[ start + i ] ); + s[i + 1] = '\0'; + } + + if ( CompareCaseInsensitive(s, "IF") == 0 || CompareCaseInsensitive(s, "WHILE") == 0 + || CompareCaseInsensitive(s, "MACRO") == 0 || CompareCaseInsensitive(s, "FOREACH") == 0 + || CompareCaseInsensitive(s, "ELSEIF") == 0 ) + newFoldlevel++; + else if ( CompareCaseInsensitive(s, "ENDIF") == 0 || CompareCaseInsensitive(s, "ENDWHILE") == 0 + || CompareCaseInsensitive(s, "ENDMACRO") == 0 || CompareCaseInsensitive(s, "ENDFOREACH") == 0) + newFoldlevel--; + else if ( bElse && CompareCaseInsensitive(s, "ELSEIF") == 0 ) + newFoldlevel++; + else if ( bElse && CompareCaseInsensitive(s, "ELSE") == 0 ) + newFoldlevel++; + + return newFoldlevel; +} + +static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) +{ + char word[100] = {0}; + char lowercaseWord[100] = {0}; + + WordList &Commands = *keywordLists[0]; + WordList &Parameters = *keywordLists[1]; + WordList &UserDefined = *keywordLists[2]; + + for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) { + word[i] = static_cast( styler[ start + i ] ); + lowercaseWord[i] = static_cast(tolower(word[i])); + } + + // Check for special words... + if ( CompareCaseInsensitive(word, "MACRO") == 0 || CompareCaseInsensitive(word, "ENDMACRO") == 0 ) + return SCE_CMAKE_MACRODEF; + + if ( CompareCaseInsensitive(word, "IF") == 0 || CompareCaseInsensitive(word, "ENDIF") == 0 ) + return SCE_CMAKE_IFDEFINEDEF; + + if ( CompareCaseInsensitive(word, "ELSEIF") == 0 || CompareCaseInsensitive(word, "ELSE") == 0 ) + return SCE_CMAKE_IFDEFINEDEF; + + if ( CompareCaseInsensitive(word, "WHILE") == 0 || CompareCaseInsensitive(word, "ENDWHILE") == 0) + return SCE_CMAKE_WHILEDEF; + + if ( CompareCaseInsensitive(word, "FOREACH") == 0 || CompareCaseInsensitive(word, "ENDFOREACH") == 0) + return SCE_CMAKE_FOREACHDEF; + + if ( Commands.InList(lowercaseWord) ) + return SCE_CMAKE_COMMANDS; + + if ( Parameters.InList(word) ) + return SCE_CMAKE_PARAMETERS; + + + if ( UserDefined.InList(word) ) + return SCE_CMAKE_USERDEFINED; + + if ( strlen(word) > 3 ) { + if ( word[1] == '{' && word[strlen(word)-1] == '}' ) + return SCE_CMAKE_VARIABLE; + } + + // To check for numbers + if ( isCmakeNumber( word[0] ) ) { + bool bHasSimpleCmakeNumber = true; + for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) { + if ( !isCmakeNumber( word[j] ) ) { + bHasSimpleCmakeNumber = false; + break; + } + } + + if ( bHasSimpleCmakeNumber ) + return SCE_CMAKE_NUMBER; + } + + return SCE_CMAKE_DEFAULT; +} + +static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) +{ + int state = SCE_CMAKE_DEFAULT; + if ( startPos > 0 ) + state = styler.StyleAt(startPos-1); // Use the style from the previous line, usually default, but could be commentbox + + styler.StartAt( startPos ); + styler.GetLine( startPos ); + + unsigned int nLengthDoc = startPos + length; + styler.StartSegment( startPos ); + + char cCurrChar; + bool bVarInString = false; + bool bClassicVarInString = false; + + unsigned int i; + for ( i = startPos; i < nLengthDoc; i++ ) { + cCurrChar = styler.SafeGetCharAt( i ); + char cNextChar = styler.SafeGetCharAt(i+1); + + switch (state) { + case SCE_CMAKE_DEFAULT: + if ( cCurrChar == '#' ) { // we have a comment line + styler.ColourTo(i-1, state ); + state = SCE_CMAKE_COMMENT; + break; + } + if ( cCurrChar == '"' ) { + styler.ColourTo(i-1, state ); + state = SCE_CMAKE_STRINGDQ; + bVarInString = false; + bClassicVarInString = false; + break; + } + if ( cCurrChar == '\'' ) { + styler.ColourTo(i-1, state ); + state = SCE_CMAKE_STRINGRQ; + bVarInString = false; + bClassicVarInString = false; + break; + } + if ( cCurrChar == '`' ) { + styler.ColourTo(i-1, state ); + state = SCE_CMAKE_STRINGLQ; + bVarInString = false; + bClassicVarInString = false; + break; + } + + // CMake Variable + if ( cCurrChar == '$' || isCmakeChar(cCurrChar)) { + styler.ColourTo(i-1,state); + state = SCE_CMAKE_VARIABLE; + + // If it is a number, we must check and set style here first... + if ( isCmakeNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) ) + styler.ColourTo( i, SCE_CMAKE_NUMBER); + + break; + } + + break; + case SCE_CMAKE_COMMENT: + if ( cNextChar == '\n' || cNextChar == '\r' ) { + // Special case: + if ( cCurrChar == '\\' ) { + styler.ColourTo(i-2,state); + styler.ColourTo(i,SCE_CMAKE_DEFAULT); + } + else { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + } + } + break; + case SCE_CMAKE_STRINGDQ: + case SCE_CMAKE_STRINGLQ: + case SCE_CMAKE_STRINGRQ: + + if ( styler.SafeGetCharAt(i-1) == '\\' && styler.SafeGetCharAt(i-2) == '$' ) + break; // Ignore the next character, even if it is a quote of some sort + + if ( cCurrChar == '"' && state == SCE_CMAKE_STRINGDQ ) { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + break; + } + + if ( cCurrChar == '`' && state == SCE_CMAKE_STRINGLQ ) { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + break; + } + + if ( cCurrChar == '\'' && state == SCE_CMAKE_STRINGRQ ) { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + break; + } + + if ( cNextChar == '\r' || cNextChar == '\n' ) { + int nCurLine = styler.GetLine(i+1); + int nBack = i; + // We need to check if the previous line has a \ in it... + bool bNextLine = false; + + while ( nBack > 0 ) { + if ( styler.GetLine(nBack) != nCurLine ) + break; + + char cTemp = styler.SafeGetCharAt(nBack, 'a'); // Letter 'a' is safe here + + if ( cTemp == '\\' ) { + bNextLine = true; + break; + } + if ( cTemp != '\r' && cTemp != '\n' && cTemp != '\t' && cTemp != ' ' ) + break; + + nBack--; + } + + if ( bNextLine ) { + styler.ColourTo(i+1,state); + } + if ( bNextLine == false ) { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + } + } + break; + + case SCE_CMAKE_VARIABLE: + + // CMake Variable: + if ( cCurrChar == '$' ) + state = SCE_CMAKE_DEFAULT; + else if ( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) ) + state = SCE_CMAKE_DEFAULT; + else if ( (isCmakeChar(cCurrChar) && !isCmakeChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' ) { + state = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler ); + styler.ColourTo( i, state); + state = SCE_CMAKE_DEFAULT; + } + else if ( !isCmakeChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' ) { + if ( classifyWordCmake( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_CMAKE_NUMBER ) + styler.ColourTo( i-1, SCE_CMAKE_NUMBER ); + + state = SCE_CMAKE_DEFAULT; + + if ( cCurrChar == '"' ) { + state = SCE_CMAKE_STRINGDQ; + bVarInString = false; + bClassicVarInString = false; + } + else if ( cCurrChar == '`' ) { + state = SCE_CMAKE_STRINGLQ; + bVarInString = false; + bClassicVarInString = false; + } + else if ( cCurrChar == '\'' ) { + state = SCE_CMAKE_STRINGRQ; + bVarInString = false; + bClassicVarInString = false; + } + else if ( cCurrChar == '#' ) { + state = SCE_CMAKE_COMMENT; + } + } + break; + } + + if ( state == SCE_CMAKE_COMMENT) { + styler.ColourTo(i,state); + } + else if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) { + bool bIngoreNextDollarSign = false; + + if ( bVarInString && cCurrChar == '$' ) { + bVarInString = false; + bIngoreNextDollarSign = true; + } + else if ( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' || cNextChar == '"' || cNextChar == '`' || cNextChar == '\'' ) ) { + styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); + bVarInString = false; + bIngoreNextDollarSign = false; + } + + else if ( bVarInString && !isCmakeChar(cNextChar) ) { + int nWordState = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler); + if ( nWordState == SCE_CMAKE_VARIABLE ) + styler.ColourTo( i, SCE_CMAKE_STRINGVAR); + bVarInString = false; + } + // Covers "${TEST}..." + else if ( bClassicVarInString && cNextChar == '}' ) { + styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); + bClassicVarInString = false; + } + + // Start of var in string + if ( !bIngoreNextDollarSign && cCurrChar == '$' && cNextChar == '{' ) { + styler.ColourTo( i-1, state); + bClassicVarInString = true; + bVarInString = false; + } + else if ( !bIngoreNextDollarSign && cCurrChar == '$' ) { + styler.ColourTo( i-1, state); + bVarInString = true; + bClassicVarInString = false; + } + } + } + + // Colourise remaining document + styler.ColourTo(nLengthDoc-1,state); +} + +static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) +{ + // No folding enabled, no reason to continue... + if ( styler.GetPropertyInt("fold") == 0 ) + return; + + bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; + + int lineCurrent = styler.GetLine(startPos); + unsigned int safeStartPos = styler.LineStart( lineCurrent ); + + bool bArg1 = true; + int nWordStart = -1; + + int levelCurrent = SC_FOLDLEVELBASE; + if (lineCurrent > 0) + levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + int levelNext = levelCurrent; + + for (unsigned int i = safeStartPos; i < startPos + length; i++) { + char chCurr = styler.SafeGetCharAt(i); + + if ( bArg1 ) { + if ( nWordStart == -1 && (isCmakeLetter(chCurr)) ) { + nWordStart = i; + } + else if ( isCmakeLetter(chCurr) == false && nWordStart > -1 ) { + int newLevel = calculateFoldCmake( nWordStart, i-1, levelNext, styler, foldAtElse); + + if ( newLevel == levelNext ) { + if ( foldAtElse ) { + if ( CmakeNextLineHasElse(i, startPos + length, styler) ) + levelNext--; + } + } + else + levelNext = newLevel; + bArg1 = false; + } + } + + if ( chCurr == '\n' ) { + if ( bArg1 && foldAtElse) { + if ( CmakeNextLineHasElse(i, startPos + length, styler) ) + levelNext--; + } + + // If we are on a new line... + int levelUse = levelCurrent; + int lev = levelUse | levelNext << 16; + if (levelUse < levelNext ) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) + styler.SetLevel(lineCurrent, lev); + + lineCurrent++; + levelCurrent = levelNext; + bArg1 = true; // New line, lets look at first argument again + nWordStart = -1; + } + } + + int levelUse = levelCurrent; + int lev = levelUse | levelNext << 16; + if (levelUse < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) + styler.SetLevel(lineCurrent, lev); +} + +static const char * const cmakeWordLists[] = { + "Commands", + "Parameters", + "UserDefined", + 0, + 0,}; + +LexerModule lmCmake(SCLEX_CMAKE, ColouriseCmakeDoc, "cmake", FoldCmakeDoc, cmakeWordLists); diff --git a/src/stc/scintilla/src/LexConf.cxx b/src/stc/scintilla/src/LexConf.cxx index c33cdb5ce6..969275f925 100644 --- a/src/stc/scintilla/src/LexConf.cxx +++ b/src/stc/scintilla/src/LexConf.cxx @@ -23,6 +23,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) { int state = SCE_CONF_DEFAULT; diff --git a/src/stc/scintilla/src/LexCrontab.cxx b/src/stc/scintilla/src/LexCrontab.cxx index d139bb4f14..62044c3709 100644 --- a/src/stc/scintilla/src/LexCrontab.cxx +++ b/src/stc/scintilla/src/LexCrontab.cxx @@ -21,6 +21,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) { diff --git a/src/stc/scintilla/src/LexCsound.cxx b/src/stc/scintilla/src/LexCsound.cxx index 27f7b990a2..4162c9b3aa 100644 --- a/src/stc/scintilla/src/LexCsound.cxx +++ b/src/stc/scintilla/src/LexCsound.cxx @@ -20,6 +20,9 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || diff --git a/src/stc/scintilla/src/LexD.cxx b/src/stc/scintilla/src/LexD.cxx new file mode 100644 index 0000000000..95be129d59 --- /dev/null +++ b/src/stc/scintilla/src/LexD.cxx @@ -0,0 +1,358 @@ +/** @file LexD.cxx + ** Lexer for D. + ** + ** Copyright (c) 2006 by Waldemar Augustyn + **/ +// Copyright 1998-2005 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/*/ Nested comments require keeping the value of the nesting level for every + position in the document. But since scintilla always styles line by line, + we only need to store one value per line. The non-negative number indicates + nesting level at the end of the line. +/*/ + +// We use custom qualifiers since it is not clear what D allows. + +static bool IsWordStart(int ch) { + return isascii(ch) && (isalpha(ch) || ch == '_'); +} + +static bool IsWord(int ch) { + return isascii(ch) && (isalnum(ch) || ch == '_'); +} + +static bool IsDoxygen(int ch) { + if (isascii(ch) && islower(ch)) + return true; + if (ch == '$' || ch == '@' || ch == '\\' || + ch == '&' || ch == '#' || ch == '<' || ch == '>' || + ch == '{' || ch == '}' || ch == '[' || ch == ']') + return true; + return false; +} + + +static void ColouriseDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler, bool caseSensitive) { + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + WordList &keywords4 = *keywordlists[3]; + + int styleBeforeDCKeyword = SCE_D_DEFAULT; + + StyleContext sc(startPos, length, initStyle, styler); + + int curLine = styler.GetLine(startPos); + int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0; + + for (; sc.More(); sc.Forward()) { + + if (sc.atLineStart) { + if (sc.state == SCE_D_STRING) { + // Prevent SCE_D_STRINGEOL from leaking back to previous line which + // ends with a line continuation by locking in the state upto this position. + sc.SetState(SCE_D_STRING); + } + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + } + + // 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(); + } + continue; + } + } + + // Determine if the current state should terminate. + switch (sc.state) { + case SCE_D_OPERATOR: + sc.SetState(SCE_D_DEFAULT); + break; + case SCE_D_NUMBER: + // We accept almost anything because of hex. and number suffixes + if (!IsWord(sc.ch) && sc.ch != '.') { + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_IDENTIFIER: + if (!IsWord(sc.ch)) { + char s[1000]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + if (keywords.InList(s)) { + sc.ChangeState(SCE_D_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_D_WORD2); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_D_TYPEDEF); + } + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENTDOC: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_D_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_D_COMMENTDOC; + sc.SetState(SCE_D_COMMENTDOCKEYWORD); + } + } + break; + case SCE_D_COMMENTLINE: + if (sc.atLineStart) { + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENTLINEDOC: + if (sc.atLineStart) { + sc.SetState(SCE_D_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_D_COMMENTLINEDOC; + sc.SetState(SCE_D_COMMENTDOCKEYWORD); + } + } + break; + case SCE_D_COMMENTDOCKEYWORD: + if ((styleBeforeDCKeyword == SCE_D_COMMENTDOC) && sc.Match('*', '/')) { + sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } else if (!IsDoxygen(sc.ch)) { + char s[100]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { + sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); + } + sc.SetState(styleBeforeDCKeyword); + } + break; + case SCE_D_COMMENTNESTED: + if (sc.Match('+', '/')) { + if (curNcLevel > 0) + curNcLevel -= 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.Forward(); + if (curNcLevel == 0) { + sc.ForwardSetState(SCE_D_DEFAULT); + } + } + else if (sc.Match('/','+')) { + curNcLevel += 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.Forward(); + } + break; + case SCE_D_STRING: + if (sc.atLineEnd) { + sc.ChangeState(SCE_D_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_CHARACTER: + if (sc.atLineEnd) { + sc.ChangeState(SCE_D_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_STRINGEOL: + if (sc.atLineStart) { + sc.SetState(SCE_D_DEFAULT); + } + break; + } + + // Determine if a new state should be entered. + if (sc.state == SCE_D_DEFAULT) { + if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_D_NUMBER); + } else if (IsWordStart(sc.ch)) { + sc.SetState(SCE_D_IDENTIFIER); + } else if (sc.Match('/','+')) { + curNcLevel += 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.SetState(SCE_D_COMMENTNESTED); + sc.Forward(); + } else if (sc.Match('/', '*')) { + if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style + sc.SetState(SCE_D_COMMENTDOC); + } else { + sc.SetState(SCE_D_COMMENT); + } + sc.Forward(); // Eat the * so it isn't used for the end of the comment + } else if (sc.Match('/', '/')) { + if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) + // Support of Qt/Doxygen doc. style + sc.SetState(SCE_D_COMMENTLINEDOC); + else + sc.SetState(SCE_D_COMMENTLINE); + } else if (sc.ch == '\"') { + sc.SetState(SCE_D_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_D_CHARACTER); + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_D_OPERATOR); + } + } + } + sc.Complete(); +} + +static bool IsStreamCommentStyle(int style) { + return style == SCE_D_COMMENT || + style == SCE_D_COMMENTDOC || + style == SCE_D_COMMENTDOCKEYWORD || + style == SCE_D_COMMENTDOCKEYWORDERROR; +} + +// Store both the current line's fold level and the next lines in the +// level store to make it easy to pick up with each increment +// and to make it possible to fiddle the current level for "} else {". +static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) { + bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + bool foldAtElse = styler.GetPropertyInt("lexer.d.fold.at.else", + styler.GetPropertyInt("fold.at.else", 0)) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelCurrent = SC_FOLDLEVELBASE; + if (lineCurrent > 0) + levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + int levelMinCurrent = levelCurrent; + int levelNext = levelCurrent; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (foldComment && IsStreamCommentStyle(style)) { + if (!IsStreamCommentStyle(stylePrev)) { + levelNext++; + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + // Comments don't end at end of line and the next character may be unstyled. + levelNext--; + } + } + if (style == SCE_D_OPERATOR) { + if (ch == '{') { + // Measure the minimum before a '{' to allow + // folding on "} else {" + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + levelNext++; + } else if (ch == '}') { + levelNext--; + } + } + if (atEOL) { + if (foldComment) { // Handle nested comments + int nc; + nc = styler.GetLineState(lineCurrent); + nc -= lineCurrent>0? styler.GetLineState(lineCurrent-1): 0; + levelNext += nc; + } + int levelUse = levelCurrent; + if (foldAtElse) { + levelUse = levelMinCurrent; + } + int lev = levelUse | levelNext << 16; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if (levelUse < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelCurrent = levelNext; + levelMinCurrent = levelCurrent; + visibleChars = 0; + } + if (!IsASpace(ch)) + visibleChars++; + } +} + +static void FoldDDoc(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + FoldDoc(startPos, length, initStyle, styler); +} + +static const char * const dWordLists[] = { + "Primary keywords and identifiers", + "Secondary keywords and identifiers", + "Documentation comment keywords", + "Type definitions and aliases", + 0, + }; + +static void ColouriseDDoc(unsigned int startPos, int length, + int initStyle, WordList *keywordlists[], Accessor &styler) { + ColouriseDoc(startPos, length, initStyle, keywordlists, styler, true); +} + +LexerModule lmD(SCLEX_D, ColouriseDDoc, "d", FoldDDoc, dWordLists); diff --git a/src/stc/scintilla/src/LexEScript.cxx b/src/stc/scintilla/src/LexEScript.cxx index 49411588aa..295aaec531 100644 --- a/src/stc/scintilla/src/LexEScript.cxx +++ b/src/stc/scintilla/src/LexEScript.cxx @@ -19,6 +19,9 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif static inline bool IsAWordChar(const int ch) { diff --git a/src/stc/scintilla/src/LexEiffel.cxx b/src/stc/scintilla/src/LexEiffel.cxx index 4aed7c6af1..03dea5e73d 100644 --- a/src/stc/scintilla/src/LexEiffel.cxx +++ b/src/stc/scintilla/src/LexEiffel.cxx @@ -20,6 +20,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + static inline bool isEiffelOperator(unsigned int ch) { // '.' left out as it is used to make up numbers return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' || diff --git a/src/stc/scintilla/src/LexErlang.cxx b/src/stc/scintilla/src/LexErlang.cxx index d801f74166..d56f785287 100644 --- a/src/stc/scintilla/src/LexErlang.cxx +++ b/src/stc/scintilla/src/LexErlang.cxx @@ -21,6 +21,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + /* TODO: o _Param should be a new lexical type diff --git a/src/stc/scintilla/src/LexFlagship.cxx b/src/stc/scintilla/src/LexFlagship.cxx index db0314eb96..baf2941a84 100644 --- a/src/stc/scintilla/src/LexFlagship.cxx +++ b/src/stc/scintilla/src/LexFlagship.cxx @@ -22,6 +22,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + static bool IsFlagShipComment(Accessor &styler, int pos, int len) { return len>0 && styler[pos]=='\''; } diff --git a/src/stc/scintilla/src/LexForth.cxx b/src/stc/scintilla/src/LexForth.cxx index 3f128156d6..f097b0e00a 100644 --- a/src/stc/scintilla/src/LexForth.cxx +++ b/src/stc/scintilla/src/LexForth.cxx @@ -21,6 +21,10 @@ #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + bool is_whitespace(int ch){ return ch == '\n' || ch == '\r' || ch == '\t' || ch == ' '; } diff --git a/src/stc/scintilla/src/LexFortran.cxx b/src/stc/scintilla/src/LexFortran.cxx index 3ab1116ea6..c68c5b62fa 100644 --- a/src/stc/scintilla/src/LexFortran.cxx +++ b/src/stc/scintilla/src/LexFortran.cxx @@ -19,6 +19,11 @@ #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + /***********************************************/ static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%'); diff --git a/src/stc/scintilla/src/LexGAP.cxx b/src/stc/scintilla/src/LexGAP.cxx new file mode 100644 index 0000000000..25bd33b900 --- /dev/null +++ b/src/stc/scintilla/src/LexGAP.cxx @@ -0,0 +1,263 @@ +// Scintilla source code edit control +/** @file LexGAP.cxx + ** Lexer for the GAP language. (The GAP System for Computational Discrete Algebra) + ** http://www.gap-system.org + **/ +// Copyright 2007 by Istvan Szollosi ( szteven gmail com ) +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsGAPOperator(char ch) { + if (isalnum(ch)) return false; + if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || + ch == '^' || ch == ',' || ch == '!' || ch == '.' || + ch == '=' || ch == '<' || ch == '>' || ch == '(' || + ch == ')' || ch == ';' || ch == '[' || ch == ']' || + ch == '{' || ch == '}' || ch == ':' ) + return true; + return false; +} + +static void GetRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) { + unsigned int i = 0; + while ((i < end - start + 1) && (i < len-1)) { + s[i] = static_cast(styler[start + i]); + i++; + } + s[i] = '\0'; +} + +static void ColouriseGAPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { + + WordList &keywords1 = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + WordList &keywords4 = *keywordlists[3]; + + // Do not leak onto next line + if (initStyle == SCE_GAP_STRINGEOL) initStyle = SCE_GAP_DEFAULT; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + // Prevent SCE_GAP_STRINGEOL from leaking back to previous line + if ( sc.atLineStart ) { + if (sc.state == SCE_GAP_STRING) sc.SetState(SCE_GAP_STRING); + if (sc.state == SCE_GAP_CHAR) sc.SetState(SCE_GAP_CHAR); + } + + // 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(); + } + continue; + } + } + + // Determine if the current state should terminate + switch (sc.state) { + case SCE_GAP_OPERATOR : + sc.SetState(SCE_GAP_DEFAULT); + break; + + case SCE_GAP_NUMBER : + if (!IsADigit(sc.ch)) { + if (sc.ch == '\\') { + if (!sc.atLineEnd) { + if (!IsADigit(sc.chNext)) { + sc.Forward(); + sc.ChangeState(SCE_GAP_IDENTIFIER); + } + } + } else if (isalpha(sc.ch) || sc.ch == '_') { + sc.ChangeState(SCE_GAP_IDENTIFIER); + } + else sc.SetState(SCE_GAP_DEFAULT); + } + break; + + case SCE_GAP_IDENTIFIER : + if (!(iswordstart(static_cast(sc.ch)) || sc.ch == '$')) { + if (sc.ch == '\\') sc.Forward(); + else { + char s[1000]; + sc.GetCurrent(s, sizeof(s)); + if (keywords1.InList(s)) { + sc.ChangeState(SCE_GAP_KEYWORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_GAP_KEYWORD2); + } else if (keywords3.InList(s)) { + sc.ChangeState(SCE_GAP_KEYWORD3); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_GAP_KEYWORD4); + } + sc.SetState(SCE_GAP_DEFAULT); + } + } + break; + + case SCE_GAP_COMMENT : + if (sc.atLineEnd) { + sc.SetState(SCE_GAP_DEFAULT); + } + break; + + case SCE_GAP_STRING: + if (sc.atLineEnd) { + sc.ChangeState(SCE_GAP_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_GAP_DEFAULT); + } + break; + + case SCE_GAP_CHAR: + if (sc.atLineEnd) { + sc.ChangeState(SCE_GAP_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_GAP_DEFAULT); + } + break; + + case SCE_GAP_STRINGEOL: + if (sc.atLineStart) { + sc.SetState(SCE_GAP_DEFAULT); + } + break; + } + + // Determine if a new state should be entered + if (sc.state == SCE_GAP_DEFAULT) { + if (IsGAPOperator(static_cast(sc.ch))) { + sc.SetState(SCE_GAP_OPERATOR); + } + else if (IsADigit(sc.ch)) { + sc.SetState(SCE_GAP_NUMBER); + } else if (isalpha(sc.ch) || sc.ch == '_' || sc.ch == '\\' || sc.ch == '$' || sc.ch == '~') { + sc.SetState(SCE_GAP_IDENTIFIER); + if (sc.ch == '\\') sc.Forward(); + } else if (sc.ch == '#') { + sc.SetState(SCE_GAP_COMMENT); + } else if (sc.ch == '\"') { + sc.SetState(SCE_GAP_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_GAP_CHAR); + } + } + + } + sc.Complete(); +} + +static int ClassifyFoldPointGAP(const char* s) { + int level = 0; + if (strcmp(s, "function") == 0 || + strcmp(s, "do") == 0 || + strcmp(s, "if") == 0 || + strcmp(s, "repeat") == 0 ) { + level = 1; + } else if (strcmp(s, "end") == 0 || + strcmp(s, "od") == 0 || + strcmp(s, "fi") == 0 || + strcmp(s, "until") == 0 ) { + level = -1; + } + return level; +} + +static void FoldGAPDoc( unsigned int startPos, int length, int initStyle, WordList** , Accessor &styler) { + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + + int lastStart = 0; + + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + + if (stylePrev != SCE_GAP_KEYWORD && style == SCE_GAP_KEYWORD) { + // Store last word start point. + lastStart = i; + } + + if (stylePrev == SCE_GAP_KEYWORD) { + if(iswordchar(ch) && !iswordchar(chNext)) { + char s[100]; + GetRange(lastStart, i, styler, s, sizeof(s)); + levelCurrent += ClassifyFoldPointGAP(s); + } + } + + if (atEOL) { + int lev = levelPrev; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + } + + if (!isspacechar(ch)) + visibleChars++; + } + + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const GAPWordListDesc[] = { + "Keywords 1", + "Keywords 2", + "Keywords 3 (unused)", + "Keywords 4 (unused)", + 0 +}; + +LexerModule lmGAP( + SCLEX_GAP, + ColouriseGAPDoc, + "gap", + FoldGAPDoc, + GAPWordListDesc); diff --git a/src/stc/scintilla/src/LexGui4Cli.cxx b/src/stc/scintilla/src/LexGui4Cli.cxx index f76fff6cc4..1c92de72e7 100644 --- a/src/stc/scintilla/src/LexGui4Cli.cxx +++ b/src/stc/scintilla/src/LexGui4Cli.cxx @@ -36,6 +36,10 @@ val SCE_GC_OPERATOR=9 #include "Scintilla.h" #include "SciLexer.h" +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + #define debug Platform::DebugPrintf static inline bool IsAWordChar(const int ch) { diff --git a/src/stc/scintilla/src/LexHTML.cxx b/src/stc/scintilla/src/LexHTML.cxx index dad8fce46f..9b8d5dc923 100644 --- a/src/stc/scintilla/src/LexHTML.cxx +++ b/src/stc/scintilla/src/LexHTML.cxx @@ -19,6 +19,11 @@ #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" +#include "CharacterSet.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif #define SCE_HA_JS (SCE_HJA_START - SCE_HJ_START) #define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START) @@ -35,6 +40,20 @@ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } +inline bool IsOperator(int ch) { + if (isascii(ch) && isalnum(ch)) + return false; + // '.' left out as it is used to make up numbers + if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || + ch == '(' || ch == ')' || ch == '-' || ch == '+' || + ch == '=' || ch == '|' || ch == '{' || ch == '}' || + ch == '[' || ch == ']' || ch == ':' || ch == ';' || + ch == '<' || ch == '>' || ch == ',' || ch == '/' || + ch == '?' || ch == '!' || ch == '.' || ch == '~') + return true; + return false; +} + static inline int MakeLowerCase(int ch) { if (ch < 'A' || ch > 'Z') return ch; @@ -66,8 +85,15 @@ static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, return eScriptJS; if (strstr(s, "php")) return eScriptPHP; - if (strstr(s, "xml")) + if (strstr(s, "xml")) { + const char *xml = strstr(s, "xml"); + for (const char *t=s; t= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { - StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_PYTHON); - } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) { - StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_VBS); - } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { - StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS); - } else { - StateToPrint = state; + int StateToPrint = state; + + if (state >= SCE_HJ_START) { + if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { + StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_PYTHON); + } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) { + StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_VBS); + } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { + StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS); + } } return StateToPrint; @@ -173,6 +199,7 @@ static inline bool stateAllowsTermination(int state) { bool allowTermination = !isStringState(state); if (allowTermination) { switch (state) { + case SCE_HB_COMMENTLINE: case SCE_HPHP_COMMENT: case SCE_HP_COMMENTLINE: case SCE_HPA_COMMENTLINE: @@ -222,7 +249,7 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k static int classifyTagHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, bool &tagDontFold, - bool caseSensitive) { + bool caseSensitive, bool isXml) { char s[30 + 2]; // Copy after the '<' unsigned int i = 0; @@ -238,9 +265,10 @@ static int classifyTagHTML(unsigned int start, unsigned int end, s[i] = ' '; s[i+1] = '\0'; + // if the current language is XML, I can fold any tag + // if the current language is HTML, I don't want to fold certain tags (input, meta, etc.) //...to find it in the list of no-container-tags - // (There are many more. We will need a keywordlist in the property file for this) - tagDontFold = (NULL != strstr("meta link img area br hr input ",s)); + tagDontFold = (!isXml) && (NULL != strstr("meta link img area br hr input ",s)); //now we can remove the trailing space s[i] = '\0'; @@ -390,21 +418,21 @@ static int StateForScript(script_type scriptLanguage) { return Result; } -static inline bool ishtmlwordchar(char ch) { +static inline bool ishtmlwordchar(int ch) { return !isascii(ch) || (isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'); } -static inline bool issgmlwordchar(char ch) { +static inline bool issgmlwordchar(int ch) { return !isascii(ch) || (isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '['); } -static inline bool IsPhpWordStart(const unsigned char ch) { +static inline bool IsPhpWordStart(int ch) { return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f); } -static inline bool IsPhpWordChar(char ch) { +static inline bool IsPhpWordChar(int ch) { return IsADigit(ch) || IsPhpWordStart(ch); } @@ -425,11 +453,11 @@ static bool IsScriptCommentState(const int state) { state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE; } -static bool isLineEnd(char ch) { +static bool isLineEnd(int ch) { return ch == '\r' || ch == '\n'; } -static bool isOKBeforeRE(char ch) { +static bool isOKBeforeRE(int ch) { return (ch == '(') || (ch == '=') || (ch == ','); } @@ -457,7 +485,7 @@ static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringD } static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { + Accessor &styler, bool isXml) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; @@ -465,8 +493,8 @@ 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 (7 bits worth) than most lexers - styler.StartAt(startPos, STYLE_MAX); + // Lexer for HTML requires more lexical states (8 bits worth) than most lexers + styler.StartAt(startPos, static_cast(STYLE_MAX)); char prevWord[200]; prevWord[0] = '\0'; char phpStringDelimiter[200]; // PHP is not limited in length, we are @@ -488,7 +516,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty length++; state = styler.StyleAt(startPos); } - styler.StartAt(startPos, STYLE_MAX); + styler.StartAt(startPos, static_cast(STYLE_MAX)); int lineCurrent = styler.GetLine(startPos); int lineState; @@ -515,13 +543,17 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0; + const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true); + const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true); + const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int visibleChars = 0; - char chPrev = ' '; - char ch = ' '; - char chPrevNonWhite = ' '; + int chPrev = ' '; + int ch = ' '; + int chPrevNonWhite = ' '; // look back to set chPrevNonWhite properly for better regex colouring if (scriptLanguage == eScriptJS && startPos > 0) { int back = startPos; @@ -533,30 +565,30 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty break; } if (style == SCE_HJ_SYMBOLS) { - chPrevNonWhite = styler.SafeGetCharAt(back); + chPrevNonWhite = static_cast(styler.SafeGetCharAt(back)); } } styler.StartSegment(startPos); const int lengthDoc = startPos + length; for (int i = startPos; i < lengthDoc; i++) { - const char chPrev2 = chPrev; + const int chPrev2 = chPrev; chPrev = ch; - if (!isspacechar(ch) && state != SCE_HJ_COMMENT && + if (!IsASpace(ch) && state != SCE_HJ_COMMENT && state != SCE_HJ_COMMENTLINE && state != SCE_HJ_COMMENTDOC) chPrevNonWhite = ch; - ch = styler[i]; - char chNext = styler.SafeGetCharAt(i + 1); - const char chNext2 = styler.SafeGetCharAt(i + 2); + ch = static_cast(styler[i]); + int chNext = static_cast(styler.SafeGetCharAt(i + 1)); + const int chNext2 = static_cast(styler.SafeGetCharAt(i + 2)); // Handle DBCS codepages - if (styler.IsLeadByte(ch)) { + if (styler.IsLeadByte(static_cast(ch))) { chPrev = ' '; i += 1; continue; } - if ((!isspacechar(ch) || !foldCompact) && fold) + if ((!IsASpace(ch) || !foldCompact) && fold) visibleChars++; // decide what is the current state to print (depending of the script tag) @@ -644,22 +676,24 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty case SCE_HJ_COMMENTDOC: //case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide // the end of script marker from some JS interpreters. + case SCE_HB_COMMENTLINE: + case SCE_HBA_COMMENTLINE: case SCE_HJ_DOUBLESTRING: case SCE_HJ_SINGLESTRING: case SCE_HJ_REGEX: case SCE_HB_STRING: + case SCE_HBA_STRING: case SCE_HP_STRING: case SCE_HP_TRIPLE: case SCE_HP_TRIPLEDOUBLE: break; default : // check if the closing tag is a script tag - if (state == SCE_HJ_COMMENTLINE) { + if (state == SCE_HJ_COMMENTLINE || isXml) { char tag[7]; // room for the