]> git.saurik.com Git - wxWidgets.git/commitdiff
Update Scintilla to version 1.75
authorRobin Dunn <robin@alldunn.com>
Sat, 15 Dec 2007 04:07:00 +0000 (04:07 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 15 Dec 2007 04:07:00 +0000 (04:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50712 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

141 files changed:
Makefile.in
build/bakefiles/scintilla.bkl
build/msw/makefile.bcc
build/msw/makefile.gcc
build/msw/makefile.vc
build/msw/makefile.wat
build/msw/wx_wxscintilla.dsp
include/wx/stc/stc.h
src/stc/PlatWX.cpp
src/stc/ScintillaWX.cpp
src/stc/ScintillaWX.h
src/stc/gen_iface.py
src/stc/scintilla/README.txt
src/stc/scintilla/include/Accessor.h
src/stc/scintilla/include/KeyWords.h
src/stc/scintilla/include/Platform.h
src/stc/scintilla/include/PropSet.h
src/stc/scintilla/include/SString.h
src/stc/scintilla/include/SciLexer.h
src/stc/scintilla/include/Scintilla.h
src/stc/scintilla/include/Scintilla.iface
src/stc/scintilla/include/WindowAccessor.h
src/stc/scintilla/src/AutoComplete.cxx
src/stc/scintilla/src/AutoComplete.h
src/stc/scintilla/src/CallTip.cxx
src/stc/scintilla/src/CallTip.h
src/stc/scintilla/src/CellBuffer.cxx
src/stc/scintilla/src/CellBuffer.h
src/stc/scintilla/src/CharacterSet.h [new file with mode: 0644]
src/stc/scintilla/src/ContractionState.cxx
src/stc/scintilla/src/ContractionState.h
src/stc/scintilla/src/Decoration.cxx [new file with mode: 0644]
src/stc/scintilla/src/Decoration.h [new file with mode: 0644]
src/stc/scintilla/src/Document.cxx
src/stc/scintilla/src/Document.h
src/stc/scintilla/src/DocumentAccessor.cxx
src/stc/scintilla/src/DocumentAccessor.h
src/stc/scintilla/src/Editor.cxx
src/stc/scintilla/src/Editor.h
src/stc/scintilla/src/ExternalLexer.cxx
src/stc/scintilla/src/ExternalLexer.h
src/stc/scintilla/src/Indicator.cxx
src/stc/scintilla/src/Indicator.h
src/stc/scintilla/src/KeyMap.cxx
src/stc/scintilla/src/KeyMap.h
src/stc/scintilla/src/KeyWords.cxx
src/stc/scintilla/src/LexAPDL.cxx
src/stc/scintilla/src/LexASY.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexAU3.cxx
src/stc/scintilla/src/LexAVE.cxx
src/stc/scintilla/src/LexAbaqus.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexAda.cxx
src/stc/scintilla/src/LexAsm.cxx
src/stc/scintilla/src/LexAsn1.cxx
src/stc/scintilla/src/LexBaan.cxx
src/stc/scintilla/src/LexBash.cxx
src/stc/scintilla/src/LexBasic.cxx
src/stc/scintilla/src/LexBullant.cxx
src/stc/scintilla/src/LexCLW.cxx
src/stc/scintilla/src/LexCPP.cxx
src/stc/scintilla/src/LexCSS.cxx
src/stc/scintilla/src/LexCaml.cxx
src/stc/scintilla/src/LexCmake.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexConf.cxx
src/stc/scintilla/src/LexCrontab.cxx
src/stc/scintilla/src/LexCsound.cxx
src/stc/scintilla/src/LexD.cxx [new file with mode: 0644]
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 [new file with mode: 0644]
src/stc/scintilla/src/LexGui4Cli.cxx
src/stc/scintilla/src/LexHTML.cxx
src/stc/scintilla/src/LexHaskell.cxx
src/stc/scintilla/src/LexInno.cxx
src/stc/scintilla/src/LexKix.cxx
src/stc/scintilla/src/LexLisp.cxx
src/stc/scintilla/src/LexLout.cxx
src/stc/scintilla/src/LexLua.cxx
src/stc/scintilla/src/LexMMIXAL.cxx
src/stc/scintilla/src/LexMPT.cxx
src/stc/scintilla/src/LexMSSQL.cxx
src/stc/scintilla/src/LexMatlab.cxx
src/stc/scintilla/src/LexMetapost.cxx
src/stc/scintilla/src/LexNsis.cxx
src/stc/scintilla/src/LexOpal.cxx
src/stc/scintilla/src/LexOthers.cxx
src/stc/scintilla/src/LexPB.cxx
src/stc/scintilla/src/LexPLM.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexPOV.cxx
src/stc/scintilla/src/LexPS.cxx
src/stc/scintilla/src/LexPascal.cxx
src/stc/scintilla/src/LexPerl.cxx
src/stc/scintilla/src/LexProgress.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexPython.cxx
src/stc/scintilla/src/LexR.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexRebol.cxx
src/stc/scintilla/src/LexRuby.cxx
src/stc/scintilla/src/LexSQL.cxx
src/stc/scintilla/src/LexScriptol.cxx
src/stc/scintilla/src/LexSmalltalk.cxx
src/stc/scintilla/src/LexSpecman.cxx
src/stc/scintilla/src/LexSpice.cxx
src/stc/scintilla/src/LexTADS3.cxx
src/stc/scintilla/src/LexTCL.cxx
src/stc/scintilla/src/LexTeX.cxx
src/stc/scintilla/src/LexVB.cxx
src/stc/scintilla/src/LexVHDL.cxx
src/stc/scintilla/src/LexVerilog.cxx
src/stc/scintilla/src/LexYAML.cxx
src/stc/scintilla/src/LineMarker.cxx
src/stc/scintilla/src/LineMarker.h
src/stc/scintilla/src/Partitioning.h [new file with mode: 0644]
src/stc/scintilla/src/PositionCache.cxx [new file with mode: 0644]
src/stc/scintilla/src/PositionCache.h [new file with mode: 0644]
src/stc/scintilla/src/PropSet.cxx
src/stc/scintilla/src/RESearch.cxx
src/stc/scintilla/src/RESearch.h
src/stc/scintilla/src/RunStyles.cxx [new file with mode: 0644]
src/stc/scintilla/src/RunStyles.h [new file with mode: 0644]
src/stc/scintilla/src/SVector.h
src/stc/scintilla/src/ScintillaBase.cxx
src/stc/scintilla/src/ScintillaBase.h
src/stc/scintilla/src/SplitVector.h [new file with mode: 0644]
src/stc/scintilla/src/Style.cxx
src/stc/scintilla/src/Style.h
src/stc/scintilla/src/StyleContext.cxx
src/stc/scintilla/src/StyleContext.h
src/stc/scintilla/src/UniConversion.cxx
src/stc/scintilla/src/UniConversion.h
src/stc/scintilla/src/ViewStyle.cxx
src/stc/scintilla/src/ViewStyle.h
src/stc/scintilla/src/WindowAccessor.cxx
src/stc/scintilla/src/XPM.cxx
src/stc/scintilla/src/XPM.h
src/stc/stc.cpp
src/stc/stc.cpp.in
src/stc/stc.h.in

index 07ec1096b9f4169ec50548645e474d77e260eb93..900183a3209ab7e52a36d838d37973ed3bafeacc 100644 (file)
@@ -215,6 +215,7 @@ WXSCINTILLA_OBJECTS =  \
        wxscintilla_CellBuffer.o \
        wxscintilla_CharClassify.o \
        wxscintilla_ContractionState.o \
        wxscintilla_CellBuffer.o \
        wxscintilla_CharClassify.o \
        wxscintilla_ContractionState.o \
+       wxscintilla_Decoration.o \
        wxscintilla_Document.o \
        wxscintilla_DocumentAccessor.o \
        wxscintilla_Editor.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_KeyWords.o \
        wxscintilla_LexAPDL.o \
        wxscintilla_LexAU3.o \
+       wxscintilla_LexASY.o \
        wxscintilla_LexAVE.o \
        wxscintilla_LexAVE.o \
+       wxscintilla_LexAbaqus.o \
        wxscintilla_LexAda.o \
        wxscintilla_LexAsm.o \
        wxscintilla_LexAsn1.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_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_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_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 \
        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_LexOpal.o \
        wxscintilla_LexOthers.o \
        wxscintilla_LexPB.o \
+       wxscintilla_LexPLM.o \
        wxscintilla_LexPOV.o \
        wxscintilla_LexPOV.o \
+       wxscintilla_LexProgress.o \
        wxscintilla_LexPS.o \
        wxscintilla_LexPascal.o \
        wxscintilla_LexPerl.o \
        wxscintilla_LexPython.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 \
        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_LexVerilog.o \
        wxscintilla_LexYAML.o \
        wxscintilla_LineMarker.o \
+       wxscintilla_PositionCache.o \
        wxscintilla_PropSet.o \
        wxscintilla_RESearch.o \
        wxscintilla_PropSet.o \
        wxscintilla_RESearch.o \
+       wxscintilla_RunStyles.o \
        wxscintilla_ScintillaBase.o \
        wxscintilla_Style.o \
        wxscintilla_StyleContext.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_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
 
 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_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_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
 
 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_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
 
 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_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
 
 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_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
 
 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_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_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
 
 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_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
 
 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_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_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
 
 wxscintilla_ScintillaBase.o: $(srcdir)/src/stc/scintilla/src/ScintillaBase.cxx
        $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/ScintillaBase.cxx
 
index 4c36b10ccbb9a2ae38cd5818bd700e8e8797d27e..a64a2a24844d29caa2583b597231c6e1f1e8866d 100644 (file)
@@ -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/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
            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/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/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
            src/stc/scintilla/src/LexAda.cxx
            src/stc/scintilla/src/LexAsm.cxx
            src/stc/scintilla/src/LexAsn1.cxx
            src/stc/scintilla/src/LexBasic.cxx
            src/stc/scintilla/src/LexBullant.cxx
            src/stc/scintilla/src/LexCLW.cxx
            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/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/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
            src/stc/scintilla/src/LexGui4Cli.cxx
            src/stc/scintilla/src/LexHTML.cxx
            src/stc/scintilla/src/LexHaskell.cxx
            src/stc/scintilla/src/LexOpal.cxx
            src/stc/scintilla/src/LexOthers.cxx
            src/stc/scintilla/src/LexPB.cxx
            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/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/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
            src/stc/scintilla/src/LexRebol.cxx
            src/stc/scintilla/src/LexRuby.cxx
            src/stc/scintilla/src/LexSQL.cxx
            src/stc/scintilla/src/LexVerilog.cxx
            src/stc/scintilla/src/LexYAML.cxx
            src/stc/scintilla/src/LineMarker.cxx
            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/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
            src/stc/scintilla/src/ScintillaBase.cxx
            src/stc/scintilla/src/Style.cxx
            src/stc/scintilla/src/StyleContext.cxx
index ba42d620d3cc061ba0bfafacc596ec76d3e9d354..ed3d877eb160c1030e34b20421936a381d565896 100644 (file)
@@ -198,6 +198,7 @@ WXSCINTILLA_OBJECTS =  \
        $(OBJS)\wxscintilla_CellBuffer.obj \
        $(OBJS)\wxscintilla_CharClassify.obj \
        $(OBJS)\wxscintilla_ContractionState.obj \
        $(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 \
        $(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_KeyWords.obj \
        $(OBJS)\wxscintilla_LexAPDL.obj \
        $(OBJS)\wxscintilla_LexAU3.obj \
+       $(OBJS)\wxscintilla_LexASY.obj \
        $(OBJS)\wxscintilla_LexAVE.obj \
        $(OBJS)\wxscintilla_LexAVE.obj \
+       $(OBJS)\wxscintilla_LexAbaqus.obj \
        $(OBJS)\wxscintilla_LexAda.obj \
        $(OBJS)\wxscintilla_LexAsm.obj \
        $(OBJS)\wxscintilla_LexAsn1.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_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_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_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 \
        $(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_LexOpal.obj \
        $(OBJS)\wxscintilla_LexOthers.obj \
        $(OBJS)\wxscintilla_LexPB.obj \
+       $(OBJS)\wxscintilla_LexPLM.obj \
        $(OBJS)\wxscintilla_LexPOV.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_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 \
        $(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_LexVerilog.obj \
        $(OBJS)\wxscintilla_LexYAML.obj \
        $(OBJS)\wxscintilla_LineMarker.obj \
+       $(OBJS)\wxscintilla_PositionCache.obj \
        $(OBJS)\wxscintilla_PropSet.obj \
        $(OBJS)\wxscintilla_RESearch.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 \
        $(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_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) $**
 
 $(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_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_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) $**
 
 $(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_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) $**
 
 $(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_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) $**
 
 $(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_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) $**
 
 $(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_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_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) $**
 
 $(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_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) $**
 
 $(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_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_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) $**
 
 $(OBJS)\wxscintilla_ScintillaBase.obj: ..\..\src\stc\scintilla\src\ScintillaBase.cxx
        $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) $**
 
index 0168247796c186ec5b4cfc8a04e1fbf3f6f81245..bd0f9a76ff853f30ca08a67de8829fee249cdd9b 100644 (file)
@@ -183,6 +183,7 @@ WXSCINTILLA_OBJECTS =  \
        $(OBJS)\wxscintilla_CellBuffer.o \
        $(OBJS)\wxscintilla_CharClassify.o \
        $(OBJS)\wxscintilla_ContractionState.o \
        $(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 \
        $(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_KeyWords.o \
        $(OBJS)\wxscintilla_LexAPDL.o \
        $(OBJS)\wxscintilla_LexAU3.o \
+       $(OBJS)\wxscintilla_LexASY.o \
        $(OBJS)\wxscintilla_LexAVE.o \
        $(OBJS)\wxscintilla_LexAVE.o \
+       $(OBJS)\wxscintilla_LexAbaqus.o \
        $(OBJS)\wxscintilla_LexAda.o \
        $(OBJS)\wxscintilla_LexAsm.o \
        $(OBJS)\wxscintilla_LexAsn1.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_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_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_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 \
        $(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_LexOpal.o \
        $(OBJS)\wxscintilla_LexOthers.o \
        $(OBJS)\wxscintilla_LexPB.o \
+       $(OBJS)\wxscintilla_LexPLM.o \
        $(OBJS)\wxscintilla_LexPOV.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_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 \
        $(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_LexVerilog.o \
        $(OBJS)\wxscintilla_LexYAML.o \
        $(OBJS)\wxscintilla_LineMarker.o \
+       $(OBJS)\wxscintilla_PositionCache.o \
        $(OBJS)\wxscintilla_PropSet.o \
        $(OBJS)\wxscintilla_RESearch.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 \
        $(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_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) $<
 
 $(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_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_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) $<
 
 $(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_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) $<
 
 $(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_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) $<
 
 $(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_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) $<
 
 $(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_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_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) $<
 
 $(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_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) $<
 
 $(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_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_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) $<
 
 $(OBJS)\wxscintilla_ScintillaBase.o: ../../src/stc/scintilla/src/ScintillaBase.cxx
        $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
 
index a9d3be3355ca5d96c6b444921b56d92ccf8d0580..28715f60e836ea52fe66b3d4b60f61d2bcb15948 100644 (file)
@@ -194,6 +194,7 @@ WXSCINTILLA_OBJECTS =  \
        $(OBJS)\wxscintilla_CellBuffer.obj \
        $(OBJS)\wxscintilla_CharClassify.obj \
        $(OBJS)\wxscintilla_ContractionState.obj \
        $(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 \
        $(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_KeyWords.obj \
        $(OBJS)\wxscintilla_LexAPDL.obj \
        $(OBJS)\wxscintilla_LexAU3.obj \
+       $(OBJS)\wxscintilla_LexASY.obj \
        $(OBJS)\wxscintilla_LexAVE.obj \
        $(OBJS)\wxscintilla_LexAVE.obj \
+       $(OBJS)\wxscintilla_LexAbaqus.obj \
        $(OBJS)\wxscintilla_LexAda.obj \
        $(OBJS)\wxscintilla_LexAsm.obj \
        $(OBJS)\wxscintilla_LexAsn1.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_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_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_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 \
        $(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_LexOpal.obj \
        $(OBJS)\wxscintilla_LexOthers.obj \
        $(OBJS)\wxscintilla_LexPB.obj \
+       $(OBJS)\wxscintilla_LexPLM.obj \
        $(OBJS)\wxscintilla_LexPOV.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_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 \
        $(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_LexVerilog.obj \
        $(OBJS)\wxscintilla_LexYAML.obj \
        $(OBJS)\wxscintilla_LineMarker.obj \
+       $(OBJS)\wxscintilla_PositionCache.obj \
        $(OBJS)\wxscintilla_PropSet.obj \
        $(OBJS)\wxscintilla_RESearch.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 \
        $(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
        -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
 
 
 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
 sub_samples: 
        cd ..\..\samples
        $(MAKE) -f makefile.vc $(MAKEARGS) all
-       cd "$(MAKEDIR)"
+       cd $(MAKEDIR)
 
 $(LIBDIRNAME): 
        if not exist $(LIBDIRNAME) mkdir $(LIBDIRNAME)
 
 $(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_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) $**
 
 $(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_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_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) $**
 
 $(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_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) $**
 
 $(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_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) $**
 
 $(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_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) $**
 
 $(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_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_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) $**
 
 $(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_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) $**
 
 $(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_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_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) $**
 
 $(OBJS)\wxscintilla_ScintillaBase.obj: ..\..\src\stc\scintilla\src\ScintillaBase.cxx
        $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) $**
 
index f69887ba347829b762096c798297027df4404725..a9ce3c12204bfecfdc2fe4d2aa223365b68883f8 100644 (file)
@@ -3135,6 +3135,7 @@ WXSCINTILLA_OBJECTS =  &
        $(OBJS)\wxscintilla_CellBuffer.obj &
        $(OBJS)\wxscintilla_CharClassify.obj &
        $(OBJS)\wxscintilla_ContractionState.obj &
        $(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 &
        $(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_KeyWords.obj &
        $(OBJS)\wxscintilla_LexAPDL.obj &
        $(OBJS)\wxscintilla_LexAU3.obj &
+       $(OBJS)\wxscintilla_LexASY.obj &
        $(OBJS)\wxscintilla_LexAVE.obj &
        $(OBJS)\wxscintilla_LexAVE.obj &
+       $(OBJS)\wxscintilla_LexAbaqus.obj &
        $(OBJS)\wxscintilla_LexAda.obj &
        $(OBJS)\wxscintilla_LexAsm.obj &
        $(OBJS)\wxscintilla_LexAsn1.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_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_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_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 &
        $(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_LexOpal.obj &
        $(OBJS)\wxscintilla_LexOthers.obj &
        $(OBJS)\wxscintilla_LexPB.obj &
+       $(OBJS)\wxscintilla_LexPLM.obj &
        $(OBJS)\wxscintilla_LexPOV.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_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 &
        $(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_LexVerilog.obj &
        $(OBJS)\wxscintilla_LexYAML.obj &
        $(OBJS)\wxscintilla_LineMarker.obj &
+       $(OBJS)\wxscintilla_PositionCache.obj &
        $(OBJS)\wxscintilla_PropSet.obj &
        $(OBJS)\wxscintilla_RESearch.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 &
        $(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_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) $<
 
 $(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_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_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) $<
 
 $(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_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) $<
 
 $(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_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) $<
 
 $(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_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) $<
 
 $(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_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_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) $<
 
 $(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_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) $<
 
 $(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_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_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) $<
 
 $(OBJS)\wxscintilla_ScintillaBase.obj :  .AUTODEPEND ..\..\src\stc\scintilla\src\ScintillaBase.cxx
        $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
 
index 415d1da0049f2d8778ae5027ebd6f0ce0c75b7c4..62fce81505a0602b2f25e2677c6fe7c49d347998 100644 (file)
@@ -255,6 +255,10 @@ SOURCE=..\..\src\stc\scintilla\src\ContractionState.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\Decoration.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\Document.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\Document.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -287,6 +291,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexAPDL.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\LexASY.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\LexAU3.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\LexAU3.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -295,6 +303,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexAVE.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\LexAbaqus.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\LexAda.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\LexAda.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -339,6 +351,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexCaml.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\LexCmake.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\LexConf.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\LexConf.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -351,6 +367,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexCsound.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\LexD.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\LexEScript.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\LexEScript.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -375,6 +395,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexFortran.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\LexGAP.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\LexGui4Cli.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\LexGui4Cli.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -443,6 +467,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexPB.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\LexPLM.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\LexPOV.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\LexPOV.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -459,10 +487,18 @@ SOURCE=..\..\src\stc\scintilla\src\LexPerl.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\LexProgress.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\LexPython.cxx\r
 # End Source File\r
 # Begin Source File\r
 \r
 SOURCE=..\..\src\stc\scintilla\src\LexPython.cxx\r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\LexR.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\LexRebol.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\LexRebol.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -523,6 +559,10 @@ SOURCE=..\..\src\stc\scintilla\src\LineMarker.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\PositionCache.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\PropSet.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\PropSet.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -531,6 +571,10 @@ SOURCE=..\..\src\stc\scintilla\src\RESearch.cxx
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\stc\scintilla\src\RunStyles.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\stc\scintilla\src\ScintillaBase.cxx\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=..\..\src\stc\scintilla\src\ScintillaBase.cxx\r
 # End Source File\r
 # Begin Source File\r
index 1217ebace4356f9c025ec19c0a8e834419d588a6..7014fbcb176bf4a89dfa7012dd49d1b6af815c3d 100644 (file)
@@ -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_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.
 
 // 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_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
 #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_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_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
 
 // 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
 
 // 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
 #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
 
 #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
 
 // 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_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.
 
 // 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_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
 #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_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.
 
 // 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
 
 #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
 // 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_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
 
 // 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_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
 
 // 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_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
 
 // 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_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
 
 // 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
 
 #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
 
 //-----------------------------------------
 // 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.
 #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
 
 // 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;
 
 #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
 
 //----------------------------------------------------------------------
 #endif
 
 //----------------------------------------------------------------------
@@ -2058,6 +2231,46 @@ public:
     // Set a style to be underlined or not.
     void StyleSetUnderline(int style, bool underline);
 
     // 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);
 
     // 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);
 
     // 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);
 
     // 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);
 
     // 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);
 
     // 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.
     bool GetUseHorizontalScrollBar();
 
     // Show or hide indentation guides.
-    void SetIndentationGuides(bool show);
+    void SetIndentationGuides(int indentView);
 
     // Are the indentation guides visible?
 
     // Are the indentation guides visible?
-    bool GetIndentationGuides();
+    int GetIndentationGuides();
 
     // Set the highlighted indentation guide column.
     // 0 = no highlighted guide.
 
     // Set the highlighted indentation guide column.
     // 0 = no highlighted guide.
@@ -2629,6 +2854,12 @@ public:
     // Retrieve the document width assumed for scrolling.
     int GetScrollWidth();
 
     // 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.
     // 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.
     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();
 
     // 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);
 
     // 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);
 
     // 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);
 
     // 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);
 
     // 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();
     // 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();
 
     // 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();
 
     // Start notifying the container of all key presses and commands.
     void StartRecord();
 
@@ -3213,6 +3501,9 @@ public:
     void StyleSetSpec(int styleNum, const wxString& spec);
 
 
     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.
 
     // 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_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 {
 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_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
 
     };
 #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_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
 #endif
 
 #endif // wxUSE_STC
index 153de8cc573832c464694ac9419dca425aa502a3..46020203e9c7fd2eb35c9b319cfcc831af58a360 100644 (file)
 
 #include <ctype.h>
 
 
 #include <ctype.h>
 
+#if wxUSE_DISPLAY
+#include "wx/display.h"
+#endif
+
 #include "wx/encconv.h"
 #include "wx/listctrl.h"
 #include "wx/mstream.h"
 #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);
                     false,
                     stc2wx(faceName),
                     encoding);
-    font->SetNoAntiAliasing(!extraFontFlag);
+    //font->SetNoAntiAliasing(!extraFontFlag);
     id = font;
 }
 
     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
 
 //----------------------------------------------------------------------
 // Helper classes for ListBox
 
@@ -1543,10 +1560,10 @@ wxString stc2wx(const char* str, size_t len)
     if (!len)
         return wxEmptyString;
 
     if (!len)
         return wxEmptyString;
 
-    size_t wclen = UCS2Length(str, len);
+    size_t wclen = UTF16Length(str, len);
     wxWCharBuffer buffer(wclen+1);
 
     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);
 }
 
     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);
     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!!
 
 
     // TODO check NULL termination!!
 
index 76af113dd7640e279ef99dbb329f5afc555fad5a..48655b2966fafe43675966140f05df60c0f89fea 100644 (file)
@@ -334,7 +334,7 @@ void ScintillaWX::DoStartDrag() {
         result = source.DoDragDrop(evt.GetDragAllowMove());
         if (result == wxDragMove && dropWentOutside)
             ClearSelection();
         result = source.DoDragDrop(evt.GetDragAllowMove());
         if (result == wxDragMove && dropWentOutside)
             ClearSelection();
-        inDragDrop = false;
+        inDragDrop = ddNone;
         SetDragPosition(invalidPosition);
     }
 #endif // wxUSE_DRAG_AND_DROP
         SetDragPosition(invalidPosition);
     }
 #endif // wxUSE_DRAG_AND_DROP
index 26e9c239e58361882c97cd51d3ea3d6e3e7ce469..66345d16d27ae8dc8675af75f7fadeb056f76cc0 100644 (file)
 #include "Accessor.h"
 #include "KeyWords.h"
 #endif
 #include "Accessor.h"
 #include "KeyWords.h"
 #endif
+#include "SplitVector.h"
+#include "Partitioning.h"
+#include "RunStyles.h"
 #include "ContractionState.h"
 #include "ContractionState.h"
-#include "SVector.h"
 #include "CellBuffer.h"
 #include "CallTip.h"
 #include "KeyMap.h"
 #include "CellBuffer.h"
 #include "CallTip.h"
 #include "KeyMap.h"
@@ -46,7 +48,9 @@
 #include "Style.h"
 #include "ViewStyle.h"
 #include "AutoComplete.h"
 #include "Style.h"
 #include "ViewStyle.h"
 #include "AutoComplete.h"
+#include "Decoration.h"
 #include "Document.h"
 #include "Document.h"
+#include "PositionCache.h"
 #include "Editor.h"
 #include "ScintillaBase.h"
 
 #include "Editor.h"
 #include "ScintillaBase.h"
 
index 37bae5033db98162964c11380c6d3fcace671800..2dfea4c444f26d5967bdcc659c9c3babca51a898 100644 (file)
@@ -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')
 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
 
 
 # Value prefixes to convert
@@ -37,16 +37,17 @@ valPrefixes = [('SCI_', ''),
 ]
 
 # Message function values that should have a CMD_ constant generated
 ]
 
 # Message function values that should have a CMD_ constant generated
-cmdValues = [ (2300, 2349),
-              2011,
+cmdValues = [ 2011,
               2013,
               (2176, 2180),
               2013,
               (2176, 2180),
+              (2300, 2349),
               (2390, 2393),
               (2395, 2396),
               2404,
               (2413, 2416),
               (2426, 2442),
               (2450, 2455),
               (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),
 
     '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),
     '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),
     
     '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),
     '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),
 
     '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),
 
     '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),
     
     'GetCaretLineBack' : ('GetCaretLineBackground', 0, 0, 0),
     'SetCaretLineBack' : ('SetCaretLineBackground', 0, 0, 0),
@@ -626,6 +647,9 @@ methodOverrideMap = {
 
     'LoadLexerLibrary' : (None, 0,0,0),
 
 
     'LoadLexerLibrary' : (None, 0,0,0),
 
+    'SetPositionCache' : ('SetPositionCacheSize', 0, 0, 0),
+    'GetPositionCache' : ('GetPositionCacheSize', 0, 0, 0),
+
 
     '' : ('', 0, 0, 0),
 
 
     '' : ('', 0, 0, 0),
 
index 89ff867d441e96e71cd796bec2eb504ea5e72fba..13390ddda6ed44297645893197d90862f21dda93 100644 (file)
@@ -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.
 
 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
 
 
index 0b2c4baee25cb8a8bc1768adf22a05c9a5fe2358..d9db9c7bfe389d66b678e693febbbf0c90fdcfc1 100644 (file)
@@ -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 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;
 };
 };
index 059ac0da0fd881dbe31aebe03c584cb368837f39..6abae594538d22399d268f55044a9fcfea48fd93 100644 (file)
@@ -5,6 +5,10 @@
 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // 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);
                   
 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);
 };
 
        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.
 /**
  * Check if a character is a space.
  * This is ASCII specific but is safe with chars >= 0x80.
index 679294cad7702fb64084a099236bee977915a129..79be33f6bae81d8de4e04d5d30040f6b06280e30 100644 (file)
@@ -1,7 +1,7 @@
 // Scintilla source code edit control
 /** @file Platform.h
  ** Interface to platform facilities. Also includes some basic utilities.
 // 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 <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
  **/
 // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 // 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_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_GTK 0
 #define PLAT_GTK_WIN32 0
+#define PLAT_MACOSX 0
 #define PLAT_WIN 0
 #define PLAT_WX  0
 #define PLAT_FOX 0
 #define PLAT_WIN 0
 #define PLAT_WX  0
 #define PLAT_FOX 0
 #define PLAT_GTK_WIN32 1
 #endif
 
 #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
 
 #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
 
 // 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; }
        }
        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(const Surface &) {}
        Surface &operator=(const Surface &) { return *this; }
 public:
-       Surface() {}
-       virtual ~Surface() {}
+       Surface() {};
+       virtual ~Surface() {};
        static Surface *Allocate();
 
        virtual void Init(WindowID wid)=0;
        static Surface *Allocate();
 
        virtual void Init(WindowID wid)=0;
@@ -360,9 +371,23 @@ typedef void (*CallBackAction)(void*);
 class Window {
 protected:
        WindowID id;
 class Window {
 protected:
        WindowID id;
+#if PLAT_MACOSX
+       void *windowRef;
+       void *control;
+#endif
 public:
 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_;
        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);
        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;
 };
 private:
        Cursor cursorLast;
 };
@@ -443,7 +473,7 @@ public:
  */
 class DynamicLibrary {
 public:
  */
 class DynamicLibrary {
 public:
-       virtual ~DynamicLibrary() {}
+       virtual ~DynamicLibrary() {};
 
        /// @return Pointer to function "name", or NULL on failure.
        virtual Function FindFunction(const char *name) = 0;
 
        /// @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  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
 #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
 
 // Shut up annoying Visual C++ warnings:
 #ifdef _MSC_VER
index e38de7dc408f106970257fff1feafcf300655b12..91bc7072ba68d46b2847261e37724e4b72c015aa 100644 (file)
@@ -13,6 +13,10 @@ bool EqualCaseInsensitive(const char *a, const char *b);
 
 bool isprefix(const char *target, const char *prefix);
 
 
 bool isprefix(const char *target, const char *prefix);
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 struct Property {
        unsigned int hash;
        char *key;
 struct Property {
        unsigned int hash;
        char *key;
@@ -29,7 +33,6 @@ protected:
        Property *props[hashRoots];
        Property *enumnext;
        int enumhash;
        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--) {
        static unsigned int HashString(const char *s, size_t len) {
                unsigned int ret = 0;
                while (len--) {
@@ -39,7 +42,6 @@ protected:
                }
                return ret;
        }
                }
                return ret;
        }
-       static bool IncludesVar(const char *value, const char *key);
 
 public:
        PropSet *superPS;
 
 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);
        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();
        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
 
 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;
 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;
        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) :
        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; }
        ~WordList() { Clear(); }
        operator bool() { return len ? true : false; }
-       char *operator[](int ind) { return words[ind]; }
        void Clear();
        void Set(const char *s);
        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);
        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'));
 }
 
 };
 
 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
 
 #ifdef _MSC_VER
 // Visual C++ doesn't like the private copy idiom for disabling
index 38a206ccf2240224ce1dbdd3236c727ab54babc9..b770afebeedfaa6e896f3df0b5464c475f562b51 100644 (file)
@@ -8,11 +8,16 @@
 #ifndef SSTRING_H
 #define SSTRING_H
 
 #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);
 
 // 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.
 // 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);
 }
 
        return SContainer::StringAllocate(s, len);
 }
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index 22d016d21c4524eabb5acf8a4b80ea2840ae330f..2354aa87656dd2041d19c5aaa044985bf6cd1c60 100644 (file)
 #define SCLEX_INNOSETUP 76
 #define SCLEX_OPAL 77
 #define SCLEX_SPICE 78
 #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
 #define SCLEX_AUTOMATIC 1000
 #define SCE_P_DEFAULT 0
 #define SCE_P_COMMENTLINE 1
 #define SCE_C_COMMENTDOCKEYWORD 17
 #define SCE_C_COMMENTDOCKEYWORDERROR 18
 #define SCE_C_GLOBALCLASS 19
 #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
 #define SCE_TCL_DEFAULT 0
 #define SCE_TCL_COMMENT 1
 #define SCE_TCL_COMMENTLINE 2
 #define SCE_PL_STRING_QR 29
 #define SCE_PL_STRING_QW 30
 #define SCE_PL_POD_VERB 31
 #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
 #define SCE_RB_DEFAULT 0
 #define SCE_RB_ERROR 1
 #define SCE_RB_COMMENTLINE 2
 #define SCE_ERR_ABSF 18
 #define SCE_ERR_TIDY 19
 #define SCE_ERR_JAVA_STACK 20
 #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
 #define SCE_BAT_DEFAULT 0
 #define SCE_BAT_COMMENT 1
 #define SCE_BAT_WORD 2
 #define SCE_YAML_DOCUMENT 6
 #define SCE_YAML_TEXT 7
 #define SCE_YAML_ERROR 8
 #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
 #define SCE_TEX_DEFAULT 0
 #define SCE_TEX_SPECIAL 1
 #define SCE_TEX_GROUP 2
 #define SCE_T3_USER1 17
 #define SCE_T3_USER2 18
 #define SCE_T3_USER3 19
 #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
 #define SCE_REBOL_DEFAULT 0
 #define SCE_REBOL_COMMENTLINE 1
 #define SCE_REBOL_COMMENTBLOCK 2
 #define SCE_SPICE_DELIMITER 6
 #define SCE_SPICE_VALUE 7
 #define SCE_SPICE_COMMENTLINE 8
 #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
 #define SCLEX_ASP 29
 #define SCLEX_PHP 30
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
index 3a57da6ae2b13bf548a0ab8ef33fad795e387187..6fde15267d82412423d02a20f5f6affe9ecb5737 100644 (file)
@@ -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_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
 #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 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
 #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_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
 #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 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
 #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_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
 #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_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
 #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 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
 #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_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
 #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_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
 #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_SETPRINTWRAPMODE 2406
 #define SCI_GETPRINTWRAPMODE 2407
 #define SCI_SETHOTSPOTACTIVEFORE 2410
+#define SCI_GETHOTSPOTACTIVEFORE 2494
 #define SCI_SETHOTSPOTACTIVEBACK 2411
 #define SCI_SETHOTSPOTACTIVEBACK 2411
+#define SCI_GETHOTSPOTACTIVEBACK 2495
 #define SCI_SETHOTSPOTACTIVEUNDERLINE 2412
 #define SCI_SETHOTSPOTACTIVEUNDERLINE 2412
+#define SCI_GETHOTSPOTACTIVEUNDERLINE 2496
 #define SCI_SETHOTSPOTSINGLELINE 2421
 #define SCI_SETHOTSPOTSINGLELINE 2421
+#define SCI_GETHOTSPOTSINGLELINE 2497
 #define SCI_PARADOWN 2413
 #define SCI_PARADOWNEXTEND 2414
 #define SCI_PARAUP 2415
 #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 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
 #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_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
 #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_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
 #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_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.
 
 //--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;
 struct CharacterRange {
        long cpMin;
        long cpMax;
@@ -761,6 +819,10 @@ struct SCNotification {
        int y;          // SCN_DWELLSTART, SCN_DWELLEND
 };
 
        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
 // 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
index 9540e0de1aaa556c8cdfe24a8110802f076cc229..a6626d233593e3d776c19a23a523cff5f509197f 100644 (file)
@@ -360,7 +360,7 @@ val STYLE_CONTROLCHAR=36
 val STYLE_INDENTGUIDE=37
 val STYLE_CALLTIP=38
 val STYLE_LASTPREDEFINED=39
 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.
 
 # 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
 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)
 
 # 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,)
 
 # 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,)
 
 # 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(,)
 
 # 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_
 enu IndicatorStyle=INDIC_
-val INDIC_MAX=7
 val INDIC_PLAIN=0
 val INDIC_SQUIGGLE=1
 val INDIC_TT=2
 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_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
 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,)
 
 # 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)
 
 # 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(,)
 
 # 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.
 # Show or hide indentation guides.
-set void SetIndentationGuides=2132(bool show,)
+set void SetIndentationGuides=2132(int indentView,)
 
 # Are the indentation guides visible?
 
 # Are the indentation guides visible?
-get bool GetIndentationGuides=2133(,)
+get int GetIndentationGuides=2133(,)
 
 # Set the highlighted indentation guide column.
 # 0 = no highlighted guide.
 
 # 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(,)
 
 # 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.
 # 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.
 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(,)
 
 # 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)
 
 # 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)
 
 # 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,)
 
 # 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,)
 
 # 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(,)
 # 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)
 
 # 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
 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(,)
 
 # 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(,)
 
 # 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_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.
 
 # 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_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
 
 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_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.
 
 # 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
 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
 # 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_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
 # 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_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
 # 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_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
 # 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_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
 # 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
 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
 
 
 # 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 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
 
 
 cat Deprecated
 
index 3d59cd1531e1e4a5136008e7a34ee640549d4683..e107a0659caebd545912d0ca0f6d3b1e291daeb8 100644 (file)
@@ -6,6 +6,10 @@
 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class WindowAccessor : public Accessor {
 /**
  */
 class WindowAccessor : public Accessor {
@@ -48,10 +52,15 @@ public:
        }
 
        void StartAt(unsigned int start, char chMask=31);
        }
 
        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);
        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
index 753adca77978e624daf6c3ba9b0518001c231470..af6154ea13bf0ebb14b588c698a02e9f0565ffa7 100644 (file)
 #include "PropSet.h"
 #include "AutoComplete.h"
 
 #include "PropSet.h"
 #include "AutoComplete.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 AutoComplete::AutoComplete() :
        active(false),
        separator(' '),
 AutoComplete::AutoComplete() :
        active(false),
        separator(' '),
index 10577ca38057c0f10d369eb2d2175e75781dbcf3..b10cdce82ff50e9a8a303de9c0123854135833a9 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef AUTOCOMPLETE_H
 #define AUTOCOMPLETE_H
 
 #ifndef AUTOCOMPLETE_H
 #define AUTOCOMPLETE_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class AutoComplete {
 /**
  */
 class AutoComplete {
@@ -67,4 +71,8 @@ public:
        void Select(const char *word);
 };
 
        void Select(const char *word);
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index f4bc5f83c42e0c93e00db9c0ea4ddd4f16e7e788..9f5f8847649665416779396a9f0a96e60d4de2f3 100644 (file)
 
 #include "Scintilla.h"
 #include "CallTip.h"
 
 #include "Scintilla.h"
 #include "CallTip.h"
+#include <stdio.h>
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
 
 static const int insetX = 5;    // text inset in x from calltip border
 static const int widthArrow = 14;
 
 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
 
        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);
        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);
        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;
        char *chunkVal = val;
        bool moreChunks = true;
        int maxWidth = 0;
+
        while (moreChunks) {
                char *chunkEnd = strchr(chunkVal, '\n');
                if (chunkEnd == NULL) {
        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);
 
        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);
        // 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);
        surfaceWindow->PenColour(colourLight.allocated);
        surfaceWindow->LineTo(0, 0);
        surfaceWindow->LineTo(0, rcClientSize.bottom - 1);
+#endif
 }
 
 void CallTip::MouseClick(Point pt) {
 }
 
 void CallTip::MouseClick(Point pt) {
index 9848a10af989e89d5068acb4ec45a1d0b5d09311..bdf1123c74a8447a896433ee060befc6a7999b56 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef CALLTIP_H
 #define CALLTIP_H
 
 #ifndef CALLTIP_H
 #define CALLTIP_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class CallTip {
 /**
  */
 class CallTip {
@@ -76,4 +80,8 @@ public:
        void SetForeBack(const ColourPair &fore, const ColourPair &back);
 };
 
        void SetForeBack(const ColourPair &fore, const ColourPair &back);
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index 1109a17fbe54293c865c78d86cb17f0a5ae29bca..6d04e04c9141de3cfbc9bbe748ab4b175c14ae20 100644 (file)
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "Platform.h"
 
 #include "Scintilla.h"
-#include "SVector.h"
+#include "SplitVector.h"
+#include "Partitioning.h"
 #include "CellBuffer.h"
 
 #include "CellBuffer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 MarkerHandleSet::MarkerHandleSet() {
        root = 0;
 }
 MarkerHandleSet::MarkerHandleSet() {
        root = 0;
 }
@@ -30,7 +35,7 @@ MarkerHandleSet::~MarkerHandleSet() {
        root = 0;
 }
 
        root = 0;
 }
 
-int MarkerHandleSet::Length() {
+int MarkerHandleSet::Length() const {
        int c = 0;
        MarkerHandleNumber *mhn = root;
        while (mhn) {
        int c = 0;
        MarkerHandleNumber *mhn = root;
        while (mhn) {
@@ -40,7 +45,7 @@ int MarkerHandleSet::Length() {
        return c;
 }
 
        return c;
 }
 
-int MarkerHandleSet::NumberFromHandle(int handle) {
+int MarkerHandleSet::NumberFromHandle(int handle) const {
        MarkerHandleNumber *mhn = root;
        while (mhn) {
                if (mhn->handle == handle) {
        MarkerHandleNumber *mhn = root;
        while (mhn) {
                if (mhn->handle == handle) {
@@ -51,7 +56,7 @@ int MarkerHandleSet::NumberFromHandle(int handle) {
        return - 1;
 }
 
        return - 1;
 }
 
-int MarkerHandleSet::MarkValue() {
+int MarkerHandleSet::MarkValue() const {
        unsigned int m = 0;
        MarkerHandleNumber *mhn = root;
        while (mhn) {
        unsigned int m = 0;
        MarkerHandleNumber *mhn = root;
        while (mhn) {
@@ -61,7 +66,7 @@ int MarkerHandleSet::MarkValue() {
        return m;
 }
 
        return m;
 }
 
-bool MarkerHandleSet::Contains(int handle) {
+bool MarkerHandleSet::Contains(int handle) const {
        MarkerHandleNumber *mhn = root;
        while (mhn) {
                if (mhn->handle == handle) {
        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;
                if (mhn->handle == handle) {
                        *pmhn = mhn->next;
                        delete mhn;
-                       return ;
+                       return;
                }
                pmhn = &((*pmhn)->next);
        }
                }
                pmhn = &((*pmhn)->next);
        }
@@ -121,210 +126,154 @@ void MarkerHandleSet::CombineWith(MarkerHandleSet *other) {
        other->root = 0;
 }
 
        other->root = 0;
 }
 
-LineVector::LineVector() {
-       linesData = 0;
-       lines = 0;
-       size = 0;
-       levels = 0;
-       sizeLevels = 0;
+LineVector::LineVector() : starts(256) {
        handleCurrent = 1;
        handleCurrent = 1;
-       growSize = 1000;
 
        Init();
 }
 
 LineVector::~LineVector() {
 
        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() {
 }
 
 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<int>(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) {
 }
 
 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() {
 }
 
 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
        // 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.
                // 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) {
 }
 
 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;
                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++;
 }
 
 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
                // 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;
        }
                        return - 1;
        }
-       linesData[line].handleSet->InsertHandle(handleCurrent, markerNum);
+       markers[line]->InsertHandle(handleCurrent, markerNum);
 
        return handleCurrent;
 }
 
 void LineVector::MergeMarkers(int pos) {
 
        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) {
        }
 }
 
 void LineVector::DeleteMark(int line, int markerNum, bool all) {
-       if (linesData[line].handleSet) {
+       if (markers.Length() && markers[line]) {
                if (markerNum == -1) {
                if (markerNum == -1) {
-                       delete linesData[line].handleSet;
-                       linesData[line].handleSet = 0;
+                       delete markers[line];
+                       markers[line] = NULL;
                } else {
                } else {
-                       bool performedDeletion = 
-                               linesData[line].handleSet->RemoveNumber(markerNum);
+                       bool performedDeletion = markers[line]->RemoveNumber(markerNum);
                        while (all && performedDeletion) {
                        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) {
 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) {
                }
        }
 }
 
 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() {
 }
 
 Action::Action() {
@@ -437,7 +388,7 @@ void UndoHistory::EnsureUndoRoom() {
                int lenActionsNew = lenActions * 2;
                Action *actionsNew = new Action[lenActionsNew];
                if (!actionsNew)
                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;
                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,
        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;
        }
        if (currentAction < savePoint) {
                savePoint = -1;
        }
+       int oldCurrentAction = currentAction;
        if (currentAction >= 1) {
                if (0 == undoSequenceDepth) {
                        // Top level actions may not always be coalesced
        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 {
                                        currentAction++;
                                }
                        } else {
-                               //Platform::DebugPrintf("action coalesced\n");
+                               // Action coalesced.
                        }
 
                } else {
                        }
 
                } else {
@@ -497,6 +450,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
        } else {
                currentAction++;
        }
        } else {
                currentAction++;
        }
+       startSequence = oldCurrentAction != currentAction;
        actions[currentAction].Create(at, position, data, lengthData);
        currentAction++;
        actions[currentAction].Create(startAction);
        actions[currentAction].Create(at, position, data, lengthData);
        currentAction++;
        actions[currentAction].Create(startAction);
@@ -517,6 +471,7 @@ void UndoHistory::BeginUndoAction() {
 }
 
 void UndoHistory::EndUndoAction() {
 }
 
 void UndoHistory::EndUndoAction() {
+       PLATFORM_ASSERT(undoSequenceDepth > 0);
        EnsureUndoRoom();
        undoSequenceDepth--;
        if (0 == undoSequenceDepth) {
        EnsureUndoRoom();
        undoSequenceDepth--;
        if (0 == undoSequenceDepth) {
@@ -600,132 +555,51 @@ void UndoHistory::CompletedRedoStep() {
        currentAction++;
 }
 
        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;
        readOnly = false;
        collectingUndo = true;
-       growSize = 4000;
 }
 
 CellBuffer::~CellBuffer() {
 }
 
 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)
 }
 
 void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) {
        if (lengthRetrieve < 0)
-               return ;
+               return;
        if (position < 0)
        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<lengthRetrieve; i++) {
+               *buffer++ = substance.ValueAt(position + i);
        }
 }
 
 char CellBuffer::StyleAt(int position) {
        }
 }
 
 char CellBuffer::StyleAt(int position) {
-       return ByteAt(position*2 + 1);
+       return style.ValueAt(position);
 }
 
 }
 
-const char *CellBuffer::InsertString(int position, char *s, int insertLength) {
+// The char* returned is to an allocation owned by the undo history
+const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) {
        char *data = 0;
        // InsertString and DeleteChars are the bottleneck though which all changes occur
        if (!readOnly) {
                if (collectingUndo) {
                        // Save into the undo/redo stack, but only the characters - not the formatting
                        // This takes up about half load time
        char *data = 0;
        // InsertString and DeleteChars are the bottleneck though which all changes occur
        if (!readOnly) {
                if (collectingUndo) {
                        // Save into the undo/redo stack, but only the characters - not the formatting
                        // This takes up about half load time
-                       data = new char[insertLength / 2];
-                       for (int i = 0; i < insertLength / 2; i++) {
-                               data[i] = s[i * 2];
+                       data = new char[insertLength];
+                       for (int i = 0; i < insertLength; i++) {
+                               data[i] = s[i];
                        }
                        }
-                       uh.AppendAction(insertAction, position / 2, data, insertLength / 2);
+                       uh.AppendAction(insertAction, position, data, insertLength, startSequence);
                }
 
                BasicInsertString(position, s, insertLength);
                }
 
                BasicInsertString(position, s, insertLength);
@@ -733,45 +607,45 @@ const char *CellBuffer::InsertString(int position, char *s, int insertLength) {
        return data;
 }
 
        return data;
 }
 
-bool CellBuffer::SetStyleAt(int position, char style, char mask) {
-       style &= mask;
-       char curVal = ByteAt(position * 2 + 1);
-       if ((curVal & mask) != style) {
-               SetByteAt(position*2 + 1, static_cast<char>((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<char>((curVal & ~mask) | styleValue));
                return true;
        } else {
                return false;
        }
 }
 
                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 ||
        bool changed = false;
        PLATFORM_ASSERT(lengthStyle == 0 ||
-               (lengthStyle > 0 && lengthStyle + position < length));
+               (lengthStyle > 0 && lengthStyle + position <= style.Length()));
        while (lengthStyle--) {
        while (lengthStyle--) {
-               char curVal = ByteAt(bytePos);
-               if ((curVal & mask) != style) {
-                       SetByteAt(bytePos, static_cast<char>((curVal & ~mask) | style));
+               char curVal = style.ValueAt(position);
+               if ((curVal & mask) != styleValue) {
+                       style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue));
                        changed = true;
                }
                        changed = true;
                }
-               bytePos += 2;
+               position++;
        }
        return changed;
 }
 
        }
        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
        // 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);
                }
 
                BasicDeleteChars(position, deleteLength);
@@ -779,39 +653,26 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength) {
        return data;
 }
 
        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) {
 }
 
 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;
        if (line < 0)
                return 0;
-       else if (line > lv.lines)
+       else if (line >= Lines())
                return Length();
        else
                return Length();
        else
-               return lv.linesData[line].startPosition;
+               return lv.LineStart(line);
 }
 
 bool CellBuffer::IsReadOnly() {
 }
 
 bool CellBuffer::IsReadOnly() {
@@ -831,14 +692,14 @@ bool CellBuffer::IsSavePoint() {
 }
 
 int CellBuffer::AddMark(int line, int markerNum) {
 }
 
 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) {
                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);
        }
 }
                lv.DeleteMark(line, markerNum, false);
        }
 }
@@ -848,13 +709,13 @@ void CellBuffer::DeleteMarkFromHandle(int markerHandle) {
 }
 
 int CellBuffer::GetMark(int line) {
 }
 
 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) {
        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);
        }
 }
                lv.DeleteMark(line, markerNum, true);
        }
 }
@@ -865,119 +726,101 @@ int CellBuffer::LineFromHandle(int markerHandle) {
 
 // Without undo
 
 
 // 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)
        if (insertLength == 0)
-               return ;
+               return;
        PLATFORM_ASSERT(insertLength > 0);
        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
        // 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') {
        if (chPrev == '\r' && chAfter == '\n') {
-               //Platform::DebugPrintf("Splitting a crlf pair at %d\n", lineInsert);
                // Splitting up a crlf pair at position
                // Splitting up a crlf pair at position
-               lv.InsertValue(lineInsert, position / 2);
+               InsertLine(lineInsert, position);
                lineInsert++;
        }
        char ch = ' ';
                lineInsert++;
        }
        char ch = ' ';
-       for (int i = 0; i < insertLength; i += 2) {
+       for (int i = 0; i < insertLength; i++) {
                ch = s[i];
                if (ch == '\r') {
                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') {
                        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
                                // Patch up what was end of line
-                               lv.SetValue(lineInsert - 1, (position + i) / 2 + 1);
+                               lv.SetLineStart(lineInsert - 1, (position + i) + 1);
                        } else {
                        } else {
-                               //Platform::DebugPrintf("Inserting lf at %d\n", lineInsert);
-                               lv.InsertValue(lineInsert, (position + i) / 2 + 1);
+                               InsertLine(lineInsert, (position + i) + 1);
                                lineInsert++;
                        }
                }
                chPrev = ch;
        }
                                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') {
        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
                        // 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) {
                }
        }
 }
 
 void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
-       //Platform::DebugPrintf("Deleting at %d for %d\n", position, deleteLength);
        if (deleteLength == 0)
        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.
                // 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
 
                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 chBefore = chPrev;
-               char chNext = ' ';
-               if (position < length)
-                       chNext = ByteAt(position);
+               char chNext = substance.ValueAt(position);
                bool ignoreNL = false;
                if (chPrev == '\r' && chNext == '\n') {
                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
                        // Move back one
-                       lv.SetValue(lineRemove, position / 2);
+                       lv.SetLineStart(lineRemove, position);
                        lineRemove++;
                        ignoreNL = true;        // First \n is not real deletion
                }
 
                char ch = chNext;
                        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') {
                        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 {
                                }
                        } 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
                }
                // 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') {
                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
                        // 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) {
 }
 
 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) {
 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) {
        } 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();
 }
        }
        uh.CompletedUndoStep();
 }
@@ -1066,26 +898,22 @@ const Action &CellBuffer::GetRedoStep() const {
 void CellBuffer::PerformRedoStep() {
        const Action &actionStep = uh.GetRedoStep();
        if (actionStep.at == insertAction) {
 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) {
        } 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) {
        }
        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) {
        int stateOld = lineStates[line];
        lineStates[line] = state;
        return stateOld;
 }
 
 int CellBuffer::GetLineState(int line) {
+       lineStates.EnsureLength(line + 1);
        return lineStates[line];
 }
 
        return lineStates[line];
 }
 
@@ -1094,25 +922,11 @@ int CellBuffer::GetMaxLineState() {
 }
 
 int CellBuffer::SetLevel(int line, int level) {
 }
 
 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) {
 }
 
 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() {
 }
 
 void CellBuffer::ClearLevels() {
index bb81fd5722d3784d697a1705140183bbaf1505a7..4f654a8fd99aec2651734f0dbeccc2e710f9bf76 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef CELLBUFFER_H
 #define CELLBUFFER_H
 
 #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.
 /**
  * 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();
 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);
 };
 
        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 {
 /**
  * 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<MarkerHandleSet *> markers;
+       SplitVector<int> levels;
        /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
        int handleCurrent;
 
        /// 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();
 
        LineVector();
        ~LineVector();
        void Init();
 
-       void Expand(int sizeNew);
        void ExpandLevels(int sizeNew=-1);
        void ClearLevels();
        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 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);
        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();
 
        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();
 
        void BeginUndoAction();
        void EndUndoAction();
@@ -150,54 +151,42 @@ public:
  */
 class CellBuffer {
 private:
  */
 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<char> substance;
+       SplitVector<char> style;
        bool readOnly;
        bool readOnly;
-       int growSize;
 
        bool collectingUndo;
        UndoHistory uh;
 
        LineVector lv;
 
 
        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<int> lineStates;
 
 public:
 
 
 public:
 
-       CellBuffer(int initialLength = 4000);
+       CellBuffer();
        ~CellBuffer();
 
        /// Retrieving positions outside the range of the buffer works and returns 0
        ~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);
 
        void GetCharRange(char *buffer, int position, int lengthRetrieve);
        char StyleAt(int position);
 
-       int ByteLength();
-       int Length();
+       int Length() const;
        void Allocate(int newSize);
        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); }
        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.
 
        /// 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);
 
        bool IsReadOnly();
        void SetReadOnly(bool set);
@@ -216,7 +205,7 @@ public:
        int LineFromHandle(int markerHandle);
 
        /// Actions without undo
        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);
        void BasicDeleteChars(int position, int deleteLength);
 
        bool SetUndoCollection(bool collectUndo);
@@ -245,6 +234,8 @@ public:
        void ClearLevels();
 };
 
        void ClearLevels();
 };
 
-#define CELL_SIZE      2
+#ifdef SCI_NAMESPACE
+}
+#endif
 
 #endif
 
 #endif
diff --git a/src/stc/scintilla/src/CharacterSet.h b/src/stc/scintilla/src/CharacterSet.h
new file mode 100644 (file)
index 0000000..4e8ffbd
--- /dev/null
@@ -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 <neilh@scintilla.org>
+// 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<unsigned char>(*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;
+       }
+};
index 3d021b080b2f6d46133833722001c9eeccb2b619..08de5cf1f7aa9ce89f3417d65b6bbbf921d7960c 100644 (file)
 // Scintilla source code edit control
 /** @file ContractionState.cxx
 // 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 <neilh@scintilla.org>
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // The License.txt file describes the conditions under which this software may be distributed.
 
+#include <string.h>
+
 #include "Platform.h"
 
 #include "Platform.h"
 
+#include "SplitVector.h"
+#include "Partitioning.h"
+#include "RunStyles.h"
 #include "ContractionState.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();
 }
 
 }
 
 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; lineInDoc<linesInDoc; lineInDoc++) {
-                       lines[lineInDoc].displayLine = linesInDisplay;
-                       if (lines[lineInDoc].visible) {
-                               linesInDisplay += lines[lineInDoc].height;
-                       }
-               }
-               if (sizeDocLines < linesInDisplay) {
-                       delete []docLines;
-                       int *docLinesNew = new int[linesInDisplay + growSize];
-                       if (!docLinesNew) {
-                               docLines = 0;
-                               sizeDocLines = 0;
-                               return;
-                       }
-                       docLines = docLinesNew;
-                       sizeDocLines = linesInDisplay + growSize;
-               }
-
-               int lineInDisplay=0;
-               for (int line=0; line<linesInDoc; line++) {
-                       if (lines[line].visible) {
-                               for (int linePiece=0; linePiece<lines[line].height; linePiece++) {
-                                       docLines[lineInDisplay] = line;
-                                       lineInDisplay++;
-                               }
-                       }
-               }
-               valid = true;
+void ContractionState::EnsureData() {
+       if (OneToOne()) {
+               visible = new RunStyles();
+               expanded = new RunStyles();
+               heights = new RunStyles();
+               displayLines = new Partitioning(4);
+               InsertLines(0, linesInDocument);
        }
 }
 
 void ContractionState::Clear() {
        }
 }
 
 void ContractionState::Clear() {
-       delete []lines;
-       lines = 0;
-       size = 0;
-       linesInDoc = 1;
-       linesInDisplay = 1;
-       delete []docLines;
-       docLines = 0;
-       sizeDocLines = 0;
+       delete visible;
+       visible = 0;
+       delete expanded;
+       expanded = 0;
+       delete heights;
+       heights = 0;
+       delete displayLines;
+       displayLines = 0;
+       linesInDocument = 1;
 }
 
 int ContractionState::LinesInDoc() const {
 }
 
 int ContractionState::LinesInDoc() const {
-       return linesInDoc;
+       if (OneToOne()) {
+               return linesInDocument;
+       } else {
+               return displayLines->Partitions() - 1;
+       }
 }
 
 int ContractionState::LinesDisplayed() const {
 }
 
 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 {
 }
 
 int ContractionState::DisplayFromDoc(int lineDoc) const {
-       if (size == 0) {
+       if (OneToOne()) {
                return lineDoc;
                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 {
 }
 
 int ContractionState::DocFromDisplay(int lineDisplay) const {
-       if (lineDisplay <= 0)
-               return 0;
-       if (lineDisplay >= linesInDisplay)
-               return linesInDoc;
-       if (size == 0)
+       if (OneToOne()) {
                return lineDisplay;
                return lineDisplay;
-       MakeValid();
-       if (docLines) { // Valid allocation
-               return docLines[lineDisplay];
        } else {
        } 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 {
        } 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) {
        }
 }
 
 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;d<lineCount;d++) {
-               lines[lineDoc+d].visible = true;        // Should inherit visibility from context ?
-               lines[lineDoc+d].height = 1;
-               lines[lineDoc+d].expanded = true;
+       Check();
+}
+
+void ContractionState::DeleteLine(int lineDoc) {
+       if (OneToOne()) {
+               linesInDocument--;
+       } else {
+               if (GetVisible(lineDoc)) {
+                       displayLines->InsertText(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) {
 }
 
 void ContractionState::DeleteLines(int lineDoc, int lineCount) {
-       if (size == 0) {
-               linesInDoc -= lineCount;
-               linesInDisplay -= lineCount;
-               return;
-       }
-       int deltaDisplayed = 0;
-       for (int d=0;d<lineCount;d++) {
-               if (lines[lineDoc+d].visible)
-                       deltaDisplayed -= lines[lineDoc+d].height;
+       for (int l = 0; l < lineCount; l++) {
+               DeleteLine(lineDoc);
        }
        }
-       for (int i = lineDoc; i < linesInDoc-lineCount; i++) {
-               if (i != 0) // Line zero is always visible
-                       lines[i].visible = lines[i + lineCount].visible;
-               lines[i].expanded = lines[i + lineCount].expanded;
-               lines[i].height = lines[i + lineCount].height;
-       }
-       linesInDoc -= lineCount;
-       linesInDisplay += deltaDisplayed;
-       valid = false;
+       Check();
 }
 
 bool ContractionState::GetVisible(int lineDoc) const {
 }
 
 bool ContractionState::GetVisible(int lineDoc) const {
-       if (size == 0)
+       if (OneToOne()) {
                return true;
                return true;
-       if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
-               return lines[lineDoc].visible;
        } else {
        } 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;
                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 {
 }
 
 bool ContractionState::GetExpanded(int lineDoc) const {
-       if (size == 0)
+       if (OneToOne()) {
                return true;
                return true;
-       if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
-               return lines[lineDoc].expanded;
        } else {
        } 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;
                        return true;
+               } else {
+                       Check();
+                       return false;
                }
        }
                }
        }
-       return false;
 }
 
 int ContractionState::GetHeight(int lineDoc) const {
 }
 
 int ContractionState::GetHeight(int lineDoc) const {
-       if (size == 0)
+       if (OneToOne()) {
                return 1;
                return 1;
-       if ((lineDoc >= 0) && (lineDoc < linesInDoc)) {
-               return lines[lineDoc].height;
        } else {
        } 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) {
        }
 }
 
 // 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;
                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;
                }
                        return false;
                }
-               Grow(linesInDoc + growSize);
-       }
-       if (lines[lineDoc].height != height) {
-               lines[lineDoc].height = height;
-               valid = false;
-               return true;
-       } else {
-               return false;
        }
 }
 
 void ContractionState::ShowAll() {
        }
 }
 
 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
 }
 }
index e15ee3bbe6279c64ea6e8d8359b21e14d7043e78..ba629751280e69030e2430b104001f0830403402 100644 (file)
@@ -1,40 +1,34 @@
 // Scintilla source code edit control
 /** @file ContractionState.h
 // 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 <neilh@scintilla.org>
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef CONTRACTIONSTATE_H
 #define CONTRACTIONSTATE_H
 
 // 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 {
 
 /**
  */
 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();
 
 public:
        ContractionState();
@@ -47,7 +41,9 @@ public:
        int DisplayFromDoc(int lineDoc) const;
        int DocFromDisplay(int lineDisplay) const;
 
        int DisplayFromDoc(int lineDoc) const;
        int DocFromDisplay(int lineDisplay) const;
 
+       void InsertLine(int lineDoc);
        void InsertLines(int lineDoc, int lineCount);
        void InsertLines(int lineDoc, int lineCount);
+       void DeleteLine(int lineDoc);
        void DeleteLines(int lineDoc, int lineCount);
 
        bool GetVisible(int lineDoc) const;
        void DeleteLines(int lineDoc, int lineCount);
 
        bool GetVisible(int lineDoc) const;
@@ -60,6 +56,11 @@ public:
        bool SetHeight(int lineDoc, int height);
 
        void ShowAll();
        bool SetHeight(int lineDoc, int height);
 
        void ShowAll();
+       void Check() const;
 };
 
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
diff --git a/src/stc/scintilla/src/Decoration.cxx b/src/stc/scintilla/src/Decoration.cxx
new file mode 100644 (file)
index 0000000..e4ac0e0
--- /dev/null
@@ -0,0 +1,188 @@
+/** @file Decoration.cxx
+ ** Visual elements added over text.
+ **/
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#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 (file)
index 0000000..2809641
--- /dev/null
@@ -0,0 +1,64 @@
+/** @file Decoration.h
+ ** Visual elements added over text.
+ **/
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
+// 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
index 92be92691c0a117dcfc8b8a0ca3828276dcfa2b6..ff8d0fbcfcb374c404399f7adb74c615b6ebc0f0 100644 (file)
 #include "Platform.h"
 
 #include "Scintilla.h"
 #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 "CellBuffer.h"
 #include "CharClassify.h"
+#include "Decoration.h"
 #include "Document.h"
 #include "RESearch.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));
 // 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;
        stylingMask = 0;
        endStyled = 0;
        styleClock = 0;
-       enteredCount = 0;
+       enteredModification = 0;
+       enteredStyling = 0;
        enteredReadOnlyCount = 0;
        tabInChars = 8;
        indentInChars = 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);
 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;
 }
        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);
                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);
        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);
 }
 
        NotifyModified(mh);
 }
 
@@ -140,11 +145,11 @@ void Document::DeleteAllMarks(int markerNum) {
        NotifyModified(mh);
 }
 
        NotifyModified(mh);
 }
 
-int Document::LineStart(int line) {
+int Document::LineStart(int line) const {
        return cb.LineStart(line);
 }
 
        return cb.LineStart(line);
 }
 
-int Document::LineEnd(int line) {
+int Document::LineEnd(int line) const {
        if (line == LinesTotal() - 1) {
                return LineStart(line + 1);
        } else {
        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,
        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);
                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)
                        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)
                        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<unsigned char>(cb.CharAt(lead-1))))
+               lead--;
+       start = 0;
+       if (lead > 0) {
+               start = lead-1;
+       }
+       int leadByte = static_cast<unsigned char>(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<trailBytes) && (trail < Length())) {
+                       if (!IsTrailByte(static_cast<unsigned char>(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.
 // 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<unsigned char>(cb.CharAt(pos));
        if (dbcsCodePage) {
                if (SC_CP_UTF8 == dbcsCodePage) {
                        unsigned char ch = static_cast<unsigned char>(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)
                                if (moveDir > 0)
-                                       pos++;
+                                       pos = endUTF;
                                else
                                else
-                                       pos--;
-                               ch = static_cast<unsigned char>(cb.CharAt(pos));
+                                       pos = startUTF;
                        }
                } else {
                        // Anchor DBCS calculations at start of line because start of line can
                        }
                } 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
 
 // 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();
 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 {
                return false;
        } else {
-               enteredCount++;
+               enteredModification++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
                            DocModification(
                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();
                                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))
                        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(
                                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));
                }
                                pos, len,
                                LinesTotal() - prevLinesTotal, text));
                }
-               enteredCount--;
+               enteredModification--;
        }
        return !cb.IsReadOnly();
 }
 
 /**
        }
        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();
        CheckReadOnly();
-       if (enteredCount != 0) {
+       if (enteredModification != 0) {
                return false;
        } else {
                return false;
        } else {
-               enteredCount++;
+               enteredModification++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
                            DocModification(
                                SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
                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();
                                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);
                        if (startSavePoint && cb.IsCollectingUndo())
                                NotifySavePoint(!startSavePoint);
-                       ModifiedAt(position / 2);
+                       ModifiedAt(position);
                        NotifyModified(
                            DocModification(
                        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));
                }
                                LinesTotal() - prevLinesTotal, text));
                }
-               enteredCount--;
+               enteredModification--;
        }
        return !cb.IsReadOnly();
 }
        }
        return !cb.IsReadOnly();
 }
@@ -433,8 +493,8 @@ bool Document::InsertStyledString(int position, char *s, int insertLength) {
 int Document::Undo() {
        int newPos = -1;
        CheckReadOnly();
 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;
                if (!cb.IsReadOnly()) {
                        bool startSavePoint = cb.IsSavePoint();
                        bool multiLine = false;
@@ -481,7 +541,7 @@ int Document::Undo() {
                        if (startSavePoint != endSavePoint)
                                NotifySavePoint(endSavePoint);
                }
                        if (startSavePoint != endSavePoint)
                                NotifySavePoint(endSavePoint);
                }
-               enteredCount--;
+               enteredModification--;
        }
        return newPos;
 }
        }
        return newPos;
 }
@@ -489,8 +549,8 @@ int Document::Undo() {
 int Document::Redo() {
        int newPos = -1;
        CheckReadOnly();
 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;
                if (!cb.IsReadOnly()) {
                        bool startSavePoint = cb.IsSavePoint();
                        bool multiLine = false;
@@ -535,7 +595,7 @@ int Document::Redo() {
                        if (startSavePoint != endSavePoint)
                                NotifySavePoint(endSavePoint);
                }
                        if (startSavePoint != endSavePoint)
                                NotifySavePoint(endSavePoint);
                }
-               enteredCount--;
+               enteredModification--;
        }
        return newPos;
 }
        }
        return newPos;
 }
@@ -544,39 +604,18 @@ int Document::Redo() {
  * Insert a single character.
  */
 bool Document::InsertChar(int pos, char ch) {
  * Insert a single character.
  */
 bool Document::InsertChar(int pos, char ch) {
-       char chs[2];
+       char chs[1];
        chs[0] = ch;
        chs[0] = ch;
-       chs[1] = 0;
-       return InsertStyledString(pos*2, chs, 2);
+       return InsertString(pos, chs, 1);
 }
 
 /**
  * Insert a null terminated string.
  */
 }
 
 /**
  * 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));
 }
 
        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<int>(insertLength*2));
-                       delete []sWithStyle;
-               }
-       }
-       return changed;
-}
-
 void Document::ChangeChar(int pos, char ch) {
        DeleteChars(pos, 1);
        InsertChar(pos, ch);
 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);
                int indentPos = GetLineIndentPosition(line);
                BeginUndoAction();
                DeleteChars(thisLineStart, indentPos - thisLineStart);
-               InsertString(thisLineStart, linebuf);
+               InsertCString(thisLineStart, linebuf);
                EndUndoAction();
        }
 }
 
                EndUndoAction();
        }
 }
 
-int Document::GetLineIndentPosition(int line) {
+int Document::GetLineIndentPosition(int line) const {
        if (line < 0)
                return 0;
        int pos = LineStart(line);
        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;
                                return column;
                        } else if (ch == '\n') {
                                return column;
+                       } else if (i >= Length()) {
+                               return column;
                        } else {
                                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++;
                                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();
 }
 
        EndUndoAction();
 }
 
-bool Document::IsWhiteLine(int line) {
+bool Document::IsWhiteLine(int line) const {
        int currentChar = LineStart(line);
        int endLine = LineEnd(line);
        while (currentChar < endLine) {
        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 {
                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++;
                        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;
 }
 
        return substituted;
 }
 
-int Document::LinesTotal() {
+int Document::LinesTotal() const {
        return cb.Lines();
 }
 
        return cb.Lines();
 }
 
@@ -1275,11 +1316,7 @@ void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCh
 
 void Document::SetStylingBits(int bits) {
        stylingBits = bits;
 
 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) {
 }
 
 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) {
 }
 
 bool Document::SetStyleFor(int length, char style) {
-       if (enteredCount != 0) {
+       if (enteredStyling != 0) {
                return false;
        } else {
                return false;
        } else {
-               enteredCount++;
+               enteredStyling++;
                style &= stylingMask;
                int prevEndStyled = endStyled;
                if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
                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;
                        NotifyModified(mh);
                }
                endStyled += length;
-               enteredCount--;
+               enteredStyling--;
                return true;
        }
 }
 
 bool Document::SetStyles(int length, char *styles) {
                return true;
        }
 }
 
 bool Document::SetStyles(int length, char *styles) {
-       if (enteredCount != 0) {
+       if (enteredStyling != 0) {
                return false;
        } else {
                return false;
        } else {
-               enteredCount++;
+               enteredStyling++;
                bool didChange = false;
                int startMod = 0;
                int endMod = 0;
                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);
                }
                                           startMod, endMod - startMod + 1);
                        NotifyModified(mh);
                }
-               enteredCount--;
+               enteredStyling--;
                return true;
        }
 }
 
                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);
                }
        }
                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() {
 }
 
 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) {
 }
 
 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);
        }
        for (int i = 0; i < lenWatchers; i++) {
                watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
        }
index 15ba096b8a2664417cc569b539ef3a2199b67ab3..a36c4aafeedac24beecc954682d0ab2dc83ccf25 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef DOCUMENT_H
 #define DOCUMENT_H
 
 #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.
 /**
  * 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 pos=0) :
                start(pos), end(pos) {
-       }
+       };
        Range(Position start_, Position end_) :
                start(start_), end(end_) {
        Range(Position start_, Position end_) :
                start(start_), end(end_) {
-       }
+       };
 
        bool Valid() const {
                return (start != invalidPosition) && (end != invalidPosition);
 
        bool Valid() const {
                return (start != invalidPosition) && (end != invalidPosition);
@@ -97,7 +101,8 @@ private:
        char stylingMask;
        int endStyled;
        int styleClock;
        char stylingMask;
        int endStyled;
        int styleClock;
-       int enteredCount;
+       int enteredModification;
+       int enteredStyling;
        int enteredReadOnlyCount;
 
        WatcherWithUserData *watchers;
        int enteredReadOnlyCount;
 
        WatcherWithUserData *watchers;
@@ -121,6 +126,8 @@ public:
        bool tabIndents;
        bool backspaceUnindents;
 
        bool tabIndents;
        bool backspaceUnindents;
 
+       DecorationList decorations;
+
        Document();
        virtual ~Document();
 
        Document();
        virtual ~Document();
 
@@ -131,12 +138,14 @@ public:
        int ClampPositionIntoDocument(int pos);
        bool IsCrLf(int pos);
        int LenChar(int pos);
        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);
        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 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(); }
        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 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);
        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 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);
        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); }
        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);
 
        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 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);
        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);
 
 
        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 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();
        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(); }
 
        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);
        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:
        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);
        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;
 };
 
        virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0;
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index c695c5f510e510131f0b496cc9eae95efddb7b7b..a25979dc2c9300b9025b627edae181d15aecf322 100644 (file)
 #include "Platform.h"
 
 #include "PropSet.h"
 #include "Platform.h"
 
 #include "PropSet.h"
-#include "SVector.h"
 #include "Accessor.h"
 #include "DocumentAccessor.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 "CellBuffer.h"
 #include "Scintilla.h"
 #include "CharClassify.h"
+#include "Decoration.h"
 #include "Document.h"
 
 #include "Document.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 DocumentAccessor::~DocumentAccessor() {
 }
 
 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) {
 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) {
                if (pos < startSeg) {
-                       Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos);
+                       return;
                }
 
                if (validLen + (pos - startSeg + 1) >= bufferSize)
                }
 
                if (validLen + (pos - startSeg + 1) >= bufferSize)
@@ -185,3 +193,7 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI
                return indent;
 }
 
                return indent;
 }
 
+void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int value) {
+       pdoc->decorations.SetCurrentIndicator(indicator);
+       pdoc->DecorationFillRange(start, value, end - start);
+}
index 0b94978c2d4668783dc50a12926995f5f277a819..a3a939d0d3068fa67397d37ac0d5b25ce24009b2 100644 (file)
@@ -6,6 +6,10 @@
 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 class Document;
 
 /**
 class Document;
 
 /**
@@ -58,10 +62,15 @@ public:
        WindowID GetWindow() { return id; }
 
        void StartAt(unsigned int start, char chMask=31);
        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);
        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
index a69194f97e854344f8a2c507dcd0cff4ed76960f..9107102ff6f654834596f7e22bf523563f0c1c00 100644 (file)
 #endif
 #include "Scintilla.h"
 
 #endif
 #include "Scintilla.h"
 
+#include "SplitVector.h"
+#include "Partitioning.h"
+#include "RunStyles.h"
 #include "ContractionState.h"
 #include "ContractionState.h"
-#include "SVector.h"
 #include "CellBuffer.h"
 #include "KeyMap.h"
 #include "Indicator.h"
 #include "CellBuffer.h"
 #include "KeyMap.h"
 #include "Indicator.h"
 #include "Style.h"
 #include "ViewStyle.h"
 #include "CharClassify.h"
 #include "Style.h"
 #include "ViewStyle.h"
 #include "CharClassify.h"
+#include "Decoration.h"
 #include "Document.h"
 #include "Document.h"
+#include "PositionCache.h"
 #include "Editor.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) {
 /*
        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
                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
                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
 
 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
 */
 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() :
 }
 
 Caret::Caret() :
-active(false), on(false), period(500) {}
+               active(false), on(false), period(500) {}
 
 Timer::Timer() :
 
 Timer::Timer() :
-ticking(false), ticksToWait(0), tickerID(0) {}
+               ticking(false), ticksToWait(0), tickerID(0) {}
 
 Idler::Idler() :
 
 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() {
 }
 
 Editor::Editor() {
@@ -358,7 +109,7 @@ Editor::Editor() {
        dwelling = false;
        ptMouseLast.x = 0;
        ptMouseLast.y = 0;
        dwelling = false;
        ptMouseLast.x = 0;
        ptMouseLast.y = 0;
-       inDragDrop = false;
+       inDragDrop = ddNone;
        dropWentOutside = false;
        posDrag = invalidPosition;
        posDrop = invalidPosition;
        dropWentOutside = false;
        posDrag = invalidPosition;
        posDrop = invalidPosition;
@@ -386,6 +137,8 @@ Editor::Editor() {
        xCaretMargin = 50;
        horizontalScrollBarVisible = true;
        scrollWidth = 2000;
        xCaretMargin = 50;
        horizontalScrollBarVisible = true;
        scrollWidth = 2000;
+       trackLineWidth = false;
+       lineWidthMaxSeen = 0;
        verticalScrollBarVisible = true;
        endAtLastLine = true;
        caretSticky = false;
        verticalScrollBarVisible = true;
        endAtLastLine = true;
        caretSticky = false;
@@ -442,6 +195,7 @@ Editor::Editor() {
        hsEnd = -1;
 
        llc.SetLevel(LineLayoutCache::llcCaret);
        hsEnd = -1;
 
        llc.SetLevel(LineLayoutCache::llcCaret);
+       posCache.SetSize(0x400);
 }
 
 Editor::~Editor() {
 }
 
 Editor::~Editor() {
@@ -474,6 +228,7 @@ void Editor::InvalidateStyleData() {
        palette.Release();
        DropGraphics();
        llc.Invalidate(LineLayout::llInvalid);
        palette.Release();
        DropGraphics();
        llc.Invalidate(LineLayout::llInvalid);
+       posCache.Clear();
        if (selType == selRectangle) {
                xStartSelect = XFromPosition(anchor);
                xEndSelect = XFromPosition(currentPos);
        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);
        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() {
 }
 
 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",
 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
 /**
  * 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();
 Point Editor::LocationFromPosition(int pos) {
        Point pt;
        RefreshStyleData();
@@ -725,10 +480,6 @@ void Editor::SetTopLine(int topLineNew) {
        posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine));
 }
 
        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;
 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 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;
                        }
                        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);
                                }
                                        return pdoc->MovePositionOutsideChar(i + posLineStart, 1);
                                }
+                               i++;
                        }
                        return lineEnd + posLineStart;
                }
                        }
                        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 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;
                        }
                        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);
                                }
                                        return pdoc->MovePositionOutsideChar(i + posLineStart, 1);
                                }
+                               i++;
                        }
                        if (pt.x < (ll->positions[lineEnd] - subLineStart)) {
                                return pdoc->MovePositionOutsideChar(lineEnd + posLineStart, 1);
                        }
                        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);
                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;
                }
                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;
                        }
                                retVal = pdoc->MovePositionOutsideChar(i + posLineStart, 1);
                                break;
                        }
+                       i++;
                }
        }
        return retVal;
                }
        }
        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
                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();
                        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 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(
        } 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;
                        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;
                }
                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();
                        xOffset = xOffsetNew;
                        if (xOffsetNew > 0) {
                                PRectangle rcText = GetTextRectangle();
-                               if (horizontalScrollBarVisible == true &&
+                               if (horizontalScrollBarVisible &&
                                        rcText.Width() + xOffset > scrollWidth) {
                                        scrollWidth = xOffset + rcText.Width();
                                        SetScrollBars();
                                        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.
 // 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 &&
                        }
                }
                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;
                }
                        // 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) {
                                // 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++;
                                                wrapOccurred = true;
                                        }
                                        lineToWrap++;
@@ -1628,6 +1390,7 @@ void Editor::LinesJoin() {
                                if (prevNonWS) {
                                        // Ensure at least one space separating previous lines
                                        pdoc->InsertChar(pos, ' ');
                                if (prevNonWS) {
                                        // Ensure at least one space separating previous lines
                                        pdoc->InsertChar(pos, ' ');
+                                       targetEnd++;
                                }
                        } else {
                                prevNonWS = pdoc->CharAt(pos) != ' ';
                                }
                        } 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++) {
                                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<int>(strlen(eol));
                                }
                        }
                                        targetEnd += static_cast<int>(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,
 
                        // 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,
                        int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND,
-                                                               SC_MARKNUM_FOLDER);
+                               SC_MARKNUM_FOLDER);
 
                        while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) {
 
 
                        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",
                                        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
                                        }
                                        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,
                                        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) {
                                }
 
                                if (marks) {
@@ -1911,17 +1674,69 @@ void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) {
        surface->LineTo(xhead, ymid + ydiff);
 }
 
        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);
 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,
        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<const unsigned char *>(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;
 void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width) {
        if (!ll)
                return;
+
        PLATFORM_ASSERT(line < pdoc->LinesTotal());
        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
        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 &&
                                char chDoc = pdoc->CharAt(charInDoc);
                                styleByte = pdoc->StyleAt(charInDoc);
                                allSame = allSame &&
-                                               (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte & styleMask));
+                                       (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte & styleMask));
                                allSame = allSame &&
                                allSame = allSame &&
-                                               (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
+                                       (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
                                if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed)
                                        allSame = allSame &&
                                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 &&
                                else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
                                        allSame = allSame &&
-                                                       (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
+                                               (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
                                else    // Style::caseUpper
                                        allSame = allSame &&
                                else    // Style::caseUpper
                                        allSame = allSame &&
-                                                       (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
+                                               (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
                                numCharsInLine++;
                        }
                        allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled
                                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 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]);
                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]) ||
                        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) /
                                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]] =
                                                } 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<char>(controlCharSymbol), '\0' };
                                                        surface->MeasureWidths(ctrlCharsFont, cc, 1,
                                                        }
                                                        ll->positions[charInLine + 1] = ctrlCharWidth[ll->chars[charInLine]];
                                                } else {
                                                        char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
                                                        surface->MeasureWidths(ctrlCharsFont, cc, 1,
-                                                                              ll->positions + startseg + 1);
+                                                               ll->positions + startseg + 1);
                                                }
                                                lastSegItalics = false;
                                                }
                                                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])) {
                                        } 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;
                                                        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
                                                }
                                        }
                                } 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.
                        }
                        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;
                        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)
                                                // 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)
                                                }
                                                if (lastGoodBreak == lastLineStart) {
                                                        // Ensure at least one character on line.
                                                        lastGoodBreak = pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1)
-                                                                       - posLineStart;
+                                                               - posLineStart;
                                                }
                                        }
                                        lastLineStart = lastGoodBreak;
                                                }
                                        }
                                        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)
                                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]) {
                                                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 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);
        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;
                        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;
                        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,
        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,
 }
 
 void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace,
-                            bool isEndMarker, ColourAllocated wrapColour) {
+        bool isEndMarker, ColourAllocated wrapColour) {
        surface->PenColour(wrapColour);
 
        enum { xa = 1 }; // gap before start
        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) {
                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) {
                }
                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};
                }
        };
        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...
        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) {
 }
 
 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,
 }
 
 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;
 
        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)) &&
        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));
 
        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);
        }
 
                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;
 
        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,
 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;
 
 
        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) &&
                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;
                        }
                                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) &&
                        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;
                                        }
                                                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) &&
        }
 
        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;
 
        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);
        }
 
                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) {
        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..
                        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
 
                        // 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;
 
                                else
                                        rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
 
-                               DrawWrapMarker(surface, rcPlace, false, vsDraw.whitespaceForeground.allocated);
+                               DrawWrapMarker(surface, rcPlace, false, wrapColour);
                        }
 
                        xStart += actualWrapVisualStartIndent * vsDraw.aveCharWidth;
                }
        }
 
                        }
 
                        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
 
        // 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;
                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,
                }
        }
 
        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.
        }
 
        inIndentation = subLine == 0;   // Do not handle indentation except on first subline.
-       startseg = ll->LineStart(subLine);
        // Foreground drawing loop
        // 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;
 
                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<char>(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 {
                                } 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<char>(controlCharSymbol), '\0' };
+                                       surface->DrawTextNoClip(rcSegment, ctrlCharsFont,
+                                               rcSegment.top + vsDraw.maxAscent,
+                                               cc, 1, textBack, textFore);
+                               }
+                       } else if ((i == startseg) && (static_cast<unsigned char>(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);
                                        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,
        // 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;
        }
        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;
                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);
                }
        }
 
                        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;
        // 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;
 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,
                if (!pixmapLine->Initialised()) {
                        PRectangle rcClient = GetClientRectangle();
                        pixmapLine->InitPixMap(rcClient.Width(), vs.lineHeight,
-                                              surfaceWindow, wMain.GetID());
+                               surfaceWindow, wMain.GetID());
                        pixmapSelMargin->InitPixMap(vs.fixedColumnWidth,
                        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<char>(bracesMatchStyle),
                                Range rangeLine(pdoc->LineStart(lineDoc), pdoc->LineStart(lineDoc + 1));
                                // Highlight the current braces if any
                                ll->SetBracesHighlight(rangeLine, braces, static_cast<char>(bracesMatchStyle),
-                                                      highlightGuideColumn * vs.spaceWidth);
+                                       highlightGuideColumn * vs.spaceWidth);
 
                                // Draw the line
                                DrawLine(surface, vs, lineDoc, visibleLine, xStart, rcLine, ll, subLine);
 
                                // 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);
                                // 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) {
                                                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;
                                                }
                                                        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;
                                                        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) {
                                                                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;
                                                                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 {
                                                                } 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,
                                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);
                                        surfaceWindow->Copy(rcCopyArea, from, *pixmapLine);
                                }
                                //durCopy += et.Duration(true);
@@ -3054,6 +3070,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
 
                        yposScreen += vs.lineHeight;
                        visibleLine++;
 
                        yposScreen += vs.lineHeight;
                        visibleLine++;
+
+                       lineWidthMaxSeen = Platform::Maximum(
+                                   lineWidthMaxSeen, ll->positions[ll->numCharsInLine]);
                        //gdk_flush();
                }
                ll.Set(0);
                        //gdk_flush();
                }
                ll.Set(0);
@@ -3113,6 +3132,9 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
                return 0;
        }
 
                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
        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.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;
        // 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
        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);
                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);
        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,
        // 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.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;
 
        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);
 
        // 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 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;
 
        if (printWrapState == eWrapNone)
                widthPrint = LineLayout::wrapWidthInfinite;
 
@@ -3214,7 +3237,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
                ll.containsCaret = false;
 
                PRectangle rcLine;
                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;
                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
                        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,
                        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
                }
 
                // Draw the line
@@ -3276,6 +3299,9 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
                ++lineDoc;
        }
 
                ++lineDoc;
        }
 
+       // Clear cache so measurements are not used for screen
+       posCache.Clear();
+
        return nPrintPos;
 }
 
        return nPrintPos;
 }
 
@@ -3337,6 +3363,7 @@ void Editor::AddChar(char ch) {
        AddCharUTF(s, 1);
 }
 
        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();
 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 (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();
        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<unsigned char>(s[0]) << 8) |
 
        if (treatAsDBCS) {
                NotifyChar((static_cast<unsigned char>(s[0]) << 8) |
-                          static_cast<unsigned char>(s[1]));
+                       static_cast<unsigned char>(s[1]));
        } else {
                int byte = static_cast<unsigned char>(s[0]);
                if ((byte < 0xC0) || (1 == len)) {
        } else {
                int byte = static_cast<unsigned char>(s[0]);
                if ((byte < 0xC0) || (1 == len)) {
@@ -3452,6 +3487,7 @@ void Editor::ClearDocumentStyle() {
 }
 
 void Editor::Cut() {
 }
 
 void Editor::Cut() {
+       pdoc->CheckReadOnly();
        if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) {
                Copy();
                ClearSelection();
        if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) {
                Copy();
                ClearSelection();
@@ -3615,9 +3651,13 @@ void Editor::NotifyModifyAttempt() {
        NotifyParent(scn);
 }
 
        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;
        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);
 }
 
        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) |
        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);
 }
 
        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) |
        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);
 }
 
        NotifyParent(scn);
 }
 
@@ -3651,6 +3691,18 @@ void Editor::NotifyPainted() {
        NotifyParent(scn);
 }
 
        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;
 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) |
                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);
                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) {
 }
 
 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);
                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 (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
                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);
                        }
                }
                                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) {
        } 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 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
                }
                        // 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_VCHOMEWRAPEXTEND:
        case SCI_DELWORDLEFT:
        case SCI_DELWORDRIGHT:
+       case SCI_DELWORDRIGHTEND:
        case SCI_DELLINELEFT:
        case SCI_DELLINERIGHT:
        case SCI_LINECOPY:
        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;
 
        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);
        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;
        // 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;
 
        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(
                Point pt = LocationFromPosition(currentPos);
 
                topLineNew = Platform::Clamp(
-                            topLine + direction * LinesToScroll(), 0, MaxScrollPos());
+                           topLine + direction * LinesToScroll(), 0, MaxScrollPos());
                newPos = PositionFromLocation(
                newPos = PositionFromLocation(
-                        Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll())));
+                           Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll())));
        }
 
        if (topLineNew != topLine) {
        }
 
        if (topLineNew != topLine) {
@@ -4036,7 +4105,7 @@ void Editor::ChangeCaseOfSelection(bool makeUpperCase) {
        int startAnchor = anchor;
        if (selType == selStream) {
                pdoc->ChangeCase(Range(SelectionStart(), SelectionEnd()),
        int startAnchor = anchor;
        if (selType == selStream) {
                pdoc->ChangeCase(Range(SelectionStart(), SelectionEnd()),
-                                makeUpperCase);
+                       makeUpperCase);
                SetSelection(startCurrent, startAnchor);
        } else {
                SelectionLineIterator lineIterator(this, false);
                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) {
 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 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);
        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);
                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
        } 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);
                SetEmptySelection(currentPos + istrlen(eol));
                while (*eol) {
                        NotifyChar(*eol);
@@ -4125,6 +4185,7 @@ void Editor::NewLine() {
                }
        }
        SetLastXChosen();
                }
        }
        SetLastXChosen();
+       SetScrollBars();
        EnsureCaretVisible();
        // Avoid blinking during rapid typing:
        ShowCaretAtCurrentPosition();
        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(
 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.
        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
                        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();
                                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
                        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();
                                endPos = realEndPos;
                        MovePositionTo(endPos, selStream);
                        SetLastXChosen();
@@ -4509,6 +4570,11 @@ int Editor::KeyCommand(unsigned int iMessage) {
                        pdoc->DeleteChars(currentPos, endWord - currentPos);
                }
                break;
                        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);
        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),
                        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: {
                }
                break;
        case SCI_LINECUT: {
@@ -4579,22 +4645,22 @@ int Editor::KeyCommand(unsigned int iMessage) {
                break;
        case SCI_HOMEDISPLAY:
                MovePositionTo(MovePositionSoVisible(
                break;
        case SCI_HOMEDISPLAY:
                MovePositionTo(MovePositionSoVisible(
-                                  StartEndDisplayLine(currentPos, true), -1));
+                           StartEndDisplayLine(currentPos, true), -1));
                SetLastXChosen();
                break;
        case SCI_HOMEDISPLAYEXTEND:
                MovePositionTo(MovePositionSoVisible(
                SetLastXChosen();
                break;
        case SCI_HOMEDISPLAYEXTEND:
                MovePositionTo(MovePositionSoVisible(
-                                  StartEndDisplayLine(currentPos, true), -1), selStream);
+                           StartEndDisplayLine(currentPos, true), -1), selStream);
                SetLastXChosen();
                break;
        case SCI_LINEENDDISPLAY:
                MovePositionTo(MovePositionSoVisible(
                SetLastXChosen();
                break;
        case SCI_LINEENDDISPLAY:
                MovePositionTo(MovePositionSoVisible(
-                                  StartEndDisplayLine(currentPos, false), 1));
+                           StartEndDisplayLine(currentPos, false), 1));
                SetLastXChosen();
                break;
        case SCI_LINEENDDISPLAYEXTEND:
                MovePositionTo(MovePositionSoVisible(
                SetLastXChosen();
                break;
        case SCI_LINEENDDISPLAYEXTEND:
                MovePositionTo(MovePositionSoVisible(
-                                  StartEndDisplayLine(currentPos, false), 1), selStream);
+                           StartEndDisplayLine(currentPos, false), 1), selStream);
                SetLastXChosen();
                break;
        }
                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) |
 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)
        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) -
                                        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++) {
                                        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->EndUndoAction();
                        } else {
                                int newColumn = ((pdoc->GetColumn(currentPos) - 1) / pdoc->tabInChars) *
-                                               pdoc->tabInChars;
+                                       pdoc->tabInChars;
                                if (newColumn < 0)
                                        newColumn = 0;
                                int newPos = currentPos;
                                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(
  * @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<TextToFind *>(lParam);
        int lengthFound = istrlen(ft->lpstrText);
        int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText,
 
        TextToFind *ft = reinterpret_cast<TextToFind *>(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;
        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,
 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<char *>(lParam);
     sptr_t lParam) {                   ///< The text to search for.
 
        const char *txt = reinterpret_cast<char *>(lParam);
@@ -4760,20 +4826,20 @@ long Editor::SearchText(
        int lengthFound = istrlen(txt);
        if (iMessage == SCI_SEARCHNEXT) {
                pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt,
        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,
        } 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) {
        }
 
        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,
 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;
        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,
 
 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) {
 }
 
 void Editor::CopySelectionRange(SelectionText *ss) {
@@ -4864,8 +4930,8 @@ void Editor::CopySelectionRange(SelectionText *ss) {
                                lineIterator.Reset();
                                while (lineIterator.Iterate()) {
                                        for (int i = lineIterator.startPos;
                                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) {
                                                text[j++] = pdoc->CharAt(i);
                                        }
                                        if (selType != selLines) {
@@ -4881,7 +4947,7 @@ void Editor::CopySelectionRange(SelectionText *ss) {
                        }
                }
                ss->Set(text, size + 1, pdoc->dbcsCodePage,
                        }
                }
                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,
        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,
        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);
 }
 
        CopyToClipboard(selectedText);
 }
 
@@ -4922,6 +4988,13 @@ void Editor::DisplayCursor(Window::Cursor c) {
                wMain.SetCursor(static_cast<Window::Cursor>(cursorMode));
 }
 
                wMain.SetCursor(static_cast<Window::Cursor>(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);
 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) {
 }
 
 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);
                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());
 
        bool positionOnEdgeOfSelection =
            (position == SelectionStart()) || (position == SelectionEnd());
 
-       if ((!inDragDrop) || !(0 == positionWasInSelection) ||
+       if ((inDragDrop != ddDragging) || !(0 == positionWasInSelection) ||
                (positionOnEdgeOfSelection && !moving)) {
 
                int selStart = SelectionStart();
                (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;
                pdoc->BeginUndoAction();
 
                int positionAfterDeletion = position;
-               if (inDragDrop && moving) {
+               if ((inDragDrop == ddDragging) && moving) {
                        // Remove dragged out text
                        if (rectangular || selType == selLines) {
                                SelectionLineIterator lineIterator(this);
                        // 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);
                        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();
                }
                                SetSelection(position + istrlen(value), position);
                        }
                        pdoc->EndUndoAction();
                }
-       } else if (inDragDrop) {
+       } else if (inDragDrop == ddDragging) {
                SetEmptySelection(position);
        }
 }
                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),
 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_),
        } 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),
        } 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) {
 }
 
 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);
        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;
 
        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);
        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),
                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),
                        } else {        // Moved backward
                                SetSelection(pdoc->ExtendWordSelect(currentPos, -1),
-                                            pdoc->ExtendWordSelect(originalAnchorPos, 1));
+                                       pdoc->ExtendWordSelect(originalAnchorPos, 1));
                        }
                } else if (selectionType == selLine) {
                        lineAnchor = LineFromLocation(pt);
                        }
                } 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) {
                }
                //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);
                }
                        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),
                                // 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)
                        } 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) {
                                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);
                                SetDragPosition(invalidPosition);
-                               SetMouseCapture(true);
                                if (!shift) {
                                        SetEmptySelection(newPos);
                                }
                                if (!shift) {
                                        SetEmptySelection(newPos);
                                }
@@ -5248,6 +5321,20 @@ void Editor::ButtonMove(Point pt) {
        if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) {
                DwellEnd(true);
        }
        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()) {
        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
                autoScrollTimer.ticksToWait = autoScrollDelay;
 
                // Adjust selection
-               int movePos = PositionFromLocation(pt);
-               movePos = MovePositionOutsideChar(movePos, currentPos - movePos);
                if (posDrag >= 0) {
                        SetDragPosition(movePos);
                } else {
                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),
                                        // 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),
                                } else {        // Moved backward
                                        SetSelection(pdoc->ExtendWordSelect(movePos, -1),
-                                                    pdoc->ExtendWordSelect(originalAnchorPos, 1));
+                                               pdoc->ExtendWordSelect(originalAnchorPos, 1));
                                }
                        } else {
                                // Continue selecting by line
                                }
                        } else {
                                // Continue selecting by line
@@ -5336,7 +5421,13 @@ void Editor::ButtonMove(Point pt) {
 }
 
 void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
 }
 
 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);
        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);
                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) {
                        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();
                }
                if (selType == selStream) {
                        SetLastXChosen();
                }
-               inDragDrop = false;
+               inDragDrop = ddNone;
                EnsureCaretVisible(false);
        }
 }
                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())) {
        if ((dwellDelay < SC_TIME_FOREVER) &&
                (ticksToDwell > 0) &&
                (!HaveMouseCapture())) {
@@ -5456,7 +5552,11 @@ void Editor::SetFocusState(bool focusState) {
 }
 
 bool Editor::PaintContains(PRectangle rc) {
 }
 
 bool Editor::PaintContains(PRectangle rc) {
-       return rcPaint.Contains(rc);
+       if (rc.Empty()) {
+               return true;
+       } else {
+               return rcPaint.Contains(rc);
+       }
 }
 
 bool Editor::PaintContainsMargin() {
 }
 
 bool Editor::PaintContainsMargin() {
@@ -5626,7 +5726,7 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) {
                                SetVerticalScrollPos();
                                Redraw();
                        } else if ((lineDisplay > topLine + LinesOnScreen() - 1) ||
                                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();
                                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);
                length = istrlen(text);
        if (replacePatterns) {
                text = pdoc->SubstituteByPosition(text, &length);
-               if (!text)
+               if (!text) {
+                       pdoc->EndUndoAction();
                        return 0;
                        return 0;
+               }
        }
        if (targetStart != targetEnd)
                pdoc->DeleteChars(targetStart, targetEnd - targetStart);
        }
        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<char>(0xff));
+               pdoc->SetStyles(textLength, text);
+               delete []text;
+       }
+       SetEmptySelection(currentPos + textLength);
+}
+
 static bool ValidMargin(unsigned long wParam) {
        return wParam < ViewStyle::margins;
 }
 static bool ValidMargin(unsigned long wParam) {
        return wParam < ViewStyle::margins;
 }
@@ -5690,6 +5812,89 @@ static char *CharPtrFromSPtr(sptr_t lParam) {
        return reinterpret_cast<char *>(lParam);
 }
 
        return reinterpret_cast<char *>(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<Style::ecaseForced>(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<int>(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);
 
 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->BeginUndoAction();
                        pdoc->DeleteChars(0, pdoc->Length());
                        SetEmptySelection(0);
-                       pdoc->InsertString(0, CharPtrFromSPtr(lParam));
+                       pdoc->InsertCString(0, CharPtrFromSPtr(lParam));
                        pdoc->EndUndoAction();
                        return 1;
                }
                        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->BeginUndoAction();
                        ClearSelection();
                        char *replacement = CharPtrFromSPtr(lParam);
-                       pdoc->InsertString(currentPos, replacement);
+                       pdoc->InsertCString(currentPos, replacement);
                        pdoc->EndUndoAction();
                        SetEmptySelection(currentPos + istrlen(replacement));
                        EnsureCaretVisible();
                        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 searchFlags;
 
        case SCI_POSITIONBEFORE:
-               return pdoc->MovePositionOutsideChar(wParam-1, -1, true);
+               return pdoc->MovePositionOutsideChar(wParam - 1, -1, true);
 
        case SCI_POSITIONAFTER:
 
        case SCI_POSITIONAFTER:
-               return pdoc->MovePositionOutsideChar(wParam+1, 1, true);
+               return pdoc->MovePositionOutsideChar(wParam + 1, 1, true);
 
        case SCI_LINESCROLL:
                ScrollTo(topLine + lParam);
 
        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;
                }
 
                        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)
 
        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);
                                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);
                        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_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<unsigned int >(scrollWidth))) {
        case SCI_SETSCROLLWIDTH:
                PLATFORM_ASSERT(wParam > 0);
                if ((wParam > 0) && (wParam != static_cast<unsigned int >(scrollWidth))) {
+                       lineWidthMaxSeen = 0;
                        scrollWidth = wParam;
                        SetScrollBars();
                }
                        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_GETSCROLLWIDTH:
                return scrollWidth;
 
+       case SCI_SETSCROLLWIDTHTRACKING:
+               trackLineWidth = wParam != 0;
+               break;
+
+       case SCI_GETSCROLLWIDTHTRACKING:
+               return trackLineWidth;
+
        case SCI_LINESJOIN:
                LinesJoin();
                break;
        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:
                break;
 
        case SCI_TEXTWIDTH:
-               PLATFORM_ASSERT(wParam <= STYLE_MAX);
+               PLATFORM_ASSERT(wParam < vs.stylesSize);
                PLATFORM_ASSERT(lParam);
                return TextWidth(wParam, CharPtrFromSPtr(lParam));
 
                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:
                return verticalScrollBarVisible;
 
        case SCI_SETINDENTATIONGUIDES:
-               vs.viewIndentationGuides = wParam != 0;
+               vs.viewIndentationGuides = IndentView(wParam);
                Redraw();
                break;
 
                Redraw();
                break;
 
@@ -6659,91 +6876,42 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                break;
 
        case SCI_STYLESETFORE:
                break;
 
        case SCI_STYLESETFORE:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].fore.desired = ColourDesired(lParam);
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETBACK:
        case SCI_STYLESETBACK:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].back.desired = ColourDesired(lParam);
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETBOLD:
        case SCI_STYLESETBOLD:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].bold = lParam != 0;
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETITALIC:
        case SCI_STYLESETITALIC:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].italic = lParam != 0;
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETEOLFILLED:
        case SCI_STYLESETEOLFILLED:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].eolFilled = lParam != 0;
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETSIZE:
        case SCI_STYLESETSIZE:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].size = lParam;
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETFONT:
        case SCI_STYLESETFONT:
-               if (lParam == 0)
-                       return 0;
-               if (wParam <= STYLE_MAX) {
-                       vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam));
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETUNDERLINE:
        case SCI_STYLESETUNDERLINE:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].underline = lParam != 0;
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETCASE:
        case SCI_STYLESETCASE:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].caseForce = static_cast<Style::ecaseForced>(lParam);
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETCHARACTERSET:
        case SCI_STYLESETCHARACTERSET:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].characterSet = lParam;
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETVISIBLE:
        case SCI_STYLESETVISIBLE:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].visible = lParam != 0;
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETCHANGEABLE:
        case SCI_STYLESETCHANGEABLE:
-               if (wParam <= STYLE_MAX) {
-                       vs.styles[wParam].changeable = lParam != 0;
-                       InvalidateStyleRedraw();
-               }
-               break;
        case SCI_STYLESETHOTSPOT:
        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:
 
        case SCI_STYLERESETDEFAULT:
                vs.ResetDefaultStyle();
                InvalidateStyleRedraw();
                break;
        case SCI_SETSTYLEBITS:
+               vs.EnsureStyle((1 << wParam) - 1);
                pdoc->SetStylingBits(wParam);
                break;
 
                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_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);
        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_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;
        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),
 
        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),
                break;
 
        case SCI_CLEARCMDKEY:
                kmap.AssignCmdKey(Platform::LowShortFromLong(wParam),
-                                 Platform::HighShortFromLong(wParam), SCI_NULL);
+                       Platform::HighShortFromLong(wParam), SCI_NULL);
                break;
 
        case SCI_CLEARALLCMDKEYS:
                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_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:
        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_ZOOMOUT:
        case SCI_DELWORDLEFT:
        case SCI_DELWORDRIGHT:
+       case SCI_DELWORDRIGHTEND:
        case SCI_DELLINELEFT:
        case SCI_DELLINERIGHT:
        case SCI_LINECOPY:
        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;
 
                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_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_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_SETHOTSPOTSINGLELINE:
                vs.hotspotSingleLine = wParam != 0;
                InvalidateStyleRedraw();
                break;
 
+       case SCI_GETHOTSPOTSINGLELINE:
+               return vs.hotspotSingleLine ? 1 : 0;
+
        case SCI_SETPASTECONVERTENDINGS:
                convertPastes = wParam != 0;
                break;
        case SCI_SETPASTECONVERTENDINGS:
                convertPastes = wParam != 0;
                break;
index fe7be268ae43ad8c169c117f0e2e7a9d306d6990..049cc373f5b24ccb380e8df32bb75addc8200d57 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef EDITOR_H
 #define EDITOR_H
 
 #ifndef EDITOR_H
 #define EDITOR_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class Caret {
 /**
  */
 class Caret {
@@ -41,92 +45,6 @@ public:
        Idler();
 };
 
        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.
 /**
  * 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;
        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;
        bool verticalScrollBarVisible;
        bool endAtLastLine;
        bool caretSticky;
@@ -229,6 +149,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        Surface *pixmapIndentGuideHighlight;
 
        LineLayoutCache llc;
        Surface *pixmapIndentGuideHighlight;
 
        LineLayoutCache llc;
+       PositionCache posCache;
 
        KeyMap kmap;
 
 
        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 dwelling;
        enum { selChar, selWord, selLine } selectionType;
        Point ptMouseLast;
-       bool inDragDrop;
+       enum { ddNone, ddInitial, ddDragging } inDragDrop;
        bool dropWentOutside;
        int posDrag;
        int posDrop;
        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);
        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);
        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);
                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 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);
        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();
        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;
        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();
        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 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);
        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);
        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.
        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);
        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;
 
        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.
 
 public:
        // Public so the COM thunks can access it.
@@ -579,4 +509,8 @@ public:
        }
 };
 
        }
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index acf45bc2d53ae23b7a23c7364e78d8a5bd92319a..0344debd78eb506f6b79e7362376d50fd23bd862 100644 (file)
 #include "KeyWords.h"
 #include "ExternalLexer.h"
 
 #include "KeyWords.h"
 #include "ExternalLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 LexerManager *LexerManager::theInstance = NULL;
 
 //------------------------------------------
 LexerManager *LexerManager::theInstance = NULL;
 
 //------------------------------------------
index 1a595ff513d4c2f8ceaf3efa9dcb39246b7d3885..55e127b40ac0575a69655cd80fa04cf1f6ac7e3a 100644 (file)
 #if PLAT_WIN
 #define EXT_LEXER_DECL __stdcall
 #else
 #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...
 #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;
                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,
        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();
 };
 
        ~LMMinder();
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index 7624a4a5255ed53e2284b703d3be5a1ca8f0e8cb..139e2b0eab9ed3e9c5050a5aa8babd8117a21325 100644 (file)
 #include "Scintilla.h"
 #include "Indicator.h"
 
 #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;
 void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
        surface->PenColour(fore.allocated);
        int ymid = (rc.bottom + rc.top) / 2;
index 716db1051fe7abd142a5f2d30967eb7b704622e0..2081db544e9b7db8a7b11f46d3d07b4201cae32d 100644 (file)
@@ -8,15 +8,24 @@
 #ifndef INDICATOR_H
 #define INDICATOR_H
 
 #ifndef INDICATOR_H
 #define INDICATOR_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class Indicator {
 public:
        int style;
 /**
  */
 class Indicator {
 public:
        int style;
+       bool under;
        ColourPair fore;
        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);
 };
 
        }
        void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine);
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index bfa6e2d7899294cbec83e45ed1f8963bcd1427d5..c223d5b59ae58746ebd7d2f71d94f43c2dd77f0e 100644 (file)
 
 #include "KeyMap.h"
 
 
 #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,
 KeyMap::KeyMap() : kmap(0), len(0), alloc(0) {
        for (int i = 0; MapDefault[i].key; i++) {
                AssignCmdKey(MapDefault[i].key,
index 364df684f61da1a9f6b3d2f9fb9314bf5d9089b5..fd9005de84854963453484f67425a2ee0b5f1228 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef KEYTOCOMMAND_H
 #define KEYTOCOMMAND_H
 
 #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
 #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
 };
 
        unsigned int Find(int key, int modifiers);      // 0 returned on failure
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index f82eb7df6775fc05ef4eae5578636fee0fca480d..29538d57b5aa7dbcfbb20648bc64e39cda7a9d78 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 const LexerModule *LexerModule::base = 0;
 int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
 
 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\)
 
 //++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(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);
        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(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(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);
        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(lmForth);
        LINK_LEXER(lmFortran);
        LINK_LEXER(lmFreeBasic);
+       LINK_LEXER(lmGAP);
        LINK_LEXER(lmGui4Cli);
        LINK_LEXER(lmHaskell);
        LINK_LEXER(lmHTML);
        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(lmPerl);
        LINK_LEXER(lmPHP);
        LINK_LEXER(lmPHPSCRIPT);
+       LINK_LEXER(lmPLM);
        LINK_LEXER(lmPOV);
        LINK_LEXER(lmPOV);
+       LINK_LEXER(lmProgress);
        LINK_LEXER(lmProps);
        LINK_LEXER(lmPS);
        LINK_LEXER(lmPureBasic);
        LINK_LEXER(lmPython);
        LINK_LEXER(lmProps);
        LINK_LEXER(lmPS);
        LINK_LEXER(lmPureBasic);
        LINK_LEXER(lmPython);
+       LINK_LEXER(lmR);
        LINK_LEXER(lmREBOL);
        LINK_LEXER(lmRuby);
        LINK_LEXER(lmScriptol);
        LINK_LEXER(lmREBOL);
        LINK_LEXER(lmRuby);
        LINK_LEXER(lmScriptol);
index 1cf263e5018a9eef4ba08258943ca595834583df..7bf597b42ca1d96e20d9062184923b858fec22db 100644 (file)
@@ -21,6 +21,9 @@
 #include "Scintilla.h"
 #include "SciLexer.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 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();
 }
 
        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<char>(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<char>(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",
 static const char * const apdlWordListDesc[] = {
     "processors",
     "commands",
@@ -133,4 +253,4 @@ static const char * const apdlWordListDesc[] = {
     0
 };
 
     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 (file)
index 0000000..5bf979f
--- /dev/null
@@ -0,0 +1,270 @@
+// Scintilla source code edit control
+//Author: instanton (email: soft_share<at>126<dot>com)
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#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<char>(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<eol_pos){
+               char ch = styler[startpos];
+               ParseASYWord(startpos,styler,buffer);
+               bool drawcommands = strncmp(buffer,"draw",4)==0||
+                       strncmp(buffer,"pair",4)==0||strncmp(buffer,"label",5)==0;
+               if (!drawcommands && ch!=' ') return false;
+               else if (drawcommands) return true;
+               startpos++;
+       }               
+       return false;
+}
+
+static void FoldAsyDoc(unsigned int startPos, int length, int initStyle, 
+                                          WordList *[], Accessor &styler) {
+       bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+       bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+       bool foldAtElse = 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 && 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);
index 2bc2e0f4bc1f4768d6ec9818d353df3fe63b7a20..cedf261f5c9417fd8e11c8640198ddc70afcca48 100644 (file)
@@ -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)
 // 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 <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 //
 // Copyright for Scintilla: 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static inline bool IsTypeCharacter(const int ch)
 {
     return ch == '$';
 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;
                                //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 == ';') {
                                }
                                //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))) {
                                        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
                                }
                                        else
                                                ci=2;  // line doesn't begin with #CE so skip the rest of the line
                                }
-                break;
+                               break;
                        }
             case SCE_AU3_COMMENT:
             {
                        }
             case SCE_AU3_COMMENT:
             {
@@ -304,6 +316,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
                                                {
                                                        sc.ChangeState(SCE_AU3_COMMENTBLOCK);
                                                        sc.SetState(SCE_AU3_COMMENTBLOCK);
                                                {
                                                        sc.ChangeState(SCE_AU3_COMMENTBLOCK);
                                                        sc.SetState(SCE_AU3_COMMENTBLOCK);
+                                                       break;
                                                }
                                                else if (keywords.InList(s)) {
                                                        sc.ChangeState(SCE_AU3_KEYWORD);
                                                }
                                                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;
                                {
                                        sc.ForwardSetState(SCE_AU3_DEFAULT);
                                        si=0;
+                                       break;
                                }
                 if (sc.atLineEnd)
                                {
                                }
                 if (sc.atLineEnd)
                                {
@@ -433,6 +447,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
                                        if (!IsContinuationLine(lineCurrent,styler)) 
                                        {
                                                sc.SetState(SCE_AU3_DEFAULT);
                                        if (!IsContinuationLine(lineCurrent,styler)) 
                                        {
                                                sc.SetState(SCE_AU3_DEFAULT);
+                                               break;
                                        }
                                }
                                // find Sendkeys in a STRING
                                        }
                                }
                                // 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;
        // 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;
        int      szKeywordlen = 0;
        char szThen[5]="";
        int      szThenlen = 0;
index e30ee7dc9e9c05b8b8ba1b6116862179a6d4c27f..2b7029b1ac700c715f0ed954fe7898c4bb530a6c 100644 (file)
@@ -22,6 +22,9 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
 
 
 static inline bool IsAWordChar(const int ch) {
 
 
 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 (file)
index 0000000..194b84c
--- /dev/null
@@ -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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#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<char>(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<char>(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<char>(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<char>(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);
index 0227ce11088b7aa9ba73033e36a74f931bfcc306..f6c9e7ee7a853ce08b70b6f2489dcbd3d55b9234 100644 (file)
 #include "SciLexer.h"
 #include "SString.h"
 
 #include "SciLexer.h"
 #include "SString.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 /*
  * Interface
  */
 /*
  * Interface
  */
index 93e0b3718020f95e0030a833f4f4f91b0f8ade38..9dd4df45653256418f273c405b4f41a5ebde4737 100644 (file)
@@ -23,6 +23,9 @@
 #include "Scintilla.h"
 #include "SciLexer.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 IsAWordChar(const int ch) {
        return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
index 1600e6329d461bf3cf8253fa329f2785332b5f56..36f1d5dc2e67018e0d72e612b8d95fd9c87983ed 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 // Some char test functions
 static bool isAsn1Number(int ch)
 {
 // Some char test functions
 static bool isAsn1Number(int ch)
 {
index 3a36eb8f27652a000e7b11c2631980c724e8e531..a6847db71a494eb2ac9f05e7c34658e0eb878073 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.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 == '_' || ch == '$' || ch == ':');
 }
 static inline bool IsAWordChar(const int  ch) {
        return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '$' || ch == ':');
 }
index e9c31d6b38fad7f73ec121ac1bf8c2cee4eff234..f0376b9474b010b093a0cb637da72b2f2e208898 100644 (file)
@@ -2,7 +2,7 @@
 /** @file LexBash.cxx
  ** Lexer for Bash.
  **/
 /** @file LexBash.cxx
  ** Lexer for Bash.
  **/
-// Copyright 2004-2005 by Neil Hodgson <neilh@scintilla.org>
+// Copyright 2004-2007 by Neil Hodgson <neilh@scintilla.org>
 // Adapted from LexPerl by Kein-Hong Man <mkh@pl.jaring.my> 2004
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Adapted from LexPerl by Kein-Hong Man <mkh@pl.jaring.my> 2004
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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
 #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
 #define BASH_BASE_OCTAL                68
 #define BASH_BASE_OCTAL_ERROR  69
+#endif
 
 #define HERE_DELIM_MAX 256
 
 
 #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';
 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)) {
                                                ch = chNext;
                                                chNext = chNext2;
                                        } else if (isdigit(chNext)) {
+#ifdef PEDANTIC_OCTAL
                                                numBase = BASH_BASE_OCTAL;
                                                numBase = BASH_BASE_OCTAL;
+#else
+                                               numBase = BASH_BASE_HEX;
+#endif
                                        }
                                }
                        } else if (iswordstart(ch)) {
                                        }
                                }
                        } 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)
                                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++;
                                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;
                                        // 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) {
                        } 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;
                                }
                                        } else
                                                goto numAtEnd;
                                }
+#endif
                        } else if (numBase == BASH_BASE_ERROR) {
                                if (digit > 9)
                                        goto numAtEnd;
                        } 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:
                                        }
                                } 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;
                                                state = SCE_SH_ERROR;
                                        styler.ColourTo(i - 1, state);
                                        state = SCE_SH_DEFAULT;
index 79ba2b89116bc5199f7ed385d524204f6b6d31c4..1c5d7b42598d93ce3caf4035b3fdbb804e2f1b2d 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 /* Bits:
  * 1  - whitespace
  * 2  - operator
 /* Bits:
  * 1  - whitespace
  * 2  - operator
index 902f89c1e481b34037dec8d71cac87aeb559e046..cc60cd2fc67be2f9be4313701e86baa6c6650fd1 100644 (file)
@@ -15,6 +15,9 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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];
 
 static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
        char s[100];
index e28e4b13b48a259978240410066f416850a25a47..624ef0f2ba852e6dbb8ccb4acc0fee8cd6cc9531 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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) {
 
 // Is an end of line character
 inline bool IsEOL(const int ch) {
 
index bf089d6cff1110712df160df04203c4be8c9cdf7..bf351280fe17cdee46e2cfd1c35ec6c67677cd68 100644 (file)
 #include "KeyWords.h"
 #include "Scintilla.h"
 #include "SciLexer.h"
 #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) ||
 
 static bool IsSpaceEquiv(int state) {
        return (state <= SCE_C_COMMENTDOC) ||
@@ -49,6 +32,24 @@ static bool IsSpaceEquiv(int state) {
                (state == SCE_C_COMMENTDOCKEYWORDERROR);
 }
 
                (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) {
 
 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;
 
 
        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;
        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) {
 
                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);
                        }
                                // 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
                                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:
                                        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));
                                        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);
                                        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));
                                        }
                                        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);
                                                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 {
                                        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;
                                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);
                                        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);
                                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 {".
 // 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;
        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)) {
                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++;
                                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--;
                        }
                                // 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;
                }
                        levelMinCurrent = levelCurrent;
                        visibleChars = 0;
                }
-               if (!isspacechar(ch))
+               if (!IsASpace(ch))
                        visibleChars++;
        }
 }
 
                        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",
 static const char * const cppWordLists[] = {
             "Primary keywords and identifiers",
             "Secondary keywords and identifiers",
index 963a7b3ef77f10ac8a5e29075b7d7ec3151afab9..f5c112d6f1501815d02559fe5af177951e000e92 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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
 
 static inline bool IsAWordChar(const unsigned int ch) {
        return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character
index 5f4fad5fb867ddc63e8f3e477263f9b1dce7e922..539eee0de7b5310ae8cea5b38589f6e827c6c361 100644 (file)
@@ -42,6 +42,10 @@ static const int baseT[24] = {
        0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,16      /* M - X */
 };
 
        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!)
 #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 (file)
index 0000000..f63eb39
--- /dev/null
@@ -0,0 +1,456 @@
+// Scintilla source code edit control
+/** @file LexCmake.cxx
+ ** Lexer for Cmake
+ **/
+// Copyright 2007 by Cristian Adam <cristian [dot] adam [at] gmx [dot] net>
+// based on the NSIS lexer
+// The License.txt file describes the conditions under which this software may be distributed.
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#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<char>( 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<char>( styler[ start + i ] );
+        lowercaseWord[i] = static_cast<char>(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);
index c33cdb5ce68edcf8ebc85dd7f7307edceac73508..969275f925190812416d9c8d1e802c91805c7aa6 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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;
 static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
 {
        int state = SCE_CONF_DEFAULT;
index d139bb4f144778f532d7b2c89389191954c80c3d..62044c3709831510c23925cef552026bf9d60534 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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)
 {
 static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordList
 *keywordLists[], Accessor &styler)
 {
index 27f7b990a2595aade43c0c3475d3eed70fb2862b..4162c9b3aa8a95761948f829038dbd2901a254e7 100644 (file)
@@ -20,6 +20,9 @@
 #include "Scintilla.h"
 #include "SciLexer.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 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 (file)
index 0000000..95be129
--- /dev/null
@@ -0,0 +1,358 @@
+/** @file LexD.cxx
+ ** Lexer for D.
+ **
+ ** Copyright (c) 2006 by Waldemar Augustyn <waldemar@wdmsys.com>
+ **/
+// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#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<char>(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);
index 49411588aa50b8eb423d2148cd3e854456a67f10..295aaec531b117479bbaca91d52f0342f496fbc1 100644 (file)
@@ -19,6 +19,9 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
 
 
 static inline bool IsAWordChar(const int ch) {
 
 
 static inline bool IsAWordChar(const int ch) {
index 4aed7c6af1aaa768e0c76fb727fbbf66e02cb02e..03dea5e73d36b754a9d25414a7684b55c6fcd006 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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 == '+' ||
 static inline bool isEiffelOperator(unsigned int ch) {
        // '.' left out as it is used to make up numbers
        return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' ||
index d801f741664ea0977bf09ff264aabed386816510..d56f78528715f6f184ab0e7de5754623b2463307 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 /*
    TODO:
    o  _Param should be a new lexical type
 /*
    TODO:
    o  _Param should be a new lexical type
index db0314eb96b174238263ace66926b7ed9b59423b..baf2941a847ec91510c0114b7668dd8acd81eef9 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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]=='\'';
 }
 static bool IsFlagShipComment(Accessor &styler, int pos, int len) {
        return len>0 && styler[pos]=='\'';
 }
index 3f128156d6b781740f011cf97d9913b87e4efa7a..f097b0e00a1e2b9febac6cc8341e9b1a40d35537 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #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 == ' ';
 }
 bool is_whitespace(int ch){
     return ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ';
 }
index 3ab1116ea6ed2a889830452e32615f27cfc5f9f7..c68c5b62fa955f43ab76100554bd2e2a781b0712 100644 (file)
 #include "KeyWords.h"
 #include "Scintilla.h"
 #include "SciLexer.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 == '_' || ch == '%');
 /***********************************************/
 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 (file)
index 0000000..25bd33b
--- /dev/null
@@ -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 <at> gmail <dot> com )
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#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<char>(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<char>(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<char>(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);
index f76fff6cc4b86e5d665a1b12445d065e27723612..1c92de72e7fc7e02c8f9e9ec8e30959c903141d0 100644 (file)
@@ -36,6 +36,10 @@ val SCE_GC_OPERATOR=9
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 #define debug Platform::DebugPrintf
 
 static inline bool IsAWordChar(const int ch) {
 #define debug Platform::DebugPrintf
 
 static inline bool IsAWordChar(const int ch) {
index dad8fce46fcb99ce5502185e324c3a0a05dee32b..9b8d5dc92339065959e78d6b0caf076e136b72de 100644 (file)
 #include "KeyWords.h"
 #include "Scintilla.h"
 #include "SciLexer.h"
 #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)
 
 #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 == '_');
 }
 
        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;
 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;
                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<xml; t++) {
+                       if (!IsASpace(*t)) {
+                               return prevValue;
+                       }
+               }
                return eScriptXML;
                return eScriptXML;
+       }
 
        return prevValue;
 }
 
        return prevValue;
 }
@@ -102,16 +128,16 @@ static script_type ScriptOfState(int state) {
 }
 
 static int statePrintForState(int state, script_mode inScriptType) {
 }
 
 static int statePrintForState(int state, script_mode inScriptType) {
-       int StateToPrint;
-
-       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);
-       } 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;
        }
 
        return StateToPrint;
@@ -173,6 +199,7 @@ static inline bool stateAllowsTermination(int state) {
        bool allowTermination = !isStringState(state);
        if (allowTermination) {
                switch (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:
                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,
 
 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;
        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';
 
        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
        //...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';
 
        //now we can remove the trailing space
        s[i] = '\0';
@@ -390,21 +418,21 @@ static int StateForScript(script_type scriptLanguage) {
        return Result;
 }
 
        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 == '#');
 }
 
        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 == '[');
 }
 
        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);
 }
 
        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);
 }
 
        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;
 }
 
                   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';
 }
 
        return ch == '\r' || ch == '\n';
 }
 
-static bool isOKBeforeRE(char ch) {
+static bool isOKBeforeRE(int ch) {
        return (ch == '(') || (ch == '=') || (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[],
 }
 
 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];
        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
 
        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<char>(STYLE_MAX));
        char prevWord[200];
        prevWord[0] = '\0';
        char phpStringDelimiter[200]; // PHP is not limited in length, we are
        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);
        }
                length++;
                state = styler.StyleAt(startPos);
        }
-       styler.StartAt(startPos, STYLE_MAX);
+       styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
 
        int lineCurrent = styler.GetLine(startPos);
        int lineState;
 
        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 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;
 
        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;
        // 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) {
                                break;
                }
                if (style == SCE_HJ_SYMBOLS) {
-                       chPrevNonWhite = styler.SafeGetCharAt(back);
+                       chPrevNonWhite = static_cast<unsigned char>(styler.SafeGetCharAt(back));
                }
        }
 
        styler.StartSegment(startPos);
        const int lengthDoc = startPos + length;
        for (int i = startPos; i < lengthDoc; i++) {
                }
        }
 
        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;
                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;
                        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<unsigned char>(styler[i]);
+               int chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
+               const int chNext2 = static_cast<unsigned char>(styler.SafeGetCharAt(i + 2));
 
                // Handle DBCS codepages
 
                // Handle DBCS codepages
-               if (styler.IsLeadByte(ch)) {
+               if (styler.IsLeadByte(static_cast<char>(ch))) {
                        chPrev = ' ';
                        i += 1;
                        continue;
                }
 
                        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)
                        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_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_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
                        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 <script> tag
                                        char tag[7]; // room for the <script> tag
-                                       char chr;       // current char
-                                       int j=0;
-                                       chr = styler.SafeGetCharAt(i+2);
-                                       while (j < 6 && !isspacechar(chr)) {
+                                       int j = 0;
+                                       char chr = styler.SafeGetCharAt(i+2);
+                                       while (j < 6 && !IsASpace(chr)) {
                                                tag[j++] = static_cast<char>(MakeLowerCase(chr));
                                                chr = styler.SafeGetCharAt(i+2+j);
                                        }
                                                tag[j++] = static_cast<char>(MakeLowerCase(chr));
                                                chr = styler.SafeGetCharAt(i+2+j);
                                        }
@@ -708,7 +742,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                levelCurrent++;
                        }
                        // should be better
                                levelCurrent++;
                        }
                        // should be better
-                       ch = styler.SafeGetCharAt(i);
+                       ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
                        continue;
                }
 
                        continue;
                }
 
@@ -747,7 +781,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        if (foldHTMLPreprocessor)
                                levelCurrent++;
                        // should be better
                        if (foldHTMLPreprocessor)
                                levelCurrent++;
                        // should be better
-                       ch = styler.SafeGetCharAt(i);
+                       ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
                        continue;
                }
 
                        continue;
                }
 
@@ -862,7 +896,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_H_SGML_SIMPLESTRING;
                        } else if ((ch == '-') && (chPrev == '-')) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_H_SGML_SIMPLESTRING;
                        } else if ((ch == '-') && (chPrev == '-')) {
-                               styler.ColourTo(i - 2, StateToPrint);
+                               if (static_cast<int>(styler.GetStartSegment()) <= (i - 2)) {
+                                       styler.ColourTo(i - 2, StateToPrint);
+                               }
                                state = SCE_H_SGML_COMMENT;
                        } else if (isascii(ch) && isalpha(ch) && (chPrev == '%')) {
                                styler.ColourTo(i - 2, StateToPrint);
                                state = SCE_H_SGML_COMMENT;
                        } else if (isascii(ch) && isalpha(ch) && (chPrev == '%')) {
                                styler.ColourTo(i - 2, StateToPrint);
@@ -924,12 +960,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                }
                                // find the length of the word
                                int size = 1;
                                }
                                // find the length of the word
                                int size = 1;
-                               while (ishtmlwordchar(styler.SafeGetCharAt(i + size)))
+                               while (setHTMLWord.Contains(static_cast<unsigned char>(styler.SafeGetCharAt(i + size))))
                                        size++;
                                styler.ColourTo(i + size - 1, StateToPrint);
                                i += size - 1;
                                visibleChars += size - 1;
                                        size++;
                                styler.ColourTo(i + size - 1, StateToPrint);
                                i += size - 1;
                                visibleChars += size - 1;
-                               ch = styler.SafeGetCharAt(i);
+                               ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
                                if (scriptLanguage == eScriptSGMLblock) {
                                        state = SCE_H_SGML_BLOCK_DEFAULT;
                                } else {
                                if (scriptLanguage == eScriptSGMLblock) {
                                        state = SCE_H_SGML_BLOCK_DEFAULT;
                                } else {
@@ -1012,9 +1048,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                        break;
                case SCE_H_TAGUNKNOWN:
                        }
                        break;
                case SCE_H_TAGUNKNOWN:
-                       if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
+                       if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) {
                                int eClass = classifyTagHTML(styler.GetStartSegment(),
                                int eClass = classifyTagHTML(styler.GetStartSegment(),
-                                       i - 1, keywords, styler, tagDontFold, caseSensitive);
+                                       i - 1, keywords, styler, tagDontFold, caseSensitive, isXml);
                                if (eClass == SCE_H_SCRIPT) {
                                        if (!tagClosing) {
                                                inScriptType = eNonHtmlScript;
                                if (eClass == SCE_H_SCRIPT) {
                                        if (!tagClosing) {
                                                inScriptType = eNonHtmlScript;
@@ -1064,7 +1100,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                        break;
                case SCE_H_ATTRIBUTE:
                        }
                        break;
                case SCE_H_ATTRIBUTE:
-                       if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
+                       if (!setAttributeContinue.Contains(ch)) {
                                if (inScriptType == eNonHtmlScript) {
                                        int scriptLanguagePrev = scriptLanguage;
                                        clientScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
                                if (inScriptType == eNonHtmlScript) {
                                        int scriptLanguagePrev = scriptLanguage;
                                        clientScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
@@ -1137,7 +1173,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                i++;
                                ch = chNext;
                                state = SCE_H_DEFAULT;
                                i++;
                                ch = chNext;
                                state = SCE_H_DEFAULT;
-                       } else if (ishtmlwordchar(ch)) {
+                       } else if (setHTMLWord.Contains(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_H_ATTRIBUTE;
                        }
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_H_ATTRIBUTE;
                        }
@@ -1161,7 +1197,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                        break;
                case SCE_H_VALUE:
                        }
                        break;
                case SCE_H_VALUE:
-                       if (!ishtmlwordchar(ch)) {
+                       if (!setHTMLWord.Contains(ch)) {
                                if (ch == '\"' && chPrev == '=') {
                                        // Should really test for being first character
                                        state = SCE_H_DOUBLESTRING;
                                if (ch == '\"' && chPrev == '=') {
                                        // Should really test for being first character
                                        state = SCE_H_DOUBLESTRING;
@@ -1198,7 +1234,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                case SCE_HJ_DEFAULT:
                case SCE_HJ_START:
                case SCE_HJ_SYMBOLS:
                case SCE_HJ_DEFAULT:
                case SCE_HJ_START:
                case SCE_HJ_SYMBOLS:
-                       if (iswordstart(ch)) {
+                       if (IsAWordStart(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_WORD;
                        } else if (ch == '/' && chNext == '*') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_WORD;
                        } else if (ch == '/' && chNext == '*') {
@@ -1227,7 +1263,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_COMMENTLINE;
                                i += 2;
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_COMMENTLINE;
                                i += 2;
-                       } else if (isoperator(ch)) {
+                       } else if (IsOperator(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
                                styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
                                state = SCE_HJ_DEFAULT;
                                styler.ColourTo(i - 1, StateToPrint);
                                styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
                                state = SCE_HJ_DEFAULT;
@@ -1239,7 +1275,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                        break;
                case SCE_HJ_WORD:
                        }
                        break;
                case SCE_HJ_WORD:
-                       if (!iswordchar(ch)) {
+                       if (!IsAWordChar(ch)) {
                                classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler, inScriptType);
                                //styler.ColourTo(i - 1, eHTJSKeyword);
                                state = SCE_HJ_DEFAULT;
                                classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler, inScriptType);
                                //styler.ColourTo(i - 1, eHTJSKeyword);
                                state = SCE_HJ_DEFAULT;
@@ -1258,7 +1294,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        styler.ColourTo(i - 1, StateToPrint);
                                        state = SCE_HJ_COMMENTLINE;
                                        i += 2;
                                        styler.ColourTo(i - 1, StateToPrint);
                                        state = SCE_HJ_COMMENTLINE;
                                        i += 2;
-                               } else if (isoperator(ch)) {
+                               } else if (IsOperator(ch)) {
                                        styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
                                        state = SCE_HJ_DEFAULT;
                                }
                                        styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
                                        state = SCE_HJ_DEFAULT;
                                }
@@ -1328,7 +1364,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        while (isascii(chNext) && islower(chNext)) {   // gobble regex flags
                                                i++;
                                                ch = chNext;
                                        while (isascii(chNext) && islower(chNext)) {   // gobble regex flags
                                                i++;
                                                ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
+                                               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
                                        }
                                }
                                styler.ColourTo(i, StateToPrint);
                                        }
                                }
                                styler.ColourTo(i, StateToPrint);
@@ -1338,13 +1374,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                if (chNext == '\\' || chNext == '/') {
                                        i++;
                                        ch = chNext;
                                if (chNext == '\\' || chNext == '/') {
                                        i++;
                                        ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
+                                       chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
                                }
                        }
                        break;
                case SCE_HB_DEFAULT:
                case SCE_HB_START:
                                }
                        }
                        break;
                case SCE_HB_DEFAULT:
                case SCE_HB_START:
-                       if (iswordstart(ch)) {
+                       if (IsAWordStart(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HB_WORD;
                        } else if (ch == '\'') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HB_WORD;
                        } else if (ch == '\'') {
@@ -1357,7 +1393,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                   styler.SafeGetCharAt(i + 3) == '-') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HB_COMMENTLINE;
                                   styler.SafeGetCharAt(i + 3) == '-') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HB_COMMENTLINE;
-                       } else if (isoperator(ch)) {
+                       } else if (IsOperator(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
                                styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
                                state = SCE_HB_DEFAULT;
                                styler.ColourTo(i - 1, StateToPrint);
                                styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
                                state = SCE_HB_DEFAULT;
@@ -1369,14 +1405,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                        break;
                case SCE_HB_WORD:
                        }
                        break;
                case SCE_HB_WORD:
-                       if (!iswordchar(ch)) {
+                       if (!IsAWordChar(ch)) {
                                state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType);
                                if (state == SCE_HB_DEFAULT) {
                                        if (ch == '\"') {
                                                state = SCE_HB_STRING;
                                        } else if (ch == '\'') {
                                                state = SCE_HB_COMMENTLINE;
                                state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType);
                                if (state == SCE_HB_DEFAULT) {
                                        if (ch == '\"') {
                                                state = SCE_HB_STRING;
                                        } else if (ch == '\'') {
                                                state = SCE_HB_COMMENTLINE;
-                                       } else if (isoperator(ch)) {
+                                       } else if (IsOperator(ch)) {
                                                styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
                                                state = SCE_HB_DEFAULT;
                                        }
                                                styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
                                                state = SCE_HB_DEFAULT;
                                        }
@@ -1409,7 +1445,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        break;
                case SCE_HP_DEFAULT:
                case SCE_HP_START:
                        break;
                case SCE_HP_DEFAULT:
                case SCE_HP_START:
-                       if (iswordstart(ch)) {
+                       if (IsAWordStart(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HP_WORD;
                        } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') &&
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HP_WORD;
                        } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') &&
@@ -1426,7 +1462,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        state = SCE_HP_TRIPLEDOUBLE;
                                        ch = ' ';
                                        chPrev = ' ';
                                        state = SCE_HP_TRIPLEDOUBLE;
                                        ch = ' ';
                                        chPrev = ' ';
-                                       chNext = styler.SafeGetCharAt(i + 1);
+                                       chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
                                } else {
                                        //                                      state = statePrintForState(SCE_HP_STRING,inScriptType);
                                        state = SCE_HP_STRING;
                                } else {
                                        //                                      state = statePrintForState(SCE_HP_STRING,inScriptType);
                                        state = SCE_HP_STRING;
@@ -1438,11 +1474,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        state = SCE_HP_TRIPLE;
                                        ch = ' ';
                                        chPrev = ' ';
                                        state = SCE_HP_TRIPLE;
                                        ch = ' ';
                                        chPrev = ' ';
-                                       chNext = styler.SafeGetCharAt(i + 1);
+                                       chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
                                } else {
                                        state = SCE_HP_CHARACTER;
                                }
                                } else {
                                        state = SCE_HP_CHARACTER;
                                }
-                       } else if (isoperator(ch)) {
+                       } else if (IsOperator(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
                                styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType));
                        } else if ((ch == ' ') || (ch == '\t')) {
                                styler.ColourTo(i - 1, StateToPrint);
                                styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType));
                        } else if ((ch == ' ') || (ch == '\t')) {
@@ -1453,7 +1489,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                        break;
                case SCE_HP_WORD:
                        }
                        break;
                case SCE_HP_WORD:
-                       if (!iswordchar(ch)) {
+                       if (!IsAWordChar(ch)) {
                                classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
                                state = SCE_HP_DEFAULT;
                                if (ch == '#') {
                                classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
                                state = SCE_HP_DEFAULT;
                                if (ch == '#') {
@@ -1464,7 +1500,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                                state = SCE_HP_TRIPLEDOUBLE;
                                                ch = ' ';
                                                chPrev = ' ';
                                                state = SCE_HP_TRIPLEDOUBLE;
                                                ch = ' ';
                                                chPrev = ' ';
-                                               chNext = styler.SafeGetCharAt(i + 1);
+                                               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
                                        } else {
                                                state = SCE_HP_STRING;
                                        }
                                        } else {
                                                state = SCE_HP_STRING;
                                        }
@@ -1474,11 +1510,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                                state = SCE_HP_TRIPLE;
                                                ch = ' ';
                                                chPrev = ' ';
                                                state = SCE_HP_TRIPLE;
                                                ch = ' ';
                                                chPrev = ' ';
-                                               chNext = styler.SafeGetCharAt(i + 1);
+                                               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
                                        } else {
                                                state = SCE_HP_CHARACTER;
                                        }
                                        } else {
                                                state = SCE_HP_CHARACTER;
                                        }
-                               } else if (isoperator(ch)) {
+                               } else if (IsOperator(ch)) {
                                        styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType));
                                }
                        }
                                        styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType));
                                }
                        }
@@ -1494,7 +1530,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
                                        i++;
                                        ch = chNext;
                                if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
                                        i++;
                                        ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
+                                       chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
                                }
                        } else if (ch == '\"') {
                                styler.ColourTo(i, StateToPrint);
                                }
                        } else if (ch == '\"') {
                                styler.ColourTo(i, StateToPrint);
@@ -1506,7 +1542,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
                                        i++;
                                        ch = chNext;
                                if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
                                        i++;
                                        ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
+                                       chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
                                }
                        } else if (ch == '\'') {
                                styler.ColourTo(i, StateToPrint);
                                }
                        } else if (ch == '\'') {
                                styler.ColourTo(i, StateToPrint);
@@ -1527,7 +1563,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        break;
                        ///////////// start - PHP state handling
                case SCE_HPHP_WORD:
                        break;
                        ///////////// start - PHP state handling
                case SCE_HPHP_WORD:
-                       if (!iswordchar(ch)) {
+                       if (!IsAWordChar(ch)) {
                                classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
                                if (ch == '/' && chNext == '*') {
                                        i++;
                                classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
                                if (ch == '/' && chNext == '*') {
                                        i++;
@@ -1547,7 +1583,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        state = SCE_HPHP_SIMPLESTRING;
                                } else if (ch == '$' && IsPhpWordStart(chNext)) {
                                        state = SCE_HPHP_VARIABLE;
                                        state = SCE_HPHP_SIMPLESTRING;
                                } else if (ch == '$' && IsPhpWordStart(chNext)) {
                                        state = SCE_HPHP_VARIABLE;
-                               } else if (isoperator(ch)) {
+                               } else if (IsOperator(ch)) {
                                        state = SCE_HPHP_OPERATOR;
                                } else {
                                        state = SCE_HPHP_DEFAULT;
                                        state = SCE_HPHP_OPERATOR;
                                } else {
                                        state = SCE_HPHP_DEFAULT;
@@ -1560,7 +1596,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                && strchr(".xXabcdefABCDEF", ch) == NULL
                                && ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) {
                                styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
                                && strchr(".xXabcdefABCDEF", ch) == NULL
                                && ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) {
                                styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
-                               if (isoperator(ch))
+                               if (IsOperator(ch))
                                        state = SCE_HPHP_OPERATOR;
                                else
                                        state = SCE_HPHP_DEFAULT;
                                        state = SCE_HPHP_OPERATOR;
                                else
                                        state = SCE_HPHP_DEFAULT;
@@ -1569,7 +1605,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                case SCE_HPHP_VARIABLE:
                        if (!IsPhpWordChar(ch)) {
                                styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
                case SCE_HPHP_VARIABLE:
                        if (!IsPhpWordChar(ch)) {
                                styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
-                               if (isoperator(ch))
+                               if (IsOperator(ch))
                                        state = SCE_HPHP_OPERATOR;
                                else
                                        state = SCE_HPHP_DEFAULT;
                                        state = SCE_HPHP_OPERATOR;
                                else
                                        state = SCE_HPHP_DEFAULT;
@@ -1599,8 +1635,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HPHP_HSTRING_VARIABLE;
                        } else if (styler.Match(i, phpStringDelimiter)) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HPHP_HSTRING_VARIABLE;
                        } else if (styler.Match(i, phpStringDelimiter)) {
-                               if (strlen(phpStringDelimiter) > 1)
-                                       i += strlen(phpStringDelimiter) - 1;
+                               const int psdLength = strlen(phpStringDelimiter);
+                               if ((psdLength > 1) && ((i + psdLength) < lengthDoc))
+                                       i += psdLength - 1;
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_HPHP_DEFAULT;
                        }
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_HPHP_DEFAULT;
                        }
@@ -1632,7 +1669,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        styler.ColourTo(i - 1, StateToPrint);
                        if (IsADigit(ch) || (ch == '.' && IsADigit(chNext))) {
                                state = SCE_HPHP_NUMBER;
                        styler.ColourTo(i - 1, StateToPrint);
                        if (IsADigit(ch) || (ch == '.' && IsADigit(chNext))) {
                                state = SCE_HPHP_NUMBER;
-                       } else if (iswordstart(ch)) {
+                       } else if (IsAWordStart(ch)) {
                                state = SCE_HPHP_WORD;
                        } else if (ch == '/' && chNext == '*') {
                                i++;
                                state = SCE_HPHP_WORD;
                        } else if (ch == '/' && chNext == '*') {
                                i++;
@@ -1652,9 +1689,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HPHP_SIMPLESTRING;
                        } else if (ch == '$' && IsPhpWordStart(chNext)) {
                                state = SCE_HPHP_VARIABLE;
                                state = SCE_HPHP_SIMPLESTRING;
                        } else if (ch == '$' && IsPhpWordStart(chNext)) {
                                state = SCE_HPHP_VARIABLE;
-                       } else if (isoperator(ch)) {
+                       } else if (IsOperator(ch)) {
                                state = SCE_HPHP_OPERATOR;
                                state = SCE_HPHP_OPERATOR;
-                       } else if ((state == SCE_HPHP_OPERATOR) && (isspacechar(ch))) {
+                       } else if ((state == SCE_HPHP_OPERATOR) && (IsASpace(ch))) {
                                state = SCE_HPHP_DEFAULT;
                        }
                        break;
                                state = SCE_HPHP_DEFAULT;
                        }
                        break;
@@ -1670,9 +1707,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HB_STRING;
                        } else if (ch == '\'') {
                                state = SCE_HB_COMMENTLINE;
                                state = SCE_HB_STRING;
                        } else if (ch == '\'') {
                                state = SCE_HB_COMMENTLINE;
-                       } else if (iswordstart(ch)) {
+                       } else if (IsAWordStart(ch)) {
                                state = SCE_HB_WORD;
                                state = SCE_HB_WORD;
-                       } else if (isoperator(ch)) {
+                       } else if (IsOperator(ch)) {
                                styler.ColourTo(i, SCE_HB_DEFAULT);
                        }
                } else if (state == SCE_HBA_DEFAULT) {    // One of the above succeeded
                                styler.ColourTo(i, SCE_HB_DEFAULT);
                        }
                } else if (state == SCE_HBA_DEFAULT) {    // One of the above succeeded
@@ -1680,9 +1717,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HBA_STRING;
                        } else if (ch == '\'') {
                                state = SCE_HBA_COMMENTLINE;
                                state = SCE_HBA_STRING;
                        } else if (ch == '\'') {
                                state = SCE_HBA_COMMENTLINE;
-                       } else if (iswordstart(ch)) {
+                       } else if (IsAWordStart(ch)) {
                                state = SCE_HBA_WORD;
                                state = SCE_HBA_WORD;
-                       } else if (isoperator(ch)) {
+                       } else if (IsOperator(ch)) {
                                styler.ColourTo(i, SCE_HBA_DEFAULT);
                        }
                } else if (state == SCE_HJ_DEFAULT) {    // One of the above succeeded
                                styler.ColourTo(i, SCE_HBA_DEFAULT);
                        }
                } else if (state == SCE_HJ_DEFAULT) {    // One of the above succeeded
@@ -1697,9 +1734,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HJ_DOUBLESTRING;
                        } else if ((ch == '\'') && (nonEmptySegment)) {
                                state = SCE_HJ_SINGLESTRING;
                                state = SCE_HJ_DOUBLESTRING;
                        } else if ((ch == '\'') && (nonEmptySegment)) {
                                state = SCE_HJ_SINGLESTRING;
-                       } else if (iswordstart(ch)) {
+                       } else if (IsAWordStart(ch)) {
                                state = SCE_HJ_WORD;
                                state = SCE_HJ_WORD;
-                       } else if (isoperator(ch)) {
+                       } else if (IsOperator(ch)) {
                                styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
                        }
                }
                                styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
                        }
                }
@@ -1715,6 +1752,18 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
        }
 }
 
        }
 }
 
+static void ColouriseXMLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+                                  Accessor &styler) {
+       // Passing in true because we're lexing XML
+       ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists,styler, true);
+}
+
+static void ColouriseHTMLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+                                  Accessor &styler) {
+       // Passing in false because we're notlexing XML
+       ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists,styler, false);
+}
+
 static bool isASPScript(int state) {
        return
                (state >= SCE_HJA_START && state <= SCE_HJA_REGEX) ||
 static bool isASPScript(int state) {
        return
                (state >= SCE_HJA_START && state <= SCE_HJA_REGEX) ||
@@ -1789,7 +1838,7 @@ static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) {
                        sc.SetState(SCE_H_DEFAULT);
                }
        } else if (sc.state == SCE_H_TAGUNKNOWN) {
                        sc.SetState(SCE_H_DEFAULT);
                }
        } else if (sc.state == SCE_H_TAGUNKNOWN) {
-               if (!ishtmlwordchar(static_cast<char>(sc.ch)) && !((sc.ch == '/') && (sc.chPrev == '<')) && sc.ch != '[') {
+               if (!ishtmlwordchar(sc.ch) && !((sc.ch == '/') && (sc.chPrev == '<')) && sc.ch != '[') {
                        char s[100];
                        sc.GetCurrentLowered(s, sizeof(s));
                        if (s[1] == '/') {
                        char s[100];
                        sc.GetCurrentLowered(s, sizeof(s));
                        if (s[1] == '/') {
@@ -1812,7 +1861,7 @@ static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) {
                        }
                }
        } else if (sc.state == SCE_H_ATTRIBUTE) {
                        }
                }
        } else if (sc.state == SCE_H_ATTRIBUTE) {
-               if (!ishtmlwordchar(static_cast<char>(sc.ch))) {
+               if (!ishtmlwordchar(sc.ch)) {
                        char s[100];
                        sc.GetCurrentLowered(s, sizeof(s));
                        if (!keywordsTags.InList(s)) {
                        char s[100];
                        sc.GetCurrentLowered(s, sizeof(s));
                        if (!keywordsTags.InList(s)) {
@@ -1864,7 +1913,7 @@ static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) {
                } else if (sc.ch == '>') {
                        sc.SetState(SCE_H_TAG);
                        sc.ForwardSetState(SCE_H_DEFAULT);
                } else if (sc.ch == '>') {
                        sc.SetState(SCE_H_TAG);
                        sc.ForwardSetState(SCE_H_DEFAULT);
-               } else if (ishtmlwordchar(static_cast<char>(sc.ch))) {
+               } else if (ishtmlwordchar(sc.ch)) {
                        sc.SetState(SCE_H_ATTRIBUTE);
                }
        }
                        sc.SetState(SCE_H_ATTRIBUTE);
                }
        }
@@ -1908,8 +1957,8 @@ static void ColouriseASPPiece(StyleContext &sc, WordList *keywordlists[]) {
 
 static void ColouriseASPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
                                   Accessor &styler) {
 
 static void ColouriseASPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
                                   Accessor &styler) {
-       // Lexer for HTML requires more lexical states (7 bits worth) than most lexers
-       StyleContext sc(startPos, length, initStyle, styler, 0x7f);
+       // Lexer for HTML requires more lexical states (8 bits worth) than most lexers
+       StyleContext sc(startPos, length, initStyle, styler, static_cast<char>(STYLE_MAX));
        for (; sc.More(); sc.Forward()) {
                ColouriseASPPiece(sc, keywordlists);
        }
        for (; sc.More(); sc.Forward()) {
                ColouriseASPPiece(sc, keywordlists);
        }
@@ -1992,7 +2041,7 @@ static void ColourisePHPPiece(StyleContext &sc, WordList *keywordlists[]) {
                        sc.SetState(SCE_HPHP_SIMPLESTRING);
                } else if (sc.ch == '$' && IsPhpWordStart(static_cast<char>(sc.chNext))) {
                        sc.SetState(SCE_HPHP_VARIABLE);
                        sc.SetState(SCE_HPHP_SIMPLESTRING);
                } else if (sc.ch == '$' && IsPhpWordStart(static_cast<char>(sc.chNext))) {
                        sc.SetState(SCE_HPHP_VARIABLE);
-               } else if (isoperator(static_cast<char>(sc.ch))) {
+               } else if (IsOperator(static_cast<char>(sc.ch))) {
                        sc.SetState(SCE_HPHP_OPERATOR);
                }
        }
                        sc.SetState(SCE_HPHP_OPERATOR);
                }
        }
@@ -2000,8 +2049,8 @@ static void ColourisePHPPiece(StyleContext &sc, WordList *keywordlists[]) {
 
 static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
                                   Accessor &styler) {
 
 static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
                                   Accessor &styler) {
-       // Lexer for HTML requires more lexical states (7 bits worth) than most lexers
-       StyleContext sc(startPos, length, initStyle, styler, 0x7f);
+       // Lexer for HTML requires more lexical states (8 bits worth) than most lexers
+       StyleContext sc(startPos, length, initStyle, styler, static_cast<char>(STYLE_MAX));
        for (; sc.More(); sc.Forward()) {
                ColourisePHPPiece(sc, keywordlists);
        }
        for (; sc.More(); sc.Forward()) {
                ColourisePHPPiece(sc, keywordlists);
        }
@@ -2011,7 +2060,7 @@ static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, Wo
 static void ColourisePHPScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
                                                Accessor &styler) {
        if(startPos == 0) initStyle = SCE_HPHP_DEFAULT;
 static void ColourisePHPScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
                                                Accessor &styler) {
        if(startPos == 0) initStyle = SCE_HPHP_DEFAULT;
-               ColouriseHyperTextDoc(startPos,length,initStyle,keywordlists,styler);
+               ColouriseHTMLDoc(startPos,length,initStyle,keywordlists,styler);
 }
 
 static const char * const htmlWordListDesc[] = {
 }
 
 static const char * const htmlWordListDesc[] = {
@@ -2034,9 +2083,9 @@ static const char * const phpscriptWordListDesc[] = {
        0,
 };
 
        0,
 };
 
-LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc, 7);
-LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc, 7);
+LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc, 8);
+LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc, 8);
 // SCLEX_ASP and SCLEX_PHP should not be used in new code: use SCLEX_HTML instead.
 // SCLEX_ASP and SCLEX_PHP should not be used in new code: use SCLEX_HTML instead.
-LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc, 7);
-LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc, 7);
-LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 7);
+LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc, 8);
+LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc, 8);
+LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 8);
index 0e4be85c6ba262a20ec380f8763f783c2640e2d5..095675ee5b9c605e07c6d534622d57a4b895e064 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 #ifdef BUILD_AS_EXTERNAL_LEXER
 
 #include "ExternalLexer.h"
 #ifdef BUILD_AS_EXTERNAL_LEXER
 
 #include "ExternalLexer.h"
@@ -85,12 +89,16 @@ static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
       else if (sc.state == SCE_HA_STRING) {
          if (sc.ch == '\"') {
             sc.ForwardSetState(SCE_HA_DEFAULT);
       else if (sc.state == SCE_HA_STRING) {
          if (sc.ch == '\"') {
             sc.ForwardSetState(SCE_HA_DEFAULT);
+         } else if (sc.ch == '\\') {
+            sc.Forward();
          }
       }
          // Char
       else if (sc.state == SCE_HA_CHARACTER) {
          if (sc.ch == '\'') {
             sc.ForwardSetState(SCE_HA_DEFAULT);
          }
       }
          // Char
       else if (sc.state == SCE_HA_CHARACTER) {
          if (sc.ch == '\'') {
             sc.ForwardSetState(SCE_HA_DEFAULT);
+         } else if (sc.ch == '\\') {
+            sc.Forward();
          }
       }
          // Number
          }
       }
          // Number
@@ -185,7 +193,7 @@ static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
             sc.SetState(SCE_HA_STRING);
          }
          // Character
             sc.SetState(SCE_HA_STRING);
          }
          // Character
-         else if (sc.Match('\'') && IsWhitespace(sc.GetRelative(-1)) ) {
+         else if (sc.Match('\'')) {
             sc.SetState(SCE_HA_CHARACTER);
          }
          // Stringstart
             sc.SetState(SCE_HA_CHARACTER);
          }
          // Stringstart
index ff99da7e4ecf50e3b3daf9dec3618fc47e3fbaed..53817509676730e2696d16b06668481b7eafd853 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
        int state = SCE_INNO_DEFAULT;
        char chPrev;
 static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
        int state = SCE_INNO_DEFAULT;
        char chPrev;
@@ -172,14 +176,14 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
                        case SCE_INNO_STRING_DOUBLE:
                                if (ch == '"' || isEOL) {
                                        state = SCE_INNO_DEFAULT;
                        case SCE_INNO_STRING_DOUBLE:
                                if (ch == '"' || isEOL) {
                                        state = SCE_INNO_DEFAULT;
-                                       styler.ColourTo(i,SCE_INNO_DEFAULT);
+                                       styler.ColourTo(i,SCE_INNO_STRING_DOUBLE);
                                }
                                break;
 
                        case SCE_INNO_STRING_SINGLE:
                                if (ch == '\'' || isEOL) {
                                        state = SCE_INNO_DEFAULT;
                                }
                                break;
 
                        case SCE_INNO_STRING_SINGLE:
                                if (ch == '\'' || isEOL) {
                                        state = SCE_INNO_DEFAULT;
-                                       styler.ColourTo(i,SCE_INNO_DEFAULT);
+                                       styler.ColourTo(i,SCE_INNO_STRING_SINGLE);
                                }
                                break;
 
                                }
                                break;
 
index e439d4d1d6d693bd7ac8f3b88717d9ac7b293698..06e7c1791fbe22d5e0e5cb8ccf20515f33952e93 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 // Extended to accept accented characters
 static inline bool IsAWordChar(int ch) {
        return ch >= 0x80 || isalnum(ch) || ch == '_';
 // Extended to accept accented characters
 static inline bool IsAWordChar(int ch) {
        return ch >= 0x80 || isalnum(ch) || ch == '_';
index 91385f0fd4914efc1347e9039f1d35f5dcd4d7f6..1072e13a3af2fdd62274b7dc4a450df660128e4b 100644 (file)
 #include "SciLexer.h"
 #include "StyleContext.h"
 
 #include "SciLexer.h"
 #include "StyleContext.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 #define SCE_LISP_CHARACTER 29
 #define SCE_LISP_MACRO 30
 #define SCE_LISP_MACRO_DISPATCH 31
 #define SCE_LISP_CHARACTER 29
 #define SCE_LISP_MACRO 30
 #define SCE_LISP_MACRO_DISPATCH 31
index 9d1a45a028d5dfb4b372f51931811a92cb438ad4..492e4ed6d66230cbc17a5eb43dd2c9372f6b1f9b 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static inline bool IsAWordChar(const int ch) {
        return (ch < 0x80) && (isalpha(ch) || ch == '@' || ch == '_');
 }
 static inline bool IsAWordChar(const int ch) {
        return (ch < 0x80) && (isalpha(ch) || ch == '@' || ch == '_');
 }
index b3a46ad34188cc2f3b253422ef900d1cf24314fe..63114a976dfaeb63a060b3b46579920e87e8d0ec 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 // Extended to accept accented characters
 static inline bool IsAWordChar(int ch) {
        return ch >= 0x80 ||
 // Extended to accept accented characters
 static inline bool IsAWordChar(int ch) {
        return ch >= 0x80 ||
@@ -149,7 +153,10 @@ static void ColouriseLuaDoc(
                        // We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char
                        if (!IsANumberChar(sc.ch)) {
                                sc.SetState(SCE_LUA_DEFAULT);
                        // We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char
                        if (!IsANumberChar(sc.ch)) {
                                sc.SetState(SCE_LUA_DEFAULT);
-                       }
+                       } else if (sc.ch == '-' || sc.ch == '+') {
+                                if (sc.chPrev != 'E' && sc.chPrev != 'e')
+                                        sc.SetState(SCE_LUA_DEFAULT);
+                        }
                } else if (sc.state == SCE_LUA_IDENTIFIER) {
                        if (!IsAWordChar(sc.ch) || sc.Match('.', '.')) {
                                char s[100];
                } else if (sc.state == SCE_LUA_IDENTIFIER) {
                        if (!IsAWordChar(sc.ch) || sc.Match('.', '.')) {
                                char s[100];
@@ -166,8 +173,6 @@ static void ColouriseLuaDoc(
                                        sc.ChangeState(SCE_LUA_WORD5);
                                } else if (keywords6.InList(s)) {
                                        sc.ChangeState(SCE_LUA_WORD6);
                                        sc.ChangeState(SCE_LUA_WORD5);
                                } else if (keywords6.InList(s)) {
                                        sc.ChangeState(SCE_LUA_WORD6);
-                               } else if (keywords6.InList(s)) {
-                                       sc.ChangeState(SCE_LUA_WORD6);
                                } else if (keywords7.InList(s)) {
                                        sc.ChangeState(SCE_LUA_WORD7);
                                } else if (keywords8.InList(s)) {
                                } else if (keywords7.InList(s)) {
                                        sc.ChangeState(SCE_LUA_WORD7);
                                } else if (keywords8.InList(s)) {
index f447899899114de28e7ca596b6ba836fe4b4958f..a00f35ca038885936352a303aea85b64669ae426 100644 (file)
@@ -22,6 +22,9 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
 
 
 static inline bool IsAWordChar(const int ch) {
 
 
 static inline bool IsAWordChar(const int ch) {
index 1058b9b49674cb4b99c1a661474eea605172d952..93b8caba7c3c560d4ead05375a294e1cb57d1d50 100644 (file)
 #include "SciLexer.h"
 #include "SString.h"
 
 #include "SciLexer.h"
 #include "SString.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static int GetLotLineState(SString &line) {
        if (line.length()) {
                // Most of the time the first non-blank character in line determines that line's type
 static int GetLotLineState(SString &line) {
        if (line.length()) {
                // Most of the time the first non-blank character in line determines that line's type
index a94666822b871b86aa4d5df6739b0222600618b0..4a3f3bed83c4e6a71cf698416a2380536ea1f6b8 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 #define KW_MSSQL_STATEMENTS         0
 #define KW_MSSQL_DATA_TYPES         1
 #define KW_MSSQL_SYSTEM_TABLES      2
 #define KW_MSSQL_STATEMENTS         0
 #define KW_MSSQL_DATA_TYPES         1
 #define KW_MSSQL_SYSTEM_TABLES      2
@@ -307,16 +311,16 @@ static void FoldMSSQLDoc(unsigned int startPos, int length, int, WordList *[], A
                        inComment = (style == SCE_MSSQL_COMMENT);
                }
         if (style == SCE_MSSQL_STATEMENT) {
                        inComment = (style == SCE_MSSQL_COMMENT);
                }
         if (style == SCE_MSSQL_STATEMENT) {
-            // Folding between begin and end
-            if (ch == 'b' || ch == 'e') {
+            // Folding between begin or case and end
+            if (ch == 'b' || ch == 'B' || ch == 'c' || ch == 'C' || ch == 'e' || ch == 'E') {
                 for (unsigned int j = 0; j < 5; j++) {
                                        if (!iswordchar(styler[i + j])) {
                                                break;
                                        }
                 for (unsigned int j = 0; j < 5; j++) {
                                        if (!iswordchar(styler[i + j])) {
                                                break;
                                        }
-                                       s[j] = styler[i + j];
+                                       s[j] = static_cast<char>(tolower(styler[i + j]));
                                        s[j + 1] = '\0';
                 }
                                        s[j + 1] = '\0';
                 }
-                               if (strcmp(s, "begin") == 0) {
+                               if ((strcmp(s, "begin") == 0) || (strcmp(s, "case") == 0)) {
                                        levelCurrent++;
                                }
                                if (strcmp(s, "end") == 0) {
                                        levelCurrent++;
                                }
                                if (strcmp(s, "end") == 0) {
index ce3ba917193b46a54f7d002ae7f6b32425bddeec..af5f59aea5dff63524bbb22fcdbf1323ff838983 100644 (file)
@@ -25,6 +25,9 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
 
 static bool IsMatlabCommentChar(int c) {
        return (c == '%') ;
 
 static bool IsMatlabCommentChar(int c) {
        return (c == '%') ;
@@ -100,11 +103,19 @@ static void ColouriseMatlabOctaveDoc(
                                transpose = true;
                        }
                } else if (sc.state == SCE_MATLAB_STRING) {
                                transpose = true;
                        }
                } else if (sc.state == SCE_MATLAB_STRING) {
-                       if (sc.ch == '\'' && sc.chPrev != '\\') {
+                       if (sc.ch == '\\') {
+                               if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
+                                       sc.Forward();
+                               }
+                       } else if (sc.ch == '\'') {
                                sc.ForwardSetState(SCE_MATLAB_DEFAULT);
                        }
                } else if (sc.state == SCE_MATLAB_DOUBLEQUOTESTRING) {
                                sc.ForwardSetState(SCE_MATLAB_DEFAULT);
                        }
                } else if (sc.state == SCE_MATLAB_DOUBLEQUOTESTRING) {
-                       if (sc.ch == '"' && sc.chPrev != '\\') {
+                       if (sc.ch == '\\') {
+                               if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
+                                       sc.Forward();
+                               }
+                       } else if (sc.ch == '\"') {
                                sc.ForwardSetState(SCE_MATLAB_DEFAULT);
                        }
                } else if (sc.state == SCE_MATLAB_COMMENT || sc.state == SCE_MATLAB_COMMAND) {
                                sc.ForwardSetState(SCE_MATLAB_DEFAULT);
                        }
                } else if (sc.state == SCE_MATLAB_COMMENT || sc.state == SCE_MATLAB_COMMAND) {
@@ -126,7 +137,7 @@ static void ColouriseMatlabOctaveDoc(
                                        sc.SetState(SCE_MATLAB_STRING);
                                }
                        } else if (sc.ch == '"') {
                                        sc.SetState(SCE_MATLAB_STRING);
                                }
                        } else if (sc.ch == '"') {
-              sc.SetState(SCE_MATLAB_DOUBLEQUOTESTRING);
+                               sc.SetState(SCE_MATLAB_DOUBLEQUOTESTRING);
                        } else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) {
                                sc.SetState(SCE_MATLAB_NUMBER);
                        } else if (isalpha(sc.ch)) {
                        } else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) {
                                sc.SetState(SCE_MATLAB_NUMBER);
                        } else if (isalpha(sc.ch)) {
@@ -148,17 +159,17 @@ static void ColouriseMatlabOctaveDoc(
 
 static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
                                WordList *keywordlists[], Accessor &styler) {
 
 static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
                                WordList *keywordlists[], Accessor &styler) {
-  ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar);
+       ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar);
 }
 
 static void ColouriseOctaveDoc(unsigned int startPos, int length, int initStyle,
                                WordList *keywordlists[], Accessor &styler) {
 }
 
 static void ColouriseOctaveDoc(unsigned int startPos, int length, int initStyle,
                                WordList *keywordlists[], Accessor &styler) {
-  ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar);
+       ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar);
 }
 
 static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
 }
 
 static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
-                          WordList *[], Accessor &styler,
-                          bool (*IsComment)(Accessor&,int,int)) {
+                                WordList *[], Accessor &styler,
+                                bool (*IsComment)(Accessor&, int, int)) {
 
        int endPos = startPos + length;
 
 
        int endPos = startPos + length;
 
@@ -202,12 +213,12 @@ static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
 
 static void FoldMatlabDoc(unsigned int startPos, int length, int initStyle,
                           WordList *keywordlists[], Accessor &styler) {
 
 static void FoldMatlabDoc(unsigned int startPos, int length, int initStyle,
                           WordList *keywordlists[], Accessor &styler) {
-  FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabComment);
+       FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabComment);
 }
 
 static void FoldOctaveDoc(unsigned int startPos, int length, int initStyle,
                           WordList *keywordlists[], Accessor &styler) {
 }
 
 static void FoldOctaveDoc(unsigned int startPos, int length, int initStyle,
                           WordList *keywordlists[], Accessor &styler) {
-  FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveComment);
+       FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveComment);
 }
 
 static const char * const matlabWordListDesc[] = {
 }
 
 static const char * const matlabWordListDesc[] = {
index b7d482c0f1d9a74e10b0907cd94176b06095e293..6afc9d8265848a9d45ab096ff53cb4c230654f52 100644 (file)
@@ -3,6 +3,8 @@
 // File: LexMetapost.cxx - general context conformant metapost coloring scheme
 // Author: Hans Hagen - PRAGMA ADE - Hasselt NL - www.pragma-ade.com
 // Version: September 28, 2003
 // File: LexMetapost.cxx - general context conformant metapost coloring scheme
 // Author: Hans Hagen - PRAGMA ADE - Hasselt NL - www.pragma-ade.com
 // Version: September 28, 2003
+// Modified by instanton: July 10, 2007
+// Folding based on keywordlists[]
 
 // Copyright: 1998-2003 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Copyright: 1998-2003 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 #include "SciLexer.h"
 #include "StyleContext.h"
 
 #include "SciLexer.h"
 #include "StyleContext.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 // val SCE_METAPOST_DEFAULT = 0
 // val SCE_METAPOST_SPECIAL = 1
 // val SCE_METAPOST_GROUP = 2
 // val SCE_METAPOST_DEFAULT = 0
 // val SCE_METAPOST_SPECIAL = 1
 // val SCE_METAPOST_GROUP = 2
@@ -317,4 +323,77 @@ static const char * const metapostWordListDesc[] = {
        0
 } ;
 
        0
 } ;
 
-LexerModule lmMETAPOST(SCLEX_METAPOST, ColouriseMETAPOSTDoc, "metapost", 0, metapostWordListDesc);
+static int classifyFoldPointMetapost(const char* s,WordList *keywordlists[]) {
+       WordList& keywordsStart=*keywordlists[3];
+       WordList& keywordsStop1=*keywordlists[4];
+       
+       if (keywordsStart.InList(s)) {return 1;}
+       else if (keywordsStop1.InList(s)) {return -1;}
+       return 0;
+       
+}
+
+static int ParseMetapostWord(unsigned int pos, Accessor &styler, char *word)
+{
+  int length=0;
+  char ch=styler.SafeGetCharAt(pos);
+  *word=0;
+
+  while(isMETAPOSTidentifier(ch) && isalpha(ch) && length<100){
+          word[length]=ch;
+          length++;
+          ch=styler.SafeGetCharAt(pos+length);
+  }
+  word[length]=0;   
+  return length;
+}
+static void FoldMetapostDoc(unsigned int startPos, int length, int, WordList *keywordlists[], Accessor &styler) 
+{
+       bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+       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];
+       
+       char buffer[100]="";
+       
+       for (unsigned int i=startPos; i < endPos; i++) {
+               char ch=chNext;
+               chNext=styler.SafeGetCharAt(i+1);
+               char chPrev=styler.SafeGetCharAt(i-1);
+               bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+
+               if(i==0 || chPrev == '\r' || chPrev=='\n'|| chPrev==' '|| chPrev=='(' || chPrev=='$')
+               {
+            ParseMetapostWord(i, styler, buffer);
+                       levelCurrent += classifyFoldPointMetapost(buffer,keywordlists);
+               }
+               
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0 && foldCompact)
+                               lev |= SC_FOLDLEVELWHITEFLAG;
+                       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++;
+       }
+       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+       int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+       styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+
+}
+
+
+LexerModule lmMETAPOST(SCLEX_METAPOST, ColouriseMETAPOSTDoc, "metapost", FoldMetapostDoc, metapostWordListDesc);
index e6f12dd943058788eb7803e0339f7fac3303e22d..93f0cd4d62b72c06a4a61ee18e5cb8e9fd44d658 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 /*
 // located in SciLexer.h
 #define SCLEX_NSIS 43
 /*
 // located in SciLexer.h
 #define SCLEX_NSIS 43
@@ -94,7 +98,7 @@ static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &
   return false;
 }
 
   return false;
 }
 
-static int NsisCmp( const char *s1, const char *s2, bool bIgnoreCase )
+static int NsisCmp( char *s1, char *s2, bool bIgnoreCase )
 {
   if( bIgnoreCase )
      return CompareCaseInsensitive( s1, s2);
 {
   if( bIgnoreCase )
      return CompareCaseInsensitive( s1, s2);
@@ -120,7 +124,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel
           return foldlevel;
   }
   else
           return foldlevel;
   }
   else
-  { 
+  {
     if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF &&
         style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_SECTIONGROUP &&
         style != SCE_NSIS_PAGEEX )
     if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF &&
         style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_SECTIONGROUP &&
         style != SCE_NSIS_PAGEEX )
@@ -141,7 +145,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel
 
   if( s[0] == '!' )
   {
 
   if( s[0] == '!' )
   {
-    if( NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!macro", bIgnoreCase ) == 0 )
+    if( NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!macro", bIgnoreCase ) == 0 )
       newFoldlevel++;
     else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 )
       newFoldlevel--;
       newFoldlevel++;
     else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 )
       newFoldlevel--;
@@ -155,7 +159,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel
     else if( NsisCmp(s, "SectionGroupEnd", bIgnoreCase ) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase ) == 0 )
       newFoldlevel--;
   }
     else if( NsisCmp(s, "SectionGroupEnd", bIgnoreCase ) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase ) == 0 )
       newFoldlevel--;
   }
-  
+
   return newFoldlevel;
 }
 
   return newFoldlevel;
 }
 
@@ -195,6 +199,9 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
   if( NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // ||  NsisCmp(s, "!ifndef", bIgnoreCase) == 0 ||  NsisCmp(s, "!endif", bIgnoreCase) == 0 )
                return SCE_NSIS_IFDEFINEDEF;
 
   if( NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // ||  NsisCmp(s, "!ifndef", bIgnoreCase) == 0 ||  NsisCmp(s, "!endif", bIgnoreCase) == 0 )
                return SCE_NSIS_IFDEFINEDEF;
 
+  if( NsisCmp(s, "!if", bIgnoreCase ) == 0 )
+               return SCE_NSIS_IFDEFINEDEF;
+
   if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd
     return SCE_NSIS_SECTIONGROUP;
 
   if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd
     return SCE_NSIS_SECTIONGROUP;
 
index d1d188998f056a593016a8ac7fbd658f067deea0..221f955974cb1d007f46e1565e9a93a7718d944a 100644 (file)
 #include "SciLexer.h"
 #include "StyleContext.h"
 
 #include "SciLexer.h"
 #include "StyleContext.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
 {
        unsigned int i = 0;
 inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
 {
        unsigned int i = 0;
index 5f6e7e404152f53182fb7cd6c53e825d674bdfd6..fbc3b28911aeac7613b48732cdad12c2a0b15712 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static bool Is0To9(char ch) {
        return (ch >= '0') && (ch <= '9');
 }
 static bool Is0To9(char ch) {
        return (ch >= '0') && (ch <= '9');
 }
@@ -125,7 +129,7 @@ static void ColouriseBatchLine(
                        styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
                        offset += 2;
                        // Check for External Command / Program
                        styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
                        offset += 2;
                        // Check for External Command / Program
-                       if (!isspacechar(lineBuffer[offset])) {
+                       if (offset < lengthLine && !isspacechar(lineBuffer[offset])) {
                                cmdLoc = offset;
                        }
                // Check for Environment Variable (%x...%)
                                cmdLoc = offset;
                        }
                // Check for Environment Variable (%x...%)
@@ -136,7 +140,7 @@ static void ColouriseBatchLine(
                        styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER);
                        offset++;
                        // Check for External Command / Program
                        styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER);
                        offset++;
                        // Check for External Command / Program
-                       if (!isspacechar(lineBuffer[offset])) {
+                       if (offset < lengthLine && !isspacechar(lineBuffer[offset])) {
                                cmdLoc = offset;
                        }
                }
                                cmdLoc = offset;
                        }
                }
@@ -371,6 +375,7 @@ static void ColouriseBatchLine(
                                offset -= (wbl - wbo);
                        // Check for Local Variable (%%a)
                        } else if (
                                offset -= (wbl - wbo);
                        // Check for Local Variable (%%a)
                        } else if (
+                               (wbl > 2) &&
                                (wordBuffer[1] == '%') &&
                                (wordBuffer[2] != '%') &&
                                (!IsBOperator(wordBuffer[2])) &&
                                (wordBuffer[1] == '%') &&
                                (wordBuffer[2] != '%') &&
                                (!IsBOperator(wordBuffer[2])) &&
@@ -473,6 +478,7 @@ static void ColouriseBatchDoc(
                }
        }
        if (linePos > 0) {      // Last line does not have ending characters
                }
        }
        if (linePos > 0) {      // Last line does not have ending characters
+               lineBuffer[linePos] = '\0';
                ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
                                   keywordlists, styler);
        }
                ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
                                   keywordlists, styler);
        }
@@ -720,6 +726,12 @@ static void ColouriseMakeLine(
        int lastNonSpace = -1;
        unsigned int state = SCE_MAKE_DEFAULT;
        bool bSpecial = false;
        int lastNonSpace = -1;
        unsigned int state = SCE_MAKE_DEFAULT;
        bool bSpecial = false;
+
+       // check for a tab character in column 0 indicating a command
+       bool bCommand = false;
+       if ((lengthLine > 0) && (lineBuffer[0] == '\t'))
+               bCommand = true;
+
        // Skip initial spaces
        while ((i < lengthLine) && isspacechar(lineBuffer[i])) {
                i++;
        // Skip initial spaces
        while ((i < lengthLine) && isspacechar(lineBuffer[i])) {
                i++;
@@ -740,14 +752,24 @@ static void ColouriseMakeLine(
                        styler.ColourTo(startLine + i, state);
                        state = SCE_MAKE_DEFAULT;
                }
                        styler.ColourTo(startLine + i, state);
                        state = SCE_MAKE_DEFAULT;
                }
-               if (!bSpecial) {
+
+               // skip identifier and target styling if this is a command line
+               if (!bSpecial && !bCommand) {
                        if (lineBuffer[i] == ':') {
                        if (lineBuffer[i] == ':') {
-                               // We should check that no colouring was made since the beginning of the line,
-                               // to avoid colouring stuff like /OUT:file
-                               if (lastNonSpace >= 0)
-                                       styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
-                               styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
-                               styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
+                               if (((i + 1) < lengthLine) && (lineBuffer[i + 1] == '=')) {
+                                       // it's a ':=', so style as an identifier
+                                       if (lastNonSpace >= 0)
+                                               styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
+                                       styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
+                                       styler.ColourTo(startLine + i + 1, SCE_MAKE_OPERATOR);
+                               } else {
+                                       // We should check that no colouring was made since the beginning of the line,
+                                       // to avoid colouring stuff like /OUT:file
+                                       if (lastNonSpace >= 0)
+                                               styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET);
+                                       styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT);
+                                       styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR);
+                               }
                                bSpecial = true;        // Only react to the first ':' of the line
                                state = SCE_MAKE_DEFAULT;
                        } else if (lineBuffer[i] == '=') {
                                bSpecial = true;        // Only react to the first ':' of the line
                                state = SCE_MAKE_DEFAULT;
                        } else if (lineBuffer[i] == '=') {
@@ -796,7 +818,7 @@ static bool strstart(const char *haystack, const char *needle) {
        return strncmp(haystack, needle, strlen(needle)) == 0;
 }
 
        return strncmp(haystack, needle, strlen(needle)) == 0;
 }
 
-static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine) {
+static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine, int &startValue) {
        if (lineBuffer[0] == '>') {
                // Command or return status
                return SCE_ERR_CMD;
        if (lineBuffer[0] == '>') {
                // Command or return status
                return SCE_ERR_CMD;
@@ -879,7 +901,9 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
                // Microsoft: <filename>(<line>,<column>)<message>
                // CTags: \t<message>
                // Lua 5 traceback: \t<filename>:<line>:<message>
                // Microsoft: <filename>(<line>,<column>)<message>
                // CTags: \t<message>
                // Lua 5 traceback: \t<filename>:<line>:<message>
+               // Lua 5.1: <exe>: <filename>:<line>:<message>
                bool initialTab = (lineBuffer[0] == '\t');
                bool initialTab = (lineBuffer[0] == '\t');
+               bool initialColonPart = false;
                enum { stInitial,
                        stGccStart, stGccDigit, stGcc,
                        stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
                enum { stInitial,
                        stGccStart, stGccDigit, stGcc,
                        stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
@@ -894,10 +918,12 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
                        if (state == stInitial) {
                                if (ch == ':') {
                                        // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix)
                        if (state == stInitial) {
                                if (ch == ':') {
                                        // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix)
-                                       if ((chNext != '\\') && (chNext != '/')) {
+                                       if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) {
                                                // This check is not completely accurate as may be on
                                                // GTK+ with a file name that includes ':'.
                                                // This check is not completely accurate as may be on
                                                // GTK+ with a file name that includes ':'.
-                                               state = stGccStart;
+                                               state = stGccStart;                                             
+                                       } else if (chNext == ' ') { // indicates a Lua 5.1 error message
+                                               initialColonPart = true;
                                        }
                                } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) {
                                        // May be Microsoft
                                        }
                                } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) {
                                        // May be Microsoft
@@ -912,6 +938,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
                        } else if (state == stGccDigit) {       // <filename>:<line>
                                if (ch == ':') {
                                        state = stGcc;  // :9.*: is GCC
                        } else if (state == stGccDigit) {       // <filename>:<line>
                                if (ch == ':') {
                                        state = stGcc;  // :9.*: is GCC
+                                       startValue = i + 1;
                                        break;
                                } else if (!Is0To9(ch)) {
                                        state = stUnrecognized;
                                        break;
                                } else if (!Is0To9(ch)) {
                                        state = stUnrecognized;
@@ -972,7 +999,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
                        }
                }
                if (state == stGcc) {
                        }
                }
                if (state == stGcc) {
-                       return SCE_ERR_GCC;
+                       return initialColonPart ? SCE_ERR_LUA : SCE_ERR_GCC;
                } else if ((state == stMsVc) || (state == stMsDotNet)) {
                        return SCE_ERR_MS;
                } else if ((state == stCtagsStringDollar) || (state == stCtags)) {
                } else if ((state == stMsVc) || (state == stMsDotNet)) {
                        return SCE_ERR_MS;
                } else if ((state == stCtagsStringDollar) || (state == stCtags)) {
@@ -987,8 +1014,16 @@ static void ColouriseErrorListLine(
     char *lineBuffer,
     unsigned int lengthLine,
     unsigned int endPos,
     char *lineBuffer,
     unsigned int lengthLine,
     unsigned int endPos,
-    Accessor &styler) {
-       styler.ColourTo(endPos, RecogniseErrorListLine(lineBuffer, lengthLine));
+    Accessor &styler,
+       bool valueSeparate) {
+       int startValue = -1;
+       int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue);
+       if (valueSeparate && (startValue >= 0)) {
+               styler.ColourTo(endPos - (lengthLine - startValue), style);
+               styler.ColourTo(endPos, SCE_ERR_VALUE);
+       } else {
+               styler.ColourTo(endPos, style);
+       }
 }
 
 static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
 }
 
 static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
@@ -996,17 +1031,18 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi
        styler.StartAt(startPos);
        styler.StartSegment(startPos);
        unsigned int linePos = 0;
        styler.StartAt(startPos);
        styler.StartSegment(startPos);
        unsigned int linePos = 0;
+       bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0;
        for (unsigned int i = startPos; i < startPos + length; i++) {
                lineBuffer[linePos++] = styler[i];
                if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
                        // End of line (or of line buffer) met, colourise it
                        lineBuffer[linePos] = '\0';
        for (unsigned int i = startPos; i < startPos + length; i++) {
                lineBuffer[linePos++] = styler[i];
                if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
                        // End of line (or of line buffer) met, colourise it
                        lineBuffer[linePos] = '\0';
-                       ColouriseErrorListLine(lineBuffer, linePos, i, styler);
+                       ColouriseErrorListLine(lineBuffer, linePos, i, styler, valueSeparate);
                        linePos = 0;
                }
        }
        if (linePos > 0) {      // Last line does not have ending characters
                        linePos = 0;
                }
        }
        if (linePos > 0) {      // Last line does not have ending characters
-               ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler);
+               ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler, valueSeparate);
        }
 }
 
        }
 }
 
index 7878a6bf8f0667414782da52b28dc043f70ad1fc..abc0ddc790661b01017d80c741ef62aab0a5c853 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static inline bool IsTypeCharacter(const int ch)
 {
     return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$' || ch == '?';
 static inline bool IsTypeCharacter(const int ch)
 {
     return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$' || ch == '?';
diff --git a/src/stc/scintilla/src/LexPLM.cxx b/src/stc/scintilla/src/LexPLM.cxx
new file mode 100644 (file)
index 0000000..604850f
--- /dev/null
@@ -0,0 +1,198 @@
+// Copyright (c) 1990-2007, Scientific Toolworks, Inc.
+// Author: Jason Haslam
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+#include "StyleContext.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+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<char>(tolower(styler[start + i]));
+               i++;
+       }
+       s[i] = '\0';
+}
+
+static void ColourisePlmDoc(unsigned int startPos,
+                            int length,
+                            int initStyle,
+                            WordList *keywordlists[],
+                            Accessor &styler)
+{
+       unsigned int endPos = startPos + length;
+       int state = initStyle;
+
+       styler.StartAt(startPos);
+       styler.StartSegment(startPos);
+
+       for (unsigned int i = startPos; i < endPos; i++) {
+               char ch = styler.SafeGetCharAt(i);
+               char chNext = styler.SafeGetCharAt(i + 1);
+
+               if (state == SCE_PLM_DEFAULT) {
+                       if (ch == '/' && chNext == '*') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_PLM_COMMENT;
+                       } else if (ch == '\'') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_PLM_STRING;
+                       } else if (isdigit(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_PLM_NUMBER;
+                       } else if (isalpha(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_PLM_IDENTIFIER;
+                       } else if (ch == '+' || ch == '-' || ch == '*' || ch == '/' ||
+                                  ch == '=' || ch == '<' || ch == '>' || ch == ':') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_PLM_OPERATOR;
+                       } else if (ch == '$') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_PLM_CONTROL;
+                       }
+               } else if (state == SCE_PLM_COMMENT) {
+                       if (ch == '*' && chNext == '/') {
+                               i++;
+                               styler.ColourTo(i, state);
+                               state = SCE_PLM_DEFAULT;
+                       }
+               } else if (state == SCE_PLM_STRING) {
+                       if (ch == '\'') {
+                               if (chNext == '\'') {
+                                       i++;
+                               } else {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_PLM_DEFAULT;
+                               }
+                       }
+               } else if (state == SCE_PLM_NUMBER) {
+                       if (!isdigit(ch) && !isalpha(ch) && ch != '$') {
+                               i--;
+                               styler.ColourTo(i, state);
+                               state = SCE_PLM_DEFAULT;
+                       }
+               } else if (state == SCE_PLM_IDENTIFIER) {
+                       if (!isdigit(ch) && !isalpha(ch) && ch != '$') {
+                               // Get the entire identifier.
+                               char word[1024];
+                               int segmentStart = styler.GetStartSegment();
+                               GetRange(segmentStart, i - 1, styler, word, sizeof(word));
+
+                               i--;
+                               if (keywordlists[0]->InList(word))
+                                       styler.ColourTo(i, SCE_PLM_KEYWORD);
+                               else
+                                       styler.ColourTo(i, state);
+                               state = SCE_PLM_DEFAULT;
+                       }
+               } else if (state == SCE_PLM_OPERATOR) {
+                       if (ch != '=' && ch != '>') {
+                               i--;
+                               styler.ColourTo(i, state);
+                               state = SCE_PLM_DEFAULT;
+                       }
+               } else if (state == SCE_PLM_CONTROL) {
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_PLM_DEFAULT;
+                       }
+               }
+       }
+       styler.ColourTo(endPos - 1, state);
+}
+
+static void FoldPlmDoc(unsigned int startPos,
+                       int length,
+                       int initStyle,
+                       WordList *[],
+                       Accessor &styler)
+{
+       bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+       bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+       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 startKeyword = 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_PLM_KEYWORD && style == SCE_PLM_KEYWORD)
+                       startKeyword = i;
+
+               if (style == SCE_PLM_KEYWORD && styleNext != SCE_PLM_KEYWORD) {
+                       char word[1024];
+                       GetRange(startKeyword, i, styler, word, sizeof(word));
+
+                       if (strcmp(word, "procedure") == 0 || strcmp(word, "do") == 0)
+                               levelCurrent++;
+                       else if (strcmp(word, "end") == 0)
+                               levelCurrent--;
+               }
+
+               if (foldComment) {
+                       if (stylePrev != SCE_PLM_COMMENT && style == SCE_PLM_COMMENT)
+                               levelCurrent++;
+                       else if (stylePrev == SCE_PLM_COMMENT && style != SCE_PLM_COMMENT)
+                               levelCurrent--;
+               }
+
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0 && foldCompact)
+                               lev |= SC_FOLDLEVELWHITEFLAG;
+                       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 plmWordListDesc[] = {
+       "Keywords",
+       0
+};
+
+LexerModule lmPLM(SCLEX_PLM, ColourisePlmDoc, "PL/M", FoldPlmDoc, plmWordListDesc);
index 5cc05ce6ab70f3a764d8d1acfb38363cf360930f..b845b2d4720d23a61a38104fde26e844d859a3ef 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static inline bool IsAWordChar(int ch) {
        return ch < 0x80 && (isalnum(ch) || ch == '_');
 }
 static inline bool IsAWordChar(int ch) {
        return ch < 0x80 && (isalnum(ch) || ch == '_');
 }
index 3c75ae554d65bf05d28cecf9f4b197ac8b52a7e3..2edcff150a4c430256ae1116ee0547b3c732e2f8 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static inline bool IsASelfDelimitingChar(const int ch) {
     return (ch == '[' || ch == ']' || ch == '{' || ch == '}' ||
             ch == '/' || ch == '<' || ch == '>' ||
 static inline bool IsASelfDelimitingChar(const int ch) {
     return (ch == '[' || ch == ']' || ch == '{' || ch == '}' ||
             ch == '/' || ch == '<' || ch == '>' ||
@@ -103,7 +107,7 @@ static void ColourisePSDoc(
                     sc.SetState(SCE_C_DEFAULT);
             } else if (sc.atLineEnd) {
                 sc.SetState(SCE_C_DEFAULT);
                     sc.SetState(SCE_C_DEFAULT);
             } else if (sc.atLineEnd) {
                 sc.SetState(SCE_C_DEFAULT);
-            } else if (IsAWhitespaceChar(sc.ch)) {
+            } else if (IsAWhitespaceChar(sc.ch) && sc.ch != '\r') {
                 sc.ChangeState(SCE_PS_COMMENT);
             }
         } else if (sc.state == SCE_PS_NUMBER) {
                 sc.ChangeState(SCE_PS_COMMENT);
             }
         } else if (sc.state == SCE_PS_NUMBER) {
index 434f88d4fe493c6a6b39bc0b1be7302eb4f90153..0e4576064e9eedac13e7cced2b2b929f11553d19 100644 (file)
 #include "SciLexer.h"
 #include "StyleContext.h"
 
 #include "SciLexer.h"
 #include "StyleContext.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static void getRange(unsigned int start,
                unsigned int end,
                Accessor &styler,
 static void getRange(unsigned int start,
                unsigned int end,
                Accessor &styler,
@@ -289,7 +293,7 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
                styleNext = styler.StyleAt(i + 1);
                bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
 
                styleNext = styler.StyleAt(i + 1);
                bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
 
-               if (stylePrev == SCE_C_DEFAULT && style == SCE_C_WORD)
+               if (stylePrev != SCE_C_WORD && style == SCE_C_WORD)
                {
                        // Store last word start point.
                        lastStart = i;
                {
                        // Store last word start point.
                        lastStart = i;
index cb9152ecaf2fd2b2301c199b514700d86196fc8a..d7e817049645c28106a0c8fe856b5e4e045462c3 100644 (file)
@@ -2,7 +2,7 @@
 /** @file LexPerl.cxx
  ** Lexer for subset of Perl.
  **/
 /** @file LexPerl.cxx
  ** Lexer for subset of Perl.
  **/
-// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
 // Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 #define PERLNUM_BINARY 1    // order is significant: 1-4 cannot have a dot
 #define PERLNUM_HEX 2
 #define PERLNUM_OCTAL 3
 #define PERLNUM_BINARY 1    // order is significant: 1-4 cannot have a dot
 #define PERLNUM_HEX 2
 #define PERLNUM_OCTAL 3
@@ -68,14 +72,22 @@ static bool isPerlKeyword(unsigned int start, unsigned int end, WordList &keywor
        return keywords.InList(s);
 }
 
        return keywords.InList(s);
 }
 
+// Note: as lexer uses chars, UTF-8 bytes are considered as <0 values
+// Note: iswordchar() was used in only one place in LexPerl, it is
+// unnecessary as '.' is processed as the concatenation operator, so
+// only isWordStart() is used in LexPerl
+
+static inline bool isWordStart(char ch) {
+       return !isascii(ch) || isalnum(ch) || ch == '_';
+}
+
 static inline bool isEndVar(char ch) {
 static inline bool isEndVar(char ch) {
-       return !isalnum(ch) && ch != '#' && ch != '$' &&
+       return isascii(ch) && !isalnum(ch) && ch != '#' && ch != '$' &&
               ch != '_' && ch != '\'';
 }
 
               ch != '_' && ch != '\'';
 }
 
-
 static inline bool isNonQuote(char ch) {
 static inline bool isNonQuote(char ch) {
-       return isalnum(ch) || ch == '_';
+       return !isascii(ch) || isalnum(ch) || ch == '_';
 }
 
 static inline char actualNumStyle(int numberStyle) {
 }
 
 static inline char actualNumStyle(int numberStyle) {
@@ -121,6 +133,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
 
        WordList &keywords = *keywordlists[0];
 
 
        WordList &keywords = *keywordlists[0];
 
+    // keywords that forces /PATTERN/ at all times
+    WordList reWords;
+    reWords.Set("elsif if split while");
+
        class HereDocCls {
        public:
                int State;              // 0: '<<' encountered
        class HereDocCls {
        public:
                int State;              // 0: '<<' encountered
@@ -175,6 +191,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
        //char sooked[100];
        //sooked[sookedpos] = '\0';
 
        //char sooked[100];
        //sooked[sookedpos] = '\0';
 
+       styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
        // If in a long distance lexical state, seek to the beginning to find quote characters
        // Perl strings can be multi-line with embedded newlines, so backtrack.
        // Perl numbers have additional state during lexing, so backtrack too.
        // If in a long distance lexical state, seek to the beginning to find quote characters
        // Perl strings can be multi-line with embedded newlines, so backtrack.
        // Perl numbers have additional state during lexing, so backtrack too.
@@ -185,6 +202,14 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                startPos = styler.LineStart(styler.GetLine(startPos));
                state = styler.StyleAt(startPos - 1);
        }
                startPos = styler.LineStart(styler.GetLine(startPos));
                state = styler.StyleAt(startPos - 1);
        }
+    // Backtrack for format body.
+       if (state == SCE_PL_FORMAT) {
+               while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_PL_FORMAT_IDENT)) {
+                       startPos--;
+               }
+               startPos = styler.LineStart(styler.GetLine(startPos));
+               state = styler.StyleAt(startPos - 1);
+       }
        if ( state == SCE_PL_STRING_Q
        || state == SCE_PL_STRING_QQ
        || state == SCE_PL_STRING_QX
        if ( state == SCE_PL_STRING_Q
        || state == SCE_PL_STRING_QQ
        || state == SCE_PL_STRING_QX
@@ -198,6 +223,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
        || state == SCE_PL_NUMBER
        || state == SCE_PL_IDENTIFIER
     || state == SCE_PL_ERROR
        || state == SCE_PL_NUMBER
        || state == SCE_PL_IDENTIFIER
     || state == SCE_PL_ERROR
+    || state == SCE_PL_SUB_PROTOTYPE
        ) {
                while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
                        startPos--;
        ) {
                while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
                        startPos--;
@@ -221,7 +247,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
             backflag = BACK_KEYWORD;
     }
 
             backflag = BACK_KEYWORD;
     }
 
-       styler.StartAt(startPos);
+       styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
        char chPrev = styler.SafeGetCharAt(startPos - 1);
        if (startPos == 0)
                chPrev = '\n';
        char chPrev = styler.SafeGetCharAt(startPos - 1);
        if (startPos == 0)
                chPrev = '\n';
@@ -282,9 +308,15 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                }
                        }
                }
                                }
                        }
                }
+        if (HereDoc.State == 4 && isEOLChar(ch)) {
+            // Start of format body.
+            HereDoc.State = 0;
+            styler.ColourTo(i - 1, state);
+            state = SCE_PL_FORMAT;
+        }
 
                if (state == SCE_PL_DEFAULT) {
 
                if (state == SCE_PL_DEFAULT) {
-                       if (isdigit(ch) || (isdigit(chNext) &&
+                       if ((isascii(ch) && isdigit(ch)) || (isascii(chNext) && isdigit(chNext) &&
                                (ch == '.' || ch == 'v'))) {
                                state = SCE_PL_NUMBER;
                 backflag = BACK_NONE;
                                (ch == '.' || ch == 'v'))) {
                                state = SCE_PL_NUMBER;
                 backflag = BACK_NONE;
@@ -295,7 +327,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                numState = PERLNUM_HEX;
                                        } else if (chNext == 'b') {
                         numState = PERLNUM_BINARY;
                                                numState = PERLNUM_HEX;
                                        } else if (chNext == 'b') {
                         numState = PERLNUM_BINARY;
-                    } else if (isdigit(chNext)) {
+                    } else if (isascii(chNext) && isdigit(chNext)) {
                         numState = PERLNUM_OCTAL;
                     }
                     if (numState != PERLNUM_DECIMAL) {
                         numState = PERLNUM_OCTAL;
                     }
                     if (numState != PERLNUM_DECIMAL) {
@@ -306,7 +338,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                } else if (ch == 'v') { // vector
                                        numState = PERLNUM_V_VECTOR;
                                }
                                } else if (ch == 'v') { // vector
                                        numState = PERLNUM_V_VECTOR;
                                }
-                       } else if (iswordstart(ch)) {
+                       } else if (isWordStart(ch)) {
                 // if immediately prefixed by '::', always a bareword
                 state = SCE_PL_WORD;
                 if (chPrev == ':' && styler.SafeGetCharAt(i - 2) == ':') {
                 // if immediately prefixed by '::', always a bareword
                 state = SCE_PL_WORD;
                 if (chPrev == ':' && styler.SafeGetCharAt(i - 2) == ':') {
@@ -338,7 +370,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        Quote.New(1);
                     kw++;
                                } else if (ch == 'x' && (chNext == '=' ||       // repetition
                                        Quote.New(1);
                     kw++;
                                } else if (ch == 'x' && (chNext == '=' ||       // repetition
-                           (chNext != '_' && !isalnum(chNext)) ||
+                           !isWordStart(chNext) ||
                            (isdigit(chPrev) && isdigit(chNext)))) {
                     state = SCE_PL_OPERATOR;
                 }
                            (isdigit(chPrev) && isdigit(chNext)))) {
                     state = SCE_PL_OPERATOR;
                 }
@@ -347,7 +379,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                 // otherwise it is always a bareword and we skip a lot of scanning
                 // note: keywords assumed to be limited to [_a-zA-Z] only
                 if (state == SCE_PL_WORD) {
                 // otherwise it is always a bareword and we skip a lot of scanning
                 // note: keywords assumed to be limited to [_a-zA-Z] only
                 if (state == SCE_PL_WORD) {
-                    while (iswordstart(styler.SafeGetCharAt(kw))) kw++;
+                    while (isWordStart(styler.SafeGetCharAt(kw))) kw++;
                     if (!isPerlKeyword(styler.GetStartSegment(), kw, keywords, styler)) {
                         state = SCE_PL_IDENTIFIER;
                     }
                     if (!isPerlKeyword(styler.GetStartSegment(), kw, keywords, styler)) {
                         state = SCE_PL_IDENTIFIER;
                     }
@@ -371,7 +403,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                         if (ch2 == '{' && !moreback) {
                             // {bareword: possible variable spec
                             brace = true;
                         if (ch2 == '{' && !moreback) {
                             // {bareword: possible variable spec
                             brace = true;
-                        } else if ((ch2 == '&')
+                        } else if ((ch2 == '&' && styler.SafeGetCharAt(j - 1) != '&')
                                 // &bareword: subroutine call
                                 || (ch2 == '>' && styler.SafeGetCharAt(j - 1) == '-')
                                 // ->bareword: part of variable spec
                                 // &bareword: subroutine call
                                 || (ch2 == '>' && styler.SafeGetCharAt(j - 1) == '-')
                                 // ->bareword: part of variable spec
@@ -403,7 +435,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                 backflag = BACK_NONE;
                 // an identifier or bareword
                 if (state == SCE_PL_IDENTIFIER) {
                 backflag = BACK_NONE;
                 // an identifier or bareword
                 if (state == SCE_PL_IDENTIFIER) {
-                    if ((!iswordchar(chNext) && chNext != '\'')
+                    if ((!isWordStart(chNext) && chNext != '\'')
                         || (chNext == '.' && chNext2 == '.')) {
                         // We need that if length of word == 1!
                         // This test is copied from the SCE_PL_WORD handler.
                         || (chNext == '.' && chNext2 == '.')) {
                         // We need that if length of word == 1!
                         // This test is copied from the SCE_PL_WORD handler.
@@ -419,8 +451,13 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                         styler.ColourTo(i, SCE_PL_DATASECTION);
                         state = SCE_PL_DATASECTION;
                     } else {
                         styler.ColourTo(i, SCE_PL_DATASECTION);
                         state = SCE_PL_DATASECTION;
                     } else {
+                        if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "format")) {
+                            state = SCE_PL_FORMAT_IDENT;
+                            HereDoc.State = 0;
+                        } else {
+                            state = SCE_PL_DEFAULT;
+                        }
                         styler.ColourTo(i, SCE_PL_WORD);
                         styler.ColourTo(i, SCE_PL_WORD);
-                        state = SCE_PL_DEFAULT;
                         backflag = BACK_KEYWORD;
                         backPos = i;
                     }
                         backflag = BACK_KEYWORD;
                         backPos = i;
                     }
@@ -428,8 +465,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                     chNext = styler.SafeGetCharAt(i + 1);
                 // a repetition operator 'x'
                 } else if (state == SCE_PL_OPERATOR) {
                     chNext = styler.SafeGetCharAt(i + 1);
                 // a repetition operator 'x'
                 } else if (state == SCE_PL_OPERATOR) {
-                    styler.ColourTo(i, SCE_PL_OPERATOR);
                     state = SCE_PL_DEFAULT;
                     state = SCE_PL_DEFAULT;
+                    goto handleOperator;
                 // quote-like delimiter, skip one char if double-char delimiter
                 } else {
                     i = kw - 1;
                 // quote-like delimiter, skip one char if double-char delimiter
                 } else {
                     i = kw - 1;
@@ -462,7 +499,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        styler.ColourTo(i, SCE_PL_SCALAR);
                                } else {
                                        state = SCE_PL_SCALAR;
                                        styler.ColourTo(i, SCE_PL_SCALAR);
                                } else {
                                        state = SCE_PL_SCALAR;
-                                       if (chNext == '`' && chNext2 == '`') {
+                                       if ((chNext == '`' && chNext2 == '`')
+                     || (chNext == ':' && chNext2 == ':')) {
                                                i += 2;
                                                ch = styler.SafeGetCharAt(i);
                                                chNext = styler.SafeGetCharAt(i + 1);
                                                i += 2;
                                                ch = styler.SafeGetCharAt(i);
                                                chNext = styler.SafeGetCharAt(i + 1);
@@ -474,9 +512,14 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                }
                 backflag = BACK_NONE;
                        } else if (ch == '@') {
                                }
                 backflag = BACK_NONE;
                        } else if (ch == '@') {
-                               if (isalpha(chNext) || chNext == '#' || chNext == '$'
+                               if (!isascii(chNext) || isalpha(chNext) || chNext == '#' || chNext == '$'
                                        || chNext == '_' || chNext == '+' || chNext == '-') {
                                        state = SCE_PL_ARRAY;
                                        || chNext == '_' || chNext == '+' || chNext == '-') {
                                        state = SCE_PL_ARRAY;
+                } else if (chNext == ':' && chNext2 == ':') {
+                    state = SCE_PL_ARRAY;
+                    i += 2;
+                    ch = styler.SafeGetCharAt(i);
+                    chNext = styler.SafeGetCharAt(i + 1);
                                } else if (chNext != '{' && chNext != '[') {
                                        styler.ColourTo(i, SCE_PL_ARRAY);
                                } else {
                                } else if (chNext != '{' && chNext != '[') {
                                        styler.ColourTo(i, SCE_PL_ARRAY);
                                } else {
@@ -484,24 +527,35 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                }
                 backflag = BACK_NONE;
                        } else if (ch == '%') {
                                }
                 backflag = BACK_NONE;
                        } else if (ch == '%') {
-                               if (isalpha(chNext) || chNext == '#' || chNext == '$'
+                backflag = BACK_NONE;
+                               if (!isascii(chNext) || isalpha(chNext) || chNext == '#' || chNext == '$'
                     || chNext == '_' || chNext == '!' || chNext == '^') {
                                        state = SCE_PL_HASH;
                     i++;
                     ch = chNext;
                     chNext = chNext2;
                     || chNext == '_' || chNext == '!' || chNext == '^') {
                                        state = SCE_PL_HASH;
                     i++;
                     ch = chNext;
                     chNext = chNext2;
+                } else if (chNext == ':' && chNext2 == ':') {
+                    state = SCE_PL_HASH;
+                    i += 2;
+                    ch = styler.SafeGetCharAt(i);
+                    chNext = styler.SafeGetCharAt(i + 1);
                                } else if (chNext == '{') {
                                        styler.ColourTo(i, SCE_PL_HASH);
                                } else {
                                } else if (chNext == '{') {
                                        styler.ColourTo(i, SCE_PL_HASH);
                                } else {
-                                       styler.ColourTo(i, SCE_PL_OPERATOR);
+                    goto handleOperator;
                                }
                                }
-                backflag = BACK_NONE;
                        } else if (ch == '*') {
                        } else if (ch == '*') {
+                backflag = BACK_NONE;
                 char strch[2];
                 strch[0] = chNext;
                 strch[1] = '\0';
                 char strch[2];
                 strch[0] = chNext;
                 strch[1] = '\0';
-                               if (isalpha(chNext) || chNext == '_' ||
-                    NULL != strstr("^/|,\\\";#%^:?<>)[]", strch)) {
+                if (chNext == ':' && chNext2 == ':') {
+                    state = SCE_PL_SYMBOLTABLE;
+                    i += 2;
+                    ch = styler.SafeGetCharAt(i);
+                    chNext = styler.SafeGetCharAt(i + 1);
+                               } else if (!isascii(chNext) || isalpha(chNext) || chNext == '_'
+                        || NULL != strstr("^/|,\\\";#%^:?<>)[]", strch)) {
                                        state = SCE_PL_SYMBOLTABLE;
                     i++;
                     ch = chNext;
                                        state = SCE_PL_SYMBOLTABLE;
                     i++;
                     ch = chNext;
@@ -514,9 +568,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                ch = chNext;
                                                chNext = chNext2;
                                        }
                                                ch = chNext;
                                                chNext = chNext2;
                                        }
-                                       styler.ColourTo(i, SCE_PL_OPERATOR);
+                    goto handleOperator;
                                }
                                }
-                backflag = BACK_NONE;
                        } else if (ch == '/' || (ch == '<' && chNext == '<')) {
                                // Explicit backward peeking to set a consistent preferRE for
                                // any slash found, so no longer need to track preferRE state.
                        } else if (ch == '/' || (ch == '<' && chNext == '<')) {
                                // Explicit backward peeking to set a consistent preferRE for
                                // any slash found, so no longer need to track preferRE state.
@@ -528,6 +581,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                 bool hereDocSpace = false;      // these are for corner case:
                 bool hereDocScalar = false;     // SCALAR [whitespace] '<<'
                                unsigned int bk = (i > 0)? i - 1: 0;
                 bool hereDocSpace = false;      // these are for corner case:
                 bool hereDocScalar = false;     // SCALAR [whitespace] '<<'
                                unsigned int bk = (i > 0)? i - 1: 0;
+                unsigned int bkend;
                                char bkch;
                                styler.Flush();
                 if (styler.StyleAt(bk) == SCE_PL_DEFAULT)
                                char bkch;
                                styler.Flush();
                 if (styler.StyleAt(bk) == SCE_PL_DEFAULT)
@@ -603,26 +657,21 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                        if (bkstyle == SCE_PL_DEFAULT ||
                                                            bkstyle == SCE_PL_COMMENTLINE) {
                                                        } else if (bkstyle == SCE_PL_OPERATOR) {
                                                        if (bkstyle == SCE_PL_DEFAULT ||
                                                            bkstyle == SCE_PL_COMMENTLINE) {
                                                        } else if (bkstyle == SCE_PL_OPERATOR) {
-                                                               // gcc 3.2.3 bloats if more compact form used
                                                                bkch = styler.SafeGetCharAt(bk);
                                                                bkch = styler.SafeGetCharAt(bk);
-                                                               if (bkch == '>') { // "->"
-                                                                       if (styler.SafeGetCharAt(bk - 1) == '-') {
-                                                                               preferRE = false;
-                                                                               break;
-                                                                       }
-                                                               } else if (bkch == ':') { // "::"
-                                                                       if (styler.SafeGetCharAt(bk - 1) == ':') {
-                                                                               preferRE = false;
-                                                                               break;
-                                                                       }
-                                                               }
-                                                       } else {// bare identifier, usually a function call but Perl
-                                                               // optimizes them as pseudo-constants, then the next
-                                                               // '/' will be a divide; favour divide over regex
-                                                               // if there is a whitespace after the '/'
-                                                               if (isspacechar(chNext)) {
-                                                                       preferRE = false;
+                                // test for "->" and "::"
+                                                               if ((bkch == '>' && styler.SafeGetCharAt(bk - 1) == '-')
+                                 || (bkch == ':' && styler.SafeGetCharAt(bk - 1) == ':')) {
+                                    preferRE = false;
+                                    break;
                                                                }
                                                                }
+                                                       } else {
+                                // bare identifier, if '/', /PATTERN/ unless digit/space immediately after '/'
+                                                               if (!isHereDoc &&
+                                    (isspacechar(chNext) || isdigit(chNext)))
+                                    preferRE = false;
+                                                               // HERE docs cannot have a space after the >>
+                                if (isspacechar(chNext))
+                                    preferRE = false;
                                                                break;
                                                        }
                                                        bk--;
                                                                break;
                                                        }
                                                        bk--;
@@ -631,8 +680,24 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                     case SCE_PL_SCALAR:     // for $var<< case
                         hereDocScalar = true;
                         break;
                     case SCE_PL_SCALAR:     // for $var<< case
                         hereDocScalar = true;
                         break;
-                                       // other styles uses the default, preferRE=false
+                    // for HERE docs, always true for preferRE
                                        case SCE_PL_WORD:
                                        case SCE_PL_WORD:
+                        preferRE = true;
+                        if (isHereDoc)
+                            break;
+                        // adopt heuristics similar to vim-style rules:
+                        // keywords always forced as /PATTERN/: split, if, elsif, while
+                        // everything else /PATTERN/ unless digit/space immediately after '/'
+                        bkend = bk + 1;
+                                               while (bk > 0 && styler.StyleAt(bk-1) == SCE_PL_WORD) {
+                                                       bk--;
+                                               }
+                        if (isPerlKeyword(bk, bkend, reWords, styler))
+                            break;
+                        if (isspacechar(chNext) || isdigit(chNext))
+                            preferRE = false;
+                        break;
+                                       // other styles uses the default, preferRE=false
                                        case SCE_PL_POD:
                                        case SCE_PL_POD_VERB:
                                        case SCE_PL_HERE_Q:
                                        case SCE_PL_POD:
                                        case SCE_PL_POD_VERB:
                                        case SCE_PL_HERE_Q:
@@ -642,6 +707,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                break;
                                        }
                                }
                                                break;
                                        }
                                }
+                backflag = BACK_NONE;
                 if (isHereDoc) {    // handle HERE doc
                     // if SCALAR whitespace '<<', *always* a HERE doc
                     if (preferRE || (hereDocSpace && hereDocScalar)) {
                 if (isHereDoc) {    // handle HERE doc
                     // if SCALAR whitespace '<<', *always* a HERE doc
                     if (preferRE || (hereDocSpace && hereDocScalar)) {
@@ -651,7 +717,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                i++;
                                                ch = chNext;
                                                chNext = chNext2;
                                                i++;
                                                ch = chNext;
                                                chNext = chNext2;
-                        styler.ColourTo(i, SCE_PL_OPERATOR);
+                        goto handleOperator;
                     }
                 } else {            // handle regexp
                     if (preferRE) {
                     }
                 } else {            // handle regexp
                     if (preferRE) {
@@ -659,10 +725,9 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                         Quote.New(1);
                         Quote.Open(ch);
                     } else {        // / operator
                         Quote.New(1);
                         Quote.Open(ch);
                     } else {        // / operator
-                        styler.ColourTo(i, SCE_PL_OPERATOR);
+                        goto handleOperator;
                     }
                 }
                     }
                 }
-                backflag = BACK_NONE;
                        } else if (ch == '<') {
                                // looks forward for matching > on same line
                                unsigned int fw = i + 1;
                        } else if (ch == '<') {
                                // looks forward for matching > on same line
                                unsigned int fw = i + 1;
@@ -671,24 +736,23 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        if (fwch == ' ') {
                                                if (styler.SafeGetCharAt(fw-1) != '\\' ||
                                                    styler.SafeGetCharAt(fw-2) != '\\')
                                        if (fwch == ' ') {
                                                if (styler.SafeGetCharAt(fw-1) != '\\' ||
                                                    styler.SafeGetCharAt(fw-2) != '\\')
-                                               break;
+                                               goto handleOperator;
                                        } else if (isEOLChar(fwch) || isspacechar(fwch)) {
                                        } else if (isEOLChar(fwch) || isspacechar(fwch)) {
-                                               break;
+                                               goto handleOperator;
                                        } else if (fwch == '>') {
                                                if ((fw - i) == 2 &&    // '<=>' case
                                                    styler.SafeGetCharAt(fw-1) == '=') {
                                        } else if (fwch == '>') {
                                                if ((fw - i) == 2 &&    // '<=>' case
                                                    styler.SafeGetCharAt(fw-1) == '=') {
-                                                       styler.ColourTo(fw, SCE_PL_OPERATOR);
-                                               } else {
-                                                       styler.ColourTo(fw, SCE_PL_IDENTIFIER);
+                            goto handleOperator;
                                                }
                                                }
+                        styler.ColourTo(fw, SCE_PL_IDENTIFIER);
                                                i = fw;
                                                ch = fwch;
                                                chNext = styler.SafeGetCharAt(i+1);
                                        }
                                        fw++;
                                }
                                                i = fw;
                                                ch = fwch;
                                                chNext = styler.SafeGetCharAt(i+1);
                                        }
                                        fw++;
                                }
-                               styler.ColourTo(i, SCE_PL_OPERATOR);
-                backflag = BACK_NONE;
+                if (fw == lengthDoc)
+                    goto handleOperator;
                        } else if (ch == '='    // POD
                                   && isalpha(chNext)
                                   && (isEOLChar(chPrev))) {
                        } else if (ch == '='    // POD
                                   && isalpha(chNext)
                                   && (isEOLChar(chPrev))) {
@@ -705,6 +769,35 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                ch = chNext;
                                chNext = chNext2;
                 backflag = BACK_NONE;
                                ch = chNext;
                                chNext = chNext2;
                 backflag = BACK_NONE;
+            } else if (ch == '-'    // bareword promotion (-FOO cases)
+                       && ((isascii(chNext) && isalpha(chNext)) || chNext == '_')
+                       && backflag != BACK_NONE) {
+                               state = SCE_PL_IDENTIFIER;
+                backflag = BACK_NONE;
+            } else if (ch == '(' && i > 0) {
+                // backtrack to identify if we're starting a sub prototype
+                // for generality, we need to ignore whitespace/comments
+                               unsigned int bk = i - 1;    // i > 0 tested above
+                               styler.Flush();
+                               while (bk > 0 && (styler.StyleAt(bk) == SCE_PL_DEFAULT ||
+                       styler.StyleAt(bk) == SCE_PL_COMMENTLINE)) {
+                                       bk--;
+                               }
+                if (bk == 0 || styler.StyleAt(bk) != SCE_PL_IDENTIFIER) // check identifier
+                    goto handleOperator;
+                               while (bk > 0 && (styler.StyleAt(bk) == SCE_PL_IDENTIFIER)) {
+                                       bk--;
+                               }
+                               while (bk > 0 && (styler.StyleAt(bk) == SCE_PL_DEFAULT ||
+                       styler.StyleAt(bk) == SCE_PL_COMMENTLINE)) {
+                                       bk--;
+                               }
+                if (bk < 2 || styler.StyleAt(bk) != SCE_PL_WORD // check "sub" keyword
+                    || !styler.Match(bk - 2, "sub"))    // assume suffix is unique!
+                    goto handleOperator;
+                state = SCE_PL_SUB_PROTOTYPE;
+                backflag = BACK_NONE;
+                backPos = i;    // needed for restart
                        } else if (isPerlOperator(ch)) {
                                if (ch == '.' && chNext == '.') { // .. and ...
                                        i++;
                        } else if (isPerlOperator(ch)) {
                                if (ch == '.' && chNext == '.') { // .. and ...
                                        i++;
@@ -713,10 +806,14 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        ch = styler.SafeGetCharAt(i);
                                        chNext = styler.SafeGetCharAt(i + 1);
                                }
                                        ch = styler.SafeGetCharAt(i);
                                        chNext = styler.SafeGetCharAt(i + 1);
                                }
+        handleOperator:
                                styler.ColourTo(i, SCE_PL_OPERATOR);
                 backflag = BACK_OPERATOR;
                 backPos = i;
                                styler.ColourTo(i, SCE_PL_OPERATOR);
                 backflag = BACK_OPERATOR;
                 backPos = i;
-                       } else {
+                       } else if (ch == 4 || ch == 26) {    // ^D and ^Z ends valid perl source
+                styler.ColourTo(i, SCE_PL_DATASECTION);
+                state = SCE_PL_DATASECTION;
+            } else {
                                // keep colouring defaults to make restart easier
                                styler.ColourTo(i, SCE_PL_DEFAULT);
                        }
                                // keep colouring defaults to make restart easier
                                styler.ColourTo(i, SCE_PL_DEFAULT);
                        }
@@ -728,8 +825,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                } else if (numState <= PERLNUM_FLOAT) {
                                        // non-decimal number or float exponent, consume next dot
                                        styler.ColourTo(i - 1, SCE_PL_NUMBER);
                                } else if (numState <= PERLNUM_FLOAT) {
                                        // non-decimal number or float exponent, consume next dot
                                        styler.ColourTo(i - 1, SCE_PL_NUMBER);
-                                       styler.ColourTo(i, SCE_PL_OPERATOR);
                                        state = SCE_PL_DEFAULT;
                                        state = SCE_PL_DEFAULT;
+                    goto handleOperator;
                                } else { // decimal or vectors allows dots
                                        dotCount++;
                                        if (numState == PERLNUM_DECIMAL) {
                                } else { // decimal or vectors allows dots
                                        dotCount++;
                                        if (numState == PERLNUM_DECIMAL) {
@@ -744,13 +841,11 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                        goto numAtEnd;
                                        }
                                }
                                                        goto numAtEnd;
                                        }
                                }
-                       } else if (ch == '_' && numState == PERLNUM_DECIMAL) {
-                               if (!isdigit(chNext)) {
-                                       goto numAtEnd;
-                               }
-                       } else if (isalnum(ch)) {
+                       } else if (ch == '_') {
+                // permissive underscoring for number and vector literals
+                       } else if (!isascii(ch) || isalnum(ch)) {
                                if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) {
                                if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) {
-                                       if (isalpha(ch)) {
+                                       if (!isascii(ch) || isalpha(ch)) {
                                                if (dotCount == 0) { // change to word
                                                        state = SCE_PL_IDENTIFIER;
                                                } else { // vector then word
                                                if (dotCount == 0) { // change to word
                                                        state = SCE_PL_IDENTIFIER;
                                                } else { // vector then word
@@ -765,7 +860,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                        ch = chNext;
                                                        chNext = chNext2;
                                                }
                                                        ch = chNext;
                                                        chNext = chNext2;
                                                }
-                                       } else if (!isdigit(ch)) { // number then word
+                                       } else if (!isascii(ch) || !isdigit(ch)) { // number then word
                                                goto numAtEnd;
                                        }
                                } else if (numState == PERLNUM_FLOAT) {
                                                goto numAtEnd;
                                        }
                                } else if (numState == PERLNUM_FLOAT) {
@@ -798,7 +893,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                goto restartLexer;
                        }
                } else if (state == SCE_PL_IDENTIFIER) {
                                goto restartLexer;
                        }
                } else if (state == SCE_PL_IDENTIFIER) {
-                       if (!iswordstart(chNext) && chNext != '\'') {
+                       if (!isWordStart(chNext) && chNext != '\'') {
                                styler.ColourTo(i, SCE_PL_IDENTIFIER);
                                state = SCE_PL_DEFAULT;
                                ch = ' ';
                                styler.ColourTo(i, SCE_PL_IDENTIFIER);
                                state = SCE_PL_DEFAULT;
                                ch = ' ';
@@ -871,6 +966,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                         i = oldi;
                                                styler.ColourTo(i, SCE_PL_OPERATOR);
                                                state = SCE_PL_DEFAULT;
                         i = oldi;
                                                styler.ColourTo(i, SCE_PL_OPERATOR);
                                                state = SCE_PL_DEFAULT;
+                        backflag = BACK_OPERATOR;
+                        backPos = i;
                                                HereDoc.State = 0;
                         goto restartLexer;
                                        } else {
                                                HereDoc.State = 0;
                         goto restartLexer;
                                        } else {
@@ -994,7 +1091,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                }
                                        } else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
                                                Quote.Count++;
                                                }
                                        } else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
                                                Quote.Count++;
-                                       } else if (!isalpha(chNext)) {
+                                       } else if (!isascii(chNext) || !isalpha(chNext)) {
                                                if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
@@ -1028,7 +1125,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                if (isspacechar(ch)) {
                                                        // Keep going
                                                }
                                                if (isspacechar(ch)) {
                                                        // Keep going
                                                }
-                                               else if (isalnum(ch)) {
+                                               else if (!isascii(ch) || isalnum(ch)) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
@@ -1040,7 +1137,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                if (Quote.Count == 0) {
                                                        Quote.Rep--;
                                                }
                                                if (Quote.Count == 0) {
                                                        Quote.Rep--;
                                                }
-                                               if (!isalpha(chNext)) {
+                                               if (!isascii(chNext) || !isalpha(chNext)) {
                                                        if (Quote.Rep <= 0) {
                                                                styler.ColourTo(i, state);
                                                                state = SCE_PL_DEFAULT;
                                                        if (Quote.Rep <= 0) {
                                                                styler.ColourTo(i, state);
                                                                state = SCE_PL_DEFAULT;
@@ -1052,7 +1149,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                }
                                        } else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
                                                Quote.Count++;
                                                }
                                        } else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
                                                Quote.Count++;
-                                       } else if (!isalpha(chNext)) {
+                                       } else if (!isascii(chNext) || !isalpha(chNext)) {
                                                if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
@@ -1090,7 +1187,63 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                } else if (ch == Quote.Up) {
                                        Quote.Count++;
                                }
                                } else if (ch == Quote.Up) {
                                        Quote.Count++;
                                }
-                       }
+                       } else if (state == SCE_PL_SUB_PROTOTYPE) {
+                char strch[2];
+                strch[0] = ch;
+                strch[1] = '\0';
+                if (NULL != strstr("\\[$@%&*];", strch)) {
+                    // keep going
+                } else if (ch == ')') {
+                    styler.ColourTo(i, state);
+                    state = SCE_PL_DEFAULT;
+                } else {
+                    // abandon prototype, restart from '('
+                    i = backPos;
+                    styler.ColourTo(i, SCE_PL_OPERATOR);
+                                       ch = styler.SafeGetCharAt(i);
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                    state = SCE_PL_DEFAULT;
+                }
+            } else if (state == SCE_PL_FORMAT_IDENT) {
+                // occupies different HereDoc states to avoid clashing with HERE docs
+                if (HereDoc.State == 0) {
+                    if ((isascii(ch) && isalpha(ch)) || ch == '_'   // probable identifier
+                        || ch == '=') {                             // no identifier
+                        HereDoc.State = 3;
+                        HereDoc.Quoted = false; // whitespace flag
+                    } else if (ch == ' ' || ch == '\t') {
+                        styler.ColourTo(i, SCE_PL_DEFAULT);
+                    } else {
+                        state = SCE_PL_DEFAULT;
+                        HereDoc.State = 0;
+                        goto restartLexer;
+                    }
+                }
+                if (HereDoc.State == 3) {   // with just a '=', state goes 0->3->4
+                    if (ch == '=') {
+                        styler.ColourTo(i, SCE_PL_FORMAT_IDENT);
+                        state = SCE_PL_DEFAULT;
+                        HereDoc.State = 4;
+                    } else if (ch == ' ' || ch == '\t') {
+                        HereDoc.Quoted = true;
+                    } else if (isEOLChar(ch) || (HereDoc.Quoted && ch != '=')) {
+                        // abandon format, restart from after 'format'
+                        i = backPos + 1;
+                        ch = styler.SafeGetCharAt(i);
+                        chNext = styler.SafeGetCharAt(i + 1);
+                        state = SCE_PL_DEFAULT;
+                        HereDoc.State = 0;
+                    }
+                }
+            } else if (state == SCE_PL_FORMAT) {
+                if (isEOLChar(chPrev)) {
+                    styler.ColourTo(i - 1, state);
+                    if (ch == '.' && isEOLChar(chNext)) {
+                        styler.ColourTo(i, state);
+                        state = SCE_PL_DEFAULT;
+                    }
+                }
+            }
                }
                if (state == SCE_PL_ERROR) {
                        break;
                }
                if (state == SCE_PL_ERROR) {
                        break;
@@ -1228,5 +1381,5 @@ static const char * const perlWordListDesc[] = {
        0
 };
 
        0
 };
 
-LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", FoldPerlDoc, perlWordListDesc);
+LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", FoldPerlDoc, perlWordListDesc, 8);
 
 
diff --git a/src/stc/scintilla/src/LexProgress.cxx b/src/stc/scintilla/src/LexProgress.cxx
new file mode 100644 (file)
index 0000000..3b3a445
--- /dev/null
@@ -0,0 +1,271 @@
+// Scintilla source code edit control
+/** @file LexProgress.cxx
+ **  Lexer for Progress 4GL.
+ ** Based on LexCPP.cxx of Neil Hodgson <neilh@scintilla.org>
+  **/
+// Copyright 2006-2007 by Yuval Papish <Yuval@YuvCom.com>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+/** TODO:
+WebSpeed support in html lexer
+Support "end triggers" expression of the triggers phrase
+change lmPS to lmProgress
+Support more than 6 comments levels
+**/
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#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(int ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '_');
+}
+
+static inline bool IsAWordStart(int ch) {
+       return (ch < 0x80) && (isalpha(ch) || ch == '_');
+}
+
+enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0
+
+static void Colourise4glDoc(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];
+    //WordList &keywords5 = *keywordlists[4];
+
+       int visibleChars = 0;
+       int mask;
+
+       StyleContext sc(startPos, length, initStyle, styler);
+
+       for (; sc.More(); sc.Forward()) {
+
+               if (sc.atLineStart) {
+                       // Reset states to begining of colourise so no surprises
+                       // if different sets of lines lexed.
+                       visibleChars = 0;
+               }
+
+               // Handle line continuation generically.
+               if (sc.ch == '~') {
+                       // Skip whitespace between ~ and EOL
+       /*              do {
+                               sc.Forward();
+                       } */
+                       while ((sc.chNext == ' ' || sc.chNext == '\t') ) {
+                               sc.Forward();
+                               sc.More();
+                       }
+                       if (sc.chNext == '\n' || sc.chNext == '\r') {
+                               sc.Forward();
+                               if (sc.ch == '\r' && sc.chNext == '\n') {
+                                       sc.Forward();
+                               }
+                               sc.Forward();
+                               continue;
+                       }
+               }
+               // Determine if a new state should be terminated.
+               mask = sc.state & 0x10;
+               switch (sc.state & 0xf) {
+                       case SCE_4GL_OPERATOR:
+                               sc.SetState(SCE_4GL_DEFAULT | mask);
+                               break;
+                       case SCE_4GL_NUMBER:
+                               if (!(IsADigit(sc.ch))) {
+                                       sc.SetState(SCE_4GL_DEFAULT | mask);
+                               }
+                               break;
+                       case SCE_4GL_IDENTIFIER:
+                               if (!IsAWordChar(sc.ch) && sc.ch != '-') {
+                                       char s[1000];
+                                       sc.GetCurrentLowered(s, sizeof(s));
+                                       if (((sc.state & 0x10) == 0) && keywords2.InList(s) || keywords3.InList(s)) {
+                                               sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart);
+                                       }
+                                       else if (keywords1.InList(s)) {
+                                               if ((s[0] == 'e' && s[1] =='n' && s[2] == 'd' && !isalnum(s[3]) && s[3] != '-') ||
+                                                       (s[0] == 'f' && s[1] =='o' && s[2] == 'r' && s[3] == 'w' && s[4] =='a' && s[5] == 'r' && s[6] == 'd'&& !isalnum(s[7]))) {
+                                                       sc.ChangeState(SCE_4GL_END | ResetSentenceStart);
+                                               }
+                                               else if ((s[0] == 'e' && s[1] =='l' && s[2] == 's' && s[3] == 'e') ||
+                                                                (s[0] == 't' && s[1] =='h' && s[2] == 'e' && s[3] == 'n')) {
+                                                       sc.ChangeState(SCE_4GL_WORD & SetSentenceStart);
+                                               }
+                                               else {
+                                                       sc.ChangeState(SCE_4GL_WORD | ResetSentenceStart);
+                                               }
+                                       }
+                                       sc.SetState(SCE_4GL_DEFAULT | (sc.state & 0x10));
+                               }
+                               break;
+                       case SCE_4GL_PREPROCESSOR:
+                               if (sc.atLineStart) {
+                                       sc.SetState(SCE_4GL_DEFAULT & SetSentenceStart);
+                               } else if (sc.ch == '*' && sc.chNext == '/') {
+                                       sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
+                               }
+                               break;
+                       case SCE_4GL_STRING:
+                               if (sc.ch == '\"') {
+                                       sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
+                               }
+                               break;
+                       case SCE_4GL_CHARACTER:
+                               if (sc.ch == '\'') {
+                                       sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
+                               }
+                               break;
+                       default:
+                               if ((sc.state & 0xf) >= SCE_4GL_COMMENT1) {
+                                       if (sc.ch == '*' && sc.chNext == '/') {
+                                               sc.Forward();
+                                               if ((sc.state & 0xf) == SCE_4GL_COMMENT1) {
+                                                       sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
+                                               }
+                                               else
+                                                       sc.SetState((sc.state & 0x1f) - 1);
+                                       } else if (sc.ch == '/' && sc.chNext == '*') {
+                                               sc.Forward();
+                                               sc.SetState((sc.state & 0x1f) + 1);
+                                       }
+                               }
+               }
+
+               // Determine if a new state should be entered.
+               mask = sc.state & 0x10;
+               if ((sc.state & 0xf) == SCE_4GL_DEFAULT) {
+                       if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
+                               sc.SetState(SCE_4GL_NUMBER | ResetSentenceStart);
+                       } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
+                               sc.SetState(SCE_4GL_IDENTIFIER | mask);
+                       } else if (sc.ch == '/' && sc.chNext == '*') {
+                               sc.SetState(SCE_4GL_COMMENT1 | mask);
+                               sc.Forward();
+                       } else if (sc.ch == '\"') {
+                               sc.SetState(SCE_4GL_STRING | ResetSentenceStart);
+                       } else if (sc.ch == '\'') {
+                               sc.SetState(SCE_4GL_CHARACTER | ResetSentenceStart);
+                       } else if (sc.ch == '&' && visibleChars == 0 && ((sc.state & 0x10) == 0)) {
+                               sc.SetState(SCE_4GL_PREPROCESSOR | ResetSentenceStart);
+                               // Skip whitespace between & and preprocessor word
+                               do {
+                                       sc.Forward();
+                               } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
+                       // Handle syntactical line termination
+                       } else if ((sc.ch == '.' || sc.ch == ':' || sc.ch == '}') && (sc.chNext == ' ' || sc.chNext == '\t' || sc.chNext == '\n' || sc.chNext == '\r')) {
+                               sc.SetState(sc.state & SetSentenceStart);
+                       } else if (isoperator(static_cast<char>(sc.ch))) {
+                               if (sc.ch == ':')
+                                       sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart);
+                               else
+                                       sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart);
+                       }
+               }
+
+               if (!IsASpace(sc.ch)) {
+                       visibleChars++;
+               }
+       }
+       sc.Complete();
+}
+
+static bool IsStreamCommentStyle(int style) {
+       return (style & 0xf) >= SCE_4GL_COMMENT1 ;
+}
+
+// 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 FoldNoBox4glDoc(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("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 = static_cast<char>(tolower(styler[startPos]));
+       int styleNext = styler.StyleAt(startPos);
+       int style = initStyle;
+       for (unsigned int i = startPos; i < endPos; i++) {
+               char ch = chNext;
+               chNext = static_cast<char>(tolower(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--;
+                       }
+               }
+               else if ((style & 0xf) == SCE_4GL_BLOCK && !isalnum(chNext)) {
+                       levelNext++;
+               }
+               else if ((style & 0xf) == SCE_4GL_END  && (ch == 'e' || ch == 'f')) {
+                       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 (!isspacechar(ch))
+                       visibleChars++;
+       }
+}
+
+static void Fold4glDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+                       Accessor &styler) {
+       FoldNoBox4glDoc(startPos, length, initStyle, styler);
+}
+
+static const char * const FglWordLists[] = {
+            "Primary keywords and identifiers",
+            "Secondary keywords and identifiers",
+            "Documentation comment keywords",
+            "Unused",
+            "Global classes and typedefs",
+            0,
+        };
+
+LexerModule lmProgress(SCLEX_PS, Colourise4glDoc, "progress", Fold4glDoc, FglWordLists);
index 1bdebf6deda620c874d25d4f3436a5571902355d..01d406d0d076701d562f0b5b1c86b72f9d0161e8 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 enum kwType { kwOther, kwClass, kwDef, kwImport };
 enum kwType { kwOther, kwClass, kwDef, kwImport };
+static const int indicatorWhitespace = 1;
 
 static bool IsPyComment(Accessor &styler, int pos, int len) {
        return len > 0 && styler[pos] == '#';
 
 static bool IsPyComment(Accessor &styler, int pos, int len) {
        return len > 0 && styler[pos] == '#';
@@ -123,26 +128,29 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
        styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
        bool hexadecimal = false;
 
        styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
        bool hexadecimal = false;
 
-       // Python uses a different mask because bad indentation is marked by oring with 32
-       StyleContext sc(startPos, endPos - startPos, initStyle, styler, 0x7f);
+       StyleContext sc(startPos, endPos - startPos, initStyle, styler);
+
+       bool indentGood = true;
+       int startIndicator = sc.currentPos;
 
        for (; sc.More(); sc.Forward()) {
 
                if (sc.atLineStart) {
 
        for (; sc.More(); sc.Forward()) {
 
                if (sc.atLineStart) {
-                       const char chBad = static_cast<char>(64);
-                       const char chGood = static_cast<char>(0);
-                       char chFlags = chGood;
+                       styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
+                       indentGood = true;
                        if (whingeLevel == 1) {
                        if (whingeLevel == 1) {
-                               chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
+                               indentGood = (spaceFlags & wsInconsistent) == 0;
                        } else if (whingeLevel == 2) {
                        } else if (whingeLevel == 2) {
-                               chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
+                               indentGood = (spaceFlags & wsSpaceTab) == 0;
                        } else if (whingeLevel == 3) {
                        } else if (whingeLevel == 3) {
-                               chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
+                               indentGood = (spaceFlags & wsSpace) == 0;
                        } else if (whingeLevel == 4) {
                        } else if (whingeLevel == 4) {
-                               chFlags = (spaceFlags & wsTab) ? chBad : chGood;
+                               indentGood = (spaceFlags & wsTab) == 0;
+                       }
+                       if (!indentGood) {
+                               styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0);
+                               startIndicator = sc.currentPos;
                        }
                        }
-                       sc.SetState(sc.state);
-                       styler.SetFlags(chFlags, static_cast<char>(sc.state));
                }
 
                if (sc.atLineEnd) {
                }
 
                if (sc.atLineEnd) {
@@ -154,7 +162,6 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                                sc.SetState(sc.state);
                        }
                        lineCurrent++;
                                sc.SetState(sc.state);
                        }
                        lineCurrent++;
-                       styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
                        if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
                                sc.ChangeState(SCE_P_STRINGEOL);
                                sc.ForwardSetState(SCE_P_DEFAULT);
                        if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
                                sc.ChangeState(SCE_P_STRINGEOL);
                                sc.ForwardSetState(SCE_P_DEFAULT);
@@ -210,10 +217,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                                sc.SetState(SCE_P_DEFAULT);
                        }
                } else if (sc.state == SCE_P_DECORATOR) {
                                sc.SetState(SCE_P_DEFAULT);
                        }
                } else if (sc.state == SCE_P_DECORATOR) {
-                       if (sc.ch == '\r' || sc.ch == '\n') {
+                       if (!IsAWordChar(sc.ch)) {
                                sc.SetState(SCE_P_DEFAULT);
                                sc.SetState(SCE_P_DEFAULT);
-                       } else if (sc.ch == '#') {
-                               sc.SetState((sc.chNext == '#') ? SCE_P_COMMENTBLOCK  :  SCE_P_COMMENTLINE);
                        }
                } else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
                        if (sc.ch == '\\') {
                        }
                } else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
                        if (sc.ch == '\\') {
@@ -248,6 +253,12 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                        }
                }
 
                        }
                }
 
+               if (!indentGood && !IsASpaceOrTab(sc.ch)) {
+                       styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 1);
+                       startIndicator = sc.currentPos;
+                       indentGood = true;
+               }
+
                // State exit code may have moved on to end of line
                if (needEOLCheck && sc.atLineEnd) {
                        lineCurrent++;
                // State exit code may have moved on to end of line
                if (needEOLCheck && sc.atLineEnd) {
                        lineCurrent++;
@@ -282,6 +293,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                        }
                }
        }
                        }
                }
        }
+       styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0);
        sc.Complete();
 }
 
        sc.Complete();
 }
 
diff --git a/src/stc/scintilla/src/LexR.cxx b/src/stc/scintilla/src/LexR.cxx
new file mode 100644 (file)
index 0000000..67e779f
--- /dev/null
@@ -0,0 +1,213 @@
+// Scintilla source code edit control
+/** @file Lexr.cxx
+ ** Lexer for R, S, SPlus Statistics Program (Heavily derived from CPP Lexer).
+ **
+ **/
+// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#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 == '.' || ch == '_');
+}
+
+static inline bool IsAWordStart(const int ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '_');
+}
+
+static inline bool IsAnOperator(const 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 == ']')
+               return true;
+       return false;
+}
+
+static void ColouriseRDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+                            Accessor &styler) {
+
+       WordList &keywords   = *keywordlists[0];
+       WordList &keywords2 = *keywordlists[1];
+       WordList &keywords3 = *keywordlists[2];
+
+
+       // Do not leak onto next line
+       if (initStyle == SCE_R_INFIXEOL)
+               initStyle = SCE_R_DEFAULT;
+
+
+       StyleContext sc(startPos, length, initStyle, styler);
+
+       for (; sc.More(); sc.Forward()) {
+
+               if (sc.atLineStart && (sc.state == SCE_R_STRING)) {
+                       // Prevent SCE_R_STRINGEOL from leaking back to previous line
+                       sc.SetState(SCE_R_STRING);
+               }
+
+               // Determine if the current state should terminate.
+               if (sc.state == SCE_R_OPERATOR) {
+                       sc.SetState(SCE_R_DEFAULT);
+               } else if (sc.state == SCE_R_NUMBER) {
+                       if (!IsADigit(sc.ch) && !(sc.ch == '.' && IsADigit(sc.chNext))) {
+                               sc.SetState(SCE_R_DEFAULT);
+                       }
+               } else if (sc.state == SCE_R_IDENTIFIER) {
+                       if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
+                               char s[100];
+                               sc.GetCurrentLowered(s, sizeof(s));
+                               if (keywords.InList(s)) {
+                                       sc.ChangeState(SCE_R_KWORD);
+                               } else if  (keywords2.InList(s)) {
+                                       sc.ChangeState(SCE_R_BASEKWORD);
+                               } else if  (keywords3.InList(s)) {
+                                       sc.ChangeState(SCE_R_OTHERKWORD);
+                               }
+                               sc.SetState(SCE_R_DEFAULT);
+                       }
+               } else if (sc.state == SCE_R_COMMENT) {
+                       if (sc.ch == '\r' || sc.ch == '\n') {
+                               sc.SetState(SCE_R_DEFAULT);
+                       }
+               } else if (sc.state == SCE_R_STRING) {
+                       if (sc.ch == '\\') {
+                               if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
+                                       sc.Forward();
+                               }
+                       } else if (sc.ch == '\"') {
+                               sc.ForwardSetState(SCE_R_DEFAULT);
+                       }
+               } else if (sc.state == SCE_R_INFIX) {
+                       if (sc.ch == '%') {
+                               sc.ForwardSetState(SCE_R_DEFAULT);
+                       } else if (sc.atLineEnd) {
+                               sc.ChangeState(SCE_R_INFIXEOL);
+                               sc.ForwardSetState(SCE_R_DEFAULT);
+                       }
+               }else if (sc.state == SCE_R_STRING2) {
+                       if (sc.ch == '\\') {
+                               if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
+                                       sc.Forward();
+                               }
+                       } else if (sc.ch == '\'') {
+                               sc.ForwardSetState(SCE_R_DEFAULT);
+                       }
+               }
+
+               // Determine if a new state should be entered.
+               if (sc.state == SCE_R_DEFAULT) {
+                       if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
+                               sc.SetState(SCE_R_NUMBER);
+                       } else if (IsAWordStart(sc.ch) ) {
+                               sc.SetState(SCE_R_IDENTIFIER);
+                       } else if (sc.Match('#')) {
+                                       sc.SetState(SCE_R_COMMENT);
+                       } else if (sc.ch == '\"') {
+                               sc.SetState(SCE_R_STRING);
+                       } else if (sc.ch == '%') {
+                               sc.SetState(SCE_R_INFIX);
+                       } else if (sc.ch == '\'') {
+                               sc.SetState(SCE_R_STRING2);
+                       } else if (IsAnOperator(sc.ch)) {
+                               sc.SetState(SCE_R_OPERATOR);
+                       }
+               }
+       }
+       sc.Complete();
+}
+
+// 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 FoldRDoc(unsigned int startPos, int length, int, WordList *[],
+                       Accessor &styler) {
+       bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+       bool foldAtElse = 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);
+       for (unsigned int i = startPos; i < endPos; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               int style = styleNext;
+               styleNext = styler.StyleAt(i + 1);
+               bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+               if (style == SCE_R_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) {
+                       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 (!isspacechar(ch))
+                       visibleChars++;
+       }
+}
+
+
+static const char * const RWordLists[] = {
+            "Language Keywords",
+            "Base / Default package function",
+            "Other Package Functions",
+            "Unused",
+            "Unused",
+            0,
+        };
+
+
+
+LexerModule lmR(SCLEX_R, ColouriseRDoc, "r", FoldRDoc, RWordLists);
index f829c1e36b839db1d9bc7481013e601ca2a17d83..7139b8dbd50e6777efde3f466c0c181db433b3fd 100644 (file)
@@ -26,6 +26,9 @@
 #include "SciLexer.h"
 #include "StyleContext.h"
 
 #include "SciLexer.h"
 #include "StyleContext.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
 
 static inline bool IsAWordChar(const int ch) {
        return (isalnum(ch) || ch == '?' || ch == '!' || ch == '.' || ch == '\'' || ch == '+' || ch == '-' || ch == '*' || ch == '&' || ch == '|' || ch == '=' || ch == '_' || ch == '~');
 
 static inline bool IsAWordChar(const int ch) {
        return (isalnum(ch) || ch == '?' || ch == '!' || ch == '.' || ch == '\'' || ch == '+' || ch == '-' || ch == '*' || ch == '&' || ch == '|' || ch == '=' || ch == '_' || ch == '~');
index f5ad020f404e31eae5127a05cda5f3dc597da048..18e94d4d82cdc18e65438259ec64a8fc9421b6c2 100644 (file)
@@ -49,7 +49,10 @@ static inline bool isSafeDigit(char ch) {
 }
 
 static inline bool isSafeWordcharOrHigh(char ch) {
 }
 
 static inline bool isSafeWordcharOrHigh(char ch) {
-    return isHighBitChar(ch) || iswordchar(ch);
+    // Error: scintilla's KeyWords.h includes '.' as a word-char
+    // we want to separate things that can take methods from the
+    // methods.
+    return isHighBitChar(ch) || isalnum(ch) || ch == '_';
 }
 
 static bool inline iswhitespace(char ch) {
 }
 
 static bool inline iswhitespace(char ch) {
@@ -95,7 +98,7 @@ static bool keywordIsModifier(const char *word,
                               Accessor &styler);
 
 static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
                               Accessor &styler);
 
 static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
-       char s[100];
+       char s[MAX_KEYWORD_LENGTH];
     unsigned int i, j;
        unsigned int lim = end - start + 1; // num chars to copy
        if (lim >= MAX_KEYWORD_LENGTH) {
     unsigned int i, j;
        unsigned int lim = end - start + 1; // num chars to copy
        if (lim >= MAX_KEYWORD_LENGTH) {
@@ -238,6 +241,74 @@ static bool currLineContainsHereDelims(int& startPos,
     return true;
 }
 
     return true;
 }
 
+// This class is used by the enter and exit methods, so it needs
+// to be hoisted out of the function.
+
+class QuoteCls {
+    public:
+    int  Count;
+    char Up;
+    char Down;
+    QuoteCls() {
+        this->New();
+    }
+    void New() {
+        Count = 0;
+        Up    = '\0';
+        Down  = '\0';
+    }
+    void Open(char u) {
+        Count++;
+        Up    = u;
+        Down  = opposite(Up);
+    }
+    QuoteCls(const QuoteCls& q) {
+        // copy constructor -- use this for copying in
+        Count = q.Count;
+        Up    = q.Up;
+        Down  = q.Down;
+    }
+    QuoteCls& operator=(const QuoteCls& q) { // assignment constructor
+        if (this != &q) {
+            Count = q.Count;
+            Up    = q.Up;
+            Down  = q.Down;
+        }
+               return *this;
+    }
+            
+};
+
+
+static void enterInnerExpression(int  *p_inner_string_types,
+                                 int  *p_inner_expn_brace_counts,
+                                 QuoteCls *p_inner_quotes,
+                                 int&  inner_string_count,
+                                 int&  state,
+                                 int&  brace_counts,
+                                 QuoteCls curr_quote
+                                 ) {
+    p_inner_string_types[inner_string_count] = state;
+    state = SCE_RB_DEFAULT;
+    p_inner_expn_brace_counts[inner_string_count] = brace_counts;
+    brace_counts = 0;
+    p_inner_quotes[inner_string_count] = curr_quote;
+    ++inner_string_count;
+}
+
+static void exitInnerExpression(int *p_inner_string_types,
+                                 int *p_inner_expn_brace_counts,
+                                 QuoteCls *p_inner_quotes,
+                                 int& inner_string_count,
+                                 int& state,
+                                 int&  brace_counts,
+                                 QuoteCls& curr_quote
+                                ) {
+    --inner_string_count;
+    state = p_inner_string_types[inner_string_count];
+    brace_counts = p_inner_expn_brace_counts[inner_string_count];
+    curr_quote = p_inner_quotes[inner_string_count];
+}
 
 static bool isEmptyLine(int pos,
                         Accessor &styler) {
 
 static bool isEmptyLine(int pos,
                         Accessor &styler) {
@@ -288,7 +359,7 @@ static int skipWhitespace(int startPos,
 //
 // iPrev points to the start of <<
 
 //
 // iPrev points to the start of <<
 
-static bool sureThisIsHeredoc(int iPrev, 
+static bool sureThisIsHeredoc(int iPrev,
                               Accessor &styler,
                               char *prevWord) {
                     
                               Accessor &styler,
                               char *prevWord) {
                     
@@ -605,25 +676,6 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
        };
        HereDocCls HereDoc;     
 
        };
        HereDocCls HereDoc;     
 
-       class QuoteCls {
-               public:
-               int  Count;
-               char Up;
-               char Down;
-               QuoteCls() {
-                       this->New();
-               }
-               void New() {
-                       Count = 0;
-                       Up    = '\0';
-                       Down  = '\0';
-               }
-               void Open(char u) {
-                       Count++;
-                       Up    = u;
-                       Down  = opposite(Up);
-               }
-       };
        QuoteCls Quote;
 
     int numDots = 0;  // For numbers --
        QuoteCls Quote;
 
     int numDots = 0;  // For numbers --
@@ -643,6 +695,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
 
        char chPrev = styler.SafeGetCharAt(startPos - 1);
        char chNext = styler.SafeGetCharAt(startPos);
 
        char chPrev = styler.SafeGetCharAt(startPos - 1);
        char chNext = styler.SafeGetCharAt(startPos);
+       bool is_real_number = true;   // Differentiate between constants and ?-sequences.
        // Ruby uses a different mask because bad indentation is marked by oring with 32
        styler.StartAt(startPos, 127);
        styler.StartSegment(startPos);
        // Ruby uses a different mask because bad indentation is marked by oring with 32
        styler.StartAt(startPos, 127);
        styler.StartSegment(startPos);
@@ -654,8 +707,39 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
                              SCE_RB_STRING_QW,
                              SCE_RB_STRING_QX};
     static const char* q_chars = "qQrwWx";
                              SCE_RB_STRING_QW,
                              SCE_RB_STRING_QX};
     static const char* q_chars = "qQrwWx";
-    
-       for (int i = startPos; i < lengthDoc; i++) {
+
+    // In most cases a value of 2 should be ample for the code in the
+    // Ruby library, and the code the user is likely to enter.
+    // For example,
+    // fu_output_message "mkdir #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}"
+    //     if options[:verbose]
+    // from fileutils.rb nests to a level of 2
+    // If the user actually hits a 6th occurrence of '#{' in a double-quoted
+    // string (including regex'es, %Q, %<sym>, %w, and other strings
+    // that interpolate), it will stay as a string.  The problem with this
+    // is that quotes might flip, a 7th '#{' will look like a comment,
+    // and code-folding might be wrong.
+
+    // If anyone runs into this problem, I recommend raising this
+    // value slightly higher to replacing the fixed array with a linked
+    // list.  Keep in mind this code will be called everytime the lexer
+    // is invoked.
+
+#define INNER_STRINGS_MAX_COUNT 5
+    // These vars track our instances of "...#{,,,%Q<..#{,,,}...>,,,}..."
+    int inner_string_types[INNER_STRINGS_MAX_COUNT];
+    // Track # braces when we push a new #{ thing
+    int inner_expn_brace_counts[INNER_STRINGS_MAX_COUNT];
+    QuoteCls inner_quotes[INNER_STRINGS_MAX_COUNT];
+    int inner_string_count = 0;
+    int brace_counts = 0;   // Number of #{ ... } things within an expression
+
+    int i;
+       for (i = 0; i < INNER_STRINGS_MAX_COUNT; i++) {
+        inner_string_types[i] = 0;
+        inner_expn_brace_counts[i] = 0;
+    }
+       for (i = startPos; i < lengthDoc; i++) {
                char ch = chNext;
                chNext = styler.SafeGetCharAt(i + 1);
                char chNext2 = styler.SafeGetCharAt(i + 2);
                char ch = chNext;
                chNext = styler.SafeGetCharAt(i + 1);
                char chNext2 = styler.SafeGetCharAt(i + 2);
@@ -690,6 +774,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
             if (isSafeDigit(ch)) {
                styler.ColourTo(i - 1, state);
                                state = SCE_RB_NUMBER;
             if (isSafeDigit(ch)) {
                styler.ColourTo(i - 1, state);
                                state = SCE_RB_NUMBER;
+                is_real_number = true;
                 numDots = 0;
             } else if (isHighBitChar(ch) || iswordstart(ch)) {
                styler.ColourTo(i - 1, state);
                 numDots = 0;
             } else if (isHighBitChar(ch) || iswordstart(ch)) {
                styler.ColourTo(i - 1, state);
@@ -885,7 +970,7 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
                                                chNext = styler.SafeGetCharAt(i + 1);
                         have_string = true;
                     }
                                                chNext = styler.SafeGetCharAt(i + 1);
                         have_string = true;
                     }
-                } else if (!isSafeWordcharOrHigh(chNext)) {
+                } else if (preferRE && !isSafeWordcharOrHigh(chNext)) {
                     // Ruby doesn't allow high bit chars here,
                     // but the editor host might
                     state = SCE_RB_STRING_QQ;
                     // Ruby doesn't allow high bit chars here,
                     // but the editor host might
                     state = SCE_RB_STRING_QQ;
@@ -898,6 +983,16 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
                     // stay in default
                     preferRE = true;
                 }
                     // stay in default
                     preferRE = true;
                 }
+            } else if (ch == '?') {
+                styler.ColourTo(i - 1, state);
+                if (iswhitespace(chNext) || chNext == '\n' || chNext == '\r') {
+                    styler.ColourTo(i, SCE_RB_OPERATOR);
+                } else {
+                    // It's the start of a character code escape sequence
+                    // Color it as a number.
+                    state = SCE_RB_NUMBER;
+                    is_real_number = false;
+                }
             } else if (isoperator(ch) || ch == '.') {
                                styler.ColourTo(i - 1, state);
                                styler.ColourTo(i, SCE_RB_OPERATOR);
             } else if (isoperator(ch) || ch == '.') {
                                styler.ColourTo(i - 1, state);
                                styler.ColourTo(i, SCE_RB_OPERATOR);
@@ -909,7 +1004,20 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
                 // we aren't ending an object exp'n, and ops
                 // like : << / are unary operators.
                 
                 // we aren't ending an object exp'n, and ops
                 // like : << / are unary operators.
                 
-                preferRE = (strchr(")}].", ch) == NULL);
+                if (ch == '{') {
+                    ++brace_counts;
+                    preferRE = true;
+                } else if (ch == '}' && --brace_counts < 0
+                           && inner_string_count > 0) {
+                    styler.ColourTo(i, SCE_RB_OPERATOR);
+                    exitInnerExpression(inner_string_types,
+                                        inner_expn_brace_counts,
+                                        inner_quotes,
+                                        inner_string_count,
+                                        state, brace_counts, Quote);
+                } else {
+                    preferRE = (strchr(")}].", ch) == NULL);
+                }
                 // Stay in default state
             } else if (isEOLChar(ch)) {
                 // Make sure it's a true line-end, with no backslash
                 // Stay in default state
             } else if (isEOLChar(ch)) {
                 // Make sure it's a true line-end, with no backslash
@@ -984,7 +1092,37 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
                 }
             }
         } else if (state == SCE_RB_NUMBER) {
                 }
             }
         } else if (state == SCE_RB_NUMBER) {
-            if (isSafeAlnumOrHigh(ch) || ch == '_') {
+            if (!is_real_number) {
+                if (ch != '\\') {
+                    styler.ColourTo(i, state);
+                    state = SCE_RB_DEFAULT;
+                    preferRE = false;
+                } else if (strchr("\\ntrfvaebs", chNext)) {
+                    // Terminal escape sequence -- handle it next time
+                    // Nothing more to do this time through the loop
+                } else if (chNext == 'C' || chNext == 'M') {
+                    if (chNext2 != '-') {
+                        // \C or \M ends the sequence -- handle it next time
+                    } else {
+                        // Move from abc?\C-x
+                        //               ^
+                        // to
+                        //                 ^
+                        i += 2;
+                        ch = chNext2;
+                        chNext = styler.SafeGetCharAt(i + 1);
+                    }
+                } else if (chNext == 'c') {
+                    // Stay here, \c is a combining sequence
+                    advance_char(i, ch, chNext, chNext2); // pass by ref
+                } else {
+                    // ?\x, including ?\\ is final.
+                    styler.ColourTo(i + 1, state);
+                    state = SCE_RB_DEFAULT;
+                    preferRE = false;
+                    advance_char(i, ch, chNext, chNext2);
+                }
+            } else if (isSafeAlnumOrHigh(ch) || ch == '_') {
                 // Keep going
             } else if (ch == '.' && ++numDots == 1) {
                 // Keep going
                 // Keep going
             } else if (ch == '.' && ++numDots == 1) {
                 // Keep going
@@ -1155,30 +1293,47 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
                 Quote.Count++;
                 
             } else if (ch == '#' ) {
                 Quote.Count++;
                 
             } else if (ch == '#' ) {
-                //todo: distinguish comments from pound chars
-                // for now, handle as comment
-                styler.ColourTo(i - 1, state);
-                bool inEscape = false;
-                while (++i < lengthDoc) {
-                    ch = styler.SafeGetCharAt(i);
-                    if (ch == '\\') {
-                        inEscape = true;
-                    } else if (isEOLChar(ch)) {
-                        // Comment inside a regex
-                        styler.ColourTo(i - 1, SCE_RB_COMMENTLINE);
-                        break;
-                    } else if (inEscape) {
-                        inEscape = false;  // don't look at char
-                    } else if (ch == Quote.Down) {
-                        // Have the regular handler deal with this
-                        // to get trailing modifiers.
-                        i--;
-                        ch = styler[i];
-                                               break;
+                if (chNext == '{'
+                    && inner_string_count < INNER_STRINGS_MAX_COUNT) {
+                    // process #{ ... }
+                    styler.ColourTo(i - 1, state);
+                    styler.ColourTo(i + 1, SCE_RB_OPERATOR);
+                    enterInnerExpression(inner_string_types,
+                                         inner_expn_brace_counts,
+                                         inner_quotes,
+                                         inner_string_count,
+                                         state,
+                                         brace_counts,
+                                         Quote);
+                    preferRE = true;
+                    // Skip one
+                    advance_char(i, ch, chNext, chNext2);
+                } else {
+                    //todo: distinguish comments from pound chars
+                    // for now, handle as comment
+                    styler.ColourTo(i - 1, state);
+                    bool inEscape = false;
+                    while (++i < lengthDoc) {
+                        ch = styler.SafeGetCharAt(i);
+                        if (ch == '\\') {
+                            inEscape = true;
+                        } else if (isEOLChar(ch)) {
+                            // Comment inside a regex
+                            styler.ColourTo(i - 1, SCE_RB_COMMENTLINE);
+                            break;
+                        } else if (inEscape) {
+                            inEscape = false;  // don't look at char
+                        } else if (ch == Quote.Down) {
+                            // Have the regular handler deal with this
+                            // to get trailing modifiers.
+                            i--;
+                            ch = styler[i];
+                            break;
+                        }
                     }
                     }
+                    chNext = styler.SafeGetCharAt(i + 1);
+                    chNext2 = styler.SafeGetCharAt(i + 2);
                 }
                 }
-                chNext = styler.SafeGetCharAt(i + 1);
-                chNext2 = styler.SafeGetCharAt(i + 2);
             }
         // Quotes of all kinds...
         } else if (state == SCE_RB_STRING_Q || state == SCE_RB_STRING_QQ || 
             }
         // Quotes of all kinds...
         } else if (state == SCE_RB_STRING_Q || state == SCE_RB_STRING_QQ || 
@@ -1199,6 +1354,23 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
                 }
             } else if (ch == Quote.Up) {
                 Quote.Count++;
                 }
             } else if (ch == Quote.Up) {
                 Quote.Count++;
+            } else if (ch == '#' && chNext == '{'
+                       && inner_string_count < INNER_STRINGS_MAX_COUNT
+                       && state != SCE_RB_CHARACTER
+                       && state != SCE_RB_STRING_Q) {
+                // process #{ ... }
+                styler.ColourTo(i - 1, state);
+                styler.ColourTo(i + 1, SCE_RB_OPERATOR);
+                enterInnerExpression(inner_string_types,
+                                     inner_expn_brace_counts,
+                                     inner_quotes,
+                                     inner_string_count,
+                                     state,
+                                     brace_counts,
+                                     Quote);
+                preferRE = true;
+                // Skip one
+                advance_char(i, ch, chNext, chNext2);
             }
         }
             
             }
         }
             
index d8e14b9eb104c46a8d9c5ca4c6d5c8f902500dc4..eb1cddbdffc3e7c7f071efb982d29e46879db341 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static inline bool IsAWordChar(int ch) {
 static inline bool IsAWordChar(int ch) {
-       return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+       return (ch < 0x80) && (isalnum(ch) || ch == '_');
 }
 
 static inline bool IsAWordStart(int ch) {
 }
 
 static inline bool IsAWordStart(int ch) {
index faaa2d46dfad78c264fd4d52d8fa51b0b614a402..76c38e6b68a99c2ba60da5efa07a930d8194602e 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
 {
     char s[100];
 static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
 {
     char s[100];
index 6f43ec3b306891cf3d39102a8e44b7f15420533e..265de380382a4538d64d889fc4f7b60fdb48a7ec 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 /*
 | lexTable classificationBlock charClasses |
 charClasses := #(#DecDigit #Letter #Special #Upper #BinSel).
 /*
 | lexTable classificationBlock charClasses |
 charClasses := #(#DecDigit #Letter #Special #Upper #BinSel).
index bf5d639a129b39c637781e474911ebdcb182f76a..093efae755634ec66ab0bee96a1d5d3bf6c10624 100644 (file)
@@ -21,6 +21,9 @@
 #include "Scintilla.h"
 #include "SciLexer.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 == '_' || ch == '\'');
 
 static inline bool IsAWordChar(const int ch) {
        return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\'');
index 8a1683f055c79d9c222fc211bbe5c607ec45617e..b2953c00146b3c0bd9809f64d4a09b150b975cc8 100644 (file)
 #include "SciLexer.h"
 #include "SString.h"
 
 #include "SciLexer.h"
 #include "SString.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 /*
  * Interface
  */
 /*
  * Interface
  */
index 9938f63745cf54d3fea0115fad0d1f23459808a2..7cc85f1f99eeb5bac3e2dcde4735e0c0e652f5e2 100644 (file)
@@ -2,12 +2,8 @@
 /** @file LexTADS3.cxx
  ** Lexer for TADS3.
  **/
 /** @file LexTADS3.cxx
  ** Lexer for TADS3.
  **/
-/* Copyright 2005 by Michael Cartmell
- * Parts copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
- * In particular FoldTADS3Doc is derived from FoldCppDoc
- * The License.txt file describes the conditions under which this software may
- * be distributed.
- */
+// Copyright 1998-2006 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
 
 /*
  * TADS3 is a language designed by Michael J. Roberts for the writing of text
 
 /*
  * TADS3 is a language designed by Michael J. Roberts for the writing of text
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static const int T3_SINGLE_QUOTE = 1;
 static const int T3_INT_EXPRESSION = 2;
 static const int T3_SINGLE_QUOTE = 1;
 static const int T3_INT_EXPRESSION = 2;
+static const int T3_INT_EXPRESSION_IN_TAG = 4;
+static const int T3_HTML_SQUOTE = 8;
 
 static inline bool IsEOL(const int ch, const int chNext) {
 
 static inline bool IsEOL(const int ch, const int chNext) {
-       return (ch == '\r' && chNext != '\n') || (ch == '\n');
+        return (ch == '\r' && chNext != '\n') || (ch == '\n');
+}
+
+/*
+ *   Test the current character to see if it's the START of an EOL sequence;
+ *   if so, skip ahead to the last character of the sequence and return true,
+ *   and if not just return false.  There are a few places where we want to
+ *   check to see if a newline sequence occurs at a particular point, but
+ *   where a caller expects a subroutine to stop only upon reaching the END
+ *   of a newline sequence (in particular, CR-LF on Windows).  That's why
+ *   IsEOL() above only returns true on CR if the CR isn't followed by an LF
+ *   - it doesn't want to admit that there's a newline until reaching the END
+ *   of the sequence.  We meet both needs by saying that there's a newline
+ *   when we see the CR in a CR-LF, but skipping the CR before returning so
+ *   that the caller's caller will see that we've stopped at the LF.  
+ */
+static inline bool IsEOLSkip(StyleContext &sc)
+{
+    /* test for CR-LF */
+    if (sc.ch == '\r' && sc.chNext == '\n')
+    {
+        /* got CR-LF - skip the CR and indicate that we're at a newline */
+        sc.Forward();
+        return true;
+    }
+
+    /* 
+     *   in other cases, we have at most a 1-character newline, so do the
+     *   normal IsEOL test 
+     */
+    return IsEOL(sc.ch, sc.chNext);
 }
 
 static inline bool IsASpaceOrTab(const int ch) {
 }
 
 static inline bool IsASpaceOrTab(const int ch) {
-       return ch == ' ' || ch == '\t';
+        return ch == ' ' || ch == '\t';
 }
 
 static inline bool IsATADS3Operator(const int ch) {
 }
 
 static inline bool IsATADS3Operator(const int ch) {
-       return ch == '=' || ch == '{' || ch == '}' || ch == '(' || ch == ')'
-               || ch == '[' || ch == ']' || ch == ',' || ch == ':' || ch == ';'
-               || ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '%'
-               || ch == '?' || ch == '!' || ch == '<' || ch == '>' || ch == '|'
-               || ch == '@' || ch == '&' || ch == '~';
+        return ch == '=' || ch == '{' || ch == '}' || ch == '(' || ch == ')'
+                || ch == '[' || ch == ']' || ch == ',' || ch == ':' || ch == ';'
+                || ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '%'
+                || ch == '?' || ch == '!' || ch == '<' || ch == '>' || ch == '|'
+                || ch == '@' || ch == '&' || ch == '~';
 }
 
 static inline bool IsAWordChar(const int ch) {
 }
 
 static inline bool IsAWordChar(const int ch) {
-       return isalnum(ch) || ch == '_' || ch == '.';
+        return isalnum(ch) || ch == '_';
 }
 
 static inline bool IsAWordStart(const int ch) {
 }
 
 static inline bool IsAWordStart(const int ch) {
-       return isalpha(ch) || ch == '_';
+        return isalpha(ch) || ch == '_';
 }
 
 static inline bool IsAHexDigit(const int ch) {
 }
 
 static inline bool IsAHexDigit(const int ch) {
-       int lch = tolower(ch);
-       return isdigit(lch) || lch == 'a' || lch == 'b' || lch == 'c'
-               || lch == 'd' || lch == 'e' || lch == 'f';
+        int lch = tolower(ch);
+        return isdigit(lch) || lch == 'a' || lch == 'b' || lch == 'c'
+                || lch == 'd' || lch == 'e' || lch == 'f';
 }
 
 static inline bool IsAnHTMLChar(int ch) {
 }
 
 static inline bool IsAnHTMLChar(int ch) {
-       return isalnum(ch) || ch == '-' || ch == '_' || ch == '.';
+        return isalnum(ch) || ch == '-' || ch == '_' || ch == '.';
 }
 
 static inline bool IsADirectiveChar(int ch) {
 }
 
 static inline bool IsADirectiveChar(int ch) {
-       return isalnum(ch) || isspace(ch) || ch == '-' || ch == '/';
+        return isalnum(ch) || isspace(ch) || ch == '-' || ch == '/';
 }
 
 static inline bool IsANumberStart(StyleContext &sc) {
 }
 
 static inline bool IsANumberStart(StyleContext &sc) {
-       return isdigit(sc.ch)
-               || (!isdigit(sc.chPrev) && sc.ch == '.' && isdigit(sc.chNext));
+        return isdigit(sc.ch)
+                || (!isdigit(sc.chPrev) && sc.ch == '.' && isdigit(sc.chNext));
 }
 
 inline static void ColouriseTADS3Operator(StyleContext &sc) {
 }
 
 inline static void ColouriseTADS3Operator(StyleContext &sc) {
-       int initState = sc.state;
-       sc.SetState(SCE_T3_OPERATOR);
-       sc.ForwardSetState(initState);
+        int initState = sc.state;
+        int c = sc.ch;
+        sc.SetState(c == '{' || c == '}' ? SCE_T3_BRACE : SCE_T3_OPERATOR);
+        sc.ForwardSetState(initState);
 }
 
 static void ColouriseTADSHTMLString(StyleContext &sc, int &lineState) {
 }
 
 static void ColouriseTADSHTMLString(StyleContext &sc, int &lineState) {
-       int endState = sc.state;
-       int chQuote = sc.ch;
-       if (endState == SCE_T3_HTML_STRING) {
-               if (lineState&T3_SINGLE_QUOTE) {
-                       endState = SCE_T3_S_STRING;
-                       chQuote = '"';
-               } else if (lineState&T3_INT_EXPRESSION) {
-                       endState = SCE_T3_X_STRING;
-                       chQuote = '\'';
-               } else {
-                       endState = SCE_T3_D_STRING;
-                       chQuote = '\'';
-               }
-       } else {
-               sc.SetState(SCE_T3_HTML_STRING);
-               sc.Forward();
-       }
-       int chString = chQuote == '"'? '\'': '"';
-
-       while (sc.More()) {
-               if (IsEOL(sc.ch, sc.chNext)) {
-                       return;
-               }
-               if (sc.ch == chQuote) {
-                       sc.ForwardSetState(endState);
-                       return;
-               }
-               if (sc.ch == chString) {
-                       sc.SetState(endState);
-                       return;
-               }
-               if (sc.Match('\\', static_cast<char>(chQuote))
-                       || sc.Match('\\', static_cast<char>(chString))) {
-                       sc.Forward(2);
-               } else {
-                       sc.Forward();
-               }
-       }
+        int endState = sc.state;
+        int chQuote = sc.ch;
+        int chString = (lineState & T3_SINGLE_QUOTE) ? '\'' : '"';
+        if (endState == SCE_T3_HTML_STRING) {
+                if (lineState&T3_SINGLE_QUOTE) {
+                        endState = SCE_T3_S_STRING;
+                        chString = '\'';
+                } else if (lineState&T3_INT_EXPRESSION) {
+                        endState = SCE_T3_X_STRING;
+                        chString = '"';
+                } else {
+                        endState = SCE_T3_HTML_DEFAULT;
+                        chString = '"';
+                }
+                chQuote = (lineState & T3_HTML_SQUOTE) ? '\'' : '"';
+        } else {
+                sc.SetState(SCE_T3_HTML_STRING);
+                sc.Forward();
+        }
+        if (chQuote == '"')
+                lineState &= ~T3_HTML_SQUOTE; 
+        else
+                lineState |= T3_HTML_SQUOTE;
+
+        while (sc.More()) {
+                if (IsEOL(sc.ch, sc.chNext)) {
+                        return;
+                }
+                if (sc.ch == chQuote) {
+                        sc.ForwardSetState(endState);
+                        return;
+                }
+                if (sc.Match('\\', static_cast<char>(chQuote))) {
+                        sc.Forward(2);
+                        sc.SetState(endState);
+                        return;
+                }
+                if (sc.ch == chString) {
+                        sc.SetState(SCE_T3_DEFAULT);
+                        return;
+                }
+
+                if (sc.Match('<', '<')) {
+                        lineState |= T3_INT_EXPRESSION | T3_INT_EXPRESSION_IN_TAG;
+                        sc.SetState(SCE_T3_X_DEFAULT);
+                        sc.Forward(2);
+                        return;
+                }
+
+                if (sc.Match('\\', static_cast<char>(chQuote))
+                        || sc.Match('\\', static_cast<char>(chString))
+                        || sc.Match('\\', '\\')) {
+                        sc.Forward(2);
+                } else {
+                        sc.Forward();
+                }
+        }
 }
 
 static void ColouriseTADS3HTMLTagStart(StyleContext &sc) {
 }
 
 static void ColouriseTADS3HTMLTagStart(StyleContext &sc) {
-       sc.SetState(SCE_T3_HTML_TAG);
-       sc.Forward();
-       if (sc.ch == '/') {
-               sc.Forward();
-       }
-       while (IsAnHTMLChar(sc.ch)) {
-               sc.Forward();
-       }
+        sc.SetState(SCE_T3_HTML_TAG);
+        sc.Forward();
+        if (sc.ch == '/') {
+                sc.Forward();
+        }
+        while (IsAnHTMLChar(sc.ch)) {
+                sc.Forward();
+        }
 }
 
 static void ColouriseTADS3HTMLTag(StyleContext &sc, int &lineState) {
 }
 
 static void ColouriseTADS3HTMLTag(StyleContext &sc, int &lineState) {
-       int endState = sc.state;
-       int chQuote = '"';
-       int chString = '\'';
-       switch (endState) {
-               case SCE_T3_S_STRING:
-                       ColouriseTADS3HTMLTagStart(sc);
-                       sc.SetState(SCE_T3_HTML_DEFAULT);
-                       chQuote = '\'';
-                       chString = '"';
-                       break;
-               case SCE_T3_D_STRING:
-               case SCE_T3_X_STRING:
-                       ColouriseTADS3HTMLTagStart(sc);
-                       sc.SetState(SCE_T3_HTML_DEFAULT);
-                       break;
-               case SCE_T3_HTML_DEFAULT:
-                       if (lineState&T3_SINGLE_QUOTE) {
-                               endState = SCE_T3_S_STRING;
-                               chQuote = '\'';
-                               chString = '"';
-                       } else if (lineState&T3_INT_EXPRESSION) {
-                               endState = SCE_T3_X_STRING;
-                       } else {
-                               endState = SCE_T3_D_STRING;
-                       }
-                       break;
-       }
-
-       while (sc.More()) {
-               if (IsEOL(sc.ch, sc.chNext)) {
-                       return;
-               }
-               if (sc.Match('/', '>')) {
-                       sc.SetState(SCE_T3_HTML_TAG);
-                       sc.Forward(2);
-                       sc.SetState(endState);
-                       return;
-               }
-               if (sc.ch == '>') {
-                       sc.SetState(SCE_T3_HTML_TAG);
-                       sc.ForwardSetState(endState);
-                       return;
-               }
-               if (sc.ch == chQuote) {
-                       sc.SetState(endState);
-                       return;
-               }
-               if (sc.ch == chString) {
-                       ColouriseTADSHTMLString(sc, lineState);
-               } else if (sc.ch == '=') {
-                       ColouriseTADS3Operator(sc);
-               } else {
-                       sc.Forward();
-               }
-       }
+        int endState = sc.state;
+        int chQuote = '"';
+        int chString = '\'';
+        switch (endState) {
+                case SCE_T3_S_STRING:
+                        ColouriseTADS3HTMLTagStart(sc);
+                        sc.SetState(SCE_T3_HTML_DEFAULT);
+                        chQuote = '\'';
+                        chString = '"';
+                        break;
+                case SCE_T3_D_STRING:
+                case SCE_T3_X_STRING:
+                        ColouriseTADS3HTMLTagStart(sc);
+                        sc.SetState(SCE_T3_HTML_DEFAULT);
+                        break;
+                case SCE_T3_HTML_DEFAULT:
+                        if (lineState&T3_SINGLE_QUOTE) {
+                                endState = SCE_T3_S_STRING;
+                                chQuote = '\'';
+                                chString = '"';
+                        } else if (lineState&T3_INT_EXPRESSION) {
+                                endState = SCE_T3_X_STRING;
+                        } else {
+                                endState = SCE_T3_D_STRING;
+                        }
+                        break;
+        }
+
+        while (sc.More()) {
+                if (IsEOL(sc.ch, sc.chNext)) {
+                        return;
+                }
+                if (sc.Match('/', '>')) {
+                        sc.SetState(SCE_T3_HTML_TAG);
+                        sc.Forward(2);
+                        sc.SetState(endState);
+                        return;
+                }
+                if (sc.ch == '>') {
+                        sc.SetState(SCE_T3_HTML_TAG);
+                        sc.ForwardSetState(endState);
+                        return;
+                }
+                if (sc.ch == chQuote) {
+                        sc.SetState(endState);
+                        return;
+                }
+                if (sc.Match('\\', static_cast<char>(chQuote))) {
+                        sc.Forward();
+                        ColouriseTADSHTMLString(sc, lineState);
+                        if (sc.state == SCE_T3_X_DEFAULT)
+                            break;
+                } else if (sc.ch == chString) {
+                        ColouriseTADSHTMLString(sc, lineState);
+                } else if (sc.ch == '=') {
+                        ColouriseTADS3Operator(sc);
+                } else {
+                        sc.Forward();
+                }
+        }
 }
 
 static void ColouriseTADS3Keyword(StyleContext &sc,
 }
 
 static void ColouriseTADS3Keyword(StyleContext &sc,
-                                                       WordList *keywordlists[],       unsigned int endPos) {
-       char s[250];
-       WordList &keywords = *keywordlists[0];
-       WordList &userwords1 = *keywordlists[1];
-       WordList &userwords2 = *keywordlists[2];
-       WordList &userwords3 = *keywordlists[3];
-       int initState = sc.state;
-       sc.SetState(SCE_T3_IDENTIFIER);
-       while (sc.More() && (IsAWordChar(sc.ch))) {
-               sc.Forward();
-       }
-       sc.GetCurrent(s, sizeof(s));
-       if ( strcmp(s, "is") == 0 || strcmp(s, "not") == 0) {
-               // have to find if "in" is next
-               int n = 1;
-               while (n + sc.currentPos < endPos && IsASpaceOrTab(sc.GetRelative(n)))
-                       n++;
-               if (sc.GetRelative(n) == 'i' && sc.GetRelative(n+1) == 'n') {
-                       sc.Forward(n+2);
-                       sc.ChangeState(SCE_T3_KEYWORD);
-               }
-       } else if (keywords.InList(s)) {
-               sc.ChangeState(SCE_T3_KEYWORD);
-       } else if (userwords3.InList(s)) {
-               sc.ChangeState(SCE_T3_USER3);
-       } else if (userwords2.InList(s)) {
-               sc.ChangeState(SCE_T3_USER2);
-       } else if (userwords1.InList(s)) {
-               sc.ChangeState(SCE_T3_USER1);
-       }
-       sc.SetState(initState);
+                                                        WordList *keywordlists[],       unsigned int endPos) {
+        char s[250];
+        WordList &keywords = *keywordlists[0];
+        WordList &userwords1 = *keywordlists[1];
+        WordList &userwords2 = *keywordlists[2];
+        WordList &userwords3 = *keywordlists[3];
+        int initState = sc.state;
+        sc.SetState(SCE_T3_IDENTIFIER);
+        while (sc.More() && (IsAWordChar(sc.ch))) {
+                sc.Forward();
+        }
+        sc.GetCurrent(s, sizeof(s));
+        if ( strcmp(s, "is") == 0 || strcmp(s, "not") == 0) {
+                // have to find if "in" is next
+                int n = 1;
+                while (n + sc.currentPos < endPos && IsASpaceOrTab(sc.GetRelative(n)))
+                        n++;
+                if (sc.GetRelative(n) == 'i' && sc.GetRelative(n+1) == 'n') {
+                        sc.Forward(n+2);
+                        sc.ChangeState(SCE_T3_KEYWORD);
+                }
+        } else if (keywords.InList(s)) {
+                sc.ChangeState(SCE_T3_KEYWORD);
+        } else if (userwords3.InList(s)) {
+                sc.ChangeState(SCE_T3_USER3);
+        } else if (userwords2.InList(s)) {
+                sc.ChangeState(SCE_T3_USER2);
+        } else if (userwords1.InList(s)) {
+                sc.ChangeState(SCE_T3_USER1);
+        }
+        sc.SetState(initState);
 }
 
 static void ColouriseTADS3MsgParam(StyleContext &sc, int &lineState) {
 }
 
 static void ColouriseTADS3MsgParam(StyleContext &sc, int &lineState) {
-       int endState = sc.state;
-       int chQuote = '"';
-       switch (endState) {
-               case SCE_T3_S_STRING:
-                       sc.SetState(SCE_T3_MSG_PARAM);
-                       sc.Forward();
-                       chQuote = '\'';
-                       break;
-               case SCE_T3_D_STRING:
-               case SCE_T3_X_STRING:
-                       sc.SetState(SCE_T3_MSG_PARAM);
-                       sc.Forward();
-                       break;
-               case SCE_T3_MSG_PARAM:
-                       if (lineState&T3_SINGLE_QUOTE) {
-                               endState = SCE_T3_S_STRING;
-                               chQuote = '\'';
-                       } else if (lineState&T3_INT_EXPRESSION) {
-                               endState = SCE_T3_X_STRING;
-                       } else {
-                               endState = SCE_T3_D_STRING;
-                       }
-                       break;
-       }
-       while (sc.More() && sc.ch != '}' && sc.ch != chQuote) {
-               if (IsEOL(sc.ch, sc.chNext)) {
-                       return;
-               }
-               if (sc.ch == '\\') {
-                       sc.Forward();
-               }
-               sc.Forward();
-       }
-       if (sc.ch == chQuote) {
-               sc.SetState(endState);
-       } else {
-               sc.ForwardSetState(endState);
-       }
+        int endState = sc.state;
+        int chQuote = '"';
+        switch (endState) {
+                case SCE_T3_S_STRING:
+                        sc.SetState(SCE_T3_MSG_PARAM);
+                        sc.Forward();
+                        chQuote = '\'';
+                        break;
+                case SCE_T3_D_STRING:
+                case SCE_T3_X_STRING:
+                        sc.SetState(SCE_T3_MSG_PARAM);
+                        sc.Forward();
+                        break;
+                case SCE_T3_MSG_PARAM:
+                        if (lineState&T3_SINGLE_QUOTE) {
+                                endState = SCE_T3_S_STRING;
+                                chQuote = '\'';
+                        } else if (lineState&T3_INT_EXPRESSION) {
+                                endState = SCE_T3_X_STRING;
+                        } else {
+                                endState = SCE_T3_D_STRING;
+                        }
+                        break;
+        }
+        while (sc.More() && sc.ch != '}' && sc.ch != chQuote) {
+                if (IsEOL(sc.ch, sc.chNext)) {
+                        return;
+                }
+                if (sc.ch == '\\') {
+                        sc.Forward();
+                }
+                sc.Forward();
+        }
+        if (sc.ch == chQuote) {
+                sc.SetState(endState);
+        } else {
+                sc.ForwardSetState(endState);
+        }
 }
 
 static void ColouriseTADS3LibDirective(StyleContext &sc, int &lineState) {
 }
 
 static void ColouriseTADS3LibDirective(StyleContext &sc, int &lineState) {
-       int initState = sc.state;
-       int chQuote = '"';
-       switch (initState) {
-               case SCE_T3_S_STRING:
-                       sc.SetState(SCE_T3_LIB_DIRECTIVE);
-                       sc.Forward(2);
-                       chQuote = '\'';
-                       break;
-               case SCE_T3_D_STRING:
-                       sc.SetState(SCE_T3_LIB_DIRECTIVE);
-                       sc.Forward(2);
-                       break;
-               case SCE_T3_LIB_DIRECTIVE:
-                       if (lineState&T3_SINGLE_QUOTE) {
-                               initState = SCE_T3_S_STRING;
-                               chQuote = '\'';
-                       } else {
-                               initState = SCE_T3_D_STRING;
-                       }
-                       break;
-       }
-       while (sc.More() && IsADirectiveChar(sc.ch)) {
-               if (IsEOL(sc.ch, sc.chNext)) {
-                       return;
-               }
-               sc.Forward();
-       };
-       if (sc.ch == '>' || !sc.More()) {
-               sc.ForwardSetState(initState);
-       } else if (sc.ch == chQuote) {
-               sc.SetState(initState);
-       } else {
-               sc.ChangeState(initState);
-               sc.Forward();
-       }
+        int initState = sc.state;
+        int chQuote = '"';
+        switch (initState) {
+                case SCE_T3_S_STRING:
+                        sc.SetState(SCE_T3_LIB_DIRECTIVE);
+                        sc.Forward(2);
+                        chQuote = '\'';
+                        break;
+                case SCE_T3_D_STRING:
+                        sc.SetState(SCE_T3_LIB_DIRECTIVE);
+                        sc.Forward(2);
+                        break;
+                case SCE_T3_LIB_DIRECTIVE:
+                        if (lineState&T3_SINGLE_QUOTE) {
+                                initState = SCE_T3_S_STRING;
+                                chQuote = '\'';
+                        } else {
+                                initState = SCE_T3_D_STRING;
+                        }
+                        break;
+        }
+        while (sc.More() && IsADirectiveChar(sc.ch)) {
+                if (IsEOL(sc.ch, sc.chNext)) {
+                        return;
+                }
+                sc.Forward();
+        };
+        if (sc.ch == '>' || !sc.More()) {
+                sc.ForwardSetState(initState);
+        } else if (sc.ch == chQuote) {
+                sc.SetState(initState);
+        } else {
+                sc.ChangeState(initState);
+                sc.Forward();
+        }
 }
 
 static void ColouriseTADS3String(StyleContext &sc, int &lineState) {
 }
 
 static void ColouriseTADS3String(StyleContext &sc, int &lineState) {
-       int chQuote = sc.ch;
-       int endState = sc.state;
-       switch (sc.state) {
-               case SCE_T3_DEFAULT:
-               case SCE_T3_X_DEFAULT:
-                       if (chQuote == '"') {
-                               if (sc.state == SCE_T3_DEFAULT) {
-                                       sc.SetState(SCE_T3_D_STRING);
-                               } else {
-                                       sc.SetState(SCE_T3_X_STRING);
-                               }
-                               lineState &= ~T3_SINGLE_QUOTE;
-                       } else {
-                               sc.SetState(SCE_T3_S_STRING);
-                               lineState |= T3_SINGLE_QUOTE;
-                       }
-                       sc.Forward();
-                       break;
-               case SCE_T3_S_STRING:
-                       chQuote = '\'';
-                       endState = lineState&T3_INT_EXPRESSION ?
-                               SCE_T3_X_DEFAULT : SCE_T3_DEFAULT;
-                       break;
-               case SCE_T3_D_STRING:
-                       chQuote = '"';
-                       endState = SCE_T3_DEFAULT;
-                       break;
-               case SCE_T3_X_STRING:
-                       chQuote = '"';
-                       endState = SCE_T3_X_DEFAULT;
-                       break;
-       }
-       while (sc.More()) {
-               if (IsEOL(sc.ch, sc.chNext)) {
-                       return;
-               }
-               if (sc.ch == chQuote) {
-                       sc.ForwardSetState(endState);
-                       return;
-               }
-               if (sc.state == SCE_T3_D_STRING && sc.Match('<', '<')) {
-                       lineState |= T3_INT_EXPRESSION;
-                       sc.SetState(SCE_T3_X_DEFAULT);
-                       sc.Forward(2);
-                       return;
-               }
-               if (sc.Match('\\', static_cast<char>(chQuote))) {
-                       sc.Forward(2);
-               } else if (sc.ch == '{') {
-                       ColouriseTADS3MsgParam(sc, lineState);
-               } else if (sc.Match('<', '.')) {
-                       ColouriseTADS3LibDirective(sc, lineState);
-               } else if (sc.ch == '<') {
-                       ColouriseTADS3HTMLTag(sc, lineState);
-               } else {
-                       sc.Forward();
-               }
-       }
+        int chQuote = sc.ch;
+        int endState = sc.state;
+        switch (sc.state) {
+                case SCE_T3_DEFAULT:
+                case SCE_T3_X_DEFAULT:
+                        if (chQuote == '"') {
+                                if (sc.state == SCE_T3_DEFAULT) {
+                                        sc.SetState(SCE_T3_D_STRING);
+                                } else {
+                                        sc.SetState(SCE_T3_X_STRING);
+                                }
+                                lineState &= ~T3_SINGLE_QUOTE;
+                        } else {
+                                sc.SetState(SCE_T3_S_STRING);
+                                lineState |= T3_SINGLE_QUOTE;
+                        }
+                        sc.Forward();
+                        break;
+                case SCE_T3_S_STRING:
+                        chQuote = '\'';
+                        endState = lineState&T3_INT_EXPRESSION ?
+                                SCE_T3_X_DEFAULT : SCE_T3_DEFAULT;
+                        break;
+                case SCE_T3_D_STRING:
+                        chQuote = '"';
+                        endState = SCE_T3_DEFAULT;
+                        break;
+                case SCE_T3_X_STRING:
+                        chQuote = '"';
+                        endState = SCE_T3_X_DEFAULT;
+                        break;
+        }
+        while (sc.More()) {
+                if (IsEOL(sc.ch, sc.chNext)) {
+                        return;
+                }
+                if (sc.ch == chQuote) {
+                        sc.ForwardSetState(endState);
+                        return;
+                }
+                if (sc.state == SCE_T3_D_STRING && sc.Match('<', '<')) {
+                        lineState |= T3_INT_EXPRESSION;
+                        sc.SetState(SCE_T3_X_DEFAULT);
+                        sc.Forward(2);
+                        return;
+                }
+                if (sc.Match('\\', static_cast<char>(chQuote))
+                    || sc.Match('\\', '\\')) {
+                        sc.Forward(2);
+                } else if (sc.ch == '{') {
+                        ColouriseTADS3MsgParam(sc, lineState);
+                } else if (sc.Match('<', '.')) {
+                        ColouriseTADS3LibDirective(sc, lineState);
+                } else if (sc.ch == '<') {
+                        ColouriseTADS3HTMLTag(sc, lineState);
+                        if (sc.state == SCE_T3_X_DEFAULT)
+                                return;
+                } else {
+                        sc.Forward();
+                }
+        }
 }
 
 static void ColouriseTADS3Comment(StyleContext &sc, int endState) {
 }
 
 static void ColouriseTADS3Comment(StyleContext &sc, int endState) {
-       sc.SetState(SCE_T3_BLOCK_COMMENT);
-       while (sc.More()) {
-               if (IsEOL(sc.ch, sc.chNext)) {
-                       return;
-               }
-               if (sc.Match('*', '/')) {
-                       sc.Forward(2);
-                       sc.SetState(endState);
-                       return;
-               }
-               sc.Forward();
-       }
+        sc.SetState(SCE_T3_BLOCK_COMMENT);
+        while (sc.More()) {
+                if (IsEOL(sc.ch, sc.chNext)) {
+                        return;
+                }
+                if (sc.Match('*', '/')) {
+                        sc.Forward(2);
+                        sc.SetState(endState);
+                        return;
+                }
+                sc.Forward();
+        }
 }
 
 static void ColouriseToEndOfLine(StyleContext &sc, int initState, int endState) {
 }
 
 static void ColouriseToEndOfLine(StyleContext &sc, int initState, int endState) {
-       sc.SetState(initState);
-       while (sc.More()) {
-               if (sc.ch == '\\') {
-                       sc.Forward();
-                       if (IsEOL(sc.ch, sc.chNext)) {
-                                       return;
-                       }
-               }
-               if (IsEOL(sc.ch, sc.chNext)) {
-                       sc.SetState(endState);
-                       return;
-               }
-               sc.Forward();
-       }
+        sc.SetState(initState);
+        while (sc.More()) {
+                if (sc.ch == '\\') {
+                        sc.Forward();
+                        if (IsEOLSkip(sc)) {
+                                        return;
+                        }
+                }
+                if (IsEOL(sc.ch, sc.chNext)) {
+                        sc.SetState(endState);
+                        return;
+                }
+                sc.Forward();
+        }
 }
 
 static void ColouriseTADS3Number(StyleContext &sc) {
 }
 
 static void ColouriseTADS3Number(StyleContext &sc) {
-       int endState = sc.state;
-       bool inHexNumber = false;
-       bool seenE = false;
-       bool seenDot = sc.ch == '.';
-       sc.SetState(SCE_T3_NUMBER);
-       if (sc.More()) {
-               sc.Forward();
-       }
-       if (sc.chPrev == '0' && tolower(sc.ch) == 'x') {
-               inHexNumber = true;
-               sc.Forward();
-       }
-       while (sc.More()) {
-               if (inHexNumber) {
-                       if (!IsAHexDigit(sc.ch)) {
-                               break;
-                       }
-               } else if (!isdigit(sc.ch)) {
-                       if (!seenE && tolower(sc.ch) == 'e') {
-                               seenE = true;
-                               seenDot = true;
-                               if (sc.chNext == '+' || sc.chNext == '-') {
-                                       sc.Forward();
-                               }
-                       } else if (!seenDot && sc.ch == '.') {
-                               seenDot = true;
-                       } else {
-                               break;
-                       }
-               }
-               sc.Forward();
-       }
-       sc.SetState(endState);
+        int endState = sc.state;
+        bool inHexNumber = false;
+        bool seenE = false;
+        bool seenDot = sc.ch == '.';
+        sc.SetState(SCE_T3_NUMBER);
+        if (sc.More()) {
+                sc.Forward();
+        }
+        if (sc.chPrev == '0' && tolower(sc.ch) == 'x') {
+                inHexNumber = true;
+                sc.Forward();
+        }
+        while (sc.More()) {
+                if (inHexNumber) {
+                        if (!IsAHexDigit(sc.ch)) {
+                                break;
+                        }
+                } else if (!isdigit(sc.ch)) {
+                        if (!seenE && tolower(sc.ch) == 'e') {
+                                seenE = true;
+                                seenDot = true;
+                                if (sc.chNext == '+' || sc.chNext == '-') {
+                                        sc.Forward();
+                                }
+                        } else if (!seenDot && sc.ch == '.') {
+                                seenDot = true;
+                        } else {
+                                break;
+                        }
+                }
+                sc.Forward();
+        }
+        sc.SetState(endState);
 }
 
 static void ColouriseTADS3Doc(unsigned int startPos, int length, int initStyle,
 }
 
 static void ColouriseTADS3Doc(unsigned int startPos, int length, int initStyle,
-                                                          WordList *keywordlists[], Accessor &styler) {
-       int visibleChars = 0;
-       int bracketLevel = 0;
-       int lineState = 0;
-       unsigned int endPos = startPos + length;
-       int lineCurrent = styler.GetLine(startPos);
-       if (lineCurrent > 0) {
-               lineState = styler.GetLineState(lineCurrent-1);
-       }
-       StyleContext sc(startPos, length, initStyle, styler);
-
-       while (sc.More()) {
-
-               if (IsEOL(sc.ch, sc.chNext)) {
-                       styler.SetLineState(lineCurrent, lineState);
-                       lineCurrent++;
-                       visibleChars = 0;
-                       sc.Forward();
-                       if (sc.ch == '\n') {
-                               sc.Forward();
-                       }
-               }
-
-               switch(sc.state) {
-                       case SCE_T3_PREPROCESSOR:
-                       case SCE_T3_LINE_COMMENT:
-                               ColouriseToEndOfLine(sc, sc.state, lineState&T3_INT_EXPRESSION ?
-                                       SCE_T3_X_DEFAULT : SCE_T3_DEFAULT);
-                               break;
-                       case SCE_T3_S_STRING:
-                       case SCE_T3_D_STRING:
-                       case SCE_T3_X_STRING:
-                               ColouriseTADS3String(sc, lineState);
-                               visibleChars++;
-                               break;
-                       case SCE_T3_MSG_PARAM:
-                               ColouriseTADS3MsgParam(sc, lineState);
-                               break;
-                       case SCE_T3_LIB_DIRECTIVE:
-                               ColouriseTADS3LibDirective(sc, lineState);
-                               break;
-                       case SCE_T3_HTML_DEFAULT:
-                               ColouriseTADS3HTMLTag(sc, lineState);
-                               break;
-                       case SCE_T3_HTML_STRING:
-                               ColouriseTADSHTMLString(sc, lineState);
-                               break;
-                       case SCE_T3_BLOCK_COMMENT:
-                               ColouriseTADS3Comment(sc, lineState&T3_INT_EXPRESSION ?
-                                       SCE_T3_X_DEFAULT : SCE_T3_DEFAULT);
-                               break;
-                       case SCE_T3_DEFAULT:
-                       case SCE_T3_X_DEFAULT:
-                               if (IsASpaceOrTab(sc.ch)) {
-                                       sc.Forward();
-                               } else if (sc.ch == '#' && visibleChars == 0) {
-                                       ColouriseToEndOfLine(sc, SCE_T3_PREPROCESSOR, sc.state);
-                               } else if (sc.Match('/', '*')) {
-                                       ColouriseTADS3Comment(sc, sc.state);
-                                       visibleChars++;
-                               } else if (sc.Match('/', '/')) {
-                                       ColouriseToEndOfLine(sc, SCE_T3_LINE_COMMENT, sc.state);
-                               } else if (sc.ch == '"') {
-                                       bracketLevel = 0;
-                                       ColouriseTADS3String(sc, lineState);
-                                       visibleChars++;
-                               } else if (sc.ch == '\'') {
-                                       ColouriseTADS3String(sc, lineState);
-                                       visibleChars++;
-                               } else if (sc.state == SCE_T3_X_DEFAULT && bracketLevel == 0
-                                                  && sc.Match('>', '>')) {
-                                       sc.Forward(2);
-                                       sc.SetState(SCE_T3_D_STRING);
-                                       lineState &= ~(T3_SINGLE_QUOTE|T3_INT_EXPRESSION);
-                               } else if (IsATADS3Operator(sc.ch)) {
-                                       if (sc.state == SCE_T3_X_DEFAULT) {
-                                               if (sc.ch == '(') {
-                                                       bracketLevel++;
-                                               } else if (sc.ch == ')') {
-                                                       bracketLevel--;
-                                               }
-                                       }
-                                       ColouriseTADS3Operator(sc);
-                                       visibleChars++;
-                               } else if (IsANumberStart(sc)) {
-                                       ColouriseTADS3Number(sc);
-                                       visibleChars++;
-                               } else if (IsAWordStart(sc.ch)) {
-                                       ColouriseTADS3Keyword(sc, keywordlists, endPos);
-                                       visibleChars++;
-                               } else if (sc.Match("...")) {
-                                       sc.SetState(SCE_T3_IDENTIFIER);
-                                       sc.Forward(3);
-                                       sc.SetState(SCE_T3_DEFAULT);
-                               } else {
-                                       sc.Forward();
-                                       visibleChars++;
-                               }
-                               break;
-                       default:
-                               sc.SetState(SCE_T3_DEFAULT);
-                               sc.Forward();
-               }
-       }
-       sc.Complete();
+                                                           WordList *keywordlists[], Accessor &styler) {
+        int visibleChars = 0;
+        int bracketLevel = 0;
+        int lineState = 0;
+        unsigned int endPos = startPos + length;
+        int lineCurrent = styler.GetLine(startPos);
+        if (lineCurrent > 0) {
+                lineState = styler.GetLineState(lineCurrent-1);
+        }
+        StyleContext sc(startPos, length, initStyle, styler);
+
+        while (sc.More()) {
+
+                if (IsEOL(sc.ch, sc.chNext)) {
+                        styler.SetLineState(lineCurrent, lineState);
+                        lineCurrent++;
+                        visibleChars = 0;
+                        sc.Forward();
+                        if (sc.ch == '\n') {
+                                sc.Forward();
+                        }
+                }
+
+                switch(sc.state) {
+                        case SCE_T3_PREPROCESSOR:
+                        case SCE_T3_LINE_COMMENT:
+                                ColouriseToEndOfLine(sc, sc.state, lineState&T3_INT_EXPRESSION ?
+                                        SCE_T3_X_DEFAULT : SCE_T3_DEFAULT);
+                                break;
+                        case SCE_T3_S_STRING:
+                        case SCE_T3_D_STRING:
+                        case SCE_T3_X_STRING:
+                                ColouriseTADS3String(sc, lineState);
+                                visibleChars++;
+                                break;
+                        case SCE_T3_MSG_PARAM:
+                                ColouriseTADS3MsgParam(sc, lineState);
+                                break;
+                        case SCE_T3_LIB_DIRECTIVE:
+                                ColouriseTADS3LibDirective(sc, lineState);
+                                break;
+                        case SCE_T3_HTML_DEFAULT:
+                                ColouriseTADS3HTMLTag(sc, lineState);
+                                break;
+                        case SCE_T3_HTML_STRING:
+                                ColouriseTADSHTMLString(sc, lineState);
+                                break;
+                        case SCE_T3_BLOCK_COMMENT:
+                                ColouriseTADS3Comment(sc, lineState&T3_INT_EXPRESSION ?
+                                        SCE_T3_X_DEFAULT : SCE_T3_DEFAULT);
+                                break;
+                        case SCE_T3_DEFAULT:
+                        case SCE_T3_X_DEFAULT:
+                                if (IsASpaceOrTab(sc.ch)) {
+                                        sc.Forward();
+                                } else if (sc.ch == '#' && visibleChars == 0) {
+                                        ColouriseToEndOfLine(sc, SCE_T3_PREPROCESSOR, sc.state);
+                                } else if (sc.Match('/', '*')) {
+                                        ColouriseTADS3Comment(sc, sc.state);
+                                        visibleChars++;
+                                } else if (sc.Match('/', '/')) {
+                                        ColouriseToEndOfLine(sc, SCE_T3_LINE_COMMENT, sc.state);
+                                } else if (sc.ch == '"') {
+                                        bracketLevel = 0;
+                                        ColouriseTADS3String(sc, lineState);
+                                        visibleChars++;
+                                } else if (sc.ch == '\'') {
+                                        ColouriseTADS3String(sc, lineState);
+                                        visibleChars++;
+                                } else if (sc.state == SCE_T3_X_DEFAULT && bracketLevel == 0
+                                                   && sc.Match('>', '>')) {
+                                        sc.Forward(2);
+                                        sc.SetState(SCE_T3_D_STRING);
+                                        if (lineState & T3_INT_EXPRESSION_IN_TAG)
+                                                sc.SetState(SCE_T3_HTML_STRING);
+                                        lineState &= ~(T3_SINGLE_QUOTE|T3_INT_EXPRESSION
+                                                       |T3_INT_EXPRESSION_IN_TAG);
+                                } else if (IsATADS3Operator(sc.ch)) {
+                                        if (sc.state == SCE_T3_X_DEFAULT) {
+                                                if (sc.ch == '(') {
+                                                        bracketLevel++;
+                                                } else if (sc.ch == ')' && bracketLevel > 0) {
+                                                        bracketLevel--;
+                                                }
+                                        }
+                                        ColouriseTADS3Operator(sc);
+                                        visibleChars++;
+                                } else if (IsANumberStart(sc)) {
+                                        ColouriseTADS3Number(sc);
+                                        visibleChars++;
+                                } else if (IsAWordStart(sc.ch)) {
+                                        ColouriseTADS3Keyword(sc, keywordlists, endPos);
+                                        visibleChars++;
+                                } else if (sc.Match("...")) {
+                                        sc.SetState(SCE_T3_IDENTIFIER);
+                                        sc.Forward(3);
+                                        sc.SetState(SCE_T3_DEFAULT);
+                                } else {
+                                        sc.Forward();
+                                        visibleChars++;
+                                }
+                                break;
+                        default:
+                                sc.SetState(SCE_T3_DEFAULT);
+                                sc.Forward();
+                }
+        }
+        sc.Complete();
 }
 
 /*
 }
 
 /*
@@ -567,15 +630,15 @@ static void ColouriseTADS3Doc(unsigned int startPos, int length, int initStyle,
 
  // default style
  silverKey : Key 'small silver key' 'small silver key'
 
  // default style
  silverKey : Key 'small silver key' 'small silver key'
-       "A small key glints in the sunlight. "
+        "A small key glints in the sunlight. "
  ;
 
  and
 
  silverKey : Key {
  ;
 
  and
 
  silverKey : Key {
-       'small silver key'
-       'small silver key'
-       "A small key glints in the sunlight. "
+        'small silver key'
+        'small silver key'
+        "A small key glints in the sunlight. "
  }
 
  Some constructs mandate one or the other, but usually the author has may choose
  }
 
  Some constructs mandate one or the other, but usually the author has may choose
@@ -614,224 +677,228 @@ static const int T3_EXPECTINGIDENTIFIER = 1 << 13;
 static const int T3_EXPECTINGPUNCTUATION = 1 << 14;
 
 static inline bool IsStringTransition(int s1, int s2) {
 static const int T3_EXPECTINGPUNCTUATION = 1 << 14;
 
 static inline bool IsStringTransition(int s1, int s2) {
-       return s1 != s2
-               && (s1 == SCE_T3_S_STRING || s1 == SCE_T3_X_STRING
-                       || s1 == SCE_T3_D_STRING && s2 != SCE_T3_X_DEFAULT)
-               && s2 != SCE_T3_LIB_DIRECTIVE
-               && s2 != SCE_T3_MSG_PARAM
-               && s2 != SCE_T3_HTML_TAG
-               && s2 != SCE_T3_HTML_STRING;
+        return s1 != s2
+                && (s1 == SCE_T3_S_STRING || s1 == SCE_T3_X_STRING
+                        || s1 == SCE_T3_D_STRING && s2 != SCE_T3_X_DEFAULT)
+                && s2 != SCE_T3_LIB_DIRECTIVE
+                && s2 != SCE_T3_MSG_PARAM
+                && s2 != SCE_T3_HTML_TAG
+                && s2 != SCE_T3_HTML_STRING;
 }
 
 static inline bool IsATADS3Punctuation(const int ch) {
 }
 
 static inline bool IsATADS3Punctuation(const int ch) {
-       return ch == ':' || ch == ',' || ch == '(' || ch == ')';
+        return ch == ':' || ch == ',' || ch == '(' || ch == ')';
 }
 
 static inline bool IsAnIdentifier(const int style) {
 }
 
 static inline bool IsAnIdentifier(const int style) {
-       return style == SCE_T3_IDENTIFIER
-               || style == SCE_T3_USER1
-               || style == SCE_T3_USER2
-               || style == SCE_T3_USER3;
+        return style == SCE_T3_IDENTIFIER
+                || style == SCE_T3_USER1
+                || style == SCE_T3_USER2
+                || style == SCE_T3_USER3;
+}
+
+static inline bool IsAnOperator(const int style) {
+    return style == SCE_T3_OPERATOR || SCE_T3_BRACE;
 }
 
 static inline bool IsSpaceEquivalent(const int ch, const int style) {
 }
 
 static inline bool IsSpaceEquivalent(const int ch, const int style) {
-       return isspace(ch)
-               || style == SCE_T3_BLOCK_COMMENT
-               || style == SCE_T3_LINE_COMMENT
-               || style == SCE_T3_PREPROCESSOR;
+        return isspace(ch)
+                || style == SCE_T3_BLOCK_COMMENT
+                || style == SCE_T3_LINE_COMMENT
+                || style == SCE_T3_PREPROCESSOR;
 }
 
 static char peekAhead(unsigned int startPos, unsigned int endPos,
 }
 
 static char peekAhead(unsigned int startPos, unsigned int endPos,
-                                         Accessor &styler) {
-       for (unsigned int i = startPos; i < endPos; i++) {
-               int style = styler.StyleAt(i);
-               char ch = styler[i];
-               if (!IsSpaceEquivalent(ch, style)) {
-                       if (IsAnIdentifier(style)) {
-                               return 'a';
-                       }
-                       if (IsATADS3Punctuation(ch)) {
-                               return ':';
-                       }
-                       if (ch == '{') {
-                               return '{';
-                       }
-                       return '*';
-               }
-       }
-       return ' ';
+                                          Accessor &styler) {
+        for (unsigned int i = startPos; i < endPos; i++) {
+                int style = styler.StyleAt(i);
+                char ch = styler[i];
+                if (!IsSpaceEquivalent(ch, style)) {
+                        if (IsAnIdentifier(style)) {
+                                return 'a';
+                        }
+                        if (IsATADS3Punctuation(ch)) {
+                                return ':';
+                        }
+                        if (ch == '{') {
+                                return '{';
+                        }
+                        return '*';
+                }
+        }
+        return ' ';
 }
 
 static void FoldTADS3Doc(unsigned int startPos, int length, int initStyle,
                             WordList *[], Accessor &styler) {
 }
 
 static void FoldTADS3Doc(unsigned int startPos, int length, int initStyle,
                             WordList *[], Accessor &styler) {
-       unsigned int endPos = startPos + length;
-       int lineCurrent = styler.GetLine(startPos);
-       int levelCurrent = SC_FOLDLEVELBASE;
-       if (lineCurrent > 0)
-               levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
-       int seenStart = levelCurrent & T3_SEENSTART;
-       int expectingIdentifier = levelCurrent & T3_EXPECTINGIDENTIFIER;
-       int expectingPunctuation = levelCurrent & T3_EXPECTINGPUNCTUATION;
-       levelCurrent &= SC_FOLDLEVELNUMBERMASK;
-       int levelMinCurrent = levelCurrent;
-       int levelNext = levelCurrent;
-       char chNext = styler[startPos];
-       int styleNext = styler.StyleAt(startPos);
-       int style = initStyle;
-       char ch = chNext;
-       int stylePrev = style;
-       bool redo = false;
-       for (unsigned int i = startPos; i < endPos; i++) {
-               if (redo) {
-                       redo = false;
-                       i--;
-               } else {
-                       ch = chNext;
-                       chNext = styler.SafeGetCharAt(i + 1);
-                       stylePrev = style;
-                       style = styleNext;
-                       styleNext = styler.StyleAt(i + 1);
-               }
-               bool atEOL = IsEOL(ch, chNext);
-
-               if (levelNext == SC_FOLDLEVELBASE) {
-                       if (IsSpaceEquivalent(ch, style)) {
-                               if (expectingPunctuation) {
-                                       expectingIdentifier = 0;
-                               }
-                               if (style == SCE_T3_BLOCK_COMMENT) {
-                                       levelNext++;
-                               }
-                       } else if (ch == '{') {
-                               levelNext++;
-                               seenStart = 0;
-                       } else if (ch == '\'' || ch == '"' || ch == '[') {
-                               levelNext++;
-                               if (seenStart) {
-                                       redo = true;
-                               }
-                       } else if (ch == ';') {
-                               seenStart = 0;
-                               expectingIdentifier = 0;
-                               expectingPunctuation = 0;
-                       } else if (expectingIdentifier && expectingPunctuation) {
-                               if (IsATADS3Punctuation(ch)) {
-                                       if (ch == ')' && peekAhead(i+1, endPos, styler) != '{') {
-                                               levelNext++;
-                                       } else {
-                                               expectingPunctuation = 0;
-                                       }
-                               } else if (!IsAnIdentifier(style)) {
-                                       levelNext++;
-                               }
-                       } else if (expectingIdentifier && !expectingPunctuation) {
-                               if (!IsAnIdentifier(style)) {
-                                       levelNext++;
-                               } else {
-                                       expectingPunctuation = T3_EXPECTINGPUNCTUATION;
-                               }
-                       } else if (!expectingIdentifier && expectingPunctuation) {
-                               if (!IsATADS3Punctuation(ch)) {
-                                       levelNext++;
-                               } else {
-                                       if (ch == ')' && peekAhead(i+1, endPos, styler) != '{') {
-                                               levelNext++;
-                                       } else {
-                                               expectingIdentifier = T3_EXPECTINGIDENTIFIER;
-                                               expectingPunctuation = 0;
-                                       }
-                               }
-                       } else if (!expectingIdentifier && !expectingPunctuation) {
-                               if (IsAnIdentifier(style)) {
-                                       seenStart = T3_SEENSTART;
-                                       expectingIdentifier = T3_EXPECTINGIDENTIFIER;
-                                       expectingPunctuation = T3_EXPECTINGPUNCTUATION;
-                               }
-                       }
-
-                       if (levelNext != SC_FOLDLEVELBASE && style != SCE_T3_BLOCK_COMMENT) {
-                               expectingIdentifier = 0;
-                               expectingPunctuation = 0;
-                       }
-
-               } else if (levelNext == SC_FOLDLEVELBASE+1 && seenStart
-                                  && ch == ';' && style == SCE_T3_OPERATOR ) {
-                       levelNext--;
-                       seenStart = 0;
-               } else if (style == SCE_T3_BLOCK_COMMENT) {
-                       if (stylePrev != SCE_T3_BLOCK_COMMENT) {
-                               levelNext++;
-                       } else if (styleNext != SCE_T3_BLOCK_COMMENT && !atEOL) {
-                               // Comments don't end at end of line and the next character may be unstyled.
-                               levelNext--;
-                       }
-               } else if (ch == '\'' || ch == '"') {
-                       if (IsStringTransition(style, stylePrev)) {
-                               if (levelMinCurrent > levelNext) {
-                                       levelMinCurrent = levelNext;
-                               }
-                               levelNext++;
-                       } else if (IsStringTransition(style, styleNext)) {
-                               levelNext--;
-                       }
-               } else if (style == SCE_T3_OPERATOR) {
-                       if (ch == '{' || ch == '[') {
-                               // Measure the minimum before a '{' to allow
-                               // folding on "} else {"
-                               if (levelMinCurrent > levelNext) {
-                                       levelMinCurrent = levelNext;
-                               }
-                               levelNext++;
-                       } else if (ch == '}' || ch == ']') {
-                               levelNext--;
-                       }
-               }
-
-               if (atEOL) {
-                       if (seenStart && levelNext == SC_FOLDLEVELBASE) {
-                               switch (peekAhead(i+1, endPos, styler)) {
-                                       case ' ':
-                                       case '{':
-                                               break;
-                                       case '*':
-                                               levelNext++;
-                                               break;
-                                       case 'a':
-                                               if (expectingPunctuation) {
-                                                       levelNext++;
-                                               }
-                                               break;
-                                       case ':':
-                                               if (expectingIdentifier) {
-                                                       levelNext++;
-                                               }
-                                               break;
-                               }
-                               if (levelNext != SC_FOLDLEVELBASE) {
-                                       expectingIdentifier = 0;
-                                       expectingPunctuation = 0;
-                               }
-                       }
-                       int lev = levelMinCurrent | (levelNext | expectingIdentifier
-                               | expectingPunctuation | seenStart) << 16;
-                       if (levelMinCurrent < levelNext)
-                               lev |= SC_FOLDLEVELHEADERFLAG;
-                       if (lev != styler.LevelAt(lineCurrent)) {
-                               styler.SetLevel(lineCurrent, lev);
-                       }
-                       lineCurrent++;
-                       levelCurrent = levelNext;
-                       levelMinCurrent = levelCurrent;
-               }
-       }
+        unsigned int endPos = startPos + length;
+        int lineCurrent = styler.GetLine(startPos);
+        int levelCurrent = SC_FOLDLEVELBASE;
+        if (lineCurrent > 0)
+                levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
+        int seenStart = levelCurrent & T3_SEENSTART;
+        int expectingIdentifier = levelCurrent & T3_EXPECTINGIDENTIFIER;
+        int expectingPunctuation = levelCurrent & T3_EXPECTINGPUNCTUATION;
+        levelCurrent &= SC_FOLDLEVELNUMBERMASK;
+        int levelMinCurrent = levelCurrent;
+        int levelNext = levelCurrent;
+        char chNext = styler[startPos];
+        int styleNext = styler.StyleAt(startPos);
+        int style = initStyle;
+        char ch = chNext;
+        int stylePrev = style;
+        bool redo = false;
+        for (unsigned int i = startPos; i < endPos; i++) {
+                if (redo) {
+                        redo = false;
+                        i--;
+                } else {
+                        ch = chNext;
+                        chNext = styler.SafeGetCharAt(i + 1);
+                        stylePrev = style;
+                        style = styleNext;
+                        styleNext = styler.StyleAt(i + 1);
+                }
+                bool atEOL = IsEOL(ch, chNext);
+
+                if (levelNext == SC_FOLDLEVELBASE) {
+                        if (IsSpaceEquivalent(ch, style)) {
+                                if (expectingPunctuation) {
+                                        expectingIdentifier = 0;
+                                }
+                                if (style == SCE_T3_BLOCK_COMMENT) {
+                                        levelNext++;
+                                }
+                        } else if (ch == '{') {
+                                levelNext++;
+                                seenStart = 0;
+                        } else if (ch == '\'' || ch == '"' || ch == '[') {
+                                levelNext++;
+                                if (seenStart) {
+                                        redo = true;
+                                }
+                        } else if (ch == ';') {
+                                seenStart = 0;
+                                expectingIdentifier = 0;
+                                expectingPunctuation = 0;
+                        } else if (expectingIdentifier && expectingPunctuation) {
+                                if (IsATADS3Punctuation(ch)) {
+                                        if (ch == ')' && peekAhead(i+1, endPos, styler) != '{') {
+                                                levelNext++;
+                                        } else {
+                                                expectingPunctuation = 0;
+                                        }
+                                } else if (!IsAnIdentifier(style)) {
+                                        levelNext++;
+                                }
+                        } else if (expectingIdentifier && !expectingPunctuation) {
+                                if (!IsAnIdentifier(style)) {
+                                        levelNext++;
+                                } else {
+                                        expectingPunctuation = T3_EXPECTINGPUNCTUATION;
+                                }
+                        } else if (!expectingIdentifier && expectingPunctuation) {
+                                if (!IsATADS3Punctuation(ch)) {
+                                        levelNext++;
+                                } else {
+                                        if (ch == ')' && peekAhead(i+1, endPos, styler) != '{') {
+                                                levelNext++;
+                                        } else {
+                                                expectingIdentifier = T3_EXPECTINGIDENTIFIER;
+                                                expectingPunctuation = 0;
+                                        }
+                                }
+                        } else if (!expectingIdentifier && !expectingPunctuation) {
+                                if (IsAnIdentifier(style)) {
+                                        seenStart = T3_SEENSTART;
+                                        expectingIdentifier = T3_EXPECTINGIDENTIFIER;
+                                        expectingPunctuation = T3_EXPECTINGPUNCTUATION;
+                                }
+                        }
+
+                        if (levelNext != SC_FOLDLEVELBASE && style != SCE_T3_BLOCK_COMMENT) {
+                                expectingIdentifier = 0;
+                                expectingPunctuation = 0;
+                        }
+
+                } else if (levelNext == SC_FOLDLEVELBASE+1 && seenStart
+                                   && ch == ';' && IsAnOperator(style)) {
+                        levelNext--;
+                        seenStart = 0;
+                } else if (style == SCE_T3_BLOCK_COMMENT) {
+                        if (stylePrev != SCE_T3_BLOCK_COMMENT) {
+                                levelNext++;
+                        } else if (styleNext != SCE_T3_BLOCK_COMMENT && !atEOL) {
+                                // Comments don't end at end of line and the next character may be unstyled.
+                                levelNext--;
+                        }
+                } else if (ch == '\'' || ch == '"') {
+                        if (IsStringTransition(style, stylePrev)) {
+                                if (levelMinCurrent > levelNext) {
+                                        levelMinCurrent = levelNext;
+                                }
+                                levelNext++;
+                        } else if (IsStringTransition(style, styleNext)) {
+                                levelNext--;
+                        }
+                } else if (IsAnOperator(style)) {
+                        if (ch == '{' || ch == '[') {
+                                // Measure the minimum before a '{' to allow
+                                // folding on "} else {"
+                                if (levelMinCurrent > levelNext) {
+                                        levelMinCurrent = levelNext;
+                                }
+                                levelNext++;
+                        } else if (ch == '}' || ch == ']') {
+                                levelNext--;
+                        }
+                }
+
+                if (atEOL) {
+                        if (seenStart && levelNext == SC_FOLDLEVELBASE) {
+                                switch (peekAhead(i+1, endPos, styler)) {
+                                        case ' ':
+                                        case '{':
+                                                break;
+                                        case '*':
+                                                levelNext++;
+                                                break;
+                                        case 'a':
+                                                if (expectingPunctuation) {
+                                                        levelNext++;
+                                                }
+                                                break;
+                                        case ':':
+                                                if (expectingIdentifier) {
+                                                        levelNext++;
+                                                }
+                                                break;
+                                }
+                                if (levelNext != SC_FOLDLEVELBASE) {
+                                        expectingIdentifier = 0;
+                                        expectingPunctuation = 0;
+                                }
+                        }
+                        int lev = levelMinCurrent | (levelNext | expectingIdentifier
+                                | expectingPunctuation | seenStart) << 16;
+                        if (levelMinCurrent < levelNext)
+                                lev |= SC_FOLDLEVELHEADERFLAG;
+                        if (lev != styler.LevelAt(lineCurrent)) {
+                                styler.SetLevel(lineCurrent, lev);
+                        }
+                        lineCurrent++;
+                        levelCurrent = levelNext;
+                        levelMinCurrent = levelCurrent;
+                }
+        }
 }
 
 static const char * const tads3WordList[] = {
 }
 
 static const char * const tads3WordList[] = {
-       "TADS3 Keywords",
-       "User defined 1",
-       "User defined 2",
-       "User defined 3",
-       0
+        "TADS3 Keywords",
+        "User defined 1",
+        "User defined 2",
+        "User defined 3",
+        0
 };
 
 LexerModule lmTADS3(SCLEX_TADS3, ColouriseTADS3Doc, "tads3", FoldTADS3Doc, tads3WordList);
 };
 
 LexerModule lmTADS3(SCLEX_TADS3, ColouriseTADS3Doc, "tads3", FoldTADS3Doc, tads3WordList);
index c78214116401570eaf785d9d8780bea699bddd18..3c175de2a0e6b738af4ef6eb6b87d8ef672cf54a 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 // Extended to accept accented characters
 static inline bool IsAWordChar(int ch) {
        return ch >= 0x80 ||
 // Extended to accept accented characters
 static inline bool IsAWordChar(int ch) {
        return ch >= 0x80 ||
index 65e530adb8b443a4faed89106d508ad5c5ea82d1..e28857a35d312c3dcf949df0240c3bec906cb6be 100644 (file)
 
 // If you run into strange boundary cases, just tell me and I'll look into it.
 
 
 // If you run into strange boundary cases, just tell me and I'll look into it.
 
+
+// TeX Folding code added by instanton (soft_share@126.com) with borrowed code from VisualTeX source by Alex Romanenko.
+// Version: June 22, 2007
+
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include "SciLexer.h"
 #include "StyleContext.h"
 
 #include "SciLexer.h"
 #include "StyleContext.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 // val SCE_TEX_DEFAULT = 0
 // val SCE_TEX_SPECIAL = 1
 // val SCE_TEX_GROUP   = 2
 // val SCE_TEX_DEFAULT = 0
 // val SCE_TEX_SPECIAL = 1
 // val SCE_TEX_GROUP   = 2
@@ -169,9 +177,9 @@ static void ColouriseTeXDoc(
        styler.StartSegment(startPos) ;
 
        bool processComment   = styler.GetPropertyInt("lexer.tex.comment.process",   0) == 1 ;
        styler.StartSegment(startPos) ;
 
        bool processComment   = styler.GetPropertyInt("lexer.tex.comment.process",   0) == 1 ;
-    bool useKeywords      = styler.GetPropertyInt("lexer.tex.use.keywords",      1) == 1 ;
+       bool useKeywords      = styler.GetPropertyInt("lexer.tex.use.keywords",      1) == 1 ;
        bool autoIf           = styler.GetPropertyInt("lexer.tex.auto.if",           1) == 1 ;
        bool autoIf           = styler.GetPropertyInt("lexer.tex.auto.if",           1) == 1 ;
-    int  defaultInterface = styler.GetPropertyInt("lexer.tex.interface.default", 1) ;
+       int  defaultInterface = styler.GetPropertyInt("lexer.tex.interface.default", 1) ;
 
        char key[100] ;
        int  k ;
 
        char key[100] ;
        int  k ;
@@ -272,7 +280,202 @@ static void ColouriseTeXDoc(
 }
 
 
 }
 
 
-// Hooks into the system:
+static inline bool isNumber(int ch) {
+       return
+      (ch == '0') || (ch == '1') || (ch == '2') || 
+      (ch == '3') || (ch == '4') || (ch == '5') || 
+      (ch == '6') || (ch == '7') || (ch == '8') || (ch == '9');
+}
+
+static inline bool isWordChar(int ch) {
+       return ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'));
+}
+
+static int ParseTeXCommand(unsigned int pos, Accessor &styler, char *command)
+{
+  int length=0;
+  char ch=styler.SafeGetCharAt(pos+1);
+  
+  if(ch==',' || ch==':' || ch==';' || ch=='%'){
+      command[0]=ch;
+      command[1]=0;
+         return 1;
+  }
+
+  // find end
+     while(isWordChar(ch) && !isNumber(ch) && ch!='_' && ch!='.' && length<100){
+          command[length]=ch;
+          length++;
+          ch=styler.SafeGetCharAt(pos+length+1);
+     }
+     
+  command[length]='\0';   
+  if(!length) return 0;
+  return length+1;
+}
+
+static int classifyFoldPointTeXPaired(const char* s) {
+       int lev=0; 
+       if (!(isdigit(s[0]) || (s[0] == '.'))){
+               if (strcmp(s, "begin")==0||strcmp(s,"FoldStart")==0||
+                       strcmp(s,"abstract")==0||strcmp(s,"unprotect")==0||
+                       strcmp(s,"title")==0||strncmp(s,"start",5)==0||strncmp(s,"Start",5)==0||
+                       strcmp(s,"documentclass")==0||strncmp(s,"if",2)==0
+                       )
+                       lev=1;
+               if (strcmp(s, "end")==0||strcmp(s,"FoldStop")==0||
+                       strcmp(s,"maketitle")==0||strcmp(s,"protect")==0||
+                       strncmp(s,"stop",4)==0||strncmp(s,"Stop",4)==0||
+                       strcmp(s,"fi")==0
+                       ) 
+               lev=-1;
+       }
+       return lev;
+}
+
+static int classifyFoldPointTeXUnpaired(const char* s) {
+       int lev=0; 
+       if (!(isdigit(s[0]) || (s[0] == '.'))){
+               if (strcmp(s,"part")==0||
+                       strcmp(s,"chapter")==0||
+                       strcmp(s,"section")==0||
+                       strcmp(s,"subsection")==0||
+                       strcmp(s,"subsubsection")==0||
+                       strcmp(s,"CJKfamily")==0||
+                       strcmp(s,"appendix")==0||
+                       strcmp(s,"Topic")==0||strcmp(s,"topic")==0||
+                       strcmp(s,"subject")==0||strcmp(s,"subsubject")==0||
+                       strcmp(s,"def")==0||strcmp(s,"gdef")==0||strcmp(s,"edef")==0||
+                       strcmp(s,"xdef")==0||strcmp(s,"framed")==0||
+                       strcmp(s,"frame")==0||
+                       strcmp(s,"foilhead")==0||strcmp(s,"overlays")==0||strcmp(s,"slide")==0
+                       ){
+                           lev=1;
+                       }
+       }
+       return lev;
+}
+
+static bool IsTeXCommentLine(int line, Accessor &styler) {
+       int pos = styler.LineStart(line);
+       int eol_pos = styler.LineStart(line + 1) - 1;
+       
+       int startpos = pos;
+
+       while (startpos<eol_pos){
+               char ch = styler[startpos];
+               if (ch!='%' && ch!=' ') return false;
+               else if (ch=='%') return true;
+               startpos++;
+       }               
+
+       return false;
+}
+
+// FoldTeXDoc: borrowed from VisualTeX with modifications
+
+static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) 
+{
+       bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+       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];
+       char buffer[100]="";
+       
+       for (unsigned int i=startPos; i < endPos; i++) {
+               char ch=chNext;
+               chNext=styler.SafeGetCharAt(i+1);
+               bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+
+        if(ch=='\\') {
+            ParseTeXCommand(i, styler, buffer);
+                       levelCurrent += classifyFoldPointTeXPaired(buffer)+classifyFoldPointTeXUnpaired(buffer);
+               }
+
+               if((ch == '\r' || ch=='\n') && (chNext == '\\')){
+            ParseTeXCommand(i+1, styler, buffer);
+                       levelCurrent -= classifyFoldPointTeXUnpaired(buffer);
+               }
+
+       char chNext2;
+       char chNext3;
+       char chNext4;
+       char chNext5;
+       chNext2=styler.SafeGetCharAt(i+2);
+       chNext3=styler.SafeGetCharAt(i+3);
+       chNext4=styler.SafeGetCharAt(i+4);
+       chNext5=styler.SafeGetCharAt(i+5);
+
+       bool atEOfold = (ch == '%') && 
+                       (chNext == '%') && (chNext2=='}') && 
+                               (chNext3=='}')&& (chNext4=='-')&& (chNext5=='-');
+
+       bool atBOfold = (ch == '%') && 
+                       (chNext == '%') && (chNext2=='-') && 
+                               (chNext3=='-')&& (chNext4=='{')&& (chNext5=='{');
+
+       if(atBOfold){
+               levelCurrent+=1;
+       }
+
+       if(atEOfold){
+               levelCurrent-=1;
+       }
+       
+       if(ch=='\\' && chNext=='['){
+               levelCurrent+=1;
+       }
+       
+       if(ch=='\\' && chNext==']'){
+               levelCurrent-=1;
+       }
+
+       bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+
+       if (foldComment && atEOL && IsTeXCommentLine(lineCurrent, styler))
+        {
+            if (lineCurrent==0 && IsTeXCommentLine(lineCurrent + 1, styler)
+                               )
+                levelCurrent++;
+            else if (lineCurrent!=0 && !IsTeXCommentLine(lineCurrent - 1, styler)
+               && IsTeXCommentLine(lineCurrent + 1, styler)
+                               )
+                levelCurrent++;
+            else if (lineCurrent!=0 && IsTeXCommentLine(lineCurrent - 1, styler) &&
+                     !IsTeXCommentLine(lineCurrent+1, styler))
+                levelCurrent--;
+        }
+
+//---------------------------------------------------------------------------------------------        
+               
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0 && foldCompact)
+                               lev |= SC_FOLDLEVELWHITEFLAG;
+                       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++;
+       }
+
+       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+       int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+       styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+}
+
+
+
 
 static const char * const texWordListDesc[] = {
     "TeX, eTeX, pdfTeX, Omega",
 
 static const char * const texWordListDesc[] = {
     "TeX, eTeX, pdfTeX, Omega",
@@ -285,4 +488,4 @@ static const char * const texWordListDesc[] = {
        0,
 } ;
 
        0,
 } ;
 
-LexerModule lmTeX(SCLEX_TEX, ColouriseTeXDoc, "tex", 0, texWordListDesc);
+LexerModule lmTeX(SCLEX_TEX,   ColouriseTeXDoc, "tex", FoldTexDoc, texWordListDesc);
index d9f02862913e405ad46234b2ab54557d57477381..a1f9ec7aeabda59df5751f05c6460578ae7314b6 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 // Internal state, highlighted as number
 #define SCE_B_FILENUMBER SCE_B_DEFAULT+100
 
 // Internal state, highlighted as number
 #define SCE_B_FILENUMBER SCE_B_DEFAULT+100
 
@@ -118,20 +122,27 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
                        // VB doubles quotes to preserve them, so just end this string
                        // state now as a following quote will start again
                        if (sc.ch == '\"') {
                        // VB doubles quotes to preserve them, so just end this string
                        // state now as a following quote will start again
                        if (sc.ch == '\"') {
-                               if (tolower(sc.chNext) == 'c') {
+                               if (sc.chNext == '\"') {
                                        sc.Forward();
                                        sc.Forward();
+                               } else {
+                                       if (tolower(sc.chNext) == 'c') {
+                                               sc.Forward();
+                                       }
+                                       sc.ForwardSetState(SCE_B_DEFAULT);
                                }
                                }
-                               sc.ForwardSetState(SCE_B_DEFAULT);
                        } else if (sc.atLineEnd) {
                        } else if (sc.atLineEnd) {
+                               visibleChars = 0;
                                sc.ChangeState(SCE_B_STRINGEOL);
                                sc.ForwardSetState(SCE_B_DEFAULT);
                        }
                } else if (sc.state == SCE_B_COMMENT) {
                        if (sc.atLineEnd) {
                                sc.ChangeState(SCE_B_STRINGEOL);
                                sc.ForwardSetState(SCE_B_DEFAULT);
                        }
                } else if (sc.state == SCE_B_COMMENT) {
                        if (sc.atLineEnd) {
+                               visibleChars = 0;
                                sc.ForwardSetState(SCE_B_DEFAULT);
                        }
                } else if (sc.state == SCE_B_PREPROCESSOR) {
                        if (sc.atLineEnd) {
                                sc.ForwardSetState(SCE_B_DEFAULT);
                        }
                } else if (sc.state == SCE_B_PREPROCESSOR) {
                        if (sc.atLineEnd) {
+                               visibleChars = 0;
                                sc.ForwardSetState(SCE_B_DEFAULT);
                        }
                } else if (sc.state == SCE_B_FILENUMBER) {
                                sc.ForwardSetState(SCE_B_DEFAULT);
                        }
                } else if (sc.state == SCE_B_FILENUMBER) {
@@ -157,6 +168,7 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
                        }
                } else if (sc.state == SCE_B_DATE) {
                        if (sc.atLineEnd) {
                        }
                } else if (sc.state == SCE_B_DATE) {
                        if (sc.atLineEnd) {
+                               visibleChars = 0;
                                sc.ChangeState(SCE_B_STRINGEOL);
                                sc.ForwardSetState(SCE_B_DEFAULT);
                        } else if (sc.ch == '#') {
                                sc.ChangeState(SCE_B_STRINGEOL);
                                sc.ForwardSetState(SCE_B_DEFAULT);
                        } else if (sc.ch == '#') {
index 0feef951206a2ba4b33a2bce5b15b25fe22533d7..c082cdb923b19d2b703e6935621f6314e9e00791 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static void ColouriseVHDLDoc(
   unsigned int startPos,
   int length,
 static void ColouriseVHDLDoc(
   unsigned int startPos,
   int length,
index 43ef7eb37dbdb2d144ea22eee46eb4737d1bb902..16553734640fc7db6d35cc84b6b85a13b2ac0007 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.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 == '_' || ch == '\'');
 }
 static inline bool IsAWordChar(const int ch) {
        return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\'');
 }
index e3053f8140afba05648e89abea088743d6294783..ef5315f247ce504757755c50c587aa6c88af0ec0 100644 (file)
 #include "Scintilla.h"
 #include "SciLexer.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static const char * const yamlWordListDesc[] = {
        "Keywords",
        0
 static const char * const yamlWordListDesc[] = {
        "Keywords",
        0
@@ -33,12 +37,12 @@ static inline bool AtEOL(Accessor &styler, unsigned int i) {
 static unsigned int SpaceCount(char* lineBuffer) {
        if (lineBuffer == NULL)
                return 0;
 static unsigned int SpaceCount(char* lineBuffer) {
        if (lineBuffer == NULL)
                return 0;
-       
+
        char* headBuffer = lineBuffer;
        char* headBuffer = lineBuffer;
-       
+
        while (*headBuffer == ' ')
                headBuffer++;
        while (*headBuffer == ' ')
                headBuffer++;
-       
+
        return headBuffer - lineBuffer;
 }
 
        return headBuffer - lineBuffer;
 }
 
@@ -58,14 +62,14 @@ static void ColouriseYAMLLine(
        unsigned int endPos,
        WordList &keywords,
        Accessor &styler) {
        unsigned int endPos,
        WordList &keywords,
        Accessor &styler) {
-           
+
        unsigned int i = 0;
        bool bInQuotes = false;
        unsigned int indentAmount = SpaceCount(lineBuffer);
        unsigned int i = 0;
        bool bInQuotes = false;
        unsigned int indentAmount = SpaceCount(lineBuffer);
-               
+
        if (currentLine > 0) {
                int parentLineState = styler.GetLineState(currentLine - 1);
        if (currentLine > 0) {
                int parentLineState = styler.GetLineState(currentLine - 1);
-       
+
                if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) {
                        unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK);
                        if (indentAmount > parentIndentAmount) {
                if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) {
                        unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK);
                        if (indentAmount > parentIndentAmount) {
@@ -98,7 +102,8 @@ static void ColouriseYAMLLine(
                if (lineBuffer[i] == '\'' || lineBuffer[i] == '\"') {
                        bInQuotes = !bInQuotes;
                } else if (lineBuffer[i] == ':' && !bInQuotes) {
                if (lineBuffer[i] == '\'' || lineBuffer[i] == '\"') {
                        bInQuotes = !bInQuotes;
                } else if (lineBuffer[i] == ':' && !bInQuotes) {
-                       styler.ColourTo(startLine + i, SCE_YAML_IDENTIFIER);
+                       styler.ColourTo(startLine + i - 1, SCE_YAML_IDENTIFIER);
+                       styler.ColourTo(startLine + i, SCE_YAML_OPERATOR);
                        // Non-folding scalar
                        i++;
                        while ((i < lengthLine) && isspacechar(lineBuffer[i]))
                        // Non-folding scalar
                        i++;
                        while ((i < lengthLine) && isspacechar(lineBuffer[i]))
@@ -126,6 +131,10 @@ static void ColouriseYAMLLine(
                                        styler.ColourTo(endPos, SCE_YAML_ERROR);
                                        return;
                                }
                                        styler.ColourTo(endPos, SCE_YAML_ERROR);
                                        return;
                                }
+                       } else if (lineBuffer[i] == '#') {
+                               styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT);
+                               styler.ColourTo(endPos, SCE_YAML_COMMENT);
+                               return;
                        }
                        styler.SetLineState(currentLine, YAML_STATE_VALUE);
                        if (lineBuffer[i] == '&' || lineBuffer[i] == '*') {
                        }
                        styler.SetLineState(currentLine, YAML_STATE_VALUE);
                        if (lineBuffer[i] == '&' || lineBuffer[i] == '*') {
@@ -165,7 +174,7 @@ static void ColouriseYAMLDoc(unsigned int startPos, int length, int, WordList *k
        unsigned int endPos = startPos + length;
        unsigned int maxPos = styler.Length();
        unsigned int lineCurrent = styler.GetLine(startPos);
        unsigned int endPos = startPos + length;
        unsigned int maxPos = styler.Length();
        unsigned int lineCurrent = styler.GetLine(startPos);
-       
+
        for (unsigned int i = startPos; i < maxPos && i < endPos; i++) {
                lineBuffer[linePos++] = styler[i];
                if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
        for (unsigned int i = startPos; i < maxPos && i < endPos; i++) {
                lineBuffer[linePos++] = styler[i];
                if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
index 6ded13c73ac32b23e2a45265b0b2cf3815f4cb5f..ab0511654f0eaee557ee540f0608faa3a73d316e 100644 (file)
 #include "XPM.h"
 #include "LineMarker.h"
 
 #include "XPM.h"
 #include "LineMarker.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 void LineMarker::RefreshColourPalette(Palette &pal, bool want) {
        pal.WantFind(fore, want);
        pal.WantFind(back, want);
 void LineMarker::RefreshColourPalette(Palette &pal, bool want) {
        pal.WantFind(fore, want);
        pal.WantFind(back, want);
index 8ebdce491831105ba331da610a90c3898442b025..3cb4139f08a2a4d5a0af8f8821f2eac729dafc12 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef LINEMARKER_H
 #define LINEMARKER_H
 
 #ifndef LINEMARKER_H
 #define LINEMARKER_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class LineMarker {
 /**
  */
 class LineMarker {
@@ -51,4 +55,8 @@ public:
        void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);
 };
 
        void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
diff --git a/src/stc/scintilla/src/Partitioning.h b/src/stc/scintilla/src/Partitioning.h
new file mode 100644 (file)
index 0000000..752e696
--- /dev/null
@@ -0,0 +1,184 @@
+// Scintilla source code edit control
+/** @file Partitioning.h
+ ** Data structure used to partition an interval. Used for holding line start/end positions.
+ **/
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef PARTITIONING_H
+#define PARTITIONING_H
+
+/// A split vector of integers with a method for adding a value to all elements 
+/// in a range.
+/// Used by the Partitioning class.
+
+class SplitVectorWithRangeAdd : public SplitVector<int> {
+public:
+       SplitVectorWithRangeAdd(int growSize_) {
+               SetGrowSize(growSize_);
+               ReAllocate(growSize_);
+       }
+       ~SplitVectorWithRangeAdd() {
+       }
+       void RangeAddDelta(int start, int end, int delta) {
+               // end is 1 past end, so end-start is number of elements to change
+               int i = 0;
+               int rangeLength = end - start;
+               int range1Length = rangeLength;
+               int part1Left = part1Length - start;
+               if (range1Length > part1Left)
+                       range1Length = part1Left;
+               while (i < range1Length) {
+                       body[start++] += delta;
+                       i++;
+               }
+               start += gapLength;
+               while (i < rangeLength) {
+                       body[start++] += delta;
+                       i++;
+               }
+       }
+};
+
+/// Divide an interval into multiple partitions.
+/// Useful for breaking a document down into sections such as lines.
+
+class Partitioning {
+private:
+       // To avoid calculating all the partition positions whenever any text is inserted
+       // there may be a step somewhere in the list.
+       int stepPartition;
+       int stepLength;
+       SplitVectorWithRangeAdd *body;
+
+       // Move step forward
+       void ApplyStep(int partitionUpTo) {
+               if (stepLength != 0) {
+                       body->RangeAddDelta(stepPartition+1, partitionUpTo + 1, stepLength);
+               }
+               stepPartition = partitionUpTo;
+               if (stepPartition >= body->Length()-1) {
+                       stepPartition = body->Length()-1;
+                       stepLength = 0;
+               }
+       }
+
+       // Move step backward
+       void BackStep(int partitionDownTo) {
+               if (stepLength != 0) {
+                       body->RangeAddDelta(partitionDownTo+1, stepPartition+1, -stepLength);
+               }
+               stepPartition = partitionDownTo;
+       }
+
+       void Allocate(int growSize) {
+               body = new SplitVectorWithRangeAdd(growSize);
+               stepPartition = 0;
+               stepLength = 0;
+               body->Insert(0, 0);     // This value stays 0 for ever
+               body->Insert(1, 0);     // This is the end of the first partition and will be the start of the second
+       }
+
+public:
+       Partitioning(int growSize) {
+               Allocate(growSize);
+       }
+
+       ~Partitioning() {
+               delete body;
+               body = 0;
+       }
+
+       int Partitions() const {
+               return body->Length()-1;
+       }
+
+       void InsertPartition(int partition, int pos) {
+               if (stepPartition < partition) {
+                       ApplyStep(partition);
+               }
+               body->Insert(partition, pos);
+               stepPartition++;
+       }
+
+       void SetPartitionStartPosition(int partition, int pos) {
+               ApplyStep(partition+1);
+               if ((partition < 0) || (partition > body->Length())) {
+                       return;
+               }
+               body->SetValueAt(partition, pos);
+       }
+
+       void InsertText(int partitionInsert, int delta) {
+               // Point all the partitions after the insertion point further along in the buffer
+               if (stepLength != 0) {
+                       if (partitionInsert >= stepPartition) {
+                               // Fill in up to the new insertion point
+                               ApplyStep(partitionInsert);
+                               stepLength += delta;
+                       } else if (partitionInsert >= (stepPartition - body->Length() / 10)) {
+                               // Close to step but before so move step back
+                               BackStep(partitionInsert);
+                               stepLength += delta;
+                       } else {
+                               ApplyStep(body->Length()-1);
+                               stepPartition = partitionInsert;
+                               stepLength = delta;
+                       }
+               } else {
+                       stepPartition = partitionInsert;
+                       stepLength = delta;
+               }
+       }
+
+       void RemovePartition(int partition) {
+               if (partition > stepPartition) {
+                       ApplyStep(partition);
+                       stepPartition--;
+               } else {
+                       stepPartition--;
+               }
+               body->Delete(partition);
+       }
+
+       int PositionFromPartition(int partition) const {
+               PLATFORM_ASSERT(partition >= 0);
+               PLATFORM_ASSERT(partition < body->Length());
+               if ((partition < 0) || (partition >= body->Length())) {
+                       return 0;
+               }
+               int pos = body->ValueAt(partition);
+               if (partition > stepPartition)
+                       pos += stepLength;
+               return pos;
+       }
+
+       int PartitionFromPosition(int pos) {
+               if (body->Length() <= 1)
+                       return 0;
+               if (pos >= (PositionFromPartition(body->Length()-1)))
+                       return body->Length() - 1 - 1;
+               int lower = 0;
+               int upper = body->Length()-1;
+               do {
+                       int middle = (upper + lower + 1) / 2;   // Round high
+                       int posMiddle = body->ValueAt(middle);
+                       if (middle > stepPartition)
+                               posMiddle += stepLength;
+                       if (pos < posMiddle) {
+                               upper = middle - 1;
+                       } else {
+                               lower = middle;
+                       }
+               } while (lower < upper);
+               return lower;
+       }
+
+       void DeleteAll() {
+               int growSize = body->GetGrowSize();
+               delete body;
+               Allocate(growSize);
+       }
+};
+
+#endif
diff --git a/src/stc/scintilla/src/PositionCache.cxx b/src/stc/scintilla/src/PositionCache.cxx
new file mode 100644 (file)
index 0000000..f40a153
--- /dev/null
@@ -0,0 +1,635 @@
+// Scintilla source code edit control
+/** @file PositionCache.cxx
+ ** Classes for caching layout information.
+ **/
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#include "Platform.h"
+
+#include "Scintilla.h"
+
+#include "SplitVector.h"
+#include "Partitioning.h"
+#include "RunStyles.h"
+#include "ContractionState.h"
+#include "CellBuffer.h"
+#include "KeyMap.h"
+#include "Indicator.h"
+#include "XPM.h"
+#include "LineMarker.h"
+#include "Style.h"
+#include "ViewStyle.h"
+#include "CharClassify.h"
+#include "Decoration.h"
+#include "Document.h"
+#include "PositionCache.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+static inline bool IsControlCharacter(int ch) {
+       // iscntrl returns true for lots of chars > 127 which are displayable
+       return ch >= 0 && ch < ' ';
+}
+
+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_;
+}
+
+int LineLayout::LineStart(int line) const {
+       if (line <= 0) {
+               return 0;
+       } else if ((line >= lines) || !lineStarts) {
+               return numCharsInLine;
+       } else {
+               return lineStarts[line];
+       }
+}
+
+int LineLayout::LineLastVisible(int line) const {
+       if (line < 0) {
+               return 0;
+       } else if ((line >= lines-1) || !lineStarts) {
+               int startLine = LineStart(line);
+               int endLine = numCharsInLine;
+               while ((endLine > startLine) && IsEOLChar(chars[endLine-1])) {
+                       endLine--;
+               }
+               return endLine;
+       } else {
+               return lineStarts[line+1];
+       }
+}
+
+bool LineLayout::InLine(int offset, int line) const {
+       return ((offset >= LineStart(line)) && (offset < LineStart(line + 1)) ||
+               ((offset == numCharsInLine) && (line == (lines-1))));
+}
+
+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;
+}
+
+int LineLayout::FindBefore(int x, int lower, int upper) const {
+       do {
+               int middle = (upper + lower + 1) / 2;   // Round high
+               int posMiddle = positions[middle];
+               if (x < posMiddle) {
+                       upper = middle - 1;
+               } else {
+                       lower = middle;
+               }
+       } while (lower < upper);
+       return lower;
+}
+
+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;
+       }
+
+       return ret;
+}
+
+void LineLayoutCache::Dispose(LineLayout *ll) {
+       allInvalidated = false;
+       if (ll) {
+               if (!ll->inCache) {
+                       delete ll;
+               } else {
+                       useCount--;
+               }
+       }
+}
+
+void BreakFinder::Insert(int val) {
+       // Expand if needed
+       if (saeLen >= saeSize) {
+               saeSize *= 2;
+               int *selAndEdgeNew = new int[saeSize];
+               for (unsigned int j = 0; j<saeLen; j++) {
+                       selAndEdgeNew[j] = selAndEdge[j];
+               }
+               delete []selAndEdge;
+               selAndEdge = selAndEdgeNew;
+       }
+
+       if (val >= nextBreak) {
+               for (unsigned int j = 0; j<saeLen; j++) {
+                       if (val == selAndEdge[j]) {
+                               return;
+                       } if (val < selAndEdge[j]) {
+                               for (unsigned int k = saeLen; k>j; k--) {
+                                       selAndEdge[k] = selAndEdge[k-1];
+                               }
+                               saeLen++;
+                               selAndEdge[j] = val;
+                               return;
+                       }
+               }
+               // Not less than any so append
+               selAndEdge[saeLen++] = val;
+       }
+}
+
+extern bool BadUTF(const char *s, int len, int &trailBytes);
+
+static int NextBadU(const char *s, int p, int len, int &trailBytes) {
+       while (p < len) {
+               p++;
+               if (BadUTF(s + p, len - p, trailBytes))
+                       return p;
+       }
+       return -1;
+}
+
+BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, bool utf8_, int xStart) :
+       ll(ll_),
+       lineStart(lineStart_),
+       lineEnd(lineEnd_),
+       posLineStart(posLineStart_),
+       utf8(utf8_),
+       nextBreak(lineStart_),
+       saeSize(0),
+       saeLen(0),
+       saeCurrentPos(0),
+       saeNext(0),
+       subBreak(-1) {
+       saeSize = 8;
+       selAndEdge = new int[saeSize];
+       for (unsigned int j=0; j < saeSize; j++) {
+               selAndEdge[j] = 0;
+       }
+
+       // Search for first visible break
+       // First find the first visible character
+       nextBreak = ll->FindBefore(xStart, lineStart, lineEnd);
+       // Now back to a style break
+       while ((nextBreak > lineStart) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) {
+               nextBreak--;
+       }
+
+       if (ll->selStart != ll->selEnd) {
+               Insert(ll->selStart - posLineStart - 1);
+               Insert(ll->selEnd - posLineStart - 1);
+       }
+
+       Insert(ll->edgeColumn - 1);
+       Insert(lineEnd - 1);
+
+       if (utf8) {
+               int trailBytes=0;
+               for (int pos = -1;;) {
+                       pos = NextBadU(ll->chars, pos, lineEnd, trailBytes);
+                       if (pos < 0)
+                               break;
+                       Insert(pos-1);
+                       Insert(pos);
+               }
+       }
+       saeNext = (saeLen > 0) ? selAndEdge[0] : -1;
+}
+
+BreakFinder::~BreakFinder() {
+       delete []selAndEdge;
+}
+
+int BreakFinder::First() {
+       return nextBreak;
+}
+
+int BreakFinder::Next() {
+       if (subBreak == -1) {
+               int prev = nextBreak;
+               while (nextBreak < lineEnd) {
+                       if ((ll->styles[nextBreak] != ll->styles[nextBreak + 1]) ||
+                                       (nextBreak == saeNext) ||
+                                       IsControlCharacter(ll->chars[nextBreak]) || IsControlCharacter(ll->chars[nextBreak + 1])) {
+                               if (nextBreak == saeNext) {
+                                       saeCurrentPos++;
+                                       saeNext = (saeLen > saeCurrentPos) ? selAndEdge[saeCurrentPos] : -1;
+                               }
+                               nextBreak++;
+                               if ((nextBreak - prev) < lengthStartSubdivision) {
+                                       return nextBreak;
+                               }
+                               break;
+                       }
+                       nextBreak++;
+               }
+               if ((nextBreak - prev) < lengthStartSubdivision) {
+                       return nextBreak;
+               }
+               subBreak = prev;
+       }
+       // Splitting up a long run from prev to nextBreak in lots of approximately lengthEachSubdivision.
+       // For very long runs add extra breaks after spaces or if no spaces before low punctuation.
+       if ((nextBreak - subBreak) <= lengthEachSubdivision) {
+               subBreak = -1;
+               return nextBreak;
+       } else {
+               int lastGoodBreak = -1;
+               int lastOKBreak = -1;
+               int j;
+               for (j = subBreak + 1; j <= nextBreak; j++) {
+                       if (IsSpaceOrTab(ll->chars[j - 1]) && !IsSpaceOrTab(ll->chars[j])) {
+                               lastGoodBreak = j;
+                       }
+                       if (ll->chars[j] < 'A') {
+                               lastOKBreak = j;
+                       }
+                       if (((j - subBreak) >= lengthEachSubdivision) && ((lastGoodBreak >= 0) || (lastOKBreak >= 0))) {
+                               break;
+                       }
+               }
+               if (lastGoodBreak >= 0) {
+                       subBreak = lastGoodBreak;
+               } else if (lastOKBreak >= 0) {
+                       subBreak = lastOKBreak;
+               } else {
+                       subBreak = nextBreak;
+               }
+               if (subBreak >= nextBreak) {
+                       subBreak = -1;
+                       return nextBreak;
+               } else {
+                       return subBreak;
+               }
+       }
+}
+
+PositionCacheEntry::PositionCacheEntry() :
+       styleNumber(0), len(0), clock(0), positions(0) {
+}
+
+void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_,
+       unsigned int len_, int *positions_, unsigned int clock_) {
+       Clear();
+       styleNumber = styleNumber_;
+       len = len_;
+       clock = clock_;
+       if (s_ && positions_) {
+               positions = new short[len + (len + 1) / 2];
+               for (unsigned int i=0;i<len;i++) {
+                       positions[i] = static_cast<short>(positions_[i]);
+               }
+               memcpy(reinterpret_cast<char *>(positions + len), s_, len);
+       }
+}
+
+PositionCacheEntry::~PositionCacheEntry() {
+       Clear();
+}
+
+void PositionCacheEntry::Clear() {
+       delete []positions;
+       positions = 0;
+       styleNumber = 0;
+       len = 0;
+       clock = 0;
+}
+
+bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
+       unsigned int len_, int *positions_) const {
+       if ((styleNumber == styleNumber_) && (len == len_) &&
+               (memcmp(reinterpret_cast<char *>(positions + len), s_, len)== 0)) {
+               for (unsigned int i=0;i<len;i++) {
+                       positions_[i] = positions[i];
+               }
+               return true;
+       } else {
+               return false;
+       }
+}
+
+int PositionCacheEntry::Hash(unsigned int styleNumber, const char *s, unsigned int len) {
+       unsigned int ret = s[0] << 7;
+       for (unsigned int i=0; i<len; i++) {
+               ret *= 1000003;
+               ret ^= s[i];
+       }
+       ret *= 1000003;
+       ret ^= len;
+       ret *= 1000003;
+       ret ^= styleNumber;
+       return ret;
+}
+
+bool PositionCacheEntry::NewerThan(const PositionCacheEntry &other) {
+       return clock > other.clock;
+}
+
+void PositionCacheEntry::ResetClock() {
+       if (clock > 0) {
+               clock = 1;
+       }
+}
+
+PositionCache::PositionCache() {
+       size = 0x400;
+       clock = 1;
+       pces = new PositionCacheEntry[size];
+       allClear = true;
+}
+
+PositionCache::~PositionCache() {
+       Clear();
+       delete []pces;
+}
+
+void PositionCache::Clear() {
+       if (!allClear) {
+               for (size_t i=0;i<size;i++) {
+                       pces[i].Clear();
+               }
+       }
+       clock = 1;
+       allClear = true;
+}
+
+void PositionCache::SetSize(size_t size_) {
+       Clear();
+       delete []pces;
+       size = size_;
+       pces = new PositionCacheEntry[size];
+}
+
+void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber,
+       const char *s, unsigned int len, int *positions) {
+       allClear = false;
+       int probe = -1;
+       if ((size > 0) && (len < 30)) {
+               // Only store short strings in the cache so it doesn't churn with
+               // long comments with only a single comment.
+
+               // Two way associative: try two probe positions.
+               int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
+               probe = hashValue % size;
+               if (pces[probe].Retrieve(styleNumber, s, len, positions)) {
+                       return;
+               }
+               int probe2 = (hashValue * 37) % size;
+               if (pces[probe2].Retrieve(styleNumber, s, len, positions)) {
+                       return;
+               }
+               // Not found. Choose the oldest of the two slots to replace
+               if (pces[probe].NewerThan(pces[probe2])) {
+                       probe = probe2;
+               }
+       }
+       surface->MeasureWidths(vstyle.styles[styleNumber].font, s, len, positions);
+       if (probe >= 0) {
+               clock++;
+               if (clock > 60000) {
+                       // Since there are only 16 bits for the clock, wrap it round and
+                       // reset all cache entries so none get stuck with a high clock.
+                       for (size_t i=0;i<size;i++) {
+                               pces[i].ResetClock();
+                       }
+                       clock = 2;
+               }
+               pces[probe].Set(styleNumber, s, len, positions, clock);
+       }
+}
diff --git a/src/stc/scintilla/src/PositionCache.h b/src/stc/scintilla/src/PositionCache.h
new file mode 100644 (file)
index 0000000..5d486cb
--- /dev/null
@@ -0,0 +1,166 @@
+// Scintilla source code edit control
+/** @file PositionCache.h
+ ** Classes for caching layout information.
+ **/
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef POSITIONCACHE_H
+#define POSITIONCACHE_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+static inline bool IsEOLChar(char ch) {
+       return (ch == '\r') || (ch == '\n');
+}
+
+/**
+ */
+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) const;
+       int LineLastVisible(int line) const;
+       bool InLine(int offset, int line) const;
+       void SetLineStart(int line, int start);
+       void SetBracesHighlight(Range rangeLine, Position braces[],
+               char bracesMatchStyle, int xHighlight);
+       void RestoreBracesHighlight(Range rangeLine, Position braces[]);
+       int FindBefore(int x, int lower, int upper) const;
+};
+
+/**
+ */
+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);
+};
+
+class PositionCacheEntry {
+       unsigned int styleNumber:8;
+       unsigned int len:8;
+       unsigned int clock:16;
+       short *positions;
+public:
+       PositionCacheEntry();
+       ~PositionCacheEntry();
+       void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_, unsigned int clock);
+       void Clear();
+       bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const;
+       static int Hash(unsigned int styleNumber, const char *s, unsigned int len);
+       bool NewerThan(const PositionCacheEntry &other);
+       void ResetClock();
+};
+
+// Class to break a line of text into shorter runs at sensible places.
+class BreakFinder {
+       // If a whole run is longer than lengthStartSubdivision then subdivide
+       // into smaller runs at spaces or punctuation.
+       enum { lengthStartSubdivision = 300 };
+       // Try to make each subdivided run lengthEachSubdivision or shorter.
+       enum { lengthEachSubdivision = 100 };
+       LineLayout *ll;
+       int lineStart;
+       int lineEnd;
+       int posLineStart;
+       bool utf8;
+       int nextBreak;
+       int *selAndEdge;
+       unsigned int saeSize;
+       unsigned int saeLen;
+       unsigned int saeCurrentPos;
+       int saeNext;
+       int subBreak;
+       void Insert(int val);
+public:
+       BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, bool utf8_, int xStart);
+       ~BreakFinder();
+       int First();
+       int Next();
+};
+
+class PositionCache {
+       PositionCacheEntry *pces;
+       size_t size;
+       unsigned int clock;
+       bool allClear;
+public:
+       PositionCache();
+       ~PositionCache();
+       void Clear();
+       void SetSize(size_t size_);
+       int GetSize() { return size; }
+       void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber,
+               const char *s, unsigned int len, int *positions);
+};
+
+inline bool IsSpaceOrTab(int ch) {
+       return ch == ' ' || ch == '\t';
+}
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif
index b4011a04c7e3ba7079571318326316445a17a153..a1c366c3be4e7b2c14a018af19e6e162f6bab2fd 100644 (file)
 
 #include "PropSet.h"
 
 
 #include "PropSet.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 // The comparison and case changing functions here assume ASCII
 // or extended ASCII such as the normal Windows code page.
 
 // The comparison and case changing functions here assume ASCII
 // or extended ASCII such as the normal Windows code page.
 
@@ -329,8 +333,6 @@ char *SContainer::StringAllocate(const char *s, lenpos_t len) {
 
 // End SString functions
 
 
 // End SString functions
 
-bool PropSet::caseSensitiveFilenames = false;
-
 PropSet::PropSet() {
        superPS = 0;
        for (int root = 0; root < hashRoots; root++)
 PropSet::PropSet() {
        superPS = 0;
        for (int root = 0; root < hashRoots; root++)
@@ -422,7 +424,7 @@ void PropSet::SetMultiple(const char *s) {
        Set(s);
 }
 
        Set(s);
 }
 
-SString PropSet::Get(const char *key) {
+SString PropSet::Get(const char *key) const {
        unsigned int hash = HashString(key, strlen(key));
        for (Property *p = props[hash % hashRoots]; p; p = p->next) {
                if ((hash == p->hash) && (0 == strcmp(p->key, key))) {
        unsigned int hash = HashString(key, strlen(key));
        for (Property *p = props[hash % hashRoots]; p; p = p->next) {
                if ((hash == p->hash) && (0 == strcmp(p->key, key))) {
@@ -437,21 +439,6 @@ SString PropSet::Get(const char *key) {
        }
 }
 
        }
 }
 
-bool PropSet::IncludesVar(const char *value, const char *key) {
-       const char *var = strstr(value, "$(");
-       while (var) {
-               if (isprefix(var + 2, key) && (var[2 + strlen(key)] == ')')) {
-                       // Found $(key) which would lead to an infinite loop so exit
-                       return true;
-               }
-               var = strstr(var + 2, ")");
-               if (var)
-                       var = strstr(var + 1, "$(");
-       }
-       return false;
-}
-
-
 // There is some inconsistency between GetExpanded("foo") and Expand("$(foo)").
 // A solution is to keep a stack of variables that have been expanded, so that
 // recursive expansions can be skipped.  For now I'll just use the C++ stack
 // There is some inconsistency between GetExpanded("foo") and Expand("$(foo)").
 // A solution is to keep a stack of variables that have been expanded, so that
 // recursive expansions can be skipped.  For now I'll just use the C++ stack
@@ -469,7 +456,7 @@ struct VarChain {
        const VarChain *link;
 };
 
        const VarChain *link;
 };
 
-static int ExpandAllInPlace(PropSet &props, SString &withVars, int maxExpands, const VarChain &blankVars = VarChain()) {
+static int ExpandAllInPlace(const PropSet &props, SString &withVars, int maxExpands, const VarChain &blankVars = VarChain()) {
        int varStart = withVars.search("$(");
        while ((varStart >= 0) && (maxExpands > 0)) {
                int varEnd = withVars.search(")", varStart+2);
        int varStart = withVars.search("$(");
        while ((varStart >= 0) && (maxExpands > 0)) {
                int varEnd = withVars.search(")", varStart+2);
@@ -505,20 +492,19 @@ static int ExpandAllInPlace(PropSet &props, SString &withVars, int maxExpands, c
        return maxExpands;
 }
 
        return maxExpands;
 }
 
-
-SString PropSet::GetExpanded(const char *key) {
+SString PropSet::GetExpanded(const char *key) const {
        SString val = Get(key);
        ExpandAllInPlace(*this, val, 100, VarChain(key));
        return val;
 }
 
        SString val = Get(key);
        ExpandAllInPlace(*this, val, 100, VarChain(key));
        return val;
 }
 
-SString PropSet::Expand(const char *withVars, int maxExpands) {
+SString PropSet::Expand(const char *withVars, int maxExpands) const {
        SString val = withVars;
        ExpandAllInPlace(*this, val, maxExpands);
        return val;
 }
 
        SString val = withVars;
        ExpandAllInPlace(*this, val, maxExpands);
        return val;
 }
 
-int PropSet::GetInt(const char *key, int defaultValue) {
+int PropSet::GetInt(const char *key, int defaultValue) const {
        SString val = GetExpanded(key);
        if (val.length())
                return val.value();
        SString val = GetExpanded(key);
        if (val.length())
                return val.value();
@@ -538,118 +524,6 @@ bool isprefix(const char *target, const char *prefix) {
                return true;
 }
 
                return true;
 }
 
-static bool IsSuffix(const char *target, const char *suffix, bool caseSensitive) {
-       size_t lentarget = strlen(target);
-       size_t lensuffix = strlen(suffix);
-       if (lensuffix > lentarget)
-               return false;
-       if (caseSensitive) {
-               for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) {
-                       if (target[i + lentarget - lensuffix] != suffix[i])
-                               return false;
-               }
-       } else {
-       for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) {
-               if (MakeUpperCase(target[i + lentarget - lensuffix]) !=
-                       MakeUpperCase(suffix[i]))
-                       return false;
-       }
-       }
-       return true;
-}
-
-SString PropSet::GetWild(const char *keybase, const char *filename) {
-       for (int root = 0; root < hashRoots; root++) {
-               for (Property *p = props[root]; p; p = p->next) {
-                       if (isprefix(p->key, keybase)) {
-                               char * orgkeyfile = p->key + strlen(keybase);
-                               char *keyfile = NULL;
-
-                               if (strstr(orgkeyfile, "$(") == orgkeyfile) {
-                                       char *cpendvar = strchr(orgkeyfile, ')');
-                                       if (cpendvar) {
-                                               *cpendvar = '\0';
-                                               SString s = GetExpanded(orgkeyfile + 2);
-                                               *cpendvar = ')';
-                                               keyfile = StringDup(s.c_str());
-                                       }
-                               }
-                               char *keyptr = keyfile;
-
-                               if (keyfile == NULL)
-                                       keyfile = orgkeyfile;
-
-                               for (;;) {
-                                       char *del = strchr(keyfile, ';');
-                                       if (del == NULL)
-                                               del = keyfile + strlen(keyfile);
-                                       char delchr = *del;
-                                       *del = '\0';
-                                       if (*keyfile == '*') {
-                                               if (IsSuffix(filename, keyfile + 1, caseSensitiveFilenames)) {
-                                                       *del = delchr;
-                                                       delete []keyptr;
-                                                       return p->val;
-                                               }
-                                       } else if (0 == strcmp(keyfile, filename)) {
-                                               *del = delchr;
-                                               delete []keyptr;
-                                               return p->val;
-                                       }
-                                       if (delchr == '\0')
-                                               break;
-                                       *del = delchr;
-                                       keyfile = del + 1;
-                               }
-                               delete []keyptr;
-
-                               if (0 == strcmp(p->key, keybase)) {
-                                       return p->val;
-                               }
-                       }
-               }
-       }
-       if (superPS) {
-               // Failed here, so try in base property set
-               return superPS->GetWild(keybase, filename);
-       } else {
-               return "";
-       }
-}
-
-
-
-// GetNewExpand does not use Expand as it has to use GetWild with the filename for each
-// variable reference found.
-SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
-       char *base = StringDup(GetWild(keybase, filename).c_str());
-       char *cpvar = strstr(base, "$(");
-       int maxExpands = 1000;  // Avoid infinite expansion of recursive definitions
-       while (cpvar && (maxExpands > 0)) {
-               char *cpendvar = strchr(cpvar, ')');
-               if (cpendvar) {
-                       int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
-                       char *var = StringDup(cpvar + 2, lenvar);
-                       SString val = GetWild(var, filename);
-                       if (0 == strcmp(var, keybase))
-                               val.clear(); // Self-references evaluate to empty string
-                       size_t newlenbase = strlen(base) + val.length() - lenvar;
-                       char *newbase = new char[newlenbase];
-                       strncpy(newbase, base, cpvar - base);
-                       strcpy(newbase + (cpvar - base), val.c_str());
-                       strcpy(newbase + (cpvar - base) + val.length(), cpendvar + 1);
-                       delete []var;
-                       delete []base;
-                       base = newbase;
-               }
-               cpvar = strstr(base, "$(");
-               maxExpands--;
-       }
-       SString sret = base;
-       delete []base;
-       return sret;
-}
-
 void PropSet::Clear() {
        for (int root = 0; root < hashRoots; root++) {
                Property *p = props[root];
 void PropSet::Clear() {
        for (int root = 0; root < hashRoots; root++) {
                Property *p = props[root];
@@ -667,7 +541,7 @@ void PropSet::Clear() {
        }
 }
 
        }
 }
 
-char *PropSet::ToString() {
+char *PropSet::ToString() const {
        size_t len=0;
        for (int r = 0; r < hashRoots; r++) {
                for (Property *p = props[r]; p; p = p->next) {
        size_t len=0;
        for (int r = 0; r < hashRoots; r++) {
                for (Property *p = props[r]; p; p = p->next) {
@@ -695,50 +569,6 @@ char *PropSet::ToString() {
        return ret;
 }
 
        return ret;
 }
 
-/**
- * Initiate enumeration.
- */
-bool PropSet::GetFirst(char **key, char **val) {
-       for (int i = 0; i < hashRoots; i++) {
-               for (Property *p = props[i]; p; p = p->next) {
-                       if (p) {
-                               *key = p->key;
-                               *val = p->val;
-                               enumnext = p->next; // GetNext will begin here ...
-                               enumhash = i;             // ... in this block
-                               return true;
-                       }
-               }
-       }
-       return false;
-}
-
-/**
- * Continue enumeration.
- */
-bool PropSet::GetNext(char ** key, char ** val) {
-       bool firstloop = true;
-
-       // search begins where we left it : in enumhash block
-       for (int i = enumhash; i < hashRoots; i++) {
-               if (!firstloop)
-                       enumnext = props[i]; // Begin with first property in block
-               // else : begin where we left
-               firstloop = false;
-
-               for (Property *p = enumnext; p; p = p->next) {
-                       if (p) {
-                               *key = p->key;
-                               *val = p->val;
-                               enumnext = p->next; // for GetNext
-                               enumhash = i;
-                               return true;
-                       }
-               }
-       }
-       return false;
-}
-
 /**
  * Creates an array that points into each word in the string and puts \0 terminators
  * after each word.
 /**
  * Creates an array that points into each word in the string and puts \0 terminators
  * after each word.
@@ -792,59 +622,29 @@ void WordList::Clear() {
        if (words) {
                delete []list;
                delete []words;
        if (words) {
                delete []list;
                delete []words;
-               delete []wordsNoCase;
        }
        words = 0;
        }
        words = 0;
-       wordsNoCase = 0;
        list = 0;
        len = 0;
        sorted = false;
        list = 0;
        len = 0;
        sorted = false;
-       sortedNoCase = false;
 }
 
 void WordList::Set(const char *s) {
        list = StringDup(s);
        sorted = false;
 }
 
 void WordList::Set(const char *s) {
        list = StringDup(s);
        sorted = false;
-       sortedNoCase = false;
        words = ArrayFromWordList(list, &len, onlyLineEnds);
        words = ArrayFromWordList(list, &len, onlyLineEnds);
-       wordsNoCase = new char * [len + 1];
-       memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
 }
 
 }
 
-char *WordList::Allocate(int size) {
-       list = new char[size + 1];
-       list[size] = '\0';
-       return list;
-}
-
-void WordList::SetFromAllocated() {
-       sorted = false;
-       sortedNoCase = false;
-       words = ArrayFromWordList(list, &len, onlyLineEnds);
-       wordsNoCase = new char * [len + 1];
-       memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
-}
-
-int cmpString(const void *a1, const void *a2) {
+extern "C" int cmpString(const void *a1, const void *a2) {
        // Can't work out the correct incantation to use modern casts here
        return strcmp(*(char**)(a1), *(char**)(a2));
 }
 
        // Can't work out the correct incantation to use modern casts here
        return strcmp(*(char**)(a1), *(char**)(a2));
 }
 
-int cmpStringNoCase(const void *a1, const void *a2) {
-       // Can't work out the correct incantation to use modern casts here
-       return CompareCaseInsensitive(*(char**)(a1), *(char**)(a2));
-}
-
 static void SortWordList(char **words, unsigned int len) {
        qsort(reinterpret_cast<void*>(words), len, sizeof(*words),
              cmpString);
 }
 
 static void SortWordList(char **words, unsigned int len) {
        qsort(reinterpret_cast<void*>(words), len, sizeof(*words),
              cmpString);
 }
 
-static void SortWordListNoCase(char **wordsNoCase, unsigned int len) {
-       qsort(reinterpret_cast<void*>(wordsNoCase), len, sizeof(*wordsNoCase),
-             cmpStringNoCase);
-}
-
 bool WordList::InList(const char *s) {
        if (0 == words)
                return false;
 bool WordList::InList(const char *s) {
        if (0 == words)
                return false;
@@ -861,7 +661,7 @@ bool WordList::InList(const char *s) {
        unsigned char firstChar = s[0];
        int j = starts[firstChar];
        if (j >= 0) {
        unsigned char firstChar = s[0];
        int j = starts[firstChar];
        if (j >= 0) {
-               while (words[j][0] == firstChar) {
+               while ((unsigned char)words[j][0] == firstChar) {
                        if (s[1] == words[j][1]) {
                                const char *a = words[j] + 1;
                                const char *b = s + 1;
                        if (s[1] == words[j][1]) {
                                const char *a = words[j] + 1;
                                const char *b = s + 1;
@@ -953,218 +753,3 @@ bool WordList::InListAbbreviated(const char *s, const char marker) {
        }
        return false;
 }
        }
        return false;
 }
-
-/**
- * Returns an element (complete) of the wordlist array which has
- * the same beginning as the passed string.
- * The length of the word to compare is passed too.
- * Letter case can be ignored or preserved (default).
- */
-const char *WordList::GetNearestWord(const char *wordStart, int searchLen, bool ignoreCase /*= false*/, SString wordCharacters /*='/0' */, int wordIndex /*= -1 */) {
-       int start = 0; // lower bound of the api array block to search
-       int end = len - 1; // upper bound of the api array block to search
-       int pivot; // index of api array element just being compared
-       int cond; // comparison result (in the sense of strcmp() result)
-       const char *word; // api array element just being compared
-
-       if (0 == words)
-               return NULL;
-       if (ignoreCase) {
-               if (!sortedNoCase) {
-                       sortedNoCase = true;
-                       SortWordListNoCase(wordsNoCase, len);
-               }
-               while (start <= end) { // binary searching loop
-                       pivot = (start + end) >> 1;
-                       word = wordsNoCase[pivot];
-                       cond = CompareNCaseInsensitive(wordStart, word, searchLen);
-                       if (!cond) {
-                               // find first word
-                               start = pivot;
-                               while (start > 0 && !CompareNCaseInsensitive(wordStart, wordsNoCase[start-1], searchLen)) {
-                                       start--;
-                               }
-                               // find last word
-                               end = pivot;
-                               while (end < len-1 && !CompareNCaseInsensitive(wordStart, wordsNoCase[end+1], searchLen)) {
-                                       end++;
-                               }
-
-                               // Finds first word in a series of equal words
-                               for (pivot = start; pivot <= end; pivot++) {
-                                       word = wordsNoCase[pivot];
-                                       if (!wordCharacters.contains(word[searchLen])) {
-                                               if (wordIndex <= 0) // Checks if a specific index was requested
-                                                       return word; // result must not be freed with free()
-                                               wordIndex--;
-                                       }
-                               }
-                               return NULL;
-                       }
-                       else if (cond > 0)
-                               start = pivot + 1;
-                       else if (cond < 0)
-                               end = pivot - 1;
-               }
-       } else { // preserve the letter case
-               if (!sorted) {
-                       sorted = true;
-                       SortWordList(words, len);
-               }
-               while (start <= end) { // binary searching loop
-                       pivot = (start + end) >> 1;
-                       word = words[pivot];
-                       cond = strncmp(wordStart, word, searchLen);
-                       if (!cond) {
-                               // find first word
-                               start = pivot;
-                               while (start > 0 && !strncmp(wordStart, words[start-1], searchLen)) {
-                                       start--;
-                               }
-                               // find last word
-                               end = pivot;
-                               while (end < len-1 && !strncmp(wordStart, words[end+1], searchLen)) {
-                                       end++;
-                               }
-
-                               // Finds first word in a series of equal words
-                               pivot = start;
-                               while (pivot <= end) {
-                                       word = words[pivot];
-                                       if (!wordCharacters.contains(word[searchLen])) {
-                                               if (wordIndex <= 0) // Checks if a specific index was requested
-                                                       return word; // result must not be freed with free()
-                                               wordIndex--;
-                                       }
-                                       pivot++;
-                               }
-                               return NULL;
-                       }
-                       else if (cond > 0)
-                               start = pivot + 1;
-                       else if (cond < 0)
-                               end = pivot - 1;
-               }
-       }
-       return NULL;
-}
-
-/**
- * Find the length of a 'word' which is actually an identifier in a string
- * which looks like "identifier(..." or "identifier" and where
- * there may be extra spaces after the identifier that should not be
- * counted in the length.
- */
-static unsigned int LengthWord(const char *word, char otherSeparator) {
-       // Find a '('. If that fails go to the end of the string.
-       const char *endWord = strchr(word, '(');
-       if (!endWord && otherSeparator)
-               endWord = strchr(word, otherSeparator);
-       if (!endWord)
-               endWord = word + strlen(word);
-       // Last case always succeeds so endWord != 0
-
-       // Drop any space characters.
-       if (endWord > word) {
-               endWord--;      // Back from the '(', otherSeparator, or '\0'
-               // Move backwards over any spaces
-               while ((endWord > word) && (IsASpace(*endWord))) {
-                       endWord--;
-               }
-       }
-       return endWord - word;
-}
-
-/**
- * Returns elements (first words of them) of the wordlist array which have
- * the same beginning as the passed string.
- * The length of the word to compare is passed too.
- * Letter case can be ignored or preserved (default).
- * If there are more words meeting the condition they are returned all of
- * them in the ascending order separated with spaces.
- *
- * NOTE: returned buffer has to be freed with delete[].
- */
-char *WordList::GetNearestWords(
-    const char *wordStart,
-    int searchLen,
-    bool ignoreCase /*= false*/,
-    char otherSeparator /*= '\0'*/,
-    bool exactLen /*=false*/) {
-       unsigned int wordlen; // length of the word part (before the '(' brace) of the api array element
-       SString wordsNear;
-       wordsNear.setsizegrowth(1000);
-       int start = 0; // lower bound of the api array block to search
-       int end = len - 1; // upper bound of the api array block to search
-       int pivot; // index of api array element just being compared
-       int cond; // comparison result (in the sense of strcmp() result)
-
-       if (0 == words)
-               return NULL;
-       if (ignoreCase) {
-               if (!sortedNoCase) {
-                       sortedNoCase = true;
-                       SortWordListNoCase(wordsNoCase, len);
-               }
-               while (start <= end) { // Binary searching loop
-                       pivot = (start + end) / 2;
-                       cond = CompareNCaseInsensitive(wordStart, wordsNoCase[pivot], searchLen);
-                       if (!cond) {
-                               // Find first match
-                               while ((pivot > start) &&
-                                       (0 == CompareNCaseInsensitive(wordStart,
-                                               wordsNoCase[pivot-1], searchLen))) {
-                                       --pivot;
-                               }
-                               // Grab each match
-                               while ((pivot <= end) &&
-                                       (0 == CompareNCaseInsensitive(wordStart,
-                                               wordsNoCase[pivot], searchLen))) {
-                                       wordlen = LengthWord(wordsNoCase[pivot], otherSeparator) + 1;
-                                       ++pivot;
-                                       if (exactLen && wordlen != LengthWord(wordStart, otherSeparator) + 1)
-                                               continue;
-                                       wordsNear.append(wordsNoCase[pivot-1], wordlen, ' ');
-                               }
-                               return wordsNear.detach();
-                       } else if (cond < 0) {
-                               end = pivot - 1;
-                       } else if (cond > 0) {
-                               start = pivot + 1;
-                       }
-               }
-       } else {        // Preserve the letter case
-               if (!sorted) {
-                       sorted = true;
-                       SortWordList(words, len);
-               }
-               while (start <= end) { // Binary searching loop
-                       pivot = (start + end) / 2;
-                       cond = strncmp(wordStart, words[pivot], searchLen);
-                       if (!cond) {
-                               // Find first match
-                               while ((pivot > start) &&
-                                       (0 == strncmp(wordStart,
-                                               words[pivot-1], searchLen))) {
-                                       --pivot;
-                               }
-                               // Grab each match
-                               while ((pivot <= end) &&
-                                       (0 == strncmp(wordStart,
-                                               words[pivot], searchLen))) {
-                                       wordlen = LengthWord(words[pivot], otherSeparator) + 1;
-                                       ++pivot;
-                                       if (exactLen && wordlen != LengthWord(wordStart, otherSeparator) + 1)
-                                               continue;
-                                       wordsNear.append(words[pivot-1], wordlen, ' ');
-                               }
-                               return wordsNear.detach();
-                       } else if (cond < 0) {
-                               end = pivot - 1;
-                       } else if (cond > 0) {
-                               start = pivot + 1;
-                       }
-               }
-       }
-       return NULL;
-}
index 00e183060af654a4d2b644026abf97e7ca7f2f1f..b1b226a05c3a887b02173f64c87e43270d115514 100644 (file)
@@ -16,6 +16,7 @@
  * Converted to modern function prototypes.
  * Put all global/static variables into an object so this code can be
  * used from multiple threads, etc.
  * Converted to modern function prototypes.
  * Put all global/static variables into an object so this code can be
  * used from multiple threads, etc.
+ * Some extensions by Philippe Lhoste PhiLho(a)GMX.net
  *
  * These routines are the PUBLIC DOMAIN equivalents of regex
  * routines as found in 4.nBSD UN*X, with minor extensions.
  *
  * These routines are the PUBLIC DOMAIN equivalents of regex
  * routines as found in 4.nBSD UN*X, with minor extensions.
  *      [2]     .       matches any character.
  *
  *      [3]     \       matches the character following it, except:
  *      [2]     .       matches any character.
  *
  *      [3]     \       matches the character following it, except:
- *                      - \a, \b, \f, \n, \t, \v match the
- *                      corresponding C escape char;
+ *                      - \a, \b, \f, \n, \r, \t, \v match the corresponding C
+ *                      escape char, respectively BEL, BS, FF, LF, CR, TAB and VT;
+ *                      Note that \r and \n are never matched because Scintilla
+ *                      regex searches are made line per line
+ *                      (stripped of end-of-line chars).
  *                      - if not in posix mode, when followed by a
  *                      left or right round bracket (see [7]);
  *                      - when followed by a digit 1 to 9 (see [8]);
  *                      - when followed by a left or right angle bracket
  *                      - if not in posix mode, when followed by a
  *                      left or right round bracket (see [7]);
  *                      - when followed by a digit 1 to 9 (see [8]);
  *                      - when followed by a left or right angle bracket
- *                      (see [9]).
- *                      It is used as an escape character for all
- *                      other meta-characters, and itself. When used
- *                      in a set ([4]), it is treated as an ordinary
- *                      character (except for escape chars).
+ *                      (see [9]);
+ *                      - when followed by d, D, s, S, w or W (see [10]);
+ *                      - when followed by x and two hexa digits (see [11].
+ *                      Backslash is used as an escape character for all
+ *                      other meta-characters, and itself.
  *
  *      [4]     [set]   matches one of the characters in the set.
  *                      If the first character in the set is "^",
  *
  *      [4]     [set]   matches one of the characters in the set.
  *                      If the first character in the set is "^",
- *                      it matches a character NOT in the set, i.e.
- *                      complements the set. A shorthand S-E (start-end)
- *                      is used to specify a set of characters S upto
- *                      E, inclusive. The special characters "]" and
- *                      "-" have no special meaning if they appear
- *                      as the first chars in the set. To include both,
- *                      put - first: [-]A-Z]:
- *                      [-]|] matches these 2 chars,
- *                      []-|] matches from ] to | chars.
+ *                      it matches the characters NOT in the set, i.e.
+ *                      complements the set. A shorthand S-E (start dash end)
+ *                      is used to specify a set of characters S up to
+ *                      E, inclusive. S and E must be characters, otherwise
+ *                      the dash is taken literally (eg. in expression [\d-a]).
+ *                      The special characters "]" and "-" have no special
+ *                      meaning if they appear as the first chars in the set.
+ *                      To include both, put - first: [-]A-Z]
+ *                      (or just backslash them).
  *                      examples:        match:
  *
  *                      examples:        match:
  *
+ *                              [-]|]    matches these 3 chars,
+ *
+ *                              []-|]    matches from ] to | chars
+ *
  *                              [a-z]    any lowercase alpha
  *
  *                              [^-]]    any char except - and ]
  *                              [a-z]    any lowercase alpha
  *
  *                              [^-]]    any char except - and ]
  *
  *                              [a-zA-Z] any alpha
  *
  *
  *                              [a-zA-Z] any alpha
  *
- *      [5]     *       any regular expression form [1] to [4], followed by
- *                      closure char (*) matches zero or more matches of
- *                      that form.
+ *      [5]     *       any regular expression form [1] to [4]
+ *                      (except [7], [8] and [9] forms of [3]),
+ *                      followed by closure char (*)
+ *                      matches zero or more matches of that form.
  *
  *      [6]     +       same as [5], except it matches one or more.
  *
  *      [6]     +       same as [5], except it matches one or more.
+ *                      Both [5] and [6] are greedy (they match as much as possible).
  *
  *
- *      [7]             a regular expression in the form [1] to [10], enclosed
+ *      [7]             a regular expression in the form [1] to [12], enclosed
  *                      as \(form\) (or (form) with posix flag) matches what
  *                      form matches. The enclosure creates a set of tags,
  *                      used for [8] and for pattern substitution.
  *                      as \(form\) (or (form) with posix flag) matches what
  *                      form matches. The enclosure creates a set of tags,
  *                      used for [8] and for pattern substitution.
  *                      pattern matching to the beginning of a word, and/or
  *                      the end of a word. A word is defined to be a character
  *                      string beginning and/or ending with the characters
  *                      pattern matching to the beginning of a word, and/or
  *                      the end of a word. A word is defined to be a character
  *                      string beginning and/or ending with the characters
- *                      A-Z a-z 0-9 and _. It must also be preceded and/or
+ *                      A-Z a-z 0-9 and _. Scintilla extends this definition
+ *                      by user setting. The word must also be preceded and/or
  *                      followed by any character outside those mentioned.
  *
  *                      followed by any character outside those mentioned.
  *
- *      [10]            a composite regular expression xy where x and y
- *                      are in the form [1] to [10] matches the longest
+ *      [10]    \l      a backslash followed by d, D, s, S, w or W,
+ *                      becomes a character class (both inside and
+ *                      outside sets []).
+ *                        d: decimal digits
+ *                        D: any char except decimal digits
+ *                        s: whitespace (space, \t \n \r \f \v)
+ *                        S: any char except whitespace (see above)
+ *                        w: alphanumeric & underscore (changed by user setting)
+ *                        W: any char except alphanumeric & underscore (see above)
+ *
+ *      [11]    \xHH    a backslash followed by x and two hexa digits,
+ *                      becomes the character whose Ascii code is equal
+ *                      to these digits. If not followed by two digits,
+ *                      it is 'x' char itself.
+ *
+ *      [12]            a composite regular expression xy where x and y
+ *                      are in the form [1] to [11] matches the longest
  *                      match of x followed by a match for y.
  *
  *                      match of x followed by a match for y.
  *
- *      [11]    ^       a regular expression starting with a ^ character
+ *      [13]    ^       a regular expression starting with a ^ character
  *              $       and/or ending with a $ character, restricts the
  *                      pattern matching to the beginning of the line,
  *                      or the end of line. [anchors] Elsewhere in the
  *              $       and/or ending with a $ character, restricts the
  *                      pattern matching to the beginning of the line,
  *                      or the end of line. [anchors] Elsewhere in the
  *
  * Notes:
  *
  *
  * Notes:
  *
- *     This implementation uses a bit-set representation for character
- *     classes for speed and compactness. Each character is represented
- *     by one bit in a 256-bit block. Thus, CCL always takes a
+ *  This implementation uses a bit-set representation for character
+ *  classes for speed and compactness. Each character is represented
+ *  by one bit in a 256-bit block. Thus, CCL always takes a
  *     constant 32 bytes in the internal nfa, and RESearch::Execute does a single
  *     constant 32 bytes in the internal nfa, and RESearch::Execute does a single
- *     bit comparison to locate the character in the set.
+ *  bit comparison to locate the character in the set.
  *
  * Examples:
  *
  *
  * Examples:
  *
 #pragma warning(disable: 4514)
 #endif
 
 #pragma warning(disable: 4514)
 #endif
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 #define OKP     1
 #define NOP     0
 
 #define OKP     1
 #define NOP     0
 
 #define BLKIND  0370
 #define BITIND  07
 
 #define BLKIND  0370
 #define BITIND  07
 
-const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
+const char bitarr[] = { 1, 2, 4, 8, 16, 32, 64, '\200' };
 
 #define badpat(x)      (*nfa = END, x)
 
 
 #define badpat(x)      (*nfa = END, x)
 
@@ -212,7 +242,7 @@ const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
  * Character classification table for word boundary operators BOW
  * and EOW is passed in by the creator of this object (Scintilla
  * Document). The Document default state is that word chars are:
  * Character classification table for word boundary operators BOW
  * and EOW is passed in by the creator of this object (Scintilla
  * Document). The Document default state is that word chars are:
- * 0-9,a-z, A-Z and _
+ * 0-9, a-z, A-Z and _
  */
 
 RESearch::RESearch(CharClassify *charClassTable) {
  */
 
 RESearch::RESearch(CharClassify *charClassTable) {
@@ -227,14 +257,14 @@ RESearch::~RESearch() {
 void RESearch::Init() {
        sta = NOP;                  /* status of lastpat */
        bol = 0;
 void RESearch::Init() {
        sta = NOP;                  /* status of lastpat */
        bol = 0;
-       for (int i=0; i<MAXTAG; i++)
+       for (int i = 0; i < MAXTAG; i++)
                pat[i] = 0;
                pat[i] = 0;
-       for (int j=0; j<BITBLK; j++)
+       for (int j = 0; j < BITBLK; j++)
                bittab[j] = 0;
 }
 
 void RESearch::Clear() {
                bittab[j] = 0;
 }
 
 void RESearch::Clear() {
-       for (int i=0; i<MAXTAG; i++) {
+       for (int i = 0; i < MAXTAG; i++) {
                delete []pat[i];
                pat[i] = 0;
                bopat[i] = NOTFOUND;
                delete []pat[i];
                pat[i] = 0;
                bopat[i] = NOTFOUND;
@@ -244,12 +274,12 @@ void RESearch::Clear() {
 
 bool RESearch::GrabMatches(CharacterIndexer &ci) {
        bool success = true;
 
 bool RESearch::GrabMatches(CharacterIndexer &ci) {
        bool success = true;
-       for (unsigned int i=0; i<MAXTAG; i++) {
+       for (unsigned int i = 0; i < MAXTAG; i++) {
                if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
                        unsigned int len = eopat[i] - bopat[i];
                        pat[i] = new char[len + 1];
                        if (pat[i]) {
                if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
                        unsigned int len = eopat[i] - bopat[i];
                        pat[i] = new char[len + 1];
                        if (pat[i]) {
-                               for (unsigned int j=0; j<len; j++)
+                               for (unsigned int j = 0; j < len; j++)
                                        pat[i][j] = ci.CharAt(bopat[i] + j);
                                pat[i][len] = '\0';
                        } else {
                                        pat[i][j] = ci.CharAt(bopat[i] + j);
                                pat[i][len] = '\0';
                        } else {
@@ -260,27 +290,27 @@ bool RESearch::GrabMatches(CharacterIndexer &ci) {
        return success;
 }
 
        return success;
 }
 
-void RESearch::ChSet(char c) {
+void RESearch::ChSet(unsigned char c) {
        bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND];
 }
 
        bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND];
 }
 
-void RESearch::ChSetWithCase(char c, bool caseSensitive) {
+void RESearch::ChSetWithCase(unsigned char c, bool caseSensitive) {
        if (caseSensitive) {
                ChSet(c);
        } else {
                if ((c >= 'a') && (c <= 'z')) {
                        ChSet(c);
        if (caseSensitive) {
                ChSet(c);
        } else {
                if ((c >= 'a') && (c <= 'z')) {
                        ChSet(c);
-                       ChSet(static_cast<char>(c - 'a' + 'A'));
+                       ChSet(static_cast<unsigned char>(c - 'a' + 'A'));
                } else if ((c >= 'A') && (c <= 'Z')) {
                        ChSet(c);
                } else if ((c >= 'A') && (c <= 'Z')) {
                        ChSet(c);
-                       ChSet(static_cast<char>(c - 'A' + 'a'));
+                       ChSet(static_cast<unsigned char>(c - 'A' + 'a'));
                } else {
                        ChSet(c);
                }
        }
 }
 
                } else {
                        ChSet(c);
                }
        }
 }
 
-const char escapeValue(char ch) {
+const unsigned char escapeValue(unsigned char ch) {
        switch (ch) {
        case 'a':       return '\a';
        case 'b':       return '\b';
        switch (ch) {
        case 'a':       return '\a';
        case 'b':       return '\b';
@@ -293,6 +323,119 @@ const char escapeValue(char ch) {
        return 0;
 }
 
        return 0;
 }
 
+static int GetHexaChar(unsigned char hd1, unsigned char hd2) {
+       int hexValue = 0;
+       if (hd1 >= '0' && hd1 <= '9') {
+               hexValue += 16 * (hd1 - '0');
+       } else if (hd1 >= 'A' && hd1 <= 'F') {
+               hexValue += 16 * (hd1 - 'A' + 10);
+       } else if (hd1 >= 'a' && hd1 <= 'f') {
+               hexValue += 16 * (hd1 - 'a' + 10);
+       } else
+               return -1;
+       if (hd2 >= '0' && hd2 <= '9') {
+               hexValue += hd2 - '0';
+       } else if (hd2 >= 'A' && hd2 <= 'F') {
+               hexValue += hd2 - 'A' + 10;
+       } else if (hd2 >= 'a' && hd2 <= 'f') {
+               hexValue += hd2 - 'a' + 10;
+       } else
+               return -1;
+       return hexValue;
+}
+
+/**
+ * Called when the parser finds a backslash not followed
+ * by a valid expression (like \( in non-Posix mode).
+ * @param pat: pointer on the char after the backslash.
+ * @param incr: (out) number of chars to skip after expression evaluation.
+ * @return the char if it resolves to a simple char,
+ * or -1 for a char class. In this case, bittab is changed.
+ */
+int RESearch::GetBackslashExpression(
+               const char *pat,
+               int &incr) {
+       // Since error reporting is primitive and messages are not used anyway,
+       // I choose to interpret unexpected syntax in a logical way instead
+       // of reporting errors. Otherwise, we can stick on, eg., PCRE behavior.
+       incr = 0;       // Most of the time, will skip the char "naturally".
+       int c;
+       int result = -1;
+       unsigned char bsc = *pat;
+       if (!bsc) {
+               // Avoid overrun
+               result = '\\';  // \ at end of pattern, take it literally
+               return result;
+       }
+
+       switch (bsc) {
+       case 'a':
+       case 'b':
+       case 'n':
+       case 'f':
+       case 'r':
+       case 't':
+       case 'v':
+               result = escapeValue(bsc);
+               break;
+       case 'x': {
+                       unsigned char hd1 = *(pat + 1);
+                       unsigned char hd2 = *(pat + 2);
+                       int hexValue = GetHexaChar(hd1, hd2);
+                       if (hexValue >= 0) {
+                               result = hexValue;
+                               incr = 2;       // Must skip the digits
+                       } else {
+                               result = 'x';   // \x without 2 digits: see it as 'x'
+                       }
+               }
+               break;
+       case 'd':
+               for (c = '0'; c <= '9'; c++) {
+                       ChSet(static_cast<unsigned char>(c));
+               }
+               break;
+       case 'D':
+               for (c = 0; c < MAXCHR; c++) {
+                       if (c < '0' || c > '9') {
+                               ChSet(static_cast<unsigned char>(c));
+                       }
+               }
+               break;
+       case 's':
+               ChSet(' ');
+               ChSet('\t');
+               ChSet('\n');
+               ChSet('\r');
+               ChSet('\f');
+               ChSet('\v');
+               break;
+       case 'S':
+               for (c = 0; c < MAXCHR; c++) {
+                       if (c != ' ' && !(c >= 0x09 && c <= 0x0D)) {
+                               ChSet(static_cast<unsigned char>(c));
+                       }
+               }
+       case 'w':
+               for (c = 0; c < MAXCHR; c++) {
+                       if (iswordc(static_cast<unsigned char>(c))) {
+                               ChSet(static_cast<unsigned char>(c));
+                       }
+               }
+               break;
+       case 'W':
+               for (c = 0; c < MAXCHR; c++) {
+                       if (!iswordc(static_cast<unsigned char>(c))) {
+                               ChSet(static_cast<unsigned char>(c));
+                       }
+               }
+               break;
+       default:
+               result = bsc;
+       }
+       return result;
+}
+
 const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
        char *mp=nfa;          /* nfa pointer       */
        char *lp;              /* saved pointer     */
 const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
        char *mp=nfa;          /* nfa pointer       */
        char *lp;              /* saved pointer     */
@@ -304,7 +447,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
 
        int n;
        char mask;             /* xor mask -CCL/NCL */
 
        int n;
        char mask;             /* xor mask -CCL/NCL */
-       int c1, c2;
+       int c1, c2, prevChar;
 
        if (!pat || !length)
                if (sta)
 
        if (!pat || !length)
                if (sta)
@@ -318,7 +461,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
                if (mp > mpMax)
                        return badpat("Pattern too long");
                lp = mp;
                if (mp > mpMax)
                        return badpat("Pattern too long");
                lp = mp;
-               switch(*p) {
+               switch (*p) {
 
                case '.':               /* match any char  */
                        *mp++ = ANY;
 
                case '.':               /* match any char  */
                        *mp++ = ANY;
@@ -344,6 +487,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
 
                case '[':               /* match char class */
                        *mp++ = CCL;
 
                case '[':               /* match char class */
                        *mp++ = CCL;
+                       prevChar = 0;
 
                        i++;
                        if (*++p == '^') {
 
                        i++;
                        if (*++p == '^') {
@@ -355,41 +499,89 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
 
                        if (*p == '-') {        /* real dash */
                                i++;
 
                        if (*p == '-') {        /* real dash */
                                i++;
+                               prevChar = *p;
                                ChSet(*p++);
                        }
                        if (*p == ']') {        /* real brace */
                                i++;
                                ChSet(*p++);
                        }
                        if (*p == ']') {        /* real brace */
                                i++;
+                               prevChar = *p;
                                ChSet(*p++);
                        }
                        while (*p && *p != ']') {
                                ChSet(*p++);
                        }
                        while (*p && *p != ']') {
-                               if (*p == '-' && *(p+1) && *(p+1) != ']') {
-                                       i++;
-                                       p++;
-                                       c1 = *(p-2) + 1;
-                                       i++;
-                                       c2 = *p++;
-                                       while (c1 <= c2) {
-                                               ChSetWithCase(static_cast<char>(c1++), caseSensitive);
+                               if (*p == '-') {
+                                       if (prevChar < 0) {
+                                               // Previous def. was a char class like \d, take dash literally
+                                               prevChar = *p;
+                                               ChSet(*p);
+                                       } else if (*(p+1)) {
+                                               if (*(p+1) != ']') {
+                                                       c1 = prevChar + 1;
+                                                       i++;
+                                                       c2 = *++p;
+                                                       if (c2 == '\\') {
+                                                               if (!*(p+1))    // End of RE
+                                                                       return badpat("Missing ]");
+                                                               else {
+                                                                       i++;
+                                                                       p++;
+                                                                       int incr;
+                                                                       c2 = GetBackslashExpression(p, incr);
+                                                                       i += incr;
+                                                                       p += incr;
+                                                                       if (c2 >= 0) {
+                                                                               // Convention: \c (c is any char) is case sensitive, whatever the option
+                                                                               ChSet(static_cast<unsigned char>(c2));
+                                                                               prevChar = c2;
+                                                                       } else {
+                                                                               // bittab is already changed
+                                                                               prevChar = -1;
+                                                                       }
+                                                               }
+                                                       }
+                                                       if (prevChar < 0) {
+                                                               // Char after dash is char class like \d, take dash literally
+                                                               prevChar = '-';
+                                                               ChSet('-');
+                                                       } else {
+                                                               // Put all chars between c1 and c2 included in the char set
+                                                               while (c1 <= c2) {
+                                                                       ChSetWithCase(static_cast<unsigned char>(c1++), caseSensitive);
+                                                               }
+                                                       }
+                                               } else {
+                                                       // Dash before the ], take it literally
+                                                       prevChar = *p;
+                                                       ChSet(*p);
+                                               }
+                                       } else {
+                                               return badpat("Missing ]");
                                        }
                                } else if (*p == '\\' && *(p+1)) {
                                        i++;
                                        p++;
                                        }
                                } else if (*p == '\\' && *(p+1)) {
                                        i++;
                                        p++;
-                                       char escape = escapeValue(*p);
-                                       if (escape)
-                                               ChSetWithCase(escape, caseSensitive);
-                                       else
-                                               ChSetWithCase(*p, caseSensitive);
-                                       i++;
-                                       p++;
+                                       int incr;
+                                       int c = GetBackslashExpression(p, incr);
+                                       i += incr;
+                                       p += incr;
+                                       if (c >= 0) {
+                                               // Convention: \c (c is any char) is case sensitive, whatever the option
+                                               ChSet(static_cast<unsigned char>(c));
+                                               prevChar = c;
+                                       } else {
+                                               // bittab is already changed
+                                               prevChar = -1;
+                                       }
                                } else {
                                } else {
-                                       i++;
-                                       ChSetWithCase(*p++, caseSensitive);
+                                       prevChar = *p;
+                                       ChSetWithCase(*p, caseSensitive);
                                }
                                }
+                               i++;
+                               p++;
                        }
                        if (!*p)
                                return badpat("Missing ]");
 
                        }
                        if (!*p)
                                return badpat("Missing ]");
 
-                       for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
+                       for (n = 0; n < BITBLK; bittab[n++] = 0)
                                *mp++ = static_cast<char>(mask ^ bittab[n]);
 
                        break;
                                *mp++ = static_cast<char>(mask ^ bittab[n]);
 
                        break;
@@ -401,7 +593,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
                        lp = sp;                /* previous opcode */
                        if (*lp == CLO)         /* equivalence... */
                                break;
                        lp = sp;                /* previous opcode */
                        if (*lp == CLO)         /* equivalence... */
                                break;
-                       switch(*lp) {
+                       switch (*lp) {
 
                        case BOL:
                        case BOT:
 
                        case BOL:
                        case BOT:
@@ -429,8 +621,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
 
                case '\\':              /* tags, backrefs... */
                        i++;
 
                case '\\':              /* tags, backrefs... */
                        i++;
-                       switch(*++p) {
-
+                       switch (*++p) {
                        case '<':
                                *mp++ = BOW;
                                break;
                        case '<':
                                *mp++ = BOW;
                                break;
@@ -454,28 +645,16 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
                                if (tagc > n) {
                                        *mp++ = static_cast<char>(REF);
                                        *mp++ = static_cast<char>(n);
                                if (tagc > n) {
                                        *mp++ = static_cast<char>(REF);
                                        *mp++ = static_cast<char>(n);
-                               }
-                               else
+                               } else
                                        return badpat("Undetermined reference");
                                break;
                                        return badpat("Undetermined reference");
                                break;
-                       case 'a':
-                       case 'b':
-                       case 'n':
-                       case 'f':
-                       case 'r':
-                       case 't':
-                       case 'v':
-                               *mp++ = CHR;
-                               *mp++ = escapeValue(*p);
-                               break;
                        default:
                                if (!posix && *p == '(') {
                                        if (tagc < MAXTAG) {
                                                tagstk[++tagi] = tagc;
                                                *mp++ = BOT;
                                                *mp++ = static_cast<char>(tagc++);
                        default:
                                if (!posix && *p == '(') {
                                        if (tagc < MAXTAG) {
                                                tagstk[++tagi] = tagc;
                                                *mp++ = BOT;
                                                *mp++ = static_cast<char>(tagc++);
-                                       }
-                                       else
+                                       } else
                                                return badpat("Too many \\(\\) pairs");
                                } else if (!posix && *p == ')') {
                                        if (*sp == BOT)
                                                return badpat("Too many \\(\\) pairs");
                                } else if (!posix && *p == ')') {
                                        if (*sp == BOT)
@@ -483,12 +662,22 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
                                        if (tagi > 0) {
                                                *mp++ = static_cast<char>(EOT);
                                                *mp++ = static_cast<char>(tagstk[tagi--]);
                                        if (tagi > 0) {
                                                *mp++ = static_cast<char>(EOT);
                                                *mp++ = static_cast<char>(tagstk[tagi--]);
-                                       }
-                                       else
+                                       } else
                                                return badpat("Unmatched \\)");
                                } else {
                                                return badpat("Unmatched \\)");
                                } else {
-                                       *mp++ = CHR;
-                                       *mp++ = *p;
+                                       int incr;
+                                       int c = GetBackslashExpression(p, incr);
+                                       i += incr;
+                                       p += incr;
+                                       if (c >= 0) {
+                                               *mp++ = CHR;
+                                               *mp++ = static_cast<unsigned char>(c);
+                                       } else {
+                                               *mp++ = CCL;
+                                               mask = 0;
+                                               for (n = 0; n < BITBLK; bittab[n++] = 0)
+                                                       *mp++ = static_cast<char>(mask ^ bittab[n]);
+                                       }
                                }
                        }
                        break;
                                }
                        }
                        break;
@@ -499,8 +688,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
                                        tagstk[++tagi] = tagc;
                                        *mp++ = BOT;
                                        *mp++ = static_cast<char>(tagc++);
                                        tagstk[++tagi] = tagc;
                                        *mp++ = BOT;
                                        *mp++ = static_cast<char>(tagc++);
-                               }
-                               else
+                               } else
                                        return badpat("Too many () pairs");
                        } else if (posix && *p == ')') {
                                if (*sp == BOT)
                                        return badpat("Too many () pairs");
                        } else if (posix && *p == ')') {
                                if (*sp == BOT)
@@ -508,18 +696,22 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
                                if (tagi > 0) {
                                        *mp++ = static_cast<char>(EOT);
                                        *mp++ = static_cast<char>(tagstk[tagi--]);
                                if (tagi > 0) {
                                        *mp++ = static_cast<char>(EOT);
                                        *mp++ = static_cast<char>(tagstk[tagi--]);
-                               }
-                               else
+                               } else
                                        return badpat("Unmatched )");
                                        return badpat("Unmatched )");
-                       } else if (caseSensitive) {
-                               *mp++ = CHR;
-                               *mp++ = *p;
                        } else {
                        } else {
-                               *mp++ = CCL;
-                               mask = 0;
-                               ChSetWithCase(*p, false);
-                               for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
-                                       *mp++ = static_cast<char>(mask ^ bittab[n]);
+                               unsigned char c = *p;
+                               if (!c) // End of RE
+                                       c = '\\';       // We take it as raw backslash
+                               if (caseSensitive || !iswordc(c)) {
+                                       *mp++ = CHR;
+                                       *mp++ = c;
+                               } else {
+                                       *mp++ = CCL;
+                                       mask = 0;
+                                       ChSetWithCase(c, false);
+                                       for (n = 0; n < BITBLK; bittab[n++] = 0)
+                                               *mp++ = static_cast<char>(mask ^ bittab[n]);
+                               }
                        }
                        break;
                }
                        }
                        break;
                }
@@ -553,9 +745,8 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
  *  respectively.
  *
  */
  *  respectively.
  *
  */
-
 int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
 int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
-       char c;
+       unsigned char c;
        int ep = NOTFOUND;
        char *ap = nfa;
 
        int ep = NOTFOUND;
        char *ap = nfa;
 
@@ -564,7 +755,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
 
        Clear();
 
 
        Clear();
 
-       switch(*ap) {
+       switch (*ap) {
 
        case BOL:                       /* anchored: match from BOL only */
                ep = PMatch(ci, lp, endp, ap);
 
        case BOL:                       /* anchored: match from BOL only */
                ep = PMatch(ci, lp, endp, ap);
@@ -651,7 +842,7 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
        int are;        /* to save the line ptr.  */
 
        while ((op = *ap++) != END)
        int are;        /* to save the line ptr.  */
 
        while ((op = *ap++) != END)
-               switch(op) {
+               switch (op) {
 
                case CHR:
                        if (ci.CharAt(lp++) != *ap++)
 
                case CHR:
                        if (ci.CharAt(lp++) != *ap++)
@@ -699,7 +890,7 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
                        break;
                case CLO:
                        are = lp;
                        break;
                case CLO:
                        are = lp;
-                       switch(*ap) {
+                       switch (*ap) {
 
                        case ANY:
                                while (lp < endp)
 
                        case ANY:
                                while (lp < endp)
@@ -749,7 +940,7 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
  *      tagged subpattern does not exist, null is substituted.
  */
 int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
  *      tagged subpattern does not exist, null is substituted.
  */
 int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
-       char c;
+       unsigned char c;
        int  pin;
        int bp;
        int ep;
        int  pin;
        int bp;
        int ep;
@@ -758,7 +949,7 @@ int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
                return 0;
 
        while ((c = *src++) != 0) {
                return 0;
 
        while ((c = *src++) != 0) {
-               switch(c) {
+               switch (c) {
 
                case '&':
                        pin = 0;
 
                case '&':
                        pin = 0;
@@ -783,6 +974,7 @@ int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
                                return 0;
                }
        }
                                return 0;
                }
        }
-       *dst = (char) 0;
+       *dst = '\0';
        return 1;
 }
        return 1;
 }
+
index aa85579184257f2aaae1c5e4f42a8b97e83e53b0..0944fc398ccb44ceae4c46c62d25b5096eecb14d 100644 (file)
@@ -9,6 +9,10 @@
 #ifndef RESEARCH_H
 #define RESEARCH_H
 
 #ifndef RESEARCH_H
 #define RESEARCH_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /*
  * The following defines are not meant to be changeable.
  * They are for readability only.
 /*
  * The following defines are not meant to be changeable.
  * They are for readability only.
@@ -34,9 +38,9 @@ public:
        int Execute(CharacterIndexer &ci, int lp, int endp);
        int Substitute(CharacterIndexer &ci, char *src, char *dst);
 
        int Execute(CharacterIndexer &ci, int lp, int endp);
        int Substitute(CharacterIndexer &ci, char *src, char *dst);
 
-       enum {MAXTAG=10};
-       enum {MAXNFA=2048};
-       enum {NOTFOUND=-1};
+       enum { MAXTAG=10 };
+       enum { MAXNFA=2048 };
+       enum { NOTFOUND=-1 };
 
        int bopat[MAXTAG];
        int eopat[MAXTAG];
 
        int bopat[MAXTAG];
        int eopat[MAXTAG];
@@ -45,16 +49,17 @@ public:
 private:
        void Init();
        void Clear();
 private:
        void Init();
        void Clear();
-       void ChSet(char c);
-       void ChSetWithCase(char c, bool caseSensitive);
+       void ChSet(unsigned char c);
+       void ChSetWithCase(unsigned char c, bool caseSensitive);
+       int GetBackslashExpression(const char *pat, int &incr);
 
        int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
 
        int bol;
 
        int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
 
        int bol;
-       int  tagstk[MAXTAG]; /* subpat tag stack */
+       int tagstk[MAXTAG];  /* subpat tag stack */
        char nfa[MAXNFA];    /* automaton */
        int sta;
        char nfa[MAXNFA];    /* automaton */
        int sta;
-       char bittab[BITBLK]; /* bit table for CCL pre-set bits */
+       unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */
        int failure;
        CharClassify *charClass;
        bool iswordc(unsigned char x) {
        int failure;
        CharClassify *charClass;
        bool iswordc(unsigned char x) {
@@ -62,4 +67,9 @@ private:
        }
 };
 
        }
 };
 
+#ifdef SCI_NAMESPACE
+}
 #endif
 #endif
+
+#endif
+
diff --git a/src/stc/scintilla/src/RunStyles.cxx b/src/stc/scintilla/src/RunStyles.cxx
new file mode 100644 (file)
index 0000000..dfff754
--- /dev/null
@@ -0,0 +1,216 @@
+/** @file RunStyles.cxx
+ ** Data structure used to store sparse styles.
+ **/
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "Platform.h"
+
+#include "Scintilla.h"
+#include "SplitVector.h"
+#include "Partitioning.h"
+#include "RunStyles.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+// Find the first run at a position
+int RunStyles::RunFromPosition(int position) {
+       int run = starts->PartitionFromPosition(position);
+       // Go to first element with this position
+       while ((run > 0) && (position == starts->PositionFromPartition(run-1))) {
+               run--;
+       }
+       return run;
+}
+
+// If there is no run boundary at position, insert one continuing style.
+int RunStyles::SplitRun(int position) {
+       int run = RunFromPosition(position);
+       int posRun = starts->PositionFromPartition(run);
+       if (posRun < position) {
+               int runStyle = ValueAt(position);
+               run++;
+               starts->InsertPartition(run, position);
+               styles->InsertValue(run, 1, runStyle);
+       }
+       return run;
+}
+
+void RunStyles::RemoveRun(int run) {
+       starts->RemovePartition(run);
+       styles->DeleteRange(run, 1);
+}
+
+void RunStyles::RemoveRunIfEmpty(int run) {
+       if ((run < starts->Partitions()) && (starts->Partitions() > 1)) {
+               if (starts->PositionFromPartition(run) == starts->PositionFromPartition(run+1)) {
+                       RemoveRun(run);
+               }
+       }
+}
+
+void RunStyles::RemoveRunIfSameAsPrevious(int run) {
+       if ((run > 0) && (run < starts->Partitions())) {
+               if (styles->ValueAt(run-1) == styles->ValueAt(run)) {
+                       RemoveRun(run);
+               }
+       }
+}
+
+RunStyles::RunStyles() {
+       starts = new Partitioning(8);
+       styles = new SplitVector<int>();
+       styles->InsertValue(0, 2, 0);
+}
+
+RunStyles::~RunStyles() {
+       delete starts;
+       starts = NULL;
+       delete styles;
+       styles = NULL;
+}
+
+int RunStyles::Length() {
+       return starts->PositionFromPartition(starts->Partitions());
+}
+
+int RunStyles::ValueAt(int position) {
+       return styles->ValueAt(starts->PartitionFromPosition(position));
+}
+
+int RunStyles::FindNextChange(int position, int end) {
+       int run = starts->PartitionFromPosition(position);
+       if (run < starts->Partitions()) {
+               int runChange = starts->PositionFromPartition(run);
+               if (runChange > position)
+                       return runChange;
+               int nextChange = starts->PositionFromPartition(run + 1);
+               if (nextChange > position) {
+                       return nextChange;
+               } else if (position < end) {
+                       return end;
+               } else {
+                       return end + 1;
+               }
+       } else {
+               return end + 1;
+       }
+}
+
+int RunStyles::StartRun(int position) {
+       return starts->PositionFromPartition(starts->PartitionFromPosition(position));
+}
+
+int RunStyles::EndRun(int position) {
+       return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1);
+}
+
+bool RunStyles::FillRange(int &position, int value, int &fillLength) {
+       int end = position + fillLength;
+       int runEnd = RunFromPosition(end);
+       if (styles->ValueAt(runEnd) == value) {
+               // End already has value so trim range.
+               end = starts->PositionFromPartition(runEnd);
+               if (position >= end) {
+                       // Whole range is already same as value so no action
+                       return false;
+               }
+               fillLength = end - position;
+       } else {
+               runEnd = SplitRun(end);
+       }
+       int runStart = RunFromPosition(position);
+       if (styles->ValueAt(runStart) == value) {
+               // Start is in expected value so trim range.
+               runStart++;
+               position = starts->PositionFromPartition(runStart);
+               fillLength = end - position;
+       } else {
+               if (starts->PositionFromPartition(runStart) < position) {
+                       runStart = SplitRun(position);
+                       runEnd++;
+               }
+       }
+       if (runStart < runEnd) {
+               styles->SetValueAt(runStart, value);
+               // Remove each old run over the range
+               for (int run=runStart+1; run<runEnd; run++) {
+                       RemoveRun(runStart+1);
+               }
+               runEnd = RunFromPosition(end);
+               RemoveRunIfSameAsPrevious(runEnd);
+               RemoveRunIfSameAsPrevious(runStart);
+       }
+       return true;
+}
+
+void RunStyles::SetValueAt(int position, int value) {
+       int len = 1;
+       FillRange(position, value, len);
+}
+
+void RunStyles::InsertSpace(int position, int insertLength) {
+       int runStart = RunFromPosition(position);
+       if (starts->PositionFromPartition(runStart) == position) {
+               int runStyle = ValueAt(position);
+               // Inserting at start of run so make previous longer
+               if (runStart == 0) {
+                       // Inserting at start of document so ensure 0
+                       if (runStyle) {
+                               styles->SetValueAt(0, 0);
+                               starts->InsertPartition(1, 0);
+                               styles->InsertValue(1, 1, runStyle);
+                               starts->InsertText(0, insertLength);
+                       } else {
+                               starts->InsertText(runStart, insertLength);
+                       }
+               } else {
+                       if (runStyle) {
+                               starts->InsertText(runStart-1, insertLength);
+                       } else {
+                               // Insert at end of run so do not extend style
+                               starts->InsertText(runStart, insertLength);
+                       }
+               }
+       } else {
+               starts->InsertText(runStart, insertLength);
+       }
+}
+
+void RunStyles::DeleteAll() {
+       delete starts;
+       starts = NULL;
+       delete styles;
+       styles = NULL;
+       starts = new Partitioning(8);
+       styles = new SplitVector<int>();
+       styles->InsertValue(0, 2, 0);
+}
+
+void RunStyles::DeleteRange(int position, int deleteLength) {
+       int end = position + deleteLength;
+       int runStart = RunFromPosition(position);
+       int runEnd = RunFromPosition(end);
+       if (runStart == runEnd) {
+               // Deleting from inside one run
+               starts->InsertText(runStart, -deleteLength);
+       } else {
+               runStart = SplitRun(position);
+               runEnd = SplitRun(end);
+               starts->InsertText(runStart, -deleteLength);
+               // Remove each old run over the range
+               for (int run=runStart; run<runEnd; run++) {
+                       RemoveRun(runStart);
+               }
+               RemoveRunIfEmpty(runStart);
+               RemoveRunIfSameAsPrevious(runStart);
+       }
+}
+
diff --git a/src/stc/scintilla/src/RunStyles.h b/src/stc/scintilla/src/RunStyles.h
new file mode 100644 (file)
index 0000000..bbf20b2
--- /dev/null
@@ -0,0 +1,41 @@
+/** @file RunStyles.h
+ ** Data structure used to store sparse styles.
+ **/
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+/// Styling buffer using one element for each run rather than using
+/// a filled buffer.
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+class RunStyles {
+public:
+       Partitioning *starts;
+       SplitVector<int> *styles;
+       int RunFromPosition(int position);
+       int SplitRun(int position);
+       void RemoveRun(int run);
+       void RemoveRunIfEmpty(int run);
+       void RemoveRunIfSameAsPrevious(int run);
+public:
+       RunStyles();
+       ~RunStyles();
+       int Length();
+       int ValueAt(int position);
+       int FindNextChange(int position, int end);
+       int StartRun(int position);
+       int EndRun(int position);
+       // Returns true if some values may have changed
+       bool FillRange(int &position, int value, int &fillLength);
+       void SetValueAt(int position, int value);
+       void InsertSpace(int position, int insertLength);
+       void DeleteAll();
+       void DeleteRange(int position, int deleteLength);
+};
+
+#ifdef SCI_NAMESPACE
+}
+#endif
index c8edb513bc3fdca89e6ef43f7341ee4a73f5ed13..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,127 +0,0 @@
-// Scintilla source code edit control
-/** @file SVector.h
- ** A simple expandable vector.
- **/
-// Copyright 1998-2001 by Neil Hodgson <neilh@hare.net.au>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#ifndef SVECTOR_H
-#define SVECTOR_H
-
-/**
- * A simple expandable integer vector.
- * Storage not allocated for elements until an element is used.
- * This makes it very lightweight unless used so is a good match for optional features.
- */
-class SVector {
-       enum { allocSize = 4000 };
-       
-       int *v;                         ///< The vector
-       unsigned int size;      ///< Number of elements allocated
-       unsigned int len;       ///< Number of elements used in vector
-       bool allocFailure;      ///< A memory allocation call has failed
-       
-       /** Internally allocate more elements than the user wants
-        * to avoid thrashing the memory allocator. */
-       void SizeTo(int newSize) {
-               if (newSize < allocSize)
-                       newSize += allocSize;
-               else 
-                       newSize = (newSize * 3) / 2;
-               int* newv = new int[newSize];
-               if (!newv) {
-                       allocFailure = true;
-                       return;
-               }
-               size = newSize;
-               unsigned int i=0;
-               for (; i<len; i++) {
-                       newv[i] = v[i];
-               }
-               for (; i<size; i++) {
-                       newv[i] = 0;
-               }
-               delete []v;
-               v = newv;
-       }
-       
-public:
-       SVector() {
-               allocFailure = false;
-               v = 0;
-               len = 0;
-               size = 0;
-       }
-       ~SVector() {
-               Free();
-       }
-       /// Constructor from another vector.
-       SVector(const SVector &other) {
-               allocFailure = false;
-               v = 0;
-               len = 0;
-               size = 0;
-               if (other.Length() > 0) {
-                       SizeTo(other.Length());
-                       if (!allocFailure) {
-                               for (int i=0;i<other.Length();i++)
-                                       v[i] = other.v[i];
-                               len = other.Length();
-                       }
-               }
-       }
-       /// Copy constructor.
-       SVector &operator=(const SVector &other) {
-               if (this != &other) {
-                       delete []v;
-                       allocFailure = false;
-                       v = 0;
-                       len = 0;
-                       size = 0;
-                       if (other.Length() > 0) {
-                               SizeTo(other.Length());
-                               if (!allocFailure) {
-                                       for (int i=0;i<other.Length();i++)
-                                               v[i] = other.v[i];
-                               }
-                               len = other.Length();
-                       }
-               }
-               return *this;
-       }
-       /** @brief Accessor.
-        * Allows to access values from the list, and grows it if accessing
-        * outside the current bounds. The returned value in this case is 0. */
-       int &operator[](unsigned int i) {
-               if (i >= len) {
-                       if (i >= size) {
-                               SizeTo(i);
-                       }
-                       len = i+1;
-               }
-               return v[i];
-       }
-       /// Reset vector.
-       void Free() {
-               delete []v;
-               v = 0;
-               size = 0;
-               len = 0;
-       }
-       /** @brief Grow vector size.
-        * Doesn't allow a vector to be shrinked. */
-       void SetLength(unsigned int newLength) {
-               if (newLength > len) {
-                       if (newLength >= size) {
-                               SizeTo(newLength);
-                       }
-               }
-               len = newLength;
-       }
-       /// Get the current length (number of used elements) of the vector.
-       int Length() const {
-               return len;
-       }
-};
-
-#endif
index bcb0a77e29730a93d878af7fc7bfa64b037a6b45..679cc1d1fb0f1f9a693a324ae803916b5d5e47fa 100644 (file)
 #include "DocumentAccessor.h"
 #include "KeyWords.h"
 #endif
 #include "DocumentAccessor.h"
 #include "KeyWords.h"
 #endif
+#include "SplitVector.h"
+#include "Partitioning.h"
+#include "RunStyles.h"
 #include "ContractionState.h"
 #include "ContractionState.h"
-#include "SVector.h"
 #include "CellBuffer.h"
 #include "CallTip.h"
 #include "KeyMap.h"
 #include "CellBuffer.h"
 #include "CallTip.h"
 #include "KeyMap.h"
 #include "ViewStyle.h"
 #include "AutoComplete.h"
 #include "CharClassify.h"
 #include "ViewStyle.h"
 #include "AutoComplete.h"
 #include "CharClassify.h"
+#include "Decoration.h"
 #include "Document.h"
 #include "Document.h"
+#include "PositionCache.h"
 #include "Editor.h"
 #include "ScintillaBase.h"
 
 #include "Editor.h"
 #include "ScintillaBase.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 ScintillaBase::ScintillaBase() {
        displayPopupMenu = true;
        listType = 0;
 ScintillaBase::ScintillaBase() {
        displayPopupMenu = true;
        listType = 0;
@@ -174,7 +182,7 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) {
                    (iMessage != SCI_CHARLEFT) &&
                    (iMessage != SCI_CHARLEFTEXTEND) &&
                    (iMessage != SCI_CHARRIGHT) &&
                    (iMessage != SCI_CHARLEFT) &&
                    (iMessage != SCI_CHARLEFTEXTEND) &&
                    (iMessage != SCI_CHARRIGHT) &&
-                   (iMessage != SCI_CHARLEFTEXTEND) &&
+                   (iMessage != SCI_CHARRIGHTEXTEND) &&
                    (iMessage != SCI_EDITTOGGLEOVERTYPE) &&
                    (iMessage != SCI_DELETEBACK) &&
                    (iMessage != SCI_DELETEBACKNOTLINE)
                    (iMessage != SCI_EDITTOGGLEOVERTYPE) &&
                    (iMessage != SCI_DELETEBACK) &&
                    (iMessage != SCI_DELETEBACKNOTLINE)
@@ -222,6 +230,9 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
 
        PRectangle rcClient = GetClientRectangle();
        Point pt = LocationFromPosition(currentPos - lenEntered);
 
        PRectangle rcClient = GetClientRectangle();
        Point pt = LocationFromPosition(currentPos - lenEntered);
+       PRectangle rcPopupBounds = wMain.GetMonitorRect(pt);
+       if (rcPopupBounds.Height() == 0)
+               rcPopupBounds = rcClient;
 
        int heightLB = 100;
        int widthLB = 100;
 
        int heightLB = 100;
        int widthLB = 100;
@@ -232,18 +243,18 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        }
        PRectangle rcac;
        rcac.left = pt.x - ac.lb->CaretFromEdge();
        }
        PRectangle rcac;
        rcac.left = pt.x - ac.lb->CaretFromEdge();
-       if (pt.y >= rcClient.bottom - heightLB &&  // Wont fit below.
-               pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
+       if (pt.y >= rcPopupBounds.bottom - heightLB &&  // Wont fit below.
+               pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above.
                rcac.top = pt.y - heightLB;
                rcac.top = pt.y - heightLB;
-               if (rcac.top < 0) {
-                       heightLB += rcac.top;
-                       rcac.top = 0;
+               if (rcac.top < rcPopupBounds.top) {
+                       heightLB -= (rcPopupBounds.top - rcac.top);
+                       rcac.top = rcPopupBounds.top;
                }
        } else {
                rcac.top = pt.y + vs.lineHeight;
        }
        rcac.right = rcac.left + widthLB;
                }
        } else {
                rcac.top = pt.y + vs.lineHeight;
        }
        rcac.right = rcac.left + widthLB;
-       rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom);
+       rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom);
        ac.lb->SetPositionRelative(rcac, wMain);
        ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
        unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
        ac.lb->SetPositionRelative(rcac, wMain);
        ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
        unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
@@ -261,8 +272,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        // Make an allowance for large strings in list
        rcList.left = pt.x - ac.lb->CaretFromEdge();
        rcList.right = rcList.left + widthLB;
        // Make an allowance for large strings in list
        rcList.left = pt.x - ac.lb->CaretFromEdge();
        rcList.right = rcList.left + widthLB;
-       if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) &&  // Wont fit below.
-               ((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above.
+       if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) &&  // Wont fit below.
+               ((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above.
                rcList.top = pt.y - heightAlloced;
        } else {
                rcList.top = pt.y + vs.lineHeight;
                rcList.top = pt.y - heightAlloced;
        } else {
                rcList.top = pt.y + vs.lineHeight;
@@ -356,7 +367,7 @@ void ScintillaBase::AutoCompleteCompleted() {
        SetEmptySelection(ac.posStart);
        if (item != -1) {
                SString piece = selected;
        SetEmptySelection(ac.posStart);
        if (item != -1) {
                SString piece = selected;
-               pdoc->InsertString(firstPos, piece.c_str());
+               pdoc->InsertCString(firstPos, piece.c_str());
                SetEmptySelection(firstPos + static_cast<int>(piece.length()));
        }
        pdoc->EndUndoAction();
                SetEmptySelection(firstPos + static_cast<int>(piece.length()));
        }
        pdoc->EndUndoAction();
@@ -632,7 +643,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
 
        case SCI_CALLTIPSETBACK:
                ct.colourBG = ColourDesired(wParam);
 
        case SCI_CALLTIPSETBACK:
                ct.colourBG = ColourDesired(wParam);
-               vs.styles[STYLE_CALLTIP].fore = ct.colourBG;
+               vs.styles[STYLE_CALLTIP].back = ct.colourBG;
                InvalidateStyleRedraw();
                break;
 
                InvalidateStyleRedraw();
                break;
 
index cb85b55b511e40163693709f944f7b3cae3cea87..0554d9457a062a8e8188142468354ba8bbe95529 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef SCINTILLABASE_H
 #define SCINTILLABASE_H
 
 #ifndef SCINTILLABASE_H
 #define SCINTILLABASE_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class ScintillaBase : public Editor {
 /**
  */
 class ScintillaBase : public Editor {
@@ -90,4 +94,8 @@ public:
        virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 };
 
        virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
diff --git a/src/stc/scintilla/src/SplitVector.h b/src/stc/scintilla/src/SplitVector.h
new file mode 100644 (file)
index 0000000..9d62aef
--- /dev/null
@@ -0,0 +1,243 @@
+// Scintilla source code edit control
+/** @file SplitVector.h
+ ** Main data structure for holding arrays that handle insertions 
+ ** and deletions efficiently.
+ **/
+// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef SPLITVECTOR_H
+#define SPLITVECTOR_H
+
+template <typename T>
+class SplitVector {
+protected:
+       T *body;
+       int size;
+       int lengthBody;
+       int part1Length;
+       int gapLength;  /// invariant: gapLength == size - lengthBody
+       int growSize;
+
+       /// Move the gap to a particular position so that insertion and
+       /// deletion at that point will not require much copying and
+       /// hence be fast.
+       void GapTo(int position) {
+               if (position != part1Length) {
+                       if (position < part1Length) {
+                               memmove(
+                                       body + position + gapLength,
+                                       body + position,
+                                       sizeof(T) * (part1Length - position));
+                       } else {        // position > part1Length
+                               memmove(
+                                       body + part1Length,
+                                       body + part1Length + gapLength,
+                                       sizeof(T) * (position - part1Length));
+                       }
+                       part1Length = position;
+               }
+       }
+
+       /// Check that there is room in the buffer for an insertion,
+       /// reallocating if more space needed.
+       void RoomFor(int insertionLength) {
+               if (gapLength <= insertionLength) {
+                       if (growSize * 6 < size)
+                               growSize *= 2;
+                       ReAllocate(size + insertionLength + growSize);
+               }
+       }
+
+       void Init() {
+               body = NULL;
+               growSize = 8;
+               size = 0;
+               lengthBody = 0;
+               part1Length = 0;
+               gapLength = 0;
+       }
+
+public:
+       /// Construct a split buffer.
+       SplitVector() {
+               Init();
+       }
+
+       ~SplitVector() {
+               delete []body;
+               body = 0;
+       }
+
+       int GetGrowSize() const {
+               return growSize;
+       }
+
+       void SetGrowSize(int growSize_) {
+               growSize = growSize_;
+       }
+
+       /// Reallocate the storage for the buffer to be newSize and
+       /// copy exisiting contents to the new buffer.
+       /// Must not be used to decrease the size of the buffer.
+       void ReAllocate(int newSize) {
+               if (newSize > size) {
+                       // Move the gap to the end
+                       GapTo(lengthBody);
+                       T *newBody = new T[newSize];
+                       if ((size != 0) && (body != 0)) {
+                               memmove(newBody, body, sizeof(T) * lengthBody);
+                               delete []body;
+                       }
+                       body = newBody;
+                       gapLength += newSize - size;
+                       size = newSize;
+               }
+       }
+
+       /// Retrieve the character at a particular position.
+       /// Retrieving positions outside the range of the buffer returns 0.
+       /// The assertions here are disabled since calling code can be 
+       /// simpler if out of range access works and returns 0.
+       T ValueAt(int position) const {
+               if (position < part1Length) {
+                       //PLATFORM_ASSERT(position >= 0);
+                       if (position < 0) {
+                               return 0;
+                       } else {
+                               return body[position];
+                       }
+               } else {
+                       //PLATFORM_ASSERT(position < lengthBody);
+                       if (position >= lengthBody) {
+                               return 0;
+                       } else {
+                               return body[gapLength + position];
+                       }
+               }
+       }
+
+       void SetValueAt(int position, T v) {
+               if (position < part1Length) {
+                       PLATFORM_ASSERT(position >= 0);
+                       if (position < 0) {
+                               ;
+                       } else {
+                               body[position] = v;
+                       }
+               } else {
+                       PLATFORM_ASSERT(position < lengthBody);
+                       if (position >= lengthBody) {
+                               ;
+                       } else {
+                               body[gapLength + position] = v;
+                       }
+               }
+       }
+
+       T& operator[](int position) const {
+               PLATFORM_ASSERT(position >= 0 && position < lengthBody);
+               if (position < part1Length) {
+                       return body[position];
+               } else {
+                       return body[gapLength + position];
+               }
+       }
+
+       /// Retrieve the length of the buffer.
+       int Length() const {
+               return lengthBody;
+       }
+
+       /// Insert a single value into the buffer.
+       /// Inserting at positions outside the current range fails.
+       void Insert(int position, T v) {
+               PLATFORM_ASSERT((position >= 0) && (position <= lengthBody));
+               if ((position < 0) || (position > lengthBody)) {
+                       return;
+               }
+               RoomFor(1);
+               GapTo(position);
+               body[part1Length] = v;
+               lengthBody++;
+               part1Length++;
+               gapLength--;
+       }
+
+       /// Insert a number of elements into the buffer setting their value.
+       /// Inserting at positions outside the current range fails.
+       void InsertValue(int position, int insertLength, T v) {
+               PLATFORM_ASSERT((position >= 0) && (position <= lengthBody));
+               if (insertLength > 0) {
+                       if ((position < 0) || (position > lengthBody)) {
+                               return;
+                       }
+                       RoomFor(insertLength);
+                       GapTo(position);
+                       for (int i = 0; i < insertLength; i++)
+                               body[part1Length + i] = v;
+                       lengthBody += insertLength;
+                       part1Length += insertLength;
+                       gapLength -= insertLength;
+               }
+       }
+
+       /// Ensure at least length elements allocated, 
+       /// appending zero valued elements if needed.
+       void EnsureLength(int wantedLength) {
+               if (Length() < wantedLength) {
+                       InsertValue(Length(), wantedLength - Length(), 0);
+               }
+       }
+       
+       /// Insert text into the buffer from an array.
+       void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) {
+               PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody));
+               if (insertLength > 0) {
+                       if ((positionToInsert < 0) || (positionToInsert > lengthBody)) {
+                               return;
+                       }
+                       RoomFor(insertLength);
+                       GapTo(positionToInsert);
+                       memmove(body + part1Length, s + positionFrom, sizeof(T) * insertLength);
+                       lengthBody += insertLength;
+                       part1Length += insertLength;
+                       gapLength -= insertLength;
+               }
+       }
+
+       /// Delete one element from the buffer.
+       void Delete(int position) {
+               PLATFORM_ASSERT((position >= 0) && (position < lengthBody));
+               if ((position < 0) || (position >= lengthBody)) {
+                       return;
+               }
+               DeleteRange(position, 1);
+       }
+
+       /// Delete a range from the buffer.
+       /// Deleting positions outside the current range fails.
+       void DeleteRange(int position, int deleteLength) {
+               PLATFORM_ASSERT((position >= 0) && (position + deleteLength <= lengthBody));
+               if ((position < 0) || ((position + deleteLength) > lengthBody)) {
+                       return;
+               }
+               if ((position == 0) && (deleteLength == lengthBody)) {
+                       // Full deallocation returns storage and is faster
+                       delete []body;
+                       Init();
+               } else if (deleteLength > 0) {
+                       GapTo(position);
+                       lengthBody -= deleteLength;
+                       gapLength += deleteLength;
+               }
+       }
+
+       /// Delete all the buffer contents.
+       void DeleteAll() {
+               DeleteRange(0, lengthBody);
+       }
+
+};
+
+#endif
index f01aee0826c820e8b9db9d069379abfe8507a4f1..ad081a66ddc779774742f05ad9d8568f539170bb 100644 (file)
 #include "Scintilla.h"
 #include "Style.h"
 
 #include "Scintilla.h"
 #include "Style.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 Style::Style() {
        aliasOfDefaultFont = true;
        Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
 Style::Style() {
        aliasOfDefaultFont = true;
        Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
index 91f0bdb62e4aad972f2c36c85d00aa1bcdf0c820..1caecaee73ffe228f0521348320bee167a26c098 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef STYLE_H
 #define STYLE_H
 
 #ifndef STYLE_H
 #define STYLE_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class Style {
 /**
  */
 class Style {
@@ -50,7 +54,11 @@ public:
        void ClearTo(const Style &source);
        bool EquivalentFontTo(const Style *other) const;
        void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, bool extraFontFlag = false);
        void ClearTo(const Style &source);
        bool EquivalentFontTo(const Style *other) const;
        void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, bool extraFontFlag = false);
-       bool IsProtected() const { return !(changeable && visible);}
+       bool IsProtected() const { return !(changeable && visible);};
 };
 
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index d9da0edc47af689c57944109764ee810b247d19e..4a1f71622f98a54dd3bcd20bba8dd0bd2915e769 100644 (file)
 #include "Accessor.h"
 #include "StyleContext.h"
 
 #include "Accessor.h"
 #include "StyleContext.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static void getRange(unsigned int start,
                unsigned int end,
                Accessor &styler,
 static void getRange(unsigned int start,
                unsigned int end,
                Accessor &styler,
index 36b50f9142f309d6d9ae1feaa95a715354df96d9..463aab462afebdf8c208bc48f9e822ec1bc32d5d 100644 (file)
@@ -5,6 +5,10 @@
 // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
 // This file is in the public domain.
 
 // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
 // This file is in the public domain.
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 // All languages handled so far can treat all characters >= 0x80 as one class
 // which just continues the current token or starts an identifier if in default.
 // DBCS treated specially as the second character can be < 0x80 and hence
 // All languages handled so far can treat all characters >= 0x80 as one class
 // which just continues the current token or starts an identifier if in default.
 // DBCS treated specially as the second character can be < 0x80 and hence
@@ -107,16 +111,18 @@ public:
                return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n));
        }
        bool Match(char ch0) {
                return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n));
        }
        bool Match(char ch0) {
-               return ch == ch0;
+               return ch == static_cast<unsigned char>(ch0);
        }
        bool Match(char ch0, char ch1) {
        }
        bool Match(char ch0, char ch1) {
-               return (ch == ch0) && (chNext == ch1);
+               return (ch == static_cast<unsigned char>(ch0)) && (chNext == static_cast<unsigned char>(ch1));
        }
        bool Match(const char *s) {
        }
        bool Match(const char *s) {
-               if (ch != *s)
+               if (ch != static_cast<unsigned char>(*s))
                        return false;
                s++;
                        return false;
                s++;
-               if (chNext != *s)
+               if (!*s)
+                       return true;
+               if (chNext != static_cast<unsigned char>(*s))
                        return false;
                s++;
                for (int n=2; *s; n++) {
                        return false;
                s++;
                for (int n=2; *s; n++) {
@@ -127,14 +133,14 @@ public:
                return true;
        }
        bool MatchIgnoreCase(const char *s) {
                return true;
        }
        bool MatchIgnoreCase(const char *s) {
-               if (tolower(ch) != *s)
+               if (tolower(ch) != static_cast<unsigned char>(*s))
                        return false;
                s++;
                        return false;
                s++;
-               if (tolower(chNext) != *s)
+               if (tolower(chNext) != static_cast<unsigned char>(*s))
                        return false;
                s++;
                for (int n=2; *s; n++) {
                        return false;
                s++;
                for (int n=2; *s; n++) {
-                       if (*s !=
+                       if (static_cast<unsigned char>(*s) !=
                                tolower(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n))))
                                return false;
                        s++;
                                tolower(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n))))
                                return false;
                        s++;
@@ -146,6 +152,10 @@ public:
        void GetCurrentLowered(char *s, unsigned int len);
 };
 
        void GetCurrentLowered(char *s, unsigned int len);
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 inline bool IsASpace(unsigned int ch) {
     return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
 }
 inline bool IsASpace(unsigned int ch) {
     return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
 }
index 363db90f4528c5bfe3abda127f5e063b369d389f..863eb82cdc97586d480b0bdb3d77ac17c50ac478 100644 (file)
@@ -9,49 +9,80 @@
 
 #include "UniConversion.h"
 
 
 #include "UniConversion.h"
 
+enum { SURROGATE_LEAD_FIRST = 0xD800 };
+enum { SURROGATE_TRAIL_FIRST = 0xDC00 };
+enum { SURROGATE_TRAIL_LAST = 0xDFFF };
+
 unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) {
        unsigned int len = 0;
 unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) {
        unsigned int len = 0;
-       for (unsigned int i = 0; i < tlen && uptr[i]; i++) {
+       for (unsigned int i = 0; i < tlen && uptr[i];) {
                unsigned int uch = uptr[i];
                unsigned int uch = uptr[i];
-               if (uch < 0x80)
+               if (uch < 0x80) {
                        len++;
                        len++;
-               else if (uch < 0x800)
+               } else if (uch < 0x800) {
                        len += 2;
                        len += 2;
-               else
-                       len +=3;
+               } else if ((uch >= SURROGATE_LEAD_FIRST) &&
+                       (uch <= SURROGATE_TRAIL_LAST)) {
+                       len += 4;
+                       i++;
+               } else {
+                       len += 3;
+               }
+               i++;
        }
        return len;
 }
 
        }
        return len;
 }
 
-void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) {
+void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) {
        int k = 0;
        int k = 0;
-       for (unsigned int i = 0; i < tlen && uptr[i]; i++) {
+       for (unsigned int i = 0; i < tlen && uptr[i];) {
                unsigned int uch = uptr[i];
                if (uch < 0x80) {
                        putf[k++] = static_cast<char>(uch);
                } else if (uch < 0x800) {
                        putf[k++] = static_cast<char>(0xC0 | (uch >> 6));
                        putf[k++] = static_cast<char>(0x80 | (uch & 0x3f));
                unsigned int uch = uptr[i];
                if (uch < 0x80) {
                        putf[k++] = static_cast<char>(uch);
                } else if (uch < 0x800) {
                        putf[k++] = static_cast<char>(0xC0 | (uch >> 6));
                        putf[k++] = static_cast<char>(0x80 | (uch & 0x3f));
+               } else if ((uch >= SURROGATE_LEAD_FIRST) &&
+                       (uch <= SURROGATE_TRAIL_LAST)) {
+                       // Half a surrogate pair
+                       i++;
+                       unsigned int xch = 0x10000 + ((uch & 0x3ff) << 10) + (uptr[i] & 0x3ff);
+                       putf[k++] = static_cast<char>(0xF0 | (xch >> 18));
+                       putf[k++] = static_cast<char>(0x80 | (xch >> 12) & 0x3f);
+                       putf[k++] = static_cast<char>(0x80 | ((xch >> 6) & 0x3f));
+                       putf[k++] = static_cast<char>(0x80 | (xch & 0x3f));
                } else {
                        putf[k++] = static_cast<char>(0xE0 | (uch >> 12));
                        putf[k++] = static_cast<char>(0x80 | ((uch >> 6) & 0x3f));
                        putf[k++] = static_cast<char>(0x80 | (uch & 0x3f));
                }
                } else {
                        putf[k++] = static_cast<char>(0xE0 | (uch >> 12));
                        putf[k++] = static_cast<char>(0x80 | ((uch >> 6) & 0x3f));
                        putf[k++] = static_cast<char>(0x80 | (uch & 0x3f));
                }
+               i++;
        }
        putf[len] = '\0';
 }
 
        }
        putf[len] = '\0';
 }
 
-unsigned int UCS2Length(const char *s, unsigned int len) {
+unsigned int UTF16Length(const char *s, unsigned int len) {
        unsigned int ulen = 0;
        unsigned int ulen = 0;
-       for (unsigned int i=0;i<len;i++) {
+       unsigned int charLen;
+       for (unsigned int i=0;i<len;) {
                unsigned char ch = static_cast<unsigned char>(s[i]);
                unsigned char ch = static_cast<unsigned char>(s[i]);
-               if ((ch < 0x80) || (ch > (0x80 + 0x40)))
+               if (ch < 0x80) {
+                       charLen = 1;
+               } else if (ch < 0x80 + 0x40 + 0x20) {
+                       charLen = 2;
+               } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) {
+                       charLen = 3;
+               } else {
+                       charLen = 4;
                        ulen++;
                        ulen++;
+               }
+               i += charLen;
+               ulen++;
        }
        return ulen;
 }
 
        }
        return ulen;
 }
 
-unsigned int UCS2FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen) {
+unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen) {
        unsigned int ui=0;
        const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
        unsigned int i=0;
        unsigned int ui=0;
        const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
        unsigned int i=0;
@@ -63,12 +94,24 @@ unsigned int UCS2FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsign
                        tbuf[ui] = static_cast<wchar_t>((ch & 0x1F) << 6);
                        ch = us[i++];
                        tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F));
                        tbuf[ui] = static_cast<wchar_t>((ch & 0x1F) << 6);
                        ch = us[i++];
                        tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F));
-               } else {
+               } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) {
                        tbuf[ui] = static_cast<wchar_t>((ch & 0xF) << 12);
                        ch = us[i++];
                        tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + ((ch & 0x7F) << 6));
                        ch = us[i++];
                        tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F));
                        tbuf[ui] = static_cast<wchar_t>((ch & 0xF) << 12);
                        ch = us[i++];
                        tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + ((ch & 0x7F) << 6));
                        ch = us[i++];
                        tbuf[ui] = static_cast<wchar_t>(tbuf[ui] + (ch & 0x7F));
+               } else {
+                       // Outside the BMP so need two surrogates
+                       int val = (ch & 0x7) << 18;
+                       ch = us[i++];
+                       val += (ch & 0x3F) << 12;
+                       ch = us[i++];
+                       val += (ch & 0x3F) << 6;
+                       ch = us[i++];
+                       val += (ch & 0x3F);
+                       tbuf[ui] = static_cast<wchar_t>(((val - 0x10000) >> 10) + SURROGATE_LEAD_FIRST);
+                       ui++;
+                       tbuf[ui] = static_cast<wchar_t>((val & 0x3ff) + SURROGATE_TRAIL_FIRST);
                }
                ui++;
        }
                }
                ui++;
        }
index bd1d7754d45a9924f631d0d592491786dc8e8ea4..fd420a6884eb9c42fb015360add40364d9de5f61 100644 (file)
@@ -6,7 +6,7 @@
 // The License.txt file describes the conditions under which this software may be distributed.
 
 unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen);
 // The License.txt file describes the conditions under which this software may be distributed.
 
 unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen);
-void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len);
-unsigned int UCS2Length(const char *s, unsigned int len);
-unsigned int UCS2FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen);
+void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len);
+unsigned int UTF16Length(const char *s, unsigned int len);
+unsigned int UTF16FromUTF8(const char *s, unsigned int len, wchar_t *tbuf, unsigned int tlen);
 
 
index b4da30ace3f2077200aaf40891dc06a43f96fe83..15efea8cc5ca3bf59fbf54afc62b008f4e27e3de 100644 (file)
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "Platform.h"
 
 #include "Scintilla.h"
+#include "SplitVector.h"
+#include "Partitioning.h"
+#include "RunStyles.h"
 #include "Indicator.h"
 #include "XPM.h"
 #include "LineMarker.h"
 #include "Style.h"
 #include "ViewStyle.h"
 
 #include "Indicator.h"
 #include "XPM.h"
 #include "LineMarker.h"
 #include "Style.h"
 #include "ViewStyle.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 MarginStyle::MarginStyle() :
        style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) {
 }
 
 // A list of the fontnames - avoids wasting space in each style
 FontNames::FontNames() {
 MarginStyle::MarginStyle() :
        style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) {
 }
 
 // A list of the fontnames - avoids wasting space in each style
 FontNames::FontNames() {
+       size = 8;
+       names = new char *[size];
        max = 0;
 }
 
 FontNames::~FontNames() {
        Clear();
        max = 0;
 }
 
 FontNames::~FontNames() {
        Clear();
+       delete []names;
+       names = 0;
 }
 
 void FontNames::Clear() {
 }
 
 void FontNames::Clear() {
@@ -44,6 +55,17 @@ const char *FontNames::Save(const char *name) {
                        return names[i];
                }
        }
                        return names[i];
                }
        }
+       if (max >= size) {
+               // Grow array
+               int sizeNew = size * 2;
+               char **namesNew = new char *[sizeNew];
+               for (int j=0;j<max;j++) {
+                       namesNew[j] = names[j];
+               }
+               delete []names;
+               names = namesNew;
+               size = sizeNew;
+       }
        names[max] = new char[strlen(name) + 1];
        strcpy(names[max], name);
        max++;
        names[max] = new char[strlen(name) + 1];
        strcpy(names[max], name);
        max++;
@@ -55,8 +77,8 @@ ViewStyle::ViewStyle() {
 }
 
 ViewStyle::ViewStyle(const ViewStyle &source) {
 }
 
 ViewStyle::ViewStyle(const ViewStyle &source) {
-       Init();
-       for (unsigned int sty=0;sty<(sizeof(styles)/sizeof(styles[0]));sty++) {
+       Init(source.stylesSize);
+       for (unsigned int sty=0;sty<source.stylesSize;sty++) {
                styles[sty] = source.styles[sty];
                // Can't just copy fontname as its lifetime is relative to its owning ViewStyle
                styles[sty].fontName = fontNames.Save(source.styles[sty].fontName);
                styles[sty] = source.styles[sty];
                // Can't just copy fontname as its lifetime is relative to its owning ViewStyle
                styles[sty].fontName = fontNames.Save(source.styles[sty].fontName);
@@ -74,6 +96,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
        selbackground.desired = source.selbackground.desired;
        selbackground2.desired = source.selbackground2.desired;
        selAlpha = source.selAlpha;
        selbackground.desired = source.selbackground.desired;
        selbackground2.desired = source.selbackground2.desired;
        selAlpha = source.selAlpha;
+       selEOLFilled = source.selEOLFilled;
 
        foldmarginColourSet = source.foldmarginColourSet;
        foldmarginColour.desired = source.foldmarginColour.desired;
 
        foldmarginColourSet = source.foldmarginColourSet;
        foldmarginColour.desired = source.foldmarginColour.desired;
@@ -99,6 +122,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
        caretLineAlpha = source.caretLineAlpha;
        edgecolour.desired = source.edgecolour.desired;
        edgeState = source.edgeState;
        caretLineAlpha = source.caretLineAlpha;
        edgecolour.desired = source.edgecolour.desired;
        edgeState = source.edgeState;
+       caretStyle = source.caretStyle;
        caretWidth = source.caretWidth;
        someStylesProtected = false;
        leftMarginWidth = source.leftMarginWidth;
        caretWidth = source.caretWidth;
        someStylesProtected = false;
        leftMarginWidth = source.leftMarginWidth;
@@ -118,17 +142,25 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
 }
 
 ViewStyle::~ViewStyle() {
 }
 
 ViewStyle::~ViewStyle() {
+       delete []styles;
+       styles = NULL;
 }
 
 }
 
-void ViewStyle::Init() {
+void ViewStyle::Init(size_t stylesSize_) {
+       stylesSize = 0;
+       styles = NULL;
+       AllocStyles(stylesSize_);
        fontNames.Clear();
        ResetDefaultStyle();
 
        indicators[0].style = INDIC_SQUIGGLE;
        fontNames.Clear();
        ResetDefaultStyle();
 
        indicators[0].style = INDIC_SQUIGGLE;
+       indicators[0].under = false;
        indicators[0].fore = ColourDesired(0, 0x7f, 0);
        indicators[1].style = INDIC_TT;
        indicators[0].fore = ColourDesired(0, 0x7f, 0);
        indicators[1].style = INDIC_TT;
+       indicators[1].under = false;
        indicators[1].fore = ColourDesired(0, 0, 0xff);
        indicators[2].style = INDIC_PLAIN;
        indicators[1].fore = ColourDesired(0, 0, 0xff);
        indicators[2].style = INDIC_PLAIN;
+       indicators[2].under = false;
        indicators[2].fore = ColourDesired(0xff, 0, 0);
 
        lineHeight = 1;
        indicators[2].fore = ColourDesired(0xff, 0, 0);
 
        lineHeight = 1;
@@ -143,6 +175,7 @@ void ViewStyle::Init() {
        selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
        selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
        selAlpha = SC_ALPHA_NOALPHA;
        selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
        selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
        selAlpha = SC_ALPHA_NOALPHA;
+       selEOLFilled = false;
 
        foldmarginColourSet = false;
        foldmarginColour.desired = ColourDesired(0xff, 0, 0);
 
        foldmarginColourSet = false;
        foldmarginColour.desired = ColourDesired(0xff, 0, 0);
@@ -163,6 +196,7 @@ void ViewStyle::Init() {
        caretLineAlpha = SC_ALPHA_NOALPHA;
        edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
        edgeState = EDGE_NONE;
        caretLineAlpha = SC_ALPHA_NOALPHA;
        edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
        edgeState = EDGE_NONE;
+       caretStyle = CARETSTYLE_LINE;
        caretWidth = 1;
        someStylesProtected = false;
 
        caretWidth = 1;
        someStylesProtected = false;
 
@@ -195,7 +229,7 @@ void ViewStyle::Init() {
        }
        zoomLevel = 0;
        viewWhitespace = wsInvisible;
        }
        zoomLevel = 0;
        viewWhitespace = wsInvisible;
-       viewIndentationGuides = false;
+       viewIndentationGuides = ivNone;
        viewEOL = false;
        showMarkedLines = true;
        extraFontFlag = false;
        viewEOL = false;
        showMarkedLines = true;
        extraFontFlag = false;
@@ -203,7 +237,7 @@ void ViewStyle::Init() {
 
 void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
        unsigned int i;
 
 void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
        unsigned int i;
-       for (i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
+       for (i=0;i<stylesSize;i++) {
                pal.WantFind(styles[i].fore, want);
                pal.WantFind(styles[i].back, want);
        }
                pal.WantFind(styles[i].fore, want);
                pal.WantFind(styles[i].back, want);
        }
@@ -238,7 +272,7 @@ void ViewStyle::Refresh(Surface &surface) {
        maxAscent = styles[STYLE_DEFAULT].ascent;
        maxDescent = styles[STYLE_DEFAULT].descent;
        someStylesProtected = false;
        maxAscent = styles[STYLE_DEFAULT].ascent;
        maxDescent = styles[STYLE_DEFAULT].descent;
        someStylesProtected = false;
-       for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
+       for (unsigned int i=0; i<stylesSize; i++) {
                if (i != STYLE_DEFAULT) {
                        styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT], extraFontFlag);
                        if (maxAscent < styles[i].ascent)
                if (i != STYLE_DEFAULT) {
                        styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT], extraFontFlag);
                        if (maxAscent < styles[i].ascent)
@@ -266,17 +300,45 @@ void ViewStyle::Refresh(Surface &surface) {
        }
 }
 
        }
 }
 
+void ViewStyle::AllocStyles(size_t sizeNew) {
+       Style *stylesNew = new Style[sizeNew];
+       size_t i=0;
+       for (; i<stylesSize; i++) {
+               stylesNew[i] = styles[i];
+               stylesNew[i].fontName = styles[i].fontName;
+       }
+       if (stylesSize > STYLE_DEFAULT) {
+               for (; i<sizeNew; i++) {
+                       if (i != STYLE_DEFAULT) {
+                               stylesNew[i].ClearTo(styles[STYLE_DEFAULT]);
+                       }
+               }
+       }
+       delete []styles;
+       styles = stylesNew;
+       stylesSize = sizeNew;
+}
+
+void ViewStyle::EnsureStyle(size_t index) {
+       if (index >= stylesSize) {
+               size_t sizeNew = stylesSize * 2;
+               while (sizeNew < index)
+                       sizeNew *= 2;
+               AllocStyles(sizeNew);
+       }
+}
+
 void ViewStyle::ResetDefaultStyle() {
        styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0),
                ColourDesired(0xff,0xff,0xff),
 void ViewStyle::ResetDefaultStyle() {
        styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0),
                ColourDesired(0xff,0xff,0xff),
-               Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()),
+               Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()),
                SC_CHARSET_DEFAULT,
                false, false, false, false, Style::caseMixed, true, true, false);
 }
 
 void ViewStyle::ClearStyles() {
        // Reset all styles to be like the default style
                SC_CHARSET_DEFAULT,
                false, false, false, false, Style::caseMixed, true, true, false);
 }
 
 void ViewStyle::ClearStyles() {
        // Reset all styles to be like the default style
-       for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
+       for (unsigned int i=0; i<stylesSize; i++) {
                if (i != STYLE_DEFAULT) {
                        styles[i].ClearTo(styles[STYLE_DEFAULT]);
                }
                if (i != STYLE_DEFAULT) {
                        styles[i].ClearTo(styles[STYLE_DEFAULT]);
                }
@@ -293,5 +355,5 @@ void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
 }
 
 bool ViewStyle::ProtectionActive() const {
 }
 
 bool ViewStyle::ProtectionActive() const {
-    return someStylesProtected;
+       return someStylesProtected;
 }
 }
index 75f899d974a2e588cddb1bdea39cc253c95442ed..2f2d524616a7f8dff106d5f86c1389dec88b2dc4 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef VIEWSTYLE_H
 #define VIEWSTYLE_H
 
 #ifndef VIEWSTYLE_H
 #define VIEWSTYLE_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  */
 class MarginStyle {
 /**
  */
 class MarginStyle {
@@ -23,7 +27,8 @@ public:
  */
 class FontNames {
 private:
  */
 class FontNames {
 private:
-       char *names[STYLE_MAX + 1];
+       char **names;
+       int size;
        int max;
 
 public:
        int max;
 
 public:
@@ -33,6 +38,8 @@ public:
        const char *Save(const char *name);
 };
 
        const char *Save(const char *name);
 };
 
+enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth};
+
 enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
 
 /**
 enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
 
 /**
@@ -40,7 +47,8 @@ enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterInden
 class ViewStyle {
 public:
        FontNames fontNames;
 class ViewStyle {
 public:
        FontNames fontNames;
-       Style styles[STYLE_MAX + 1];
+       size_t stylesSize;
+       Style *styles;
        LineMarker markers[MARKER_MAX + 1];
        Indicator indicators[INDIC_MAX + 1];
        int lineHeight;
        LineMarker markers[MARKER_MAX + 1];
        Indicator indicators[INDIC_MAX + 1];
        int lineHeight;
@@ -54,6 +62,7 @@ public:
        ColourPair selbackground;
        ColourPair selbackground2;
        int selAlpha;
        ColourPair selbackground;
        ColourPair selbackground2;
        int selAlpha;
+       bool selEOLFilled;
        bool whitespaceForegroundSet;
        ColourPair whitespaceForeground;
        bool whitespaceBackgroundSet;
        bool whitespaceForegroundSet;
        ColourPair whitespaceForeground;
        bool whitespaceBackgroundSet;
@@ -80,7 +89,7 @@ public:
        int fixedColumnWidth;
        int zoomLevel;
        WhiteSpaceVisibility viewWhitespace;
        int fixedColumnWidth;
        int zoomLevel;
        WhiteSpaceVisibility viewWhitespace;
-       bool viewIndentationGuides;
+       IndentView viewIndentationGuides;
        bool viewEOL;
        bool showMarkedLines;
        ColourPair caretcolour;
        bool viewEOL;
        bool showMarkedLines;
        ColourPair caretcolour;
@@ -89,6 +98,7 @@ public:
        int caretLineAlpha;
        ColourPair edgecolour;
        int edgeState;
        int caretLineAlpha;
        ColourPair edgecolour;
        int edgeState;
+       int caretStyle;
        int caretWidth;
        bool someStylesProtected;
        bool extraFontFlag;
        int caretWidth;
        bool someStylesProtected;
        bool extraFontFlag;
@@ -96,13 +106,19 @@ public:
        ViewStyle();
        ViewStyle(const ViewStyle &source);
        ~ViewStyle();
        ViewStyle();
        ViewStyle(const ViewStyle &source);
        ~ViewStyle();
-       void Init();
+       void Init(size_t stylesSize_=64);
        void RefreshColourPalette(Palette &pal, bool want);
        void Refresh(Surface &surface);
        void RefreshColourPalette(Palette &pal, bool want);
        void Refresh(Surface &surface);
+       void AllocStyles(size_t sizeNew);
+       void EnsureStyle(size_t index);
        void ResetDefaultStyle();
        void ClearStyles();
        void SetStyleFontName(int styleIndex, const char *name);
        bool ProtectionActive() const;
 };
 
        void ResetDefaultStyle();
        void ClearStyles();
        void SetStyleFontName(int styleIndex, const char *name);
        bool ProtectionActive() const;
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index ce42534e7bffa52b588207e0dcd4ef38854102eb..8093300bc05bc41471c2abb5a81f4a86a271fdef 100644 (file)
 #include "WindowAccessor.h"
 #include "Scintilla.h"
 
 #include "WindowAccessor.h"
 #include "Scintilla.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 WindowAccessor::~WindowAccessor() {
 }
 
 WindowAccessor::~WindowAccessor() {
 }
 
@@ -176,3 +180,12 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC
                return indent;
 }
 
                return indent;
 }
 
+void WindowAccessor::IndicatorFill(int start, int end, int indicator, int value) {
+       Platform::SendScintilla(id, SCI_SETINDICATORCURRENT, indicator);
+       if (value) {
+               Platform::SendScintilla(id, SCI_SETINDICATORVALUE, value);
+               Platform::SendScintilla(id, SCI_INDICATORFILLRANGE, start, end - start);
+       } else {
+               Platform::SendScintilla(id, SCI_INDICATORCLEARRANGE, start, end - start);
+       }
+}
index 36e7994f46c4dd9b562523c48df0db82de9f5363..7fc05bb9b46cd7403cc0ba57a86ba45bfa6dd0d9 100644 (file)
 
 #include "XPM.h"
 
 
 #include "XPM.h"
 
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
 static const char *NextField(const char *s) {
        // In case there are leading spaces in the string
        while (*s && *s == ' ') {
 static const char *NextField(const char *s) {
        // In case there are leading spaces in the string
        while (*s && *s == ' ') {
index 4d3da28d36e58b67f668914df2abaf9c1dbd6826..0ee68c07204b1c00bd5ca0b8376e7861822a26a1 100644 (file)
@@ -8,6 +8,10 @@
 #ifndef XPM_H
 #define XPM_H
 
 #ifndef XPM_H
 #define XPM_H
 
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
 /**
  * Hold a pixmap in XPM format.
  */
 /**
  * Hold a pixmap in XPM format.
  */
@@ -69,4 +73,8 @@ public:
        int GetWidth();
 };
 
        int GetWidth();
 };
 
+#ifdef SCI_NAMESPACE
+}
+#endif
+
 #endif
 #endif
index dda75ca9d36af95fab7edb6d8adf564aee13fe03..6230d02ca53b0b09c7988441217b651bc82751d0 100644 (file)
@@ -110,7 +110,9 @@ DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
-DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION )    
+DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION )
+DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_CLICK )
+DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_RELEASE )
 
 
 
 
 
 
@@ -642,6 +644,81 @@ void wxStyledTextCtrl::StyleSetUnderline(int style, bool underline) {
     SendMsg(2059, style, underline);
 }
 
     SendMsg(2059, style, underline);
 }
 
+// Get the foreground colour of a style.
+wxColour wxStyledTextCtrl::StyleGetForeground(int style) {
+    long c = SendMsg(2481, style, 0);
+    return wxColourFromLong(c);
+}
+
+// Get the background colour of a style.
+wxColour wxStyledTextCtrl::StyleGetBackground(int style) {
+    long c = SendMsg(2482, style, 0);
+    return wxColourFromLong(c);
+}
+
+// Get is a style bold or not.
+bool wxStyledTextCtrl::StyleGetBold(int style) {
+    return SendMsg(2483, style, 0) != 0;
+}
+
+// Get is a style italic or not.
+bool wxStyledTextCtrl::StyleGetItalic(int style) {
+    return SendMsg(2484, style, 0) != 0;
+}
+
+// Get the size of characters of a style.
+int wxStyledTextCtrl::StyleGetSize(int style) {
+    return SendMsg(2485, style, 0);
+}
+
+// Get the font facename of a style
+wxString wxStyledTextCtrl::StyleGetFaceName(int style) {
+         long msg = 2486;
+         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 is a style to have its end of line filled or not.
+bool wxStyledTextCtrl::StyleGetEOLFilled(int style) {
+    return SendMsg(2487, style, 0) != 0;
+}
+
+// Get is a style underlined or not.
+bool wxStyledTextCtrl::StyleGetUnderline(int style) {
+    return SendMsg(2488, style, 0) != 0;
+}
+
+// Get is a style mixed case, or to force upper or lower case.
+int wxStyledTextCtrl::StyleGetCase(int style) {
+    return SendMsg(2489, style, 0);
+}
+
+// Get the character set of the font in a style.
+int wxStyledTextCtrl::StyleGetCharacterSet(int style) {
+    return SendMsg(2490, style, 0);
+}
+
+// Get is a style visible or not.
+bool wxStyledTextCtrl::StyleGetVisible(int style) {
+    return SendMsg(2491, style, 0) != 0;
+}
+
+// Get is a style changeable or not (read only).
+// Experimental feature, currently buggy.
+bool wxStyledTextCtrl::StyleGetChangeable(int style) {
+    return SendMsg(2492, style, 0) != 0;
+}
+
+// Get is a style a hotspot or not.
+bool wxStyledTextCtrl::StyleGetHotSpot(int style) {
+    return SendMsg(2493, style, 0) != 0;
+}
+
 // Set a style to be mixed case, or to force upper or lower case.
 void wxStyledTextCtrl::StyleSetCase(int style, int caseForce) {
     SendMsg(2060, style, caseForce);
 // Set a style to be mixed case, or to force upper or lower case.
 void wxStyledTextCtrl::StyleSetCase(int style, int caseForce) {
     SendMsg(2060, style, caseForce);
@@ -672,6 +749,16 @@ void wxStyledTextCtrl::SetSelAlpha(int alpha) {
     SendMsg(2478, alpha, 0);
 }
 
     SendMsg(2478, alpha, 0);
 }
 
+// Is the selection end of line filled?
+bool wxStyledTextCtrl::GetSelEOLFilled() {
+    return SendMsg(2479, 0, 0) != 0;
+}
+
+// Set the selection to have its end of line filled or not.
+void wxStyledTextCtrl::SetSelEOLFilled(bool filled) {
+    SendMsg(2480, filled, 0);
+}
+
 // Set the foreground colour of the caret.
 void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
     SendMsg(2069, wxColourAsLong(fore), 0);
 // Set the foreground colour of the caret.
 void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
     SendMsg(2069, wxColourAsLong(fore), 0);
@@ -750,6 +837,16 @@ wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) {
     return wxColourFromLong(c);
 }
 
     return wxColourFromLong(c);
 }
 
+// Set an indicator to draw under text or over(default).
+void wxStyledTextCtrl::IndicatorSetUnder(int indic, bool under) {
+    SendMsg(2510, indic, under);
+}
+
+// Retrieve whether indicator drawn under or over text.
+bool wxStyledTextCtrl::IndicatorGetUnder(int indic) {
+    return SendMsg(2511, indic, 0) != 0;
+}
+
 // Set the foreground colour of all whitespace and whether to use this setting.
 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting, const wxColour& fore) {
     SendMsg(2084, useSetting, wxColourAsLong(fore));
 // Set the foreground colour of all whitespace and whether to use this setting.
 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting, const wxColour& fore) {
     SendMsg(2084, useSetting, wxColourAsLong(fore));
@@ -1033,13 +1130,13 @@ bool wxStyledTextCtrl::GetUseHorizontalScrollBar() {
 }
 
 // Show or hide indentation guides.
 }
 
 // Show or hide indentation guides.
-void wxStyledTextCtrl::SetIndentationGuides(bool show) {
-    SendMsg(2132, show, 0);
+void wxStyledTextCtrl::SetIndentationGuides(int indentView) {
+    SendMsg(2132, indentView, 0);
 }
 
 // Are the indentation guides visible?
 }
 
 // Are the indentation guides visible?
-bool wxStyledTextCtrl::GetIndentationGuides() {
-    return SendMsg(2133, 0, 0) != 0;
+int wxStyledTextCtrl::GetIndentationGuides() {
+    return SendMsg(2133, 0, 0);
 }
 
 // Set the highlighted indentation guide column.
 }
 
 // Set the highlighted indentation guide column.
@@ -1660,6 +1757,16 @@ int wxStyledTextCtrl::GetScrollWidth() {
     return SendMsg(2275, 0, 0);
 }
 
     return SendMsg(2275, 0, 0);
 }
 
+// Sets whether the maximum width line displayed is used to set scroll width.
+void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking) {
+    SendMsg(2516, tracking, 0);
+}
+
+// Retrieve whether the scroll width tracks wide lines.
+bool wxStyledTextCtrl::GetScrollWidthTracking() {
+    return SendMsg(2517, 0, 0) != 0;
+}
+
 // Measure the pixel width of some text in a particular style.
 // NUL terminated text argument.
 // Does not handle tab or control characters.
 // Measure the pixel width of some text in a particular style.
 // NUL terminated text argument.
 // Does not handle tab or control characters.
@@ -1923,6 +2030,11 @@ void wxStyledTextCtrl::DelWordRight() {
     SendMsg(2336, 0, 0);
 }
 
     SendMsg(2336, 0, 0);
 }
 
+// Delete the word to the right of the caret, but not the trailing non-word characters.
+void wxStyledTextCtrl::DelWordRightEnd() {
+    SendMsg(2518, 0, 0);
+}
+
 // Cut the line containing the caret.
 void wxStyledTextCtrl::LineCut() {
     SendMsg(2337, 0, 0);
 // Cut the line containing the caret.
 void wxStyledTextCtrl::LineCut() {
     SendMsg(2337, 0, 0);
@@ -2297,21 +2409,43 @@ void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting, const wxColou
     SendMsg(2410, useSetting, wxColourAsLong(fore));
 }
 
     SendMsg(2410, useSetting, wxColourAsLong(fore));
 }
 
+// Get the fore colour for active hotspots.
+wxColour wxStyledTextCtrl::GetHotspotActiveForeground() {
+    long c = SendMsg(2494, 0, 0);
+    return wxColourFromLong(c);
+}
+
 // Set a back colour for active hotspots.
 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting, const wxColour& back) {
     SendMsg(2411, useSetting, wxColourAsLong(back));
 }
 
 // Set a back colour for active hotspots.
 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting, const wxColour& back) {
     SendMsg(2411, useSetting, wxColourAsLong(back));
 }
 
+// Get the back colour for active hotspots.
+wxColour wxStyledTextCtrl::GetHotspotActiveBackground() {
+    long c = SendMsg(2495, 0, 0);
+    return wxColourFromLong(c);
+}
+
 // Enable / Disable underlining active hotspots.
 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline) {
     SendMsg(2412, underline, 0);
 }
 
 // Enable / Disable underlining active hotspots.
 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline) {
     SendMsg(2412, underline, 0);
 }
 
+// Get whether underlining for active hotspots.
+bool wxStyledTextCtrl::GetHotspotActiveUnderline() {
+    return SendMsg(2496, 0, 0) != 0;
+}
+
 // Limit hotspots to single line so hotspots on two lines don't merge.
 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine) {
     SendMsg(2421, singleLine, 0);
 }
 
 // Limit hotspots to single line so hotspots on two lines don't merge.
 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine) {
     SendMsg(2421, singleLine, 0);
 }
 
+// Get the HotspotSingleLine property
+bool wxStyledTextCtrl::GetHotspotSingleLine() {
+    return SendMsg(2497, 0, 0) != 0;
+}
+
 // Move caret between paragraphs (delimited by empty lines).
 void wxStyledTextCtrl::ParaDown() {
     SendMsg(2413, 0, 0);
 // Move caret between paragraphs (delimited by empty lines).
 void wxStyledTextCtrl::ParaDown() {
     SendMsg(2413, 0, 0);
@@ -2523,6 +2657,76 @@ int wxStyledTextCtrl::GetCaretLineBackAlpha() {
     return SendMsg(2471, 0, 0);
 }
 
     return SendMsg(2471, 0, 0);
 }
 
+// Set the style of the caret to be drawn.
+void wxStyledTextCtrl::SetCaretStyle(int caretStyle) {
+    SendMsg(2512, caretStyle, 0);
+}
+
+// Returns the current style of the caret.
+int wxStyledTextCtrl::GetCaretStyle() {
+    return SendMsg(2513, 0, 0);
+}
+
+// Set the indicator used for IndicatorFillRange and IndicatorClearRange
+void wxStyledTextCtrl::SetIndicatorCurrent(int indicator) {
+    SendMsg(2500, indicator, 0);
+}
+
+// Get the current indicator
+int wxStyledTextCtrl::GetIndicatorCurrent() {
+    return SendMsg(2501, 0, 0);
+}
+
+// Set the value used for IndicatorFillRange
+void wxStyledTextCtrl::SetIndicatorValue(int value) {
+    SendMsg(2502, value, 0);
+}
+
+// Get the current indicator vaue
+int wxStyledTextCtrl::GetIndicatorValue() {
+    return SendMsg(2503, 0, 0);
+}
+
+// Turn a indicator on over a range.
+void wxStyledTextCtrl::IndicatorFillRange(int position, int fillLength) {
+    SendMsg(2504, position, fillLength);
+}
+
+// Turn a indicator off over a range.
+void wxStyledTextCtrl::IndicatorClearRange(int position, int clearLength) {
+    SendMsg(2505, position, clearLength);
+}
+
+// Are any indicators present at position?
+int wxStyledTextCtrl::IndicatorAllOnFor(int position) {
+    return SendMsg(2506, position, 0);
+}
+
+// What value does a particular indicator have at at a position?
+int wxStyledTextCtrl::IndicatorValueAt(int indicator, int position) {
+    return SendMsg(2507, indicator, position);
+}
+
+// Where does a particular indicator start?
+int wxStyledTextCtrl::IndicatorStart(int indicator, int position) {
+    return SendMsg(2508, indicator, position);
+}
+
+// Where does a particular indicator end?
+int wxStyledTextCtrl::IndicatorEnd(int indicator, int position) {
+    return SendMsg(2509, indicator, position);
+}
+
+// Set number of entries in position cache
+void wxStyledTextCtrl::SetPositionCacheSize(int size) {
+    SendMsg(2514, size, 0);
+}
+
+// How many entries are allocated to the position cache?
+int wxStyledTextCtrl::GetPositionCacheSize() {
+    return SendMsg(2515, 0, 0);
+}
+
 // Start notifying the container of all key presses and commands.
 void wxStyledTextCtrl::StartRecord() {
     SendMsg(3001, 0, 0);
 // Start notifying the container of all key presses and commands.
 void wxStyledTextCtrl::StartRecord() {
     SendMsg(3001, 0, 0);
@@ -2663,6 +2867,25 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
 }
 
 
 }
 
 
+// Get the font of a style
+wxFont wxStyledTextCtrl::StyleGetFont(int style) {
+    wxFont font;
+    font.SetPointSize(StyleGetSize(style));
+    font.SetFaceName(StyleGetFaceName(style));
+    if( StyleGetBold(style) )
+        font.SetWeight(wxFONTWEIGHT_BOLD);
+    else
+        font.SetWeight(wxFONTWEIGHT_NORMAL);
+
+    if( StyleGetItalic(style) )
+        font.SetStyle(wxFONTSTYLE_ITALIC);
+    else
+        font.SetStyle(wxFONTSTYLE_NORMAL);
+
+    return font;
+}
+
+
 // Set style size, face, bold, italic, and underline attributes from
 // a wxFont's attributes.
 void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
 // Set style size, face, bold, italic, and underline attributes from
 // a wxFont's attributes.
 void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
@@ -2677,7 +2900,7 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
     bool           italic   = font.GetStyle() != wxNORMAL;
     bool           under    = font.GetUnderlined();
     wxFontEncoding encoding = font.GetEncoding();
     bool           italic   = font.GetStyle() != wxNORMAL;
     bool           under    = font.GetUnderlined();
     wxFontEncoding encoding = font.GetEncoding();
-    
+
     StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
 }
 
     StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
 }
 
@@ -2781,7 +3004,7 @@ void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet)
         case wxSTC_CHARSET_CYRILLIC:
             encoding = wxFONTENCODING_ISO8859_5;
             break;
         case wxSTC_CHARSET_CYRILLIC:
             encoding = wxFONTENCODING_ISO8859_5;
             break;
-                
+
         case wxSTC_CHARSET_8859_15:
             encoding = wxFONTENCODING_ISO8859_15;;
             break;
         case wxSTC_CHARSET_8859_15:
             encoding = wxFONTENCODING_ISO8859_15;;
             break;
@@ -2977,7 +3200,7 @@ wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
     if (!len) {
         wxCharBuffer empty;
         return empty;
     if (!len) {
         wxCharBuffer empty;
         return empty;
-    }        
+    }
 
     wxCharBuffer buf(len);
     SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
 
     wxCharBuffer buf(len);
     SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
@@ -2995,7 +3218,7 @@ wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos)
     if (!len) {
         wxCharBuffer empty;
         return empty;
     if (!len) {
         wxCharBuffer empty;
         return empty;
-    }        
+    }
 
     wxCharBuffer buf(len);
     TextRange tr;
 
     wxCharBuffer buf(len);
     TextRange tr;
@@ -3162,7 +3385,7 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
         }
 #endif
     }
         }
 #endif
     }
-    
+
     evt.Skip();
 }
 
     evt.Skip();
 }
 
@@ -3319,7 +3542,7 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
         SetEventText(evt, scn.text, strlen(scn.text));
         evt.SetPosition(scn.lParam);
         break;
         SetEventText(evt, scn.text, strlen(scn.text));
         evt.SetPosition(scn.lParam);
         break;
-        
+
     case SCN_USERLISTSELECTION:
         evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
         evt.SetListType(scn.listType);
     case SCN_USERLISTSELECTION:
         evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
         evt.SetListType(scn.listType);
@@ -3359,7 +3582,15 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
     case SCN_CALLTIPCLICK:
         evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
         break;
     case SCN_CALLTIPCLICK:
         evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
         break;
-       
+
+    case SCN_INDICATORCLICK:
+        evt.SetEventType(wxEVT_STC_INDICATOR_CLICK);
+        break;
+
+    case SCN_INDICATORRELEASE:
+        evt.SetEventType(wxEVT_STC_INDICATOR_RELEASE);
+        break;
+
     default:
         return;
     }
     default:
         return;
     }
index b20db627fa1e1c5a8b9f26c915311a0eef8a3ae5..73a311bf8b051a8f5a1656b4224f0b7ae60b2415 100644 (file)
@@ -110,7 +110,9 @@ DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
-DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION )    
+DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION )
+DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_CLICK )
+DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_RELEASE )
 
 
 
 
 
 
@@ -301,6 +303,25 @@ void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
 }
 
 
 }
 
 
+// Get the font of a style
+wxFont wxStyledTextCtrl::StyleGetFont(int style) {
+    wxFont font;
+    font.SetPointSize(StyleGetSize(style));
+    font.SetFaceName(StyleGetFaceName(style));
+    if( StyleGetBold(style) )
+        font.SetWeight(wxFONTWEIGHT_BOLD);
+    else
+        font.SetWeight(wxFONTWEIGHT_NORMAL);
+
+    if( StyleGetItalic(style) )
+        font.SetStyle(wxFONTSTYLE_ITALIC);
+    else
+        font.SetStyle(wxFONTSTYLE_NORMAL);
+
+    return font;
+}
+
+
 // Set style size, face, bold, italic, and underline attributes from
 // a wxFont's attributes.
 void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
 // Set style size, face, bold, italic, and underline attributes from
 // a wxFont's attributes.
 void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
@@ -315,7 +336,7 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
     bool           italic   = font.GetStyle() != wxNORMAL;
     bool           under    = font.GetUnderlined();
     wxFontEncoding encoding = font.GetEncoding();
     bool           italic   = font.GetStyle() != wxNORMAL;
     bool           under    = font.GetUnderlined();
     wxFontEncoding encoding = font.GetEncoding();
-    
+
     StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
 }
 
     StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
 }
 
@@ -419,7 +440,7 @@ void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet)
         case wxSTC_CHARSET_CYRILLIC:
             encoding = wxFONTENCODING_ISO8859_5;
             break;
         case wxSTC_CHARSET_CYRILLIC:
             encoding = wxFONTENCODING_ISO8859_5;
             break;
-                
+
         case wxSTC_CHARSET_8859_15:
             encoding = wxFONTENCODING_ISO8859_15;;
             break;
         case wxSTC_CHARSET_8859_15:
             encoding = wxFONTENCODING_ISO8859_15;;
             break;
@@ -615,7 +636,7 @@ wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
     if (!len) {
         wxCharBuffer empty;
         return empty;
     if (!len) {
         wxCharBuffer empty;
         return empty;
-    }        
+    }
 
     wxCharBuffer buf(len);
     SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
 
     wxCharBuffer buf(len);
     SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
@@ -633,7 +654,7 @@ wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos)
     if (!len) {
         wxCharBuffer empty;
         return empty;
     if (!len) {
         wxCharBuffer empty;
         return empty;
-    }        
+    }
 
     wxCharBuffer buf(len);
     TextRange tr;
 
     wxCharBuffer buf(len);
     TextRange tr;
@@ -800,7 +821,7 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
         }
 #endif
     }
         }
 #endif
     }
-    
+
     evt.Skip();
 }
 
     evt.Skip();
 }
 
@@ -957,7 +978,7 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
         SetEventText(evt, scn.text, strlen(scn.text));
         evt.SetPosition(scn.lParam);
         break;
         SetEventText(evt, scn.text, strlen(scn.text));
         evt.SetPosition(scn.lParam);
         break;
-        
+
     case SCN_USERLISTSELECTION:
         evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
         evt.SetListType(scn.listType);
     case SCN_USERLISTSELECTION:
         evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
         evt.SetListType(scn.listType);
@@ -997,7 +1018,15 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
     case SCN_CALLTIPCLICK:
         evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
         break;
     case SCN_CALLTIPCLICK:
         evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
         break;
-       
+
+    case SCN_INDICATORCLICK:
+        evt.SetEventType(wxEVT_STC_INDICATOR_CLICK);
+        break;
+
+    case SCN_INDICATORRELEASE:
+        evt.SetEventType(wxEVT_STC_INDICATOR_RELEASE);
+        break;
+
     default:
         return;
     }
     default:
         return;
     }
index 5630c3229d908cd0cf8292778b1260e768fb41d4..a7de3aa2e74f7486075208b02dc45c33973badcc 100644 (file)
 #include "wx/dnd.h"
 #include "wx/stopwatch.h"
 
 #include "wx/dnd.h"
 #include "wx/stopwatch.h"
 
-class WXDLLIMPEXP_CORE wxScrollBar;
-
-#ifdef WXMAKINGDLL_STC
-    #define WXDLLIMPEXP_STC WXEXPORT
-#elif defined(WXUSINGDLL)
-    #define WXDLLIMPEXP_STC WXIMPORT
-#else // not making nor using DLL
-    #define WXDLLIMPEXP_STC
-#endif
-
+class WXDLLIMPEXP_FWD_CORE wxScrollBar;
 
 // SWIG can't handle "#if" type of conditionals, only "#ifdef"
 #ifdef SWIG
 
 // SWIG can't handle "#if" type of conditionals, only "#ifdef"
 #ifdef SWIG
@@ -78,8 +69,8 @@ struct SCNotification;
 
 #ifndef SWIG
 extern WXDLLIMPEXP_STC const wxChar* wxSTCNameStr;
 
 #ifndef SWIG
 extern WXDLLIMPEXP_STC const wxChar* wxSTCNameStr;
-class  WXDLLIMPEXP_STC wxStyledTextCtrl;
-class  WXDLLIMPEXP_STC wxStyledTextEvent;
+class  WXDLLIMPEXP_FWD_STC wxStyledTextCtrl;
+class  WXDLLIMPEXP_FWD_STC wxStyledTextEvent;
 #endif
 
 //----------------------------------------------------------------------
 #endif
 
 //----------------------------------------------------------------------
@@ -143,6 +134,9 @@ public:
     void StyleSetSpec(int styleNum, const wxString& spec);
 
 
     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.
 
     // Set style size, face, bold, italic, and underline attributes from
     // a wxFont's attributes.
@@ -451,6 +445,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_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 {
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
@@ -479,7 +475,9 @@ END_DECLARE_EVENT_TYPES()
         wxEVT_STC_HOTSPOT_CLICK,
         wxEVT_STC_HOTSPOT_DCLICK,
         wxEVT_STC_CALLTIP_CLICK,
         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
 
     };
 #endif
 
@@ -514,6 +512,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_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
 #endif
 
 #endif // wxUSE_STC