]> git.saurik.com Git - wxWidgets.git/commitdiff
Upgraded to version 1.39 of Scintilla, and upated wxStyledTextCtrl
authorRobin Dunn <robin@alldunn.com>
Sat, 1 Sep 2001 03:06:33 +0000 (03:06 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 1 Sep 2001 03:06:33 +0000 (03:06 +0000)
accordingly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

150 files changed:
contrib/include/wx/stc/stc.h
contrib/src/stc/PlatWX.cpp
contrib/src/stc/ScintillaWX.cpp
contrib/src/stc/ScintillaWX.h
contrib/src/stc/gen_iface.py
contrib/src/stc/scintilla/README.txt
contrib/src/stc/scintilla/include/Accessor.h
contrib/src/stc/scintilla/include/KeyWords.h
contrib/src/stc/scintilla/include/Platform.h
contrib/src/stc/scintilla/include/PosRegExp.h [deleted file]
contrib/src/stc/scintilla/include/PropSet.h
contrib/src/stc/scintilla/include/SString.h [new file with mode: 0644]
contrib/src/stc/scintilla/include/SciLexer.h
contrib/src/stc/scintilla/include/Scintilla.h
contrib/src/stc/scintilla/include/Scintilla.iface
contrib/src/stc/scintilla/include/ScintillaWidget.h
contrib/src/stc/scintilla/include/WinDefs.h
contrib/src/stc/scintilla/include/WindowAccessor.h
contrib/src/stc/scintilla/src/AutoComplete.cxx
contrib/src/stc/scintilla/src/AutoComplete.h
contrib/src/stc/scintilla/src/CallTip.cxx
contrib/src/stc/scintilla/src/CallTip.h
contrib/src/stc/scintilla/src/CellBuffer.cxx
contrib/src/stc/scintilla/src/CellBuffer.h
contrib/src/stc/scintilla/src/ContractionState.cxx
contrib/src/stc/scintilla/src/ContractionState.h
contrib/src/stc/scintilla/src/Document.cxx
contrib/src/stc/scintilla/src/Document.h
contrib/src/stc/scintilla/src/DocumentAccessor.cxx
contrib/src/stc/scintilla/src/DocumentAccessor.h
contrib/src/stc/scintilla/src/Editor.cxx
contrib/src/stc/scintilla/src/Editor.h
contrib/src/stc/scintilla/src/Indicator.cxx
contrib/src/stc/scintilla/src/Indicator.h
contrib/src/stc/scintilla/src/KeyMap.cxx
contrib/src/stc/scintilla/src/KeyMap.h
contrib/src/stc/scintilla/src/KeyWords.cxx
contrib/src/stc/scintilla/src/LexAVE.cxx [new file with mode: 0644]
contrib/src/stc/scintilla/src/LexAda.cxx [new file with mode: 0644]
contrib/src/stc/scintilla/src/LexCPP.cxx
contrib/src/stc/scintilla/src/LexConf.cxx [new file with mode: 0644]
contrib/src/stc/scintilla/src/LexEiffel.cxx [new file with mode: 0644]
contrib/src/stc/scintilla/src/LexHTML.cxx
contrib/src/stc/scintilla/src/LexLisp.cxx [new file with mode: 0644]
contrib/src/stc/scintilla/src/LexLua.cxx
contrib/src/stc/scintilla/src/LexOthers.cxx
contrib/src/stc/scintilla/src/LexPascal.cxx [new file with mode: 0644]
contrib/src/stc/scintilla/src/LexPerl.cxx
contrib/src/stc/scintilla/src/LexPython.cxx
contrib/src/stc/scintilla/src/LexRuby.cxx [new file with mode: 0644]
contrib/src/stc/scintilla/src/LexSQL.cxx
contrib/src/stc/scintilla/src/LexVB.cxx
contrib/src/stc/scintilla/src/LineMarker.cxx
contrib/src/stc/scintilla/src/LineMarker.h
contrib/src/stc/scintilla/src/PosRegExp.cxx [deleted file]
contrib/src/stc/scintilla/src/PropSet.cxx
contrib/src/stc/scintilla/src/RESearch.cxx [new file with mode: 0644]
contrib/src/stc/scintilla/src/RESearch.h [new file with mode: 0644]
contrib/src/stc/scintilla/src/SVector.h
contrib/src/stc/scintilla/src/ScintillaBase.cxx
contrib/src/stc/scintilla/src/ScintillaBase.h
contrib/src/stc/scintilla/src/Style.cxx
contrib/src/stc/scintilla/src/Style.h
contrib/src/stc/scintilla/src/UniConversion.cxx
contrib/src/stc/scintilla/src/UniConversion.h
contrib/src/stc/scintilla/src/ViewStyle.cxx
contrib/src/stc/scintilla/src/ViewStyle.h
contrib/src/stc/scintilla/src/WindowAccessor.cxx
contrib/src/stc/stc.cpp
contrib/src/stc/stc.cpp.in
contrib/src/stc/stc.h.in
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/PosRegExp.h [deleted file]
src/stc/scintilla/include/PropSet.h
src/stc/scintilla/include/SString.h [new file with mode: 0644]
src/stc/scintilla/include/SciLexer.h
src/stc/scintilla/include/Scintilla.h
src/stc/scintilla/include/Scintilla.iface
src/stc/scintilla/include/ScintillaWidget.h
src/stc/scintilla/include/WinDefs.h
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/ContractionState.cxx
src/stc/scintilla/src/ContractionState.h
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/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/LexAVE.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexAda.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexCPP.cxx
src/stc/scintilla/src/LexConf.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexEiffel.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexHTML.cxx
src/stc/scintilla/src/LexLisp.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexLua.cxx
src/stc/scintilla/src/LexOthers.cxx
src/stc/scintilla/src/LexPascal.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexPerl.cxx
src/stc/scintilla/src/LexPython.cxx
src/stc/scintilla/src/LexRuby.cxx [new file with mode: 0644]
src/stc/scintilla/src/LexSQL.cxx
src/stc/scintilla/src/LexVB.cxx
src/stc/scintilla/src/LineMarker.cxx
src/stc/scintilla/src/LineMarker.h
src/stc/scintilla/src/PosRegExp.cxx [deleted file]
src/stc/scintilla/src/PropSet.cxx
src/stc/scintilla/src/RESearch.cxx [new file with mode: 0644]
src/stc/scintilla/src/RESearch.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/Style.cxx
src/stc/scintilla/src/Style.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/stc.cpp
src/stc/stc.cpp.in
src/stc/stc.h.in
wxPython/CHANGES.txt
wxPython/contrib/stc/stc_.cpp
wxPython/contrib/stc/stc_.i
wxPython/contrib/stc/stc_.py
wxPython/demo/data/stc.h [deleted file]
wxPython/demo/data/stc.h.html
wxPython/demo/wxStyledTextCtrl_1.py
wxPython/demo/wxStyledTextCtrl_2.py

index f9b26bdb8ac3ca535fc29cfff40ab3956313865a..8dfe9a92f469b43ae27d631b00c5870bdb850e48 100644 (file)
 #define wxSTC_MARK_ARROWDOWN 6
 #define wxSTC_MARK_MINUS 7
 #define wxSTC_MARK_PLUS 8
+
+// Shapes used for outlining column
+#define wxSTC_MARK_VLINE 9
+#define wxSTC_MARK_LCORNER 10
+#define wxSTC_MARK_TCORNER 11
+#define wxSTC_MARK_BOXPLUS 12
+#define wxSTC_MARK_BOXPLUSCONNECTED 13
+#define wxSTC_MARK_BOXMINUS 14
+#define wxSTC_MARK_BOXMINUSCONNECTED 15
+#define wxSTC_MARK_LCORNERCURVE 16
+#define wxSTC_MARK_TCORNERCURVE 17
+#define wxSTC_MARK_CIRCLEPLUS 18
+#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19
+#define wxSTC_MARK_CIRCLEMINUS 20
+#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
+
+// Markers used for outlining column
+#define wxSTC_MARKNUM_FOLDEREND 25
+#define wxSTC_MARKNUM_FOLDEROPENMID 26
+#define wxSTC_MARKNUM_FOLDERMIDTAIL 27
+#define wxSTC_MARKNUM_FOLDERTAIL 28
+#define wxSTC_MARKNUM_FOLDERSUB 29
 #define wxSTC_MARKNUM_FOLDER 30
 #define wxSTC_MARKNUM_FOLDEROPEN 31
 #define wxSTC_MARGIN_SYMBOL 0
 #define wxSTC_CHARSET_ARABIC 178
 #define wxSTC_CHARSET_VIETNAMESE 163
 #define wxSTC_CHARSET_THAI 222
+#define wxSTC_CASE_MIXED 0
+#define wxSTC_CASE_UPPER 1
+#define wxSTC_CASE_LOWER 2
 #define wxSTC_INDIC_MAX 7
 #define wxSTC_INDIC_PLAIN 0
 #define wxSTC_INDIC_SQUIGGLE 1
 
 // PrintColourMode - force black text on white background for printing.
 #define wxSTC_PRINT_BLACKONWHITE 2
-#define wxSTC_FIND_DOWN 1
+
+// PrintColourMode - text stays coloured, but all background is forced to be white for printing.
+#define wxSTC_PRINT_COLOURONWHITE 3
+
+// PrintColourMode - only the default-background is forced to be white for printing.
+#define wxSTC_PRINT_COLOURONWHITEDEFAULTBG 4
 #define wxSTC_FIND_WHOLEWORD 2
 #define wxSTC_FIND_MATCHCASE 4
 #define wxSTC_FIND_WORDSTART 0x00100000
-
-// SCFIND_REGEXP is not yet implemented.
 #define wxSTC_FIND_REGEXP 0x00200000
 #define wxSTC_CMD_UNDO 2176
 #define wxSTC_CMD_CUT 2177
 #define wxSTC_FOLDLEVELWHITEFLAG 0x1000
 #define wxSTC_FOLDLEVELHEADERFLAG 0x2000
 #define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF
+#define wxSTC_TIME_FOREVER 10000000
 #define wxSTC_CMD_LINEDOWN 2300
 #define wxSTC_CMD_LINEDOWNEXTEND 2301
 #define wxSTC_CMD_LINEUP 2302
 #define wxSTC_EDGE_BACKGROUND 2
 
 // Show caret within N lines of edge when it's scrolled to view
+// If CARET_SLOP not set then centre caret on screen when it's
+// scrolled to view
 #define wxSTC_CARET_SLOP 0x01
 
-// Center caret on screen when it's scrolled to view
+// Value not used
 #define wxSTC_CARET_CENTER 0x02
 
-// OR this with CARET_CENTER to reposition even when visible, or
-// OR this with CARET_SLOP to reposition whenever outside slop border
+// If CARET_SLOP also set then reposition whenever outside slop border
+// If CARET_SLOP not set then recentre even when visible
 #define wxSTC_CARET_STRICT 0x04
 
+// If CARET_XEVEN set then both left and right margins are given equal weight
+// rather than favouring left following behaviour.
+#define wxSTC_CARET_XEVEN 0x08
+
+// If CARET_XJUMPS set then when caret reaches the margin the display jumps
+// enough to leave the caret solidly within the display.
+#define wxSTC_CARET_XJUMPS 0x10
+#define wxSTC_CURSORNORMAL -1
+#define wxSTC_CURSORWAIT 3
+
+// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
+#define wxSTC_VISIBLE_SLOP 0x01
+#define wxSTC_VISIBLE_STRICT 0x04
+
 // Notifications
 // Type of modification and the action which caused the modification
 // These are defined as a bit mask to make it easy to specify which notifications are wanted.
 #define wxSTC_LEX_LATEX 14
 #define wxSTC_LEX_LUA 15
 #define wxSTC_LEX_DIFF 16
+#define wxSTC_LEX_CONF 17
+#define wxSTC_LEX_PASCAL 18
+#define wxSTC_LEX_AVE 19
+#define wxSTC_LEX_ADA 20
+#define wxSTC_LEX_LISP 21
+#define wxSTC_LEX_RUBY 22
+#define wxSTC_LEX_EIFFEL 23
+#define wxSTC_LEX_EIFFELKW 24
+#define wxSTC_LEX_TCL 25
+
+// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
+// value assigned in sequence from SCLEX_AUTOMATIC+1.
+#define wxSTC_LEX_AUTOMATIC 1000
 
 // Lexical states for SCLEX_PYTHON
 #define wxSTC_P_DEFAULT 0
 #define wxSTC_C_IDENTIFIER 11
 #define wxSTC_C_STRINGEOL 12
 #define wxSTC_C_VERBATIM 13
+#define wxSTC_C_REGEX 14
+#define wxSTC_C_COMMENTLINEDOC 15
+#define wxSTC_C_WORD2 16
 
 // Lexical states for SCLEX_HTML, SCLEX_XML
 #define wxSTC_H_DEFAULT 0
 // More HTML
 #define wxSTC_H_VALUE 19
 
+// X-Code
+#define wxSTC_H_XCCOMMENT 20
+
+// SGML
+#define wxSTC_H_SGML 21
+
 // Embedded Javascript
 #define wxSTC_HJ_START 40
 #define wxSTC_HJ_DEFAULT 41
 #define wxSTC_HJ_SINGLESTRING 49
 #define wxSTC_HJ_SYMBOLS 50
 #define wxSTC_HJ_STRINGEOL 51
+#define wxSTC_HJ_REGEX 52
 
 // ASP Javascript
 #define wxSTC_HJA_START 55
 #define wxSTC_HJA_SINGLESTRING 64
 #define wxSTC_HJA_SYMBOLS 65
 #define wxSTC_HJA_STRINGEOL 66
+#define wxSTC_HJA_REGEX 67
 
 // Embedded VBScript
 #define wxSTC_HB_START 70
 #define wxSTC_HPHP_VARIABLE 123
 #define wxSTC_HPHP_COMMENT 124
 #define wxSTC_HPHP_COMMENTLINE 125
-#define wxSTC_HPHP_STRINGEOL 126
+#define wxSTC_HPHP_HSTRING_VARIABLE 126
+#define wxSTC_HPHP_OPERATOR 127
 
 // Lexical states for SCLEX_PERL
 #define wxSTC_PL_DEFAULT 0
-#define wxSTC_PL_HERE 1
+#define wxSTC_PL_ERROR 1
 #define wxSTC_PL_COMMENTLINE 2
 #define wxSTC_PL_POD 3
 #define wxSTC_PL_NUMBER 4
 #define wxSTC_PL_ARRAY 13
 #define wxSTC_PL_HASH 14
 #define wxSTC_PL_SYMBOLTABLE 15
-#define wxSTC_PL_REF 16
 #define wxSTC_PL_REGEX 17
 #define wxSTC_PL_REGSUBST 18
 #define wxSTC_PL_LONGQUOTE 19
 #define wxSTC_PL_BACKTICKS 20
 #define wxSTC_PL_DATASECTION 21
+#define wxSTC_PL_HERE_DELIM 22
+#define wxSTC_PL_HERE_Q 23
+#define wxSTC_PL_HERE_QQ 24
+#define wxSTC_PL_HERE_QX 25
+#define wxSTC_PL_STRING_Q 26
+#define wxSTC_PL_STRING_QQ 27
+#define wxSTC_PL_STRING_QX 28
+#define wxSTC_PL_STRING_QR 29
+#define wxSTC_PL_STRING_QW 30
 
 // Lexical states for SCLEX_LATEX
 #define wxSTC_L_DEFAULT 0
 #define wxSTC_LUA_OPERATOR 10
 #define wxSTC_LUA_IDENTIFIER 11
 #define wxSTC_LUA_STRINGEOL 12
+
+// Lexical states for SCLEX_ERRORLIST
 #define wxSTC_ERR_DEFAULT 0
 #define wxSTC_ERR_PYTHON 1
 #define wxSTC_ERR_GCC 2
 #define wxSTC_ERR_CMD 4
 #define wxSTC_ERR_BORLAND 5
 #define wxSTC_ERR_PERL 6
+#define wxSTC_ERR_NET 7
+#define wxSTC_ERR_LUA 8
+#define wxSTC_ERR_DIFF_CHANGED 10
+#define wxSTC_ERR_DIFF_ADDITION 11
+#define wxSTC_ERR_DIFF_DELETION 12
+#define wxSTC_ERR_DIFF_MESSAGE 13
+
+// Lexical states for SCLEX_BATCH
+#define wxSTC_BAT_DEFAULT 0
+#define wxSTC_BAT_COMMENT 1
+#define wxSTC_BAT_WORD 2
+#define wxSTC_BAT_LABEL 3
+#define wxSTC_BAT_HIDE 4
+#define wxSTC_BAT_COMMAND 5
+#define wxSTC_BAT_IDENTIFIER 6
+#define wxSTC_BAT_OPERATOR 7
+
+// Lexical states for SCLEX_MAKEFILE
+#define wxSTC_MAKE_DEFAULT 0
+#define wxSTC_MAKE_COMMENT 1
+#define wxSTC_MAKE_PREPROCESSOR 2
+#define wxSTC_MAKE_IDENTIFIER 3
+#define wxSTC_MAKE_OPERATOR 4
+#define wxSTC_MAKE_TARGET 5
+#define wxSTC_MAKE_IDEOL 9
+
+// Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+#define wxSTC_CONF_DEFAULT 0
+#define wxSTC_CONF_COMMENT 1
+#define wxSTC_CONF_NUMBER 2
+#define wxSTC_CONF_IDENTIFIER 3
+#define wxSTC_CONF_EXTENSION 4
+#define wxSTC_CONF_PARAMETER 5
+#define wxSTC_CONF_STRING 6
+#define wxSTC_CONF_OPERATOR 7
+#define wxSTC_CONF_IP 8
+#define wxSTC_CONF_DIRECTIVE 9
+
+// Avenue
+#define wxSTC_AVE_DEFAULT 0
+#define wxSTC_AVE_COMMENT 1
+#define wxSTC_AVE_NUMBER 2
+#define wxSTC_AVE_WORD 3
+#define wxSTC_AVE_KEYWORD 4
+#define wxSTC_AVE_STATEMENT 5
+#define wxSTC_AVE_STRING 6
+#define wxSTC_AVE_ENUM 7
+#define wxSTC_AVE_STRINGEOL 8
+#define wxSTC_AVE_IDENTIFIER 9
+#define wxSTC_AVE_OPERATOR 10
+
+// Lexical states for SCLEX_ADA
+#define wxSTC_ADA_DEFAULT 0
+#define wxSTC_ADA_COMMENT 1
+#define wxSTC_ADA_NUMBER 2
+#define wxSTC_ADA_WORD 3
+#define wxSTC_ADA_STRING 4
+#define wxSTC_ADA_CHARACTER 5
+#define wxSTC_ADA_OPERATOR 6
+#define wxSTC_ADA_IDENTIFIER 7
+#define wxSTC_ADA_STRINGEOL 8
+
+// Lexical states for SCLEX_LISP
+#define wxSTC_LISP_DEFAULT 0
+#define wxSTC_LISP_COMMENT 1
+#define wxSTC_LISP_NUMBER 2
+#define wxSTC_LISP_KEYWORD 3
+#define wxSTC_LISP_STRING 6
+#define wxSTC_LISP_STRINGEOL 8
+#define wxSTC_LISP_IDENTIFIER 9
+#define wxSTC_LISP_OPERATOR 10
+
+// Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+#define wxSTC_EIFFEL_DEFAULT 0
+#define wxSTC_EIFFEL_COMMENTLINE 1
+#define wxSTC_EIFFEL_NUMBER 2
+#define wxSTC_EIFFEL_WORD 3
+#define wxSTC_EIFFEL_STRING 4
+#define wxSTC_EIFFEL_CHARACTER 5
+#define wxSTC_EIFFEL_OPERATOR 6
+#define wxSTC_EIFFEL_IDENTIFIER 7
+#define wxSTC_EIFFEL_STRINGEOL 8
 
 // END of generated section
 //----------------------------------------------------------------------
@@ -556,6 +718,10 @@ public:
     // Find the position from a point within the window.
     int PositionFromPoint(wxPoint pt);
 
+    // Find the position from a point within the window but return
+    // INVALID_POSITION if not close to text.
+    int PositionFromPointClose(int x, int y);
+
     // Set caret to start of a line and ensure it is visible.
     void GotoLine(int line);
 
@@ -573,8 +739,8 @@ public:
     // Retrieve the position of the last correctly styled character.
     int GetEndStyled();
 
-    // Convert all line endings in the document to use the current mode.
-    void ConvertEOLs();
+    // Convert all line endings in the document to one mode.
+    void ConvertEOLs(int eolMode);
 
     // Retrieve the current end of line mode - one of CRLF, CR, or LF.
     int GetEOLMode();
@@ -693,6 +859,9 @@ public:
     // Set a style to be underlined or not.
     void StyleSetUnderline(int style, bool underline);
 
+    // Set a style to be mixed case, or to force upper or lower case.
+    void StyleSetCase(int style, int caseForce);
+
     // Set the foreground colour of the selection and whether to use this setting.
     void SetSelForeground(bool useSetting, const wxColour& fore);
 
@@ -763,6 +932,18 @@ public:
     // Retrieve the last line number that has line state.
     int GetMaxLineState();
 
+    // Is the background of the line containing the caret in a different colour?
+    bool GetCaretLineVisible();
+
+    // Display the background of the line containing the caret in a different colour.
+    void SetCaretLineVisible(bool show);
+
+    // Get the colour of the background of the line containing the caret.
+    wxColour GetCaretLineBack();
+
+    // Set the colour of the background of the line containing the caret.
+    void SetCaretLineBack(const wxColour& back);
+
     // Display a auto-completion list.
     // The lenEntered parameter indicates how many characters before
     // the caret should be used to provide context.
@@ -816,6 +997,15 @@ public:
     // Retrieve state of ignore case flag.
     bool AutoCompGetIgnoreCase();
 
+    // Display a list of strings and send notification when user chooses one.
+    void UserListShow(int listType, const wxString& itemList);
+
+    // Set whether or not autocompletion is hidden automatically when nothing matches
+    void AutoCompSetAutoHide(bool autoHide);
+
+    // Retrieve whether or not autocompletion is hidden automatically when nothing matches
+    bool AutoCompGetAutoHide();
+
     // Set the number of spaces used for one level of indentation.
     void SetIndent(int indentSize);
 
@@ -923,13 +1113,13 @@ public:
     int GetLineCount();
 
     // Sets the size in pixels of the left margin.
-    void SetMarginLeft(int width);
+    void SetMarginLeft(int pixelWidth);
 
     // Returns the size in pixels of the left margin.
     int GetMarginLeft();
 
     // Sets the size in pixels of the right margin.
-    void SetMarginRight(int width);
+    void SetMarginRight(int pixelWidth);
 
     // Returns the size in pixels of the right margin.
     int GetMarginRight();
@@ -1006,6 +1196,48 @@ public:
     // Returns true if overtype mode is active otherwise false is returned.
     bool GetOvertype();
 
+    // Set the width of the insert mode caret
+    void SetCaretWidth(int pixelWidth);
+
+    // Returns the width of the insert mode caret
+    int GetCaretWidth();
+
+    // Sets the position that starts the target which is used for updating the
+    // document without affecting the scroll position.
+    void SetTargetStart(int pos);
+
+    // Get the position that starts the target.
+    int GetTargetStart();
+
+    // Sets the position that ends the target which is used for updating the
+    // document without affecting the scroll position.
+    void SetTargetEnd(int pos);
+
+    // Get the position that ends the target.
+    int GetTargetEnd();
+
+    // Replace the target text with the argument text.
+    // Returns the length of the replacement text.
+    int ReplaceTarget(const wxString& text);
+
+    // Replace the target text with the argument text after \d processing.
+    // Looks for \d where d is between 1 and 9 and replaces these with the strings
+    // matched in the last search operation which were surrounded by \( and \).
+    // Returns the length of the replacement text including any change
+    // caused by processing the \d patterns.
+    int ReplaceTargetRE(const wxString& text);
+
+    // Search for a counted string in the target and set the target to the found
+    // range.
+    // Returns length of range or -1 for failure in which case target is not moved.
+    int SearchInTarget(const wxString& text);
+
+    // Set the search flags used by SearchInTarget
+    void SetSearchFlags(int flags);
+
+    // Get the search flags used by SearchInTarget
+    int GetSearchFlags();
+
     // Show a call tip containing a definition near position pos.
     void CallTipShow(int pos, const wxString& definition);
 
@@ -1068,6 +1300,31 @@ public:
     // Set some debugging options for folding
     void SetFoldFlags(int flags);
 
+    // Ensure a particular line is visible by expanding any header line hiding it.
+    // Use the currently set visibility policy to determine which range to display.
+    void EnsureVisibleEnforcePolicy(int line);
+
+    // Sets whether a tab pressed when caret is within indentation indents
+    void SetTabIndents(bool tabIndents);
+
+    // Does a tab pressed when caret is within indentation indent?
+    bool GetTabIndents();
+
+    // Sets whether a backspace pressed when caret is within indentation unindents
+    void SetBackSpaceUnIndents(bool bsUnIndents);
+
+    // Does a backspace pressed when caret is within indentation unindent?
+    bool GetBackSpaceUnIndents();
+
+    // Sets the time the mouse must sit still to generate a mouse dwell event
+    void SetMouseDwellTime(int periodMilliseconds);
+
+    // Retrieve the time the mouse must sit still to generate a mouse dwell event
+    int GetMouseDwellTime();
+
+    // Move the caret inside current view if it's not there already
+    void MoveCaretInsideView();
+
     // How many characters are on a line, not including end of line characters.
     int LineLength(int line);
 
@@ -1119,9 +1376,11 @@ public:
     void SearchAnchor();
 
     // Find some text starting at the search anchor.
+    // Does not ensure the selection is visible.
     int SearchNext(int flags, const wxString& text);
 
     // Find some text starting at the search anchor and moving backwards.
+    // Does not ensure the selection is visible.
     int SearchPrev(int flags, const wxString& text);
 
     // Set the way the line the caret is on is kept visible.
@@ -1157,6 +1416,51 @@ public:
     // Get which document modification events are sent to the container.
     int GetModEventMask();
 
+    // Change internal focus flag
+    void SetFocus(bool focus);
+
+    // Get internal focus flag
+    bool GetFocus();
+
+    // Change error status - 0 = OK
+    void SetStatus(int statusCode);
+
+    // Get error status
+    int GetStatus();
+
+    // Set whether the mouse is captured when its button is pressed
+    void SetMouseDownCaptures(bool captures);
+
+    // Get whether mouse gets captured
+    bool GetMouseDownCaptures();
+
+    // Sets the cursor to one of the SC_CURSOR* values
+    void SetCursor(int cursorType);
+
+    // Get cursor type
+    int GetCursor();
+
+    // Move to the previous change in capitalistion
+    void WordPartLeft();
+
+    // Move to the previous change in capitalistion extending selection to new caret position.
+    void WordPartLeftExtend();
+
+    // Move to the change next in capitalistion
+    void WordPartRight();
+
+    // Move to the next change in capitalistion extending selection to new caret position.
+    void WordPartRightExtend();
+
+    // Set the way the display area is determined when a particular line is to be moved to.
+    void SetVisiblePolicy(int visiblePolicy, int visibleSlop);
+
+    // Delete back from the current position to the start of the line
+    void DelLineLeft();
+
+    // Delete forwards from the current position to the end of the line
+    void DelLineRight();
+
     // Start notifying the container of all key presses and commands.
     void StartRecord();
 
@@ -1178,6 +1482,9 @@ public:
     // Set up the key words used by the lexer.
     void SetKeyWords(int keywordSet, const wxString& keyWords);
 
+    // Set the lexing language of the document based on string name.
+    void SetLexerLanguage(const wxString& language);
+
 // END of generated section
 //----------------------------------------------------------------------
 // Others...
@@ -1243,6 +1550,10 @@ public:
     // Scroll enough to make the given column visible
     void ScrollToColumn(int column);
 
+
+    // Send a message to Scintilla
+    long SendMsg(int msg, long wp=0, long lp=0);
+
 //----------------------------------------------------------------------
 
 
@@ -1255,7 +1566,7 @@ private:
     void OnMouseLeftDown(wxMouseEvent& evt);
     void OnMouseMove(wxMouseEvent& evt);
     void OnMouseLeftUp(wxMouseEvent& evt);
-    void OnMouseRightUp(wxMouseEvent& evt);
+    void OnContextMenu(wxContextMenuEvent& evt);
     void OnMouseWheel(wxMouseEvent& evt);
     void OnChar(wxKeyEvent& evt);
     void OnKeyDown(wxKeyEvent& evt);
@@ -1271,8 +1582,6 @@ private:
     void NotifyChange();
     void NotifyParent(SCNotification* scn);
 
-    long SendMsg(int msg, long wp=0, long lp=0);
-
 private:
     DECLARE_EVENT_TABLE()
     DECLARE_CLASS(wxStyledTextCtrl)
@@ -1307,6 +1616,9 @@ public:
     void SetMessage(int val)         { m_message = val; }
     void SetWParam(int val)          { m_wParam = val; }
     void SetLParam(int val)          { m_lParam = val; }
+    void SetListType(int val)        { m_listType = val; }
+    void SetX(int val)               { m_x = val; }
+    void SetY(int val)               { m_y = val; }
 
     int  GetPosition() const         { return m_position; }
     int  GetKey()  const             { return m_key; }
@@ -1322,6 +1634,9 @@ public:
     int  GetMessage() const          { return m_message; }
     int  GetWParam() const           { return m_wParam; }
     int  GetLParam() const           { return m_lParam; }
+    int  GetListType() const         { return m_listType; }
+    int  GetX() const                { return m_x; }
+    int  GetY() const                { return m_y; }
 
     bool GetShift() const;
     bool GetControl() const;
@@ -1350,42 +1665,56 @@ private:
     int  m_message;             // wxEVT_STC_MACRORECORD
     int  m_wParam;
     int  m_lParam;
+
+    int m_listType;
+    int m_x;
+    int m_y;
 #endif
 };
 
 #ifndef SWIG
 BEGIN_DECLARE_EVENT_TYPES()
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED, 1651)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED, 1652)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI, 1653)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED, 1654)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT, 1655)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT, 1656)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK, 1657)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED, 1658)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY, 1659)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD, 1660)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK, 1661)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN, 1662)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED, 1663)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE,                  1650)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED,             1651)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED,               1652)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED,        1653)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT,           1654)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT,         1655)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY,                     1656)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK,             1657)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI,                1658)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED,                1659)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD,             1660)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK,             1661)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN,               1662)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED,              1663)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_PAINTED,                 1664)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_USERLISTSELECTION,       1665)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED,              1666)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART,              1667)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND,                1668)
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
         wxEVT_STC_CHANGE,
         wxEVT_STC_STYLENEEDED,
         wxEVT_STC_CHARADDED,
-        wxEVT_STC_UPDATEUI,
         wxEVT_STC_SAVEPOINTREACHED,
         wxEVT_STC_SAVEPOINTLEFT,
         wxEVT_STC_ROMODIFYATTEMPT,
+        wxEVT_STC_KEY,
         wxEVT_STC_DOUBLECLICK,
+        wxEVT_STC_UPDATEUI,
         wxEVT_STC_MODIFIED,
-        wxEVT_STC_KEY,
         wxEVT_STC_MACRORECORD,
         wxEVT_STC_MARGINCLICK,
         wxEVT_STC_NEEDSHOWN,
-        wxEVT_STC_POSCHANGED
+        wxEVT_STC_POSCHANGED,
+        wxEVT_STC_PAINTED,
+        wxEVT_STC_USERLISTSELECTION,
+        wxEVT_STC_URIDROPPED,
+        wxEVT_STC_DWELLSTART,
+        wxEVT_STC_DWELLEND,
     };
 #endif
 
@@ -1394,20 +1723,26 @@ END_DECLARE_EVENT_TYPES()
 #ifndef SWIG
 typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 
-#define EVT_STC_CHANGE(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_STYLENEEDED(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_CHARADDED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_UPDATEUI(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_SAVEPOINTLEFT(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_ROMODIFYATTEMPT(id, fn)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_DOUBLECLICK(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MODIFIED(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_KEY(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MACRORECORD(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MARGINCLICK(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_NEEDSHOWN(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_POSCHANGED(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_CHANGE(id, fn)                  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE,                id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_STYLENEEDED(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_CHARADDED(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTREACHED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED,      id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTLEFT(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT,         id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ROMODIFYATTEMPT(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT,       id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_KEY(id, fn)                     DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY,                   id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DOUBLECLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_UPDATEUI(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MODIFIED(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MACRORECORD(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MARGINCLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_NEEDSHOWN(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_POSCHANGED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_PAINTED(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED,               id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_USERLISTSELECTION(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION,     id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_URIDROPPED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DWELLSTART(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DWELLEND(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+
 
 #endif
 
index 2b478141af6e6ddc62f8e84c00752f15b7665240..862d16456d3fe6e6c3e71267cf1326033f267aa3 100644 (file)
@@ -112,6 +112,8 @@ Font::~Font() {
 }
 
 void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) {
+    // TODO:  what to do about the characterSet?
+
     Release();
     id = new wxFont(size,
                     wxDEFAULT,
@@ -161,13 +163,11 @@ void Surface::Init() {
     Release();
     hdc = new wxMemoryDC();
     hdcOwned = true;
-    // **** ::SetTextAlign(hdc, TA_BASELINE);
 }
 
 void Surface::Init(SurfaceID hdc_) {
     Release();
     hdc = hdc_;
-    // **** ::SetTextAlign(hdc, TA_BASELINE);
 }
 
 void Surface::InitPixMap(int width, int height, Surface *surface_) {
@@ -176,7 +176,6 @@ void Surface::InitPixMap(int width, int height, Surface *surface_) {
     hdcOwned = true;
     bitmap = new wxBitmap(width, height);
     ((wxMemoryDC*)hdc)->SelectObject(*bitmap);
-    // **** ::SetTextAlign(hdc, TA_BASELINE);
 }
 
 void Surface::PenColour(Colour fore) {
@@ -353,7 +352,7 @@ int Surface::AverageCharWidth(Font &font) {
 }
 
 int Surface::SetPalette(Palette *pal, bool inBackGround) {
-    return 0;  // **** figure out what to do with palettes...
+    return 0;
 }
 
 void Surface::SetClip(PRectangle rc) {
@@ -697,6 +696,36 @@ void Platform::DebugPrintf(const char *format, ...) {
 #endif
 }
 
+
+static bool assertionPopUps = true;
+
+bool Platform::ShowAssertionPopUps(bool assertionPopUps_) {
+       bool ret = assertionPopUps;
+       assertionPopUps = assertionPopUps_;
+       return ret;
+}
+
+void Platform::Assert(const char *c, const char *file, int line) {
+       char buffer[2000];
+       sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line);
+       if (assertionPopUps) {
+               int idButton = wxMessageBox(buffer, "Assertion failure",
+                                            wxICON_HAND | wxOK);
+//             if (idButton == IDRETRY) {
+//                     ::DebugBreak();
+//             } else if (idButton == IDIGNORE) {
+//                     // all OK
+//             } else {
+//                     abort();
+//             }
+       } else {
+               strcat(buffer, "\r\n");
+               Platform::DebugDisplay(buffer);
+               abort();
+       }
+}
+
+
 int Platform::Clamp(int val, int minVal, int maxVal) {
     if (val > maxVal)
         val = maxVal;
index 30a896b9038e23101c679210c62bbc41d09b5269..127c172a909523365d4a076007c35b78ab1b381c 100644 (file)
@@ -93,7 +93,6 @@ END_EVENT_TABLE()
 ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
     capturedMouse = false;
     wMain = win;
-    wDraw = win;
     stc   = win;
     wheelRotation = 0;
     Initialise();
@@ -170,8 +169,8 @@ bool ScintillaWX::HaveMouseCapture() {
 
 void ScintillaWX::ScrollText(int linesToMove) {
     int dy = vs.lineHeight * (linesToMove);
-    // TODO: calculate the rectangle to refreshed...
     wMain.GetID()->ScrollWindow(0, dy);
+    wMain.GetID()->Update();
 }
 
 void ScintillaWX::SetVerticalScrollPos() {
@@ -261,7 +260,7 @@ bool ScintillaWX::CanPaste() {
 }
 
 void ScintillaWX::CreateCallTipWindow(PRectangle) {
-    ct.wCallTip = new wxSTCCallTip(wDraw.GetID(), -1, &ct);
+    ct.wCallTip = new wxSTCCallTip(wMain.GetID(), -1, &ct);
     ct.wDraw = ct.wCallTip;
 }
 
@@ -365,17 +364,27 @@ void ScintillaWX::DoVScroll(int type, int pos) {
 }
 
 
-void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction) {
+void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown) {
     int topLineNew = topLine;
     int lines;
 
-    wheelRotation += rotation;
-    lines = wheelRotation / delta;
-    wheelRotation -= lines * delta;
-    if (lines != 0) {
-        lines *= linesPerAction;
-        topLineNew -= lines;
-        ScrollTo(topLineNew);
+    if (ctrlDown) {  // Zoom the fonts if Ctrl key down
+        if (rotation < 0) {
+            KeyCommand(SCI_ZOOMIN);
+        }
+        else {
+            KeyCommand(SCI_ZOOMOUT);
+        }
+    }
+    else { // otherwise just scroll the window
+        wheelRotation += rotation;
+        lines = wheelRotation / delta;
+        wheelRotation -= lines * delta;
+        if (lines != 0) {
+            lines *= linesPerAction;
+            topLineNew -= lines;
+            ScrollTo(topLineNew);
+        }
     }
 }
 
@@ -387,11 +396,11 @@ void ScintillaWX::DoSize(int width, int height) {
 }
 
 void ScintillaWX::DoLoseFocus(){
-    DropCaret();
+    SetFocusState(false);
 }
 
 void ScintillaWX::DoGainFocus(){
-    ShowCaretAtCurrentPosition();
+    SetFocusState(true);
 }
 
 void ScintillaWX::DoSysColourChange() {
@@ -418,7 +427,7 @@ void ScintillaWX::DoAddChar(char ch) {
     //    AutoCompleteChanged(ch);
 }
 
-int  ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) {
+int  ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) {
     switch (key) {
         case WXK_DOWN: key = SCK_DOWN; break;
         case WXK_UP: key = SCK_UP; break;
@@ -442,7 +451,7 @@ int  ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) {
         case WXK_SHIFT: key = 0; break;
     }
 
-    return KeyDown(key, shift, ctrl, alt);
+    return KeyDown(key, shift, ctrl, alt, consumed);
 }
 
 
index fdd4f98dbdf3e8d6e882fcc208c75d22ed06436c..00528bcd0a4e3d03577760c5b29e7c4d1eb212c0 100644 (file)
@@ -119,9 +119,9 @@ public:
     void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
     void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
     void DoButtonMove(Point pt);
-    void DoMouseWheel(int rotation, int delta, int linesPerAction);
+    void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown);
     void DoAddChar(char ch);
-    int  DoKeyDown(int key, bool shift, bool ctrl, bool alt);
+    int  DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
     void DoTick() { Tick(); }
 
     bool DoDropText(long x, long y, const wxString& data);
index eba0f3c586333492ff94dbbb753f602f8d47db2f..e198bdc6e0af7d48d44406324283e45e2d8d45bd 100644 (file)
 #----------------------------------------------------------------------------
 
 
-import sys, string, re
+import sys, string, re, os
 from fileinput import FileInput
 
 
-IFACE         = './scintilla/include/Scintilla.iface'
-H_TEMPLATE    = './stc.h.in'
-CPP_TEMPLATE  = './stc.cpp.in'
-H_DEST        = '../../include/wx/stc/stc.h'
-CPP_DEST      = './stc.cpp'
+IFACE         = os.path.abspath('./scintilla/include/Scintilla.iface')
+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')
 
 
 # Value prefixes to convert
@@ -215,6 +215,9 @@ methodOverrideMap = {
     'AutoCGetChooseSingle' : ('AutoCompGetChooseSingle', 0, 0, 0),
     'AutoCSetIgnoreCase' : ('AutoCompSetIgnoreCase', 0, 0, 0),
     'AutoCGetIgnoreCase' : ('AutoCompGetIgnoreCase', 0, 0, 0),
+    'AutoCSetAutoHide' : ('AutoCompSetAutoHide', 0, 0, 0),
+    'AutoCGetAutoHide' : ('AutoCompGetAutoHide', 0, 0, 0),
+
 
     'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0, 0),
     'GetHScrollBar' : ('GetUseHorizontalScrollBar', 0, 0, 0),
@@ -360,6 +363,38 @@ methodOverrideMap = {
     'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
 
 
+    'ReplaceTarget' : (0,
+                       'int %s(const wxString& text);',
+
+                       '''
+                       int %s(const wxString& text) {
+                           return SendMsg(%s, text.Len(), (long)text.c_str());
+                       ''',
+
+                       0),
+
+    'ReplaceTargetRE' : (0,
+                       'int %s(const wxString& text);',
+
+                       '''
+                       int %s(const wxString& text) {
+                           return SendMsg(%s, text.Len(), (long)text.c_str());
+                       ''',
+
+                       0),
+
+    'SearchInTarget' : (0,
+                       'int %s(const wxString& text);',
+
+                       '''
+                       int %s(const wxString& text) {
+                           return SendMsg(%s, text.Len(), (long)text.c_str());
+                       ''',
+
+                       0),
+
+
+
     # Remove all methods that are key commands since they can be
     # executed with CmdKeyExecute
     'LineDown' : (None, 0, 0, 0),
@@ -417,7 +452,7 @@ methodOverrideMap = {
     'SetDocPointer' : (0,
                        'void %s(void* docPointer);',
                        '''void %s(void* docPointer) {
-                           SendMsg(%s, (long)docPointer);''',
+                           SendMsg(%s, 0, (long)docPointer);''',
                        0),
 
     'CreateDocument' : (0,
@@ -685,4 +720,3 @@ if __name__ == '__main__':
 
 #----------------------------------------------------------------------------
 
-
index b88d57495ce6e4123d5a8eba5f9ff935a1d743d3..598da70f58b7750830d6a3857bfd8e80903418f9 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.
 
-The current version of the Scintilla code is 1.32
+The current version of the Scintilla code is 1.39
 
index b4b7e62ecf2d8573d18b9d4b8b9c18bbb3df3234..17c951067221fa0b246dab36e7ee9194da39d462 100644 (file)
@@ -1,6 +1,8 @@
-// SciTE - Scintilla based Text Editor
-// Accessor.h - rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file Accessor.h
+ ** Rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
@@ -9,12 +11,16 @@ class Accessor;
 
 typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
 
-// Interface to data in a Scintilla
+/**
+ * Interface to data in a Scintilla.
+ */
 class Accessor {
 protected:
        enum {extremePosition=0x7FFFFFFF};
-       // bufferSize is a trade off between time taken to copy the characters and retrieval overhead
-       // slopSize positions the buffer before the desired position in case there is some backtracking
+       /** @a bufferSize is a trade off between time taken to copy the characters
+        * and retrieval overhead.
+        * @a slopSize positions the buffer before the desired position
+        * in case there is some backtracking. */
        enum {bufferSize=4000, slopSize=bufferSize/8};
        char buf[bufferSize+1];
        int startPos;
@@ -23,6 +29,7 @@ protected:
 
        virtual bool InternalIsLeadByte(char ch)=0;
        virtual void Fill(int position)=0;
+
 public:
        Accessor() : startPos(extremePosition), endPos(0), codePage(0) {}
        virtual ~Accessor() {}
@@ -32,8 +39,8 @@ public:
                }
                return buf[position - startPos];
        }
+       /** Safe version of operator[], returning a defined value for invalid position. */
        char SafeGetCharAt(int position, char chDefault=' ') {
-               // Safe version of operator[], returning a defined value for invalid position 
                if (position < startPos || position >= endPos) {
                        Fill(position);
                        if (position < startPos || position >= endPos) {
@@ -57,6 +64,7 @@ public:
        virtual int GetLineState(int line)=0;
        virtual int SetLineState(int line, int state)=0;
        virtual int GetPropertyInt(const char *key, int defaultValue=0)=0;
+       virtual char *GetProperties()=0;
 
        // Style setting
        virtual void StartAt(unsigned int start, char chMask=31)=0;
@@ -67,4 +75,3 @@ public:
        virtual void SetLevel(int line, int level)=0;
        virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0;
 };
-
index 3159dcc1b43762085db9af17de6086d3c35d4be7..869b59d2674a4a3226885fb1738d6e683407ef64 100644 (file)
@@ -1,32 +1,59 @@
-// SciTE - Scintilla based Text Editor
-// KeyWords.h - colourise for particular languages
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file KeyWords.h
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
                   WordList *keywordlists[], Accessor &styler);
                   
+/**
+ * A LexerModule is responsible for lexing and folding a particular language.
+ * The class maintains a list of LexerModules which can be searched to find a
+ * module appropriate to a particular language.
+ */
 class LexerModule {
-       static LexerModule *base;
+protected:
        LexerModule *next;
        int language;
-       LexerFunction fn;
+       const char *languageName;
+       LexerFunction fnLexer;
+       LexerFunction fnFolder;
+       
+       static LexerModule *base;
+       static int nextLanguage;
+
 public:
-       LexerModule(int language_, LexerFunction fn_);
-       static void Colourise(unsigned int startPos, int lengthDoc, int initStyle,
-                  int language, WordList *keywordlists[], Accessor &styler);
+       LexerModule(int language_, LexerFunction fnLexer_, 
+               const char *languageName_=0, LexerFunction fnFolder_=0);
+       int GetLanguage() { return language; }
+       virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
+                  WordList *keywordlists[], Accessor &styler);
+       virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
+                  WordList *keywordlists[], Accessor &styler);
+       static LexerModule *Find(int language);
+       static LexerModule *Find(const char *languageName);
 };
 
+/**
+ * Check if a character is a space.
+ * This is ASCII specific but is safe with chars >= 0x80.
+ */
+inline bool isspacechar(unsigned char ch) {
+    return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
+
 inline bool iswordchar(char ch) {
-       return isalnum(ch) || ch == '.' || ch == '_';
+       return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_');
 }
 
 inline bool iswordstart(char ch) {
-       return isalnum(ch) || ch == '_';
+       return isascii(ch) && (isalnum(ch) || ch == '_');
 }
 
 inline bool isoperator(char ch) {
-       if (isalnum(ch))
+       if (isascii(ch) && isalnum(ch))
                return false;
        // '.' left out as it is used to make up numbers
        if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
@@ -38,4 +65,3 @@ inline bool isoperator(char ch) {
                return true;
        return false;
 }
-
index de9cf202a131ada7b386c9cc3713c76fdd368906..74de63174ff41ec539df764f3bd771c9554e9e23 100644 (file)
@@ -1,18 +1,21 @@
 // Scintilla source code edit control
-// 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 wxWindows
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @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 wxWindows.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef PLATFORM_H
 #define PLATFORM_H
 
-// PLAT_GTK = GTK+ on Linux, 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 wxWindows on any supported platform
-// Could also have PLAT_GTKWIN = GTK+ on Win32 OS in future
 
 #define PLAT_GTK 0
+#define PLAT_GTK_WIN32 0
 #define PLAT_WIN 0
 #define PLAT_WX  0
 
 #undef PLAT_GTK
 #define PLAT_GTK 1
 
+#ifdef _MSC_VER
+#undef PLAT_GTK_WIN32
+#define PLAT_GTK_WIN32 1
+#endif
+
 #else
 #undef PLAT_WIN
 #define PLAT_WIN 1
@@ -34,6 +42,9 @@
 // Include the main header for each platform
 
 #if PLAT_GTK
+#ifdef _MSC_VER
+#pragma warning(disable: 4505 4514 4710 4800)
+#endif
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #endif
@@ -42,7 +53,7 @@
 #define _WIN32_WINNT  0x0400 // Otherwise some required stuff gets ifdef'd out
 // Vassili Bourdo: shut up annoying Visual C++ warnings:
 #ifdef _MSC_VER
-#pragma warning(disable: 4800 4244 4309)
+#pragma warning(disable: 4244 4309 4710 4800)
 #endif
 #include <windows.h>
 #include <commctrl.h>
@@ -80,23 +91,28 @@ typedef wxWindow* WindowID;
 typedef wxMenu* MenuID;
 #endif
 
-// Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably
-
+/**
+ * A geometric point class.
+ * Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably.
+ */
 class Point {
 public:
        int x;
        int y;
-       
+
        Point(int x_=0, int y_=0) : x(x_), y(y_) {
        }
 
        // Other automatically defined methods (assignment, copy constructor, destructor) are fine
-       
+
        static Point FromLong(long lpoint);
 };
 
-// PRectangle is exactly the same as the Win32 RECT so can be used interchangeably
-// PRectangles contain their top and left sides, but not their right and bottom sides
+/**
+ * A geometric rectangle class.
+ * PRectangle is exactly the same as the Win32 RECT so can be used interchangeably.
+ * PRectangles contain their top and left sides, but not their right and bottom sides.
+ */
 class PRectangle {
 public:
        int left;
@@ -110,6 +126,10 @@ public:
 
        // Other automatically defined methods (assignment, copy constructor, destructor) are fine
 
+       bool operator==(PRectangle &rc) {
+               return (rc.left == left) && (rc.right == right) &&
+                       (rc.top == top) && (rc.bottom == bottom);
+       }
        bool Contains(Point pt) {
                return (pt.x >= left) && (pt.x <= right) &&
                        (pt.y >= top) && (pt.y <= bottom);
@@ -131,6 +151,9 @@ wxRect wxRectFromPRectangle(PRectangle prc);
 PRectangle PRectangleFromwxRect(wxRect rc);
 #endif
 
+/**
+ * A colour class.
+ */
 class Colour {
        ColourID co;
 public:
@@ -141,15 +164,17 @@ public:
        unsigned int GetRed();
        unsigned int GetGreen();
        unsigned int GetBlue();
-       
+
        friend class Surface;
        friend class Palette;
 };
 
-// Colour pairs hold a desired colour and the colour that the graphics engine
-// allocates to approximate the desired colour.
-// To make palette management more automatic, ColourPairs could register at 
-// construction time with a palette management object.
+/**
+ * Colour pairs hold a desired colour and the colour that the graphics engine
+ * allocates to approximate the desired colour.
+ * To make palette management more automatic, ColourPairs could register at
+ * construction time with a palette management object.
+ */
 struct ColourPair {
        Colour desired;
        Colour allocated;
@@ -162,6 +187,9 @@ struct ColourPair {
 
 class Window;  // Forward declaration for Palette
 
+/**
+ * Colour palette management.
+ */
 class Palette {
        int used;
        enum {numEntries = 100};
@@ -176,22 +204,27 @@ class Palette {
 #endif
 public:
        bool allowRealization;
-       
+
        Palette();
        ~Palette();
 
        void Release();
-       
-       // This method either adds a colour to the list of wanted colours (want==true)
-       // or retrieves the allocated colour back to the ColourPair.
-       // This is one method to make it easier to keep the code for wanting and retrieving in sync.
+
+       /**
+        * This method either adds a colour to the list of wanted colours (want==true)
+        * or retrieves the allocated colour back to the ColourPair.
+        * This is one method to make it easier to keep the code for wanting and retrieving in sync.
+        */
        void WantFind(ColourPair &cp, bool want);
 
        void Allocate(Window &w);
-       
+
        friend class Surface;
 };
 
+/**
+ * Font management.
+ */
 class Font {
 protected:
        FontID id;
@@ -214,7 +247,9 @@ public:
        friend class Surface;
 };
 
-// A surface abstracts a place to draw
+/**
+ * A surface abstracts a place to draw.
+ */
 class Surface {
 private:
        bool unicodeMode;
@@ -256,7 +291,7 @@ private:
 public:
        Surface();
        ~Surface();
-       
+
        void Init();
        void Init(SurfaceID hdc_);
        void InitPixMap(int width, int height, Surface *surface_);
@@ -287,7 +322,7 @@ public:
        int ExternalLeading(Font &font_);
        int Height(Font &font_);
        int AverageCharWidth(Font &font_);
-       
+
        int SetPalette(Palette *pal, bool inBackGround);
        void SetClip(PRectangle rc);
        void FlushCachedState();
@@ -297,8 +332,10 @@ public:
        }
 };
 
-// Class to hide the details of window manipulation
-// Does not own the window which will normally have a longer life than this object
+/**
+ * Class to hide the details of window manipulation.
+ * Does not own the window which will normally have a longer life than this object.
+ */
 class Window {
        friend class ListBox;
 protected:
@@ -333,6 +370,9 @@ public:
 #endif
 };
 
+/**
+ * Listbox management.
+ */
 class ListBox : public Window {
 #if PLAT_GTK
        WindowID list;
@@ -360,6 +400,9 @@ public:
        void Sort();
 };
 
+/**
+ * Menu management.
+ */
 class Menu {
        MenuID id;
 public:
@@ -370,8 +413,10 @@ public:
        void Show(Point pt, Window &w);
 };
 
-// Platform class used to retrieve system wide parameters such as double click speed
-// and chrome colour. Not a creatable object, more of a module with several functions.
+/**
+ * Platform class used to retrieve system wide parameters such as double click speed
+ * and chrome colour. Not a creatable object, more of a module with several functions.
+ */
 class Platform {
        // Private so Platform objects can not be copied
        Platform(const Platform &) {}
@@ -390,7 +435,7 @@ public:
        static bool IsKeyDown(int key);
        static long SendScintilla(
                WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
-       
+
        // These are utility functions not really tied to a platform
        static int Minimum(int a, int b);
        static int Maximum(int a, int b);
@@ -405,7 +450,15 @@ public:
                return static_cast<short>(x & 0xffff);
        }
        static void DebugPrintf(const char *format, ...);
+       static bool ShowAssertionPopUps(bool assertionPopUps_);
+       static void Assert(const char *c, const char *file, int line);
        static int Clamp(int val, int minVal, int maxVal);
 };
 
+#ifdef  NDEBUG
+#define PLATFORM_ASSERT(c) ((void)0)
+#else
+#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__))
+#endif
+
 #endif
diff --git a/contrib/src/stc/scintilla/include/PosRegExp.h b/contrib/src/stc/scintilla/include/PosRegExp.h
deleted file mode 100644 (file)
index b915b1e..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifndef POSREGEXP_H
-#define POSREGEXP_H
-
-#define MatchesNum 0x10
-
-enum EOps
-{
-  ReBlockOps = 0x1000,
-  ReMul,              // *
-  RePlus,             // +
-  ReQuest,            // ?
-  ReNGMul,            // *?
-  ReNGPlus,           // +?
-  ReNGQuest,          // ??
-  ReRangeN,           // {n,}
-  ReRangeNM,          // {n,m}
-  ReNGRangeN,         // {n,}?
-  ReNGRangeNM,        // {n,m}?
-  ReOr,               // |
-  ReBehind  = 0x1100, // ?#n
-  ReNBehind = 0x1200, // ?~n
-  ReAhead   = 0x1300, // ?=
-  ReNAhead  = 0x1400, // ?!
-
-  ReSymbolOps = 0x2000,
-  ReEmpty,
-  ReSymb,             // a b \W \s ...
-  ReEnum,             // []
-  ReNEnum,            // [^]
-  ReBrackets,         // (...)
-  ReBkTrace = 0x2100, // \yN
-  ReBkBrack = 0x2200 // \N
-};
-
-enum ESymbols
-{
-  ReAnyChr = 0x4000,  // .
-  ReSoL,              // ^
-  ReEoL,              // $
-  ReDigit,            // \d
-  ReNDigit,           // \D
-  ReWordSymb,         // \w
-  ReNWordSymb,        // \W
-  ReWSpace,           // \s
-  ReNWSpace,          // \S
-  ReUCase,            // \u
-  ReNUCase ,          // \l
-  ReWBound,           // \b
-  ReNWBound,          // \B
-  RePreNW,            // \c
-  ReStart,            // \m
-  ReEnd,              // \M
-
-  ReChr    = 0x0      // Char in Lower Byte
-};
-enum ETempSymb
-{
-  ReTemp = 0x7000,
-  ReLBrack, ReRBrack,
-  ReEnumS, ReEnumE, ReNEnumS,
-  ReRangeS, ReRangeE, ReNGRangeE, ReFrToEnum
-};
-
-#define BackSlash '\\'
-
-typedef union SCharData
-{
-  int  IArr[8];
-  char CArr[32];
-  void SetBit(unsigned char Bit);
-  void ClearBit(unsigned char Bit);
-  bool GetBit(unsigned char Bit);
-} *PCharData;
-
-typedef struct SRegInfo
-{
-  SRegInfo();
-  ~SRegInfo();
-
-  EOps   Op;
-  union{
-    SRegInfo *Param;
-    int Symb;
-    PCharData ChrClass;
-  }un;
-  int s,e;
-  SRegInfo *Parent;
-  SRegInfo *Next;
-} *PRegInfo;
-
-typedef struct SMatches
-{
-  int s[MatchesNum];
-  int e[MatchesNum];
-  int CurMatch;
-} *PMatches;
-
-typedef class PosRegExp
-{
-  PRegInfo Info;
-  PMatches BkTrace;
-  bool NoCase,Extend,NoMoves;
-  bool Error;
-  int  *Exprn;
-  int  posParse;
-  int  posEnd,posStart;
-  int  posBkStr;
-  int  FirstChar;
-
-  bool SetExprLow(const char *Expr);
-  bool SetStructs(PRegInfo &Info,int st,int end);
-  void Optimize();
-  bool CheckSymb(int Symb,bool Inc);
-  bool LowParse(PRegInfo Re);
-  bool LowParseRe(PRegInfo &Next);
-  bool LowCheckNext(PRegInfo Re);
-  bool ParseRe(int posStr);
-  bool QuickCheck();
-public:
-  PMatches Matches;
-  int Ok, CurMatch;
-
-  void *param;
-  char (*CharAt)(int pos, void *param);
-
-  PosRegExp();
-  ~PosRegExp();
-
-  bool isok();
-  bool SetNoMoves(bool Moves);
-  bool SetBkTrace(int posStr,PMatches Trace);
-  bool SetExpr(const char *Expr);
-  bool Parse(int posStr, int posStop, PMatches Mtch);
-  bool Parse(int posStr,int posSol, int posEol, PMatches Mtch, int Moves = -1);
-  bool Evaluate(char *Expr, int posStr, PMatches Mtch, char **Res);
-} *PPosRegExp;
-
-#endif /* POSREGEXP_H */
index 025174f8abda8ff5b0851d61a97d1d9dc0e4bc3f..6f6bf410f14b87a4519cd8fa63bc6d1815cd5dc0 100644 (file)
-// SciTE - Scintilla based Text Editor
-// PropSet.h - a java style properties file module
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file PropSet.h
+ ** A Java style properties file module.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef PROPSET_H
 #define PROPSET_H
+#include "SString.h"
 
 bool EqualCaseInsensitive(const char *a, const char *b);
 
-#if PLAT_WIN
-#define strcasecmp  stricmp
-#define strncasecmp strnicmp
-#endif
-
-#ifdef __WXMSW__
-#define strcasecmp  stricmp
-#define strncasecmp strnicmp
-#endif
-
-// Define another string class.
-// While it would be 'better' to use std::string, that doubles the executable size.
-
-inline char *StringDup(const char *s, int len=-1) {
-       if (!s)
-               return 0;
-       if (len == -1)
-               len = strlen(s);
-       char *sNew = new char[len + 1];
-       if (sNew) {
-               strncpy(sNew, s, len);
-               sNew[len] = '\0';
-       }
-       return sNew;
-}
-
-class SString {
-       char *s;
-       int ssize;
-public:
-       typedef const char* const_iterator;
-       typedef int size_type;
-       static size_type npos;
-       const char* begin(void) const {
-               return s;
-       }
-       const char* end(void) const {
-               return &s[ssize];
-       }
-       size_type size(void) const {
-               if (s)
-                       return ssize;
-               else
-                       return 0;
-       }
-       SString &assign(const char* sother, int size_ = -1) {
-               char *t = s;
-               s = StringDup(sother,size_);
-               ssize = (s) ? strlen(s) : 0;
-               delete []t;
-               return *this;
-       }
-       SString &assign(const SString& sother, int size_ = -1) {
-               return assign(sother.s,size_);
-       }
-       SString &assign(const_iterator ibeg, const_iterator iend) {
-               return assign(ibeg,iend - ibeg);
-       }
-       SString() {
-               s = 0;
-               ssize = 0;
-       }
-       SString(const SString &source) {
-               s = StringDup(source.s);
-               ssize = (s) ? strlen(s) : 0;
-       }
-       SString(const char *s_) {
-               s = StringDup(s_);
-               ssize = (s) ? strlen(s) : 0;
-       }
-       SString(int i) {
-               char number[100];
-               sprintf(number, "%0d", i);
-               s = StringDup(number);
-               ssize = (s) ? strlen(s) : 0;
-       }
-       ~SString() {
-               delete []s;
-               s = 0;
-               ssize = 0;
-       }
-       SString &operator=(const SString &source) {
-               if (this != &source) {
-                       delete []s;
-                       s = StringDup(source.s);
-                       ssize = (s) ? strlen(s) : 0;
-               }
-               return *this;
-       }
-       bool operator==(const SString &other) const {
-               if ((s == 0) && (other.s == 0))
-                       return true;
-               if ((s == 0) || (other.s == 0))
-                       return false;
-               return strcmp(s, other.s) == 0;
-       }
-       bool operator!=(const SString &other) const {
-               return !operator==(other);
-       }
-       bool operator==(const char *sother) const {
-               if ((s == 0) && (sother == 0))
-                       return true;
-               if ((s == 0) || (sother == 0))
-                       return false;
-               return strcmp(s, sother) == 0;
-       }
-       bool operator!=(const char *sother) const {
-               return !operator==(sother);
-       }
-       const char *c_str() const {
-               if (s)
-                       return s;
-               else
-                       return "";
-       }
-       int length() const {
-               if (s)
-                       return strlen(s);
-               else
-                       return 0;
-       }
-       char operator[](int i) const {
-               if (s)
-                       return s[i];
-               else
-                       return '\0';
-       }
-       SString &operator +=(const char *sother) {
-               return append(sother,-1);
-       }
-       SString &operator +=(const SString &sother) {
-               return append(sother.s,sother.ssize);
-       }
-       SString &operator +=(char ch) {
-               return append(&ch,1);
-       }
-       SString &append(const char* sother, int lenOther) {
-               int len = length();
-               if(lenOther < 0)
-                       lenOther = strlen(sother);
-               char *sNew = new char[len + lenOther + 1];
-               if (sNew) {
-                       if (s)
-                               memcpy(sNew, s, len);
-                       strncpy(&sNew[len], sother, lenOther);
-                       sNew[len + lenOther] = '\0';
-                       delete []s;
-                       s = sNew;
-                       ssize = (s) ? strlen(s) : 0;
-               }
-               return *this;
-       }
-       int value() const {
-               if (s)
-                       return atoi(s);
-               else
-                       return 0;
-       }
-       void substitute(char find, char replace) {
-               char *t = s;
-               while (t) {
-                       t = strchr(t, find);
-                       if (t)
-                               *t = replace;
-               }
-       }
-       // I don't think this really belongs here -- Neil
-       void correctPath() {
-#ifdef unix
-               substitute('\\', '/');
-#else
-               substitute('/', '\\');
-#endif
-       }
-};
+bool isprefix(const char *target, const char *prefix);
 
 struct Property {
        unsigned int hash;
@@ -192,53 +21,66 @@ struct Property {
        Property() : hash(0), key(0), val(0), next(0) {}
 };
 
+/**
+ */
 class PropSet {
 private:
        enum { hashRoots=31 };
        Property *props[hashRoots];
+       Property *enumnext;
+       int enumhash;
 public:
        PropSet *superPS;
        PropSet();
        ~PropSet();
-       void Set(const char *key, const char *val);
-       void Set(char *keyval);
+       void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1);
+       void Set(const char *keyVal);
+       void SetMultiple(const char *s);
        SString Get(const char *key);
        SString GetExpanded(const char *key);
-       SString Expand(const char *withvars);
+       SString Expand(const char *withVars);
        int GetInt(const char *key, int defaultValue=0);
        SString GetWild(const char *keybase, const char *filename);
        SString GetNewExpand(const char *keybase, const char *filename);
        void Clear();
-       void ReadFromMemory(const char *data, int len, const char *directoryForImports=0);
-       void Read(const char *filename, const char *directoryForImports);
+       char *ToString();       // Caller must delete[] the return value
+       bool GetFirst(char **key, char **val);
+       bool GetNext(char **key, char **val);
 };
 
+/**
+ */
 class WordList {
 public:
-       // Each word contains at least one character - a empty word acts as sentinal at the end.
+       // 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 onlyLineEnds;      ///< Delimited by any white space or only line ends
        bool sorted;
        int starts[256];
-       WordList(bool onlyLineEnds_ = false) :
+       WordList(bool onlyLineEnds_ = false) : 
                words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false) {}
        ~WordList() { Clear(); }
-       operator bool() { return words ? true : false; }
-       const char *operator[](int ind) { return words[ind]; }
+       operator bool() { return len ? true : false; }
+       char *operator[](int ind) { return words[ind]; }
        void Clear();
        void Set(const char *s);
        char *Allocate(int size);
        void SetFromAllocated();
        bool InList(const char *s);
        const char *GetNearestWord(const char *wordStart, int searchLen = -1, bool ignoreCase = false);
-       char *GetNearestWords(const char *wordStart, int searchLen = -1, bool ignoreCase = false);
+       char *GetNearestWords(const char *wordStart, int searchLen=-1, 
+               bool ignoreCase=false, char otherSeparator='\0');
 };
 
 inline bool nonFuncChar(char ch) {
        return strchr("\t\n\r !\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", ch) != NULL;
 }
 
+inline bool IsAlphabetic(unsigned int ch) {
+       return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'));
+}
+
 #endif
diff --git a/contrib/src/stc/scintilla/include/SString.h b/contrib/src/stc/scintilla/include/SString.h
new file mode 100644 (file)
index 0000000..aeb5940
--- /dev/null
@@ -0,0 +1,255 @@
+// SciTE - Scintilla based Text Editor
+/** @file SString.h
+ ** A simple string class.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#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, int len);
+bool EqualCaseInsensitive(const char *a, const char *b);
+
+// 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.
+
+/**
+ * Duplicate a C string.
+ * Allocate memory of the given size, or big enough to fit the string if length isn't given;
+ * then copy the given string in the allocated memory.
+ * @return the pointer to the new string
+ */
+inline char *StringDup(
+       const char *s,  ///< The string to duplicate
+       int len=-1)             ///< The length of memory to allocate. Optional.
+{
+       if (!s)
+               return 0;
+       if (len == -1)
+               len = strlen(s);
+       char *sNew = new char[len + 1];
+       if (sNew) {
+               strncpy(sNew, s, len);
+               sNew[len] = '\0';
+       }
+       return sNew;
+}
+
+/**
+ * @brief A simple string class.
+ * Hold the length of the string for quick operations,
+ * can have a buffer bigger than the string to avoid too many memory allocations and copies.
+ * May have embedded zeroes as a result of @a substitute, but rely too heavily on C string
+ * functions to allow reliable manipulations of these strings.
+ **/
+class SString {
+       char *s;                        ///< The C string
+       int sSize;      ///< The size of the buffer, less 1: ie. the maximum size of the string
+       int sLen;       ///< The size of the string in s
+       int sizeGrowth; ///< Minimum growth size when appending strings
+       enum { sizeGrowthDefault = 64 };
+
+public:
+       typedef int size_type;
+
+       SString() : s(0), sSize(0), sLen(0), sizeGrowth(sizeGrowthDefault) {
+       }
+       SString(const SString &source) : sizeGrowth(sizeGrowthDefault) {
+               s = StringDup(source.s);
+               sSize = sLen = (s) ? strlen(s) : 0;
+       }
+       SString(const char *s_) : sizeGrowth(sizeGrowthDefault) {
+               s = StringDup(s_);
+               sSize = sLen = (s) ? strlen(s) : 0;
+       }
+       SString(const char *s_, int first, int last) : sizeGrowth(sizeGrowthDefault) {
+               s = StringDup(s_ + first, last - first);
+               sSize = sLen = (s) ? strlen(s) : 0;
+       }
+       SString(int i) : sizeGrowth(sizeGrowthDefault) {
+               char number[32];
+               sprintf(number, "%0d", i);
+               s = StringDup(number);
+               sSize = sLen = (s) ? strlen(s) : 0;
+       }
+       ~SString() {
+               delete []s;
+               s = 0;
+               sSize = 0;
+               sLen = 0;
+       }
+       void clear(void) {
+               if (s) {
+                       *s = '\0';
+               }
+               sLen = 0;
+       }
+       /** Size of buffer. */
+       size_type size(void) const {    ///<
+               if (s)
+                       return sSize;
+               else
+                       return 0;
+       }
+       /** Size of string in buffer. */
+       int length() const {
+               return sLen;
+       }
+       SString &assign(const char* sOther, int sSize_ = -1) {
+               if (!sOther) {
+                       sSize_ = 0;
+               }
+               if (sSize_ < 0) {
+                       sSize_ = strlen(sOther);
+               }
+               if (sSize > 0 && sSize_ <= sSize) {     // Does not allocate new buffer if the current is big enough
+                       if (s && sSize_) {
+                               strncpy(s, sOther, sSize_);
+                       }
+                       s[sSize_] = '\0';
+                       sLen = sSize_;
+               } else {
+                       delete []s;
+                       s = StringDup(sOther, sSize_);
+                       if (s) {
+                               sSize = sSize_; // Allow buffer bigger than real string, thus providing space to grow
+                               sLen = strlen(s);
+                       } else {
+                               sSize = sLen = 0;
+                       }
+               }
+               return *this;
+       }
+       SString &assign(const SString& sOther, int sSize_ = -1) {
+               return assign(sOther.s, sSize_);
+       }
+       SString &operator=(const char *source) {
+               return assign(source);
+       }
+       SString &operator=(const SString &source) {
+               if (this != &source) {
+                       assign(source.c_str());
+               }
+               return *this;
+       }
+       bool operator==(const SString &sOther) const {
+               if ((s == 0) && (sOther.s == 0))
+                       return true;
+               if ((s == 0) || (sOther.s == 0))
+                       return false;
+               return strcmp(s, sOther.s) == 0;
+       }
+       bool operator!=(const SString &sOther) const {
+               return !operator==(sOther);
+       }
+       bool operator==(const char *sOther) const {
+               if ((s == 0) && (sOther == 0))
+                       return true;
+               if ((s == 0) || (sOther == 0))
+                       return false;
+               return strcmp(s, sOther) == 0;
+       }
+       bool operator!=(const char *sOther) const {
+               return !operator==(sOther);
+       }
+       bool contains(char ch) {
+               if (s && *s)
+                       return strchr(s, ch) != 0;
+               else
+                       return false;
+       }
+       void setsizegrowth(int sizeGrowth_) {
+               sizeGrowth = sizeGrowth_;
+       }
+       const char *c_str() const {
+               if (s)
+                       return s;
+               else
+                       return "";
+       }
+       /** Give ownership of buffer to caller which must use delete[] to free buffer. */
+       char *detach() {
+               char *sRet = s;
+               s = 0;
+               sSize = 0;
+               sLen = 0;
+               return sRet;
+       }
+       char operator[](int i) const {
+               if (s && i < sSize)     // Or < sLen? Depends on the use, both are OK
+                       return s[i];
+               else
+                       return '\0';
+       }
+       SString &append(const char* sOther, int sLenOther=-1, char sep=0) {
+               if (sLenOther < 0)
+                       sLenOther = strlen(sOther);
+               int lenSep = 0;
+               if (sLen && sep)        // Only add a separator if not empty
+                       lenSep = 1;
+               int lenNew = sLen + sLenOther + lenSep;
+               if (lenNew + 1 < sSize) {
+                       // Conservative about growing the buffer: don't do it, unless really needed
+                       if (lenSep) {
+                               s[sLen] = sep;
+                               sLen++;
+                       }
+                       strncpy(&s[sLen], sOther, sLenOther);
+                       s[sLen + sLenOther] = '\0';
+                       sLen += sLenOther;
+               } else {
+                       // Grow the buffer bigger than really needed, to have room for other appends
+                       char *sNew = new char[lenNew + sizeGrowth + 1];
+                       if (sNew) {
+                               if (s) {
+                                       memcpy(sNew, s, sLen);
+                                       delete []s;
+                               }
+                               s = sNew;
+                               sSize = lenNew + sizeGrowth;
+                               if (lenSep) {
+                                       s[sLen] = sep;
+                                       sLen++;
+                               }
+                               strncpy(&s[sLen], sOther, sLenOther);
+                               sNew[sLen + sLenOther] = '\0';
+                               sLen += sLenOther;
+                       }
+               }
+               return *this;
+       }
+       SString &operator +=(const char *sOther) {
+               return append(sOther, -1);
+       }
+       SString &operator +=(const SString &sOther) {
+               return append(sOther.s, sOther.sSize);
+       }
+       SString &operator +=(char ch) {
+               return append(&ch, 1);
+       }
+       SString &appendwithseparator(const char* sOther, char sep) {
+               return append(sOther, strlen(sOther), sep);
+       }
+       int value() const {
+               if (s)
+                       return atoi(s);
+               else
+                       return 0;
+       }
+       void substitute(char find, char replace) {
+               char *t = s;
+               while (t) {
+                       t = strchr(t, find);
+                       if (t) {
+                               *t = replace;
+                               t++;
+                       }
+               }
+       }
+};
+
+#endif
index 69402ab9ab4bebbfafb086a59ed5e46d8f5d7195..591bd06aa1a4a6a8bbd4765d3da8aa34af146cc3 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// SciLexer - interface to the added lexer functions in the SciLexer version of the edit control
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file SciLexer.h
+ ** Interface to the added lexer functions in the SciLexer version of the edit control.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Most of this file is automatically generated from the Scintilla.iface interface definition
 #define SCLEX_LATEX 14
 #define SCLEX_LUA 15
 #define SCLEX_DIFF 16
+#define SCLEX_CONF 17
+#define SCLEX_PASCAL 18
+#define SCLEX_AVE 19
+#define SCLEX_ADA 20
+#define SCLEX_LISP 21
+#define SCLEX_RUBY 22
+#define SCLEX_EIFFEL 23
+#define SCLEX_EIFFELKW 24
+#define SCLEX_TCL 25
+#define SCLEX_AUTOMATIC 1000
 #define SCE_P_DEFAULT 0
 #define SCE_P_COMMENTLINE 1
 #define SCE_P_NUMBER 2
@@ -57,6 +69,9 @@
 #define SCE_C_IDENTIFIER 11
 #define SCE_C_STRINGEOL 12
 #define SCE_C_VERBATIM 13
+#define SCE_C_REGEX 14
+#define SCE_C_COMMENTLINEDOC 15
+#define SCE_C_WORD2 16
 #define SCE_H_DEFAULT 0
 #define SCE_H_TAG 1
 #define SCE_H_TAGUNKNOWN 2
@@ -77,6 +92,8 @@
 #define SCE_H_CDATA 17
 #define SCE_H_QUESTION 18
 #define SCE_H_VALUE 19
+#define SCE_H_XCCOMMENT 20
+#define SCE_H_SGML 21
 #define SCE_HJ_START 40
 #define SCE_HJ_DEFAULT 41
 #define SCE_HJ_COMMENT 42
 #define SCE_HJ_SINGLESTRING 49
 #define SCE_HJ_SYMBOLS 50
 #define SCE_HJ_STRINGEOL 51
+#define SCE_HJ_REGEX 52
 #define SCE_HJA_START 55
 #define SCE_HJA_DEFAULT 56
 #define SCE_HJA_COMMENT 57
 #define SCE_HJA_SINGLESTRING 64
 #define SCE_HJA_SYMBOLS 65
 #define SCE_HJA_STRINGEOL 66
+#define SCE_HJA_REGEX 67
 #define SCE_HB_START 70
 #define SCE_HB_DEFAULT 71
 #define SCE_HB_COMMENTLINE 72
 #define SCE_HPHP_VARIABLE 123
 #define SCE_HPHP_COMMENT 124
 #define SCE_HPHP_COMMENTLINE 125
-#define SCE_HPHP_STRINGEOL 126
+#define SCE_HPHP_HSTRING_VARIABLE 126
+#define SCE_HPHP_OPERATOR 127
 #define SCE_PL_DEFAULT 0
-#define SCE_PL_HERE 1
+#define SCE_PL_ERROR 1
 #define SCE_PL_COMMENTLINE 2
 #define SCE_PL_POD 3
 #define SCE_PL_NUMBER 4
 #define SCE_PL_ARRAY 13
 #define SCE_PL_HASH 14
 #define SCE_PL_SYMBOLTABLE 15
-#define SCE_PL_REF 16
 #define SCE_PL_REGEX 17
 #define SCE_PL_REGSUBST 18
 #define SCE_PL_LONGQUOTE 19
 #define SCE_PL_BACKTICKS 20
 #define SCE_PL_DATASECTION 21
+#define SCE_PL_HERE_DELIM 22
+#define SCE_PL_HERE_Q 23
+#define SCE_PL_HERE_QQ 24
+#define SCE_PL_HERE_QX 25
+#define SCE_PL_STRING_Q 26
+#define SCE_PL_STRING_QQ 27
+#define SCE_PL_STRING_QX 28
+#define SCE_PL_STRING_QR 29
+#define SCE_PL_STRING_QW 30
 #define SCE_L_DEFAULT 0
 #define SCE_L_COMMAND 1
 #define SCE_L_TAG 2
 #define SCE_ERR_CMD 4
 #define SCE_ERR_BORLAND 5
 #define SCE_ERR_PERL 6
+#define SCE_ERR_NET 7
+#define SCE_ERR_LUA 8
+#define SCE_ERR_DIFF_CHANGED 10
+#define SCE_ERR_DIFF_ADDITION 11
+#define SCE_ERR_DIFF_DELETION 12
+#define SCE_ERR_DIFF_MESSAGE 13
+#define SCE_BAT_DEFAULT 0
+#define SCE_BAT_COMMENT 1
+#define SCE_BAT_WORD 2
+#define SCE_BAT_LABEL 3
+#define SCE_BAT_HIDE 4
+#define SCE_BAT_COMMAND 5
+#define SCE_BAT_IDENTIFIER 6
+#define SCE_BAT_OPERATOR 7
+#define SCE_MAKE_DEFAULT 0
+#define SCE_MAKE_COMMENT 1
+#define SCE_MAKE_PREPROCESSOR 2
+#define SCE_MAKE_IDENTIFIER 3
+#define SCE_MAKE_OPERATOR 4
+#define SCE_MAKE_TARGET 5
+#define SCE_MAKE_IDEOL 9
+#define SCE_CONF_DEFAULT 0
+#define SCE_CONF_COMMENT 1
+#define SCE_CONF_NUMBER 2
+#define SCE_CONF_IDENTIFIER 3
+#define SCE_CONF_EXTENSION 4
+#define SCE_CONF_PARAMETER 5
+#define SCE_CONF_STRING 6
+#define SCE_CONF_OPERATOR 7
+#define SCE_CONF_IP 8
+#define SCE_CONF_DIRECTIVE 9
+#define SCE_AVE_DEFAULT 0
+#define SCE_AVE_COMMENT 1
+#define SCE_AVE_NUMBER 2
+#define SCE_AVE_WORD 3
+#define SCE_AVE_KEYWORD 4
+#define SCE_AVE_STATEMENT 5
+#define SCE_AVE_STRING 6
+#define SCE_AVE_ENUM 7
+#define SCE_AVE_STRINGEOL 8
+#define SCE_AVE_IDENTIFIER 9
+#define SCE_AVE_OPERATOR 10
+#define SCE_ADA_DEFAULT 0
+#define SCE_ADA_COMMENT 1
+#define SCE_ADA_NUMBER 2
+#define SCE_ADA_WORD 3
+#define SCE_ADA_STRING 4
+#define SCE_ADA_CHARACTER 5
+#define SCE_ADA_OPERATOR 6
+#define SCE_ADA_IDENTIFIER 7
+#define SCE_ADA_STRINGEOL 8
+#define SCE_LISP_DEFAULT 0
+#define SCE_LISP_COMMENT 1
+#define SCE_LISP_NUMBER 2
+#define SCE_LISP_KEYWORD 3
+#define SCE_LISP_STRING 6
+#define SCE_LISP_STRINGEOL 8
+#define SCE_LISP_IDENTIFIER 9
+#define SCE_LISP_OPERATOR 10
+#define SCE_EIFFEL_DEFAULT 0
+#define SCE_EIFFEL_COMMENTLINE 1
+#define SCE_EIFFEL_NUMBER 2
+#define SCE_EIFFEL_WORD 3
+#define SCE_EIFFEL_STRING 4
+#define SCE_EIFFEL_CHARACTER 5
+#define SCE_EIFFEL_OPERATOR 6
+#define SCE_EIFFEL_IDENTIFIER 7
+#define SCE_EIFFEL_STRINGEOL 8
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
 
 #endif
index ca81d135bd71290712859b83b670488ba6337bb5..0185d3e5be6cac69c7b19f8e888bba79cc4235b0 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Scintilla.h - interface to the edit control
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Scintilla.h
+ ** Interface to the edit control.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Most of this file is automatically generated from the Scintilla.iface interface definition
@@ -18,7 +20,13 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);
 #endif
 #endif
 
-typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wParam, long lParam);
+// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
+// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
+// May need to be changed for 64 bit platforms.
+typedef unsigned long uptr_t;
+typedef long sptr_t;
+
+typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
 //++Autogenerated -- start of section automatically generated from Scintilla.iface
 #define INVALID_POSITION -1
@@ -50,15 +58,16 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_GETVIEWWS 2020
 #define SCI_SETVIEWWS 2021
 #define SCI_POSITIONFROMPOINT 2022
+#define SCI_POSITIONFROMPOINTCLOSE 2023
 #define SCI_GOTOLINE 2024
 #define SCI_GOTOPOS 2025
 #define SCI_SETANCHOR 2026
 #define SCI_GETCURLINE 2027
 #define SCI_GETENDSTYLED 2028
-#define SCI_CONVERTEOLS 2029
 #define SC_EOL_CRLF 0
 #define SC_EOL_CR 1
 #define SC_EOL_LF 2
+#define SCI_CONVERTEOLS 2029
 #define SCI_GETEOLMODE 2030
 #define SCI_SETEOLMODE 2031
 #define SCI_STARTSTYLING 2032
@@ -80,6 +89,24 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SC_MARK_ARROWDOWN 6
 #define SC_MARK_MINUS 7
 #define SC_MARK_PLUS 8
+#define SC_MARK_VLINE 9
+#define SC_MARK_LCORNER 10
+#define SC_MARK_TCORNER 11
+#define SC_MARK_BOXPLUS 12
+#define SC_MARK_BOXPLUSCONNECTED 13
+#define SC_MARK_BOXMINUS 14
+#define SC_MARK_BOXMINUSCONNECTED 15
+#define SC_MARK_LCORNERCURVE 16
+#define SC_MARK_TCORNERCURVE 17
+#define SC_MARK_CIRCLEPLUS 18
+#define SC_MARK_CIRCLEPLUSCONNECTED 19
+#define SC_MARK_CIRCLEMINUS 20
+#define SC_MARK_CIRCLEMINUSCONNECTED 21
+#define SC_MARKNUM_FOLDEREND 25
+#define SC_MARKNUM_FOLDEROPENMID 26
+#define SC_MARKNUM_FOLDERMIDTAIL 27
+#define SC_MARKNUM_FOLDERTAIL 28
+#define SC_MARKNUM_FOLDERSUB 29
 #define SC_MARKNUM_FOLDER 30
 #define SC_MARKNUM_FOLDEROPEN 31
 #define SCI_MARKERDEFINE 2040
@@ -137,6 +164,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_STYLESETEOLFILLED 2057
 #define SCI_STYLERESETDEFAULT 2058
 #define SCI_STYLESETUNDERLINE 2059
+#define SC_CASE_MIXED 0
+#define SC_CASE_UPPER 1
+#define SC_CASE_LOWER 2
+#define SCI_STYLESETCASE 2060
 #define SCI_STYLESETCHARACTERSET 2066
 #define SCI_SETSELFORE 2067
 #define SCI_SETSELBACK 2068
@@ -170,6 +201,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_SETLINESTATE 2092
 #define SCI_GETLINESTATE 2093
 #define SCI_GETMAXLINESTATE 2094
+#define SCI_GETCARETLINEVISIBLE 2095
+#define SCI_SETCARETLINEVISIBLE 2096
+#define SCI_GETCARETLINEBACK 2097
+#define SCI_SETCARETLINEBACK 2098
 #define SCI_AUTOCSHOW 2100
 #define SCI_AUTOCCANCEL 2101
 #define SCI_AUTOCACTIVE 2102
@@ -186,6 +221,9 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_AUTOCGETCHOOSESINGLE 2114
 #define SCI_AUTOCSETIGNORECASE 2115
 #define SCI_AUTOCGETIGNORECASE 2116
+#define SCI_USERLISTSHOW 2117
+#define SCI_AUTOCSETAUTOHIDE 2118
+#define SCI_AUTOCGETAUTOHIDE 2119
 #define SCI_SETINDENT 2122
 #define SCI_GETINDENT 2123
 #define SCI_SETUSETABS 2124
@@ -215,9 +253,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SC_PRINT_NORMAL 0
 #define SC_PRINT_INVERTLIGHT 1
 #define SC_PRINT_BLACKONWHITE 2
+#define SC_PRINT_COLOURONWHITE 3
+#define SC_PRINT_COLOURONWHITEDEFAULTBG 4
 #define SCI_SETPRINTCOLOURMODE 2148
 #define SCI_GETPRINTCOLOURMODE 2149
-#define SCFIND_DOWN 1
 #define SCFIND_WHOLEWORD 2
 #define SCFIND_MATCHCASE 4
 #define SCFIND_WORDSTART 0x00100000
@@ -260,6 +299,17 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_GETDIRECTPOINTER 2185
 #define SCI_SETOVERTYPE 2186
 #define SCI_GETOVERTYPE 2187
+#define SCI_SETCARETWIDTH 2188
+#define SCI_GETCARETWIDTH 2189
+#define SCI_SETTARGETSTART 2190
+#define SCI_GETTARGETSTART 2191
+#define SCI_SETTARGETEND 2192
+#define SCI_GETTARGETEND 2193
+#define SCI_REPLACETARGET 2194
+#define SCI_REPLACETARGETRE 2195
+#define SCI_SEARCHINTARGET 2197
+#define SCI_SETSEARCHFLAGS 2198
+#define SCI_GETSEARCHFLAGS 2199
 #define SCI_CALLTIPSHOW 2200
 #define SCI_CALLTIPCANCEL 2201
 #define SCI_CALLTIPACTIVE 2202
@@ -284,6 +334,14 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_TOGGLEFOLD 2231
 #define SCI_ENSUREVISIBLE 2232
 #define SCI_SETFOLDFLAGS 2233
+#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
+#define SCI_SETTABINDENTS 2260
+#define SCI_GETTABINDENTS 2261
+#define SCI_SETBACKSPACEUNINDENTS 2262
+#define SCI_GETBACKSPACEUNINDENTS 2263
+#define SC_TIME_FOREVER 10000000
+#define SCI_SETMOUSEDWELLTIME 2264
+#define SCI_GETMOUSEDWELLTIME 2265
 #define SCI_LINEDOWN 2300
 #define SCI_LINEDOWNEXTEND 2301
 #define SCI_LINEUP 2302
@@ -328,6 +386,7 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_UPPERCASE 2341
 #define SCI_LINESCROLLDOWN 2342
 #define SCI_LINESCROLLUP 2343
+#define SCI_MOVECARETINSIDEVIEW 2401
 #define SCI_LINELENGTH 2350
 #define SCI_BRACEHIGHLIGHT 2351
 #define SCI_BRACEBADLIGHT 2352
@@ -352,6 +411,8 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define CARET_SLOP 0x01
 #define CARET_CENTER 0x02
 #define CARET_STRICT 0x04
+#define CARET_XEVEN 0x08
+#define CARET_XJUMPS 0x10
 #define SCI_SETCARETPOLICY 2369
 #define SCI_LINESONSCREEN 2370
 #define SCI_USEPOPUP 2371
@@ -362,6 +423,25 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_ADDREFDOCUMENT 2376
 #define SCI_RELEASEDOCUMENT 2377
 #define SCI_GETMODEVENTMASK 2378
+#define SCI_SETFOCUS 2380
+#define SCI_GETFOCUS 2381
+#define SCI_SETSTATUS 2382
+#define SCI_GETSTATUS 2383
+#define SCI_SETMOUSEDOWNCAPTURES 2384
+#define SCI_GETMOUSEDOWNCAPTURES 2385
+#define SC_CURSORNORMAL -1
+#define SC_CURSORWAIT 3
+#define SCI_SETCURSOR 2386
+#define SCI_GETCURSOR 2387
+#define SCI_WORDPARTLEFT 2390
+#define SCI_WORDPARTLEFTEXTEND 2391
+#define SCI_WORDPARTRIGHT 2392
+#define SCI_WORDPARTRIGHTEXTEND 2393
+#define VISIBLE_SLOP 0x01
+#define VISIBLE_STRICT 0x04
+#define SCI_SETVISIBLEPOLICY 2394
+#define SCI_DELLINELEFT 2395
+#define SCI_DELLINERIGHT 2396
 #define SCI_GRABFOCUS 2400
 #define SCI_STARTRECORD 3001
 #define SCI_STOPRECORD 3002
@@ -370,6 +450,7 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_COLOURISE 4003
 #define SCI_SETPROPERTY 4004
 #define SCI_SETKEYWORDS 4005
+#define SCI_SETLEXERLANGUAGE 4006
 #define SC_MOD_INSERTTEXT 0x1
 #define SC_MOD_DELETETEXT 0x2
 #define SC_MOD_CHANGESTYLE 0x4
@@ -419,6 +500,11 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCN_MARGINCLICK 2010
 #define SCN_NEEDSHOWN 2011
 #define SCN_POSCHANGED 2012
+#define SCN_PAINTED 2013
+#define SCN_USERLISTSELECTION 2014
+#define SCN_URIDROPPED 2015
+#define SCN_DWELLSTART 2016
+#define SCN_DWELLEND 2017
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
 
 // Optional module for macro recording
@@ -437,14 +523,14 @@ struct CharacterRange {
 };
 
 struct TextRange {
-       CharacterRange chrg;
+       struct CharacterRange chrg;
        char *lpstrText;
 };
 
 struct TextToFind {
-       CharacterRange chrg;
+       struct CharacterRange chrg;
        char *lpstrText;
-       CharacterRange chrgText;
+       struct CharacterRange chrgText;
 };
 
 #ifdef PLATFORM_H
@@ -463,8 +549,8 @@ struct RangeToFormat {
 #endif
 
 struct NotifyHeader {
-    // hwndFrom is really an environment specifc window handle or pointer
-    // but most clients of Scintilla.h do not have this type visible.
+       // hwndFrom is really an environment specifc window handle or pointer
+       // but most clients of Scintilla.h do not have this type visible.
        //WindowID hwndFrom;
        void *hwndFrom; 
        unsigned int idFrom;
@@ -472,26 +558,35 @@ struct NotifyHeader {
 };
 
 struct SCNotification {
-       NotifyHeader nmhdr;
-       int position;                   // SCN_STYLENEEDED, SCN_MODIFIED
-       int ch;                                 // SCN_CHARADDED, SCN_KEY
-       int modifiers;                  // SCN_KEY
-       int modificationType;   // SCN_MODIFIED
-       const char *text;               // SCN_MODIFIED
-       int length;                             // SCN_MODIFIED
-       int linesAdded; // SCN_MODIFIED
+       struct NotifyHeader nmhdr;
+       int position;   // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND
+       int ch;         // SCN_CHARADDED, SCN_KEY
+       int modifiers;  // SCN_KEY
+       int modificationType;   // SCN_MODIFIED
+       const char *text;       // SCN_MODIFIED
+       int length;             // SCN_MODIFIED
+       int linesAdded; // SCN_MODIFIED
 #ifdef MACRO_SUPPORT
        int message;    // SCN_MACRORECORD
-       int wParam;     // SCN_MACRORECORD
-       int lParam;     // SCN_MACRORECORD
+       uptr_t wParam;  // SCN_MACRORECORD
+       sptr_t lParam;          // SCN_MACRORECORD
 #endif
-       int line;                       // SCN_MODIFIED
+       int line;               // SCN_MODIFIED
        int foldLevelNow;       // SCN_MODIFIED
        int foldLevelPrev;      // SCN_MODIFIED
-       int margin;     // SCN_MARGINCLICK
+       int margin;             // SCN_MARGINCLICK
+       int listType;   // SCN_USERLISTSELECTION
+       int x;                  // SCN_DWELLSTART, SCN_DWELLEND
+       int y;          // SCN_DWELLSTART, SCN_DWELLEND
 };
 
-#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | (1<<SC_MARKNUM_FOLDEROPEN))
+#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | \
+       (1<<SC_MARKNUM_FOLDEROPEN) | \
+       (1<<SC_MARKNUM_FOLDERSUB) | \
+       (1<<SC_MARKNUM_FOLDERTAIL) | \
+       (1<<SC_MARKNUM_FOLDERMIDTAIL) | \
+       (1<<SC_MARKNUM_FOLDEROPENMID) | \
+       (1<<SC_MARKNUM_FOLDEREND))
 
 // Deprecation section listing all API features that are deprecated and will
 // will be removed completely in a future version.
@@ -499,10 +594,6 @@ struct SCNotification {
 
 #ifdef INCLUDE_DEPRECATED_FEATURES
 
-// Deprecated in 1.27
-#define SC_UNDOCOLLECT_NONE 0
-#define SC_UNDOCOLLECT_AUTOSTART 1
-
 #endif
 
 #endif
index 416063efa50c2d24b557f976afb2358e26f7f7a6..90360076fa5f48bd032cd19ed705ef3b50ca48b2 100644 (file)
@@ -134,6 +134,10 @@ set void SetViewWS=2021(int viewWS,)
 # Find the position from a point within the window.
 fun int PositionFromPoint=2022(int x, int y)
 
+# Find the position from a point within the window but return
+# INVALID_POSITION if not close to text.
+fun int PositionFromPointClose=2023(int x, int y)
+
 # Set caret to start of a line and ensure it is visible.
 fun void GotoLine=2024(int line,)
 
@@ -151,13 +155,13 @@ fun int GetCurLine=2027(int length, stringresult text)
 # Retrieve the position of the last correctly styled character.
 get position GetEndStyled=2028(,)
 
-# Convert all line endings in the document to use the current mode.
-fun void ConvertEOLs=2029(,)
-
 val SC_EOL_CRLF=0
 val SC_EOL_CR=1
 val SC_EOL_LF=2
 
+# Convert all line endings in the document to one mode.
+fun void ConvertEOLs=2029(int eolMode,)
+
 # Retrieve the current end of line mode - one of CRLF, CR, or LF.
 get int GetEOLMode=2030(,)
 
@@ -210,6 +214,27 @@ val SC_MARK_ARROWDOWN=6
 val SC_MARK_MINUS=7
 val SC_MARK_PLUS=8
 
+# Shapes used for outlining column
+val SC_MARK_VLINE=9
+val SC_MARK_LCORNER=10
+val SC_MARK_TCORNER=11
+val SC_MARK_BOXPLUS=12
+val SC_MARK_BOXPLUSCONNECTED=13
+val SC_MARK_BOXMINUS=14
+val SC_MARK_BOXMINUSCONNECTED=15
+val SC_MARK_LCORNERCURVE=16
+val SC_MARK_TCORNERCURVE=17
+val SC_MARK_CIRCLEPLUS=18
+val SC_MARK_CIRCLEPLUSCONNECTED=19
+val SC_MARK_CIRCLEMINUS=20
+val SC_MARK_CIRCLEMINUSCONNECTED=21
+
+# Markers used for outlining column
+val SC_MARKNUM_FOLDEREND=25
+val SC_MARKNUM_FOLDEROPENMID=26
+val SC_MARKNUM_FOLDERMIDTAIL=27
+val SC_MARKNUM_FOLDERTAIL=28
+val SC_MARKNUM_FOLDERSUB=29
 val SC_MARKNUM_FOLDER=30
 val SC_MARKNUM_FOLDEROPEN=31
 
@@ -327,6 +352,12 @@ fun void StyleResetDefault=2058(,)
 # Set a style to be underlined or not.
 set void StyleSetUnderline=2059(int style, bool underline)
 
+val SC_CASE_MIXED=0
+val SC_CASE_UPPER=1
+val SC_CASE_LOWER=2
+# Set a style to be mixed case, or to force upper or lower case.
+set void StyleSetCase=2060(int style, int caseForce)
+
 # Set the character set of the font in a style.
 set void StyleSetCharacterSet=2066(int style, int characterSet)
 
@@ -412,6 +443,18 @@ get int GetLineState=2093(int line,)
 # Retrieve the last line number that has line state.
 get int GetMaxLineState=2094(,)
 
+# Is the background of the line containing the caret in a different colour?
+get bool GetCaretLineVisible=2095(,)
+
+# Display the background of the line containing the caret in a different colour.
+set void SetCaretLineVisible=2096(bool show,)
+
+# Get the colour of the background of the line containing the caret.
+get colour GetCaretLineBack=2097(,)
+
+# Set the colour of the background of the line containing the caret.
+set void SetCaretLineBack=2098(colour back,)
+
 # Display a auto-completion list.
 # The lenEntered parameter indicates how many characters before
 # the caret should be used to provide context.
@@ -465,6 +508,15 @@ set void AutoCSetIgnoreCase=2115(bool ignoreCase,)
 # Retrieve state of ignore case flag.
 get bool AutoCGetIgnoreCase=2116(,)
 
+# Display a list of strings and send notification when user chooses one.
+fun void UserListShow=2117(int listType, string itemList)
+
+# Set whether or not autocompletion is hidden automatically when nothing matches
+set void AutoCSetAutoHide=2118(bool autoHide,)
+
+# Retrieve whether or not autocompletion is hidden automatically when nothing matches
+get bool AutoCGetAutoHide=2119(,)
+
 # Set the number of spaces used for one level of indentation.
 set void SetIndent=2122(int indentSize,)
 
@@ -551,6 +603,10 @@ val SC_PRINT_NORMAL=0
 val SC_PRINT_INVERTLIGHT=1
 # PrintColourMode - force black text on white background for printing.
 val SC_PRINT_BLACKONWHITE=2
+# PrintColourMode - text stays coloured, but all background is forced to be white for printing.
+val SC_PRINT_COLOURONWHITE=3
+# PrintColourMode - only the default-background is forced to be white for printing.
+val SC_PRINT_COLOURONWHITEDEFAULTBG=4
 
 # Modify colours when printing for clearer printed text.
 set void SetPrintColourMode=2148(int mode,)
@@ -558,11 +614,9 @@ set void SetPrintColourMode=2148(int mode,)
 # Returns the print colour mode.
 get int GetPrintColourMode=2149(,)
 
-val SCFIND_DOWN=1
 val SCFIND_WHOLEWORD=2
 val SCFIND_MATCHCASE=4
 val SCFIND_WORDSTART=0x00100000
-# SCFIND_REGEXP is not yet implemented.
 val SCFIND_REGEXP=0x00200000
 
 # Find some text in the document.
@@ -582,13 +636,13 @@ fun int GetLine=2153(int line, stringresult text)
 get int GetLineCount=2154(,)
 
 # Sets the size in pixels of the left margin.
-set void SetMarginLeft=2155(, int width)
+set void SetMarginLeft=2155(, int pixelWidth)
 
 # Returns the size in pixels of the left margin.
 get int GetMarginLeft=2156(,)
 
 # Sets the size in pixels of the right margin.
-set void SetMarginRight=2157(, int width)
+set void SetMarginRight=2157(, int pixelWidth)
 
 # Returns the size in pixels of the right margin.
 get int GetMarginRight=2158(,)
@@ -684,6 +738,48 @@ set void SetOvertype=2186(bool overtype,)
 # Returns true if overtype mode is active otherwise false is returned.
 get bool GetOvertype=2187(,)
 
+# Set the width of the insert mode caret
+set void SetCaretWidth=2188(int pixelWidth,)
+
+# Returns the width of the insert mode caret
+get int GetCaretWidth=2189(,)
+
+# Sets the position that starts the target which is used for updating the
+# document without affecting the scroll position.
+set void SetTargetStart=2190(position pos,)
+
+# Get the position that starts the target.
+get position GetTargetStart=2191(,)
+
+# Sets the position that ends the target which is used for updating the
+# document without affecting the scroll position.
+set void SetTargetEnd=2192(position pos,)
+
+# Get the position that ends the target.
+get position GetTargetEnd=2193(,)
+
+# Replace the target text with the argument text.
+# Returns the length of the replacement text.
+fun int ReplaceTarget=2194(int length, string text)
+
+# Replace the target text with the argument text after \d processing.
+# Looks for \d where d is between 1 and 9 and replaces these with the strings
+# matched in the last search operation which were surrounded by \( and \).
+# Returns the length of the replacement text including any change
+# caused by processing the \d patterns.
+fun int ReplaceTargetRE=2195(int length, string text)
+
+# Search for a counted string in the target and set the target to the found
+# range.
+# Returns length of range or -1 for failure in which case target is not moved.
+fun int SearchInTarget=2197(int length, string text)
+
+# Set the search flags used by SearchInTarget
+set void SetSearchFlags=2198(int flags,)
+
+# Get the search flags used by SearchInTarget
+get int GetSearchFlags=2199(,)
+
 # Show a call tip containing a definition near position pos.
 fun void CallTipShow=2200(position pos, string definition)
 
@@ -751,6 +847,30 @@ fun void EnsureVisible=2232(int line,)
 # Set some debugging options for folding
 fun void SetFoldFlags=2233(int flags,)
 
+# Ensure a particular line is visible by expanding any header line hiding it.
+# Use the currently set visibility policy to determine which range to display.
+fun void EnsureVisibleEnforcePolicy=2234(int line,)
+
+# Sets whether a tab pressed when caret is within indentation indents
+set void SetTabIndents=2260(bool tabIndents,)
+
+# Does a tab pressed when caret is within indentation indent?
+get bool GetTabIndents=2261(,)
+
+# Sets whether a backspace pressed when caret is within indentation unindents
+set void SetBackSpaceUnIndents=2262(bool bsUnIndents,)
+
+# Does a backspace pressed when caret is within indentation unindent?
+get bool GetBackSpaceUnIndents=2263(,)
+
+val SC_TIME_FOREVER=10000000
+
+# Sets the time the mouse must sit still to generate a mouse dwell event
+set void SetMouseDwellTime=2264(int periodMilliseconds,)
+
+# Retrieve the time the mouse must sit still to generate a mouse dwell event
+get int GetMouseDwellTime=2265(,)
+
 ## Start of key messages
 # Move caret down one line.
 fun void LineDown=2300(,)
@@ -887,6 +1007,9 @@ fun void LineScrollDown=2342(,)
 # Scroll the document up, keeping the caret visible.
 fun void LineScrollUp=2343(,)
 
+# Move the caret inside current view if it's not there already
+fun void MoveCaretInsideView=2401(,)
+
 # How many characters are on a line, not including end of line characters.
 fun int LineLength=2350(int line,)
 
@@ -909,7 +1032,7 @@ set void SetViewEOL=2356(bool visible,)
 get int GetDocPointer=2357(,)
 
 # Change the document object used.
-set void SetDocPointer=2358(int pointer,)
+set void SetDocPointer=2358(,int pointer)
 
 # Set which document modification events are sent to the container.
 set void SetModEventMask=2359(int mask,)
@@ -942,18 +1065,28 @@ set void SetEdgeColour=2365(colour edgeColour,)
 fun void SearchAnchor=2366(,)
 
 # Find some text starting at the search anchor.
+# Does not ensure the selection is visible.
 fun int SearchNext=2367(int flags, string text)
 
 # Find some text starting at the search anchor and moving backwards.
+# Does not ensure the selection is visible.
 fun int SearchPrev=2368(int flags, string text)
 
 # Show caret within N lines of edge when it's scrolled to view
+# If CARET_SLOP not set then centre caret on screen when it's
+# scrolled to view
 val CARET_SLOP=0x01
-# Center caret on screen when it's scrolled to view
+# Value not used
 val CARET_CENTER=0x02
-# OR this with CARET_CENTER to reposition even when visible, or
-# OR this with CARET_SLOP to reposition whenever outside slop border
+# If CARET_SLOP also set then reposition whenever outside slop border
+# If CARET_SLOP not set then recentre even when visible
 val CARET_STRICT=0x04
+# If CARET_XEVEN set then both left and right margins are given equal weight
+# rather than favouring left following behaviour.
+val CARET_XEVEN=0x08
+# If CARET_XJUMPS set then when caret reaches the margin the display jumps
+# enough to leave the caret solidly within the display.
+val CARET_XJUMPS=0x10
 # Set the way the line the caret is on is kept visible.
 fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
 
@@ -984,6 +1117,49 @@ fun void ReleaseDocument=2377(, int doc)
 # Get which document modification events are sent to the container.
 get int GetModEventMask=2378(,)
 
+# Change internal focus flag
+set void SetFocus=2380(bool focus,)
+# Get internal focus flag
+get bool GetFocus=2381(,)
+
+# Change error status - 0 = OK
+set void SetStatus=2382(int statusCode,)
+# Get error status
+get int GetStatus=2383(,)
+
+# Set whether the mouse is captured when its button is pressed
+set void SetMouseDownCaptures=2384(bool captures,)
+# Get whether mouse gets captured
+get bool GetMouseDownCaptures=2385(,)
+
+val SC_CURSORNORMAL=-1
+val SC_CURSORWAIT=3
+# Sets the cursor to one of the SC_CURSOR* values
+set void SetCursor=2386(int cursorType,)
+# Get cursor type
+get int GetCursor=2387(,)
+
+# Move to the previous change in capitalistion
+fun void WordPartLeft=2390(,)
+# Move to the previous change in capitalistion extending selection to new caret position.
+fun void WordPartLeftExtend=2391(,)
+# Move to the change next in capitalistion
+fun void WordPartRight=2392(,)
+# Move to the next change in capitalistion extending selection to new caret position.
+fun void WordPartRightExtend=2393(,)
+
+# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
+val VISIBLE_SLOP=0x01
+val VISIBLE_STRICT=0x04
+# Set the way the display area is determined when a particular line is to be moved to.
+fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop)
+
+# Delete back from the current position to the start of the line
+fun void DelLineLeft=2395(,)
+
+# Delete forwards from the current position to the end of the line
+fun void DelLineRight=2396(,)
+
 # Set the focus to this Scintilla widget.
 # GTK+ Specific
 fun void GrabFocus=2400(,)
@@ -1009,6 +1185,9 @@ set void SetProperty=4004(string key, string value)
 # Set up the key words used by the lexer.
 set void SetKeyWords=4005(int keywordSet, string keyWords)
 
+# Set the lexing language of the document based on string name.
+set void SetLexerLanguage=4006(, string language)
+
 # Notifications
 # Type of modification and the action which caused the modification
 # These are defined as a bit mask to make it easy to specify which notifications are wanted.
@@ -1077,6 +1256,18 @@ val SCLEX_XCODE=13
 val SCLEX_LATEX=14
 val SCLEX_LUA=15
 val SCLEX_DIFF=16
+val SCLEX_CONF=17
+val SCLEX_PASCAL=18
+val SCLEX_AVE=19
+val SCLEX_ADA=20
+val SCLEX_LISP=21
+val SCLEX_RUBY=22
+val SCLEX_EIFFEL=23
+val SCLEX_EIFFELKW=24
+val SCLEX_TCL=25
+# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
+# value assigned in sequence from SCLEX_AUTOMATIC+1.
+val SCLEX_AUTOMATIC=1000
 # Lexical states for SCLEX_PYTHON
 val SCE_P_DEFAULT=0
 val SCE_P_COMMENTLINE=1
@@ -1107,6 +1298,9 @@ val SCE_C_OPERATOR=10
 val SCE_C_IDENTIFIER=11
 val SCE_C_STRINGEOL=12
 val SCE_C_VERBATIM=13
+val SCE_C_REGEX=14
+val SCE_C_COMMENTLINEDOC=15
+val SCE_C_WORD2=16
 # Lexical states for SCLEX_HTML, SCLEX_XML
 val SCE_H_DEFAULT=0
 val SCE_H_TAG=1
@@ -1130,6 +1324,10 @@ val SCE_H_CDATA=17
 val SCE_H_QUESTION=18
 # More HTML
 val SCE_H_VALUE=19
+# X-Code
+val SCE_H_XCCOMMENT=20
+# SGML
+val SCE_H_SGML=21
 # Embedded Javascript
 val SCE_HJ_START=40
 val SCE_HJ_DEFAULT=41
@@ -1143,6 +1341,7 @@ val SCE_HJ_DOUBLESTRING=48
 val SCE_HJ_SINGLESTRING=49
 val SCE_HJ_SYMBOLS=50
 val SCE_HJ_STRINGEOL=51
+val SCE_HJ_REGEX=52
 # ASP Javascript
 val SCE_HJA_START=55
 val SCE_HJA_DEFAULT=56
@@ -1156,6 +1355,7 @@ val SCE_HJA_DOUBLESTRING=63
 val SCE_HJA_SINGLESTRING=64
 val SCE_HJA_SYMBOLS=65
 val SCE_HJA_STRINGEOL=66
+val SCE_HJA_REGEX=67
 # Embedded VBScript
 val SCE_HB_START=70
 val SCE_HB_DEFAULT=71
@@ -1211,10 +1411,11 @@ val SCE_HPHP_NUMBER=122
 val SCE_HPHP_VARIABLE=123
 val SCE_HPHP_COMMENT=124
 val SCE_HPHP_COMMENTLINE=125
-val SCE_HPHP_STRINGEOL=126
+val SCE_HPHP_HSTRING_VARIABLE=126
+val SCE_HPHP_OPERATOR=127
 # Lexical states for SCLEX_PERL
 val SCE_PL_DEFAULT=0
-val SCE_PL_HERE=1
+val SCE_PL_ERROR=1
 val SCE_PL_COMMENTLINE=2
 val SCE_PL_POD=3
 val SCE_PL_NUMBER=4
@@ -1229,12 +1430,20 @@ val SCE_PL_SCALAR=12
 val SCE_PL_ARRAY=13
 val SCE_PL_HASH=14
 val SCE_PL_SYMBOLTABLE=15
-val SCE_PL_REF=16
 val SCE_PL_REGEX=17
 val SCE_PL_REGSUBST=18
 val SCE_PL_LONGQUOTE=19
 val SCE_PL_BACKTICKS=20
 val SCE_PL_DATASECTION=21
+val SCE_PL_HERE_DELIM=22
+val SCE_PL_HERE_Q=23
+val SCE_PL_HERE_QQ=24
+val SCE_PL_HERE_QX=25
+val SCE_PL_STRING_Q=26
+val SCE_PL_STRING_QQ=27
+val SCE_PL_STRING_QX=28
+val SCE_PL_STRING_QR=29
+val SCE_PL_STRING_QW=30
 # Lexical states for SCLEX_LATEX
 val SCE_L_DEFAULT=0
 val SCE_L_COMMAND=1
@@ -1255,6 +1464,7 @@ val SCE_LUA_PREPROCESSOR=9
 val SCE_LUA_OPERATOR=10
 val SCE_LUA_IDENTIFIER=11
 val SCE_LUA_STRINGEOL=12
+# Lexical states for SCLEX_ERRORLIST
 val SCE_ERR_DEFAULT=0
 val SCE_ERR_PYTHON=1
 val SCE_ERR_GCC=2
@@ -1262,6 +1472,81 @@ val SCE_ERR_MS=3
 val SCE_ERR_CMD=4
 val SCE_ERR_BORLAND=5
 val SCE_ERR_PERL=6
+val SCE_ERR_NET=7
+val SCE_ERR_LUA=8
+val SCE_ERR_DIFF_CHANGED=10
+val SCE_ERR_DIFF_ADDITION=11
+val SCE_ERR_DIFF_DELETION=12
+val SCE_ERR_DIFF_MESSAGE=13
+# Lexical states for SCLEX_BATCH
+val SCE_BAT_DEFAULT=0
+val SCE_BAT_COMMENT=1
+val SCE_BAT_WORD=2
+val SCE_BAT_LABEL=3
+val SCE_BAT_HIDE=4
+val SCE_BAT_COMMAND=5
+val SCE_BAT_IDENTIFIER=6
+val SCE_BAT_OPERATOR=7
+# Lexical states for SCLEX_MAKEFILE
+val SCE_MAKE_DEFAULT=0
+val SCE_MAKE_COMMENT=1
+val SCE_MAKE_PREPROCESSOR=2
+val SCE_MAKE_IDENTIFIER=3
+val SCE_MAKE_OPERATOR=4
+val SCE_MAKE_TARGET=5
+val SCE_MAKE_IDEOL=9
+# Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+val SCE_CONF_DEFAULT=0
+val SCE_CONF_COMMENT=1
+val SCE_CONF_NUMBER=2
+val SCE_CONF_IDENTIFIER=3
+val SCE_CONF_EXTENSION=4
+val SCE_CONF_PARAMETER=5
+val SCE_CONF_STRING=6
+val SCE_CONF_OPERATOR=7
+val SCE_CONF_IP=8
+val SCE_CONF_DIRECTIVE=9
+# Avenue
+val SCE_AVE_DEFAULT=0
+val SCE_AVE_COMMENT=1
+val SCE_AVE_NUMBER=2
+val SCE_AVE_WORD=3
+val SCE_AVE_KEYWORD=4
+val SCE_AVE_STATEMENT=5
+val SCE_AVE_STRING=6
+val SCE_AVE_ENUM=7
+val SCE_AVE_STRINGEOL=8
+val SCE_AVE_IDENTIFIER=9
+val SCE_AVE_OPERATOR=10
+# Lexical states for SCLEX_ADA
+val SCE_ADA_DEFAULT=0
+val SCE_ADA_COMMENT=1
+val SCE_ADA_NUMBER=2
+val SCE_ADA_WORD=3
+val SCE_ADA_STRING=4
+val SCE_ADA_CHARACTER=5
+val SCE_ADA_OPERATOR=6
+val SCE_ADA_IDENTIFIER=7
+val SCE_ADA_STRINGEOL=8
+# Lexical states for SCLEX_LISP
+val SCE_LISP_DEFAULT=0
+val SCE_LISP_COMMENT=1
+val SCE_LISP_NUMBER=2
+val SCE_LISP_KEYWORD=3
+val SCE_LISP_STRING=6
+val SCE_LISP_STRINGEOL=8
+val SCE_LISP_IDENTIFIER=9
+val SCE_LISP_OPERATOR=10
+# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+val SCE_EIFFEL_DEFAULT=0
+val SCE_EIFFEL_COMMENTLINE=1
+val SCE_EIFFEL_NUMBER=2
+val SCE_EIFFEL_WORD=3
+val SCE_EIFFEL_STRING=4
+val SCE_EIFFEL_CHARACTER=5
+val SCE_EIFFEL_OPERATOR=6
+val SCE_EIFFEL_IDENTIFIER=7
+val SCE_EIFFEL_STRINGEOL=8
 
 # Events
 
@@ -1282,9 +1567,16 @@ evt void MacroRecord=2009(int message, int wParam, int lParam)
 evt void MarginClick=2010(int modifiers, int position, int margin)
 evt void NeedShown=2011(int position, int length)
 evt void PosChanged=2012(int position)
+evt void Painted=2013(void)
+evt void UserListSelection=2014(int listType, string text)
+evt void URIDropped=2015(string text)
+evt void DwellStart=2016(int position)
+evt void DwellEnd=2017(int position)
 
 cat Deprecated
 
+val SCFIND_DOWN=1
+
 ################################################
 # From WinDefs.h
 
index 980557a2e7450a594efc0001e5e21c89be1ebcd4..f6c2fc3542c343af2c1cd05622063e6c6da084d3 100644 (file)
@@ -1,7 +1,9 @@
 // Scintilla source code edit control
-// ScintillaWidget.h - definition of Scintilla widget for GTK+
-// Only needed by GTK+ code but is harmless on other platforms.
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ScintillaWidget.h
+ ** Definition of Scintilla widget for GTK+.
+ ** Only needed by GTK+ code but is harmless on other platforms.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef SCINTILLAWIDGET_H
@@ -9,6 +11,17 @@
 
 #if PLAT_GTK
 
+#ifndef SCINTILLA_H
+#ifdef _MSC_VER
+#pragma message(__FILE__ "(1) : warning : Scintilla.h should be included before ScintillaWidget.h")
+#pragma message("This will be required in the next version of Scintilla")
+#else
+#warning Scintilla.h should be included before ScintillaWidget.h
+#warning This will be required in the next version of Scintilla
+#endif
+#include "Scintilla.h"
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -21,7 +34,7 @@ typedef struct _ScintillaObject ScintillaObject;
 typedef struct _ScintillaClass  ScintillaClass;
 
 struct _ScintillaObject {
-       GtkFixed vbox;
+       GtkContainer cont;
        void *pscin;
 };
 
@@ -35,7 +48,7 @@ struct _ScintillaClass {
 guint          scintilla_get_type      (void);
 GtkWidget*     scintilla_new           (void);
 void           scintilla_set_id        (ScintillaObject *sci,int id);
-long           scintilla_send_message  (ScintillaObject *sci,int iMessage,int wParam,int lParam);
+sptr_t scintilla_send_message  (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
 #ifdef __cplusplus
 }
index c56f02d8109e9e331dfb9dd93a4acdccb511fdf0..b3421c0bcceee5f6e820504a97f45699e143e1a9 100644 (file)
@@ -1,11 +1,23 @@
 // Scintilla source code edit control
-// WinDefs.h - the subset of definitions from Windows needed by Scintilla for GTK+
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file WinDefs.h
+ ** The subset of definitions from Windows needed by Scintilla for GTK+.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef WINDEFS_H
 #define WINDEFS_H
 
+/* Running GTK version on win32 */
+#if PLAT_GTK_WIN32
+#include "Windows.h"
+#include "Richedit.h"
+
+/* Name conflicts */
+#undef DrawText
+#undef FindText
+#else
+
 #define WORD short
 #define WPARAM unsigned long
 #define LPARAM long
@@ -180,4 +192,6 @@ struct FORMATRANGE {
 //#define LOWORD(x) (x & 0xffff)
 //#define HIWORD(x) (x >> 16)
 
+#endif /* !_MSC_VER */
+
 #endif
index 4f41dfc7ff4db6948e87ad3ca6b13afd1254e581..7fd8e30fd7db980e0adeca21d8c49b53b3ec07e1 100644 (file)
@@ -1,7 +1,13 @@
-// WindowAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file WindowAccessor.h
+ ** Implementation of BufferAccess and StylingAccess on a Scintilla
+ ** rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
+/**
+ */
 class WindowAccessor : public Accessor {
        // Private so WindowAccessor objects can not be copied
        WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {}
@@ -36,6 +42,9 @@ public:
        int GetPropertyInt(const char *key, int defaultValue=0) { 
                return props.GetInt(key, defaultValue); 
        }
+       char *GetProperties() {
+               return props.ToString();
+       }
 
        void StartAt(unsigned int start, char chMask=31);
        void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
index 5bc50d1efab3dfe8db55159a75ff693d6349e4e0..7f7412e43fa9f10d37910ff87248d6ff616a2267 100644 (file)
@@ -1,13 +1,17 @@
 // Scintilla source code edit control
-// AutoComplete.cxx - defines the auto completion list box
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file AutoComplete.cxx
+ ** Defines the auto completion list box.
+ **/
+// Copyright 1998-2001 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 "Platform.h"
 
+#include "PropSet.h"
 #include "AutoComplete.h"
 
 AutoComplete::AutoComplete() : 
@@ -17,7 +21,8 @@ AutoComplete::AutoComplete() :
        chooseSingle(false),
        posStart(0),
        startLen(0),
-       cancelAtStartPos(true) {
+       cancelAtStartPos(true),
+       autoHide(true) {
        stopChars[0] = '\0';
        fillUpChars[0] = '\0';
 }
@@ -85,7 +90,6 @@ void AutoComplete::SetList(const char *list) {
                }
                delete []words;
        }
-       lb.Sort();
 }
 
 void AutoComplete::Show() {
@@ -113,9 +117,42 @@ void AutoComplete::Move(int delta) {
 }
 
 void AutoComplete::Select(const char *word) {
-       int pos = lb.Find(word);
-       //Platform::DebugPrintf("Autocompleting at <%s> %d\n", wordCurrent, pos);
-       if (pos != -1)
-               lb.Select(pos);
+       int lenWord = strlen(word);
+       int location = -1;
+       const int maxItemLen=1000;
+       char item[maxItemLen];
+       int start = 0; // lower bound of the api array block to search
+       int end = lb.Length() - 1; // upper bound of the api array block to search
+       while ((start <= end) && (location == -1)) { // Binary searching loop
+               int pivot = (start + end) / 2;
+               lb.GetValue(pivot, item, maxItemLen);
+               int cond;
+               if (ignoreCase)
+                       cond = CompareNCaseInsensitive(word, item, lenWord);
+               else
+                       cond = strncmp(word, item, lenWord);
+               if (!cond) {
+                       // Find first match
+                       while (pivot > start) {
+                               lb.GetValue(pivot-1, item, maxItemLen);
+                               if (ignoreCase)
+                                       cond = CompareNCaseInsensitive(word, item, lenWord);
+                               else
+                                       cond = strncmp(word, item, lenWord);
+                               if (0 != cond)
+                                       break;
+                               --pivot;
+                       }
+                       location = pivot;
+               } else if (cond < 0) {
+                       end = pivot - 1;
+               } else if (cond > 0) {
+                       start = pivot + 1;
+               }
+       }
+       if (location == -1 && autoHide)
+               Cancel();
+       else
+               lb.Select(location);
 }
 
index c1789ad7b6c88a9529674651ce31fd47183095bf..79d467529134261c3bc2f39bf72fa225b28dfda6 100644 (file)
@@ -1,56 +1,62 @@
 // Scintilla source code edit control
-// AutoComplete.h - defines the auto completion list box
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file AutoComplete.h
+ ** Defines the auto completion list box.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef AUTOCOMPLETE_H
 #define AUTOCOMPLETE_H
 
+/**
+ */
 class AutoComplete {
        bool active;
        char stopChars[256];
        char fillUpChars[256];
        char separator;
+
 public:
        bool ignoreCase;
        bool chooseSingle;
        ListBox lb;
        int posStart;
        int startLen;
-       // Should autocompletion be canceled if editor's currentPos <= startPos?
+       /// Should autocompletion be canceled if editor's currentPos <= startPos?
        bool cancelAtStartPos;
-       
+       bool autoHide;
+
        AutoComplete();
        ~AutoComplete();
 
-       // Is the auto completion list displayed?       
+       /// Is the auto completion list displayed?
        bool Active();
-       
-       // Display the auto completion list positioned to be near a character position
+
+       /// Display the auto completion list positioned to be near a character position
        void Start(Window &parent, int ctrlID, int position, int startLen_);
-       
-       // The stop chars are characters which, when typed, cause the auto completion list to disappear
+
+       /// The stop chars are characters which, when typed, cause the auto completion list to disappear
        void SetStopChars(const char *stopChars_);
        bool IsStopChar(char ch);
-       
-       // The fillup chars are characters which, when typed, fill up the selected word
+
+       /// The fillup chars are characters which, when typed, fill up the selected word
        void SetFillUpChars(const char *fillUpChars_);
        bool IsFillUpChar(char ch);
 
-       // The separator character is used when interpreting the list in SetList
+       /// The separator character is used when interpreting the list in SetList
        void SetSeparator(char separator_);
        char GetSeparator();
-       
-       // The list string contains a sequence of words separated by the separator character
+
+       /// The list string contains a sequence of words separated by the separator character
        void SetList(const char *list);
-       
+
        void Show();
        void Cancel();
-       
-       // Move the current list element by delta, scrolling appropriately
+
+       /// Move the current list element by delta, scrolling appropriately
        void Move(int delta);
-       
-       // Select a list element that starts with word as the current element
+
+       /// Select a list element that starts with word as the current element
        void Select(const char *word);
 };
 
index d22a96364567ff8329cb0af146d8a43bcf7df861..3422de69696a697a4952871abfe35c298f31731f 100644 (file)
@@ -1,10 +1,12 @@
 // Scintilla source code edit control
-// CallTip.cxx - code for displaying call tips
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file CallTip.cxx
+ ** Code for displaying call tips.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
 
 #include "Platform.h"
 
@@ -27,6 +29,7 @@ CallTip::CallTip() {
 }
 
 CallTip::~CallTip() {
+       font.Release();
        wCallTip.Destroy();
        delete []val;
        val = 0;
@@ -42,7 +45,7 @@ void CallTip::RefreshColourPalette(Palette &pal, bool want) {
 
 void CallTip::PaintCT(Surface *surfaceWindow) {
        if (!val)
-               return;
+               return ;
        PRectangle rcClientPos = wCallTip.GetClientPosition();
        PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left,
                                rcClientPos.bottom - rcClientPos.top);
@@ -117,7 +120,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
                                  const char *faceName, int size) {
        Surface surfaceMeasure;
        surfaceMeasure.Init();
-       int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72;
+       int deviceHeight = surfaceMeasure.DeviceHeightFont(size);
        font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false);
        if (val)
                delete []val;
@@ -146,10 +149,9 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
        int lineHeight = surfaceMeasure.Height(font);
        // Extra line for border and an empty line at top and bottom
        int height = lineHeight * numLines - surfaceMeasure.InternalLeading(font) + 2 + 2;
-       return PRectangle(pt.x -5, pt.y + lineHeight + 1, pt.x + width - 5, pt.y + lineHeight + 1 + height);
+       return PRectangle(pt.x -5, pt.y + 1, pt.x + width - 5, pt.y + 1 + height);
 }
 
-
 void CallTip::CallTipCancel() {
        inCallTipMode = false;
        if (wCallTip.Created()) {
index cb5bc29032fb3914d5740631fda935f3227c1b77..b38a4840abbd058b4fa15a8000895f51fe16664c 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// CallTip.h - interface to the call tip control
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file CallTip.h
+ ** Interface to the call tip control.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef CALLTIP_H
 #define CALLTIP_H
 
+/**
+ */
 class CallTip {
        int startHighlight;
        int endHighlight;
@@ -14,6 +18,7 @@ class CallTip {
        // Private so CallTip objects can not be copied
        CallTip(const CallTip &) {}
        CallTip &operator=(const CallTip &) { return *this; }
+
 public:
        Window wCallTip;
        Window wDraw;
@@ -28,19 +33,19 @@ public:
        CallTip();
        ~CallTip();
        
-       // Claim or accept palette entries for the colours required to paint a calltip
+       /// Claim or accept palette entries for the colours required to paint a calltip.
        void RefreshColourPalette(Palette &pal, bool want);
        
        void PaintCT(Surface *surfaceWindow);
        
-       // Setup the calltip and return a rectangle of the area required
+       /// Setup the calltip and return a rectangle of the area required.
        PRectangle CallTipStart(int pos, Point pt, const char *defn, 
                const char *faceName, int size);
                
        void CallTipCancel();
        
-       // Set a range of characters to be displayed in a highlight style.
-       // Commonly used to highlight the current parameter.
+       /// Set a range of characters to be displayed in a highlight style.
+       /// Commonly used to highlight the current parameter.
        void SetHighlight(int start, int end);
 };
 
index befec75fc34273b8e206543946730ed5542e082b..ecb5bc1801554749e8146743a134125639ffea2a 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// CellBuffer.cxx - manages a buffer of cells
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file CellBuffer.cxx
+ ** Manages a buffer of cells.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdio.h>
@@ -416,22 +418,19 @@ UndoHistory::~UndoHistory() {
 }
 
 void UndoHistory::EnsureUndoRoom() {
-       //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction);
-       if (currentAction >= 2) {
-               // Have to test that there is room for 2 more actions in the array
-               // as two actions may be created by this function
-               if (currentAction >= (lenActions - 2)) {
-                       // Run out of undo nodes so extend the array
-                       int lenActionsNew = lenActions * 2;
-                       Action *actionsNew = new Action[lenActionsNew];
-                       if (!actionsNew)
-                               return ;
-                       for (int act = 0; act <= currentAction; act++)
-                               actionsNew[act].Grab(&actions[act]);
-                       delete []actions;
-                       lenActions = lenActionsNew;
-                       actions = actionsNew;
-               }
+       // Have to test that there is room for 2 more actions in the array
+       // as two actions may be created by the calling function
+       if (currentAction >= (lenActions - 2)) {
+               // Run out of undo nodes so extend the array
+               int lenActionsNew = lenActions * 2;
+               Action *actionsNew = new Action[lenActionsNew];
+               if (!actionsNew)
+                       return ;
+               for (int act = 0; act <= currentAction; act++)
+                       actionsNew[act].Grab(&actions[act]);
+               delete []actions;
+               lenActions = lenActionsNew;
+               actions = actionsNew;
        }
 }
 
@@ -450,14 +449,27 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
                                currentAction++;
                        } else if (currentAction == savePoint) {
                                currentAction++;
-                       } else if ((at == removeAction) &&
-                                  ((position + lengthData * 2) != actPrevious.position)) {
-                               // Removals must be at same position to coalesce
-                               currentAction++;
                        } else if ((at == insertAction) &&
                                   (position != (actPrevious.position + actPrevious.lenData*2))) {
                                // Insertions must be immediately after to coalesce
                                currentAction++;
+                       } else if (!actions[currentAction].mayCoalesce) {
+                               // Not allowed to coalesce if this set
+                               currentAction++;
+                       } else if (at == removeAction) {
+                               if ((lengthData == 1) || (lengthData == 2)){
+                                       if ((position + lengthData * 2) == actPrevious.position) {
+                                               ; // Backspace -> OK
+                                       } else if (position == actPrevious.position) {
+                                               ; // Delete -> OK
+                                       } else {
+                                               // Removals must be at same position to coalesce
+                                               currentAction++;
+                                       }
+                               } else {
+                                       // Removals must be of one character to coalesce
+                                       currentAction++;
+                               }
                        } else {
                                //Platform::DebugPrintf("action coalesced\n");
                        }
@@ -582,6 +594,7 @@ CellBuffer::CellBuffer(int initialLength) {
        part2body = body + gaplen;
        readOnly = false;
        collectingUndo = true;
+       growSize = 4000;
 }
 
 CellBuffer::~CellBuffer() {
@@ -612,7 +625,9 @@ void CellBuffer::RoomFor(int insertionLength) {
        if (gaplen <= insertionLength) {
                //Platform::DebugPrintf("need room %d %d\n", gaplen, insertionLength);
                GapTo(length);
-               int newSize = size + insertionLength + 4000;
+               if (growSize * 6 < size)
+                       growSize *= 2;
+               int newSize = size + insertionLength + growSize;
                //Platform::DebugPrintf("moved gap %d\n", newSize);
                char *newBody = new char[newSize];
                memcpy(newBody, body, size);
@@ -733,6 +748,8 @@ bool CellBuffer::SetStyleAt(int position, char style, char mask) {
 bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mask) {
        int bytePos = position * 2 + 1;
        bool changed = false;
+       PLATFORM_ASSERT(lengthStyle == 0 ||
+               (lengthStyle > 0 && lengthStyle + position < length));
        while (lengthStyle--) {
                char curVal = ByteAt(bytePos);
                if ((curVal & mask) != style) {
@@ -779,7 +796,7 @@ int CellBuffer::LineStart(int line) {
        if (line < 0)
                return 0;
        else if (line > lv.lines)
-               return length;
+               return Length();
        else
                return lv.linesData[line].startPosition;
 }
@@ -930,7 +947,6 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
                        ignoreNL = true;        // First \n is not real deletion
                }
 
-
                char ch = chNext;
                for (int i = 0; i < deleteLength; i += 2) {
                        chNext = ' ';
@@ -948,7 +964,6 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
                                ignoreNL = false;       // Further \n are not real deletions
                        }
 
-
                        ch = chNext;
                }
                // May have to fix up end if last deletion causes cr to be next to lf
index 4a1ecb39899ba8023114ff0aaa8f1d6ed01b0694..b5c90f57a51b4f46433ff4bde1fa091641bebc1d 100644 (file)
@@ -1,28 +1,35 @@
 // Scintilla source code edit control
-// CellBuffer.h - manages the text of the document
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file CellBuffer.h
+ ** Manages the text of the document.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef CELLBUFFER_H
 #define CELLBUFFER_H
 
-// 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.
+ */
 struct MarkerHandleNumber {
        int handle;
        int number;
        MarkerHandleNumber *next;
 };
 
-// A marker handle set contains any number of MarkerHandleNumbers
+/**
+ * A marker handle set contains any number of MarkerHandleNumbers.
+ */
 class MarkerHandleSet {
        MarkerHandleNumber *root;
+
 public:
        MarkerHandleSet();
        ~MarkerHandleSet();
        int Length();
        int NumberFromHandle(int handle);
-       int MarkValue();        // Bit set of marker numbers
+       int MarkValue();        ///< Bit set of marker numbers.
        bool Contains(int handle);
        bool InsertHandle(int handle, int markerNum);
        void RemoveHandle(int handle);
@@ -30,8 +37,10 @@ public:
        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.
+/**
+ * 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;
@@ -39,7 +48,9 @@ struct LineData {
        }
 };
 
-// The line vector contains information about each of the lines in a cell buffer.
+/**
+ * The line vector contains information about each of the lines in a cell buffer.
+ */
 class LineVector {
 public:
        enum { growSize = 4000 };
@@ -48,22 +59,22 @@ public:
        int size;
        int *levels;
        int sizeLevels;
-       
-       // Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
+
+       /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
        int handleCurrent;
-       
+
        LineVector();
        ~LineVector();
        void Init();
 
        void Expand(int sizeNew);
        void ExpandLevels(int sizeNew=-1);
-    void ClearLevels();
+       void ClearLevels();
        void InsertValue(int pos, int value);
        void SetValue(int pos, int value);
        void Remove(int pos);
        int LineFromPosition(int pos);
-       
+
        int AddMark(int line, int marker);
        void MergeMarkers(int pos);
        void DeleteMark(int line, int markerNum);
@@ -71,9 +82,11 @@ public:
        int LineFromHandle(int markerHandle);
 };
 
-// Actions are used to store all the information required to perform one undo/redo step.
 enum actionType { insertAction, removeAction, startAction };
 
+/**
+ * Actions are used to store all the information required to perform one undo/redo step.
+ */
 class Action {
 public:
        actionType at;
@@ -89,6 +102,9 @@ public:
        void Grab(Action *source);
 };
 
+/**
+ *
+ */
 class UndoHistory {
        Action *actions;
        int lenActions;
@@ -98,25 +114,25 @@ class UndoHistory {
        int savePoint;
 
        void EnsureUndoRoom();
-       
+
 public:
        UndoHistory();
        ~UndoHistory();
-       
+
        void AppendAction(actionType at, int position, char *data, int length);
 
        void BeginUndoAction();
        void EndUndoAction();
        void DropUndoSequence();
        void DeleteUndoHistory();
-       
-       // The save point is a marker in the undo stack where the container has stated that 
-       // the buffer was saved. Undo and redo can move over the save point.
+
+       /// The save point is a marker in the undo stack where the container has stated that
+       /// the buffer was saved. Undo and redo can move over the save point.
        void SetSavePoint();
        bool IsSavePoint() const;
 
-       // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is 
-       // called that many times. Similarly for redo.
+       /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
+       /// called that many times. Similarly for redo.
        bool CanUndo() const;
        int StartUndo();
        const Action &GetUndoStep() const;
@@ -127,9 +143,11 @@ public:
        void CompletedRedoStep();
 };
 
-// Holder for an expandable array of characters that supports undo and line markers
-// Based on article "Data Structures in a Bit-Mapped Text Editor"
-// by Wilfred J. Hansen, Byte January 1987, page 183
+/**
+ * Holder for an expandable array of characters that supports undo and line markers.
+ * Based on article "Data Structures in a Bit-Mapped Text Editor"
+ * by Wilfred J. Hansen, Byte January 1987, page 183.
+ */
 class CellBuffer {
 private:
        char *body;
@@ -139,6 +157,7 @@ private:
        int gaplen;
        char *part2body;
        bool readOnly;
+       int growSize;
 
        bool collectingUndo;
        UndoHistory uh;
@@ -157,12 +176,12 @@ public:
 
        CellBuffer(int initialLength = 4000);
        ~CellBuffer();
-       
-       // Retrieving positions outside the range of the buffer works and returns 0
+
+       /// Retrieving positions outside the range of the buffer works and returns 0
        char CharAt(int position);
        void GetCharRange(char *buffer, int position, int lengthRetrieve);
        char StyleAt(int position);
-       
+
        int ByteLength();
        int Length();
        int Lines();
@@ -170,23 +189,23 @@ public:
        int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
        const char *InsertString(int position, char *s, int insertLength);
        void InsertCharStyle(int position, char ch, char style);
-       
-       // Setting styles for positions outside the range of the buffer is safe and has no effect.
-       // True is returned if the style of a character 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);
-       
+
        const char *DeleteChars(int position, int deleteLength);
 
        bool IsReadOnly();
        void SetReadOnly(bool set);
 
-       // The save point is a marker in the undo stack where the container has stated that 
-       // the buffer was saved. Undo and redo can move over the save point.
+       /// The save point is a marker in the undo stack where the container has stated that
+       /// the buffer was saved. Undo and redo can move over the save point.
        void SetSavePoint();
        bool IsSavePoint();
 
-       // Line marker functions
+       /// Line marker functions
        int AddMark(int line, int markerNum);
        void DeleteMark(int line, int markerNum);
        void DeleteMarkFromHandle(int markerHandle);
@@ -194,7 +213,7 @@ public:
        void DeleteAllMarks(int markerNum);
        int LineFromHandle(int markerHandle);
  
-       // Without undo
+       /// Actions without undo
        void BasicInsertString(int position, char *s, int insertLength);
        void BasicDeleteChars(int position, int deleteLength);
 
@@ -203,9 +222,9 @@ public:
        void BeginUndoAction();
        void EndUndoAction();
        void DeleteUndoHistory();
-       
-       // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is 
-       // called that many times. Similarly for redo.
+
+       /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
+       /// called that many times. Similarly for redo.
        bool CanUndo();
        int StartUndo();
        const Action &GetUndoStep() const;
@@ -214,14 +233,14 @@ public:
        int StartRedo();
        const Action &GetRedoStep() const;
        void PerformRedoStep();
-       
+
        int SetLineState(int line, int state);
        int GetLineState(int line);
        int GetMaxLineState();
-               
+
        int SetLevel(int line, int level);
        int GetLevel(int line);
-    void ClearLevels();
+       void ClearLevels();
 };
 
 #define CELL_SIZE      2
index 0558b4c3652911ed374a1a6f0f95b62b76edbb5c..1f146966502d34788ae6a6130662dff573e33f49 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// ContractionState.cxx - manages visibility of lines for folding
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ContractionState.cxx
+ ** Manages visibility of lines for folding.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Platform.h"
index 2c344efeea42ff96cfd98710b570dc26d4b84348..0d7881c7b227c1ae2dc93ff23d51dca471c4a8c9 100644 (file)
@@ -1,15 +1,19 @@
 // Scintilla source code edit control
-// ContractionState.h - manages visibility of lines for folding
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ContractionState.h
+ ** Manages visibility of lines for folding.
+ **/
+// Copyright 1998-2001 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
 
+/**
+ */
 class OneLine {
 public:
-       int displayLine;        // position within set of visible lines
-       int docLine;            // inverse of displayLine
+       int displayLine;        ///< Position within set of visible lines
+       int docLine;            ///< Inverse of @a displayLine
        bool visible;
        bool expanded;
        
@@ -17,6 +21,8 @@ public:
        virtual ~OneLine() {}
 };
 
+/**
+ */
 class ContractionState {
        void Grow(int sizeNew);
        enum { growSize = 4000 };
@@ -26,6 +32,7 @@ class ContractionState {
        int size;
        mutable bool valid;
        void MakeValid() const;
+
 public:
        ContractionState();
        virtual ~ContractionState();
index c883dd253f9a3bd1a5b65b6d0bd578e78fabefde..10403242b9378ffc64a181c3de46197a753fddbd 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Document.cxx - text document that handles notifications, DBCS, styling, words and end of line
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Document.cxx
+ ** Text document that handles notifications, DBCS, styling, words and end of line.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
 #include "SVector.h"
 #include "CellBuffer.h"
 #include "Document.h"
+#include "RESearch.h"
+
+// This is ASCII specific but is safe with chars >= 0x80
+inline bool isspacechar(unsigned char ch) {
+       return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
 
 Document::Document() {
        refCount = 0;
@@ -25,7 +33,6 @@ Document::Document() {
        dbcsCodePage = 0;
        stylingBits = 5;
        stylingBitsMask = 0x1F;
-       stylingPos = 0;
        stylingMask = 0;
        for (int ch = 0; ch < 256; ch++) {
                wordchars[ch] = isalnum(ch) || ch == '_';
@@ -36,8 +43,14 @@ Document::Document() {
        tabInChars = 8;
        indentInChars = 0;
        useTabs = true;
+       tabIndents = true;
+       backspaceUnindents = false;
        watchers = 0;
        lenWatchers = 0;
+
+       matchesValid = false;
+       pre = 0;
+       substituted = 0;
 }
 
 Document::~Document() {
@@ -47,6 +60,10 @@ Document::~Document() {
        delete []watchers;
        watchers = 0;
        lenWatchers = 0;
+       delete pre;
+       pre = 0;
+       delete []substituted;
+       substituted = 0;
 }
 
 // Increase reference count and return its previous value.
@@ -68,27 +85,27 @@ void Document::SetSavePoint() {
        NotifySavePoint(true);
 }
 
-int Document::AddMark(int line, int markerNum) { 
-       int prev = cb.AddMark(line, markerNum); 
+int Document::AddMark(int line, int markerNum) {
+       int prev = cb.AddMark(line, markerNum);
        DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
        NotifyModified(mh);
        return prev;
 }
 
-void Document::DeleteMark(int line, int markerNum) { 
-       cb.DeleteMark(line, markerNum); 
+void Document::DeleteMark(int line, int markerNum) {
+       cb.DeleteMark(line, markerNum);
        DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
        NotifyModified(mh);
 }
 
-void Document::DeleteMarkFromHandle(int markerHandle) { 
-       cb.DeleteMarkFromHandle(markerHandle); 
+void Document::DeleteMarkFromHandle(int markerHandle) {
+       cb.DeleteMarkFromHandle(markerHandle);
        DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
        NotifyModified(mh);
 }
 
-void Document::DeleteAllMarks(int markerNum) { 
-       cb.DeleteAllMarks(markerNum); 
+void Document::DeleteAllMarks(int markerNum) {
+       cb.DeleteAllMarks(markerNum);
        DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
        NotifyModified(mh);
 }
@@ -131,10 +148,11 @@ int Document::VCHomePosition(int position) {
                return startText;
 }
 
-int Document::SetLevel(int line, int level) { 
-       int prev = cb.SetLevel(line, level); 
+int Document::SetLevel(int line, int level) {
+       int prev = cb.SetLevel(line, level);
        if (prev != level) {
-               DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
+               DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
+                                  LineStart(line), 0, 0, 0);
                mh.line = line;
                mh.foldLevelNow = level;
                mh.foldLevelPrev = prev;
@@ -146,7 +164,7 @@ int Document::SetLevel(int line, int level) {
 static bool IsSubordinate(int levelStart, int levelTry) {
        if (levelTry & SC_FOLDLEVELWHITEFLAG)
                return true;
-       else 
+       else
                return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
 }
 
@@ -155,16 +173,16 @@ int Document::GetLastChild(int lineParent, int level) {
                level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK;
        int maxLine = LinesTotal();
        int lineMaxSubord = lineParent;
-       while (lineMaxSubord < maxLine-1) {
-               EnsureStyledTo(LineStart(lineMaxSubord+2));
-               if (!IsSubordinate(level, GetLevel(lineMaxSubord+1)))
+       while (lineMaxSubord < maxLine - 1) {
+               EnsureStyledTo(LineStart(lineMaxSubord + 2));
+               if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1)))
                        break;
                lineMaxSubord++;
        }
        if (lineMaxSubord > lineParent) {
-               if (level > (GetLevel(lineMaxSubord+1) & SC_FOLDLEVELNUMBERMASK)) {
-                       // Have chewed up some whitespace that belongs to a parent so seek back 
-                       if ((lineMaxSubord > lineParent) && (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) {
+               if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) {
+                       // Have chewed up some whitespace that belongs to a parent so seek back
+                       if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) {
                                lineMaxSubord--;
                        }
                }
@@ -174,15 +192,15 @@ int Document::GetLastChild(int lineParent, int level) {
 
 int Document::GetFoldParent(int line) {
        int level = GetLevel(line);
-       int lineLook = line-1;
+       int lineLook = line - 1;
        while ((lineLook > 0) && (
-               (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || 
-               ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
-       ) {
+                   (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
+                   ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
+             ) {
                lineLook--;
        }
        if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) &&
-               ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) {
+               ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) {
                return lineLook;
        } else {
                return -1;
@@ -241,12 +259,12 @@ int Document::LenChar(int pos) {
                if (ch < 0x80)
                        return 1;
                int len = 2;
-               if (ch >= (0x80+0x40+0x20))
+               if (ch >= (0x80 + 0x40 + 0x20))
                        len = 3;
                int lengthDoc = Length();
                if ((pos + len) > lengthDoc)
-                       return lengthDoc-pos;
-               else 
+                       return lengthDoc -pos;
+               else
                        return len;
        } else if (IsDBCS(pos)) {
                return 2;
@@ -292,7 +310,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
                                // ch is a trail byte
                                if (moveDir > 0)
                                        pos++;
-                               else 
+                               else
                                        pos--;
                                ch = static_cast<unsigned char>(cb.CharAt(pos));
                        }
@@ -314,6 +332,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
                                //Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-");
                        }
 
+
                        if (atLeadByte) {
                                // Position is between a lead byte and a trail byte
                                if (moveDir > 0)
@@ -338,9 +357,9 @@ void Document::ModifiedAt(int pos) {
 
 // Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
 void Document::DeleteChars(int pos, int len) {
-    if ((pos + len) > Length())
-        return;
-       if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
+       if ((pos + len) > Length())
+               return ;
+       if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
                enteredReadOnlyCount++;
                NotifyModifyAttempt();
                enteredReadOnlyCount--;
@@ -349,28 +368,31 @@ void Document::DeleteChars(int pos, int len) {
                enteredCount++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
-                DocModification(
-                    SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, 
-                    pos, len, 
-                    0, 0));
+                           DocModification(
+                               SC_MOD_BEFOREDELETE | SC_PERFORMED_USER,
+                               pos, len,
+                               0, 0));
                        int prevLinesTotal = LinesTotal();
                        bool startSavePoint = cb.IsSavePoint();
-                       const char *text = cb.DeleteChars(pos*2, len * 2);
+                       const char *text = cb.DeleteChars(pos * 2, len * 2);
                        if (startSavePoint && cb.IsCollectingUndo())
                                NotifySavePoint(!startSavePoint);
-                       ModifiedAt(pos);
+                       if ((pos < Length()) || (pos == 0))
+                               ModifiedAt(pos);
+                       else
+                               ModifiedAt(pos-1);
                        NotifyModified(
-                DocModification(
-                    SC_MOD_DELETETEXT | SC_PERFORMED_USER, 
-                    pos, len, 
-                    LinesTotal() - prevLinesTotal, text));
+                           DocModification(
+                               SC_MOD_DELETETEXT | SC_PERFORMED_USER,
+                               pos, len,
+                               LinesTotal() - prevLinesTotal, text));
                }
                enteredCount--;
        }
 }
 
 void Document::InsertStyledString(int position, char *s, int insertLength) {
-       if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
+       if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
                enteredReadOnlyCount++;
                NotifyModifyAttempt();
                enteredReadOnlyCount--;
@@ -379,10 +401,10 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
                enteredCount++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
-                DocModification(
-                    SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, 
-                    position / 2, insertLength / 2, 
-                    0, 0));
+                           DocModification(
+                               SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
+                               position / 2, insertLength / 2,
+                               0, 0));
                        int prevLinesTotal = LinesTotal();
                        bool startSavePoint = cb.IsSavePoint();
                        const char *text = cb.InsertString(position, s, insertLength);
@@ -390,10 +412,10 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
                                NotifySavePoint(!startSavePoint);
                        ModifiedAt(position / 2);
                        NotifyModified(
-                DocModification(
-                    SC_MOD_INSERTTEXT | SC_PERFORMED_USER, 
-                    position / 2, insertLength / 2, 
-                    LinesTotal() - prevLinesTotal, text));
+                           DocModification(
+                               SC_MOD_INSERTTEXT | SC_PERFORMED_USER,
+                               position / 2, insertLength / 2,
+                               LinesTotal() - prevLinesTotal, text));
                }
                enteredCount--;
        }
@@ -406,21 +428,21 @@ int Document::Undo() {
                bool startSavePoint = cb.IsSavePoint();
                int steps = cb.StartUndo();
                //Platform::DebugPrintf("Steps=%d\n", steps);
-               for (int step=0; step<steps; step++) {
+               for (int step = 0; step < steps; step++) {
                        int prevLinesTotal = LinesTotal();
                        const Action &action = cb.GetUndoStep();
                        if (action.at == removeAction) {
-                           NotifyModified(DocModification(
-                    SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
-            } else {
-                           NotifyModified(DocModification(
-                    SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
-            }
+                               NotifyModified(DocModification(
+                                                  SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
+                       } else {
+                               NotifyModified(DocModification(
+                                                  SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
+                       }
                        cb.PerformUndoStep();
                        int cellPosition = action.position / 2;
                        ModifiedAt(cellPosition);
                        newPos = cellPosition;
-                       
+
                        int modFlags = SC_PERFORMED_UNDO;
                        // With undo, an insertion action becomes a deletion notification
                        if (action.at == removeAction) {
@@ -429,12 +451,12 @@ int Document::Undo() {
                        } else {
                                modFlags |= SC_MOD_DELETETEXT;
                        }
-                       if (step == steps-1)
+                       if (step == steps - 1)
                                modFlags |= SC_LASTSTEPINUNDOREDO;
-                       NotifyModified(DocModification(modFlags, cellPosition, action.lenData, 
-                               LinesTotal() - prevLinesTotal, action.data));
+                       NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
+                                                      LinesTotal() - prevLinesTotal, action.data));
                }
-       
+
                bool endSavePoint = cb.IsSavePoint();
                if (startSavePoint != endSavePoint)
                        NotifySavePoint(endSavePoint);
@@ -449,20 +471,20 @@ int Document::Redo() {
                enteredCount++;
                bool startSavePoint = cb.IsSavePoint();
                int steps = cb.StartRedo();
-               for (int step=0; step<steps; step++) {
+               for (int step = 0; step < steps; step++) {
                        int prevLinesTotal = LinesTotal();
                        const Action &action = cb.GetRedoStep();
                        if (action.at == insertAction) {
-                           NotifyModified(DocModification(
-                    SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
-            } else {
-                           NotifyModified(DocModification(
-                    SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
-            }
+                               NotifyModified(DocModification(
+                                                  SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
+                       } else {
+                               NotifyModified(DocModification(
+                                                  SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
+                       }
                        cb.PerformRedoStep();
                        ModifiedAt(action.position / 2);
                        newPos = action.position / 2;
-                       
+
                        int modFlags = SC_PERFORMED_REDO;
                        if (action.at == insertAction) {
                                newPos += action.lenData;
@@ -470,13 +492,13 @@ int Document::Redo() {
                        } else {
                                modFlags |= SC_MOD_DELETETEXT;
                        }
-                       if (step == steps-1)
+                       if (step == steps - 1)
                                modFlags |= SC_LASTSTEPINUNDOREDO;
                        NotifyModified(
-                DocModification(modFlags, action.position / 2, action.lenData, 
-                               LinesTotal() - prevLinesTotal, action.data));
+                           DocModification(modFlags, action.position / 2, action.lenData,
+                                           LinesTotal() - prevLinesTotal, action.data));
                }
-       
+
                bool endSavePoint = cb.IsSavePoint();
                if (startSavePoint != endSavePoint)
                        NotifySavePoint(endSavePoint);
@@ -526,7 +548,7 @@ int Document::DelCharBack(int pos) {
                DeleteChars(pos - 2, 2);
                return pos - 2;
        } else if (SC_CP_UTF8 == dbcsCodePage) {
-               int startChar = MovePositionOutsideChar(pos-1, -1, false);
+               int startChar = MovePositionOutsideChar(pos - 1, -1, false);
                DeleteChars(startChar, pos - startChar);
                return startChar;
        } else if (IsDBCS(pos - 1)) {
@@ -568,13 +590,13 @@ int Document::GetLineIndentation(int line) {
        if ((line >= 0) && (line < LinesTotal())) {
                int lineStart = LineStart(line);
                int length = Length();
-               for (int i=lineStart;i<length;i++) {
+               for (int i = lineStart;i < length;i++) {
                        char ch = cb.CharAt(i);
                        if (ch == ' ')
                                indent++;
                        else if (ch == '\t')
                                indent = NextTab(indent, tabInChars);
-                       else 
+                       else
                                return indent;
                }
        }
@@ -596,8 +618,8 @@ void Document::SetLineIndentation(int line, int indent) {
 }
 
 int Document::GetLineIndentPosition(int line) {
-    if (line < 0)
-        return 0;
+       if (line < 0)
+               return 0;
        int pos = LineStart(line);
        int length = Length();
        while ((pos < length) && isindentchar(cb.CharAt(pos))) {
@@ -610,7 +632,7 @@ int Document::GetColumn(int pos) {
        int column = 0;
        int line = LineFromPosition(pos);
        if ((line >= 0) && (line < LinesTotal())) {
-               for (int i=LineStart(line);i<pos;i++) {
+               for (int i = LineStart(line);i < pos;i++) {
                        char ch = cb.CharAt(i);
                        if (ch == '\t')
                                column = NextTab(column, tabInChars);
@@ -640,7 +662,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
        BeginUndoAction();
        for (int pos = 0; pos < Length(); pos++) {
                if (cb.CharAt(pos) == '\r') {
-                       if (cb.CharAt(pos+1) == '\n') {
+                       if (cb.CharAt(pos + 1) == '\n') {
                                if (eolModeSet != SC_EOL_CRLF) {
                                        DeleteChars(pos, 2);
                                        if (eolModeSet == SC_EOL_CR)
@@ -677,7 +699,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
 }
 
 bool Document::IsWordChar(unsigned char ch) {
-       if ((SC_CP_UTF8 == dbcsCodePage) && (ch >0x80))
+       if ((SC_CP_UTF8 == dbcsCodePage) && (ch > 0x80))
                return true;
        return wordchars[ch];
 }
@@ -697,19 +719,19 @@ int Document::NextWordStart(int pos, int delta) {
        if (delta < 0) {
                while (pos > 0 && (cb.CharAt(pos - 1) == ' ' || cb.CharAt(pos - 1) == '\t'))
                        pos--;
-               if (isspace(cb.CharAt(pos - 1))) {      // Back up to previous line
-                       while (pos > 0 && isspace(cb.CharAt(pos - 1)))
+               if (isspacechar(cb.CharAt(pos - 1))) {  // Back up to previous line
+                       while (pos > 0 && isspacechar(cb.CharAt(pos - 1)))
                                pos--;
                } else {
                        bool startAtWordChar = IsWordChar(cb.CharAt(pos - 1));
-                       while (pos > 0 && !isspace(cb.CharAt(pos - 1)) && (startAtWordChar == IsWordChar(cb.CharAt(pos - 1))))
+                       while (pos > 0 && !isspacechar(cb.CharAt(pos - 1)) && (startAtWordChar == IsWordChar(cb.CharAt(pos - 1))))
                                pos--;
                }
        } else {
                bool startAtWordChar = IsWordChar(cb.CharAt(pos));
-               while (pos < (Length()) && isspace(cb.CharAt(pos)))
+               while (pos < (Length()) && isspacechar(cb.CharAt(pos)))
                        pos++;
-               while (pos < (Length()) && !isspace(cb.CharAt(pos)) && (startAtWordChar == IsWordChar(cb.CharAt(pos))))
+               while (pos < (Length()) && !isspacechar(cb.CharAt(pos)) && (startAtWordChar == IsWordChar(cb.CharAt(pos))))
                        pos++;
                while (pos < (Length()) && (cb.CharAt(pos) == ' ' || cb.CharAt(pos) == '\t'))
                        pos++;
@@ -717,6 +739,10 @@ int Document::NextWordStart(int pos, int delta) {
        return pos;
 }
 
+/**
+ * Check that the character before the given position
+ * is not a word character.
+ */
 bool Document::IsWordStartAt(int pos) {
        if (pos > 0) {
                return !IsWordChar(CharAt(pos - 1));
@@ -724,6 +750,10 @@ bool Document::IsWordStartAt(int pos) {
        return true;
 }
 
+/**
+ * Check that the character after the given position
+ * is not a word character.
+ */
 bool Document::IsWordEndAt(int pos) {
        if (pos < Length() - 1) {
                return !IsWordChar(CharAt(pos));
@@ -731,74 +761,233 @@ bool Document::IsWordEndAt(int pos) {
        return true;
 }
 
+/**
+ * Check that the given range is delimited by
+ * non word characters.
+ */
 bool Document::IsWordAt(int start, int end) {
        return IsWordStartAt(start) && IsWordEndAt(end);
 }
 
-// Find text in document, supporting both forward and backward
-// searches (just pass minPos > maxPos to do a backward search)
-// Has not been tested with backwards DBCS searches yet.
-long Document::FindText(int minPos, int maxPos, const char *s, 
-       bool caseSensitive, bool word, bool wordStart) {
-       bool forward = minPos <= maxPos;
-       int increment = forward ? 1 : -1;
-
-       // Range endpoints should not be inside DBCS characters, but just in case, move them.
-       int startPos = MovePositionOutsideChar(minPos, increment, false);
-       int endPos = MovePositionOutsideChar(maxPos, increment, false);
-       
-       // Compute actual search ranges needed
-       int lengthFind = strlen(s);
-       int endSearch = endPos;
-       if (startPos <= endPos) {
-               endSearch = endPos - lengthFind + 1;
-       }
-       //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
-       char firstChar = s[0];
-       if (!caseSensitive)
-               firstChar = static_cast<char>(toupper(firstChar));
-       int pos = startPos;
-       while (forward ? (pos < endSearch) : (pos >= endSearch)) {
-               char ch = CharAt(pos);
-               if (caseSensitive) {
-                       if (ch == firstChar) {
-                               bool found = true;
-                               for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
-                                       ch = CharAt(pos + posMatch);
-                                       if (ch != s[posMatch])
-                                               found = false;
-                               }
-                               if (found) {
-                                       if ((!word && !wordStart) ||
-                                               word && IsWordAt(pos, pos + lengthFind) ||
-                                               wordStart && IsWordStartAt(pos))
-                                               return pos;
-                               }
-                       }
+// The comparison and case changing functions here assume ASCII
+// or extended ASCII such as the normal Windows code page.
+
+static inline char MakeUpperCase(char ch) {
+       if (ch < 'a' || ch > 'z')
+               return ch;
+       else
+               return static_cast<char>(ch - 'a' + 'A');
+}
+
+static inline char MakeLowerCase(char ch) {
+       if (ch < 'A' || ch > 'Z')
+               return ch;
+       else
+               return static_cast<char>(ch - 'A' + 'a');
+}
+
+// Define a way for the Regular Expression code to access the document
+class DocumentIndexer : public CharacterIndexer {
+       Document *pdoc;
+       int end;
+public:
+DocumentIndexer(Document *pdoc_, int end_) :
+       pdoc(pdoc_), end(end_) {}
+
+       virtual char CharAt(int index) {
+               if (index < 0 || index >= end)
+                       return 0;
+               else
+                       return pdoc->CharAt(index);
+       }
+};
+
+/**
+ * Find text in document, supporting both forward and backward
+ * searches (just pass minPos > maxPos to do a backward search)
+ * Has not been tested with backwards DBCS searches yet.
+ */
+long Document::FindText(int minPos, int maxPos, const char *s,
+                        bool caseSensitive, bool word, bool wordStart, bool regExp,
+                        int *length) {
+       if (regExp) {
+               if (!pre)
+                       pre = new RESearch();
+               if (!pre)
+                       return -1;
+
+               int startPos;
+               int endPos;
+
+               if (minPos <= maxPos) {
+                       startPos = minPos;
+                       endPos = maxPos;
                } else {
-                       if (toupper(ch) == firstChar) {
-                               bool found = true;
-                               for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
-                                       ch = CharAt(pos + posMatch);
-                                       if (toupper(ch) != toupper(s[posMatch]))
-                                               found = false;
+                       startPos = maxPos;
+                       endPos = minPos;
+               }
+
+               // Range endpoints should not be inside DBCS characters, but just in case, move them.
+               startPos = MovePositionOutsideChar(startPos, 1, false);
+               endPos = MovePositionOutsideChar(endPos, 1, false);
+
+               const char *errmsg = pre->Compile(s, *length, caseSensitive);
+               if (errmsg) {
+                       return -1;
+               }
+               // Find a variable in a property file: \$(\([A-Za-z0-9_.]+\))
+               // Replace first '.' with '-' in each property file variable reference:
+               //     Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
+               //     Replace: $(\1-\2)
+               int lineRangeStart = LineFromPosition(startPos);
+               int lineRangeEnd = LineFromPosition(endPos);
+               if ((startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) {
+                       // the start position is at end of line or between line end characters.
+                       lineRangeStart++;
+                       startPos = LineStart(lineRangeStart);
+               }
+               int pos = -1;
+               int lenRet = 0;
+               char searchEnd = s[*length - 1];
+               if (*length == 1) {
+                       // These produce empty selections so nudge them on if needed
+                       if (s[0] == '^') {
+                               if (startPos == LineStart(lineRangeStart))
+                                       startPos++;
+                       } else if (s[0] == '$') {
+                               if ((startPos == LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd))
+                                       startPos = LineStart(lineRangeStart + 1);
+                       }
+                       lineRangeStart = LineFromPosition(startPos);
+                       lineRangeEnd = LineFromPosition(endPos);
+               }
+               for (int line = lineRangeStart; line <= lineRangeEnd; line++) {
+                       int startOfLine = LineStart(line);
+                       int endOfLine = LineEnd(line);
+                       if (line == lineRangeStart) {
+                               if ((startPos != startOfLine) && (s[0] == '^'))
+                                       continue;       // Can't match start of line if start position after start of line
+                               startOfLine = startPos;
+                       }
+                       if (line == lineRangeEnd) {
+                               if ((endPos != endOfLine) && (searchEnd == '$'))
+                                       continue;       // Can't match end of line if end position before end of line
+                               endOfLine = endPos;
+                       }
+                       DocumentIndexer di(this, endOfLine);
+                       int success = pre->Execute(di, startOfLine, endOfLine);
+                       if (success) {
+                               pos = pre->bopat[0];
+                               lenRet = pre->eopat[0] - pre->bopat[0];
+                               break;
+                       }
+               }
+               *length = lenRet;
+               return pos;
+
+       } else {
+
+               bool forward = minPos <= maxPos;
+               int increment = forward ? 1 : -1;
+
+               // Range endpoints should not be inside DBCS characters, but just in case, move them.
+               int startPos = MovePositionOutsideChar(minPos, increment, false);
+               int endPos = MovePositionOutsideChar(maxPos, increment, false);
+
+               // Compute actual search ranges needed
+               int lengthFind = *length;
+               if (lengthFind == -1)
+                       lengthFind = strlen(s);
+               int endSearch = endPos;
+               if (startPos <= endPos) {
+                       endSearch = endPos - lengthFind + 1;
+               }
+               //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
+               char firstChar = s[0];
+               if (!caseSensitive)
+                       firstChar = static_cast<char>(MakeUpperCase(firstChar));
+               int pos = startPos;
+               while (forward ? (pos < endSearch) : (pos >= endSearch)) {
+                       char ch = CharAt(pos);
+                       if (caseSensitive) {
+                               if (ch == firstChar) {
+                                       bool found = true;
+                                       for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
+                                               ch = CharAt(pos + posMatch);
+                                               if (ch != s[posMatch])
+                                                       found = false;
+                                       }
+                                       if (found) {
+                                               if ((!word && !wordStart) ||
+                                                       word && IsWordAt(pos, pos + lengthFind) ||
+                                                       wordStart && IsWordStartAt(pos))
+                                                       return pos;
+                                       }
                                }
-                               if (found) {
-                                       if (!(word && wordStart) ||
-                                               word && IsWordAt(pos, pos + lengthFind) ||
-                                               wordStart && IsWordStartAt(pos))
-                                               return pos;
+                       } else {
+                               if (MakeUpperCase(ch) == firstChar) {
+                                       bool found = true;
+                                       for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
+                                               ch = CharAt(pos + posMatch);
+                                               if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch]))
+                                                       found = false;
+                                       }
+                                       if (found) {
+                                               if ((!word && !wordStart) ||
+                                                       word && IsWordAt(pos, pos + lengthFind) ||
+                                                       wordStart && IsWordStartAt(pos))
+                                                       return pos;
+                                       }
                                }
                        }
-               }
-               pos += increment;
-               if (dbcsCodePage) {
-                       // Ensure trying to match from start of character
-                       pos = MovePositionOutsideChar(pos, increment, false);
+                       pos += increment;
+                       if (dbcsCodePage) {
+                               // Ensure trying to match from start of character
+                               pos = MovePositionOutsideChar(pos, increment, false);
+                       }
                }
        }
        //Platform::DebugPrintf("Not found\n");
-       return - 1;
+       return -1;
+}
+
+const char *Document::SubstituteByPosition(const char *text, int *length) {
+       if (!pre)
+               return 0;
+       delete []substituted;
+       substituted = 0;
+       DocumentIndexer di(this, Length());
+       if (!pre->GrabMatches(di))
+               return 0;
+       unsigned int lenResult = 0;
+       for (int i = 0; i < *length; i++) {
+               if ((text[i] == '\\') && (text[i + 1] >= '1' && text[i + 1] <= '9')) {
+                       unsigned int patNum = text[i + 1] - '0';
+                       lenResult += pre->eopat[patNum] - pre->bopat[patNum];
+                       i++;
+               } else {
+                       lenResult++;
+               }
+       }
+       substituted = new char[lenResult + 1];
+       if (!substituted)
+               return 0;
+       char *o = substituted;
+       for (int j = 0; j < *length; j++) {
+               if ((text[j] == '\\') && (text[j + 1] >= '1' && text[j + 1] <= '9')) {
+                       unsigned int patNum = text[j + 1] - '0';
+                       unsigned int len = pre->eopat[patNum] - pre->bopat[patNum];
+                       if (pre->pat[patNum])   // Will be null if try for a match that did not occur
+                               memcpy(o, pre->pat[patNum], len);
+                       o += len;
+                       j++;
+               } else {
+                       *o++ = text[j];
+               }
+       }
+       *o = '\0';
+       *length = lenResult;
+       return substituted;
 }
 
 int Document::LinesTotal() {
@@ -806,18 +995,18 @@ int Document::LinesTotal() {
 }
 
 void Document::ChangeCase(Range r, bool makeUpperCase) {
-       for (int pos=r.start; pos<r.end; pos++) {
+       for (int pos = r.start; pos < r.end; pos++) {
                char ch = CharAt(pos);
                if (dbcsCodePage && IsDBCS(pos)) {
                        pos += LenChar(pos);
                } else {
                        if (makeUpperCase) {
                                if (islower(ch)) {
-                                       ChangeChar(pos, static_cast<char>(toupper(ch)));
+                                       ChangeChar(pos, static_cast<char>(MakeUpperCase(ch)));
                                }
                        } else {
                                if (isupper(ch)) {
-                                       ChangeChar(pos, static_cast<char>(tolower(ch)));
+                                       ChangeChar(pos, static_cast<char>(MakeLowerCase(ch)));
                                }
                        }
                }
@@ -844,28 +1033,27 @@ void Document::SetWordChars(unsigned char *chars) {
 void Document::SetStylingBits(int bits) {
        stylingBits = bits;
        stylingBitsMask = 0;
-       for (int bit=0; bit<stylingBits; bit++) {
+       for (int bit = 0; bit < stylingBits; bit++) {
                stylingBitsMask <<= 1;
                stylingBitsMask |= 1;
        }
 }
 
 void Document::StartStyling(int position, char mask) {
-       stylingPos = position;
        stylingMask = mask;
+       endStyled = position;
 }
 
 void Document::SetStyleFor(int length, char style) {
        if (enteredCount == 0) {
                enteredCount++;
                int prevEndStyled = endStyled;
-               if (cb.SetStyleFor(stylingPos, length, style, stylingMask)) {
-                       DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, 
-                               prevEndStyled, length);
+               if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
+                       DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
+                                          prevEndStyled, length);
                        NotifyModified(mh);
                }
-               stylingPos += length;
-               endStyled = stylingPos;
+               endStyled += length;
                enteredCount--;
        }
 }
@@ -875,15 +1063,14 @@ void Document::SetStyles(int length, char *styles) {
                enteredCount++;
                int prevEndStyled = endStyled;
                bool didChange = false;
-               for (int iPos = 0; iPos < length; iPos++, stylingPos++) {
-                       if (cb.SetStyleAt(stylingPos, styles[iPos], stylingMask)) {
+               for (int iPos = 0; iPos < length; iPos++, endStyled++) {
+                       if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
                                didChange = true;
                        }
                }
-               endStyled = stylingPos;
                if (didChange) {
-                       DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, 
-                               prevEndStyled, endStyled - prevEndStyled);
+                       DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
+                                          prevEndStyled, endStyled - prevEndStyled);
                        NotifyModified(mh);
                }
                enteredCount--;
@@ -958,3 +1145,85 @@ void Document::NotifyModified(DocModification mh) {
                watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
        }
 }
+
+bool Document::IsWordPartSeparator(char ch) {
+       return ispunct(ch) && IsWordChar(ch);
+}
+
+int Document::WordPartLeft(int pos) {
+       if (pos > 0) {
+               --pos;
+               char startChar = cb.CharAt(pos);
+               if (IsWordPartSeparator(startChar)) {
+                       while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) {
+                               --pos;
+                       }
+               }
+               if (pos > 0) {
+                       startChar = cb.CharAt(pos);
+                       --pos;
+                       if (islower(startChar)) {
+                               while (pos > 0 && islower(cb.CharAt(pos)))
+                                       --pos;
+                               if (!isupper(cb.CharAt(pos)) && !islower(cb.CharAt(pos)))
+                                       ++pos;
+                       } else if (isupper(startChar)) {
+                               while (pos > 0 && isupper(cb.CharAt(pos)))
+                                       --pos;
+                               if (!isupper(cb.CharAt(pos)))
+                                       ++pos;
+                       } else if (isdigit(startChar)) {
+                               while (pos > 0 && isdigit(cb.CharAt(pos)))
+                                       --pos;
+                               if (!isdigit(cb.CharAt(pos)))
+                                       ++pos;
+                       } else if (ispunct(startChar)) {
+                               while (pos > 0 && ispunct(cb.CharAt(pos)))
+                                       --pos;
+                               if (!ispunct(cb.CharAt(pos)))
+                                       ++pos;
+                       } else if (isspacechar(startChar)) {
+                               while (pos > 0 && isspacechar(cb.CharAt(pos)))
+                                       --pos;
+                               if (!isspacechar(cb.CharAt(pos)))
+                                       ++pos;
+                       }
+               }
+       }
+       return pos;
+}
+
+int Document::WordPartRight(int pos) {
+       char startChar = cb.CharAt(pos);
+       int length = Length();
+       if (IsWordPartSeparator(startChar)) {
+               while (pos < length && IsWordPartSeparator(cb.CharAt(pos)))
+                       ++pos;
+               startChar = cb.CharAt(pos);
+       }
+       if (islower(startChar)) {
+               while (pos < length && islower(cb.CharAt(pos)))
+                       ++pos;
+       } else if (isupper(startChar)) {
+               if (islower(cb.CharAt(pos + 1))) {
+                       ++pos;
+                       while (pos < length && islower(cb.CharAt(pos)))
+                               ++pos;
+               } else {
+                       while (pos < length && isupper(cb.CharAt(pos)))
+                               ++pos;
+               }
+               if (islower(cb.CharAt(pos)) && isupper(cb.CharAt(pos - 1)))
+                       --pos;
+       } else if (isdigit(startChar)) {
+               while (pos < length && isdigit(cb.CharAt(pos)))
+                       ++pos;
+       } else if (ispunct(startChar)) {
+               while (pos < length && ispunct(cb.CharAt(pos)))
+                       ++pos;
+       } else if (isspacechar(startChar)) {
+               while (pos < length && isspacechar(cb.CharAt(pos)))
+                       ++pos;
+       }
+       return pos;
+}
index af477dd79bbc78a97206fcd46a4e451da4b403f0..394c8f94b0cb7b2af48a50cdb8f15cecc291f958 100644 (file)
@@ -1,36 +1,42 @@
 // Scintilla source code edit control
-// Document.h - text document that handles notifications, DBCS, styling, words and end of line
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Document.h
+ ** Text document that handles notifications, DBCS, styling, words and end of line.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef DOCUMENT_H
 #define DOCUMENT_H
 
-// 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.
+ */
 typedef int Position;
 const Position invalidPosition = -1;
 
-// The range class represents a range of text in a document.
-// The two values are not sorted as one end may be more significant than the other
-// as is the case for the selection where the end position is the position of the caret.
-// If either position is invalidPosition then the range is invalid and most operations will fail.
+/**
+ * The range class represents a range of text in a document.
+ * The two values are not sorted as one end may be more significant than the other
+ * as is the case for the selection where the end position is the position of the caret.
+ * If either position is invalidPosition then the range is invalid and most operations will fail.
+ */
 class Range {
 public:
        Position start;
        Position end;
-       
+
        Range(Position pos=0) : 
                start(pos), end(pos) {
        };
        Range(Position start_, Position end_) : 
                start(start_), end(end_) {
        };
-       
+
        bool Valid() const {
                return (start != invalidPosition) && (end != invalidPosition);
        }
-       
+
        bool Contains(Position pos) const {
                if (start < end) {
                        return (pos >= start && pos <= end);
@@ -38,11 +44,11 @@ public:
                        return (pos <= start && pos >= end);
                }
        }
-       
+
        bool Contains(Range other) const {
                return Contains(other.start) && Contains(other.end);
        }
-       
+
        bool Overlaps(Range other) const {
                return 
                Contains(other.start) ||
@@ -54,11 +60,14 @@ public:
 
 class DocWatcher;
 class DocModification;
+class RESearch;
 
+/**
+ */
 class Document {
 
 public:
-       // Used to pair watcher pointer with user data
+       /** Used to pair watcher pointer with user data. */
        class WatcherWithUserData {
        public:
                DocWatcher *watcher;
@@ -68,37 +77,42 @@ public:
                        userData = 0;
                }
        };
-       
+
 private:       
        int refCount;
        CellBuffer cb;
        bool wordchars[256];
-       int stylingPos;
        char stylingMask;
        int endStyled;
        int enteredCount;
        int enteredReadOnlyCount;
-       
+
        WatcherWithUserData *watchers;
        int lenWatchers;
-       
+
+       bool matchesValid;
+       RESearch *pre;
+       char *substituted;
+
 public:
        int stylingBits;
        int stylingBitsMask;
-       
+
        int eolMode;
-       // dbcsCodePage can also be SC_CP_UTF8 to enable UTF-8 mode
+       /// Can also be SC_CP_UTF8 to enable UTF-8 mode
        int dbcsCodePage;
        int tabInChars;
        int indentInChars;
        bool useTabs;
-       
+       bool tabIndents;
+       bool backspaceUnindents;
+
        Document();
        virtual ~Document();
-       
+
        int AddRef();
        int Release();
-       
+
        int LineFromPosition(int pos);
        int ClampPositionIntoDocument(int pos);
        bool IsCrLf(int pos);
@@ -165,12 +179,13 @@ public:
        int NextWordStart(int pos, int delta);
        int Length() { return cb.Length(); }
        long FindText(int minPos, int maxPos, const char *s, 
-               bool caseSensitive, bool word, bool wordStart);
+               bool caseSensitive, bool word, bool wordStart, bool regExp, int *length);
        long FindText(int iMessage, unsigned long wParam, long lParam);
+       const char *SubstituteByPosition(const char *text, int *length);
        int LinesTotal();
-       
+
        void ChangeCase(Range r, bool makeUpperCase);
-       
+
        void SetWordChars(unsigned char *chars);
        void SetStylingBits(int bits);
        void StartStyling(int position, char mask);
@@ -182,12 +197,16 @@ public:
        int SetLineState(int line, int state) { return cb.SetLineState(line, state); }
        int GetLineState(int line) { return cb.GetLineState(line); }
        int GetMaxLineState() { return cb.GetMaxLineState(); }
-               
+
        bool AddWatcher(DocWatcher *watcher, void *userData);
        bool RemoveWatcher(DocWatcher *watcher, void *userData);
        const WatcherWithUserData *GetWatchers() const { return watchers; }
        int GetLenWatchers() const { return lenWatchers; }
-       
+
+       bool IsWordPartSeparator(char ch);
+       int WordPartLeft(int pos);
+       int WordPartRight(int pos);
+
 private:
        bool IsDBCS(int pos);
        bool IsWordChar(unsigned char ch);
@@ -195,24 +214,26 @@ private:
        bool IsWordEndAt(int pos);
        bool IsWordAt(int start, int end);
        void ModifiedAt(int pos);
-       
+
        void NotifyModifyAttempt();
        void NotifySavePoint(bool atSavePoint);
        void NotifyModified(DocModification mh);
-       
+
        int IndentSize() { return indentInChars ? indentInChars : tabInChars; }
 };
 
-// To optimise processing of document modifications by DocWatchers, a hint is passed indicating the 
-// scope of the change.
-// If the DocWatcher is a document view then this can be used to optimise screen updating.
+/**
+ * To optimise processing of document modifications by DocWatchers, a hint is passed indicating the
+ * scope of the change.
+ * If the DocWatcher is a document view then this can be used to optimise screen updating.
+ */
 class DocModification {
 public:
        int modificationType;
        int position;
        int length;
-       int linesAdded; // Negative if lines deleted
-       const char *text;       // Only valid for changes to text, not for changes to style
+       int linesAdded; /**< Negative if lines deleted. */
+       const char *text;       /**< Only valid for changes to text, not for changes to style. */
        int line;
        int foldLevelNow;
        int foldLevelPrev;
@@ -239,12 +260,14 @@ public:
                foldLevelPrev(0) {}
 };
 
-// A class that wants to receive notifications from a Document must be derived from DocWatcher 
-// and implement the notification methods. It can then be added to the watcher list with AddWatcher.
+/**
+ * A class that wants to receive notifications from a Document must be derived from DocWatcher
+ * and implement the notification methods. It can then be added to the watcher list with AddWatcher.
+ */
 class DocWatcher {
 public:
        virtual ~DocWatcher() {}
-       
+
        virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0;
        virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0;
        virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0;
index 6828e37c3f3c0640e3233a7753ec9a5129bac341..c187f2a442b781cb80721729fa9960150b0731a7 100644 (file)
@@ -1,11 +1,13 @@
-// SciTE - Scintilla based Text Editor
-// Accessor.cxx - rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file DocumentAccessor.cxx
+ ** Rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 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 <ctype.h>
 #include <stdio.h>
 
 #include "Platform.h"
 DocumentAccessor::~DocumentAccessor() {
 }
 
-#if PLAT_WIN 
+#if PLAT_WIN
 bool DocumentAccessor::InternalIsLeadByte(char ch) {
        if (SC_CP_UTF8 == codePage)
                // For lexing, all characters >= 0x80 are treated the
                // same so none is considered a lead byte.
-               return false;   
+               return false;
        else
                return IsDBCSLeadByteEx(codePage, ch);
 }
@@ -36,7 +38,7 @@ bool DocumentAccessor::InternalIsLeadByte(char ch) {
 bool DocumentAccessor::InternalIsLeadByte(char) {
        return false;
 }
-#endif 
+#endif
 
 void DocumentAccessor::Fill(int position) {
        if (lenDoc == -1)
@@ -70,10 +72,10 @@ int DocumentAccessor::LevelAt(int line) {
        return pdoc->GetLevel(line);
 }
 
-int DocumentAccessor::Length() { 
-       if (lenDoc == -1) 
+int DocumentAccessor::Length() {
+       if (lenDoc == -1)
                lenDoc = pdoc->Length();
-       return lenDoc; 
+       return lenDoc;
 }
 
 int DocumentAccessor::GetLineState(int line) {
@@ -132,12 +134,12 @@ void DocumentAccessor::Flush() {
 int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
        int end = Length();
        int spaceFlags = 0;
-       
-       // Determines the indentation level of the current line and also checks for consistent 
+
+       // Determines the indentation level of the current line and also checks for consistent
        // indentation compared to the previous line.
-       // Indentation is judged consistent when the indentation whitespace of each line lines 
+       // Indentation is judged consistent when the indentation whitespace of each line lines
        // the same or the indentation of one line is a prefix of the other.
-       
+
        int pos = LineStart(line);
        char ch = (*this)[pos];
        int indent = 0;
@@ -164,11 +166,12 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI
                }
                ch = (*this)[++pos];
        }
-       
+
        *flags = spaceFlags;
        indent += SC_FOLDLEVELBASE;
        // if completely empty line or the start of a comment...
-       if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
+       if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || 
+               (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
                return indent | SC_FOLDLEVELWHITEFLAG;
        else
                return indent;
index ccc05fee9fc4a9ba8f7f05695a65214ec1122374..48742a9b40564e3a1a7093a4ab889a458c14cedf 100644 (file)
@@ -1,16 +1,24 @@
-// DocumentAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file DocumentAccessor.h
+ ** Implementation of BufferAccess and StylingAccess on a Scintilla
+ ** rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 class Document;
 
+/**
+ */
 class DocumentAccessor : public Accessor {
        // Private so DocumentAccessor objects can not be copied
        DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {}
        DocumentAccessor &operator=(const DocumentAccessor &) { return *this; }
+
 protected:
        Document *pdoc;
        PropSet &props;
+       WindowID id;
        int lenDoc;
 
        char styleBuf[bufferSize];
@@ -21,9 +29,10 @@ protected:
 
        bool InternalIsLeadByte(char ch);
        void Fill(int position);
+
 public:
-       DocumentAccessor(Document *pdoc_, PropSet &props_) : 
-               Accessor(), pdoc(pdoc_), props(props_), 
+       DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) : 
+               Accessor(), pdoc(pdoc_), props(props_), id(id_),
                lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
        }
        ~DocumentAccessor();
@@ -38,6 +47,10 @@ public:
        int GetPropertyInt(const char *key, int defaultValue=0) { 
                return props.GetInt(key, defaultValue); 
        }
+       char *GetProperties() {
+               return props.ToString();
+       }
+       WindowID GetWindow() { return id; }
 
        void StartAt(unsigned int start, char chMask=31);
        void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
index 87b579bbc1bb6634b90f4bcf421375fa08292e3c..5b72ac579d28886b60c18035c20d7f1ddd955c85 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Editor.cxx - main code for the edit control
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Editor.cxx
+ ** Main code for the edit control.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
@@ -14,7 +16,7 @@
 
 #if PLAT_WX || PLAT_GTK
 #include "WinDefs.h"
-#endif
+#endif 
 
 #include "ContractionState.h"
 #include "SVector.h"
@@ -28,7 +30,7 @@
 #include "Editor.h"
 
 Caret::Caret() :
-active(true), on(true), period(500) {}
+active(false), on(false), period(500) {}
 
 Timer::Timer() :
 ticking(false), ticksToWait(0), tickerID(0) {}
@@ -40,13 +42,20 @@ Editor::Editor() {
 
        printMagnification = 0;
        printColourMode = SC_PRINT_NORMAL;
+       cursorMode = SC_CURSORNORMAL;
 
+       hasFocus = false;
        hideSelection = false;
        inOverstrike = false;
+       errorStatus = 0;
+       mouseDownCaptures = true;
 
        bufferedDraw = true;
 
        lastClickTime = 0;
+       dwellDelay = SC_TIME_FOREVER;
+       ticksToDwell = SC_TIME_FOREVER;
+       dwelling = false;
        ptMouseLast.x = 0;
        ptMouseLast.y = 0;
        firstExpose = true;
@@ -71,6 +80,9 @@ Editor::Editor() {
        caretPolicy = CARET_SLOP;
        caretSlop = 0;
 
+       visiblePolicy = VISIBLE_SLOP;
+       visibleSlop = 0;
+
        searchAnchor = 0;
 
        ucWheelScrollLines = 0;
@@ -83,6 +95,10 @@ Editor::Editor() {
        currentPos = 0;
        anchor = 0;
 
+       targetStart = 0;
+       targetEnd = 0;
+       searchFlags = 0;
+
        topLine = 0;
        posTopLine = 0;
 
@@ -106,7 +122,7 @@ Editor::Editor() {
 
 #ifdef MACRO_SUPPORT
        recordingMacro = 0;
-#endif
+#endif 
        foldFlags = 0;
 }
 
@@ -161,7 +177,7 @@ void Editor::RefreshStyleData() {
 }
 
 PRectangle Editor::GetClientRectangle() {
-       return wDraw.GetClientPosition();
+       return wMain.GetClientPosition();
 }
 
 PRectangle Editor::GetTextRectangle() {
@@ -215,15 +231,17 @@ const char *ControlCharacterString(unsigned char ch) {
        }
 }
 
-Point Editor::LocationFromPosition(unsigned int pos) {
+Point Editor::LocationFromPosition(int pos) {
+       Point pt;
        RefreshStyleData();
+       if (pos == INVALID_POSITION)
+               return pt;
        int line = pdoc->LineFromPosition(pos);
        int lineVisible = cs.DisplayFromDoc(line);
        //Platform::DebugPrintf("line=%d\n", line);
        Surface surface;
        surface.Init();
        surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage);
-       Point pt;
        pt.y = (lineVisible - topLine) * vs.lineHeight;         // + half a lineheight?
        unsigned int posLineStart = pdoc->LineStart(line);
        LineLayout ll;
@@ -237,7 +255,7 @@ Point Editor::LocationFromPosition(unsigned int pos) {
        return pt;
 }
 
-int Editor::XFromPosition(unsigned int pos) {
+int Editor::XFromPosition(int pos) {
        Point pt = LocationFromPosition(pos);
        return pt.x - vs.fixedColumnWidth + xOffset;
 }
@@ -262,7 +280,6 @@ int Editor::PositionFromLocation(Point pt) {
                return 0;
        if (line >= pdoc->LinesTotal())
                return pdoc->Length();
-       //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine);
        Surface surface;
        surface.Init();
        surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage);
@@ -280,6 +297,42 @@ int Editor::PositionFromLocation(Point pt) {
        return ll.numCharsInLine + posLineStart;
 }
 
+// Like PositionFromLocation but INVALID_POSITION returned when not near any text.
+int Editor::PositionFromLocationClose(Point pt) {
+       RefreshStyleData();
+       PRectangle rcClient = GetTextRectangle();
+       if (!rcClient.Contains(pt))
+               return INVALID_POSITION;
+       if (pt.x < vs.fixedColumnWidth)
+               return INVALID_POSITION;
+       if (pt.y < 0)
+               return INVALID_POSITION;
+       pt.x = pt.x - vs.fixedColumnWidth + xOffset;
+       int line = cs.DocFromDisplay(pt.y / vs.lineHeight + topLine);
+       if (pt.y < 0) { // Division rounds towards 0
+               line = cs.DocFromDisplay((pt.y - (vs.lineHeight - 1)) / vs.lineHeight + topLine);
+       }
+       if (line < 0)
+               return INVALID_POSITION;
+       if (line >= pdoc->LinesTotal())
+               return INVALID_POSITION;
+       Surface surface;
+       surface.Init();
+       surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage);
+       unsigned int posLineStart = pdoc->LineStart(line);
+
+       LineLayout ll;
+       LayoutLine(line, &surface, vs, ll);
+       for (int i = 0; i < ll.numCharsInLine; i++) {
+               if (pt.x < ((ll.positions[i] + ll.positions[i + 1]) / 2) ||
+                       ll.chars[i] == '\r' || ll.chars[i] == '\n') {
+                       return i + posLineStart;
+               }
+       }
+
+       return INVALID_POSITION;
+}
+
 int Editor::PositionFromLineX(int line, int x) {
        RefreshStyleData();
        if (line >= pdoc->LinesTotal())
@@ -303,27 +356,27 @@ int Editor::PositionFromLineX(int line, int x) {
 }
 
 void Editor::RedrawRect(PRectangle rc) {
-    //Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
-
-    // Clip the redraw rectangle into the client area
-    PRectangle rcClient = GetClientRectangle();
-    if (rc.top < rcClient.top)
-        rc.top = rcClient.top;
-    if (rc.bottom > rcClient.bottom)
-        rc.bottom = rcClient.bottom;
-    if (rc.left < rcClient.left)
-        rc.left = rcClient.left;
-    if (rc.right > rcClient.right)
-        rc.right = rcClient.right;
+       //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom);
 
-    if ((rc.bottom > rc.top) && (rc.right > rc.left)) {
-        wDraw.InvalidateRectangle(rc);
-    }
+       // Clip the redraw rectangle into the client area
+       PRectangle rcClient = GetClientRectangle();
+       if (rc.top < rcClient.top)
+               rc.top = rcClient.top;
+       if (rc.bottom > rcClient.bottom)
+               rc.bottom = rcClient.bottom;
+       if (rc.left < rcClient.left)
+               rc.left = rcClient.left;
+       if (rc.right > rcClient.right)
+               rc.right = rcClient.right;
+
+       if ((rc.bottom > rc.top) && (rc.right > rc.left)) {
+               wMain.InvalidateRectangle(rc);
+       }
 }
 
 void Editor::Redraw() {
        //Platform::DebugPrintf("Redraw all\n");
-       wDraw.InvalidateAll();
+       wMain.InvalidateAll();
 }
 
 void Editor::RedrawSelMargin() {
@@ -332,7 +385,7 @@ void Editor::RedrawSelMargin() {
        } else {
                PRectangle rcSelMargin = GetClientRectangle();
                rcSelMargin.right = vs.fixedColumnWidth;
-               wDraw.InvalidateRectangle(rcSelMargin);
+               wMain.InvalidateRectangle(rcSelMargin);
        }
 }
 
@@ -384,7 +437,6 @@ int Editor::SelectionStart(int line) {
                        return -1;
                } else {
                        int minX = Platform::Minimum(xStartSelect, xEndSelect);
-                       //return PositionFromLineX(line, minX + vs.fixedColumnWidth - xOffset);
                        return PositionFromLineX(line, minX);
                }
        }
@@ -455,6 +507,7 @@ void Editor::SetSelection(int currentPos_) {
 }
 
 void Editor::SetEmptySelection(int currentPos_) {
+       selType = selStream;
        SetSelection(currentPos_, currentPos_);
 }
 
@@ -485,6 +538,7 @@ int Editor::MovePositionTo(int newPos, bool extend) {
        }
        EnsureCaretVisible();
        ShowCaretAtCurrentPosition();
+       NotifyMove(newPos);
        return 0;
 }
 
@@ -541,7 +595,7 @@ void Editor::HorizontalScrollTo(int xPos) {
        if (xOffset < 0)
                xOffset = 0;
        SetHorizontalScrollPos();
-       Redraw();
+       RedrawRect(GetClientRectangle());
 }
 
 void Editor::MoveCaretInsideView() {
@@ -557,9 +611,10 @@ void Editor::MoveCaretInsideView() {
        }
 }
 
-void Editor::EnsureCaretVisible(bool useMargin) {
-       //Platform::DebugPrintf("EnsureCaretVisible %d\n", xOffset);
+void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
+       //Platform::DebugPrintf("EnsureCaretVisible %d %s\n", xOffset, useMargin ? " margin" : " ");
        PRectangle rcClient = GetTextRectangle();
+       //int rcClientFullWidth = rcClient.Width();
        int posCaret = currentPos;
        if (posDrag >= 0)
                posCaret = posDrag;
@@ -569,17 +624,26 @@ void Editor::EnsureCaretVisible(bool useMargin) {
        int lineCaret = cs.DisplayFromDoc(pdoc->LineFromPosition(posCaret));
        ptBottomCaret.y += vs.lineHeight - 1;
 
-       // Ensure the caret is reasonably visible in context.
+       // Ensure the caret is reasonably visible in context:
+       // xMargin must equal to xCaretMargin, with a minimum of 2 and a maximum of
+       // slightly less than half the width of the text area.
        int xMargin = Platform::Clamp(xCaretMargin, 2, Platform::Maximum(rcClient.Width() - 10, 4) / 2);
        if (!useMargin)
                xMargin = 2;
 
-       // Ensure certain amount of text visible on both sides of caretSo move if caret just on edge
-       rcClient.left = rcClient.left + xMargin;
-       rcClient.right = rcClient.right - xMargin;
+       // If we scroll the display, we use a minimum amount of xMargin.
+       int offsetLeft = rcClient.left + xMargin;
+       int offsetRight = rcClient.right - xMargin;
+       // If we are in XJUMPS mode, then when the margin is reached, the 
+       // offset jumps so that it won't need to move agin for a while.
+       if (!(caretPolicy & CARET_XJUMPS)) {
+               rcClient.left = offsetLeft;
+               rcClient.right = offsetRight;
+       }
 
-       if (!rcClient.Contains(pt) || !rcClient.Contains(ptBottomCaret) || (caretPolicy & CARET_STRICT)) {
-               //Platform::DebugPrintf("EnsureCaretVisible move, (%d,%d) (%d,%d)\n", pt.x, pt.y, rcClient.left, rcClient.right);
+       // Vertical positioning
+       if (vert && (!rcClient.Contains(pt) || !rcClient.Contains(ptBottomCaret) || (caretPolicy & CARET_STRICT))) {
+               //Platform::DebugPrintf("EnsureCaretVisible move, (%d,%d)(%d,%d)\n", pt.x, pt.y, rcClient.left, rcClient.right);
                // It should be possible to scroll the window to show the caret,
                // but this fails to remove the caret on GTK+
                if (caretPolicy & CARET_SLOP) {
@@ -600,12 +664,16 @@ void Editor::EnsureCaretVisible(bool useMargin) {
                                Redraw();
                        }
                }
+       }
+
+       // Horizontal positioning
+       if (horiz) {
                int xOffsetNew = xOffset;
                if (pt.x < rcClient.left) {
-                       xOffsetNew = xOffset - (rcClient.left - pt.x);
-               } else if (pt.x >= rcClient.right) {
-                       xOffsetNew = xOffset + (pt.x - rcClient.right);
-                       int xOffsetEOL = xOffset + (ptEOL.x - rcClient.right) - xMargin + 2;
+                       xOffsetNew = xOffset - (offsetLeft - pt.x);
+               } else if ((!(caretPolicy & CARET_XEVEN) && ((xOffset > 0) && useMargin)) || pt.x >= rcClient.right) {
+                       xOffsetNew = xOffset + (pt.x - offsetRight);
+                       int xOffsetEOL = xOffset + (ptEOL.x - offsetRight) - xMargin + 2;
                        //Platform::DebugPrintf("Margin %d %d\n", xOffsetNew, xOffsetEOL);
                        // Ensure don't scroll out into empty space
                        if (xOffsetNew > xOffsetEOL)
@@ -622,10 +690,10 @@ void Editor::EnsureCaretVisible(bool useMargin) {
 }
 
 void Editor::ShowCaretAtCurrentPosition() {
-       if (!wMain.HasFocus()) {
+       if (!hasFocus) {
                caret.active = false;
                caret.on = false;
-               return ;
+               return;
        }
        caret.active = true;
        caret.on = true;
@@ -644,15 +712,21 @@ void Editor::InvalidateCaret() {
                InvalidateRange(currentPos, currentPos + 1);
 }
 
+int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) {
+       if (vs.markers[markerCheck].markType == SC_MARK_EMPTY)
+               return markerDefault;
+       return markerCheck;
+}
+
 void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
        if (vs.fixedColumnWidth == 0)
-               return ;
+               return;
 
        PRectangle rcMargin = GetClientRectangle();
        rcMargin.right = vs.fixedColumnWidth;
 
        if (!rc.Intersects(rcMargin))
-               return ;
+               return;
 
        Surface *surface;
        if (bufferedDraw) {
@@ -691,15 +765,89 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
                        int line = cs.DocFromDisplay(visibleLine);
                        int yposScreen = 0;
 
+                       // Work out whether the top line is whitespace located after a 
+                       // lessening of fold level which implies a 'fold tail' but which should not
+                       // be displayed until the last of a sequence of whitespace.
+                       bool needWhiteClosure = false;  
+                       int level = pdoc->GetLevel(line);
+                       if (level & SC_FOLDLEVELWHITEFLAG) {
+                               int lineBack = line;
+                               int levelPrev = level;
+                               while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) {
+                                       lineBack--;
+                                       levelPrev = pdoc->GetLevel(lineBack);
+                               }
+                               if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) {
+                                       if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK))
+                                               needWhiteClosure = true;
+                               }
+                       }
+                       
+                       // Old code does not know about new markers needed to distinguish all cases
+                       int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, 
+                               SC_MARKNUM_FOLDEROPEN);
+                       int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND, 
+                               SC_MARKNUM_FOLDER);
+                       
                        while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) {
+
+                               // Decide which fold indicator should be displayed
+                               level = pdoc->GetLevel(line);
+                               int levelNext = pdoc->GetLevel(line+1);
                                int marks = pdoc->GetMark(line);
-                               if (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) {
+                               int levelNum = level & SC_FOLDLEVELNUMBERMASK;
+                               int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK;
+                               if (level & SC_FOLDLEVELHEADERFLAG) {
                                        if (cs.GetExpanded(line)) {
-                                               marks |= 1 << SC_MARKNUM_FOLDEROPEN;
+                                               if (levelNum == SC_FOLDLEVELBASE)
+                                                       marks |= 1 << SC_MARKNUM_FOLDEROPEN;
+                                               else 
+                                                       marks |= 1 << folderOpenMid;
                                        } else {
-                                               marks |= 1 << SC_MARKNUM_FOLDER;
+                                               if (levelNum == SC_FOLDLEVELBASE)
+                                                       marks |= 1 << SC_MARKNUM_FOLDER;
+                                               else
+                                                       marks |= 1 << folderEnd;
+                                       }
+                                       needWhiteClosure = false;
+                               } else if (level & SC_FOLDLEVELWHITEFLAG) {
+                                       if (needWhiteClosure) {
+                                               if (levelNext & SC_FOLDLEVELWHITEFLAG) {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERSUB;
+                                               } else if (levelNum > SC_FOLDLEVELBASE) {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+                                                       needWhiteClosure = false;
+                                               } else {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+                                                       needWhiteClosure = false;
+                                               }
+                                       } else if (levelNum > SC_FOLDLEVELBASE) {
+                                               if (levelNextNum < levelNum) {
+                                                       if (levelNextNum > SC_FOLDLEVELBASE) {
+                                                               marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+                                                       } else {
+                                                               marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+                                                       }
+                                               } else {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERSUB;
+                                               }
+                                       }
+                               } else if (levelNum > SC_FOLDLEVELBASE) {
+                                       if (levelNextNum < levelNum) {
+                                               needWhiteClosure = false;
+                                               if (levelNext & SC_FOLDLEVELWHITEFLAG) {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERSUB;
+                                                       needWhiteClosure = true;
+                                               } else if (levelNextNum > SC_FOLDLEVELBASE) {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+                                               } else {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+                                               }
+                                       } else {
+                                               marks |= 1 << SC_MARKNUM_FOLDERSUB;
                                        }
                                }
+
                                marks &= vs.ms[margin].mask;
                                PRectangle rcMarker = rcSelMargin;
                                rcMarker.top = yposScreen;
@@ -726,8 +874,6 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
                                if (marks) {
                                        for (int markBit = 0; (markBit < 32) && marks; markBit++) {
                                                if (marks & 1) {
-                                                       rcMarker.top++;
-                                                       rcMarker.bottom--;
                                                        vs.markers[markBit].Draw(surface, rcMarker);
                                                }
                                                marks >>= 1;
@@ -763,6 +909,11 @@ void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) {
        surface->LineTo(xhead, ymid + ydiff);
 }
 
+/**
+ * Fill in the LineLayout data for the given line.
+ * Copy the given @a line and its styles from the document into local arrays.
+ * Also determine the x position at which each character starts.
+ */
 void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout &ll) {
        int numCharsInLine = 0;
        int posLineStart = pdoc->LineStart(line);
@@ -771,9 +922,11 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
        char styleByte = 0;
        int styleMask = pdoc->stylingBitsMask;
        ll.xHighlightGuide = 0;
+       // If the line is very long, limit the treatment to a length that should fit in the viewport
        if (posLineEnd > (posLineStart + LineLayout::maxLineLength)) {
                posLineEnd = posLineStart + LineLayout::maxLineLength;
        }
+       // Fill base line layout
        for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) {
                char chDoc = pdoc->CharAt(charInDoc);
                styleByte = pdoc->StyleAt(charInDoc);
@@ -781,6 +934,10 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                        ll.chars[numCharsInLine] = chDoc;
                        ll.styles[numCharsInLine] = static_cast<char>(styleByte & styleMask);
                        ll.indicators[numCharsInLine] = static_cast<char>(styleByte & ~styleMask);
+                       if (vstyle.styles[ll.styles[numCharsInLine]].caseForce == Style::caseUpper)
+                               ll.chars[numCharsInLine] = static_cast<char>(toupper(chDoc));
+                       else if (vstyle.styles[ll.styles[numCharsInLine]].caseForce == Style::caseLower)
+                               ll.chars[numCharsInLine] = static_cast<char>(tolower(chDoc));
                        numCharsInLine++;
                }
        }
@@ -791,10 +948,11 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
 
        // Layout the line, determining the position of each character,
        // with an extra element at the end for the end of the line.
-       int startseg = 0;
-       int startsegx = 0;
+       int startseg = 0;       // Start of the current segment, in char. number
+       int startsegx = 0;      // Start of the current segment, in pixels
        ll.positions[0] = 0;
        unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars;
+       bool lastSegItalics = false;
 
        for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
                if ((ll.styles[charInLine] != ll.styles[charInLine + 1]) ||
@@ -810,14 +968,16 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                                                // +3 For a blank on front and rounded edge each side:
                                                ll.positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, strlen(ctrlChar)) + 3;
                                        }
-                               } else {
+                                       lastSegItalics = false;
+                               } else {        // Regular character
+                                       lastSegItalics = vstyle.styles[ll.styles[charInLine]].italic;
                                        int lenSeg = charInLine - startseg + 1;
                                        if ((lenSeg == 1) && (' ' == ll.chars[startseg])) {
                                                // Over half the segments are single characters and of these about half are space characters.
                                                ll.positions[charInLine + 1] = vstyle.styles[ll.styles[charInLine]].spaceWidth;
                                        } else {
                                                surface->MeasureWidths(vstyle.styles[ll.styles[charInLine]].font, ll.chars + startseg,
-                                                                      charInLine - startseg + 1, ll.positions + startseg + 1);
+                                                                      lenSeg, ll.positions + startseg + 1);
                                        }
                                }
                        } else {    // invisible
@@ -832,6 +992,10 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                        startseg = charInLine + 1;
                }
        }
+       // Small hack to make lines that end with italics not cut off the edge of the last character
+       if ((startseg > 0) && lastSegItalics) {
+               ll.positions[startseg] += 2;
+       }
        ll.numCharsInLine = numCharsInLine;
 }
 
@@ -845,19 +1009,23 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
        // is taken by an individual character - internal leading gives varying results.
        Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
 
-       int marks = 0;
-       Colour markBack = Colour(0, 0, 0);
+       bool overrideBackground = false;
+       Colour background = Colour(0, 0, 0);
+       if (caret.active && vsDraw.showCaretLineBackground && ll.containsCaret) {
+               overrideBackground = true;
+               background = vsDraw.caretLineBackground.allocated;
+       }
        if (vsDraw.maskInLine) {
-               marks = pdoc->GetMark(line) & vsDraw.maskInLine;
+               int marks = pdoc->GetMark(line) & vsDraw.maskInLine;
                if (marks) {
+                       overrideBackground = true;
                        for (int markBit = 0; (markBit < 32) && marks; markBit++) {
                                if (marks & 1) {
-                                       markBack = vsDraw.markers[markBit].back.allocated;
+                                       background = vsDraw.markers[markBit].back.allocated;
                                }
                                marks >>= 1;
                        }
                }
-               marks = pdoc->GetMark(line) & vsDraw.maskInLine;
        }
 
        bool inIndentation = true;
@@ -893,8 +1061,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
                                if (vsDraw.selforeset)
                                        textFore = vsDraw.selforeground.allocated;
                        } else {
-                               if (marks)
-                                       textBack = markBack;
+                               if (overrideBackground)
+                                       textBack = background;
                                if ((vsDraw.edgeState == EDGE_BACKGROUND) && (i >= ll.edgeColumn) && (ll.chars[i] != '\n') && (ll.chars[i] != '\r'))
                                        textBack = vsDraw.edgecolour.allocated;
                        }
@@ -948,7 +1116,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
                                                         rcSegment.top + vsDraw.maxAscent, ctrlChar, strlen(ctrlChar),
                                                         textBack, textFore);
                                // Manage normal display
-                       } else {
+                       }
+                       else {
                                rcSegment.left = ll.positions[startseg] + xStart;
                                rcSegment.right = ll.positions[i + 1] + xStart;
                                // Only try to draw if really visible - enhances performance by not calling environment to
@@ -1032,16 +1201,16 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
                        surface->FillRectangle(rcSegment, vsDraw.selbackground.allocated);
                else
                        surface->FillRectangle(rcSegment, vsDraw.selbackground2.allocated);
-       } else if (marks) {
-               surface->FillRectangle(rcSegment, markBack);
+       } else if (overrideBackground) {
+               surface->FillRectangle(rcSegment, background);
        } else {
                surface->FillRectangle(rcSegment, vsDraw.styles[ll.styles[ll.numCharsInLine] & styleMask].back.allocated);
        }
 
        rcSegment.left = xEol + vsDraw.aveCharWidth + xStart;
        rcSegment.right = rcLine.right;
-       if (marks) {
-               surface->FillRectangle(rcSegment, markBack);
+       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 {
@@ -1110,14 +1279,14 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
        }
 
        surfaceWindow->SetPalette(&palette, true);
-       pixmapLine.SetPalette(&palette, !wMain.HasFocus());
+       pixmapLine.SetPalette(&palette, !hasFocus);
 
        //Platform::DebugPrintf("Paint: (%3d,%3d) ... (%3d,%3d)\n",
        //      rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
 
        int screenLinePaintFirst = rcArea.top / vs.lineHeight;
        // The area to be painted plus one extra line is styled.
-       // The extra line is to determine when a style change, such as statrting a comment flows on to other lines.
+       // The extra line is to determine when a style change, such as starting a comment flows on to other lines.
        int lineStyleLast = topLine + (rcArea.bottom - 1) / vs.lineHeight + 1;
        //Platform::DebugPrintf("Paint lines = %d .. %d\n", topLine + screenLinePaintFirst, lineStyleLast);
        int endPosPaint = pdoc->Length();
@@ -1150,10 +1319,11 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                // Either styling or NotifyUpdateUI noticed that painting is needed
                // outside the current painting rectangle
                //Platform::DebugPrintf("Abandoning paint\n");
-               return ;
+               return;
        }
        //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset);
 
+       // Do the painting
        if (rcArea.right > vs.fixedColumnWidth) {
 
                Surface *surface = surfaceWindow;
@@ -1176,11 +1346,29 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                rcTextArea.left = vs.fixedColumnWidth;
                rcTextArea.right -= vs.rightMarginWidth;
                surfaceWindow->SetClip(rcTextArea);
+
+               // Loop on visible lines
                //GTimer *tim=g_timer_new();
                while (visibleLine < cs.LinesDisplayed() && yposScreen < rcArea.bottom) {
                        //g_timer_start(tim);
                        //Platform::DebugPrintf("Painting line %d\n", line);
 
+                       // Copy this line and its styles from the document into local arrays
+                       // and determine the x position at which each character starts.
+                       LineLayout ll;
+                       LayoutLine(line, surface, vs, ll);
+
+                       ll.selStart = SelectionStart(line);
+                       ll.selEnd = SelectionEnd(line);
+                       ll.containsCaret = line == lineCaret;
+                       if (hideSelection) {
+                               ll.selStart = -1;
+                               ll.selEnd = -1;
+                               ll.containsCaret = false;
+                       }
+                       // Need to fix this up so takes account of Unicode and DBCS
+                       ll.edgeColumn = theEdge;
+
                        int posLineStart = pdoc->LineStart(line);
                        int posLineEnd = pdoc->LineStart(line + 1);
                        //Platform::DebugPrintf("line %d %d - %d\n", line, posLineStart, posLineEnd);
@@ -1189,11 +1377,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                        rcLine.top = ypos;
                        rcLine.bottom = ypos + vs.lineHeight;
 
-                       // Copy this line and its styles from the document into local arrays
-                       // and determine the x position at which each character starts.
-                       LineLayout ll;
-                       LayoutLine(line, surface, vs, ll);
-
                        // Highlight the current braces if any
                        if ((braces[0] >= posLineStart) && (braces[0] < posLineEnd)) {
                                int braceOffset = braces[0] - posLineStart;
@@ -1210,15 +1393,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                                ll.xHighlightGuide = highlightGuideColumn * vs.spaceWidth;
                        }
 
-                       ll.selStart = SelectionStart(line);
-                       ll.selEnd = SelectionEnd(line);
-                       if (hideSelection) {
-                               ll.selStart = -1;
-                               ll.selEnd = -1;
-                       }
-                       // Need to fix this up so takes account of Unicode and DBCS
-                       ll.edgeColumn = theEdge;
-
                        // Draw the line
                        if (cs.GetVisible(line))
                                DrawLine(surface, vs, line, visibleLine, xStart, rcLine, ll);
@@ -1255,17 +1429,20 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                                        widthOverstrikeCaret = 3;
                                if (((caret.active && caret.on) || (posDrag >= 0)) && xposCaret >= 0) {
                                        PRectangle rcCaret = rcLine;
+                                       int caretWidthOffset = 0;
+                                       if ((offset > 0) && (vs.caretWidth > 1))
+                                               caretWidthOffset = 1;   // Move back so overlaps both character cells.
                                        if (posDrag >= 0) {
-                                               rcCaret.left = xposCaret;
-                                               rcCaret.right = xposCaret + 1;
+                                               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 {
-                                                       rcCaret.left = xposCaret;
-                                                       rcCaret.right = xposCaret + 1;
+                                                       rcCaret.left = xposCaret - caretWidthOffset;
+                                                       rcCaret.right = rcCaret.left + vs.caretWidth;
                                                }
                                        }
                                        surface->FillRectangle(rcCaret, vs.caretcolour.allocated);
@@ -1294,6 +1471,10 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                }
                //g_timer_destroy(tim);
 
+               // Right column limit indicator
+
+
+
                PRectangle rcBeyondEOF = rcClient;
                rcBeyondEOF.left = vs.fixedColumnWidth;
                rcBeyondEOF.right = rcBeyondEOF.right;
@@ -1307,6 +1488,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                                surfaceWindow->FillRectangle(rcBeyondEOF, vs.edgecolour.allocated);
                        }
                }
+               NotifyPainted();
        }
 }
 
@@ -1360,8 +1542,9 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
        // Don't show the selection when printing
        vsPrint.selbackset = false;
        vsPrint.selforeset = false;
-       // White background for the line numbers
-       vsPrint.styles[STYLE_LINENUMBER].back.desired = Colour(0xff, 0xff, 0xff);
+       vsPrint.showCaretLineBackground = false;
+
+       // Set colours for printing according to users settings
        for (int sty = 0;sty <= STYLE_MAX;sty++) {
                if (printColourMode == SC_PRINT_INVERTLIGHT) {
                        vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired);
@@ -1369,8 +1552,15 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
                } else if (printColourMode == SC_PRINT_BLACKONWHITE) {
                        vsPrint.styles[sty].fore.desired = Colour(0, 0, 0);
                        vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff);
+               } else if (printColourMode == SC_PRINT_COLOURONWHITE) {
+                       vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff);
+               } else if (printColourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) {
+                       if (sty <= STYLE_DEFAULT) {
+                               vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff);
+                       }
                }
        }
+       // White background for the line numbers
        vsPrint.styles[STYLE_LINENUMBER].back.desired = Colour(0xff, 0xff, 0xff);
 
        vsPrint.Refresh(*surfaceMeasure);
@@ -1381,7 +1571,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
        int lineNumberWidth = 0;
        if (lineNumberIndex >= 0) {
                lineNumberWidth = surface->WidthText(vsPrint.styles[STYLE_LINENUMBER].font,
-                                                    "9999" lineNumberPrintSpace, 4 + strlen(lineNumberPrintSpace));
+                                                    "99999" lineNumberPrintSpace, 5 + strlen(lineNumberPrintSpace));
                vsPrint.ms[lineNumberIndex].width = lineNumberWidth;
        }
 
@@ -1410,6 +1600,22 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
 
                while (line <= linePrintLast && ypos < pfr->rc.bottom) {
 
+                       // When printing, the hdc and hdcTarget may be the same, so
+                       // changing the state of surfaceMeasure may change the underlying
+                       // state of surface. Therefore, any cached state is discarded before
+                       // using each surface.
+                       surfaceMeasure->FlushCachedState();
+
+                       // Copy this line and its styles from the document into local arrays
+                       // and determine the x position at which each character starts.
+                       LineLayout ll;
+                       LayoutLine(line, surfaceMeasure, vsPrint, ll);
+                       ll.selStart = -1;
+                       ll.selEnd = -1;
+                       ll.containsCaret = false;
+                       // Need to fix this up so takes account of Unicode and DBCS
+                       ll.edgeColumn = theEdge;
+
                        PRectangle rcLine;
                        rcLine.left = pfr->rc.left + lineNumberWidth;
                        rcLine.top = ypos;
@@ -1430,21 +1636,6 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
                                                  vsPrint.styles[STYLE_LINENUMBER].back.allocated);
                        }
 
-                       // When printing, the hdc and hdcTarget may be the same, so
-                       // changing the state of surfaceMeasure may change the underlying
-                       // state of surface. Therefore, any cached state is discarded before
-                       // using each surface.
-
-                       // Copy this line and its styles from the document into local arrays
-                       // and determine the x position at which each character starts.
-                       surfaceMeasure->FlushCachedState();
-                       LineLayout ll;
-                       LayoutLine(line, surfaceMeasure, vsPrint, ll);
-                       ll.selStart = -1;
-                       ll.selEnd = -1;
-                       // Need to fix this up so takes account of Unicode and DBCS
-                       ll.edgeColumn = theEdge;
-
                        // Draw the line
                        surface->FlushCachedState();
                        DrawLine(surface, vsPrint, line, line, xStart, rcLine, ll);
@@ -1463,7 +1654,6 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
 // Empty method is overridden on GTK+ to show / hide scrollbars
 void Editor::ReconfigureScrollBars() {}
 
-
 void Editor::SetScrollBarsTo(PRectangle) {
        RefreshStyleData();
 
@@ -1483,7 +1673,6 @@ void Editor::SetScrollBarsTo(PRectangle) {
        //Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage);
 }
 
-
 void Editor::SetScrollBars() {
        PRectangle rsClient = GetClientRectangle();
        SetScrollBarsTo(rsClient);
@@ -1512,7 +1701,38 @@ void Editor::AddCharUTF(char *s, unsigned int len) {
        // Avoid blinking during rapid typing:
        ShowCaretAtCurrentPosition();
        SetLastXChosen();
-       NotifyChar(s[0]);
+
+       int byte = static_cast<unsigned char>(s[0]);
+       if ((byte < 0xC0) || (1 == len)) {
+               // Handles UTF-8 characters between 0x01 and 0x7F and single byte 
+               // characters when not in UTF-8 mode. 
+               // Also treats \0 and naked trail bytes 0x80 to 0xBF as valid
+               // characters representing themselves.
+       } else {
+               // Unroll 1 to 3 byte UTF-8 sequences.  See reference data at:
+               // http://www.cl.cam.ac.uk/~mgk25/unicode.html
+               // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
+               if (byte < 0xE0) {
+                       int byte2 = static_cast<unsigned char>(s[1]);
+                       if ((byte2 & 0xC0) == 0x80) {
+                               // Two-byte-character lead-byte followed by a trail-byte.
+                               byte = (((byte & 0x1F) << 6) | (byte2 & 0x3F));
+                       }
+                       // A two-byte-character lead-byte not followed by trail-byte
+                       // represents itself.
+               } else if (byte < 0xF0) {
+                       int byte2 = static_cast<unsigned char>(s[1]);
+                       int byte3 = static_cast<unsigned char>(s[2]);
+                       if (((byte2 & 0xC0) == 0x80) && ((byte3 & 0xC0) == 0x80)) {
+                               // Three-byte-character lead byte followed by two trail bytes.
+                               byte = (((byte & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
+                                       (byte3 & 0x3F));
+                       }
+                       // A three-byte-character lead-byte not followed by two trail-bytes
+                       // represents itself.
+               }
+       }
+       NotifyChar(byte);
 }
 
 void Editor::ClearSelection() {
@@ -1529,23 +1749,27 @@ void Editor::ClearSelection() {
                        }
                }
                SetEmptySelection(startPos);
-               selType = selStream;
                pdoc->EndUndoAction();
+               selType = selStream;
        } else {
                int startPos = SelectionStart();
                unsigned int chars = SelectionEnd() - startPos;
                SetEmptySelection(startPos);
                if (0 != chars) {
+                       pdoc->BeginUndoAction();
                        pdoc->DeleteChars(startPos, chars);
+                       pdoc->EndUndoAction();
                }
        }
 }
 
 void Editor::ClearAll() {
+       pdoc->BeginUndoAction();
        if (0 != pdoc->Length()) {
                pdoc->DeleteChars(0, pdoc->Length());
        }
        cs.Clear();
+       pdoc->EndUndoAction();
        anchor = 0;
        currentPos = 0;
        SetTopLine(0);
@@ -1560,16 +1784,22 @@ void Editor::ClearDocumentStyle() {
 }
 
 void Editor::Cut() {
-       Copy();
-       ClearSelection();
+       if (!pdoc->IsReadOnly()) {
+               Copy();
+               ClearSelection();
+       }
 }
 
 void Editor::PasteRectangular(int pos, const char *ptr, int len) {
+       if (pdoc->IsReadOnly()) {
+               return;
+       }
        currentPos = pos;
        int insertPos = currentPos;
        int xInsert = XFromPosition(currentPos);
        int line = pdoc->LineFromPosition(currentPos);
        bool prevCr = false;
+       pdoc->BeginUndoAction();
        for (int i = 0; i < len; i++) {
                if ((ptr[i] == '\r') || (ptr[i] == '\n')) {
                        if ((ptr[i] == '\r') || (!prevCr))
@@ -1580,7 +1810,15 @@ void Editor::PasteRectangular(int pos, const char *ptr, int len) {
                                if (pdoc->eolMode != SC_EOL_CR)
                                        pdoc->InsertChar(pdoc->Length(), '\n');
                        }
+                       // Pad the end of lines with spaces if required
                        currentPos = PositionFromLineX(line, xInsert);
+                       if ((XFromPosition(currentPos) < xInsert) && (i + 1 < len)) {
+                               for (int i = 0; i < xInsert - XFromPosition(currentPos); i++) {
+                                       pdoc->InsertChar(currentPos, ' ');
+                                       currentPos++;
+                               }
+                               insertPos = currentPos;
+                       }
                        prevCr = ptr[i] == '\r';
                } else {
                        pdoc->InsertString(currentPos, ptr + i, 1);
@@ -1589,9 +1827,14 @@ void Editor::PasteRectangular(int pos, const char *ptr, int len) {
                        prevCr = false;
                }
        }
+       pdoc->EndUndoAction();
        SetEmptySelection(insertPos);
 }
 
+bool Editor::CanPaste() {
+       return !pdoc->IsReadOnly();
+}
+
 void Editor::Clear() {
        if (currentPos == anchor) {
                DelChar();
@@ -1608,7 +1851,7 @@ void Editor::SelectAll() {
 
 void Editor::Undo() {
        if (pdoc->CanUndo()) {
-        InvalidateCaret();
+               InvalidateCaret();
                int newPos = pdoc->Undo();
                SetEmptySelection(newPos);
                EnsureCaretVisible();
@@ -1631,8 +1874,23 @@ void Editor::DelChar() {
 
 void Editor::DelCharBack() {
        if (currentPos == anchor) {
-               int newPos = pdoc->DelCharBack(currentPos);
-               SetEmptySelection(newPos);
+               int lineCurrentPos = pdoc->LineFromPosition(currentPos);
+               if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) &&
+                       pdoc->GetColumn(currentPos) > 0 && pdoc->backspaceUnindents) {
+                       pdoc->BeginUndoAction();
+                       int indentation = pdoc->GetLineIndentation(lineCurrentPos);
+                       int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars);
+                       if (indentation % indentationStep == 0) {
+                               pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep);
+                       } else {
+                               pdoc->SetLineIndentation(lineCurrentPos, indentation - (indentation % indentationStep));
+                       }
+                       SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
+                       pdoc->EndUndoAction();
+               } else {
+                       int newPos = pdoc->DelCharBack(currentPos);
+                       SetEmptySelection(newPos);
+               }
        } else {
                ClearSelection();
                SetEmptySelection(currentPos);
@@ -1643,7 +1901,6 @@ void Editor::DelCharBack() {
 
 void Editor::NotifyFocus(bool) {}
 
-
 void Editor::NotifyStyleToNeeded(int endStyleNeeded) {
        SCNotification scn;
        scn.nmhdr.code = SCN_STYLENEEDED;
@@ -1655,7 +1912,7 @@ void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) {
        NotifyStyleToNeeded(endStyleNeeded);
 }
 
-void Editor::NotifyChar(char ch) {
+void Editor::NotifyChar(int ch) {
        SCNotification scn;
        scn.nmhdr.code = SCN_CHARADDED;
        scn.ch = ch;
@@ -1663,11 +1920,11 @@ void Editor::NotifyChar(char ch) {
 #ifdef MACRO_SUPPORT
        if (recordingMacro) {
                char txt[2];
-               txt[0] = ch;
+               txt[0] = static_cast<char>(ch);
                txt[1] = '\0';
                NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
        }
-#endif
+#endif 
 }
 
 void Editor::NotifySavePoint(bool isSavePoint) {
@@ -1698,6 +1955,12 @@ void Editor::NotifyUpdateUI() {
        NotifyParent(scn);
 }
 
+void Editor::NotifyPainted() {
+       SCNotification scn;
+       scn.nmhdr.code = SCN_PAINTED;
+       NotifyParent(scn);
+}
+
 bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) {
        int marginClicked = -1;
        int x = 0;
@@ -1728,6 +1991,15 @@ void Editor::NotifyNeedShown(int pos, int len) {
        NotifyParent(scn);
 }
 
+void Editor::NotifyDwelling(Point pt, bool state) {
+       SCNotification scn;
+       scn.nmhdr.code = state ? SCN_DWELLSTART : SCN_DWELLEND;
+       scn.position = PositionFromLocationClose(pt);
+       scn.x = pt.x;
+       scn.y = pt.y;
+       NotifyParent(scn);
+}
+
 // Notifications from document
 void Editor::NotifyModifyAttempt(Document*, void *) {
        //Platform::DebugPrintf("** Modify Attempt\n");
@@ -1808,13 +2080,12 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
                                // Some lines are hidden so may need shown.
                                // TODO: check if the modified area is hidden.
                                if (mh.modificationType & SC_MOD_BEFOREINSERT) {
-                                       NotifyNeedShown(mh.position, 0);
+                                       NotifyNeedShown(mh.position, mh.length);
                                } else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
                                        NotifyNeedShown(mh.position, mh.length);
                                }
                        }
                        if (mh.linesAdded != 0) {
-
                                // Update contraction state for inserted and removed lines
                                // lineOfPos should be calculated in context of state before modification, shouldn't it
                                int lineOfPos = pdoc->LineFromPosition(mh.position);
@@ -1859,6 +2130,8 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
                        NotifyChange(); // Send EN_CHANGE
                }
 
+
+
                SCNotification scn;
                scn.nmhdr.code = SCN_MODIFIED;
                scn.position = mh.position;
@@ -1886,6 +2159,10 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        case SCI_COPY:
        case SCI_PASTE:
        case SCI_CLEAR:
+       case WM_CUT:
+       case WM_COPY:
+       case WM_PASTE:
+       case WM_CLEAR:
        case SCI_REPLACESEL:
        case SCI_ADDTEXT:
        case SCI_INSERTTEXT:
@@ -1908,6 +2185,10 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        case SCI_WORDLEFTEXTEND:
        case SCI_WORDRIGHT:
        case SCI_WORDRIGHTEXTEND:
+       case SCI_WORDPARTLEFT:
+       case SCI_WORDPARTLEFTEXTEND:
+       case SCI_WORDPARTRIGHT:
+       case SCI_WORDPARTRIGHTEXTEND:
        case SCI_HOME:
        case SCI_HOMEEXTEND:
        case SCI_LINEEND:
@@ -1925,12 +2206,13 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        case SCI_DELETEBACK:
        case SCI_TAB:
        case SCI_BACKTAB:
-       case SCI_NEWLINE:
        case SCI_FORMFEED:
        case SCI_VCHOME:
        case SCI_VCHOMEEXTEND:
        case SCI_DELWORDLEFT:
        case SCI_DELWORDRIGHT:
+       case SCI_DELLINELEFT:
+       case SCI_DELLINERIGHT:
        case SCI_LINECUT:
        case SCI_LINEDELETE:
        case SCI_LINETRANSPOSE:
@@ -1938,11 +2220,12 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        case SCI_UPPERCASE:
                break;
 
-               // Filter out all others (display changes, etc)
+               // 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);
-
-               return ;
+               return;
        }
 
        // Send notification
@@ -1953,7 +2236,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        scn.lParam = lParam;
        NotifyParent(scn);
 }
-#endif
+#endif 
 
 // Force scroll and keep position relative to top of window
 void Editor::PageMove(int direction, bool extend) {
@@ -1995,7 +2278,6 @@ void Editor::ChangeCaseOfSelection(bool makeUpperCase) {
        pdoc->EndUndoAction();
 }
 
-
 void Editor::LineTranspose() {
        int line = pdoc->LineFromPosition(currentPos);
        if (line > 0) {
@@ -2028,7 +2310,6 @@ void Editor::LineTranspose() {
 
 void Editor::CancelModes() {}
 
-
 int Editor::KeyCommand(unsigned int iMessage) {
        Point pt = LocationFromPosition(currentPos);
 
@@ -2147,7 +2428,7 @@ int Editor::KeyCommand(unsigned int iMessage) {
                ShowCaretAtCurrentPosition();
                NotifyUpdateUI();
                break;
-       case SCI_CANCEL:        // Cancel any modes - handled in subclass
+       case SCI_CANCEL:                // Cancel any modes - handled in subclass
                // Also unselect text
                CancelModes();
                break;
@@ -2219,6 +2500,21 @@ int Editor::KeyCommand(unsigned int iMessage) {
                        MovePositionTo(currentPos);
                }
                break;
+       case SCI_DELLINELEFT: {
+                       int line = pdoc->LineFromPosition(currentPos);
+                       int start = pdoc->LineStart(line);
+                       pdoc->DeleteChars(start, currentPos - start);
+                       MovePositionTo(start);
+                       SetLastXChosen();
+               }
+               break;
+       case SCI_DELLINERIGHT: {
+                       int line = pdoc->LineFromPosition(currentPos);
+                       int end = pdoc->LineEnd(line);
+                       pdoc->DeleteChars(currentPos, end - currentPos);
+                       MovePositionTo(currentPos);
+               }
+               break;
        case SCI_LINECUT: {
                        int lineStart = pdoc->LineFromPosition(currentPos);
                        int lineEnd = pdoc->LineFromPosition(anchor);
@@ -2250,6 +2546,22 @@ int Editor::KeyCommand(unsigned int iMessage) {
        case SCI_UPPERCASE:
                ChangeCaseOfSelection(true);
                break;
+       case SCI_WORDPARTLEFT:
+               MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(currentPos), -1));
+               SetLastXChosen();
+               break;
+       case SCI_WORDPARTLEFTEXTEND:
+               MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(currentPos), -1), true);
+               SetLastXChosen();
+               break;
+       case SCI_WORDPARTRIGHT:
+               MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(currentPos), 1));
+               SetLastXChosen();
+               break;
+       case SCI_WORDPARTRIGHTEXTEND:
+               MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(currentPos), 1), true);
+               SetLastXChosen();
+               break;
        }
        return 0;
 }
@@ -2258,14 +2570,20 @@ int Editor::KeyDefault(int, int) {
        return 0;
 }
 
-int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt) {
+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);
        int msg = kmap.Find(key, modifiers);
-       if (msg)
+       if (msg) {
+               if (consumed)
+                       *consumed = true;
                return WndProc(msg, 0, 0);
-       else
+       } else {
+               if (consumed)
+                       *consumed = false;
                return KeyDefault(key, modifiers);
+       }
 }
 
 void Editor::SetWhitespaceVisible(int view) {
@@ -2281,15 +2599,50 @@ void Editor::Indent(bool forwards) {
        int lineOfAnchor = pdoc->LineFromPosition(anchor);
        int lineCurrentPos = pdoc->LineFromPosition(currentPos);
        if (lineOfAnchor == lineCurrentPos) {
-               ClearSelection();
-               if (pdoc->useTabs) {
-                       pdoc->InsertChar(currentPos, '\t');
-                       SetEmptySelection(currentPos + 1);
+               if (forwards) {
+                       ClearSelection();
+                       if (pdoc->GetColumn(currentPos) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) &&
+                               pdoc->tabIndents) {
+                               pdoc->BeginUndoAction();
+                               int indentation = pdoc->GetLineIndentation(lineCurrentPos);
+                               int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars);
+                               pdoc->SetLineIndentation(lineCurrentPos, indentation + indentationStep);
+                               SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
+                               pdoc->EndUndoAction();
+                       } else {
+                               if (pdoc->useTabs) {
+                                       pdoc->InsertChar(currentPos, '\t');
+                                       SetEmptySelection(currentPos + 1);
+                               } else {
+                                       int numSpaces = (pdoc->tabInChars) -
+                                                       (pdoc->GetColumn(currentPos) % (pdoc->tabInChars));
+                                       if (numSpaces < 1)
+                                               numSpaces = pdoc->tabInChars;
+                                       for (int i = 0; i < numSpaces; i++) {
+                                               pdoc->InsertChar(currentPos, ' ');
+                                       }
+                                       SetEmptySelection(currentPos + numSpaces);
+                               }
+                       }
                } else {
-                       for (int i = 0; i < pdoc->tabInChars; i++) {
-                               pdoc->InsertChar(currentPos, ' ');
+                       if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) &&
+                               pdoc->tabIndents) {
+                               pdoc->BeginUndoAction();
+                               int indentation = pdoc->GetLineIndentation(lineCurrentPos);
+                               int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars);
+                               pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep);
+                               SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
+                               pdoc->EndUndoAction();
+                       } else {
+                               int newColumn = ((pdoc->GetColumn(currentPos) - 1) / pdoc->tabInChars) *
+                                               pdoc->tabInChars;
+                               if (newColumn < 0)
+                                       newColumn = 0;
+                               int newPos = currentPos;
+                               while (pdoc->GetColumn(newPos) > newColumn)
+                                       newPos--;
+                               SetEmptySelection(newPos);
                        }
-                       SetEmptySelection(currentPos + pdoc->tabInChars);
                }
        } else {
                int anchorPosOnLine = anchor - pdoc->LineStart(lineOfAnchor);
@@ -2316,59 +2669,104 @@ void Editor::Indent(bool forwards) {
        }
 }
 
-long Editor::FindText(unsigned int iMessage, unsigned long wParam, long lParam) {
+/**
+ * Search of a text in the document, in the given range.
+ * @return The position of the found text, -1 if not found.
+ */
+long Editor::FindText(
+    unsigned int iMessage,     ///< Can be @c EM_FINDTEXT or @c EM_FINDTEXTEX or @c SCI_FINDTEXT.
+    unsigned long wParam,      ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+    ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
+    long lParam) {                     ///< @c TextToFind structure: The text to search for in the given range.
+
        TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
+       int lengthFound = strlen(ft->lpstrText);
        int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText,
-                               wParam & SCFIND_MATCHCASE, wParam & SCFIND_WHOLEWORD,
-                               wParam & SCFIND_WORDSTART);
+                                wParam & SCFIND_MATCHCASE,
+                                wParam & SCFIND_WHOLEWORD,
+                                wParam & SCFIND_WORDSTART,
+                                wParam & SCFIND_REGEXP,
+                                &lengthFound);
        if (pos != -1) {
                if (iMessage != EM_FINDTEXT) {
                        ft->chrgText.cpMin = pos;
-                       ft->chrgText.cpMax = pos + strlen(ft->lpstrText);
+                       ft->chrgText.cpMax = pos + lengthFound;
                }
        }
        return pos;
 }
 
-// Relocatable search support : Searches relative to current selection
-// point and sets the selection to the found text range with
-// each search.
-
-// Anchor following searches at current selection start:  This allows
-// multiple incremental interactive searches to be macro recorded
-// while still setting the selection to found text so the find/select
-// operation is self-contained.
+/**
+ * Relocatable search support : Searches relative to current selection
+ * point and sets the selection to the found text range with
+ * each search.
+ */
+/**
+ * Anchor following searches at current selection start: This allows
+ * multiple incremental interactive searches to be macro recorded
+ * while still setting the selection to found text so the find/select
+ * operation is self-contained.
+ */
 void Editor::SearchAnchor() {
        searchAnchor = SelectionStart();
 }
 
-// Find text from current search anchor:  Must call SearchAnchor first.
-// Accepts both SCI_SEARCHNEXT and SCI_SEARCHPREV.
-// wParam contains search modes : ORed FR_MATCHCASE and FR_WHOLEWORD.
-// lParam contains the text to search for.
-long Editor::SearchText(unsigned int iMessage, unsigned long wParam, long lParam) {
+/**
+ * Find text from current search anchor: Must call @c SearchAnchor first.
+ * Used for next text and previous text requests.
+ * @return The position of the found text, -1 if not found.
+ */
+long Editor::SearchText(
+    unsigned int iMessage,     ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV.
+    unsigned long wParam,      ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+    ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
+    long lParam) {                     ///< The text to search for.
+
        const char *txt = reinterpret_cast<char *>(lParam);
        int pos;
-
+       int lengthFound = strlen(txt);
        if (iMessage == SCI_SEARCHNEXT) {
                pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt,
-                       wParam & SCFIND_MATCHCASE,
-                       wParam & SCFIND_WHOLEWORD,
-                       wParam & SCFIND_WORDSTART);
+                                    wParam & SCFIND_MATCHCASE,
+                                    wParam & SCFIND_WHOLEWORD,
+                                    wParam & SCFIND_WORDSTART,
+                                    wParam & SCFIND_REGEXP,
+                                    &lengthFound);
        } else {
                pos = pdoc->FindText(searchAnchor, 0, txt,
-                       wParam & SCFIND_MATCHCASE,
-                       wParam & SCFIND_WHOLEWORD,
-                       wParam & SCFIND_WORDSTART);
+                                    wParam & SCFIND_MATCHCASE,
+                                    wParam & SCFIND_WHOLEWORD,
+                                    wParam & SCFIND_WORDSTART,
+                                    wParam & SCFIND_REGEXP,
+                                    &lengthFound);
        }
 
        if (pos != -1) {
-               SetSelection(pos, pos + strlen(txt));
+               SetSelection(pos, pos + lengthFound);
        }
 
        return pos;
 }
 
+/**
+ * Search for text in the target range of the document.
+ * @return The position of the found text, -1 if not found.
+ */
+long Editor::SearchInTarget(const char *text, int length) {
+       int lengthFound = length;
+       int pos = pdoc->FindText(targetStart, targetEnd, text,
+                                searchFlags & SCFIND_MATCHCASE,
+                                searchFlags & SCFIND_WHOLEWORD,
+                                searchFlags & SCFIND_WORDSTART,
+                                searchFlags & SCFIND_REGEXP,
+                                &lengthFound);
+       if (pos != -1) {
+               targetStart = pos;
+               targetEnd = pos + lengthFound;
+       }
+       return pos;
+}
+
 void Editor::GoToLine(int lineNo) {
        if (lineNo > pdoc->LinesTotal())
                lineNo = pdoc->LinesTotal();
@@ -2471,13 +2869,21 @@ void Editor::SetDragPosition(int newPos) {
        }
 }
 
+void Editor::DisplayCursor(Window::Cursor c) {
+       if (cursorMode == SC_CURSORNORMAL)
+               wMain.SetCursor(c);
+       else
+               wMain.SetCursor(static_cast<Window::Cursor>(cursorMode));
+}
+
 void Editor::StartDrag() {
        // Always handled by subclasses
        //SetMouseCapture(true);
-       //wDraw.SetCursor(Window::cursorArrow);
+       //DisplayCursor(Window::cursorArrow);
 }
 
 
+
 void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) {
        //Platform::DebugPrintf("DropAt %d\n", inDragDrop);
        if (inDragDrop)
@@ -2598,6 +3004,30 @@ bool Editor::PointInSelMargin(Point pt) {
        }
 }
 
+void Editor::LineSelection(int lineCurrent_, int lineAnchor_) {
+       if (lineAnchor_ < lineCurrent_) {
+               SetSelection(pdoc->LineStart(lineCurrent_ + 1),
+                            pdoc->LineStart(lineAnchor_));
+       } else if (lineAnchor_ > lineCurrent_) {
+               SetSelection(pdoc->LineStart(lineCurrent_),
+                            pdoc->LineStart(lineAnchor_ + 1));
+       } else { // Same line, select it
+               SetSelection(pdoc->LineStart(lineAnchor_ + 1),
+                            pdoc->LineStart(lineAnchor_));
+       }
+}
+
+void Editor::DwellEnd(bool mouseMoved) {
+       if (mouseMoved)
+               ticksToDwell = dwellDelay;
+       else
+               ticksToDwell = SC_TIME_FOREVER;
+       if (dwelling && (dwellDelay < SC_TIME_FOREVER)) {
+               dwelling = false;
+               NotifyDwelling(ptMouseLast, dwelling);
+       }
+}
+
 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);
        ptMouseLast = pt;
@@ -2607,9 +3037,10 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
 
        bool processed = NotifyMarginClick(pt, shift, ctrl, alt);
        if (processed)
-               return ;
+               return;
 
-       if (shift) {
+       bool inSelMargin = PointInSelMargin(pt);
+       if (shift & !inSelMargin) {
                SetSelection(newPos);
        }
        if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick)) {
@@ -2650,21 +3081,30 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
                if (doubleClick)
                        NotifyDoubleClick(pt, shift);
        } else {        // Single click
-               if (PointInSelMargin(pt)) {
+               if (inSelMargin) {
+                       selType = selStream;
                        if (ctrl) {
                                SelectAll();
                                lastClickTime = curTime;
-                               return ;
+                               return;
                        }
-                       lineAnchor = LineFromLocation(pt);
-                       // While experimenting with folding turn off line selection
                        if (!shift) {
+                               lineAnchor = LineFromLocation(pt);
                                // Single click in margin: select whole line
-                               SetSelection(pdoc->LineStart(lineAnchor + 1), pdoc->LineStart(lineAnchor));
+                               LineSelection(lineAnchor, lineAnchor);
+                               SetSelection(pdoc->LineStart(lineAnchor + 1),
+                                            pdoc->LineStart(lineAnchor));
                        } else {
-                               // Single shift+click in margin: select from anchor to beginning of clicked line
-                               SetSelection(pdoc->LineStart(lineAnchor), anchor);
+                               // Single shift+click in margin: select from line anchor to clicked line
+                               if (anchor > currentPos)
+                                       lineAnchor = pdoc->LineFromPosition(anchor - 1);
+                               else
+                                       lineAnchor = pdoc->LineFromPosition(anchor);
+                               int lineStart = LineFromLocation(pt);
+                               LineSelection(lineStart, lineAnchor);
+                               //lineAnchor = lineStart; // Keep the same anchor for ButtonMove
                        }
+
                        SetDragPosition(invalidPosition);
                        SetMouseCapture(true);
                        selectionType = selLine;
@@ -2678,13 +3118,13 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
                                CopySelectionIntoDrag();
                                StartDrag();
                        } else {
-                               selType = alt ? selRectangle : selStream;
                                xStartSelect = pt.x - vs.fixedColumnWidth + xOffset;
                                xEndSelect = pt.x - vs.fixedColumnWidth + xOffset;
                                SetDragPosition(invalidPosition);
                                SetMouseCapture(true);
                                if (!shift)
                                        SetEmptySelection(newPos);
+                               selType = alt ? selRectangle : selStream;
                                selectionType = selChar;
                                originalAnchorPos = currentPos;
                        }
@@ -2696,10 +3136,21 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
 }
 
 void Editor::ButtonMove(Point pt) {
+       if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) {
+               DwellEnd(true);
+       }
+       ptMouseLast = pt;
        //Platform::DebugPrintf("Move %d %d\n", pt.x, pt.y);
        if (HaveMouseCapture()) {
+
+               // Slow down autoscrolling/selection
+               autoScrollTimer.ticksToWait -= timer.tickSize;
+               if (autoScrollTimer.ticksToWait > 0)
+                       return;
+               autoScrollTimer.ticksToWait = autoScrollDelay;
+
+               // Adjust selection
                xEndSelect = pt.x - vs.fixedColumnWidth + xOffset;
-               ptMouseLast = pt;
                int movePos = PositionFromLocation(pt);
                movePos = MovePositionOutsideChar(movePos, currentPos - movePos);
                if (posDrag >= 0) {
@@ -2719,29 +3170,35 @@ void Editor::ButtonMove(Point pt) {
                        } else {
                                // Continue selecting by line
                                int lineMove = LineFromLocation(pt);
-                               if (lineAnchor < lineMove) {
-                                       SetSelection(pdoc->LineStart(lineMove + 1),
-                                                    pdoc->LineStart(lineAnchor));
-                               } else {
-                                       SetSelection(pdoc->LineStart(lineMove),
-                                                    pdoc->LineStart(lineAnchor + 1));
-                               }
+                               LineSelection(lineMove, lineAnchor);
                        }
                }
-               EnsureCaretVisible(false);
+
+               // Autoscroll
+               PRectangle rcClient = GetClientRectangle();
+               if (pt.y > rcClient.bottom) {
+                       int lineMove = cs.DisplayFromDoc(LineFromLocation(pt));
+                       ScrollTo(lineMove - LinesOnScreen() + 5);
+                       Redraw();
+               } else if (pt.y < rcClient.top) {
+                       int lineMove = cs.DisplayFromDoc(LineFromLocation(pt));
+                       ScrollTo(lineMove - 5);
+                       Redraw();
+               }
+               EnsureCaretVisible(false, false, true);
+
        } else {
                if (vs.fixedColumnWidth > 0) {  // There is a margin
                        if (PointInSelMargin(pt)) {
-                               wDraw.SetCursor(Window::cursorReverseArrow);
-                               return ;        // No need to test for selection
+                               DisplayCursor(Window::cursorReverseArrow);
+                               return        // No need to test for selection
                        }
-
                }
                // Display regular (drag) cursor over selection
                if (PointInSelection(pt))
-                       wDraw.SetCursor(Window::cursorArrow);
+                       DisplayCursor(Window::cursorArrow);
                else
-                       wDraw.SetCursor(Window::cursorText);
+                       DisplayCursor(Window::cursorText);
        }
 
 }
@@ -2750,9 +3207,9 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
        //Platform::DebugPrintf("ButtonUp %d\n", HaveMouseCapture());
        if (HaveMouseCapture()) {
                if (PointInSelMargin(pt)) {
-                       wDraw.SetCursor(Window::cursorReverseArrow);
+                       DisplayCursor(Window::cursorReverseArrow);
                } else {
-                       wDraw.SetCursor(Window::cursorText);
+                       DisplayCursor(Window::cursorText);
                }
                xEndSelect = pt.x - vs.fixedColumnWidth + xOffset;
                ptMouseLast = pt;
@@ -2813,6 +3270,26 @@ void Editor::Tick() {
                        InvalidateCaret();
                }
        }
+       if ((dwellDelay < SC_TIME_FOREVER) && 
+               (ticksToDwell > 0) &&
+               (!HaveMouseCapture())) {
+               ticksToDwell -= timer.tickSize;
+               if (ticksToDwell <= 0) {
+                       dwelling = true;
+                       NotifyDwelling(ptMouseLast, dwelling);
+               }
+       }
+}
+
+void Editor::SetFocusState(bool focusState) {
+       hasFocus = focusState;
+       NotifyFocus(hasFocus);
+       if (hasFocus) {
+               ShowCaretAtCurrentPosition();
+               InvalidateCaret();
+       } else {
+               DropCaret();
+       }
 }
 
 static bool IsIn(int a, int minimum, int maximum) {
@@ -2831,7 +3308,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
        if (paintState == painting && !paintingAllText) {
                //Platform::DebugPrintf("Checking range in paint %d-%d\n", r.start, r.end);
                if (!r.Valid())
-                       return ;
+                       return;
 
                PRectangle rcText = GetTextRectangle();
                // Determine number of lines displayed including a possible partially displayed last line
@@ -2843,7 +3320,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                if (!IsOverlap(topLine, bottomLine, lineRangeStart, lineRangeEnd)) {
                        //Platform::DebugPrintf("No overlap (%d-%d) with window(%d-%d)\n",
                        //              lineRangeStart, lineRangeEnd, topLine, bottomLine);
-                       return ;
+                       return;
                }
 
                // Assert rcPaint contained within or equal to rcText
@@ -2855,7 +3332,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                                //Platform::DebugPrintf("Change (%d-%d) in top npv(%d-%d)\n",
                                //      lineRangeStart, lineRangeEnd, topLine, paintTopLine);
                                paintState = paintAbandoned;
-                               return ;
+                               return;
                        }
                }
                if (rcPaint.bottom < rcText.bottom) {
@@ -2866,7 +3343,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                                //Platform::DebugPrintf("Change (%d-%d) in bottom npv(%d-%d)\n",
                                //      lineRangeStart, lineRangeEnd, paintBottomLine, bottomLine);
                                paintState = paintAbandoned;
-                               return ;
+                               return;
                        }
                }
        }
@@ -3005,12 +3482,12 @@ void Editor::ToggleContraction(int line) {
 
 // Recurse up from this line to find any folds that prevent this line from being visible
 // and unfold them all.
-void Editor::EnsureLineVisible(int line) {
-       if (!cs.GetVisible(line)) {
-               int lineParent = pdoc->GetFoldParent(line);
+void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) {
+       if (!cs.GetVisible(lineDoc)) {
+               int lineParent = pdoc->GetFoldParent(lineDoc);
                if (lineParent >= 0) {
-                       if (line != lineParent)
-                               EnsureLineVisible(lineParent);
+                       if (lineDoc != lineParent)
+                               EnsureLineVisible(lineParent, enforcePolicy);
                        if (!cs.GetExpanded(lineParent)) {
                                cs.SetExpanded(lineParent, 1);
                                Expand(lineParent, true);
@@ -3019,21 +3496,59 @@ void Editor::EnsureLineVisible(int line) {
                SetScrollBars();
                Redraw();
        }
+       if (enforcePolicy) {
+               int lineDisplay = cs.DisplayFromDoc(lineDoc);
+               if (visiblePolicy & VISIBLE_SLOP) {
+                       if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) {
+                               SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos()));
+                               SetVerticalScrollPos();
+                               Redraw();
+                       } else if ((lineDisplay > topLine + LinesOnScreen() - 1) ||
+                                          ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) {
+                               SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos()));
+                               SetVerticalScrollPos();
+                               Redraw();
+                       }
+               } else {
+                       if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) {
+                               SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos()));
+                               SetVerticalScrollPos();
+                               Redraw();
+                       }
+               }
+       }
+}
+
+int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) {
+       pdoc->BeginUndoAction();
+       if (length == -1)
+               length = strlen(text);
+       if (replacePatterns) {
+               text = pdoc->SubstituteByPosition(text, &length);
+               if (!text)
+                       return 0;
+       }
+       if (targetStart != targetEnd)
+               pdoc->DeleteChars(targetStart, targetEnd - targetStart);
+       targetEnd = targetStart;
+       pdoc->InsertString(targetStart, text, length);
+       targetEnd = targetStart + length;
+       pdoc->EndUndoAction();
+       return length;
 }
 
 static bool ValidMargin(unsigned long wParam) {
        return wParam < ViewStyle::margins;
 }
 
-
-long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long 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);
 
        // Optional macro recording hook
 #ifdef MACRO_SUPPORT
        if (recordingMacro)
                NotifyMacroRecord(iMessage, wParam, lParam);
-#endif
+#endif 
 
        switch (iMessage) {
 
@@ -3095,7 +3610,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                SetLastXChosen();
                break;
 
-               // Edit control mesages
+               // Edit control messages
 
                // Not supported (no-ops):
                //              EM_GETWORDBREAKPROC
@@ -3164,31 +3679,37 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                return topLine;
 
        case EM_GETLINE: {
-                       if (lParam == 0)
+                       if (lParam == 0) {
                                return 0;
-                       int lineStart = pdoc->LineStart(wParam);
-                       int lineEnd = pdoc->LineStart(wParam + 1);
+                       }
                        char *ptr = reinterpret_cast<char *>(lParam);
                        short *pBufSize = reinterpret_cast<short *>(lParam);
-                       if (*pBufSize < lineEnd - lineStart) {
-                               ptr[0] = '\0';  // If no characters copied have to put a NUL into buffer
+                       short bufSize = *pBufSize;
+                       ptr[0] = '\0';  // If no characters copied, have to put a NUL into buffer
+                       if (static_cast<int>(wParam) > pdoc->LinesTotal()) {
                                return 0;
                        }
+                       int lineStart = pdoc->LineStart(wParam);
+                       int lineEnd = pdoc->LineStart(wParam + 1);
+                       // The first word of the buffer is the size, in TCHARs, of the buffer
                        int iPlace = 0;
-                       for (int iChar = lineStart; iChar < lineEnd; iChar++)
+                       for (int iChar = lineStart; iChar < lineEnd && iPlace < bufSize; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
+                       }
                        return iPlace;
                }
 
-       case SCI_GETLINE: {
-                       if (lParam == 0)
+       case SCI_GETLINE: {     // Simpler than EM_GETLINE, but with risk of overwriting the end of the buffer
+                       if (lParam == 0) {
                                return 0;
+                       }
                        int lineStart = pdoc->LineStart(wParam);
                        int lineEnd = pdoc->LineStart(wParam + 1);
                        char *ptr = reinterpret_cast<char *>(lParam);
                        int iPlace = 0;
-                       for (int iChar = lineStart; iChar < lineEnd; iChar++)
+                       for (int iChar = lineStart; iChar < lineEnd; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
+                       }
                        return iPlace;
                }
 
@@ -3268,6 +3789,8 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                                        ptr[iChar] = text[iChar];
                                ptr[iChar] = '\0';
                                delete []text;
+                       } else {
+                               ptr[0] = '\0';
                        }
                        return iChar;
                }
@@ -3294,7 +3817,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                if (wParam == 0)
                        return 0;       // Even if there is no text, there is a first line that starts at 0
                if (static_cast<int>(wParam) > pdoc->LinesTotal())
-                       return - 1;
+                       return -1;
                //if (wParam > pdoc->LineFromPosition(pdoc->Length()))  // Useful test, anyway...
                //      return -1;
                return pdoc->LineStart(wParam);
@@ -3334,6 +3857,39 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                }
                break;
 
+       case SCI_SETTARGETSTART:
+               targetStart = wParam;
+               break;
+
+       case SCI_GETTARGETSTART:
+               return targetStart;
+
+       case SCI_SETTARGETEND:
+               targetEnd = wParam;
+               break;
+
+       case SCI_GETTARGETEND:
+               return targetEnd;
+
+       case SCI_REPLACETARGET:
+               PLATFORM_ASSERT(lParam);
+               return ReplaceTarget(false, reinterpret_cast<char *>(lParam), wParam);
+
+       case SCI_REPLACETARGETRE:
+               PLATFORM_ASSERT(lParam);
+               return ReplaceTarget(true, reinterpret_cast<char *>(lParam), wParam);
+
+       case SCI_SEARCHINTARGET:
+               PLATFORM_ASSERT(lParam);
+               return SearchInTarget(reinterpret_cast<char *>(lParam), wParam);
+
+       case SCI_SETSEARCHFLAGS:
+               searchFlags = wParam;
+               break;
+
+       case SCI_GETSEARCHFLAGS:
+               return searchFlags;
+
        case EM_LINESCROLL:
        case SCI_LINESCROLL:
                ScrollTo(topLine + lParam);
@@ -3355,7 +3911,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
 
        case EM_CANPASTE:
        case SCI_CANPASTE:
-               return 1;
+               return CanPaste();
 
        case EM_CHARFROMPOS: {
                        if (lParam == 0)
@@ -3419,15 +3975,16 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                }
 
 
+
        case EM_SELECTIONTYPE:
 #ifdef SEL_EMPTY
                if (currentPos == anchor)
                        return SEL_EMPTY;
                else
                        return SEL_TEXT;
-#else
+#else 
                return 0;
-#endif
+#endif 
 
        case EM_HIDESELECTION:
                hideSelection = wParam;
@@ -3461,7 +4018,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                        vs.rightMarginWidth = vs.aveCharWidth / 2;
                }
                InvalidateStyleRedraw();
-#endif
+#endif 
                break;
 
        case SCI_SETMARGINLEFT:
@@ -3611,7 +4168,6 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
 
        case SCI_SETSAVEPOINT:
                pdoc->SetSavePoint();
-               NotifySavePoint(true);
                break;
 
        case SCI_GETSTYLEDTEXT: {
@@ -3649,6 +4205,9 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_POSITIONFROMPOINT:
                return PositionFromLocation(Point(wParam, lParam));
 
+       case SCI_POSITIONFROMPOINTCLOSE:
+               return PositionFromLocationClose(Point(wParam, lParam));
+
        case SCI_GOTOLINE:
                GoToLine(wParam);
                break;
@@ -3660,15 +4219,17 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                break;
 
        case SCI_GETCURLINE: {
-                       if (lParam == 0)
+                       if (lParam == 0) {
                                return 0;
+                       }
                        int lineCurrentPos = pdoc->LineFromPosition(currentPos);
                        int lineStart = pdoc->LineStart(lineCurrentPos);
                        unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1);
                        char *ptr = reinterpret_cast<char *>(lParam);
                        unsigned int iPlace = 0;
-                       for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam; iChar++)
+                       for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
+                       }
                        ptr[iPlace] = '\0';
                        return currentPos - lineStart;
                }
@@ -3691,7 +4252,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                pdoc->SetStyleFor(wParam, static_cast<char>(lParam));
                break;
 
-       case SCI_SETSTYLINGEX:    // Specify a complete styling buffer
+       case SCI_SETSTYLINGEX:           // Specify a complete styling buffer
                if (lParam == 0)
                        return 0;
                pdoc->SetStyles(wParam, reinterpret_cast<char *>(lParam));
@@ -3739,6 +4300,28 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_GETLINEINDENTPOSITION:
                return pdoc->GetLineIndentPosition(wParam);
 
+       case SCI_SETTABINDENTS:
+               pdoc->tabIndents = wParam;
+               break;
+
+       case SCI_GETTABINDENTS:
+               return pdoc->tabIndents;
+
+       case SCI_SETBACKSPACEUNINDENTS:
+               pdoc->backspaceUnindents = wParam;
+               break;
+
+       case SCI_GETBACKSPACEUNINDENTS:
+               return pdoc->backspaceUnindents;
+
+       case SCI_SETMOUSEDWELLTIME:
+               dwellDelay = wParam;
+               ticksToDwell = dwellDelay;
+               break;
+       
+       case SCI_GETMOUSEDWELLTIME:
+               return dwellDelay;
+       
        case SCI_GETCOLUMN:
                return pdoc->GetColumn(wParam);
 
@@ -3946,6 +4529,12 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                        InvalidateStyleRedraw();
                }
                break;
+       case SCI_STYLESETCASE:
+               if (wParam <= STYLE_MAX) {
+                       vs.styles[wParam].caseForce = static_cast<Style::ecaseForced>(lParam);
+                       InvalidateStyleRedraw();
+               }
+               break;
        case SCI_STYLESETCHARACTERSET:
                if (wParam <= STYLE_MAX) {
                        vs.styles[wParam].characterSet = lParam;
@@ -3979,6 +4568,19 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_GETMAXLINESTATE:
                return pdoc->GetMaxLineState();
 
+       case SCI_GETCARETLINEVISIBLE:
+               return vs.showCaretLineBackground;
+       case SCI_SETCARETLINEVISIBLE:
+               vs.showCaretLineBackground = wParam;
+               InvalidateStyleRedraw();
+               break;
+       case SCI_GETCARETLINEBACK:
+               return vs.caretLineBackground.desired.AsLong();
+       case SCI_SETCARETLINEBACK:
+               vs.caretLineBackground.desired = wParam;
+               InvalidateStyleRedraw();
+               break;
+
                // Folding messages
 
        case SCI_VISIBLEFROMDOCLINE:
@@ -4037,7 +4639,11 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                break;
 
        case SCI_ENSUREVISIBLE:
-               EnsureLineVisible(wParam);
+               EnsureLineVisible(wParam, false);
+               break;
+
+       case SCI_ENSUREVISIBLEENFORCEPOLICY:
+               EnsureLineVisible(wParam, true);
                break;
 
        case SCI_SEARCHANCHOR:
@@ -4053,6 +4659,11 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                caretSlop = lParam;
                break;
 
+       case SCI_SETVISIBLEPOLICY:
+               visiblePolicy = wParam;
+               visibleSlop = lParam;
+               break;
+
        case SCI_LINESONSCREEN:
                return LinesOnScreen();
 
@@ -4080,6 +4691,19 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_GETCARETFORE:
                return vs.caretcolour.desired.AsLong();
 
+       case SCI_SETCARETWIDTH:
+               if (wParam <= 1)
+                       vs.caretWidth = 1;
+               else if (wParam >= 3)
+                       vs.caretWidth = 3;
+               else
+                       vs.caretWidth = wParam;
+               InvalidateStyleRedraw();
+               break;
+
+       case SCI_GETCARETWIDTH:
+               return vs.caretWidth;
+
        case SCI_ASSIGNCMDKEY:
                kmap.AssignCmdKey(Platform::LowShortFromLong(wParam),
                                  Platform::HighShortFromLong(wParam), lParam);
@@ -4151,6 +4775,8 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_ZOOMOUT:
        case SCI_DELWORDLEFT:
        case SCI_DELWORDRIGHT:
+       case SCI_DELLINELEFT:
+       case SCI_DELLINERIGHT:
        case SCI_LINECUT:
        case SCI_LINEDELETE:
        case SCI_LINETRANSPOSE:
@@ -4158,6 +4784,10 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_UPPERCASE:
        case SCI_LINESCROLLDOWN:
        case SCI_LINESCROLLUP:
+       case SCI_WORDPARTLEFT:
+       case SCI_WORDPARTLEFTEXTEND:
+       case SCI_WORDPARTRIGHT:
+       case SCI_WORDPARTRIGHTEXTEND:
                return KeyCommand(iMessage);
 
        case SCI_BRACEHIGHLIGHT:
@@ -4256,6 +4886,35 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_GETOVERTYPE:
                return inOverstrike ? TRUE : FALSE;
 
+       case SCI_SETFOCUS:
+               SetFocusState(wParam);
+               break;
+
+       case SCI_GETFOCUS:
+               return hasFocus;
+
+       case SCI_SETSTATUS:
+               errorStatus = wParam;
+               break;
+
+       case SCI_GETSTATUS:
+               return errorStatus;
+
+       case SCI_SETMOUSEDOWNCAPTURES:
+               mouseDownCaptures = wParam;
+               break;
+
+       case SCI_GETMOUSEDOWNCAPTURES:
+               return mouseDownCaptures;
+
+       case SCI_SETCURSOR:
+               cursorMode = wParam;
+               DisplayCursor(Window::cursorText);
+               break;
+
+       case SCI_GETCURSOR:
+               return cursorMode;
+
 #ifdef MACRO_SUPPORT
        case SCI_STARTRECORD:
                recordingMacro = 1;
@@ -4264,7 +4923,11 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_STOPRECORD:
                recordingMacro = 0;
                return 0;
-#endif
+#endif 
+
+       case SCI_MOVECARETINSIDEVIEW:
+               MoveCaretInsideView();
+               break;
 
        default:
                return DefWndProc(iMessage, wParam, lParam);
index 83967cfd6a3ae4f6f904dbb01fc344123a461c59..d42f5ad14a133b0d53b1f31f12a7cc05b5cfe9a2 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// Editor.h - defines the main editor class
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Editor.h
+ ** Defines the main editor class.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef EDITOR_H
 #define EDITOR_H
 
+/**
+ */
 class Caret {
 public:
        bool active;
@@ -15,8 +19,9 @@ public:
        Caret();
 };
 
+/**
+ */
 class Timer {
-
 public:
        bool ticking;
        int ticksToWait;
@@ -26,15 +31,18 @@ public:
        Timer();
 };
 
+/**
+ */
 class LineLayout {
 public:
-       // Drawing is only performed for maxLineLength characters on each line.
+       /// Drawing is only performed for @a maxLineLength characters on each line.
        enum {maxLineLength = 4000};
        int numCharsInLine;
        int xHighlightGuide;
        bool highlightColumn;
        int selStart;
        int selEnd;
+       bool containsCaret;
        int edgeColumn;
        char chars[maxLineLength+1];
        char styles[maxLineLength+1];
@@ -42,35 +50,40 @@ public:
        int positions[maxLineLength+1];
 };
 
+/**
+ */
 class Editor : public DocWatcher {
        // Private so Editor objects can not be copied
        Editor(const Editor &) : DocWatcher() {}
        Editor &operator=(const Editor &) { return *this; }
+
 protected:     // ScintillaBase subclass needs access to much of Editor
 
-       // On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area
-       // whereas on Windows there is just one window with both scroll bars turned on.
-       // Therefore, on GTK+ the following are separate windows but only one window on Windows.
-       Window wMain;   // The Scintilla parent window
-       Window wDraw;   // The text drawing area
+       /** On GTK+, Scintilla is a container widget holding two scroll bars
+        * whereas on Windows there is just one window with both scroll bars turned on. */
+       Window wMain;   ///< The Scintilla parent window
 
-       // Style resources may be expensive to allocate so are cached between uses.
-       // When a style attribute is changed, this cache is flushed.
+       /** Style resources may be expensive to allocate so are cached between uses.
+        * When a style attribute is changed, this cache is flushed. */
        bool stylesValid;       
        ViewStyle vs;
        Palette palette;
        int printMagnification;
        int printColourMode;
-       
+       int cursorMode;
+
+       bool hasFocus;
        bool hideSelection;
        bool inOverstrike;
-
-       // In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to 
-       // the screen. This avoids flashing but is about 30% slower.
+       int errorStatus;
+       bool mouseDownCaptures;
+       
+       /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
+        * the screen. This avoids flashing but is about 30% slower. */
        bool bufferedDraw;
 
-       int xOffset;                            // Horizontal scrolled amount in pixels
-       int xCaretMargin;       // Ensure this many pixels visible on both sides of caret
+       int xOffset;            ///< Horizontal scrolled amount in pixels
+       int xCaretMargin;       ///< Ensure this many pixels visible on both sides of caret
        bool horizontalScrollBarVisible;
        
        Surface pixmapLine;
@@ -80,15 +93,20 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        Surface pixmapIndentGuideHighlight;
        // Intellimouse support - currently only implemented for Windows
        unsigned int ucWheelScrollLines;
-       int cWheelDelta; //wheel delta from roll
+       int cWheelDelta; ///< Wheel delta from roll
 
        KeyMap kmap;
 
        Caret caret;
        Timer timer;
+       Timer autoScrollTimer;
+       enum { autoScrollDelay = 200 };
 
        Point lastClick;
        unsigned int lastClickTime;
+       int dwellDelay;
+       int ticksToDwell;
+       bool dwelling;
        enum { selChar, selWord, selLine } selectionType;
        Point ptMouseLast;
        bool firstExpose;
@@ -101,6 +119,9 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        int originalAnchorPos;
        int currentPos;
        int anchor;
+       int targetStart;
+       int targetEnd;
+       int searchFlags;
        int topLine;
        int posTopLine;
        
@@ -128,6 +149,9 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        int caretPolicy;
        int caretSlop;
 
+       int visiblePolicy;
+       int visibleSlop;
+       
        int searchAnchor;
 
        int displayPopupMenu;
@@ -152,15 +176,16 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        void RefreshStyleData();
        void DropGraphics();
 
-       PRectangle GetClientRectangle();
+       virtual PRectangle GetClientRectangle();
        PRectangle GetTextRectangle();
        
        int LinesOnScreen();
        int LinesToScroll();
        int MaxScrollPos();
-       Point LocationFromPosition(unsigned int pos);
-       int XFromPosition(unsigned int pos);
+       Point LocationFromPosition(int pos);
+       int XFromPosition(int pos);
        int PositionFromLocation(Point pt);
+       int PositionFromLocationClose(Point pt);
        int PositionFromLineX(int line, int x);
        int LineFromLocation(Point pt);
        void SetTopLine(int topLineNew);
@@ -187,11 +212,12 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        virtual void ScrollText(int linesToMove);
        void HorizontalScrollTo(int xPos);
        void MoveCaretInsideView();
-       void EnsureCaretVisible(bool useMargin=true);
+       void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true);
        void ShowCaretAtCurrentPosition();
        void DropCaret();
        void InvalidateCaret();
 
+       int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
        void PaintSelMargin(Surface *surface, PRectangle &rc);
         void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout &ll);
        void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, 
@@ -214,6 +240,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        void Cut();
        void PasteRectangular(int pos, const char *ptr, int len);
        virtual void Copy() = 0;
+       virtual bool CanPaste();
        virtual void Paste() = 0;
        void Clear();
        void SelectAll();
@@ -227,14 +254,16 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        virtual void NotifyFocus(bool focus);
        virtual void NotifyParent(SCNotification scn) = 0;
        virtual void NotifyStyleToNeeded(int endStyleNeeded);
-       void NotifyChar(char ch);
+       void NotifyChar(int ch);
        void NotifyMove(int position);
        void NotifySavePoint(bool isSavePoint);
        void NotifyModifyAttempt();
        virtual void NotifyDoubleClick(Point pt, bool shift);
        void NotifyUpdateUI();
+       void NotifyPainted();
        bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
        void NotifyNeedShown(int pos, int len);
+       void NotifyDwelling(Point pt, bool state);
        
        void NotifyModifyAttempt(Document *document, void *userData);
        void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
@@ -253,7 +282,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        virtual void CancelModes();
        virtual int KeyCommand(unsigned int iMessage);
        virtual int KeyDefault(int /* key */, int /*modifiers*/);
-       int KeyDown(int key, bool shift, bool ctrl, bool alt);
+       int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
 
        int GetWhitespaceVisible();
        void SetWhitespaceVisible(int view);
@@ -263,6 +292,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        long FindText(unsigned int iMessage, unsigned long wParam, long lParam);
        void SearchAnchor();
        long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
+       long SearchInTarget(const char *text, int length);
        void GoToLine(int lineNo);
 
        char *CopyRange(int start, int end);
@@ -270,13 +300,16 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        char *CopySelectionRange();
        void CopySelectionIntoDrag();
        void SetDragPosition(int newPos);
+       void DisplayCursor(Window::Cursor c);
        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.
-       // Before means either before any line of selection or before selection on its line, with a similar meaning to after
+       /** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after.
+        * Before means either before any line of selection or before selection on its line, with a similar meaning to after. */
        int PositionInSelection(int pos);
        bool PointInSelection(Point pt);
        bool PointInSelMargin(Point pt);
+       void LineSelection(int lineCurrent_, int lineAnchor_);
+       void DwellEnd(bool mouseMoved);
        virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
        void ButtonMove(Point pt);
        void ButtonUp(Point pt, unsigned int curTime, bool ctrl);
@@ -285,6 +318,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        virtual void SetTicking(bool on) = 0;
        virtual void SetMouseCapture(bool on) = 0;
        virtual bool HaveMouseCapture() = 0;
+       void SetFocusState(bool focusState);
 
        void CheckForChangeOutsidePaint(Range r);
        int BraceMatch(int position, int maxReStyle);
@@ -294,13 +328,14 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        
        void Expand(int &line, bool doExpand);
        void ToggleContraction(int line);
-       void EnsureLineVisible(int line);
+       void EnsureLineVisible(int lineDoc, bool enforcePolicy);
+       int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
 
-       virtual long DefWndProc(unsigned int iMessage, unsigned long wParam, long lParam) = 0;
+       virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
        
 public:
        // Public so scintilla_send_message can use it
-       virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
+       virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
        // Public so scintilla_set_id can use it
        int ctrlID;     
 };
index 05bdf66b53d69a4db04c361ffef854ba5bb08e8b..580e9f86da9e34cbd0615d607bd394a87d1752cd 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Indicator.cxx - defines the style of indicators which are text decorations such as underlining
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Indicator.cxx
+ ** Defines the style of indicators which are text decorations such as underlining.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Platform.h"
index 2472cedc14cd3f64c8625d2a030d7dd0940de0e9..a19b46b5e249da99da843bf5730f1bbccc124b43 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// Indicator.h - defines the style of indicators which are text decorations such as underlining
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Indicator.h
+ ** Defines the style of indicators which are text decorations such as underlining.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef INDICATOR_H
 #define INDICATOR_H
 
+/**
+ */
 class Indicator {
 public:
        int style;
index d2a6660f3c7e3240971cd2ff2b42103d67a75d31..e1fe8e03223e943fb1b8807c17cd2b05e869186e 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// KeyMap.cxx  - defines a mapping between keystrokes and commands
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file KeyMap.cxx 
+ ** Defines a mapping between keystrokes and commands.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Platform.h"
@@ -71,10 +73,14 @@ KeyToCommand KeyMap::MapDefault[] = {
     {SCK_LEFT,         SCI_SHIFT,      SCI_CHARLEFTEXTEND},
     {SCK_LEFT,         SCI_CTRL,       SCI_WORDLEFT},
     {SCK_LEFT,         SCI_CSHIFT,     SCI_WORDLEFTEXTEND},
+    {SCK_LEFT,         SCI_ALT,                SCI_WORDPARTLEFT},
+    {SCK_LEFT,         SCI_ASHIFT,     SCI_WORDPARTLEFTEXTEND},
     {SCK_RIGHT,                SCI_NORM,       SCI_CHARRIGHT},
     {SCK_RIGHT,                SCI_SHIFT,      SCI_CHARRIGHTEXTEND},
     {SCK_RIGHT,                SCI_CTRL,       SCI_WORDRIGHT},
     {SCK_RIGHT,                SCI_CSHIFT,     SCI_WORDRIGHTEXTEND},
+    {SCK_RIGHT,                SCI_ALT,                SCI_WORDPARTRIGHT},
+    {SCK_RIGHT,                SCI_ASHIFT,     SCI_WORDPARTRIGHTEXTEND},
     {SCK_HOME,                 SCI_NORM,       SCI_VCHOME},
     {SCK_HOME,                 SCI_SHIFT,      SCI_VCHOMEEXTEND},
     {SCK_HOME,                 SCI_CTRL,       SCI_DOCUMENTSTART},
@@ -90,6 +96,7 @@ KeyToCommand KeyMap::MapDefault[] = {
     {SCK_DELETE,       SCI_NORM,       SCI_CLEAR},
     {SCK_DELETE,       SCI_SHIFT,      SCI_CUT},
     {SCK_DELETE,       SCI_CTRL,       SCI_DELWORDRIGHT},
+    {SCK_DELETE,       SCI_CSHIFT,     SCI_DELLINERIGHT},
     {SCK_INSERT,               SCI_NORM,       SCI_EDITTOGGLEOVERTYPE},
     {SCK_INSERT,               SCI_SHIFT,      SCI_PASTE},
     {SCK_INSERT,               SCI_CTRL,       SCI_COPY},
@@ -98,6 +105,7 @@ KeyToCommand KeyMap::MapDefault[] = {
     {SCK_BACK,         SCI_SHIFT,      SCI_DELETEBACK},
     {SCK_BACK,         SCI_CTRL,       SCI_DELWORDLEFT},
     {SCK_BACK,                 SCI_ALT,        SCI_UNDO},
+    {SCK_BACK,         SCI_CSHIFT,     SCI_DELLINELEFT},    
     {'Z',                      SCI_CTRL,       SCI_UNDO},
     {'Y',                      SCI_CTRL,       SCI_REDO},
     {'X',                      SCI_CTRL,       SCI_CUT},
index c84310417415db89bc426cfc09d6820410e96560..8232b7160bad68472d80245e0977bb48f7461f32 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// KeyMap.h - defines a mapping between keystrokes and commands
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file KeyMap.h
+ ** Defines a mapping between keystrokes and commands.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef KEYTOCOMMAND_H
@@ -13,6 +15,8 @@
 #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
 #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
 
+/**
+ */
 class KeyToCommand {
 public:
        int key;
@@ -20,11 +24,14 @@ public:
        unsigned int msg;
 };
 
+/**
+ */
 class KeyMap {
        KeyToCommand *kmap;
        int len;
        int alloc;
        static KeyToCommand MapDefault[];
+
 public:
        KeyMap();
        ~KeyMap();
index 113ba222dfbb16ff37b2e6d4dde3d09554404c5f..0728580fdfeb69c50b434c377f58726b7ed659ca 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// KeyWords.cxx - colourise for particular languages
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file KeyWords.cxx
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "SciLexer.h"
 
 LexerModule *LexerModule::base = 0;
+int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
 
-LexerModule::LexerModule(int language_, LexerFunction fn_) :
-       language(language_), fn(fn_) {
+LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
+       const char *languageName_, LexerFunction fnFolder_) :
+       language(language_), 
+       languageName(languageName_), 
+       fnLexer(fnLexer_), 
+       fnFolder(fnFolder_) {
        next = base;
        base = this;
+       if (language == SCLEX_AUTOMATIC) {
+               language = nextLanguage;
+               nextLanguage++;
+       }
 }
 
-void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
-               int language, WordList *keywordlists[], Accessor &styler) {
+LexerModule *LexerModule::Find(int language) {
        LexerModule *lm = base;
        while (lm) {
                if (lm->language == language) {
-                       lm->fn(startPos, lengthDoc, initStyle, keywordlists, styler);
-                       return;
+                       return lm;
                }
                lm = lm->next;
        }
-       // Unknown language
+       return 0;
+}
+
+LexerModule *LexerModule::Find(const char *languageName) {
+       if (languageName) {
+               LexerModule *lm = base;
+               while (lm) {
+                       if (lm->languageName && 0 == strcmp(lm->languageName, languageName)) {
+                               return lm;
+                       }
+                       lm = lm->next;
+               }
+       }
+       return 0;
+}
+
+void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle,
+         WordList *keywordlists[], Accessor &styler) {
+       if (fnLexer)
+               fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler);
+}
+
+void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
+         WordList *keywordlists[], Accessor &styler) {
+       if (fnFolder) {
+               int lineCurrent = styler.GetLine(startPos);
+               // Move back one line in case deletion wrecked current line fold state
+               if (lineCurrent > 0) {
+                       lineCurrent--;
+                       int newStartPos = styler.LineStart(lineCurrent);
+                       lengthDoc += startPos - newStartPos;
+                       startPos = newStartPos;
+                       initStyle = 0;
+                       if (startPos > 0) {
+                               initStyle = styler.StyleAt(startPos - 1);
+                       }
+               }
+               fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler);
+       }
+}
+
+static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[],
+                            Accessor &styler) {
        // Null language means all style bytes are 0 so just mark the end - no need to fill in.
-       if (lengthDoc > 0) {
-               styler.StartAt(startPos + lengthDoc - 1);
-               styler.StartSegment(startPos + lengthDoc - 1);
-               styler.ColourTo(startPos + lengthDoc - 1, 0);
+       if (length > 0) {
+               styler.StartAt(startPos + length - 1);
+               styler.StartSegment(startPos + length - 1);
+               styler.ColourTo(startPos + length - 1, 0);
        }
 }
+
+LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
+
+#ifdef __vms
+
+// The following code forces a reference to all of the Scintilla lexers.
+// If we don't do something like this, then the linker tends to "optimize"
+// them away. (eric@sourcegear.com)
+
+// Taken from wxWindow's stc.cpp. Walter.
+
+int wxForceScintillaLexers(void) {
+  extern LexerModule lmAda;
+  extern LexerModule lmAVE;
+  extern LexerModule lmConf;
+  extern LexerModule lmDiff;
+  extern LexerModule lmLatex;
+  extern LexerModule lmPascal;
+  extern LexerModule lmCPP;
+  extern LexerModule lmHTML;
+  extern LexerModule lmXML;
+  extern LexerModule lmProps;
+  extern LexerModule lmErrorList;
+  extern LexerModule lmMake;
+  extern LexerModule lmBatch;
+  extern LexerModule lmPerl;
+  extern LexerModule lmPython;
+  extern LexerModule lmSQL;
+  extern LexerModule lmVB;
+  extern LexerModule lmRuby;
+
+  if (
+      &lmAda
+      && &lmAVE
+      && &lmConf
+      && &lmDiff
+      && &lmLatex
+      && &lmPascal
+      && &lmCPP
+      && &lmHTML
+      && &lmXML
+      && &lmProps
+      && &lmErrorList
+      && &lmMake
+      && &lmBatch
+      && &lmPerl
+      && &lmPython
+      && &lmSQL
+      && &lmVB
+      && &lmRuby      
+      )
+    {
+      return 1;
+    }
+  else
+    {
+      return 0;
+    }
+}
+#endif
diff --git a/contrib/src/stc/scintilla/src/LexAVE.cxx b/contrib/src/stc/scintilla/src/LexAVE.cxx
new file mode 100644 (file)
index 0000000..a742274
--- /dev/null
@@ -0,0 +1,188 @@
+// SciTE - Scintilla based Text Editor
+/** @file LexAVE.cxx
+ ** Lexer for Avenue.
+ **/
+// Copyright 1998-2001 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 "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+static void ColouriseAveDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+       Accessor &styler) {
+
+       WordList &keywords = *keywordlists[0];
+
+       styler.StartAt(startPos);
+
+       bool fold = styler.GetPropertyInt("fold");
+       int lineCurrent = styler.GetLine(startPos);
+       int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+       int levelCurrent = levelPrev;
+
+       int state = initStyle;
+       if (state == SCE_AVE_STRINGEOL) // Does not leak onto next line
+               state = SCE_AVE_DEFAULT;
+       char chNext = styler[startPos];
+       unsigned int lengthDoc = startPos + length;
+       int visibleChars = 0;
+       styler.StartSegment(startPos);
+
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
+                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+                       // Avoid triggering two times on Dos/Win
+                       // End of line
+                       if (state == SCE_AVE_STRINGEOL) {
+                               styler.ColourTo(i, state);
+                               state = SCE_AVE_DEFAULT;
+                       }
+                       if (fold) {
+                               int lev = levelPrev;
+                               if (visibleChars == 0)
+                                       lev |= SC_FOLDLEVELWHITEFLAG;
+                               if ((levelCurrent > levelPrev) && (visibleChars > 0))
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               styler.SetLevel(lineCurrent, lev);
+                               lineCurrent++;
+                               levelPrev = levelCurrent;
+                       }
+                       visibleChars = 0;
+               }
+               if (!isspace(ch))
+                       visibleChars++;
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_AVE_DEFAULT) {
+                       if (iswordstart(ch) || (ch == '.') )  {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_IDENTIFIER;
+                       } else if (ch == '\'') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_COMMENT;
+                       } else if (ch == '\"') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_STRING;
+                       } else if (ch == '#') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_ENUM;
+                       } else if (isoperator(ch) ) {
+                               styler.ColourTo(i-1, state);
+                               styler.ColourTo(i, SCE_AVE_OPERATOR);
+                       }
+               }
+               else if (state == SCE_AVE_COMMENT) {
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_DEFAULT;
+                       }
+               }
+               else if (state == SCE_AVE_ENUM) {
+                       if (isoperator(ch)  || ch == ' ' || ch == '\'' || ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_DEFAULT;
+                       }
+               }
+               else if (state == SCE_AVE_STRING) {
+                       if (ch == '\"') {
+                               if (chNext == '\"') {
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               } else
+                               {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_AVE_DEFAULT;
+                               }
+                       } else if (chNext == '\r' || chNext == '\n') {
+                               styler.ColourTo(i-1, SCE_AVE_STRINGEOL);
+                               state = SCE_AVE_STRINGEOL;
+                       }
+               }
+               if ((state == SCE_AVE_IDENTIFIER)) {
+                       if (!iswordchar(ch) || ch == '.' ) {
+                               char s[100];
+                               unsigned int start = styler.GetStartSegment();
+                               unsigned int end = i - 1;
+                               for (unsigned int ii = 0; ii < end - start + 1 && ii < 30; ii++)        {
+                                       s[ii] = static_cast<char>(tolower(styler[start + ii]));
+                                       s[ii + 1] = '\0';
+                               }
+
+                               char chAttr = SCE_AVE_IDENTIFIER;
+
+                               if (isdigit(s[0]))
+                                       chAttr = SCE_AVE_NUMBER;
+                               else {
+                                       if ((strcmp(s, "for") == 0) || (strcmp(s, "if") == 0) || (strcmp(s, "while") == 0))
+                                       {
+                                               levelCurrent +=1;
+                                               chAttr = SCE_AVE_STATEMENT;
+                                       }
+
+                                       if (strcmp(s, "end") == 0)
+                                       {
+                                               levelCurrent -=1;
+                                               chAttr = SCE_AVE_STATEMENT;
+                                       }
+
+                                       if ( (strcmp(s, "then") == 0) ||  (strcmp(s, "else") == 0)       || (strcmp(s, "break") == 0) ||
+                                               (strcmp(s, "each") == 0) ||
+                                               (strcmp(s, "exit") == 0) ||  (strcmp(s, "continue") == 0) || (strcmp(s, "return") == 0) ||
+                                               (strcmp(s, "by") == 0)   ||  (strcmp(s, "in") == 0)          || (strcmp(s, "elseif") == 0))
+                                       {
+                                               chAttr = SCE_AVE_STATEMENT;
+                                       }
+
+                                       if ((strcmp(s, "av") == 0) || (strcmp(s, "self") == 0))
+                                       {
+                                               chAttr = SCE_AVE_KEYWORD;
+                                       }
+
+                                       if (keywords.InList(s))
+                                       {
+                                               chAttr = SCE_AVE_WORD;
+                                       }
+                               }
+                               styler.ColourTo(end, chAttr);
+                               state = SCE_AVE_DEFAULT;
+
+                               if (ch == '\'') {
+                                       state = SCE_AVE_COMMENT;
+                               } else if (ch == '\"') {
+                                       state = SCE_AVE_STRING;
+                               } else if (isoperator(ch)) {
+                                       styler.ColourTo(i, SCE_AVE_OPERATOR);
+                               }
+                       }
+               }
+
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+
+       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+       if (fold) {
+               int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+               styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+
+       }
+}
+
+LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave");
diff --git a/contrib/src/stc/scintilla/src/LexAda.cxx b/contrib/src/stc/scintilla/src/LexAda.cxx
new file mode 100644 (file)
index 0000000..91bf00e
--- /dev/null
@@ -0,0 +1,198 @@
+// SciTE - Scintilla based Text Editor
+// LexAda.cxx - lexer for Ada95
+// by Tahir Karaca <tahir@bigfoot.de>
+// 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"
+
+inline void classifyWordAda(unsigned int start, unsigned int end,
+       WordList &keywords, Accessor &styler) {
+
+       static const unsigned KEWORD_LEN_MAX = 30;
+
+       char wordLower[KEWORD_LEN_MAX + 1];
+       unsigned i;
+       for(i = 0; ( i < KEWORD_LEN_MAX ) && ( i < end - start + 1 ); i++) {
+               wordLower[i] = static_cast<char>(tolower(styler[start + i]));           
+       }
+       wordLower[i] = '\0';
+               
+//     int levelChange = 0;
+       char chAttr = SCE_ADA_IDENTIFIER;
+       if (keywords.InList(wordLower)) {
+               chAttr = SCE_ADA_WORD;
+
+// Folding doesn't work this way since the semantics of some keywords depends
+// on the current context.
+// E.g. - "cond1 and THEN cond2" <-> "if ... THEN ..."         
+//      - "procedure X IS ... end X;" <-> "procedure X IS new Y;"
+//             if (strcmp(wordLower, "is") == 0 || strcmp(wordLower, "then") == 0)
+//                     levelChange=1;
+//             else if (strcmp(wordLower, "end") == 0)
+//                     levelChange=-1;
+       }
+       styler.ColourTo(end, chAttr);
+       
+//     return levelChange;
+}
+
+
+inline bool isAdaOperator(char ch) {
+       
+       if (ch == '&' || ch == '\'' || ch == '(' || ch == ')' ||
+               ch == '*' || ch == '+' || ch == ',' || ch == '-' ||
+               ch == '.' || ch == '/' || ch == ':' || ch == ';' ||
+               ch == '<' || ch == '=' || ch == '>')
+               return true;
+       return false;
+}
+
+
+inline void styleTokenBegin(char beginChar, unsigned int pos, int &state,
+       Accessor &styler) {
+               
+       if (isalpha(beginChar)) {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_IDENTIFIER;
+       } else if (isdigit(beginChar)) {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_NUMBER;
+       } else if (beginChar == '-' && styler.SafeGetCharAt(pos + 1) == '-') {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_COMMENT;
+       } else if (beginChar == '\"') {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_STRING;
+       } else if (beginChar == '\'' && styler.SafeGetCharAt(pos + 2) == '\'') {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_CHARACTER;
+       } else if (isAdaOperator(beginChar)) {
+               styler.ColourTo(pos-1, state);
+               styler.ColourTo(pos, SCE_ADA_OPERATOR);
+       }
+}
+
+
+static void ColouriseAdaDoc(unsigned int startPos, int length, int initStyle,
+       WordList *keywordlists[], Accessor &styler) {
+       
+       WordList &keywords = *keywordlists[0];
+       
+       styler.StartAt(startPos);
+       
+//     bool fold = styler.GetPropertyInt("fold");
+//     int lineCurrent = styler.GetLine(startPos);
+//     int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+//     int levelCurrent = levelPrev;
+
+       int state = initStyle;
+       if (state == SCE_ADA_STRINGEOL) // Does not leak onto next line
+               state = SCE_ADA_DEFAULT;
+       char chNext = styler[startPos];
+       const unsigned int lengthDoc = startPos + length;
+       //int visibleChars = 0;
+       styler.StartSegment(startPos);
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
+                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+                       // Avoid triggering two times on Dos/Win
+                       if (state == SCE_ADA_STRINGEOL) {
+                               styler.ColourTo(i, state);
+                               state = SCE_ADA_DEFAULT;
+                       }
+//                     if (fold) {
+//                             int lev = levelPrev;
+//                             if (visibleChars == 0)
+//                                     lev |= SC_FOLDLEVELWHITEFLAG;
+//                             if ((levelCurrent > levelPrev) && (visibleChars > 0))
+//                                     lev |= SC_FOLDLEVELHEADERFLAG;
+//                             styler.SetLevel(lineCurrent, lev);
+//                             lineCurrent++;
+//                             levelPrev = levelCurrent;
+//                     }
+                       //visibleChars = 0;
+               }
+               //if (!isspacechar(ch))
+               //      visibleChars++;
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_ADA_DEFAULT) {
+                       styleTokenBegin(ch, i, state, styler);
+               } else if (state == SCE_ADA_IDENTIFIER) {
+                       if (!iswordchar(ch)) {
+                               classifyWordAda(styler.GetStartSegment(),
+                                                               i - 1,
+                                                               keywords,
+                                                               styler);
+                               state = SCE_ADA_DEFAULT;
+                               styleTokenBegin(ch, i, state, styler);
+                       }
+               } else if (state == SCE_ADA_COMMENT) {
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_ADA_DEFAULT;
+                       }
+               } else if (state == SCE_ADA_STRING) {
+                       if (ch == '"' ) {
+                               if( chNext == '"' ) {
+                                       i++;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               } else {                                        
+                                       styler.ColourTo(i, state);
+                                       state = SCE_ADA_DEFAULT;
+                               }
+                       } else if (chNext == '\r' || chNext == '\n') {
+                               styler.ColourTo(i-1, SCE_ADA_STRINGEOL);
+                               state = SCE_ADA_STRINGEOL;
+                       }
+               } else if (state == SCE_ADA_CHARACTER) {
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i-1, SCE_ADA_STRINGEOL);
+                               state = SCE_ADA_STRINGEOL;
+                       } else if (ch == '\'' && styler.SafeGetCharAt(i - 2) == '\'') {
+                               styler.ColourTo(i, state);
+                               state = SCE_ADA_DEFAULT;
+                       }
+               } else if (state == SCE_ADA_NUMBER) {
+                       if ( !( isdigit(ch) || ch == '.' || ch == '_' || ch == '#'
+                                   || ch == 'A' || ch == 'B' || ch == 'C' || ch == 'D'
+                                       || ch == 'E' || ch == 'F'
+                                       || ch == 'a' || ch == 'b' || ch == 'c' || ch == 'd'
+                                       || ch == 'e' || ch == 'f' ) ) {
+                               styler.ColourTo(i-1, SCE_ADA_NUMBER);
+                               state = SCE_ADA_DEFAULT;
+                               styleTokenBegin(ch, i, state, styler);
+                       }
+               }
+
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+
+//     // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+//     if (fold) {
+//             int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+//             styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+//     }
+}
+
+LexerModule lmAda(SCLEX_ADA, ColouriseAdaDoc, "ada");
index b6358ab3328a955401678b72d455d674dedb40ee..19aa329bafdc2cf76f762de6be183260f54e8d54 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexCPP.cxx - lexer for C++, C, Java, and Javascript
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexCPP.cxx
+ ** Lexer for C++, C, Java, and Javascript.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
-       char s[100];
-       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+static bool IsOKBeforeRE(int ch) {
+       return (ch == '(') || (ch == '=') || (ch == ',');
+}
+
+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] = styler[start + i];
-               s[i + 1] = '\0';
+               i++;
+       }
+       s[i] = '\0';
+}
+
+inline bool IsASpace(int ch) {
+    return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
+
+inline bool IsAWordChar(int  ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+}
+
+inline bool IsAWordStart(int ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '_');
+}
+
+inline bool IsADigit(int ch) {
+       return (ch >= '0') && (ch <= '9');
+}
+
+// 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 
+// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
+class ColouriseContext {
+       Accessor &styler;
+       int lengthDoc;
+       int currentPos;
+       ColouriseContext& operator=(const ColouriseContext&) {
+               return *this;
        }
-       bool wordIsUUID = false;
-       char chAttr = SCE_C_IDENTIFIER;
-       if (isdigit(s[0]) || (s[0] == '.'))
-               chAttr = SCE_C_NUMBER;
-       else {
-               if (keywords.InList(s)) {
-                       chAttr = SCE_C_WORD;
-                       wordIsUUID = strcmp(s, "uuid") == 0; 
+public:
+       bool atEOL;
+       int state;
+       int chPrev;
+       int ch;
+       int chNext;
+
+       ColouriseContext(unsigned int startPos, int length,
+                        int initStyle, Accessor &styler_) : 
+               styler(styler_),
+               lengthDoc(startPos + length),
+               currentPos(startPos), 
+               atEOL(false),
+               state(initStyle), 
+               chPrev(0),
+               ch(0), 
+               chNext(0) {
+               styler.StartAt(startPos);
+               styler.StartSegment(startPos);
+               int pos = currentPos;
+               ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
+               if (styler.IsLeadByte(static_cast<char>(ch))) {
+                       pos++;
+                       ch = ch << 8;
+                       ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
+               }
+               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
+               if (styler.IsLeadByte(static_cast<char>(chNext))) {
+                       chNext = chNext << 8;
+                       chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
                }
+               atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
        }
-       styler.ColourTo(end, chAttr);
-       return wordIsUUID;
-}
+       void Complete() {
+               styler.ColourTo(currentPos - 1, state);
+       }
+       bool More() {
+               return currentPos <= lengthDoc;
+       }
+       void Forward() {
+               // A lot of this is repeated from the constructor - TODO: merge code
+               chPrev = ch;
+               currentPos++;
+               if (ch >= 0x100)
+                       currentPos++;
+               ch = chNext;
+               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
+               if (styler.IsLeadByte(static_cast<char>(chNext))) {
+                       chNext = chNext << 8;
+                       chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
+               }
+               // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+               // Avoid triggering two times on Dos/Win
+               // End of line
+               atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+       }
+       void ChangeState(int state_) {
+               state = state_;
+       }
+       void SetState(int state_) {
+               styler.ColourTo(currentPos - 1, state);
+               state = state_;
+       }
+       void ForwardSetState(int state_) {
+               Forward();
+               styler.ColourTo(currentPos - 1, state);
+               state = state_;
+       }
+       void GetCurrent(char *s, int len) {
+               getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
+       }
+       int LengthCurrent() {
+               return currentPos - styler.GetStartSegment();
+       }
+       bool Match(char ch0) {
+               return ch == ch0;
+       }
+       bool Match(char ch0, char ch1) {
+               return (ch == ch0) && (chNext == ch1);
+       }
+       bool Match(const char *s) {
+               if (ch != *s)
+                       return false;
+               s++;
+               if (chNext != *s)
+                       return false;
+               s++;
+               for (int n=2; *s; n++) {
+                       if (*s != styler.SafeGetCharAt(currentPos+n))
+                               return false;
+                       s++;
+               }
+               return true;
+       }
+};
+
+static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+                            Accessor &styler) {
 
-static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], 
-       Accessor &styler) {
-       
        WordList &keywords = *keywordlists[0];
-       
-       styler.StartAt(startPos);
-       
-       bool fold = styler.GetPropertyInt("fold");
+       WordList &keywords2 = *keywordlists[1];
+
        bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
-       int lineCurrent = styler.GetLine(startPos);
-       int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
-       int levelCurrent = levelPrev;
 
-       int state = initStyle;
-       if (state == SCE_C_STRINGEOL)   // Does not leak onto next line
-               state = SCE_C_DEFAULT;
-       char chPrev = ' ';
-       char chNext = styler[startPos];
-       unsigned int lengthDoc = startPos + length;
+       if (initStyle == SCE_C_STRINGEOL)       // Does not leak onto next line
+               initStyle = SCE_C_DEFAULT;
+
+       int chPrevNonWhite = ' ';
        int visibleChars = 0;
-       styler.StartSegment(startPos);
        bool lastWordWasUUID = false;
-       for (unsigned int i = startPos; i < lengthDoc; i++) {
-               char ch = chNext;
-               chNext = styler.SafeGetCharAt(i + 1);
 
-               if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
-                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
-                       // Avoid triggering two times on Dos/Win
-                       // End of line
-                       if (state == SCE_C_STRINGEOL) {
-                               styler.ColourTo(i, state);
-                               state = SCE_C_DEFAULT;
-                       }
-                       if (fold) {
-                               int lev = levelPrev;
-                               if (visibleChars == 0)
-                                       lev |= SC_FOLDLEVELWHITEFLAG;
-                               if ((levelCurrent > levelPrev) && (visibleChars > 0))
-                                       lev |= SC_FOLDLEVELHEADERFLAG;
-                               styler.SetLevel(lineCurrent, lev);
-                               lineCurrent++;
-                               levelPrev = levelCurrent;
-                       }
-                       visibleChars = 0;
-               }
-               if (!isspace(ch))
-                       visibleChars++;
+       ColouriseContext cc(startPos, length, initStyle, styler);
 
-               if (styler.IsLeadByte(ch)) {
-                       chNext = styler.SafeGetCharAt(i + 2);
-                       chPrev = ' ';
-                       i += 1;
-                       continue;
-               }
+       for (; cc.More(); cc.Forward()) {
 
-               if (state == SCE_C_DEFAULT) {
-                       if (ch == '@' && chNext == '\"') {
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_VERBATIM;
-                               i++;
-                               ch = chNext;
-                               chNext = styler.SafeGetCharAt(i + 1);
-                       } else if (iswordstart(ch) || (ch == '@')) {
-                               styler.ColourTo(i-1, state);
-                               if (lastWordWasUUID) {
-                                       state = SCE_C_UUID;
-                                       lastWordWasUUID = false;
-                               } else {
-                                       state = SCE_C_IDENTIFIER;
-                               }
-                       } else if (ch == '/' && chNext == '*') {
-                               styler.ColourTo(i-1, state);
-                               if (styler.SafeGetCharAt(i + 2) == '*')
-                                       state = SCE_C_COMMENTDOC;
-                               else
-                                       state = SCE_C_COMMENT;
-                       } else if (ch == '/' && chNext == '/') {
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_COMMENTLINE;
-                       } else if (ch == '\"') {
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_STRING;
-                       } else if (ch == '\'') {
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_CHARACTER;
-                       } else if (ch == '#' && visibleChars == 1) {
-                               // Preprocessor commands are alone on their line
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_PREPROCESSOR;
-                               // Skip whitespace between # and preprocessor word
-                               do {
-                                       i++;
-                                       ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
-                               } while (isspace(ch) && (i < lengthDoc));
-                       } else if (isoperator(ch)) {
-                               styler.ColourTo(i-1, state);
-                               styler.ColourTo(i, SCE_C_OPERATOR);
-                               if ((ch == '{') || (ch == '}')) {
-                                       levelCurrent += (ch == '{') ? 1 : -1;
-                               }
+               if (cc.state == SCE_C_STRINGEOL) {
+                       if (cc.atEOL) {
+                               cc.SetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_OPERATOR) {
+                       cc.SetState(SCE_C_DEFAULT);
+               } else if (cc.state == SCE_C_NUMBER) {
+                       if (!IsAWordChar(cc.ch)) {
+                               cc.SetState(SCE_C_DEFAULT);
                        }
-               } else if (state == SCE_C_IDENTIFIER) {
-                       if (!iswordchar(ch)) {
-                               lastWordWasUUID = classifyWordCpp(styler.GetStartSegment(), i - 1, keywords, styler);
-                               state = SCE_C_DEFAULT;
-                               if (ch == '/' && chNext == '*') {
-                                       if (styler.SafeGetCharAt(i + 2) == '*')
-                                               state = SCE_C_COMMENTDOC;
-                                       else
-                                               state = SCE_C_COMMENT;
-                               } else if (ch == '/' && chNext == '/') {
-                                       state = SCE_C_COMMENTLINE;
-                               } else if (ch == '\"') {
-                                       state = SCE_C_STRING;
-                               } else if (ch == '\'') {
-                                       state = SCE_C_CHARACTER;
-                               } else if (isoperator(ch)) {
-                                       styler.ColourTo(i, SCE_C_OPERATOR);
-                                       if ((ch == '{') || (ch == '}')) {
-                                               levelCurrent += (ch == '{') ? 1 : -1;
-                                       }
+               } else if (cc.state == SCE_C_IDENTIFIER) {
+                       if (!IsAWordChar(cc.ch) || (cc.ch == '.')) {
+                               char s[100];
+                               cc.GetCurrent(s, sizeof(s));
+                               if (keywords.InList(s)) {
+                                       lastWordWasUUID = strcmp(s, "uuid") == 0;
+                                       cc.ChangeState(SCE_C_WORD);
+                               } else if (keywords2.InList(s)) {
+                                       cc.ChangeState(SCE_C_WORD2);
                                }
+                               cc.SetState(SCE_C_DEFAULT);
                        }
-               } else {
-                       if (state == SCE_C_PREPROCESSOR) {
-                               if (stylingWithinPreprocessor) {
-                                       if (isspace(ch)) {
-                                               styler.ColourTo(i-1, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
-                               } else {
-                                       if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
-                                               styler.ColourTo(i-1, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
+               } if (cc.state == SCE_C_PREPROCESSOR) {
+                       if (stylingWithinPreprocessor) {
+                               if (IsASpace(cc.ch)) {
+                                       cc.SetState(SCE_C_DEFAULT);
                                }
-                       } else if (state == SCE_C_COMMENT) {
-                               if (ch == '/' && chPrev == '*') {
-                                       if (((i > styler.GetStartSegment() + 2) || (
-                                               (initStyle == SCE_C_COMMENT) && 
-                                               (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
-                                               styler.ColourTo(i, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
+                       } else {
+                               if (cc.atEOL && (cc.chPrev != '\\')) {
+                                       cc.SetState(SCE_C_DEFAULT);
                                }
-                       } else if (state == SCE_C_COMMENTDOC) {
-                               if (ch == '/' && chPrev == '*') {
-                                       if (((i > styler.GetStartSegment() + 2) || (
-                                               (initStyle == SCE_C_COMMENTDOC) && 
-                                               (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
-                                               styler.ColourTo(i, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
+                       }
+               } else if (cc.state == SCE_C_COMMENT) {
+                       if (cc.Match('*', '/')) {
+                               cc.Forward();
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_COMMENTDOC) {
+                       if (cc.Match('*', '/')) {
+                               cc.Forward();
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_COMMENTLINE || cc.state == SCE_C_COMMENTLINEDOC) {
+                       if (cc.ch == '\r' || cc.ch == '\n') {
+                               cc.SetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_STRING) {
+                       if (cc.ch == '\\') {
+                               if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
+                                       cc.Forward();
                                }
-                       } else if (state == SCE_C_COMMENTLINE) {
-                               if (ch == '\r' || ch == '\n') {
-                                       styler.ColourTo(i-1, state);
-                                       state = SCE_C_DEFAULT;
+                       } else if (cc.ch == '\"') {
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       } else if ((cc.atEOL) && (cc.chPrev != '\\')) {
+                               cc.ChangeState(SCE_C_STRINGEOL);
+                       }
+               } else if (cc.state == SCE_C_CHARACTER) {
+                       if ((cc.ch == '\r' || cc.ch == '\n') && (cc.chPrev != '\\')) {
+                               cc.ChangeState(SCE_C_STRINGEOL);
+                       } else if (cc.ch == '\\') {
+                               if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
+                                       cc.Forward();
                                }
-                       } else if (state == SCE_C_STRING) {
-                               if (ch == '\\') {
-                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
-                                               i++;
-                                               ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       }
-                               } else if (ch == '\"') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_C_DEFAULT;
-                               } else if (chNext == '\r' || chNext == '\n') {
-                                       styler.ColourTo(i-1, SCE_C_STRINGEOL);
-                                       state = SCE_C_STRINGEOL;
+                       } else if (cc.ch == '\'') {
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_REGEX) {
+                       if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == '/') {
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       } else if (cc.ch == '\\') {
+                               // Gobble up the quoted character
+                               if (cc.chNext == '\\' || cc.chNext == '/') {
+                                       cc.Forward();
                                }
-                       } else if (state == SCE_C_CHARACTER) {
-                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
-                                       styler.ColourTo(i-1, SCE_C_STRINGEOL);
-                                       state = SCE_C_STRINGEOL;
-                               } else if (ch == '\\') {
-                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
-                                               i++;
-                                               ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       }
-                               } else if (ch == '\'') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_C_DEFAULT;
+                       }
+               } else if (cc.state == SCE_C_VERBATIM) {
+                       if (cc.ch == '\"') {
+                               if (cc.chNext == '\"') {
+                                       cc.Forward();
+                               } else {
+                                       cc.ForwardSetState(SCE_C_DEFAULT);
                                }
-                       } else if (state == SCE_C_VERBATIM) {
-                               if (ch == '\"') {
-                                       if (chNext == '\"') {
-                                               i++;
-                                               ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       } else {
-                                               styler.ColourTo(i, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
+                       }
+               } else if (cc.state == SCE_C_UUID) {
+                       if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == ')') {
+                               cc.SetState(SCE_C_DEFAULT);
+                       }
+               }
+
+               if (cc.state == SCE_C_DEFAULT) {
+                       if (cc.Match('@', '\"')) {
+                               cc.SetState(SCE_C_VERBATIM);
+                               cc.Forward();
+                       } else if (IsADigit(cc.ch) || (cc.ch == '.' && IsADigit(cc.chNext))) {
+                               if (lastWordWasUUID) {
+                                       cc.SetState(SCE_C_UUID);
+                                       lastWordWasUUID = false;
+                               } else {
+                                       cc.SetState(SCE_C_NUMBER);
                                }
-                       } else if (state == SCE_C_UUID) {
-                               if (ch == '\r' || ch == '\n' || ch == ')') {
-                                       styler.ColourTo(i-1, state);
-                                       if (ch == ')')
-                                               styler.ColourTo(i, SCE_C_OPERATOR);
-                                       state = SCE_C_DEFAULT;
+                       } else if (IsAWordStart(cc.ch) || (cc.ch == '@')) {
+                               if (lastWordWasUUID) {
+                                       cc.SetState(SCE_C_UUID);
+                                       lastWordWasUUID = false;
+                               } else {
+                                       cc.SetState(SCE_C_IDENTIFIER);
                                }
+                       } else if (cc.Match('/', '*')) {
+                               if (cc.Match("/**") || cc.Match("/*!")) // Support of Qt/Doxygen doc. style
+                                       cc.SetState(SCE_C_COMMENTDOC);
+                               else
+                                       cc.SetState(SCE_C_COMMENT);
+                               cc.Forward();   // Eat the * so it isn't used for the end of the comment
+                       } else if (cc.Match('/', '/')) {
+                               if (cc.Match("///") || cc.Match("//!")) // Support of Qt/Doxygen doc. style
+                                       cc.SetState(SCE_C_COMMENTLINEDOC);
+                               else
+                                       cc.SetState(SCE_C_COMMENTLINE);
+                       } else if (cc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
+                               cc.SetState(SCE_C_REGEX);
+                       } else if (cc.ch == '\"') {
+                               cc.SetState(SCE_C_STRING);
+                       } else if (cc.ch == '\'') {
+                               cc.SetState(SCE_C_CHARACTER);
+                       } else if (cc.ch == '#' && visibleChars == 0) {
+                               // Preprocessor commands are alone on their line
+                               cc.SetState(SCE_C_PREPROCESSOR);
+                               // Skip whitespace between # and preprocessor word
+                               do {
+                                       cc.Forward();
+                               } while (IsASpace(cc.ch) && cc.More());
+                       } else if (isoperator(static_cast<char>(cc.ch))) {
+                               cc.SetState(SCE_C_OPERATOR);
                        }
                }
-               chPrev = ch;
+               if (cc.atEOL) {
+                       // Reset states to begining of colourise so no surprises 
+                       // if different sets of lines lexed.
+                       chPrevNonWhite = ' ';
+                       visibleChars = 0;
+                       lastWordWasUUID = false;
+               }
+               if (!IsASpace(cc.ch)) {
+                       chPrevNonWhite = cc.ch;
+                       visibleChars++;
+               }
        }
-       styler.ColourTo(lengthDoc - 1, state);
+       cc.Complete();
+}
 
-       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
-       if (fold) {
-               int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
-               //styler.SetLevel(lineCurrent, levelCurrent | flagsNext);
-               styler.SetLevel(lineCurrent, levelPrev | flagsNext);
-               
+static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+                            Accessor &styler) {
+       bool foldComment = styler.GetPropertyInt("fold.comment");
+       bool foldCompact = styler.GetPropertyInt("fold.compact", 1);
+       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;
+       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 &&
+                       (style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC)) {
+                       if (style != stylePrev) {
+                               levelCurrent++;
+                       } else if ((style != styleNext) && !atEOL) {
+                               // Comments don't end at end of line and the next character may be unstyled.
+                               levelCurrent--;
+                       }
+               }
+               if (style == SCE_C_OPERATOR) {
+                       if (ch == '{') {
+                               levelCurrent++;
+                       } else if (ch == '}') {
+                               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);
 }
 
-LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc);
+LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc);
+LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc);
diff --git a/contrib/src/stc/scintilla/src/LexConf.cxx b/contrib/src/stc/scintilla/src/LexConf.cxx
new file mode 100644 (file)
index 0000000..2dbb65c
--- /dev/null
@@ -0,0 +1,177 @@
+// Scintilla source code edit control
+/** @file LexConf.cxx
+ ** Lexer for Apache Configuration Files.
+ **
+ ** First working version contributed by Ahmad Zawawi <zeus_go64@hotmail.com> on October 28, 2000.
+ ** i created this lexer because i needed something pretty when dealing
+ ** when Apache Configuration files...
+ **/
+// Copyright 1998-2001 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 "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
+{
+       int state = SCE_CONF_DEFAULT;
+       char chNext = styler[startPos];
+       int lengthDoc = startPos + length;
+       // create a buffer large enough to take the largest chunk...
+       char *buffer = new char[length];
+       int bufferCount = 0;
+
+       // this assumes that we have 2 keyword list in conf.properties
+       WordList &directives = *keywordLists[0];
+       WordList &params = *keywordLists[1];
+
+       // go through all provided text segment
+       // using the hand-written state machine shown below
+       styler.StartAt(startPos);
+       styler.StartSegment(startPos);
+       for (int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       i++;
+                       continue;
+               }
+               switch(state) {
+                       case SCE_CONF_DEFAULT:
+                               if( ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') {
+                                       // whitespace is simply ignored here...
+                                       styler.ColourTo(i,SCE_CONF_DEFAULT);
+                                       break;
+                               } else if( ch == '#' ) {
+                                       // signals the start of a comment...
+                                       state = SCE_CONF_COMMENT;
+                                       styler.ColourTo(i,SCE_CONF_COMMENT);
+                               } else if( ch == '.' /*|| ch == '/'*/) {
+                                       // signals the start of a file...
+                                       state = SCE_CONF_EXTENSION;
+                                       styler.ColourTo(i,SCE_CONF_EXTENSION);
+                               } else if( ch == '"') {
+                                       state = SCE_CONF_STRING;
+                                       styler.ColourTo(i,SCE_CONF_STRING);
+                               } else if( ispunct(ch) ) {
+                                       // signals an operator...
+                                       // no state jump necessary for this
+                                       // simple case...
+                                       styler.ColourTo(i,SCE_CONF_OPERATOR);
+                               } else if( isalpha(ch) ) {
+                                       // signals the start of an identifier
+                                       bufferCount = 0;
+                                       buffer[bufferCount++] = static_cast<char>(tolower(ch));
+                                       state = SCE_CONF_IDENTIFIER;
+                               } else if( isdigit(ch) ) {
+                                       // signals the start of a number
+                                       bufferCount = 0;
+                                       buffer[bufferCount++] = ch;
+                                       //styler.ColourTo(i,SCE_CONF_NUMBER);
+                                       state = SCE_CONF_NUMBER;
+                               } else {
+                                       // style it the default style..
+                                       styler.ColourTo(i,SCE_CONF_DEFAULT);
+                               }
+                               break;
+
+                       case SCE_CONF_COMMENT:
+                               // if we find a newline here,
+                               // we simply go to default state
+                               // else continue to work on it...
+                               if( ch == '\n' || ch == '\r' ) {
+                                       state = SCE_CONF_DEFAULT;
+                               } else {
+                                       styler.ColourTo(i,SCE_CONF_COMMENT);
+                               }
+                               break;
+
+                       case SCE_CONF_EXTENSION:
+                               // if we find a non-alphanumeric char,
+                               // we simply go to default state
+                               // else we're still dealing with an extension...
+                               if( isalnum(ch) || (ch == '_') ||
+                                       (ch == '-') || (ch == '$') ||
+                                       (ch == '/') || (ch == '.') || (ch == '*') )
+                               {
+                                       styler.ColourTo(i,SCE_CONF_EXTENSION);
+                               } else {
+                                       state = SCE_CONF_DEFAULT;
+                                       chNext = styler[i--];
+                               }
+                               break;
+
+                       case SCE_CONF_STRING:
+                               // if we find the end of a string char, we simply go to default state
+                               // else we're still dealing with an string...
+                               if( (ch == '"' && styler.SafeGetCharAt(i-1)!='\\') || (ch == '\n') || (ch == '\r') ) {
+                                       state = SCE_CONF_DEFAULT;
+                               }
+                               styler.ColourTo(i,SCE_CONF_STRING);
+                               break;
+
+                       case SCE_CONF_IDENTIFIER:
+                               // stay  in CONF_IDENTIFIER state until we find a non-alphanumeric
+                               if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) {
+                                       buffer[bufferCount++] = static_cast<char>(tolower(ch));
+                               } else {
+                                       state = SCE_CONF_DEFAULT;
+                                       buffer[bufferCount] = '\0';
+
+                                       // check if the buffer contains a keyword, and highlight it if it is a keyword...
+                                       if(directives.InList(buffer)) {
+                                               styler.ColourTo(i-1,SCE_CONF_DIRECTIVE );
+                                       } else if(params.InList(buffer)) {
+                                               styler.ColourTo(i-1,SCE_CONF_PARAMETER );
+                                       } else if(strchr(buffer,'/') || strchr(buffer,'.')) {
+                                               styler.ColourTo(i-1,SCE_CONF_EXTENSION);
+                                       } else {
+                                               styler.ColourTo(i-1,SCE_CONF_DEFAULT);
+                                       }
+
+                                       // push back the faulty character
+                                       chNext = styler[i--];
+
+                               }
+                               break;
+
+                       case SCE_CONF_NUMBER:
+                               // stay  in CONF_NUMBER state until we find a non-numeric
+                               if( isdigit(ch) || ch == '.') {
+                                       buffer[bufferCount++] = ch;
+                               } else {
+                                       state = SCE_CONF_DEFAULT;
+                                       buffer[bufferCount] = '\0';
+
+                                       // Colourize here...
+                                       if( strchr(buffer,'.') ) {
+                                               // it is an IP address...
+                                               styler.ColourTo(i-1,SCE_CONF_IP);
+                                       } else {
+                                               // normal number
+                                               styler.ColourTo(i-1,SCE_CONF_NUMBER);
+                                       }
+
+                                       // push back a character
+                                       chNext = styler[i--];
+                               }
+                               break;
+
+               }
+       }
+}
+
+LexerModule lmConf(SCLEX_CONF, ColouriseConfDoc, "conf");
diff --git a/contrib/src/stc/scintilla/src/LexEiffel.cxx b/contrib/src/stc/scintilla/src/LexEiffel.cxx
new file mode 100644 (file)
index 0000000..1296fb2
--- /dev/null
@@ -0,0 +1,321 @@
+// Scintilla source code edit control
+/** @file LexEiffel.cxx
+ ** Lexer for Eiffel.
+ **/
+// Copyright 1998-2001 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 <stdarg.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+inline bool isEiffelOperator(unsigned int ch) {
+       // '.' left out as it is used to make up numbers
+       return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' ||
+               ch == '(' || ch == ')' || ch == '=' ||
+               ch == '{' || ch == '}' || ch == '~' ||
+               ch == '[' || ch == ']' || ch == ';' ||
+               ch == '<' || ch == '>' || ch == ',' ||
+               ch == '.' || ch == '^' || ch == '%' || ch == ':' || 
+               ch == '!' || ch == '@' || ch == '?';
+}
+
+static void getRangeLowered(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';
+}
+
+inline bool IsASpace(unsigned int ch) {
+    return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
+
+inline bool IsAWordChar(unsigned int  ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+}
+
+inline bool IsAWordStart(unsigned int ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '_');
+}
+
+inline bool IsADigit(unsigned int ch) {
+       return (ch >= '0') && (ch <= '9');
+}
+
+// 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 
+// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
+class xColouriseContext {
+       Accessor &styler;
+       int lengthDoc;
+       int currentPos;
+       xColouriseContext& operator=(const xColouriseContext&) {
+               return *this;
+       }
+public:
+       int state;
+       unsigned int chPrev;
+       unsigned int ch;
+       unsigned int chNext;
+
+       xColouriseContext(unsigned int startPos, int length,
+                        int initStyle, Accessor &styler_) : 
+               styler(styler_),
+               lengthDoc(startPos + length),
+               currentPos(startPos), 
+               state(initStyle), 
+               chPrev(0),
+               ch(0), 
+               chNext(0) {
+               styler.StartAt(startPos);
+               styler.StartSegment(startPos);
+               int pos = currentPos;
+               ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
+               if (styler.IsLeadByte(static_cast<char>(ch))) {
+                       pos++;
+                       ch = ch << 8;
+                       ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
+               }
+               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
+               if (styler.IsLeadByte(static_cast<char>(chNext))) {
+                       chNext = chNext << 8;
+                       chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
+               }
+       }
+       void Complete() {
+               styler.ColourTo(currentPos - 1, state);
+       }
+       bool More() {
+               return currentPos <= lengthDoc;
+       }
+       void Forward() {
+               chPrev = ch;
+               currentPos++;
+               if (ch >= 0x100)
+                       currentPos++;
+               ch = chNext;
+               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
+               if (styler.IsLeadByte(static_cast<char>(chNext))) {
+                       chNext = chNext << 8;
+                       chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
+               }
+       }
+       void ChangeState(int state_) {
+               state = state_;
+       }
+       void SetState(int state_) {
+               styler.ColourTo(currentPos - 1, state);
+               state = state_;
+       }
+       void GetCurrentLowered(char *s, int len) {
+               getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
+       }
+};
+
+static void ColouriseEiffelDoc(unsigned int startPos,
+                            int length,
+                            int initStyle,
+                            WordList *keywordlists[],
+                            Accessor &styler) {
+
+       WordList &keywords = *keywordlists[0];
+
+       xColouriseContext lc(startPos, length, initStyle, styler);
+
+       for (; lc.More(); lc.Forward()) {
+
+               if (lc.state == SCE_EIFFEL_STRINGEOL) {
+                       if (lc.ch != '\r' && lc.ch != '\n') {
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_OPERATOR) {
+                       lc.SetState(SCE_EIFFEL_DEFAULT);
+               } else if (lc.state == SCE_EIFFEL_WORD) {
+                       if (!IsAWordChar(lc.ch)) {
+                               char s[100];
+                               lc.GetCurrentLowered(s, sizeof(s));
+                               if (!keywords.InList(s)) {
+                                       lc.ChangeState(SCE_EIFFEL_IDENTIFIER);
+                               }
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_NUMBER) {
+                       if (!IsAWordChar(lc.ch)) {
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_COMMENTLINE) {
+                       if (lc.ch == '\r' || lc.ch == '\n') {
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_STRING) {
+                       if (lc.ch == '%') {
+                               lc.Forward();
+                       } else if (lc.ch == '\"') {
+                               lc.Forward();
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_CHARACTER) {
+                       if (lc.ch == '\r' || lc.ch == '\n') {
+                               lc.SetState(SCE_EIFFEL_STRINGEOL);
+                       } else if (lc.ch == '%') {
+                               lc.Forward();
+                       } else if (lc.ch == '\'') {
+                               lc.Forward();
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               }
+
+               if (lc.state == SCE_EIFFEL_DEFAULT) {
+                       if (lc.ch == '-' && lc.chNext == '-') {
+                               lc.SetState(SCE_EIFFEL_COMMENTLINE);
+                       } else if (lc.ch == '\"') {
+                               lc.SetState(SCE_EIFFEL_STRING);
+                       } else if (lc.ch == '\'') {
+                               lc.SetState(SCE_EIFFEL_CHARACTER);
+                       } else if (IsADigit(lc.ch) || (lc.ch == '.')) {
+                               lc.SetState(SCE_EIFFEL_NUMBER);
+                       } else if (IsAWordStart(lc.ch)) {
+                               lc.SetState(SCE_EIFFEL_WORD);
+                       } else if (isEiffelOperator(lc.ch)) {
+                               lc.SetState(SCE_EIFFEL_OPERATOR);
+                       }
+               }
+       }
+       lc.Complete();
+}
+
+static bool IsEiffelComment(Accessor &styler, int pos, int len) {
+       return len>1 && styler[pos]=='-' && styler[pos+1]=='-';
+}
+
+static void FoldEiffelDocIndent(unsigned int startPos, int length, int,
+                                                  WordList *[], Accessor &styler) {
+       int lengthDoc = startPos + length;
+
+       // Backtrack to previous line in case need to fix its fold status
+       int lineCurrent = styler.GetLine(startPos);
+       if (startPos > 0) {
+               if (lineCurrent > 0) {
+                       lineCurrent--;
+                       startPos = styler.LineStart(lineCurrent);
+               }
+       }
+       int spaceFlags = 0;
+       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment);
+       char chNext = styler[startPos];
+       for (int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
+                       int lev = indentCurrent;
+                       int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsEiffelComment);
+                       if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
+                               // Only non whitespace lines can be headers
+                               if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
+                                       // Line after is blank so check the next - maybe should continue further?
+                                       int spaceFlags2 = 0;
+                                       int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsEiffelComment);
+                                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
+                                               lev |= SC_FOLDLEVELHEADERFLAG;
+                                       }
+                               }
+                       }
+                       indentCurrent = indentNext;
+                       styler.SetLevel(lineCurrent, lev);
+                       lineCurrent++;
+               }
+       }
+}
+
+static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+                       Accessor &styler) {
+       unsigned int lengthDoc = 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 stylePrev = 0;
+       int styleNext = styler.StyleAt(startPos);
+       // lastDeferred should be determined by looking back to last keyword in case
+       // the "deferred" is on a line before "class"
+       bool lastDeferred = false;
+       for (unsigned int i = startPos; i < lengthDoc; 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 ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) {
+                       char s[20];
+                       unsigned int j = 0;
+                       while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) {
+                               s[j] = styler[i + j];
+                               j++;
+                       }
+                       s[j] = '\0';
+
+                       if (
+                               (strcmp(s, "check") == 0) || 
+                               (strcmp(s, "debug") == 0) || 
+                               (strcmp(s, "deferred") == 0) || 
+                               (strcmp(s, "do") == 0) || 
+                               (strcmp(s, "from") == 0) ||
+                               (strcmp(s, "if") == 0) ||
+                               (strcmp(s, "inspect") == 0) || 
+                               (strcmp(s, "once") == 0)
+                       )
+                               levelCurrent++;
+                       if (!lastDeferred && (strcmp(s, "class") == 0))
+                               levelCurrent++;
+                       if (strcmp(s, "end") == 0) 
+                               levelCurrent--;
+                       lastDeferred = strcmp(s, "deferred") == 0;
+               }
+
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0)
+                               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++;
+               stylePrev = style;
+       }
+       // 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 lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent);
+LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords);
index 7868b47fc8c11d283b3da0d70b22a7ac5419b468..c28a43279544eaa2d76ac4a27927d51a4ccc9c34 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexHTML.cxx - lexer for HTML
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexHTML.cxx
+ ** Lexer for HTML.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
@@ -32,6 +34,8 @@ static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigne
                s[i + 1] = '\0';
        }
        //Platform::DebugPrintf("Scripting indicator [%s]\n", s);
+       if (strstr(s, "src"))   // External script
+               return eScriptNone;
        if (strstr(s, "vbs"))
                return eScriptVBS;
        if (strstr(s, "pyth"))
@@ -63,7 +67,6 @@ static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, u
        return iResult;
 }
 
-//static int ScriptOfState(int state,int defaultScript)
 static int ScriptOfState(int state) {
        int scriptLanguage;
 
@@ -71,7 +74,7 @@ static int ScriptOfState(int state) {
                scriptLanguage = eScriptPython;
        } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
                scriptLanguage = eScriptVBS;
-       } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_STRINGEOL)) {
+       } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
                scriptLanguage = eScriptJS;
        } else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) {
                scriptLanguage = eScriptPHP;
@@ -90,7 +93,7 @@ static int statePrintForState(int state, int inScriptType) {
                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_STRINGEOL)) {
+       } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
                StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS);
        } else {
                StateToPrint = state;
@@ -106,7 +109,7 @@ static int stateForPrintState(int StateToPrint) {
                state = StateToPrint - SCE_HA_PYTHON;
        } else if ((StateToPrint >= SCE_HBA_START) && (StateToPrint <= SCE_HBA_STRINGEOL)) {
                state = StateToPrint - SCE_HA_VBS;
-       } else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_STRINGEOL)) {
+       } else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_REGEX)) {
                state = StateToPrint - SCE_HA_JS;
        } else {
                state = StateToPrint;
@@ -117,7 +120,51 @@ static int stateForPrintState(int StateToPrint) {
 
 static inline bool IsNumber(unsigned int start, Accessor &styler) {
        return isdigit(styler[start]) || (styler[start] == '.') ||
-                           (styler[start] == '-') || (styler[start] == '#');
+              (styler[start] == '-') || (styler[start] == '#');
+}
+
+static inline bool isStringState(int state) {
+       bool bResult;
+
+       switch (state) {
+       case SCE_HJ_DOUBLESTRING:
+       case SCE_HJ_SINGLESTRING:
+       case SCE_HJA_DOUBLESTRING:
+       case SCE_HJA_SINGLESTRING:
+       case SCE_HB_STRING:
+       case SCE_HBA_STRING:
+       case SCE_HP_STRING:
+       case SCE_HPA_STRING:
+       case SCE_HPHP_HSTRING:
+       case SCE_HPHP_SIMPLESTRING:
+               bResult = true;
+               break;
+       default :
+               bResult = false;
+               break;
+       }
+       return bResult;
+}
+
+// not really well done, since it's only comments that should lex the %> and <%
+static inline bool isCommentASPState(int state) {
+       bool bResult;
+
+       switch (state) {
+       case SCE_HJ_COMMENT:
+       case SCE_HJ_COMMENTLINE:
+       case SCE_HJ_COMMENTDOC:
+       case SCE_HB_COMMENTLINE:
+       case SCE_HP_COMMENTLINE:
+       case SCE_HPHP_COMMENT:
+       case SCE_HPHP_COMMENTLINE:
+               bResult = true;
+               break;
+       default :
+               bResult = false;
+               break;
+       }
+       return bResult;
 }
 
 static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
@@ -152,27 +199,28 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
                        s[i++] = static_cast<char>(tolower(ch));
        }
        s[i] = '\0';
+       bool isScript = false;
        char chAttr = SCE_H_TAGUNKNOWN;
        if (s[0] == '!' && s[1] == '-' && s[2] == '-') {        //Comment
                chAttr = SCE_H_COMMENT;
        } else if (strcmp(s, "![cdata[") == 0) {        // In lower case because already converted
                chAttr = SCE_H_CDATA;
+       } else if (s[0] == '!') {
+               chAttr = SCE_H_SGML;
        } else if (s[0] == '/') {       // Closing tag
                if (keywords.InList(s + 1))
                        chAttr = SCE_H_TAG;
        } else {
                if (keywords.InList(s)) {
                        chAttr = SCE_H_TAG;
-               }
-               if (0 == strcmp(s, "script")) {
-                       chAttr = SCE_H_SCRIPT;
+                       isScript = 0 == strcmp(s, "script");
                }
        }
        if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords)
                // No keywords -> all are known
                chAttr = SCE_H_TAG;
        styler.ColourTo(end, chAttr);
-       return chAttr;
+       return isScript ? SCE_H_SCRIPT : chAttr;
 }
 
 static void classifyWordHTJS(unsigned int start, unsigned int end,
@@ -295,6 +343,17 @@ static bool isLineEnd(char ch) {
        return ch == '\r' || ch == '\n';
 }
 
+static bool isOKBeforeRE(char ch) {
+       return (ch == '(') || (ch == '=') || (ch == ',');
+}
+
+static bool isPHPStringState(int state) {
+       return 
+               (state == SCE_HPHP_HSTRING) ||
+               (state == SCE_HPHP_SIMPLESTRING) ||
+               (state == SCE_HPHP_HSTRING_VARIABLE);
+}
+
 static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
                                   Accessor &styler) {
 
@@ -313,8 +372,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 
        // If inside a tag, it may be a script tag, so reread from the start to ensure any language tags are seen
        if (InTagState(state)) {
-               while ((startPos > 1) && (InTagState(styler.StyleAt(startPos - 1)))) {
+               while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) {
                        startPos--;
+            length++;
                }
                state = SCE_H_DEFAULT;
        }
@@ -324,25 +384,36 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
        int lineCurrent = styler.GetLine(startPos);
        if (lineCurrent > 0)
                lineState = styler.GetLineState(lineCurrent);
-       int inScriptType = (lineState >> 0) & 0x03; // 2 bits
-       int defaultScript = (lineState >> 4) & 0x0F; // 4 bits
-       int beforePreProc = (lineState >> 8) & 0xFF; // 8 bits
+       int inScriptType  = (lineState >> 0) & 0x03; // 2 bits of scripting type
+       bool tagOpened    = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
+       bool tagClosing   = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
+       int defaultScript = (lineState >> 4) & 0x0F; // 4 bits of script name
+       int beforePreProc = (lineState >> 8) & 0xFF; // 8 bits of state
 
-       //      int scriptLanguage = ScriptOfState(state,defaultScript);
        int scriptLanguage = ScriptOfState(state);
 
        bool fold = styler.GetPropertyInt("fold");
+       bool foldHTML = styler.GetPropertyInt("fold.html",0);
+       bool foldCompact = styler.GetPropertyInt("fold.compact",1);
+
+       fold = foldHTML && fold;
+
        int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
        int levelCurrent = levelPrev;
-       int visibleChars = 0;
+       int visibleChars;
+
+       visibleChars = 0;
 
        char chPrev = ' ';
        char ch = ' ';
+       char chPrevNonWhite = ' ';
        styler.StartSegment(startPos);
        int lengthDoc = startPos + length;
        for (int i = startPos; i < lengthDoc; i++) {
                char chPrev2 = chPrev;
                chPrev = ch;
+               if (ch != ' ' && ch != '\t')
+                       chPrevNonWhite = ch;
                ch = styler[i];
                char chNext = styler.SafeGetCharAt(i + 1);
                char chNext2 = styler.SafeGetCharAt(i + 2);
@@ -354,40 +425,44 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        continue;
                }
 
-               if (fold && !isspace(ch))
+               if ((!isspacechar(ch) || !foldCompact) && fold)
                        visibleChars++;
 
+               // decide what is the current state to print (depending of the script tag)
+               StateToPrint = statePrintForState(state, inScriptType);
+
                // handle script folding
                if (fold) {
                        switch (scriptLanguage) {
                        case eScriptJS:
                        case eScriptPHP:
                                //not currently supported                               case eScriptVBS:
+
                                if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC)) {
-                               if ((ch == '{') || (ch == '}')) {
-                                       levelCurrent += (ch == '{') ? 1 : -1;
+                                       if ((ch == '{') || (ch == '}')) {
+                                               levelCurrent += (ch == '{') ? 1 : -1;
                                        }
                                }
                                break;
                        case eScriptPython:
                                if (state != SCE_HP_COMMENTLINE) {
-                               if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) {
-                                       levelCurrent++;
-                               } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
-                                       // check if the number of tabs is lower than the level
-                                       int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
-                                       for (int j = 0;Findlevel > 0;j++) {
-                                               char chTmp = styler.SafeGetCharAt(i + j + 1);
-                                               if (chTmp == '\t') {
-                                                       Findlevel -= 8;
-                                               }       else if (chTmp == ' ') {
-                                                       Findlevel--;
-                                               }       else break;
-                                       }
+                                       if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) {
+                                               levelCurrent++;
+                                       } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
+                                               // check if the number of tabs is lower than the level
+                                               int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
+                                               for (int j = 0;Findlevel > 0;j++) {
+                                                       char chTmp = styler.SafeGetCharAt(i + j + 1);
+                                                       if (chTmp == '\t') {
+                                                               Findlevel -= 8;
+                                                       }       else if (chTmp == ' ') {
+                                                               Findlevel--;
+                                                       }       else break;
+                                               }
 
-                                       if (Findlevel > 0) {
-                                               levelCurrent -= Findlevel / 8;
-                                               if (Findlevel % 8) levelCurrent--;
+                                               if (Findlevel > 0) {
+                                                       levelCurrent -= Findlevel / 8;
+                                                       if (Findlevel % 8) levelCurrent--;
                                                }
                                        }
                                }
@@ -395,9 +470,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                }
 
-               // decide what is the current state to print (depending of the script tag)
-               StateToPrint = statePrintForState(state, inScriptType);
-
                if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
                        // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
                        // Avoid triggering two times on Dos/Win
@@ -408,13 +480,16 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        lev |= SC_FOLDLEVELWHITEFLAG;
                                if ((levelCurrent > levelPrev) && (visibleChars > 0))
                                        lev |= SC_FOLDLEVELHEADERFLAG;
+
                                styler.SetLevel(lineCurrent, lev);
                                visibleChars = 0;
                                levelPrev = levelCurrent;
                        }
                        lineCurrent++;
                        styler.SetLineState(lineCurrent,
-                                           ((inScriptType & 0x03) << 0) |
+                                           ((inScriptType  & 0x03) << 0) |
+                                                               ((tagOpened     & 0x01) << 2) |
+                                                               ((tagClosing    & 0x01) << 3) |
                                            ((defaultScript & 0x0F) << 4) |
                                            ((beforePreProc & 0xFF) << 8));
                }
@@ -428,7 +503,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        case SCE_H_SINGLESTRING:
                        case SCE_HJ_COMMENT:
                        case SCE_HJ_COMMENTDOC:
-                       case SCE_HJ_COMMENTLINE:
+                       // 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_COMMENTLINE:
                        case SCE_HJ_DOUBLESTRING:
                        case SCE_HJ_SINGLESTRING:
                        case SCE_HB_STRING:
@@ -438,19 +515,24 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                break;
                        default :
                                // maybe we should check here if it's a tag and if it's SCRIPT
-
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_H_TAGUNKNOWN;
                                inScriptType = eHtml;
                                scriptLanguage = eScriptNone;
                                i += 2;
+                               // unfold closing script
+                               levelCurrent--;
                                continue;
                        }
                }
 
                /////////////////////////////////////
                // handle the start of PHP pre-processor = Non-HTML
-               else if ((ch == '<') && (chNext == '?')) {
+               else if ((state != SCE_H_ASPAT) && 
+                               !isPHPStringState(state) && 
+                               (state != SCE_HPHP_COMMENT) && 
+                               (ch == '<') && 
+                               (chNext == '?')) {
                        styler.ColourTo(i - 1, StateToPrint);
                        beforePreProc = state;
                        scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
@@ -465,11 +547,17 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                inScriptType = eNonHtmlScriptPreProc;
                        else
                                inScriptType = eNonHtmlPreProc;
+                       // fold whole script
+                       levelCurrent++;
+                       if (scriptLanguage == eScriptXML)
+                               levelCurrent--; // no folding of the XML first tag (all XML-like tags in this case)
+                       // should be better
+                       ch = styler.SafeGetCharAt(i);
                        continue;
                }
 
                // handle the start of ASP pre-processor = Non-HTML
-               else if ((ch == '<') && (chNext == '%')) {
+               else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%')) {
                        styler.ColourTo(i - 1, StateToPrint);
                        beforePreProc = state;
                        if (inScriptType == eNonHtmlScript)
@@ -480,25 +568,40 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        if (chNext2 == '@') {
                                i += 2; // place as if it was the second next char treated
                                state = SCE_H_ASPAT;
+                       } else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) {
+                               styler.ColourTo(i + 3, SCE_H_ASP);
+                               state = SCE_H_XCCOMMENT;
+                               scriptLanguage = eScriptVBS;
+                               continue;
                        } else {
                                if (chNext2 == '=') {
                                        i += 2; // place as if it was the second next char treated
-                               }
-                               else {
+                               } else {
                                        i++; // place as if it was the next char treated
                                }
 
-
                                state = StateForScript(defaultScript);
                        }
+                       scriptLanguage = eScriptVBS;
                        styler.ColourTo(i, SCE_H_ASP);
+                       // fold whole script
+                       levelCurrent++;
+                       // should be better
+                       ch = styler.SafeGetCharAt(i);
                        continue;
                }
 
                // handle the end of a pre-processor = Non-HTML
-               else if (((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && ((ch == '?') || (ch == '%')) && (chNext == '>')) {
+               else if (
+                       ((inScriptType == eNonHtmlPreProc)
+                               || (inScriptType == eNonHtmlScriptPreProc)) && (
+                               ((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) || 
+                               ((scriptLanguage != eScriptNone) && !isStringState(state) &&
+                                (ch == '%'))
+                       ) && (chNext == '>')) {
                        if (state == SCE_H_ASPAT) {
-                               defaultScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, defaultScript);
+                               defaultScript = segIsScriptingIndicator(styler,
+                                       styler.GetStartSegment(), i - 1, defaultScript);
                        }
                        // Bounce out of any ASP mode
                        switch (state) {
@@ -514,6 +617,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        case SCE_HPHP_WORD:
                                classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
                                break;
+                       case SCE_H_XCCOMMENT:
+                               styler.ColourTo(i - 1, state);
+                               break;
                        default :
                                styler.ColourTo(i - 1, StateToPrint);
                                break;
@@ -531,6 +637,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        else
                                inScriptType = eHtml;
                        scriptLanguage = eScriptNone;
+                       // unfold all scripting languages
+                       levelCurrent--;
                        continue;
                }
                /////////////////////////////////////
@@ -538,10 +646,21 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                switch (state) {
                case SCE_H_DEFAULT:
                        if (ch == '<') {
+                               // in HTML, fold on tag open and unfold on tag close
+                               tagOpened = true;
+                               if (chNext == '/') {
+                                       tagClosing = true;
+                               } else {
+                                       tagClosing = false;
+                               }
+
                                styler.ColourTo(i - 1, StateToPrint);
-                               if (chNext == '!' && chNext2 == '-' && styler.SafeGetCharAt(i + 3) == '-')
+                               if (chNext == '!' && chNext2 == '-' && styler.SafeGetCharAt(i + 3) == '-') {
+                                       // should be better
+                                       i += 3;
+                                       levelCurrent++;
                                        state = SCE_H_COMMENT;
-                               else
+                               else
                                        state = SCE_H_TAGUNKNOWN;
                        } else if (ch == '&') {
                                styler.ColourTo(i - 1, SCE_H_DEFAULT);
@@ -550,14 +669,26 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        break;
                case SCE_H_COMMENT:
                        if ((ch == '>') && (chPrev == '-') && (chPrev2 == '-')) {
+                               // unfold HTML comment
+                               levelCurrent--;
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_H_DEFAULT;
+                               tagOpened = false;
                        }
                        break;
                case SCE_H_CDATA:
                        if ((ch == '>') && (chPrev == ']') && (chPrev2 == ']')) {
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_H_DEFAULT;
+                               tagOpened = false;
+                       }
+                       break;
+               case SCE_H_SGML:
+                       if (ch == '>') {
+                               levelCurrent--;
+                               styler.ColourTo(i, StateToPrint);
+                               state = SCE_H_DEFAULT;
+                               tagOpened = false;
                        }
                        break;
                case SCE_H_ENTITY:
@@ -571,7 +702,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                        break;
                case SCE_H_TAGUNKNOWN:
-                       if (!ishtmlwordchar(ch) && ch != '/' && ch != '-' && ch != '[') {
+                       if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
                                int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
                                if (eClass == SCE_H_SCRIPT) {
                                        inScriptType = eNonHtmlScript;
@@ -579,17 +710,38 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        eClass = SCE_H_TAG;
                                }
                                if (ch == '>') {
-                                       styler.ColourTo(i, SCE_H_TAG);
+                                       styler.ColourTo(i, eClass);
                                        if (inScriptType == eNonHtmlScript) {
                                                state = StateForScript(scriptLanguage);
                                        } else {
                                                state = SCE_H_DEFAULT;
                                        }
-                               } else {
-                                       if (eClass == SCE_H_CDATA) {
-                                               state = SCE_H_CDATA;
+                                       tagOpened = false;
+                                       if (tagClosing)
+                                               levelCurrent--;
+                                       else
+                                               levelCurrent++;
+                                       tagClosing = false;
+                           } else if (ch == '/' && chNext == '>') {
+                                       if (eClass == SCE_H_TAGUNKNOWN) {
+                                           styler.ColourTo(i + 1, SCE_H_TAGUNKNOWN);
                                        } else {
-                                               state = SCE_H_OTHER;
+                                           styler.ColourTo(i - 1, StateToPrint);
+                                           styler.ColourTo(i + 1, SCE_H_TAGEND);
+                                       }
+                                   i++;
+                                   ch = chNext;
+                                   state = SCE_H_DEFAULT;
+                                       tagOpened = false;
+                               } else {
+                                       if (eClass != SCE_H_TAGUNKNOWN) {
+                                               if (eClass == SCE_H_CDATA) {
+                                                       state = SCE_H_CDATA;
+                                               } else if (eClass == SCE_H_SGML) {
+                                                       state = SCE_H_SGML;
+                                               } else {
+                                                       state = SCE_H_OTHER;
+                                               }
                                        }
                                }
                        }
@@ -597,7 +749,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                case SCE_H_ATTRIBUTE:
                        if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
                                if (inScriptType == eNonHtmlScript) {
+                                       int scriptLanguagePrev = scriptLanguage;
                                        scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
+                                       if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone))
+                                               inScriptType = eHtml;
                                }
                                classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler);
                                if (ch == '>') {
@@ -607,6 +762,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        } else {
                                                state = SCE_H_DEFAULT;
                                        }
+                                       tagOpened = false;
+                                       if (tagClosing)
+                                               levelCurrent--;
+                                       else
+                                               levelCurrent++;
+                                       tagClosing = false;
                                } else if (ch == '=') {
                                        styler.ColourTo(i, SCE_H_OTHER);
                                        state = SCE_H_VALUE;
@@ -624,6 +785,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                } else {
                                        state = SCE_H_DEFAULT;
                                }
+                               tagOpened = false;
+                               if (tagClosing)
+                                       levelCurrent--;
+                               else
+                                       levelCurrent++;
+                               tagClosing = false;
                        } else if (ch == '\"') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_H_DOUBLESTRING;
@@ -639,6 +806,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                i++;
                                ch = chNext;
                                state = SCE_H_DEFAULT;
+                               tagOpened = false;
                        } else if (ch == '?' && chNext == '>') {
                                styler.ColourTo(i - 1, StateToPrint);
                                styler.ColourTo(i + 1, SCE_H_XMLEND);
@@ -688,6 +856,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                                } else {
                                                        state = SCE_H_DEFAULT;
                                                }
+                                               tagOpened = false;
+                                               if (tagClosing)
+                                                       levelCurrent--;
+                                               else
+                                                       levelCurrent++;
+                                               tagClosing = false;
                                        } else {
                                                state = SCE_H_OTHER;
                                        }
@@ -709,6 +883,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        } else if (ch == '/' && chNext == '/') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_COMMENTLINE;
+                       } else if (ch == '/' && isOKBeforeRE(chPrevNonWhite)) {
+                               styler.ColourTo(i - 1, StateToPrint);
+                               state = SCE_HJ_REGEX;
                        } else if (ch == '\"') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_DOUBLESTRING;
@@ -781,8 +958,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        } else if (ch == '\"') {
                                styler.ColourTo(i, statePrintForState(SCE_HJ_DOUBLESTRING, inScriptType));
                                state = SCE_HJ_DEFAULT;
-                               i++;
-                               ch = chNext;
                        } else if ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_COMMENTLINE;
@@ -800,8 +975,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        } else if (ch == '\'') {
                                styler.ColourTo(i, statePrintForState(SCE_HJ_SINGLESTRING, inScriptType));
                                state = SCE_HJ_DEFAULT;
-                               i++;
-                               ch = chNext;
                        } else if ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_COMMENTLINE;
@@ -820,6 +993,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HJ_DEFAULT;
                        }
                        break;
+               case SCE_HJ_REGEX:
+                       if (ch == '\r' || ch == '\n' || ch == '/') {
+                               styler.ColourTo(i, StateToPrint);
+                               state = SCE_HJ_DEFAULT;
+                       } else if (ch == '\\') {
+                               // Gobble up the quoted character
+                               if (chNext == '\\' || chNext == '/') {
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               }
+                       }
+                       break;
                case SCE_HB_DEFAULT:
                case SCE_HB_START:
                        if (iswordstart(ch)) {
@@ -837,7 +1023,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HB_COMMENTLINE;
                        } else if (isoperator(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
-                               styler.ColourTo(i, SCE_HB_DEFAULT);
+                               styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
                                state = SCE_HB_DEFAULT;
                        } else if ((ch == ' ') || (ch == '\t')) {
                                if (state == SCE_HB_START) {
@@ -865,8 +1051,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        if (ch == '\"') {
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_HB_DEFAULT;
-                               i++;
-                               ch = chNext;
                        } else if (ch == '\r' || ch == '\n') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HB_STRINGEOL;
@@ -1023,6 +1207,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        state = SCE_HPHP_SIMPLESTRING;
                                } else if (ch == '$') {
                                        state = SCE_HPHP_VARIABLE;
+                               } else if (isoperator(ch)) {
+                                       state = SCE_HPHP_OPERATOR;
                                } else {
                                        state = SCE_HPHP_DEFAULT;
                                }
@@ -1031,13 +1217,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                case SCE_HPHP_NUMBER:
                        if (!isdigit(ch)) {
                                styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
-                               state = SCE_HPHP_DEFAULT;
+                               if (isoperator(ch)) 
+                                       state =SCE_HPHP_OPERATOR;
+                               else 
+                                       state = SCE_HPHP_DEFAULT;
                        }
                        break;
                case SCE_HPHP_VARIABLE:
                        if (!iswordstart(ch)) {
                                styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
-                               state = SCE_HPHP_DEFAULT;
+                               if (isoperator(ch)) 
+                                       state =SCE_HPHP_OPERATOR;
+                               else 
+                                       state = SCE_HPHP_DEFAULT;
                        }
                        break;
                case SCE_HPHP_COMMENT:
@@ -1054,20 +1246,34 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        break;
                case SCE_HPHP_HSTRING:
                        if (ch == '\\') {
-        // skip the next char
-                                       i++;
+                               // skip the next char
+                               i++;
+                       } else if (ch == '$') {
+                               styler.ColourTo(i-1, StateToPrint);
+                               state = SCE_HPHP_HSTRING_VARIABLE;
                        } else if (ch == '\"') {
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_HPHP_DEFAULT;
                        }
                        break;
                case SCE_HPHP_SIMPLESTRING:
-                        if (ch == '\'') {
+                       if (ch == '\\') {
+                               // skip the next char
+                               i++;
+                       } else if (ch == '\'') {
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_HPHP_DEFAULT;
                        }
                        break;
-               case SCE_HPHP_DEFAULT:
+               case SCE_HPHP_HSTRING_VARIABLE:
+                       if (!iswordstart(ch)) {
+                               styler.ColourTo(i-1, StateToPrint);
+                               i--; // strange but it works
+                               state = SCE_HPHP_HSTRING;
+                       }
+                       break;
+               case SCE_HPHP_OPERATOR:
+               case SCE_HPHP_DEFAULT:
                        styler.ColourTo(i - 1, StateToPrint);
                        if (isdigit(ch)) {
                                state = SCE_HPHP_NUMBER;
@@ -1087,15 +1293,20 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HPHP_SIMPLESTRING;
                        } else if (ch == '$') {
                                state = SCE_HPHP_VARIABLE;
+                       } else if (isoperator(ch)) {
+                               state = SCE_HPHP_OPERATOR;
+                       } else if ((state == SCE_HPHP_OPERATOR) && (isspacechar(ch))) {
+                               state = SCE_HPHP_DEFAULT;
                        }
                        break;
                        ///////////// end - PHP state handling
                }
 
-
-
+               // Some of the above terminated their lexeme but since the same character starts
+               // the same class again, only reenter if non empty segment.
+               bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
                if (state == SCE_HB_DEFAULT) {    // One of the above succeeded
-                       if (ch == '\"') {
+                       if ((ch == '\"') && (nonEmptySegment)) {
                                state = SCE_HB_STRING;
                        } else if (ch == '\'') {
                                state = SCE_HB_COMMENTLINE;
@@ -1105,7 +1316,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                styler.ColourTo(i, SCE_HB_DEFAULT);
                        }
                } else if (state == SCE_HBA_DEFAULT) {    // One of the above succeeded
-                       if (ch == '\"') {
+                       if ((ch == '\"') && (nonEmptySegment)) {
                                state = SCE_HBA_STRING;
                        } else if (ch == '\'') {
                                state = SCE_HBA_COMMENTLINE;
@@ -1122,14 +1333,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        state = SCE_HJ_COMMENT;
                        } else if (ch == '/' && chNext == '/') {
                                state = SCE_HJ_COMMENTLINE;
-                       } else if (ch == '\"') {
+                       } else if ((ch == '\"') && (nonEmptySegment)) {
                                state = SCE_HJ_DOUBLESTRING;
-                       } else if (ch == '\'') {
+                       } else if ((ch == '\'')  && (nonEmptySegment)) {
                                state = SCE_HJ_SINGLESTRING;
                        } else if (iswordstart(ch)) {
                                state = SCE_HJ_WORD;
                        } else if (isoperator(ch)) {
-                               styler.ColourTo(i, SCE_HJ_SYMBOLS);
+                               styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
                        }
                }
        }
@@ -1140,12 +1351,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
        // Fill in the real level of the next line, keeping the current flags as they will be filled in later
        if (fold) {
                int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
-               //styler.SetLevel(lineCurrent, levelCurrent | flagsNext);
                styler.SetLevel(lineCurrent, levelPrev | flagsNext);
-
        }
 }
 
-LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc);
-LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc);
+LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
+LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
 
diff --git a/contrib/src/stc/scintilla/src/LexLisp.cxx b/contrib/src/stc/scintilla/src/LexLisp.cxx
new file mode 100644 (file)
index 0000000..623ca7c
--- /dev/null
@@ -0,0 +1,195 @@
+// Scintilla source code edit control
+/** @file LexLisp.cxx
+ ** Lexer for Lisp.
+ ** Written by Alexey Yutkin.
+ **/
+// Copyright 1998-2001 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 "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+
+inline bool isLispoperator(char ch) {
+       if (isascii(ch) && isalnum(ch))
+               return false;
+       if (ch == '\'' || ch == '(' || ch == ')' )
+               return true;
+       return false;
+}
+
+inline bool isLispwordstart(char ch) {
+       return isascii(ch) && ch != ';'  && !isspacechar(ch) && !isLispoperator(ch) &&
+               ch != '\n' && ch != '\r' &&  ch != '\"';
+}
+
+
+static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
+       PLATFORM_ASSERT(end >= start);
+       char s[100];
+       unsigned int i;
+       bool digit_flag = true;
+       for (i = 0; (i < end - start + 1) && (i < 99); i++) {
+               s[i] = styler[start + i];
+               s[i + 1] = '\0';
+               if (!isdigit(s[i]) && (s[i] != '.')) digit_flag = false;
+       }
+       char chAttr = SCE_LISP_IDENTIFIER;
+
+       if(digit_flag) chAttr = SCE_LISP_NUMBER;
+       else {
+               if (keywords.InList(s)) {
+                       chAttr = SCE_LISP_KEYWORD;
+               }
+       }
+       styler.ColourTo(end, chAttr);
+       return;
+}
+
+
+static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+                            Accessor &styler) {
+
+       WordList &keywords = *keywordlists[0];
+
+       styler.StartAt(startPos);
+
+       int state = initStyle;
+       if (state == SCE_LISP_STRINGEOL)        // Does not leak onto next line
+               state = SCE_LISP_DEFAULT;
+       char chPrev = ' ';
+       char chNext = styler[startPos];
+       unsigned int lengthDoc = startPos + length;
+       styler.StartSegment(startPos);
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+               if (atEOL) {
+                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+                       // Avoid triggering two times on Dos/Win
+                       // End of line
+                       if (state == SCE_LISP_STRINGEOL) {
+                               styler.ColourTo(i, state);
+                               state = SCE_LISP_DEFAULT;
+                       }
+               }
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       chPrev = ' ';
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_LISP_DEFAULT) {
+                       if (isLispwordstart(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LISP_IDENTIFIER;
+                       } 
+                       else if (ch == ';') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LISP_COMMENT;
+                       }
+                       else if (isLispoperator(ch) || ch=='\'') {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i, SCE_LISP_OPERATOR);
+                       }
+                       
+                       else if (ch == '\"') {
+                                       state = SCE_LISP_STRING;
+                       }
+               } else if (state == SCE_LISP_IDENTIFIER) {
+                       if (!isLispwordstart(ch)) {
+                               classifyWordLisp(styler.GetStartSegment(), i - 1, keywords, styler);
+                               state = SCE_LISP_DEFAULT;
+                       } /*else*/ 
+                       if (isLispoperator(ch) || ch=='\'') {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i, SCE_LISP_OPERATOR);
+                       }
+                       
+               } else {
+                       if (state == SCE_LISP_COMMENT) {
+                               if (atEOL) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LISP_DEFAULT;
+                               }
+                       } else if (state == SCE_LISP_STRING) {
+                               if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\"') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_LISP_DEFAULT;
+                               } else if ((chNext == '\r' || chNext == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, SCE_LISP_STRINGEOL);
+                                       state = SCE_LISP_STRINGEOL;
+                               }
+                       }
+               }
+
+               chPrev = ch;
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+}
+
+static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+                            Accessor &styler) {
+       unsigned int lengthDoc = 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);
+       for (unsigned int i = startPos; i < lengthDoc; 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_LISP_OPERATOR) {
+                       if (ch == '(') {
+                               levelCurrent++;
+                       } else if (ch == ')') {
+                               levelCurrent--;
+                       }
+               }
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0)
+                               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 lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc);
index e6da7668ddc73017de13ef5fda9395c26f49fd1d..2791d98ada3d86e8c6086471cc4e2ec896b9b820 100644 (file)
@@ -1,5 +1,10 @@
-// LexLua.cxx - lexer for Lua language
-// Written by Paul Winwood 
+// Scintilla source code edit control
+/** @file LexLua.cxx
+ ** Lexer for Lua language.
+ **
+ ** Written by Paul Winwood.
+ ** Folder by Alexey Yutkin.
+ **/
 
 #include <stdlib.h>
 #include <string.h>
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-static void classifyWordLua(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler)
-{
-    char s[100];
-    bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
-    
-    for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
-    {
-        s[i] = styler[start + i];
-        s[i + 1] = '\0';
-    }
+inline bool isLuaOperator(char ch) {
+       if (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 == ':')
+               return true;
+       return false;
+}
+
+static void classifyWordLua(unsigned int start,
+                            unsigned int end,
+                            WordList   &keywords,
+                            Accessor   &styler) {
+       char s[100];
+       bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
+
+       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+               s[i] = styler[start + i];
+               s[i + 1] = '\0';
+       }
 
-    char chAttr = SCE_LUA_IDENTIFIER;
-    
-    if (wordIsNumber)
-        chAttr = SCE_LUA_NUMBER;
-    else
-    {
-        if (keywords.InList(s))
-        {
-            chAttr = SCE_LUA_WORD;
-        }
-    }
-    styler.ColourTo(end, chAttr);
+       char chAttr = SCE_LUA_IDENTIFIER;
+
+       if (wordIsNumber)
+               chAttr = SCE_LUA_NUMBER;
+       else {
+               if (keywords.InList(s)) {
+                       chAttr = SCE_LUA_WORD;
+               }
+       }
+       styler.ColourTo(end, chAttr);
 }
 
-static void ColouriseLuaDoc(unsigned int startPos, 
-                            int          length, 
-                            int          initStyle, 
-                            WordList    *keywordlists[],
-                            Accessor    &styler)
-{
+static void ColouriseLuaDoc(unsigned int startPos,
+                            int length,
+                            int initStyle,
+                            WordList *keywordlists[],
+                            Accessor &styler) {
+
+       WordList &keywords = *keywordlists[0];
 
-    WordList &keywords = *keywordlists[0];
+       styler.StartAt(startPos);
+       styler.GetLine(startPos);
 
-    styler.StartAt(startPos);
-    styler.GetLine(startPos);
+       int state = initStyle;
+       char chPrev = ' ';
+       char chNext = styler[startPos];
+       unsigned int lengthDoc = startPos + length;
+       bool firstChar = true;
 
-    int  state = initStyle;
-    char chPrev = ' ';
-    char chNext = styler[startPos];
-    unsigned int lengthDoc = startPos + length;
-    bool firstChar = true;
-    int  literalString = 0;
+       /* Must initialize the literalString level, if we are inside such a string.
+        * Note: this isn't enough, because literal strings can be nested,
+        * we should go back to see at what level we are...
+        */
+       int literalString = (initStyle == SCE_LUA_LITERALSTRING) ? 1 : 0;
 
-    styler.StartSegment(startPos);
-    for (unsigned int i = startPos; i <= lengthDoc; i++)
-    {
-        char ch = chNext;
-        chNext = styler.SafeGetCharAt(i + 1);
+       styler.StartSegment(startPos);
+       for (unsigned int i = startPos; i <= lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
 
-        if (styler.IsLeadByte(ch))
-        {
-            chNext = styler.SafeGetCharAt(i + 2);
-            chPrev = ' ';
-            i += 1;
-            continue;
-        }
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       chPrev = ' ';
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_LUA_STRINGEOL) {
+                       if (ch != '\r' && ch != '\n') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_DEFAULT;
+                       }
+               }
+
+               if (state == SCE_LUA_LITERALSTRING && ch == '[' && chNext == '[') {
+                       literalString++;
+               } else if (state == SCE_LUA_DEFAULT) {
+                       if (ch == '-' && chNext == '-') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_COMMENTLINE;
+                       } else if (ch == '[' && chNext == '[') {
+                               state = SCE_LUA_LITERALSTRING;
+                               literalString = 1;
+                       } else if (ch == '\"') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_STRING;
+                       } else if (ch == '\'') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_CHARACTER;
+                       } else if (ch == '$' && firstChar) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_PREPROCESSOR;
+                       } else if (ch == '#' && firstChar)      // Should be only on the first line of the file! Cannot be tested here
+                       {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_COMMENTLINE;
+                       } else if (isLuaOperator(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i, SCE_LUA_OPERATOR);
+                       } else if (iswordstart(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_WORD;
+                       }
+               } else if (state == SCE_LUA_WORD) {
+                       if (!iswordchar(ch)) {
+                               classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
+                               state = SCE_LUA_DEFAULT;
+                               if (ch == '[' && chNext == '[') {
+                                       literalString = 1;
+                                       state = SCE_LUA_LITERALSTRING;
+                               } else if (ch == '-' && chNext == '-') {
+                                       state = SCE_LUA_COMMENTLINE;
+                               } else if (ch == '\"') {
+                                       state = SCE_LUA_STRING;
+                               } else if (ch == '\'') {
+                                       state = SCE_LUA_CHARACTER;
+                               } else if (ch == '$' && firstChar) {
+                                       state = SCE_LUA_PREPROCESSOR;
+                               } else if (isLuaOperator(ch)) {
+                                       styler.ColourTo(i, SCE_LUA_OPERATOR);
+                               }
+                       } else if (ch == '.' && chNext == '.') {
+                               classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
+                               styler.ColourTo(i, SCE_LUA_OPERATOR);
+                               state = SCE_LUA_DEFAULT;
+                       }
+               } else {
+                       if (state == SCE_LUA_LITERALSTRING) {
+                               if (ch == ']' && (chPrev == ']') && (--literalString == 0)) {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_LUA_DEFAULT;
+                               }
+                       } else if (state == SCE_LUA_PREPROCESSOR) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LUA_DEFAULT;
+                               }
+                       } else if (state == SCE_LUA_COMMENTLINE) {
+                               if (ch == '\r' || ch == '\n') {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LUA_DEFAULT;
+                               }
+                       } else if (state == SCE_LUA_STRING) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LUA_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\"') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_LUA_DEFAULT;
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               }
+                       } else if (state == SCE_LUA_CHARACTER) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LUA_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\'') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_LUA_DEFAULT;
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               }
+                       }
+
+                       if (state == SCE_LUA_DEFAULT) {
+                               if (ch == '-' && chNext == '-') {
+                                       state = SCE_LUA_COMMENTLINE;
+                               } else if (ch == '\"') {
+                                       state = SCE_LUA_STRING;
+                               } else if (ch == '\'') {
+                                       state = SCE_LUA_CHARACTER;
+                               } else if (ch == '$' && firstChar) {
+                                       state = SCE_LUA_PREPROCESSOR;
+                               } else if (iswordstart(ch)) {
+                                       state = SCE_LUA_WORD;
+                               } else if (isLuaOperator(ch)) {
+                                       styler.ColourTo(i, SCE_LUA_OPERATOR);
+                               }
+                       }
+               }
+               chPrev = ch;
+               firstChar = (ch == '\r' || ch == '\n');
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+}
 
-        if (state == SCE_LUA_STRINGEOL)
-        {
-            if (ch != '\r' && ch != '\n')
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_DEFAULT;
-            }
-        }
+static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+                       Accessor &styler) {
+       unsigned int lengthDoc = 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);
+       char s[10];
+       for (unsigned int i = startPos; i < lengthDoc; 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_LUA_WORD)
+                       if ( ch == 'e' || ch == 't' || ch == 'd' || ch == 'f') {
+                               for (unsigned int j = 0; j < 8; j++) {
+                                       if (!iswordchar(styler[i + j])) break;
+                                       s[j] = styler[i + j];
+                                       s[j + 1] = '\0';
+                               }
 
-        if (state == SCE_LUA_LITERALSTRING && ch == '[' && chNext == '[')
-        {
-            literalString++;
-        }
-        else
-        if (state == SCE_LUA_DEFAULT)
-        {
-            if (ch == '-' && chNext == '-')
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_COMMENTLINE;
-            }
-            else
-            if (ch == '[' && chNext == '[')
-            {
-                state = SCE_LUA_LITERALSTRING;
-                literalString = 1;
-            }
-            else
-            if (iswordstart(ch))
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_WORD;
-            }
-            else
-            if (ch == '\"')
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_STRING;
-            }
-            else
-            if (ch == '\'')
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_CHARACTER;
-            }
-            else
-            if (ch == '$' && firstChar)
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_PREPROCESSOR;
-            }
-            else
-            if (isoperator(ch))
-            {
-                styler.ColourTo(i-1, state);
-                styler.ColourTo(i, SCE_LUA_OPERATOR);
-            }
-        }
-        else
-        if (state == SCE_LUA_WORD)
-        {
-            if (!iswordchar(ch))
-            {
-                classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
-                state = SCE_LUA_DEFAULT;
-                if (ch == '[' && chNext == '[')
-                {
-                    literalString = 1;
-                    state = SCE_LUA_LITERALSTRING;
-                }
-                else
-                if (ch == '-' && chNext == '-')
-                {
-                    state = SCE_LUA_COMMENTLINE;
-                }
-                else
-                if (ch == '\"')
-                {
-                    state = SCE_LUA_STRING;
-                }
-                else
-                if (ch == '\'')
-                {
-                    state = SCE_LUA_CHARACTER;
-                }
-                else
-                if (ch == '$' && firstChar)
-                {
-                    state = SCE_LUA_PREPROCESSOR;
-                }
-                else
-                if (isoperator(ch))
-                {
-                    styler.ColourTo(i, SCE_LUA_OPERATOR);
-                }
-            }
-        }
-        else
-        {
-            if (state == SCE_LUA_LITERALSTRING)
-            {
-                if (ch == ']' && (chPrev == ']') && (--literalString == 0))
-                {
-                    styler.ColourTo(i, state);
-                    state = SCE_LUA_DEFAULT;
-                }
-            }
-            else
-            if (state == SCE_LUA_PREPROCESSOR)
-            {
-                if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
-                {
-                    styler.ColourTo(i-1, state);
-                    state = SCE_LUA_DEFAULT;
-                }
-            }
-            else
-            if (state == SCE_LUA_COMMENTLINE)
-            {
-                if (ch == '\r' || ch == '\n')
-                {
-                    styler.ColourTo(i-1, state);
-                    state = SCE_LUA_DEFAULT;
-                }
-            }
-            else
-            if (state == SCE_LUA_STRING)
-            {
-                if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
-                {
-                    styler.ColourTo(i-1, state);
-                    state = SCE_LUA_STRINGEOL;
-                }
-                else
-                if (ch == '\\')
-                {
-                    if (chNext == '\"' || chNext == '\\')
-                    {
-                        i++;
-                        ch = chNext;
-                        chNext = styler.SafeGetCharAt(i + 1);
-                    }
-                }
-                else
-                if (ch == '\"')
-                {
-                    styler.ColourTo(i, state);
-                    state = SCE_LUA_DEFAULT;
-                    i++;
-                    ch = chNext;
-                    chNext = styler.SafeGetCharAt(i + 1);
-                }
-            }
-            else
-            if (state == SCE_LUA_CHARACTER)
-            {
-                if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
-                {
-                    styler.ColourTo(i-1, state);
-                    state = SCE_LUA_STRINGEOL;
-                }
-                else
-                if (ch == '\\')
-                {
-                    if (chNext == '\'' || chNext == '\\')
-                    {
-                        i++;
-                        ch = chNext;
-                        chNext = styler.SafeGetCharAt(i + 1);
-                    }
-                }
-                else
-                if (ch == '\'')
-                {
-                    styler.ColourTo(i, state);
-                    state = SCE_LUA_DEFAULT;
-                    i++;
-                    ch = chNext;
-                    chNext = styler.SafeGetCharAt(i + 1);
-                }
-            }
+                               if ((strcmp(s, "then") == 0) || (strcmp(s, "do") == 0)
+                                       || (strcmp(s, "function") == 0))
+                                       levelCurrent++;
+                               if (strcmp(s, "end") == 0) levelCurrent--;
+                       }
 
-            if (state == SCE_LUA_DEFAULT)
-            {    
-                if (ch == '-' && chNext == '-')
-                {
-                    state = SCE_LUA_COMMENTLINE;
-                }
-                else
-                if (ch == '\"')
-                {
-                    state = SCE_LUA_STRING;
-                }
-                else
-                if (ch == '\'')
-                {
-                    state = SCE_LUA_CHARACTER;
-                }
-                else
-                if (ch == '$' && firstChar)
-                {
-                    state = SCE_LUA_PREPROCESSOR;
-                }
-                else
-                if (iswordstart(ch))
-                {
-                    state = SCE_LUA_WORD;
-                }
-                else
-                if (isoperator(ch))
-                {
-                    styler.ColourTo(i, SCE_LUA_OPERATOR);
-                }
-            }
-        }
-        chPrev = ch;
-        firstChar = (ch == '\r' || ch == '\n');
-    }
-    styler.ColourTo(lengthDoc - 1, state);
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0)
+                               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 lmLua(SCLEX_LUA, ColouriseLuaDoc);
+LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc, "lua", FoldLuaDoc);
index dd8603368790b11695121b13ea8a6b6f23953880..0814d518c32b1498a8522f058b1ef9695d93486a 100644 (file)
@@ -1,13 +1,16 @@
-// SciTE - Scintilla based Text Editor
-// LexOthers.cxx - lexers for properties files, batch files, make files and error lists
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexOthers.cxx
+ ** Lexers for batch files, diff results, properties files, make files and error lists.
+ ** Also lexer for LaTeX documents.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-static void ColouriseBatchLine(char *lineBuffer, int endLine, Accessor &styler) {
-       if (0 == strncmp(lineBuffer, "REM", 3)) {
-               styler.ColourTo(endLine, 1);
-       } else if (0 == strncmp(lineBuffer, "rem", 3)) {
-               styler.ColourTo(endLine, 1);
-       } else if (0 == strncmp(lineBuffer, "SET", 3)) {
-               styler.ColourTo(endLine, 2);
-       } else if (0 == strncmp(lineBuffer, "set", 3)) {
-               styler.ColourTo(endLine, 2);
-       } else if (lineBuffer[0] == ':') {
-               styler.ColourTo(endLine, 3);
+static void ColouriseBatchLine(
+    char *lineBuffer,
+    unsigned int lengthLine,
+    unsigned int startLine,
+    unsigned int endPos,
+    WordList &keywords,
+    Accessor &styler) {
+
+       unsigned int i = 0;
+       unsigned int state = SCE_BAT_DEFAULT;
+
+       while (isspacechar(lineBuffer[i]) && (i < lengthLine)) {        // Skip initial spaces
+               i++;
+       }
+       if (lineBuffer[i] == '@') {     // Hide command (ECHO OFF)
+               styler.ColourTo(startLine + i, SCE_BAT_HIDE);
+               i++;
+               while (isspacechar(lineBuffer[i]) && (i < lengthLine)) {        // Skip next spaces
+                       i++;
+               }
+       }
+       if (lineBuffer[i] == ':') {
+               // Label
+               if (lineBuffer[i + 1] == ':') {
+                       // :: is a fake label, similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
+                       styler.ColourTo(endPos, SCE_BAT_COMMENT);
+               } else {        // Real label
+                       styler.ColourTo(endPos, SCE_BAT_LABEL);
+               }
        } else {
-               styler.ColourTo(endLine, 0);
+               // Check if initial word is a keyword
+               char wordBuffer[21];
+               unsigned int wbl = 0, offset = i;
+               // Copy word in buffer
+               for (; offset < lengthLine && wbl < 20 &&
+                       !isspacechar(lineBuffer[offset]); wbl++, offset++) {
+                       wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset]));
+               }
+               wordBuffer[wbl] = '\0';
+               // Check if it is a comment
+               if (CompareCaseInsensitive(wordBuffer, "rem") == 0) {
+                       styler.ColourTo(endPos, SCE_BAT_COMMENT);
+                       return ;
+               }
+               // Check if it is in the list
+               if (keywords.InList(wordBuffer)) {
+                       styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD);  // Regular keyword
+               } else {
+                       // Search end of word (can be a long path)
+                       while (offset < lengthLine &&
+                               !isspacechar(lineBuffer[offset])) {
+                               offset++;
+                       }
+                       styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);       // External command / program
+               }
+               // Remainder of the line: colourise the variables.
+
+               while (offset < lengthLine) {
+                       if (state == SCE_BAT_DEFAULT && lineBuffer[offset] == '%') {
+                               styler.ColourTo(startLine + offset - 1, state);
+                               if (isdigit(lineBuffer[offset + 1])) {
+                                       styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
+                                       offset += 2;
+                               } else if (lineBuffer[offset + 1] == '%' &&
+                                          !isspacechar(lineBuffer[offset + 2])) {
+                                       // Should be safe, as there is CRLF at the end of the line...
+                                       styler.ColourTo(startLine + offset + 2, SCE_BAT_IDENTIFIER);
+                                       offset += 3;
+                               } else {
+                                       state = SCE_BAT_IDENTIFIER;
+                               }
+                       } else if (state == SCE_BAT_IDENTIFIER && lineBuffer[offset] == '%') {
+                               styler.ColourTo(startLine + offset, state);
+                               state = SCE_BAT_DEFAULT;
+                       } else if (state == SCE_BAT_DEFAULT &&
+                                  (lineBuffer[offset] == '*' ||
+                                   lineBuffer[offset] == '?' ||
+                                   lineBuffer[offset] == '=' ||
+                                   lineBuffer[offset] == '<' ||
+                                   lineBuffer[offset] == '>' ||
+                                   lineBuffer[offset] == '|')) {
+                               styler.ColourTo(startLine + offset - 1, state);
+                               styler.ColourTo(startLine + offset, SCE_BAT_OPERATOR);
+                       }
+                       offset++;
+               }
+               //              if (endPos > startLine + offset - 1) {
+               styler.ColourTo(endPos, SCE_BAT_DEFAULT);               // Remainder of line, currently not lexed
+               //              }
        }
+
 }
+// ToDo: (not necessarily at beginning of line) GOTO, [IF] NOT, ERRORLEVEL
+// IF [NO] (test) (command) -- test is EXIST (filename) | (string1)==(string2) | ERRORLEVEL (number)
+// FOR %%(variable) IN (set) DO (command) -- variable is [a-zA-Z] -- eg for %%X in (*.txt) do type %%X
+// ToDo: %n (parameters), %EnvironmentVariable% colourising
+// ToDo: Colourise = > >> < | "
+
+static void ColouriseBatchDoc(
+    unsigned int startPos,
+    int length,
+    int /*initStyle*/,
+    WordList *keywordlists[],
+    Accessor &styler) {
 
-static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
        char lineBuffer[1024];
+       WordList &keywords = *keywordlists[0];
+
        styler.StartAt(startPos);
        styler.StartSegment(startPos);
-       unsigned int linePos = 0;
-       for (unsigned int i = startPos; i < startPos + length; i++) {
+       unsigned int linePos = 0, startLine = startPos;
+       for (unsigned int i = startPos; i <= startPos + length; i++) {
                lineBuffer[linePos++] = styler[i];
-               if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
-                       ColouriseBatchLine(lineBuffer, i, styler);
+               if (styler[i] == '\r' || styler[i] == '\n' || (linePos >=
+                       sizeof(lineBuffer) - 1)) {
+                       // End of line (or of line buffer) met, colourise it
+                       if (styler[i + 1] == '\n') {
+                               lineBuffer[linePos++] = styler[++i];
+                       }
+                       lineBuffer[linePos] = '\0';
+                       ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywords, styler);
                        linePos = 0;
+                       startLine = i + 1;
                }
        }
-       if (linePos > 0)
-               ColouriseBatchLine(lineBuffer, startPos + length, styler);
+       if (linePos > 0) {
+               ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length,
+                                  keywords, styler);
+       }
 }
 
 static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
@@ -89,25 +191,32 @@ static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[
                ColouriseDiffLine(lineBuffer, startPos + length, styler);
 }
 
-static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, Accessor &styler) {
-       int i = 0;
-       while (isspace(lineBuffer[i]) && (i < lengthLine))      // Skip initial spaces
+static void ColourisePropsLine(
+    char *lineBuffer,
+    unsigned int lengthLine,
+    unsigned int startLine,
+    unsigned int endPos,
+    Accessor &styler) {
+
+       unsigned int i = 0;
+       while (isspacechar(lineBuffer[i]) && (i < lengthLine))  // Skip initial spaces
                i++;
        if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
                styler.ColourTo(endPos, 1);
        } else if (lineBuffer[i] == '[') {
                styler.ColourTo(endPos, 2);
        } else if (lineBuffer[i] == '@') {
-               styler.ColourTo(startLine+i, 4);
+               styler.ColourTo(startLine + i, 4);
                if (lineBuffer[++i] == '=')
-                       styler.ColourTo(startLine+i, 3);
+                       styler.ColourTo(startLine + i, 3);
                styler.ColourTo(endPos, 0);
        } else {
-               while (lineBuffer[i] != '=' && (i < lengthLine))        // Search the '=' character
+               // Search for the '=' character
+               while (lineBuffer[i] != '=' && (i < lengthLine - 1))
                        i++;
                if (lineBuffer[i] == '=') {
-                       styler.ColourTo(startLine+i-1, 0);
-                       styler.ColourTo(startLine+i, 3);
+                       styler.ColourTo(startLine + i - 1, 0);
+                       styler.ColourTo(startLine + i, 3);
                        styler.ColourTo(endPos, 0);
                } else {
                        styler.ColourTo(endPos, 0);
@@ -119,31 +228,77 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *
        char lineBuffer[1024];
        styler.StartAt(startPos);
        styler.StartSegment(startPos);
-       unsigned int linePos = 0;
-       int startLine = startPos;
+       unsigned int linePos = 0, startLine = startPos;
        for (unsigned int i = startPos; i <= startPos + length; i++) {
                lineBuffer[linePos++] = styler[i];
-               if ((styler[i] == '\r' && styler.SafeGetCharAt(i+1) != '\n') || 
-                       styler[i] == '\n' || 
-                       (linePos >= sizeof(lineBuffer) - 1)) {
+               if ((styler[i] == '\r' && styler.SafeGetCharAt(i + 1) != '\n') ||
+                       styler[i] == '\n' ||
+                       (linePos >= sizeof(lineBuffer) - 1)) {
                        lineBuffer[linePos] = '\0';
                        ColourisePropsLine(lineBuffer, linePos, startLine, i, styler);
                        linePos = 0;
-                       startLine = i+1;
+                       startLine = i + 1;
                }
        }
        if (linePos > 0)
                ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler);
 }
 
-static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) {
-       int i = 0;
-       while (isspace(lineBuffer[i]) && (i < lengthLine))
+static void ColouriseMakeLine(
+    char *lineBuffer,
+    unsigned int lengthLine,
+    unsigned int startLine,
+    unsigned int endPos,
+    Accessor &styler) {
+
+       unsigned int i = 0;
+        unsigned int lastNonSpace = 0;
+       unsigned int state = SCE_MAKE_DEFAULT;
+       bool bSpecial = false;
+       // Skip initial spaces
+       while (isspacechar(lineBuffer[i]) && (i < lengthLine)) {
                i++;
-       if (lineBuffer[i] == '#' || lineBuffer[i] == '!') {
-               styler.ColourTo(endPos, 1);
+       }
+       if (lineBuffer[i] == '#') {     // Comment
+               styler.ColourTo(endPos, SCE_MAKE_COMMENT);
+               return;
+       }
+       if (lineBuffer[i] == '!') {     // Special directive
+               styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR);
+               return;
+       }
+       while (i < lengthLine) {
+               if (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(') {
+                       styler.ColourTo(startLine + i - 1, state);
+                       state = SCE_MAKE_IDENTIFIER;
+               } else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') {
+                       styler.ColourTo(startLine + i, state);
+                       state = SCE_MAKE_DEFAULT;
+               }
+               if (!bSpecial) {
+                       if (lineBuffer[i] == ':') {
+                               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] == '=') {
+                               styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
+                               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;
+                       }
+               }
+               if (!isspacechar(lineBuffer[i])) {
+                       lastNonSpace = i;
+               }
+               i++;
+       }
+       if (state == SCE_MAKE_IDENTIFIER) {
+               styler.ColourTo(endPos, SCE_MAKE_IDEOL);        // Error, variable reference not ended
        } else {
-               styler.ColourTo(endPos, 0);
+               styler.ColourTo(endPos, SCE_MAKE_DEFAULT);
        }
 }
 
@@ -151,22 +306,38 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[
        char lineBuffer[1024];
        styler.StartAt(startPos);
        styler.StartSegment(startPos);
-       unsigned int linePos = 0;
+       unsigned int linePos = 0, startLine = startPos;
        for (unsigned int i = startPos; i <= startPos + length; i++) {
                lineBuffer[linePos++] = styler[i];
                if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
-                       ColouriseMakeLine(lineBuffer, linePos, i, styler);
+                       lineBuffer[linePos] = '\0';
+                       ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler);
                        linePos = 0;
+                       startLine = i + 1;
                }
        }
-       if (linePos > 0)
-               ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler);
+       if (linePos > 0) {
+               ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length, styler);
+       }
 }
 
-static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) {
+static void ColouriseErrorListLine(
+    char *lineBuffer,
+    unsigned int lengthLine,
+    //         unsigned int startLine,
+    unsigned int endPos,
+    Accessor &styler) {
        if (lineBuffer[0] == '>') {
                // Command or return status
                styler.ColourTo(endPos, SCE_ERR_CMD);
+       } else if (lineBuffer[0] == '!') {
+               styler.ColourTo(endPos, SCE_ERR_DIFF_CHANGED);
+       } else if (lineBuffer[0] == '+') {
+               styler.ColourTo(endPos, SCE_ERR_DIFF_ADDITION);
+       } else if (lineBuffer[0] == '-' && lineBuffer[1] == '-' && lineBuffer[2] == '-') {
+               styler.ColourTo(endPos, SCE_ERR_DIFF_MESSAGE);
+       } else if (lineBuffer[0] == '-') {
+               styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION);
        } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
                styler.ColourTo(endPos, SCE_ERR_PYTHON);
        } else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) {
@@ -175,18 +346,28 @@ static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos,
        } else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) {
                // Borland warning message
                styler.ColourTo(endPos, SCE_ERR_BORLAND);
-       } else if (strstr(lineBuffer, " at "  ) && 
-               strstr(lineBuffer, " at "  ) < lineBuffer+lengthLine && 
-               strstr(lineBuffer, " line ") && 
-               strstr(lineBuffer, " line ") < lineBuffer+lengthLine) {
+       } else if (strstr(lineBuffer, "at line " ) &&
+                  strstr(lineBuffer, "at line " ) < lineBuffer + lengthLine &&
+                  strstr(lineBuffer, "file ") &&
+                  strstr(lineBuffer, "file ") < lineBuffer + lengthLine) {
+               // Lua error message
+               styler.ColourTo(endPos, SCE_ERR_LUA);
+       } else if (strstr(lineBuffer, " at " ) &&
+                  strstr(lineBuffer, " at " ) < lineBuffer + lengthLine &&
+                  strstr(lineBuffer, " line ") &&
+                  strstr(lineBuffer, " line ") < lineBuffer + lengthLine) {
                // perl error message
                styler.ColourTo(endPos, SCE_ERR_PERL);
+       } else if ((memcmp(lineBuffer, "   at ", 6) == 0) &&
+               strstr(lineBuffer, ":line ")) {
+               // A .NET traceback
+               styler.ColourTo(endPos, SCE_ERR_NET);
        } else {
                // Look for <filename>:<line>:message
                // Look for <filename>(line)message
                // Look for <filename>(line,pos)message
                int state = 0;
-               for (int i = 0; i < lengthLine; i++) {
+               for (unsigned int i = 0; i < lengthLine; i++) {
                        if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) {
                                state = 1;
                        } else if (state == 0 && lineBuffer[i] == '(') {
@@ -240,15 +421,13 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi
 }
 
 static int isSpecial(char s) {
-
        return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') ||
               (s == '\"') || (s == '`') || (s == '^') || (s == '~');
 }
 
 static int isTag(int start, Accessor &styler) {
-
        char s[6];
-       unsigned int i = 0, e=1;
+       unsigned int i = 0, e = 1;
        while (i < 5 && e) {
                s[i] = styler[start + i];
                i++;
@@ -259,7 +438,7 @@ static int isTag(int start, Accessor &styler) {
 }
 
 static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
-                          WordList *[], Accessor &styler) {
+                              WordList *[], Accessor &styler) {
 
        styler.StartAt(startPos);
 
@@ -277,75 +456,74 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
                        i++;
                        continue;
                }
-               switch(state) {
-                       case SCE_L_DEFAULT :
-                               switch(ch) {
-                                       case '\\' :
-                                               styler.ColourTo(i - 1, state);
-                                               if (isSpecial(styler[i + 1])) {
-                                                       styler.ColourTo(i + 1, SCE_L_COMMAND);
-                                                       i++;
-                                                       chNext = styler.SafeGetCharAt(i + 1);
-                                               }               
-                                               else {
-                                                   if (isTag(i+1, styler))
-                                                       state = SCE_L_TAG;
-                                                   else
-                                                       state = SCE_L_COMMAND;
-                                               }
-                                               break;
-                                       case '$' :
-                                               styler.ColourTo(i - 1, state);
-                                               state = SCE_L_MATH;
-                                               if (chNext == '$') {
-                                                       i++;
-                                                       chNext = styler.SafeGetCharAt(i + 1);
-                                               }
-                                               break;
-                                       case '%' :
-                                               styler.ColourTo(i - 1, state);
-                                               state = SCE_L_COMMENT;
-                                               break;
-                               }
-                               break;                          
-                       case SCE_L_COMMAND :
-                               if (chNext == '[' || chNext == '{' || chNext == '}' || 
-                                   chNext == ' ' || chNext == '\r' || chNext == '\n') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_L_DEFAULT;
+               switch (state) {
+               case SCE_L_DEFAULT :
+                       switch (ch) {
+                       case '\\' :
+                               styler.ColourTo(i - 1, state);
+                               if (isSpecial(styler[i + 1])) {
+                                       styler.ColourTo(i + 1, SCE_L_COMMAND);
                                        i++;
                                        chNext = styler.SafeGetCharAt(i + 1);
-                               }
-                               break;                                  
-                       case SCE_L_TAG :
-                               if (ch == '}') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_L_DEFAULT;
+                               } else {
+                                       if (isTag(i + 1, styler))
+                                               state = SCE_L_TAG;
+                                       else
+                                               state = SCE_L_COMMAND;
                                }
                                break;
-                       case SCE_L_MATH :
-                               if (ch == '$') {
-                                       if (chNext == '$') {
-                                               i++;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       }
-                                       styler.ColourTo(i, state);
-                                       state = SCE_L_DEFAULT;
+                       case '$' :
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_L_MATH;
+                               if (chNext == '$') {
+                                       i++;
+                                       chNext = styler.SafeGetCharAt(i + 1);
                                }
                                break;
-                       case SCE_L_COMMENT :
-                               if (ch == '\r' || ch == '\n') {
-                                       styler.ColourTo(i - 1, state);
-                                       state = SCE_L_DEFAULT;
+                       case '%' :
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_L_COMMENT;
+                               break;
+                       }
+                       break;
+               case SCE_L_COMMAND :
+                       if (chNext == '[' || chNext == '{' || chNext == '}' ||
+                               chNext == ' ' || chNext == '\r' || chNext == '\n') {
+                               styler.ColourTo(i, state);
+                               state = SCE_L_DEFAULT;
+                               i++;
+                               chNext = styler.SafeGetCharAt(i + 1);
+                       }
+                       break;
+               case SCE_L_TAG :
+                       if (ch == '}') {
+                               styler.ColourTo(i, state);
+                               state = SCE_L_DEFAULT;
+                       }
+                       break;
+               case SCE_L_MATH :
+                       if (ch == '$') {
+                               if (chNext == '$') {
+                                       i++;
+                                       chNext = styler.SafeGetCharAt(i + 1);
                                }
-               }               
+                               styler.ColourTo(i, state);
+                               state = SCE_L_DEFAULT;
+                       }
+                       break;
+               case SCE_L_COMMENT :
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_L_DEFAULT;
+                       }
+               }
        }
        styler.ColourTo(lengthDoc, state);
 }
 
-LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc);
-LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc);
-LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc);
-LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc);
-LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc);
-LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc);
+LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch");
+LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff");
+LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props");
+LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile");
+LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist");
+LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex");
diff --git a/contrib/src/stc/scintilla/src/LexPascal.cxx b/contrib/src/stc/scintilla/src/LexPascal.cxx
new file mode 100644 (file)
index 0000000..acc38b5
--- /dev/null
@@ -0,0 +1,222 @@
+// Scintilla source code edit control
+/** @file LexPascal.cxx
+ ** Lexer for Pascal.
+ ** Written by Laurent le Tynevez
+ **/
+
+#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"
+
+
+static int classifyWordPascal(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
+       char s[100];
+       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+               s[i] = static_cast<char>(tolower(styler[start + i]));
+               s[i + 1] = '\0';
+       }
+       int lev= 0;
+       char chAttr = SCE_C_IDENTIFIER;
+       if (isdigit(s[0]) || (s[0] == '.')){
+               chAttr = SCE_C_NUMBER;
+       }
+       else {
+               if (keywords.InList(s)) {
+                       chAttr = SCE_C_WORD;
+                       if (strcmp(s, "begin") == 0 || strcmp(s, "object") == 0)
+                               lev=1;
+                       else if (strcmp(s, "end") == 0)
+                               lev=-1;
+               }
+       }
+       styler.ColourTo(end, chAttr);
+       return lev;
+}
+
+static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+       Accessor &styler) {
+       WordList &keywords = *keywordlists[0];
+
+       styler.StartAt(startPos);
+
+       bool fold = styler.GetPropertyInt("fold");
+       int lineCurrent = styler.GetLine(startPos);
+       int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+       int levelCurrent = levelPrev;
+
+       int state = initStyle;
+       if (state == SCE_C_STRINGEOL)   // Does not leak onto next line
+               state = SCE_C_DEFAULT;
+       char chPrev = ' ';
+       char chNext = styler[startPos];
+       unsigned int lengthDoc = startPos + length;
+       int visibleChars = 0;
+       styler.StartSegment(startPos);
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
+                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+                       // Avoid triggering two times on Dos/Win
+                       // End of line
+                       if (state == SCE_C_STRINGEOL) {
+                               styler.ColourTo(i, state);
+                               state = SCE_C_DEFAULT;
+                       }
+                       if (fold) {
+                               int lev = levelPrev;
+                               if (visibleChars == 0)
+                                       lev |= SC_FOLDLEVELWHITEFLAG;
+                               if ((levelCurrent > levelPrev) && (visibleChars > 0))
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               styler.SetLevel(lineCurrent, lev);
+                               lineCurrent++;
+                               levelPrev = levelCurrent;
+                       }
+                       visibleChars = 0;
+               }
+               if (!isspacechar(ch))
+                       visibleChars++;
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       chPrev = ' ';
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_C_DEFAULT) {
+                       if (iswordstart(ch) || (ch == '@')) {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_IDENTIFIER;
+                       } else if (ch == '{' && chNext != '$' && chNext != '&') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_COMMENT;
+                       } else if (ch == '(' && chNext == '*'
+                                               && styler.SafeGetCharAt(i + 2) != '$'
+                                               && styler.SafeGetCharAt(i + 2) != '&') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_COMMENTDOC;
+                       } else if (ch == '/' && chNext == '/') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_COMMENTLINE;
+                       } else if (ch == '\"') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_STRING;
+                       } else if (ch == '\'') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_CHARACTER;
+                       } else if (ch == '{' && (chNext == '$' || chNext=='&') && visibleChars == 1) {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_PREPROCESSOR;
+                       } else if (isoperator(ch)) {
+                               styler.ColourTo(i-1, state);
+                               styler.ColourTo(i, SCE_C_OPERATOR);
+
+                       }
+               } else if (state == SCE_C_IDENTIFIER) {
+                       if (!iswordchar(ch)) {
+                               int levelChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywords, styler);
+                               state = SCE_C_DEFAULT;
+                               chNext = styler.SafeGetCharAt(i + 1);
+                               if (ch == '{' && chNext != '$' && chNext != '&') {
+                                       state = SCE_C_COMMENT;
+                               } else if (ch == '(' && chNext == '*'
+                                               && styler.SafeGetCharAt(i + 2) != '$'
+                                               && styler.SafeGetCharAt(i + 2) != '&') {
+                                       styler.ColourTo(i-1, state);
+                                       state = SCE_C_COMMENTDOC;
+                               } else if (ch == '/' && chNext == '/') {
+                                       state = SCE_C_COMMENTLINE;
+                               } else if (ch == '\"') {
+                                       state = SCE_C_STRING;
+                               } else if (ch == '\'') {
+                                       state = SCE_C_CHARACTER;
+                               } else if (isoperator(ch)) {
+                                       styler.ColourTo(i, SCE_C_OPERATOR);
+                               }
+                               levelCurrent+=levelChange;
+                       }
+               } else {
+                       if (state == SCE_C_PREPROCESSOR) {
+                               if (ch=='}'){
+                                       styler.ColourTo(i, state);
+                                       state = SCE_C_DEFAULT;
+                               } else {
+                                       if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
+                                               styler.ColourTo(i-1, state);
+                                               state = SCE_C_DEFAULT;
+                                       }
+                               }
+                       } else if (state == SCE_C_COMMENT) {
+                               if (ch == '}' ) {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_C_DEFAULT;
+                               }
+                       } else if (state == SCE_C_COMMENTDOC) {
+                               if (ch == ')' && chPrev == '*') {
+                                       if (((i > styler.GetStartSegment() + 2) || (
+                                               (initStyle == SCE_C_COMMENTDOC) &&
+                                               (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
+                                                       styler.ColourTo(i, state);
+                                                       state = SCE_C_DEFAULT;
+                                       }
+                               }
+                       } else if (state == SCE_C_COMMENTLINE) {
+                               if (ch == '\r' || ch == '\n') {
+                                       styler.ColourTo(i-1, state);
+                                       state = SCE_C_DEFAULT;
+                               }
+                       } else if (state == SCE_C_STRING) {
+                               if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\"') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_C_DEFAULT;
+                               } else if (chNext == '\r' || chNext == '\n') {
+                                       styler.ColourTo(i-1, SCE_C_STRINGEOL);
+                                       state = SCE_C_STRINGEOL;
+                               }
+                       } else if (state == SCE_C_CHARACTER) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i-1, SCE_C_STRINGEOL);
+                                       state = SCE_C_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\'') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_C_DEFAULT;
+                               }
+                       }
+               }
+               chPrev = ch;
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+
+       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+       if (fold) {
+               int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+               styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+       }
+}
+
+LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal");
index a7186fe5525641672f16b746da4cbdc68830aec1..590d05d2a3de5dd9c526a7d025a58db6c6ecd220 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexPerl.cxx - lexer for subset of Perl
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexPerl.cxx
+ ** Lexer for subset of Perl.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-inline bool isPerlOperator(char ch) {
+static inline bool isEOLChar(char ch) {
+       return (ch == '\r') || (ch == '\n');
+}
+
+static bool isSingleCharOp(char ch) {
+       char strCharSet[2];
+       strCharSet[0] = ch;
+       strCharSet[1] = '\0';
+       return (NULL != strstr("rwxoRWXOezsfdlpSbctugkTBMAC", strCharSet));
+}
+
+static inline bool isPerlOperator(char ch) {
        if (isalnum(ch))
                return false;
        // '.' left out as it is used to make up numbers
@@ -49,7 +62,7 @@ static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keyw
        return chAttr;
 }
 
-static bool isEndVar(char ch) {
+static inline bool isEndVar(char ch) {
        return !isalnum(ch) && ch != '#' && ch != '$' &&
               ch != '_' && ch != '\'';
 }
@@ -85,32 +98,86 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
        // Lexer for perl often has to backtrack to start of current style to determine
        // which characters are being used as quotes, how deeply nested is the
        // start position and what the termination string is for here documents
-       
+
        WordList &keywords = *keywordlists[0];
-       
+
+       class HereDocCls {
+       public:
+               int State;              // 0: '<<' encountered
+               // 1: collect the delimiter
+               // 2: here doc text (lines after the delimiter)
+               char Quote;             // the char after '<<'
+               bool Quoted;            // true if Quote in ('\'','"','`')
+               int DelimiterLength;    // strlen(Delimiter)
+               char Delimiter[256];    // the Delimiter, 256: sizeof PL_tokenbuf
+               HereDocCls() {
+                       State = 0;
+                       DelimiterLength = 0;
+                       Delimiter[0] = '\0';
+               }
+       };
+       HereDocCls HereDoc;     // TODO: FIFO for stacked here-docs
+
+       class QuoteCls {
+               public:
+               int  Rep;
+               int  Count;
+               char Up;
+               char Down;
+               QuoteCls() {
+                       this->New(1);
+               }
+               void New(int r) {
+                       Rep   = r;
+                       Count = 0;
+                       Up    = '\0';
+                       Down  = '\0';
+               }
+               void Open(char u) {
+                       Count++;
+                       Up    = u;
+                       Down  = opposite(Up);
+               }
+       };
+       QuoteCls Quote;
+
        char sooked[100];
-       int quotes = 0;
-       char quoteDown = 'd';
-       char quoteUp = 'd';
-       int quoteRep = 1;
        int sookedpos = 0;
        bool preferRE = true;
        sooked[sookedpos] = '\0';
        int state = initStyle;
-       int lengthDoc = startPos + length;
+       unsigned int lengthDoc = startPos + length;
+
        // If in a long distance lexical state, seek to the beginning  to find quote characters
-       if (state == SCE_PL_HERE || state == SCE_PL_REGEX || 
-               state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) {
+       if (state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX) {
+               while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_PL_HERE_DELIM)) {
+                       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
+       || state == SCE_PL_STRING_QR
+       || state == SCE_PL_STRING_QW
+       || state == SCE_PL_REGEX
+       || state == SCE_PL_REGSUBST
+       ) {
                while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
                        startPos--;
                }
                state = SCE_PL_DEFAULT;
        }
+
        styler.StartAt(startPos);
        char chPrev = styler.SafeGetCharAt(startPos - 1);
+       if (startPos == 0)
+               chPrev = '\n';
        char chNext = styler[startPos];
        styler.StartSegment(startPos);
-       for (int i = startPos; i < lengthDoc; i++) {
+
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
                char ch = chNext;
                chNext = styler.SafeGetCharAt(i + 1);
                char chNext2 = styler.SafeGetCharAt(i + 2);
@@ -121,41 +188,81 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                        i += 1;
                        continue;
                }
+               if ((chPrev == '\r' && ch == '\n')) {   // skip on DOS/Windows
+                       chPrev = ch;
+                       continue;
+               }
+
+               if (HereDoc.State == 1 && isEOLChar(ch)) {
+                       // Begin of here-doc (the line after the here-doc delimiter):
+                       HereDoc.State = 2;
+                       styler.ColourTo(i - 1, state);
+                       if (HereDoc.Quoted) {
+                               if (state == SCE_PL_HERE_DELIM) {
+                                       // Missing quote at end of string! We are stricter than perl.
+                                       state = SCE_PL_ERROR;
+                               } else {
+                                       switch (HereDoc.Quote) {
+                                       case '\'':
+                                               state = SCE_PL_HERE_Q ;
+                                               break;
+                                       case '"':
+                                               state = SCE_PL_HERE_QQ;
+                                               break;
+                                       case '`':
+                                               state = SCE_PL_HERE_QX;
+                                               break;
+                                       }
+                               }
+                       } else {
+                               switch (HereDoc.Quote) {
+                               case '\\':
+                                       state = SCE_PL_HERE_Q ;
+                                       break;
+                               default :
+                                       state = SCE_PL_HERE_QQ;
+                               }
+                       }
+               }
 
                if (state == SCE_PL_DEFAULT) {
                        if (iswordstart(ch)) {
                                styler.ColourTo(i - 1, state);
                                if (ch == 's' && !isalnum(chNext)) {
                                        state = SCE_PL_REGSUBST;
-                                       quotes = 0;
-                                       quoteUp = '\0';
-                                       quoteDown = '\0';
-                                       quoteRep = 2;
+                                       Quote.New(2);
                                } else if (ch == 'm' && !isalnum(chNext)) {
                                        state = SCE_PL_REGEX;
-                                       quotes = 0;
-                                       quoteUp = '\0';
-                                       quoteDown = '\0';
-                                       quoteRep = 1;
+                                       Quote.New(1);
+                               } else if (ch == 'q' && !isalnum(chNext)) {
+                                       state = SCE_PL_STRING_Q;
+                                       Quote.New(1);
+                               } else if (ch == 'y' && !isalnum(chNext)) {
+                                       state = SCE_PL_REGSUBST;
+                                       Quote.New(2);
                                } else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) {
                                        state = SCE_PL_REGSUBST;
-                                       quotes = 0;
-                                       quoteUp = '\0';
-                                       quoteDown = '\0';
-                                       quoteRep = 2;
+                                       Quote.New(2);
                                        i++;
                                        chNext = chNext2;
                                } else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) {
-                                       state = SCE_PL_LONGQUOTE;
+                                       if      (chNext == 'q') state = SCE_PL_STRING_QQ;
+                                       else if (chNext == 'x') state = SCE_PL_STRING_QX;
+                                       else if (chNext == 'r') state = SCE_PL_STRING_QR;
+                                       else if (chNext == 'w') state = SCE_PL_STRING_QW;
                                        i++;
                                        chNext = chNext2;
-                                       quotes = 0;
-                                       quoteUp = '\0';
-                                       quoteDown = '\0';
-                                       quoteRep = 1;
+                                       Quote.New(1);
                                } else {
                                        state = SCE_PL_WORD;
                                        preferRE = false;
+                                       if ((!iswordchar(chNext) && chNext != '\'')
+                                               || (chNext == '.' && chNext2 == '.')) {
+                                               // We need that if length of word == 1!
+                                               // This test is copied from the SCE_PL_WORD handler.
+                                               classifyWordPerl(styler.GetStartSegment(), i, keywords, styler);
+                                               state = SCE_PL_DEFAULT;
+                                       }
                                }
                        } else if (ch == '#') {
                                styler.ColourTo(i - 1, state);
@@ -163,6 +270,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                        } else if (ch == '\"') {
                                styler.ColourTo(i - 1, state);
                                state = SCE_PL_STRING;
+                               Quote.New(1);
+                               Quote.Open(ch);
                        } else if (ch == '\'') {
                                if (chPrev == '&') {
                                        // Archaic call
@@ -170,22 +279,24 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                } else {
                                        styler.ColourTo(i - 1, state);
                                        state = SCE_PL_CHARACTER;
+                                       Quote.New(1);
+                                       Quote.Open(ch);
                                }
                        } else if (ch == '`') {
                                styler.ColourTo(i - 1, state);
                                state = SCE_PL_BACKTICKS;
+                               Quote.New(1);
+                               Quote.Open(ch);
                        } else if (ch == '$') {
                                preferRE = false;
                                styler.ColourTo(i - 1, state);
-                               if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
-                                       state = SCE_PL_SCALAR;
-                               } else if (chNext != '{' && chNext != '[') {
+                               if ((chNext == '{') || isspacechar(chNext)) {
                                        styler.ColourTo(i, SCE_PL_SCALAR);
-                                       i++;
-                                       ch = ' ';
-                                       chNext = ' ';
                                } else {
-                                       styler.ColourTo(i, SCE_PL_SCALAR);
+                                       state = SCE_PL_SCALAR;
+                                       i++;
+                                       ch = chNext;
+                                       chNext = chNext2;
                                }
                        } else if (ch == '@') {
                                preferRE = false;
@@ -204,12 +315,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                styler.ColourTo(i - 1, state);
                                if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
                                        state = SCE_PL_HASH;
-                               } else if (chNext != '{' && chNext != '[') {
+                               } else if (chNext == '{') {
                                        styler.ColourTo(i, SCE_PL_HASH);
-                                       i++;
-                                       ch = ' ';
                                } else {
-                                       styler.ColourTo(i, SCE_PL_HASH);
+                                       styler.ColourTo(i, SCE_PL_OPERATOR);
                                }
                        } else if (ch == '*') {
                                styler.ColourTo(i - 1, state);
@@ -217,25 +326,29 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                        } else if (ch == '/' && preferRE) {
                                styler.ColourTo(i - 1, state);
                                state = SCE_PL_REGEX;
-                               quoteUp = '/';
-                               quoteDown = '/';
-                               quotes = 1;
-                               quoteRep = 1;
+                               Quote.New(1);
+                               Quote.Open(ch);
                        } else if (ch == '<' && chNext == '<') {
                                styler.ColourTo(i - 1, state);
-                               state = SCE_PL_HERE;
-                               i++;
-                               ch = chNext;
-                               chNext = chNext2;
-                               quotes = 0;
-                               sookedpos = 0;
-                               sooked[sookedpos] = '\0';
-                       } else if (ch == '=' && (chPrev == '\r' || chPrev == '\n') && isalpha(chNext)) {
+                               state = SCE_PL_HERE_DELIM;
+                               HereDoc.State = 0;
+                       } else if (ch == '='
+                                  && isalpha(chNext)
+                                  && (isEOLChar(chPrev))) {
                                styler.ColourTo(i - 1, state);
                                state = SCE_PL_POD;
-                               quotes = 0;
                                sookedpos = 0;
                                sooked[sookedpos] = '\0';
+                       } else if (ch == '-'
+                                  && isSingleCharOp(chNext)
+                                  && !isalnum((chNext2 = styler.SafeGetCharAt(i+2)))) {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i + 1, SCE_PL_WORD);
+                               state = SCE_PL_DEFAULT;
+                               preferRE = false;
+                               i += 2;
+                               ch = chNext2;
+                               chNext = chNext2 = styler.SafeGetCharAt(i + 1);
                        } else if (isPerlOperator(ch)) {
                                if (ch == ')' || ch == ']')
                                        preferRE = false;
@@ -245,7 +358,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                styler.ColourTo(i, SCE_PL_OPERATOR);
                        }
                } else if (state == SCE_PL_WORD) {
-                       if (!iswordchar(ch) && ch != '\'') {    // Archaic Perl has quotes inside names
+                       if ((!iswordchar(chNext) && chNext != '\'')
+                               || (chNext == '.' && chNext2 == '.')) {
+                               // ".." is always an operator if preceded by a SCE_PL_WORD.
+                               // Archaic Perl has quotes inside names
                                if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) {
                                        styler.ColourTo(i, SCE_PL_DATASECTION);
                                        state = SCE_PL_DATASECTION;
@@ -253,95 +369,106 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        styler.ColourTo(i, SCE_PL_DATASECTION);
                                        state = SCE_PL_DATASECTION;
                                } else {
-                                       if (classifyWordPerl(styler.GetStartSegment(), i - 1, keywords, styler) == SCE_PL_WORD)
+                                       if (classifyWordPerl(styler.GetStartSegment(), i, keywords, styler) == SCE_PL_WORD)
                                                preferRE = true;
                                        state = SCE_PL_DEFAULT;
-                                       if (ch == '#') {
-                                               state = SCE_PL_COMMENTLINE;
-                                       } else if (ch == '\"') {
-                                               state = SCE_PL_STRING;
-                                       } else if (ch == '\'') {
-                                               state = SCE_PL_CHARACTER;
-                                       } else if (ch == '<' && chNext == '<') {
-                                               state = SCE_PL_HERE;
-                                               quotes = 0;
-                                               sookedpos = 0;
-                                               sooked[sookedpos] = '\0';
-                                       } else if (isPerlOperator(ch)) {
-                                               if (ch == ')' || ch == ']')
-                                                       preferRE = false;
-                                               else
-                                                       preferRE = true;
-                                               styler.ColourTo(i, SCE_PL_OPERATOR);
-                                               state = SCE_PL_DEFAULT;
-                                       }
+                                       ch = ' ';
                                }
                        }
                } else {
                        if (state == SCE_PL_COMMENTLINE) {
-                               if (ch == '\r' || ch == '\n') {
+                               if (isEOLChar(ch)) {
                                        styler.ColourTo(i - 1, state);
                                        state = SCE_PL_DEFAULT;
                                }
-                       } else if (state == SCE_PL_HERE) {
-                               if ((isalnum(ch) || ch == '_') && quotes < 2) {
-                                       sooked[sookedpos++] = ch;
-                                       sooked[sookedpos] = '\0';
-                                       if (quotes == 0)
-                                               quotes = 1;
-                               } else {
-                                       quotes++;
-                               }
-                               if ((quotes > 1) && 
-                                       (chPrev == '\n' || chPrev == '\r') &&
-                                       isMatch(styler, lengthDoc, i, sooked)) {
-                                       i += sookedpos;
-                                       chNext = styler.SafeGetCharAt(i);
-                                       if (chNext == '\n' || chNext == '\r') {
-                                               styler.ColourTo(i - 1, SCE_PL_HERE);
-                                               state = SCE_PL_DEFAULT;
-                                       }
-                                       ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
-                               }
-                       } else if (state == SCE_PL_STRING) {
-                               if (ch == '\\') {
-                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                       } else if (state == SCE_PL_HERE_DELIM) {
+                               //
+                               // From perldata.pod:
+                               // ------------------
+                               // A line-oriented form of quoting is based on the shell ``here-doc''
+                               // syntax.
+                               // Following a << you specify a string to terminate the quoted material,
+                               // and all lines following the current line down to the terminating
+                               // string are the value of the item.
+                               // The terminating string may be either an identifier (a word),
+                               // or some quoted text.
+                               // If quoted, the type of quotes you use determines the treatment of
+                               // the text, just as in regular quoting.
+                               // An unquoted identifier works like double quotes.
+                               // There must be no space between the << and the identifier.
+                               // (If you put a space it will be treated as a null identifier,
+                               // which is valid, and matches the first empty line.)
+                               // The terminating string must appear by itself (unquoted and with no
+                               // surrounding whitespace) on the terminating line.
+                               //
+                               if (HereDoc.State == 0) { // '<<' encountered
+                                       HereDoc.State = 1;
+                                       HereDoc.Quote = chNext;
+                                       HereDoc.Quoted = false;
+                                       HereDoc.DelimiterLength = 0;
+                                       HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
+                                       if (chNext == '\'' || chNext == '"' || chNext == '`') { // a quoted here-doc delimiter
                                                i++;
                                                ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       }
-                               } else if (ch == '\"') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_PL_DEFAULT;
-                                       i++;
-                                       ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
-                               }
-                       } else if (state == SCE_PL_CHARACTER) {
-                               if (ch == '\\') {
-                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               chNext = chNext2;
+                                               HereDoc.Quoted = true;
+                                       } else if (chNext == '\\') { // ref?
                                                i++;
                                                ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
+                                               chNext = chNext2;
+                                       } else if (isalnum(chNext) || chNext == '_') { // an unquoted here-doc delimiter
+                                       }
+                                       else if (isspacechar(chNext)) { // deprecated here-doc delimiter || TODO: left shift operator
+                                       }
+                                       else { // TODO: ???
+                                       }
+
+                               } else if (HereDoc.State == 1) { // collect the delimiter
+                                       if (HereDoc.Quoted) { // a quoted here-doc delimiter
+                                               if (ch == HereDoc.Quote) { // closing quote => end of delimiter
+                                                       styler.ColourTo(i, state);
+                                                       state = SCE_PL_DEFAULT;
+                                                       i++;
+                                                       ch = chNext;
+                                                       chNext = chNext2;
+                                               } else {
+                                                       if (ch == '\\' && chNext == HereDoc.Quote) { // escaped quote
+                                                               i++;
+                                                               ch = chNext;
+                                                               chNext = chNext2;
+                                                       }
+                                                       HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
+                                                       HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
+                                               }
+                                       } else { // an unquoted here-doc delimiter
+                                               if (isalnum(ch) || ch == '_') {
+                                                       HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
+                                                       HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
+                                               } else {
+                                                       styler.ColourTo(i - 1, state);
+                                                       state = SCE_PL_DEFAULT;
+                                               }
+                                       }
+                                       if (HereDoc.DelimiterLength >= static_cast<int>(sizeof(HereDoc.Delimiter)) - 1) {
+                                               styler.ColourTo(i - 1, state);
+                                               state = SCE_PL_ERROR;
                                        }
-                               } else if (ch == '\'') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_PL_DEFAULT;
-                                       i++;
-                                       ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
                                }
-                       } else if (state == SCE_PL_BACKTICKS) {
-                               if (ch == '`') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_PL_DEFAULT;
-                                       i++;
+                       } else if (HereDoc.State == 2) {
+                               // state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX
+                               if (isEOLChar(chPrev) && isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) {
+                                       i += HereDoc.DelimiterLength;
+                                       chNext = styler.SafeGetCharAt(i);
+                                       if (isEOLChar(chNext)) {
+                                               styler.ColourTo(i - 1, state);
+                                               state = SCE_PL_DEFAULT;
+                                               HereDoc.State = 0;
+                                       }
                                        ch = chNext;
                                        chNext = styler.SafeGetCharAt(i + 1);
                                }
                        } else if (state == SCE_PL_POD) {
-                               if (ch == '=' && (chPrev == '\r' || chPrev == '\n')) {
+                               if (ch == '=' && isEOLChar(chPrev)) {
                                        if (isMatch(styler, lengthDoc, i, "=cut")) {
                                                styler.ColourTo(i - 1 + 4, state);
                                                i += 4;
@@ -352,7 +479,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                }
                        } else if (state == SCE_PL_SCALAR) {
                                if (isEndVar(ch)) {
-                                       styler.ColourTo(i - 1, state);
+                                       if (i == (styler.GetStartSegment() + 1)) {
+                                               // Special variable: $(, $_ etc.
+                                               styler.ColourTo(i, state);
+                                       } else {
+                                               styler.ColourTo(i - 1, state);
+                                       }
                                        state = SCE_PL_DEFAULT;
                                }
                        } else if (state == SCE_PL_ARRAY) {
@@ -370,36 +502,36 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        styler.ColourTo(i - 1, state);
                                        state = SCE_PL_DEFAULT;
                                }
-                       } else if (state == SCE_PL_REF) {
-                               if (isEndVar(ch)) {
-                                       styler.ColourTo(i - 1, state);
-                                       state = SCE_PL_DEFAULT;
-                               }
-                       } else if (state == SCE_PL_REGEX) {
-                               if (!quoteUp && !isspace(ch)) {
-                                       quoteUp = ch;
-                                       quoteDown = opposite(ch);
-                                       quotes++;
+                       } else if (state == SCE_PL_REGEX
+                               || state == SCE_PL_STRING_QR
+                               ) {
+                               if (!Quote.Up && !isspacechar(ch)) {
+                                       Quote.Open(ch);
+                               } else if (ch == '\\' && Quote.Up != '\\') {
+                                       // SG: Is it save to skip *every* escaped char?
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
                                } else {
-                                       if (ch == quoteDown && chPrev != '\\') {
-                                               quotes--;
-                                               if (quotes == 0) {
-                                                       quoteRep--;
-                                                       if (quoteUp == quoteDown) {
-                                                               quotes++;
+                                       if (ch == Quote.Down /*&& chPrev != '\\'*/) {
+                                               Quote.Count--;
+                                               if (Quote.Count == 0) {
+                                                       Quote.Rep--;
+                                                       if (Quote.Up == Quote.Down) {
+                                                               Quote.Count++;
                                                        }
                                                }
                                                if (!isalpha(chNext)) {
-                                                       if (quoteRep <= 0) {
+                                                       if (Quote.Rep <= 0) {
                                                                styler.ColourTo(i, state);
                                                                state = SCE_PL_DEFAULT;
                                                                ch = ' ';
                                                        }
                                                }
-                                       } else if (ch == quoteUp && chPrev != '\\') {
-                                               quotes++;
+                                       } else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
+                                               Quote.Count++;
                                        } else if (!isalpha(chNext)) {
-                                               if (quoteRep <= 0) {
+                                               if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
@@ -407,12 +539,15 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        }
                                }
                        } else if (state == SCE_PL_REGSUBST) {
-                               if (!quoteUp && !isspace(ch)) {
-                                       quoteUp = ch;
-                                       quoteDown = opposite(ch);
-                                       quotes++;
+                               if (!Quote.Up && !isspacechar(ch)) {
+                                       Quote.Open(ch);
+                               } else if (ch == '\\' && Quote.Up != '\\') {
+                                       // SG: Is it save to skip *every* escaped char?
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
                                } else {
-                                       if (quotes == 0 && quoteRep == 1) {
+                                       if (Quote.Count == 0 && Quote.Rep == 1) {
                                                /* We matched something like s(...) or tr{...}
                                                * and are looking for the next matcher characters,
                                                * which could be either bracketed ({...}) or non-bracketed
@@ -420,68 +555,76 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                *
                                                * Number-signs are problematic.  If they occur after
                                                * the close of the first part, treat them like
-                                               * a quoteUp char, even if they actually start comments.
+                                               * a Quote.Up char, even if they actually start comments.
                                                *
                                                * If we find an alnum, we end the regsubst, and punt.
                                                *
                                                * Eric Promislow   ericp@activestate.com  Aug 9,2000
                                                */
-                                               if (isspace(ch)) {
+                                               if (isspacechar(ch)) {
                                                        // Keep going
-                                               } else if (isalnum(ch)) {
+                                               }
+                                               else if (isalnum(ch)) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
                                                } else {
-                                                       quoteUp = ch;
-                                                       quoteDown = opposite(ch);
-                                                       quotes++;
+                                                       Quote.Open(ch);
                                                }
-                                       } else if (ch == quoteDown && chPrev != '\\') {
-                                               quotes--;
-                                               if (quotes == 0) {
-                                                       quoteRep--;
+                                       } else if (ch == Quote.Down /*&& chPrev != '\\'*/) {
+                                               Quote.Count--;
+                                               if (Quote.Count == 0) {
+                                                       Quote.Rep--;
                                                }
                                                if (!isalpha(chNext)) {
-                                                       if (quoteRep <= 0) {
+                                                       if (Quote.Rep <= 0) {
                                                                styler.ColourTo(i, state);
                                                                state = SCE_PL_DEFAULT;
                                                                ch = ' ';
                                                        }
                                                }
-                                               if (quoteUp == quoteDown) {
-                                                       quotes++;
+                                               if (Quote.Up == Quote.Down) {
+                                                       Quote.Count++;
                                                }
-                                       } else if (ch == quoteUp && chPrev != '\\') {
-                                               quotes++;
+                                       } else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
+                                               Quote.Count++;
                                        } else if (!isalpha(chNext)) {
-                                               if (quoteRep <= 0) {
+                                               if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
                                                }
                                        }
                                }
-                       } else if (state == SCE_PL_LONGQUOTE) {
-                               if (!quoteDown && !isspace(ch)) {
-                                       quoteUp = ch;
-                                       quoteDown = opposite(quoteUp);
-                                       quotes++;
-                               } else if (ch == quoteDown) {
-                                       quotes--;
-                                       if (quotes == 0) {
-                                               quoteRep--;
-                                               if (quoteRep <= 0) {
+                       } else if (state == SCE_PL_STRING_Q
+                               || state == SCE_PL_STRING_QQ
+                               || state == SCE_PL_STRING_QX
+                               || state == SCE_PL_STRING_QW
+                               || state == SCE_PL_STRING
+                               || state == SCE_PL_CHARACTER
+                               || state == SCE_PL_BACKTICKS
+                               ) {
+                               if (!Quote.Down && !isspacechar(ch)) {
+                                       Quote.Open(ch);
+                               } else if (ch == '\\' && Quote.Up != '\\') {
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               } else if (ch == Quote.Down) {
+                                       Quote.Count--;
+                                       if (Quote.Count == 0) {
+                                               Quote.Rep--;
+                                               if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
                                                }
-                                               if (quoteUp == quoteDown) {
-                                                       quotes++;
+                                               if (Quote.Up == Quote.Down) {
+                                                       Quote.Count++;
                                                }
                                        }
-                               } else if (ch == quoteUp) {
-                                       quotes++;
+                               } else if (ch == Quote.Up) {
+                                       Quote.Count++;
                                }
                        }
 
@@ -490,19 +633,30 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        state = SCE_PL_COMMENTLINE;
                                } else if (ch == '\"') {
                                        state = SCE_PL_STRING;
+                                       Quote.New(1);
+                                       Quote.Open(ch);
                                } else if (ch == '\'') {
                                        state = SCE_PL_CHARACTER;
+                                       Quote.New(1);
+                                       Quote.Open(ch);
                                } else if (iswordstart(ch)) {
                                        state = SCE_PL_WORD;
                                        preferRE = false;
-                               } else if (isoperator(ch)) {
+                               } else if (isPerlOperator(ch)) {
+                                       if (ch == ')' || ch == ']')
+                                               preferRE = false;
+                                       else
+                                               preferRE = true;
                                        styler.ColourTo(i, SCE_PL_OPERATOR);
                                }
                        }
                }
+               if (state == SCE_PL_ERROR) {
+                       break;
+               }
                chPrev = ch;
        }
        styler.ColourTo(lengthDoc, state);
 }
 
-LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc);
+LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl");
index 492d21c7d97ba660ee588e31fa6f029bb2dfd8e1..6669694d1d6451d9c0c1d56ef6b636359ffb0b52 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexPython.cxx - lexer for Python
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexPython.cxx
+ ** Lexer for Python.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+/* Returns true if the "as" word that begins at start follows an import statement */
+static bool IsImportAs(unsigned int start, Accessor &styler) {
+       unsigned int i;
+       unsigned int j;
+       char s[10];
+
+       /* Find any import before start but after any statement terminator or quote */
+       i = start;
+       while (i > 0) {
+               char ch = styler[i - 1];
+
+               if (ch == '\n' || ch == '\r' || ch == ';' || ch == '\'' || ch == '"' || ch == '`')
+                       break;
+               if (ch == 't' && i > 5) {
+                       for (j = 0; j < 6; j++)
+                               s[j] = styler[(i - 6) + j];
+                       s[j] = '\0';
+                       if (strcmp(s, "import") == 0)
+                               return true;
+               }
+               i--;
+       }
+
+        return false;
+}
+
 static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
        char s[100];
        bool wordIsNumber = isdigit(styler[start]);
@@ -33,6 +61,8 @@ static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywo
                chAttr = SCE_P_NUMBER;
        else if (keywords.InList(s))
                chAttr = SCE_P_WORD;
+       else if (strcmp(s, "as") == 0 && IsImportAs(start, styler))
+               chAttr = SCE_P_WORD;
        // make sure that dot-qualifiers inside the word are lexed correct
        else for (unsigned int i = 0; i < end - start + 1; i++) {
                if (styler[start + i] == '.') {
@@ -48,50 +78,107 @@ static bool IsPyComment(Accessor &styler, int pos, int len) {
        return len>0 && styler[pos]=='#';
 }
 
-static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, 
+static bool IsPyStringStart(char ch, char chNext, char chNext2) {
+       if (ch == '\'' || ch == '"')
+               return true;
+       if (ch == 'u' || ch == 'U') {
+               if (chNext == '"' || chNext == '\'')
+                       return true;
+               if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
+                       return true;
+       }
+       if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\''))
+               return true;
+
+       return false;
+}
+
+static bool IsPyWordStart(char ch, char chNext, char chNext2) {
+       return (iswordchar(ch) && !IsPyStringStart(ch, chNext, chNext2));
+}
+
+/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
+static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
+       char ch = styler.SafeGetCharAt(i);
+       char chNext = styler.SafeGetCharAt(i + 1);
+
+       // Advance beyond r, u, or ur prefix, but bail if there are any unexpected chars
+       if (ch == 'r' || ch == 'R') {
+               i++;
+               ch = styler.SafeGetCharAt(i);
+               chNext = styler.SafeGetCharAt(i + 1);
+       }
+       else if (ch == 'u' || ch == 'U') {
+               if (chNext == 'r' || chNext == 'R')
+                       i += 2;
+               else
+                       i += 1;
+               ch = styler.SafeGetCharAt(i);
+               chNext = styler.SafeGetCharAt(i + 1);
+       }
+
+       if (ch != '"' && ch != '\'') {
+               *nextIndex = i + 1;
+               return SCE_P_DEFAULT;
+       }
+
+       if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) {
+               *nextIndex = i + 3;
+
+               if (ch == '"')
+                       return SCE_P_TRIPLEDOUBLE;
+               else
+                       return SCE_P_TRIPLE;
+       } else {
+               *nextIndex = i + 1;
+
+               if (ch == '"')
+                       return SCE_P_STRING;
+               else
+                       return SCE_P_CHARACTER;
+       }
+}
+
+static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                                                   WordList *keywordlists[], Accessor &styler) {
 
        int lengthDoc = startPos + length;
 
-       // Backtrack to previous line in case need to fix its fold status or tab whinging
+       // Backtrack to previous line in case need to fix its tab whinging
        int lineCurrent = styler.GetLine(startPos);
        if (startPos > 0) {
                if (lineCurrent > 0) {
-                       lineCurrent--;
-                       startPos = styler.LineStart(lineCurrent);
+                       startPos = styler.LineStart(lineCurrent-1);
                        if (startPos == 0)
                                initStyle = SCE_P_DEFAULT;
-                       else 
+                       else
                                initStyle = styler.StyleAt(startPos-1);
                }
        }
-       
+
        // Python uses a different mask because bad indentation is marked by oring with 32
        styler.StartAt(startPos, 127);
-       
+
        WordList &keywords = *keywordlists[0];
-       
-       bool fold = styler.GetPropertyInt("fold");
+
        int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
        char prevWord[200];
        prevWord[0] = '\0';
        if (length == 0)
                return ;
-       int spaceFlags = 0;
 
        int state = initStyle & 31;
 
-       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
-       if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) 
-               indentCurrent |= SC_FOLDLEVELWHITEFLAG;
-
+       int nextIndex = 0;
        char chPrev = ' ';
        char chPrev2 = ' ';
        char chNext = styler[startPos];
        styler.StartSegment(startPos);
        bool atStartLine = true;
+       int spaceFlags = 0;
+       styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
        for (int i = startPos; i < lengthDoc; i++) {
-       
+
                if (atStartLine) {
                        char chBad = static_cast<char>(64);
                        char chGood = static_cast<char>(0);
@@ -108,40 +195,19 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                        styler.SetFlags(chFlags, static_cast<char>(state));
                        atStartLine = false;
                }
-               
+
                char ch = chNext;
                chNext = styler.SafeGetCharAt(i + 1);
                char chNext2 = styler.SafeGetCharAt(i + 2);
-               
+
                if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
                        if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
                                // Perform colourisation of white space and triple quoted strings at end of each line to allow
                                // tab marking to work inside white space and triple quoted strings
                                styler.ColourTo(i, state);
                        }
-
-                       int lev = indentCurrent;
-                       int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsPyComment);
-                       if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) 
-                               indentNext |= SC_FOLDLEVELWHITEFLAG;
-                       if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
-                               // Only non whitespace lines can be headers
-                               if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
-                                       lev |= SC_FOLDLEVELHEADERFLAG;
-                               } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
-                                       // Line after is blank so check the next - maybe should continue further?
-                                       int spaceFlags2 = 0;
-                                       int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsPyComment);
-                                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
-                                               lev |= SC_FOLDLEVELHEADERFLAG;
-                                       }
-                               }
-                       }
-                       indentCurrent = indentNext;
-                       if (fold) {
-                               styler.SetLevel(lineCurrent, lev);
-                       }
                        lineCurrent++;
+                       styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
                        atStartLine = true;
                }
 
@@ -160,33 +226,20 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                        }
                }
                if (state == SCE_P_DEFAULT) {
-                       if (iswordstart(ch)) {
+                       if (IsPyWordStart(ch, chNext, chNext2)) {
                                styler.ColourTo(i - 1, state);
                                state = SCE_P_WORD;
                        } else if (ch == '#') {
                                styler.ColourTo(i - 1, state);
                                state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
-                       } else if (ch == '\"') {
+                       } else if (IsPyStringStart(ch, chNext, chNext2)) {
                                styler.ColourTo(i - 1, state);
-                               if (chNext == '\"' && chNext2 == '\"') {
-                                       i += 2;
-                                       state = SCE_P_TRIPLEDOUBLE;
+                               state = GetPyStringState(styler, i, &nextIndex);
+                               if (nextIndex != i + 1) {
+                                       i = nextIndex - 1;
                                        ch = ' ';
                                        chPrev = ' ';
                                        chNext = styler.SafeGetCharAt(i + 1);
-                               } else {
-                                       state = SCE_P_STRING;
-                               }
-                       } else if (ch == '\'') {
-                               styler.ColourTo(i - 1, state);
-                               if (chNext == '\'' && chNext2 == '\'') {
-                                       i += 2;
-                                       state = SCE_P_TRIPLE;
-                                       ch = ' ';
-                                       chPrev = ' ';
-                                       chNext = styler.SafeGetCharAt(i + 1);
-                               } else {
-                                       state = SCE_P_CHARACTER;
                                }
                        } else if (isoperator(ch)) {
                                styler.ColourTo(i - 1, state);
@@ -198,25 +251,14 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                                state = SCE_P_DEFAULT;
                                if (ch == '#') {
                                        state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
-                               } else if (ch == '\"') {
-                                       if (chNext == '\"' && chNext2 == '\"') {
-                                               i += 2;
-                                               state = SCE_P_TRIPLEDOUBLE;
-                                               ch = ' ';
-                                               chPrev = ' ';
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       } else {
-                                               state = SCE_P_STRING;
-                                       }
-                               } else if (ch == '\'') {
-                                       if (chNext == '\'' && chNext2 == '\'') {
-                                               i += 2;
-                                               state = SCE_P_TRIPLE;
+                               } else if (IsPyStringStart(ch, chNext, chNext2)) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = GetPyStringState(styler, i, &nextIndex);
+                                       if (nextIndex != i + 1) {
+                                               i = nextIndex - 1;
                                                ch = ' ';
                                                chPrev = ' ';
                                                chNext = styler.SafeGetCharAt(i + 1);
-                                       } else {
-                                               state = SCE_P_CHARACTER;
                                        }
                                } else if (isoperator(ch)) {
                                        styler.ColourTo(i, SCE_P_OPERATOR);
@@ -278,4 +320,131 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
        }
 }
 
-LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc);
+static bool IsCommentLine(int line, Accessor &styler) {
+       int pos = styler.LineStart(line);
+       int eol_pos = styler.LineStart(line+1) - 1;
+       for (int i = pos; i < eol_pos; i++) {
+               char ch = styler[i];
+               if (ch == '#')
+                       return true;
+               else if (ch != ' ' && ch != '\t')
+                       return false;
+       }
+       return false;
+}
+
+static bool IsQuoteLine(int line, Accessor &styler) {
+       int style = styler.StyleAt(styler.LineStart(line)) & 31;
+       return ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
+}
+
+static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
+                                       WordList *[], Accessor &styler) {
+       int maxPos = startPos + length;
+       int maxLines = styler.GetLine(maxPos-1);
+                                               
+       bool foldComment = styler.GetPropertyInt("fold.comment.python");
+       bool foldQuotes = styler.GetPropertyInt("fold.quotes.python");
+
+       // Backtrack to previous non-blank line so we can determine indent level
+       // for any white space lines (needed esp. within triple quoted strings)
+       // and so we can fix any preceding fold level (which is why we go back
+       // at least one line in all cases)
+       int spaceFlags = 0;
+       int lineCurrent = styler.GetLine(startPos);
+       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
+       while (lineCurrent > 0) {
+               lineCurrent--;
+               indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
+               if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) &&
+                       (!IsCommentLine(lineCurrent, styler)) &&
+                       (!IsQuoteLine(lineCurrent, styler)))
+                       break;
+       }
+       int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
+       
+       startPos = styler.LineStart(lineCurrent);
+       // Set up initial state
+       int prev_state = SCE_P_DEFAULT & 31;
+       if (lineCurrent >= 1)
+               prev_state = styler.StyleAt(startPos-1) & 31;
+       int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
+       int prevComment = 0;
+       if (lineCurrent >= 1)
+               prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
+
+       // Process all characters to end of requested range or end of any triple quote
+       // or comment that hangs over the end of the range
+       while ((lineCurrent <= maxLines) || prevQuote || prevComment) {
+
+               // Gather info
+               int lev = indentCurrent;
+               int lineNext = lineCurrent + 1;
+               int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
+               int indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
+               int quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
+               int quote_start = (quote && !prevQuote);
+               int quote_continue = (quote && prevQuote);
+               int comment = foldComment && IsCommentLine(lineCurrent, styler);
+               int comment_start = (comment && !prevComment && 
+                       IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
+               int comment_continue = (comment && prevComment);
+               if ((!quote || !prevQuote) && !comment)
+                       indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
+               if (quote)
+                       indentNext = indentCurrentLevel;
+               if (indentNext & SC_FOLDLEVELWHITEFLAG)
+                       indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
+
+               if (quote_start) {
+                       // Place fold point at start of triple quoted string
+                       lev |= SC_FOLDLEVELHEADERFLAG;
+               } else if (quote_continue || prevQuote) {
+                       // Add level to rest of lines in the string
+                       lev = lev + 1;
+               } else if (comment_start) {
+                       // Place fold point at start of a block of comments
+                       lev |= SC_FOLDLEVELHEADERFLAG;
+               } else if (comment_continue) {
+                       // Add level to rest of lines in the block
+                       lev = lev + 1;
+               }
+
+               // Skip past any blank lines for next indent level info; we skip also comments
+               // starting in column 0 which effectively folds them into surrounding code
+               // rather than screwing up folding.  Then set indent level on the lines
+               // we skipped to be same as maximum of current and next indent.  This approach
+               // does a reasonable job of collapsing white space into surrounding code
+               // without getting confused by white space at the start of an indented level.
+               while (!quote &&
+                      ((indentNext & SC_FOLDLEVELWHITEFLAG) || styler[styler.LineStart(lineNext)] == '#') &&
+                      (lineNext < maxLines)) {
+                       int level = Platform::Maximum(indentCurrent, indentNext);
+                       if (indentNext & SC_FOLDLEVELWHITEFLAG)
+                               level = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
+                       styler.SetLevel(lineNext, level);
+                       lineNext++;
+                       indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
+               }
+
+               // Set fold header on non-quote/non-comment line
+               if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
+                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
+                               lev |= SC_FOLDLEVELHEADERFLAG;
+               }
+
+               // Keep track of triple quote and block comment state of previous line
+               prevQuote = quote;
+               prevComment = comment_start || comment_continue;
+
+               // Set fold level for this line and move to next line
+               styler.SetLevel(lineCurrent, lev);
+               indentCurrent = indentNext;
+               lineCurrent = lineNext;
+       }
+
+       // Make sure last line indent level is set too
+       styler.SetLevel(lineCurrent, indentCurrent);
+}
+
+LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
diff --git a/contrib/src/stc/scintilla/src/LexRuby.cxx b/contrib/src/stc/scintilla/src/LexRuby.cxx
new file mode 100644 (file)
index 0000000..b29eee3
--- /dev/null
@@ -0,0 +1,355 @@
+// Scintilla source code edit control
+/** @file LexRuby.cxx
+ ** Lexer for Ruby.
+ **/
+// Copyright 2001- by Clemens Wyss <wys@helbling.ch>
+// 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"
+
+static void ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
+       char s[100];
+       bool wordIsNumber = isdigit(styler[start]);
+       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+               s[i] = styler[start + i];
+               s[i + 1] = '\0';
+       }
+       char chAttr = SCE_P_IDENTIFIER;
+       if (0 == strcmp(prevWord, "class"))
+               chAttr = SCE_P_CLASSNAME;
+       else if (0 == strcmp(prevWord, "module"))
+               chAttr = SCE_P_CLASSNAME;
+       else if (0 == strcmp(prevWord, "def"))
+               chAttr = SCE_P_DEFNAME;
+       else if (wordIsNumber)
+               chAttr = SCE_P_NUMBER;
+       else if (keywords.InList(s))
+               chAttr = SCE_P_WORD;
+       // make sure that dot-qualifiers inside the word are lexed correct
+       else for (unsigned int i = 0; i < end - start + 1; i++) {
+               if (styler[start + i] == '.') {
+                       styler.ColourTo(start + i - 1, chAttr);
+                       styler.ColourTo(start + i, SCE_P_OPERATOR);
+               }
+       }
+       styler.ColourTo(end, chAttr);
+       strcpy(prevWord, s);
+}
+
+static bool IsRbComment(Accessor &styler, int pos, int len) {
+       return len>0 && styler[pos]=='#';
+}
+
+static bool IsRbStringStart(char ch, char chNext, char chNext2) {
+       if (ch == '\'' || ch == '"')
+               return true;
+       if (ch == 'u' || ch == 'U') {
+               if (chNext == '"' || chNext == '\'')
+                       return true;
+               if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
+                       return true;
+       }
+       if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\''))
+               return true;
+
+       return false;
+}
+
+static bool IsRbWordStart(char ch, char chNext, char chNext2) {
+       return (iswordchar(ch) && !IsRbStringStart(ch, chNext, chNext2));
+}
+
+/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
+static int GetRbStringState(Accessor &styler, int i, int *nextIndex) {
+       char ch = styler.SafeGetCharAt(i);
+       char chNext = styler.SafeGetCharAt(i + 1);
+
+       // Advance beyond r, u, or ur prefix, but bail if there are any unexpected chars
+       if (ch == 'r' || ch == 'R') {
+               i++;
+               ch = styler.SafeGetCharAt(i);
+               chNext = styler.SafeGetCharAt(i + 1);
+       }
+       else if (ch == 'u' || ch == 'U') {
+               if (chNext == 'r' || chNext == 'R')
+                       i += 2;
+               else
+                       i += 1;
+               ch = styler.SafeGetCharAt(i);
+               chNext = styler.SafeGetCharAt(i + 1);
+       }
+
+       if (ch != '"' && ch != '\'') {
+               *nextIndex = i + 1;
+               return SCE_P_DEFAULT;
+       }
+
+       if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) {
+               *nextIndex = i + 3;
+
+               if (ch == '"')
+                       return SCE_P_TRIPLEDOUBLE;
+               else
+                       return SCE_P_TRIPLE;
+       } else {
+               *nextIndex = i + 1;
+
+               if (ch == '"')
+                       return SCE_P_STRING;
+               else
+                       return SCE_P_CHARACTER;
+       }
+}
+
+static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
+                                                  WordList *keywordlists[], Accessor &styler) {
+
+       int lengthDoc = startPos + length;
+
+       // Backtrack to previous line in case need to fix its tab whinging
+       if (startPos > 0) {
+               int lineCurrent = styler.GetLine(startPos);
+               if (lineCurrent > 0) {
+                       startPos = styler.LineStart(lineCurrent-1);
+                       if (startPos == 0)
+                               initStyle = SCE_P_DEFAULT;
+                       else
+                               initStyle = styler.StyleAt(startPos-1);
+               }
+       }
+
+       // Ruby uses a different mask because bad indentation is marked by oring with 32
+       styler.StartAt(startPos, 127);
+
+       WordList &keywords = *keywordlists[0];
+
+       int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
+       char prevWord[200];
+       prevWord[0] = '\0';
+       if (length == 0)
+               return ;
+
+       int state = initStyle & 31;
+
+       int nextIndex = 0;
+       char chPrev = ' ';
+       char chPrev2 = ' ';
+       char chNext = styler[startPos];
+       styler.StartSegment(startPos);
+       bool atStartLine = true;
+       int spaceFlags = 0;
+       for (int i = startPos; i < lengthDoc; i++) {
+
+               if (atStartLine) {
+                       char chBad = static_cast<char>(64);
+                       char chGood = static_cast<char>(0);
+                       char chFlags = chGood;
+                       if (whingeLevel == 1) {
+                               chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
+                       } else if (whingeLevel == 2) {
+                               chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
+                       } else if (whingeLevel == 3) {
+                               chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
+                       } else if (whingeLevel == 4) {
+                               chFlags = (spaceFlags & wsTab) ? chBad : chGood;
+                       }
+                       styler.SetFlags(chFlags, static_cast<char>(state));
+                       atStartLine = false;
+               }
+
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               char chNext2 = styler.SafeGetCharAt(i + 2);
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
+                       if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
+                               // Perform colourisation of white space and triple quoted strings at end of each line to allow
+                               // tab marking to work inside white space and triple quoted strings
+                               styler.ColourTo(i, state);
+                       }
+                       atStartLine = true;
+               }
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       chPrev = ' ';
+                       chPrev2 = ' ';
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_P_STRINGEOL) {
+                       if (ch != '\r' && ch != '\n') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_P_DEFAULT;
+                       }
+               }
+               if (state == SCE_P_DEFAULT) {
+                       if (IsRbWordStart(ch, chNext, chNext2)) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_P_WORD;
+                       } else if (ch == '#') {
+                               styler.ColourTo(i - 1, state);
+                               state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
+                       } else if (ch == '=' && chNext == 'b') {
+                               // =begin indicates the start of a comment (doc) block
+                               if(styler.SafeGetCharAt(i + 2) == 'e' && styler.SafeGetCharAt(i + 3) == 'g' && styler.SafeGetCharAt(i + 4) == 'i' && styler.SafeGetCharAt(i + 5) == 'n') {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_P_TRIPLEDOUBLE; //SCE_C_COMMENT;
+                               }
+                       }  else if (IsRbStringStart(ch, chNext, chNext2)) {
+                               styler.ColourTo(i - 1, state);
+                               state = GetRbStringState(styler, i, &nextIndex);
+                               if (nextIndex != i + 1) {
+                                       i = nextIndex - 1;
+                                       ch = ' ';
+                                       chPrev = ' ';
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               }
+                       } else if (isoperator(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i, SCE_P_OPERATOR);
+                       } 
+                       } else if (state == SCE_P_WORD) {
+                       if (!iswordchar(ch)) {
+                               ClassifyWordRb(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
+                               state = SCE_P_DEFAULT;
+                               if (ch == '#') {
+                                       state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
+                               } else if (IsRbStringStart(ch, chNext, chNext2)) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = GetRbStringState(styler, i, &nextIndex);
+                                       if (nextIndex != i + 1) {
+                                               i = nextIndex - 1;
+                                               ch = ' ';
+                                               chPrev = ' ';
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (isoperator(ch)) {
+                                       styler.ColourTo(i, SCE_P_OPERATOR);
+                               }
+                       }
+               } else {
+                       if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) {
+                               if (ch == '\r' || ch == '\n') {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_P_DEFAULT;
+                               }
+                       } else if (state == SCE_P_STRING) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_P_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\"') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_P_DEFAULT;
+                               }
+                       } else if (state == SCE_P_CHARACTER) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_P_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\'') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_P_DEFAULT;
+                               }
+                       } else if (state == SCE_P_TRIPLE) {
+                               if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_P_DEFAULT;
+                               }
+                       } else if (state == SCE_P_TRIPLEDOUBLE) {
+                               // =end terminates the comment block
+                               if (ch == 'd' && chPrev == 'n' && chPrev2 == 'e') {
+                                       if  (styler.SafeGetCharAt(i - 3) == '=') {
+                                               styler.ColourTo(i, state);
+                                               state = SCE_P_DEFAULT;
+                                       }
+                               }
+                       }
+               }
+               chPrev2 = chPrev;
+               chPrev = ch;
+       }
+       if (state == SCE_P_WORD) {
+               ClassifyWordRb(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord);
+       } else {
+               styler.ColourTo(lengthDoc, state);
+       }
+}
+
+static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
+                                                  WordList *[], Accessor &styler) {
+       int lengthDoc = startPos + length;
+
+       // Backtrack to previous line in case need to fix its fold status
+       int lineCurrent = styler.GetLine(startPos);
+       if (startPos > 0) {
+               if (lineCurrent > 0) {
+                       lineCurrent--;
+                       startPos = styler.LineStart(lineCurrent);
+                       if (startPos == 0)
+                               initStyle = SCE_P_DEFAULT;
+                       else
+                               initStyle = styler.StyleAt(startPos-1);
+               }
+       }
+       int state = initStyle & 31;
+       int spaceFlags = 0;
+       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsRbComment);
+       if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
+               indentCurrent |= SC_FOLDLEVELWHITEFLAG;
+       char chNext = styler[startPos];
+       for (int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               int style = styler.StyleAt(i) & 31;
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
+                       int lev = indentCurrent;
+                       int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsRbComment);
+                       if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
+                               indentNext |= SC_FOLDLEVELWHITEFLAG;
+                       if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
+                               // Only non whitespace lines can be headers
+                               if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
+                                       // Line after is blank so check the next - maybe should continue further?
+                                       int spaceFlags2 = 0;
+                                       int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsRbComment);
+                                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
+                                               lev |= SC_FOLDLEVELHEADERFLAG;
+                                       }
+                               }
+                       }
+                       indentCurrent = indentNext;
+                       styler.SetLevel(lineCurrent, lev);
+                       lineCurrent++;
+               }
+       }
+}
+                                                  
+LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc);
index facd0e6b7bb64c617251fb59a18eb1c38079acce..84d7d1c52e7a9991861cda189958a3619bd07b1c 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexSQL.cxx - lexer for SQL
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexSQL.cxx
+ ** Lexer for SQL.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
@@ -38,7 +40,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
                             int initStyle, WordList *keywordlists[], Accessor &styler) {
 
        WordList &keywords = *keywordlists[0];
-       
+
        styler.StartAt(startPos);
 
        bool fold = styler.GetPropertyInt("fold");
@@ -153,4 +155,4 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
        styler.ColourTo(lengthDoc - 1, state);
 }
 
-LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc);
+LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc, "sql");
index 67dfa784276a84b25cb6dd813cdd41e53807d72a..61e4035b18f870b60767d2f4f760bad985eb74ac 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexVB.cxx - lexer for Visual Basic and VBScript
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexVB.cxx
+ ** Lexer for Visual Basic and VBScript.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
@@ -43,11 +45,15 @@ static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywor
                return SCE_C_DEFAULT;
 }
 
+static bool IsVBComment(Accessor &styler, int pos, int len) {
+       return len>0 && styler[pos]=='\'';
+}
+
 static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
                            WordList *keywordlists[], Accessor &styler) {
 
        WordList &keywords = *keywordlists[0];
-       
+
        styler.StartAt(startPos);
 
        int visibleChars = 0;
@@ -73,7 +79,7 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
                        }
                        visibleChars = 0;
                }
-               if (!isspace(ch))
+               if (!isspacechar(ch))
                        visibleChars++;
 
                if (state == SCE_C_DEFAULT) {
@@ -136,4 +142,56 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
        styler.ColourTo(lengthDoc, state);
 }
 
-LexerModule lmVB(SCLEX_VB, ColouriseVBDoc);
+static void FoldVBDoc(unsigned int startPos, int length, int initStyle,
+                                                  WordList *[], Accessor &styler) {
+       int lengthDoc = startPos + length;
+
+       // Backtrack to previous line in case need to fix its fold status
+       int lineCurrent = styler.GetLine(startPos);
+       if (startPos > 0) {
+               if (lineCurrent > 0) {
+                       lineCurrent--;
+                       startPos = styler.LineStart(lineCurrent);
+                       if (startPos == 0)
+                               initStyle = SCE_P_DEFAULT;
+                       else
+                               initStyle = styler.StyleAt(startPos-1);
+               }
+       }
+       int state = initStyle & 31;
+       int spaceFlags = 0;
+       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsVBComment);
+       if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
+               indentCurrent |= SC_FOLDLEVELWHITEFLAG;
+       char chNext = styler[startPos];
+       for (int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               int style = styler.StyleAt(i) & 31;
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
+                       int lev = indentCurrent;
+                       int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsVBComment);
+                       if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
+                               indentNext |= SC_FOLDLEVELWHITEFLAG;
+                       if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
+                               // Only non whitespace lines can be headers
+                               if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
+                                       // Line after is blank so check the next - maybe should continue further?
+                                       int spaceFlags2 = 0;
+                                       int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsVBComment);
+                                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
+                                               lev |= SC_FOLDLEVELHEADERFLAG;
+                                       }
+                               }
+                       }
+                       indentCurrent = indentNext;
+                       styler.SetLevel(lineCurrent, lev);
+                       lineCurrent++;
+               }
+       }
+}
+
+LexerModule lmVB(SCLEX_VB, ColouriseVBDoc, "vb", FoldVBDoc);
index f54978c3fc30ec35bb653acecc239fc9a84ab868..dc1468d8324ced046063c8eecea21b95ec0ac412 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// LineMarker.cxx - defines the look of a line marker in the margin 
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file LineMarker.cxx
+ ** Defines the look of a line marker in the margin .
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Platform.h"
 #include "Scintilla.h"
 #include "LineMarker.h"
 
-void LineMarker::Draw(Surface *surface, PRectangle &rc) {
+static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, Colour fore, Colour back) {
+       PRectangle rc;
+       rc.left = centreX - armSize;
+       rc.top = centreY - armSize;
+       rc.right = centreX + armSize + 1;
+       rc.bottom = centreY + armSize + 1;
+       surface->RectangleDraw(rc, back, fore);
+}
+
+static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, Colour fore, Colour back) {
+       PRectangle rcCircle;
+       rcCircle.left = centreX - armSize;
+       rcCircle.top = centreY - armSize;
+       rcCircle.right = centreX + armSize + 1;
+       rcCircle.bottom = centreY + armSize + 1;
+       surface->Ellipse(rcCircle, back, fore);
+}
+
+static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, Colour fore) {
+       PRectangle rcV(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1);
+       surface->FillRectangle(rcV, fore);
+       PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
+       surface->FillRectangle(rcH, fore);
+}
+
+static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, Colour fore) {
+       PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
+       surface->FillRectangle(rcH, fore);
+}
+
+void LineMarker::Draw(Surface *surface, PRectangle &rcWhole) {
+       // Restrict most shapes a bit
+       PRectangle rc = rcWhole;
+       rc.top++;
+       rc.bottom--;
        int minDim = Platform::Minimum(rc.Width(), rc.Height());
        minDim--;       // Ensure does not go beyond edge
        int centreX = (rc.right + rc.left) / 2;
        int centreY = (rc.bottom + rc.top) / 2;
        int dimOn2 = minDim / 2;
        int dimOn4 = minDim / 4;
+       int blobSize = dimOn2-1;
+       int armSize = dimOn2-2;
        if (rc.Width() > (rc.Height() * 2)) {
                // Wide column is line number so move to left to try to avoid overlapping number
                centreX = rc.left + dimOn2 + 1;
@@ -50,7 +88,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
                                fore.allocated, back.allocated);
 
        } else if (markType == SC_MARK_PLUS) {
-               int armSize = dimOn2-2;
                Point pts[] = {
                Point(centreX - armSize, centreY - 1),
                Point(centreX - 1, centreY - 1),
@@ -69,7 +106,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
                                fore.allocated, back.allocated);
 
        } else if (markType == SC_MARK_MINUS) {
-               int armSize = dimOn2-2;
                Point pts[] = {
                Point(centreX - armSize, centreY - 1),
                Point(centreX + armSize, centreY -1),
@@ -86,8 +122,114 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
                rcSmall.right = rc.right - 1;
                rcSmall.bottom = rc.bottom - 2;
                surface->RectangleDraw(rcSmall, fore.allocated, back.allocated);
+               
        } else if (markType == SC_MARK_EMPTY) {
                // An invisible marker so don't draw anything
+               
+       } else if (markType == SC_MARK_VLINE) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+       } else if (markType == SC_MARK_LCORNER) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rc.top + dimOn2);
+               surface->LineTo(rc.right - 2, rc.top + dimOn2);
+               
+       } else if (markType == SC_MARK_TCORNER) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rcWhole.bottom);
+               surface->MoveTo(centreX, rc.top + dimOn2);
+               surface->LineTo(rc.right - 2, rc.top + dimOn2);
+               
+       } else if (markType == SC_MARK_LCORNERCURVE) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rc.top + dimOn2-3);
+               surface->LineTo(centreX+3, rc.top + dimOn2);
+               surface->LineTo(rc.right - 1, rc.top + dimOn2);
+               
+       } else if (markType == SC_MARK_TCORNERCURVE) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rc.top + dimOn2-3);
+               surface->LineTo(centreX+3, rc.top + dimOn2);
+               surface->LineTo(rc.right - 1, rc.top + dimOn2);
+               
+       } else if (markType == SC_MARK_BOXPLUS) {
+               surface->PenColour(back.allocated);
+               DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
+               
+       } else if (markType == SC_MARK_BOXPLUSCONNECTED) {
+               surface->PenColour(back.allocated);
+               DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, centreY - blobSize);
+               
+       } else if (markType == SC_MARK_BOXMINUS) {
+               surface->PenColour(back.allocated);
+               DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+       } else if (markType == SC_MARK_BOXMINUSCONNECTED) {
+               surface->PenColour(back.allocated);
+               DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, centreY - blobSize);
+               
+       } else if (markType == SC_MARK_CIRCLEPLUS) {
+               DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               surface->PenColour(back.allocated);
+               DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
+               
+       } else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) {
+               DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               surface->PenColour(back.allocated);
+               DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, centreY - blobSize);
+               
+       } else if (markType == SC_MARK_CIRCLEMINUS) {
+               DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               surface->PenColour(back.allocated);
+               DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+       } else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) {
+               DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               surface->PenColour(back.allocated);
+               DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, centreY - blobSize);
+               
        } else { // SC_MARK_SHORTARROW
                Point pts[] = {
                        Point(centreX, centreY + dimOn2),
index f22241bb193dc0ade12242e718714eaf0116d920..ee0f36c256611437b649a254d80b8d947de8b4f9 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// LineMarker.h - defines the look of a line marker in the margin 
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file LineMarker.h
+ ** Defines the look of a line marker in the margin .
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef LINEMARKER_H
 #define LINEMARKER_H
 
+/**
+ */
 class LineMarker {
 public:
        int markType;
diff --git a/contrib/src/stc/scintilla/src/PosRegExp.cxx b/contrib/src/stc/scintilla/src/PosRegExp.cxx
deleted file mode 100644 (file)
index ea719b7..0000000
+++ /dev/null
@@ -1,1181 +0,0 @@
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <malloc.h>
-
-#include "PosRegExp.h"
-
-//Up: /[A-Z \x80-\x9f \xf0 ]/x
-//Lo: /[a-z \xa0-\xaf \xe0-\xef \xf1 ]/x
-//Wd: /[\d _ A-Z a-z \xa0-\xaf \xe0-\xf1 \x80-\x9f]/x
-//*   // Dos866
-SCharData UCData  = {0x0, 0x0, 0x7fffffe, 0x0, 0xffffffff, 0x0, 0x0, 0x10000},
-                     LCData  = {0x0, 0x0, 0x0, 0x7fffffe, 0x0, 0xffff, 0x0, 0x2ffff},
-                     WdData  = {0x0, 0x3ff0000, 0x87fffffe, 0x7fffffe, 0xffffffff, 0xffff, 0x0, 0x3ffff},
-                     DigData = {0x0, 0x3ff0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
-/*/   // cp1251
-SCharData UCData  = {0x0, 0x0, 0x7fffffe, 0x0, 0x0, 0x0, 0xffffffff, 0x0},
-          LCData  = {0x0, 0x0, 0x0, 0x7fffffe, 0x0, 0x0, 0x0, 0xffffffff},
-          WdData  = {0x0, 0x3ff0000, 0x87fffffe, 0x7fffffe, 0x0, 0x0, 0xffffffff, 0xffffffff},
-          DigData = {0x0, 0x3ff0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
-//*/
-
-///////////////////////////////////////////////
-
-int GetNumber(int *str,int s,int e) {
-       int r = 1, num = 0;
-       if (e < s) return -1;
-       for(int i = e-1; i >= s; i--) {
-               if (str[i] > '9' || str[i] < '0') return -1;
-               num += (str[i] - 0x30)*r;
-               r *= 10;
-       };
-       return num;
-       /*
-       char tmp[20];
-       double Res;
-         if (e == s) return -1;
-         for (int i = s;i < e;i++)
-           tmp[i-s] = (char)Str[i];
-         tmp[e-s] = 0;
-         GetNumber(tmp,&Res);
-         return (int)Res;
-       */
-};
-
-bool IsDigit(char Symb) {
-       return DigData.GetBit(Symb);
-};
-bool IsWord(char Symb) {
-       return WdData.GetBit(Symb);
-};
-bool IsUpperCase(char Symb) {
-       return UCData.GetBit(Symb);
-};
-bool IsLowerCase(char Symb) {
-       return LCData.GetBit(Symb);
-};
-char LowCase(char Chr) {
-       if (UCData.GetBit(Chr))
-               return Chr+0x20;
-       return Chr;
-};
-
-///////////////////////////////////////////////
-
-SRegInfo::SRegInfo() {
-       Next = Parent = 0;
-       un.Param = 0;
-       Op = ReEmpty;
-};
-SRegInfo::~SRegInfo() {
-       if (Next) delete Next;
-       if (un.Param)
-               switch(Op) {
-               case ReEnum:
-               case ReNEnum:
-                       delete un.ChrClass;
-                       break;
-               default:
-                       if (Op > ReBlockOps && Op < ReSymbolOps || Op == ReBrackets)
-                               delete un.Param;
-                       break;
-               };
-};
-
-///////////////////////////////////////////////
-
-void SCharData::SetBit(unsigned char Bit) {
-       int p = Bit/8;
-       CArr[p] |= (1 << Bit%8);
-};
-void SCharData::ClearBit(unsigned char Bit) {
-       int p = Bit/8;
-       CArr[p] &= ~(1 << Bit%8);
-};
-bool SCharData::GetBit(unsigned char Bit) {
-       int p = (unsigned char)Bit/8;
-       return (CArr[p] & (1 << Bit%8))!=0;
-};
-
-/////////////////////////////////////////////////////////////////
-//////////////////////  RegExp Class  ///////////////////////////
-/////////////////////////////////////////////////////////////////
-
-PosRegExp::PosRegExp() {
-       Info = 0;
-       Exprn = 0;
-       NoMoves = false;
-       Error = true;
-       FirstChar = 0;
-       CurMatch = 0;
-};
-PosRegExp::~PosRegExp() {
-       if (Info) delete Info;
-};
-
-bool PosRegExp::SetExpr(const char *Expr) {
-       if (!this) return false;
-       Error = true;
-       CurMatch = 0;
-       if (SetExprLow(Expr)) Error = false;
-       return !Error;
-};
-bool PosRegExp::isok() {
-       return !Error;
-};
-
-
-bool PosRegExp::SetExprLow(const char *Expr) {
-       int Len = strlen(Expr);
-       bool  Ok = false;
-       int i,j,s = 0,pos,tmp;
-       int EnterBr = 0,EnterGr = 0,EnterFg = 0;
-
-       if (Info) delete Info;
-       Info = new SRegInfo;
-       Exprn = new int[Len];
-
-       NoCase = false;
-       Extend = false;
-       if (Expr[0] == '/') s++;
-       else return false;
-
-       for (i = Len; i > 0 && !Ok;i--)
-               if (Expr[i] == '/') {
-                       Len = i-s;
-                       Ok = true;
-                       for (int j = i+1; Expr[j]; j++) {
-                               if (Expr[j] == 'i') NoCase = true;
-                               if (Expr[j] == 'x') Extend = true;
-                       };
-               };
-       if (!Ok) return false;
-
-       ////////////////////////////////
-       for (j = 0,pos = 0; j < Len; j++,pos++) {
-               if (Extend && Expr[j+s] == ' ') {
-                       pos--;
-                       continue;
-               };
-
-               Exprn[pos] = (int)(unsigned char)Expr[j+s];
-
-               if (Expr[j+s] == BackSlash) {
-                       switch (Expr[j+s+1]) {
-                       case 'd':
-                               Exprn[pos] = ReDigit;
-                               break;
-                       case 'D':
-                               Exprn[pos] = ReNDigit;
-                               break;
-                       case 'w':
-                               Exprn[pos] = ReWordSymb;
-                               break;
-                       case 'W':
-                               Exprn[pos] = ReNWordSymb;
-                               break;
-                       case 's':
-                               Exprn[pos] = ReWSpace;
-                               break;
-                       case 'S':
-                               Exprn[pos] = ReNWSpace;
-                               break;
-                       case 'u':
-                               Exprn[pos] = ReUCase;
-                               break;
-                       case 'l':
-                               Exprn[pos] = ReNUCase;
-                               break;
-                       case 't':
-                               Exprn[pos] = '\t';
-                               break;
-                       case 'n':
-                               Exprn[pos] = '\n';
-                               break;
-                       case 'r':
-                               Exprn[pos] = '\r';
-                               break;
-                       case 'b':
-                               Exprn[pos] = ReWBound;
-                               break;
-                       case 'B':
-                               Exprn[pos] = ReNWBound;
-                               break;
-                       case 'c':
-                               Exprn[pos] = RePreNW;
-                               break;
-                       case 'm':
-                               Exprn[pos] = ReStart;
-                               break;
-                       case 'M':
-                               Exprn[pos] = ReEnd;
-                               break;
-                       case 'x':
-                               tmp = toupper(Expr[j+s+2])-0x30;
-                               tmp = (tmp>9?tmp-7:tmp)<<4;
-                               tmp += (toupper(Expr[j+s+3])-0x30)>9?toupper(Expr[j+s+3])-0x37:(toupper(Expr[j+s+3])-0x30);
-                               Exprn[pos] = tmp;
-                               j+=2;
-                               break;
-                       case 'y':
-                               tmp = Expr[j+s+2] - 0x30;
-                               if (tmp >= 0 && tmp <= 9) {
-                                       if (tmp == 1) {
-                                               tmp = 10 + Expr[j+s+3] - 0x30;
-                                               if (tmp >= 10 && tmp <= 19) j++;
-                                               else tmp = 1;
-                                       };
-                                       Exprn[pos] = ReBkTrace + tmp;
-                                       j++;
-                                       break;
-                               };
-                       default:
-                               tmp = Expr[j+s+1] - 0x30;
-                               if (tmp >= 0 && tmp <= 9) {
-                                       if (tmp == 1) {
-                                               tmp = 10 + Expr[j+s+2] - 0x30;
-                                               if (tmp >= 10 && tmp <= 19) j++;
-                                               else tmp = 1;
-                                       };
-                                       Exprn[pos] = ReBkBrack + tmp;
-                                       break;
-                               } else
-                                       Exprn[pos] = Expr[j+s+1];
-                               break;
-                       };
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == ']') {
-                       Exprn[pos] = ReEnumE;
-                       if (EnterFg || !EnterGr) return false;
-                       EnterGr--;
-               };
-               if (Expr[j+s] == '-' && EnterGr) Exprn[pos] = ReFrToEnum;
-
-               if (EnterGr) continue;
-
-               if (Expr[j+s] == '[' && Expr[j+s+1] == '^') {
-                       Exprn[pos] = ReNEnumS;
-                       if (EnterFg) return false;
-                       EnterGr++;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '*' && Expr[j+s+1] == '?') {
-                       Exprn[pos] = ReNGMul;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '+' && Expr[j+s+1] == '?') {
-                       Exprn[pos] = ReNGPlus;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '?') {
-                       Exprn[pos] = ReNGQuest;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '#' &&
-                       Expr[j+s+2]>='0' && Expr[j+s+2]<='9') {
-                       Exprn[pos] = ReBehind+Expr[j+s+2]-0x30;
-                       j+=2;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '~' &&
-                       Expr[j+s+2]>='0' && Expr[j+s+2]<='9') {
-                       Exprn[pos] = ReNBehind+Expr[j+s+2]-0x30;
-                       j+=2;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '=') {
-                       Exprn[pos] = ReAhead;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '!') {
-                       Exprn[pos] = ReNAhead;
-                       j++;
-                       continue;
-               };
-
-               if (Expr[j+s] == '(') {
-                       Exprn[pos] = ReLBrack;
-                       if (EnterFg) return false;
-                       EnterBr++;
-               };
-               if (Expr[j+s] == ')') {
-                       Exprn[pos] = ReRBrack;
-                       if (!EnterBr || EnterFg) return false;
-                       EnterBr--;
-               };
-               if (Expr[j+s] == '[') {
-                       Exprn[pos] = ReEnumS;
-                       if (EnterFg) return false;
-                       EnterGr++;
-               };
-               if (Expr[j+s] == '{') {
-                       Exprn[pos] = ReRangeS;
-                       if (EnterFg) return false;
-                       EnterFg++;
-               };
-               if (Expr[j+s] == '}' && Expr[j+s+1] == '?') {
-                       Exprn[pos] = ReNGRangeE;
-                       if (!EnterFg) return false;
-                       EnterFg--;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '}') {
-                       Exprn[pos] = ReRangeE;
-                       if (!EnterFg) return false;
-                       EnterFg--;
-               };
-
-               if (Expr[j+s] == '^') Exprn[pos] = ReSoL;
-               if (Expr[j+s] == '$') Exprn[pos] = ReEoL;
-               if (Expr[j+s] == '.') Exprn[pos] = ReAnyChr;
-               if (Expr[j+s] == '*') Exprn[pos] = ReMul;
-               if (Expr[j+s] == '+') Exprn[pos] = RePlus;
-               if (Expr[j+s] == '?') Exprn[pos] = ReQuest;
-               if (Expr[j+s] == '|') Exprn[pos] = ReOr;
-       };
-       if (EnterGr || EnterBr || EnterFg) return false;
-
-       Info->Op = ReBrackets;
-       Info->un.Param = new SRegInfo;
-       Info->s = CurMatch++;
-
-       if (!SetStructs(Info->un.Param,0,pos)) return false;
-       Optimize();
-       delete Exprn;
-       return true;
-};
-
-void PosRegExp::Optimize() {
-       PRegInfo Next = Info;
-       FirstChar = 0;
-       while(Next) {
-               if (Next->Op == ReBrackets || Next->Op == RePlus  || Next->Op == ReNGPlus) {
-                       Next = Next->un.Param;
-                       continue;
-               };
-               if (Next->Op == ReSymb) {
-                       if (Next->un.Symb & 0xFF00 &&  Next->un.Symb != ReSoL && Next->un.Symb != ReWBound)
-                               break;
-                       FirstChar = Next->un.Symb;
-                       break;
-               };
-               break;
-       };
-};
-
-bool PosRegExp::SetStructs(PRegInfo &re,int start,int end) {
-       PRegInfo Next,Prev,Prev2;
-       int comma,st,en,ng,i, j,k;
-       int EnterBr;
-       bool Add;
-
-       if (end - start < 0) return false;
-       Next = re;
-       for (i = start; i < end; i++) {
-               Add = false;
-               // Ops
-               if (Exprn[i] > ReBlockOps && Exprn[i] < ReSymbolOps) {
-                       Next->un.Param = 0;
-                       Next->Op = (EOps)Exprn[i];
-                       Add = true;
-               };
-               // {n,m}
-               if (Exprn[i] == ReRangeS) {
-                       st = i;
-                       en = -1;
-                       comma = -1;
-                       ng = 0;
-                       for (j = i;j < end;j++) {
-                               if (Exprn[j] == ReNGRangeE) {
-                                       en = j;
-                                       ng = 1;
-                                       break;
-                               };
-                               if (Exprn[j] == ReRangeE) {
-                                       en = j;
-                                       break;
-                               };
-                               if ((char)Exprn[j] == ',')
-                                       comma = j;
-                       };
-                       if (en == -1) return false;
-                       if (comma == -1) comma = en;
-                       Next->s = (char)GetNumber(Exprn,st+1,comma);
-                       if (comma != en)
-                               Next->e = (char)GetNumber(Exprn,comma+1,en);
-                       else
-                               Next->e = Next->s;
-                       Next->un.Param = 0;
-                       Next->Op = ng?ReNGRangeNM:ReRangeNM;
-                       if (en-comma == 1) {
-                               Next->e = -1;
-                               Next->Op = ng?ReNGRangeN:ReRangeN;
-                       };
-                       i=j;
-                       Add = true;
-               };
-               // [] [^]
-               if (Exprn[i] == ReEnumS || Exprn[i] == ReNEnumS) {
-                       Next->Op = (Exprn[i] == ReEnumS)?ReEnum:ReNEnum;
-                       for (j = i+1;j < end;j++) {
-                               if (Exprn[j] == ReEnumE)
-                                       break;
-                       };
-                       if (j == end) return false;
-                       Next->un.ChrClass = new SCharData;
-                       memset(Next->un.ChrClass, 0, 32);
-                       for (j = i+1;Exprn[j] != ReEnumE;j++) {
-                               if (Exprn[j+1] == ReFrToEnum) {
-                                       for (i = (Exprn[j]&0xFF); i < (Exprn[j+2]&0xFF);i++)
-                                               Next->un.ChrClass->SetBit(i&0xFF);
-                                       j++;
-                                       continue;
-                               };
-                               switch(Exprn[j]) {
-                               case ReDigit:
-                                       for (k = 0x30;k < 0x40;k++)
-                                               if (IsDigit((char)k))
-                                                       Next->un.ChrClass->SetBit(k);
-                                       break;
-                               case ReNDigit:
-                                       for (k = 0x30;k < 0x40;k++)
-                                               if (!IsDigit((char)k))
-                                                       Next->un.ChrClass->SetBit(k);
-                                       Next->un.ChrClass->ClearBit(0x0a);
-                                       Next->un.ChrClass->ClearBit(0x0d);
-                                       break;
-                               case ReWordSymb:
-                                       for (k = 0;k < 256;k++)
-                                               if (IsWord((char)k))
-                                                       Next->un.ChrClass->SetBit(k);
-                                       break;
-                               case ReNWordSymb:
-                                       for (k = 0;k < 256;k++)
-                                               if (!IsWord((char)k))
-                                                       Next->un.ChrClass->SetBit(k);
-                                       Next->un.ChrClass->ClearBit(0x0a);
-                                       Next->un.ChrClass->ClearBit(0x0d);
-                                       break;
-                               case ReWSpace:
-                                       Next->un.ChrClass->SetBit(0x20);
-                                       Next->un.ChrClass->SetBit(0x09);
-                                       break;
-                               case ReNWSpace:
-                                       memset(Next->un.ChrClass->IArr, 0xFF, 32);
-                                       Next->un.ChrClass->ClearBit(0x20);
-                                       Next->un.ChrClass->ClearBit(0x09);
-                                       Next->un.ChrClass->ClearBit(0x0a);
-                                       Next->un.ChrClass->ClearBit(0x0d);
-                                       break;
-                               default:
-                                       if (!(Exprn[j]&0xFF00))
-                                               Next->un.ChrClass->SetBit(Exprn[j]&0xFF);
-                                       break;
-                               };
-                       };
-                       Add = true;
-                       i=j;
-               };
-               // ( ... )
-               if (Exprn[i] == ReLBrack) {
-                       EnterBr = 1;
-                       for (j = i+1;j < end;j++) {
-                               if (Exprn[j] == ReLBrack) EnterBr++;
-                               if (Exprn[j] == ReRBrack) EnterBr--;
-                               if (!EnterBr) break;
-                       };
-                       if (EnterBr) return false;
-                       Next->Op = ReBrackets;
-                       Next->un.Param = new SRegInfo;
-                       Next->un.Param->Parent = Next;
-                       Next->s = CurMatch++;
-                       if (CurMatch > MatchesNum) CurMatch = MatchesNum;
-                       if (!SetStructs(Next->un.Param,i+1,j)) return false;
-                       Add = true;
-                       i=j;
-               };
-               if ((Exprn[i]&0xFF00) == ReBkTrace) {
-                       Next->Op = ReBkTrace;
-                       Next->un.Symb = Exprn[i]&0xFF;
-                       Add = true;
-               };
-               if ((Exprn[i]&0xFF00) == ReBkBrack) {
-                       Next->Op = ReBkBrack;
-                       Next->un.Symb = Exprn[i]&0xFF;
-                       Add = true;
-               };
-               if ((Exprn[i]&0xFF00) == ReBehind) {
-                       Next->Op = ReBehind;
-                       Next->s = Exprn[i]&0xFF;
-                       Add = true;
-               };
-               if ((Exprn[i]&0xFF00) == ReNBehind) {
-                       Next->Op = ReNBehind;
-                       Next->s = Exprn[i]&0xFF;
-                       Add = true;
-               };
-               // Chars
-               if (Exprn[i] >= ReAnyChr && Exprn[i] < ReTemp || Exprn[i] < 0x100) {
-                       Next->Op = ReSymb;
-                       Next->un.Symb = Exprn[i];
-                       Add = true;
-               };
-               // Next
-               if (Add && i != end-1) {
-                       Next->Next = new SRegInfo;
-                       Next->Next->Parent = Next->Parent;
-                       Next = Next->Next;
-               };
-       };
-       Next = re;
-       Prev = Prev2 = 0;
-       while(Next) {
-               if (Next->Op > ReBlockOps && Next->Op < ReSymbolOps) {
-                       if (!Prev) return false;
-                       if (!Prev2) re = Next;
-                       else Prev2->Next = Next;
-                       //if (Prev->Op > ReBlockOps && Prev->Op < ReSymbolOps) return false;
-                       Prev->Parent = Next;
-                       Prev->Next = 0;
-                       Next->un.Param = Prev;
-                       Prev = Prev2;
-               };
-               Prev2 = Prev;
-               Prev = Next;
-               Next = Next->Next;
-       };
-
-       return true;
-};
-
-/////////////////////////////////////////////////////////////////
-/////////////////////////  Parsing  /////////////////////////////
-/////////////////////////////////////////////////////////////////
-
-bool PosRegExp::CheckSymb(int Symb,bool Inc) {
-       bool Res;
-       char ch;
-       switch(Symb) {
-       case ReAnyChr:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = ch != '\r' && ch != '\n';
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReSoL:
-               if (posStart == posParse)
-                       return true;
-               ch = CharAt(posParse-1,param);
-               return ch == '\n' || ch == '\r';
-       case ReEoL:
-               if (posEnd == posParse)
-                       return true;
-               ch = CharAt(posParse,param);
-               return ch == '\n' || ch == '\r';
-       case ReDigit:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = (ch >= 0x30 && ch <= 0x39);
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReNDigit:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = !(ch >= 0x30 && ch <= 0x39) && ch != '\r' && ch != '\n';
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReWordSymb:
-               if (posParse >= posEnd) return false;
-               Res = IsWord(CharAt(posParse,param));
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReNWordSymb:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = !IsWord(ch) && ch != '\r' && ch != '\n';
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReWSpace:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = (ch == 0x20 || ch == '\t');
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReNWSpace:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = !(ch == 0x20 || ch == '\t') && ch != '\r' && ch != '\n';
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReUCase:
-               if (posParse >= posEnd) return false;
-               Res = IsUpperCase(CharAt(posParse,param));
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReNUCase:
-               if (posParse >= posEnd) return false;
-               Res = IsLowerCase(CharAt(posParse,param));
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReWBound:
-               if (posParse >= posEnd) return true;
-               ch = CharAt(posParse,param);
-               return IsWord(CharAt(posParse,param)) && (posParse == posStart || !IsWord(CharAt(posParse-1,param)));
-       case ReNWBound:
-               if (posParse >= posEnd) return true;
-               return !IsWord(CharAt(posParse,param)) && IsWord(CharAt(posParse-1,param));
-       case RePreNW:
-               if (posParse >= posEnd) return true;
-               return (posParse == posStart || !IsWord(CharAt(posParse-1,param)));
-       case ReStart:
-               Matches->s[0] = (posParse-posStart);
-               return true;
-       case ReEnd:
-               Matches->e[0] = (posParse-posStart);
-               return true;
-       default:
-               if ((Symb & 0xFF00) || posParse >= posEnd) return false;
-               if (NoCase) {
-                       if (LowCase(CharAt(posParse,param)) != LowCase((char)Symb&0xFF)) return false;
-               } else
-                       if (CharAt(posParse,param) != (char)(Symb&0xFF)) return false;
-               if (Inc) posParse++;
-               return true;
-       };
-}
-
-bool PosRegExp::LowParseRe(PRegInfo &Next) {
-       PRegInfo OrNext;
-       int i,match,sv;
-       int posStr;
-
-       switch(Next->Op) {
-       case ReSymb:
-               if (!CheckSymb(Next->un.Symb,true)) return false;
-               break;
-       case ReEmpty:
-               break;
-       case ReBkTrace:
-               if (!posBkStr | !BkTrace) return false;
-               sv = Next->un.Symb;
-               posStr = posParse;
-               for (i = BkTrace->s[sv]; i < BkTrace->e[sv]; i++) {
-                       if (CharAt(posStr,param) != CharAt(posBkStr+i,param) || posEnd == posStr) return false;
-                       posStr++;
-               };
-               posParse = posStr;
-               break;
-       case ReBkBrack:
-               sv = Next->un.Symb;
-               posStr = posParse;
-               if (Matches->s[sv] == -1 || Matches->e[sv] == -1) return false;
-               for (i = Matches->s[sv]; i < Matches->e[sv]; i++) {
-                       if (CharAt(posStr,param) != CharAt(posStart+i,param) || posEnd == posStr) return false;
-                       posStr++;
-               };
-               posParse = posStr;
-               break;
-       case ReBehind:
-               sv = Next->s;
-               posStr = posParse;
-               posParse -= sv;
-               if (!LowParse(Next->un.Param)) return false;
-               posParse = posStr;
-               break;
-       case ReNBehind:
-               sv = Next->s;
-               posStr = posParse;
-               posParse -= sv;
-               if (LowParse(Next->un.Param)) return false;
-               posParse = posStr;
-               break;
-       case ReAhead:
-               posStr = posParse;
-               if (!LowParse(Next->un.Param)) return false;
-               posParse = posStr;
-               break;
-       case ReNAhead:
-               posStr = posParse;
-               if (LowParse(Next->un.Param)) return false;
-               posParse = posStr;
-               break;
-       case ReEnum:
-               if (posParse >= posEnd) return false;
-               if (!Next->un.ChrClass->GetBit(CharAt(posParse,param))) return false;
-               posParse++;
-               break;
-       case ReNEnum:
-               if (posParse >= posEnd) return false;
-               if (Next->un.ChrClass->GetBit(CharAt(posParse,param))) return false;
-               posParse++;
-               break;
-       case ReBrackets:
-               match = Next->s;
-               sv = posParse-posStart;
-               posStr = posParse;
-               if (LowParse(Next->un.Param)) {
-                       if (match || (Matches->s[match] == -1))
-                               Matches->s[match] = sv;
-                       if (match || (Matches->e[match] == -1))
-                               Matches->e[match] = posParse-posStart;
-                       return true;
-               };
-               posParse = posStr;
-               return false;
-       case ReMul:
-               posStr = posParse;
-               while (LowParse(Next->un.Param));
-               while(!LowCheckNext(Next) && posStr < posParse) posParse--;
-               break;
-       case ReNGMul:
-               do {
-                       if (LowCheckNext(Next)) break;
-               } while (LowParse(Next->un.Param));
-               break;
-       case RePlus:
-               posStr = posParse;
-               match = false;
-               while (LowParse(Next->un.Param))
-                       match = true;
-               if (!match) return false;
-               while(!LowCheckNext(Next) && posStr < posParse) posParse--;
-               break;
-       case ReNGPlus:
-               if (!LowParse(Next->un.Param)) return false;
-               do {
-                       if (LowCheckNext(Next)) break;
-               } while (LowParse(Next->un.Param));
-               break;
-       case ReQuest:
-               LowParse(Next->un.Param);
-               break;
-       case ReNGQuest:
-               if (LowCheckNext(Next)) break;
-               if (!LowParse(Next->un.Param)) return false;
-               break;
-       case ReOr:
-               OrNext = Next;
-               // posStr = posParse;
-               if (LowParse(Next->un.Param)) {
-                       while (OrNext && OrNext->Op == ReOr)
-                               OrNext = OrNext->Next;
-                       /*if (!LowCheckNext(OrNext)){
-                         posParse = posStr;
-                         OrNext = Next;
-               };*/
-               };
-               Next = OrNext;
-               break;
-       case ReRangeN:
-               posStr = posParse;
-               i = 0;
-               while (LowParse(Next->un.Param)) i++; // ???
-               do {
-                       if (i < Next->s) {
-                               posParse = posStr;
-                               return false;
-                       };
-                       i--;
-               } while(!LowCheckNext(Next) && posStr < posParse--);
-               break;
-       case ReNGRangeN:
-               posStr = posParse;
-               i = 0;
-               while (LowParse(Next->un.Param)) {
-                       i++;
-                       if (i >= Next->s && LowCheckNext(Next)) // ???
-                               break;
-               };
-               if (i < Next->s) {
-                       posParse = posStr;
-                       return false;
-               };
-               break;
-       case ReRangeNM:
-               posStr = posParse;
-               i = 0;
-               while (i < Next->s && LowParse(Next->un.Param)) // ???
-                       i++;
-               if (i < Next->s) {
-                       posParse = posStr;
-                       return false;
-               };
-               while (i < Next->e && LowParse(Next->un.Param)) // ???
-                       i++;
-
-               while(!LowCheckNext(Next)) {
-                       i--;
-                       posParse--;
-                       if (i < Next->s) {
-                               posParse = posStr;
-                               return false;
-                       };
-               };
-               break;
-       case ReNGRangeNM:
-               posStr = posParse;
-               i = 0;
-               while (i < Next->s && LowParse(Next->un.Param)) // ???
-                       i++;
-               if (i < Next->s) {
-                       posParse = posStr;
-                       return false;
-               };
-               while(!LowCheckNext(Next)) {
-                       i++;
-                       if (!LowParse(Next->un.Param) || i > Next->e) { // ???
-                               posParse = posStr;
-                               return false;
-                       };
-               };
-               break;
-       };
-       return true;
-};
-
-bool PosRegExp::LowCheckNext(PRegInfo Re) {
-       PRegInfo Next;
-       int tmp = posParse;
-       Next = Re;
-       do {
-               if (Next && Next->Op == ReOr)
-                       while (Next && Next->Op == ReOr)
-                               Next = Next->Next;
-               if (Next->Next && !LowParse(Next->Next)) {
-                       posParse = tmp;
-                       Ok = false;
-                       return false;
-               };
-               Next = Next->Parent;
-       } while(Next);
-       posParse = tmp;
-       if (Ok != false) Ok = true;
-       return true;
-};
-
-bool PosRegExp::LowParse(PRegInfo Re) {
-       while(Re && posParse <= posEnd) {
-               if (!LowParseRe(Re)) return false;
-               if (Re) Re = Re->Next;
-       };
-       return true;
-};
-
-bool PosRegExp::QuickCheck() {
-       if (!NoMoves || !FirstChar)
-               return true;
-       switch(FirstChar) {
-       case ReSoL:
-               if (posParse != posStart) return false;
-               return true;
-       case ReWBound:
-               return IsWord(CharAt(posParse,param)) && (posParse == posStart || !IsWord(CharAt(posParse-1,param)));
-       default:
-               if (NoCase && LowCase(CharAt(posParse,param)) != LowCase(FirstChar)) return false;
-               if (!NoCase && CharAt(posParse,param) != (char)FirstChar) return false;
-               return true;
-       };
-};
-
-bool PosRegExp::ParseRe(int posStr) {
-       if (Error) return false;
-
-       posParse = posStr;
-       if (!QuickCheck()) return false;
-
-       for (int i = 0; i < MatchesNum; i++)
-               Matches->s[i] = Matches->e[i] = -1;
-       Matches->CurMatch = CurMatch;
-
-       Ok = -1;
-       //try{
-       do {
-               if (!LowParse(Info)) {
-                       if (NoMoves) return false;
-               } else
-                       return true;
-               posParse = ++posStr;
-       } while(posParse != posEnd+1);
-       return false;
-       //}__except(){
-       //  return true;
-       //};
-}
-;
-
-bool PosRegExp::Parse(int posStr,int posSol, int posEol, PMatches Mtch, int Moves) {
-       if (!this) return false;
-
-       bool s = NoMoves;
-       if (Moves != -1) NoMoves = Moves!=0;
-       posStart = posSol;
-       posEnd   = posEol;
-       Matches = Mtch;
-       bool r = ParseRe(posStr);
-       NoMoves = s;
-       return r;
-};
-
-bool PosRegExp::Parse(int posStr, int posStop, PMatches Mtch) {
-       if (!this) return false;
-       posStart = posStr;
-       posEnd = posStop;
-       Matches = Mtch;
-       return ParseRe(posStr);
-};
-
-bool PosRegExp::SetNoMoves(bool Moves) {
-       NoMoves = Moves;
-       return true;
-};
-
-bool PosRegExp::SetBkTrace(int posStr,PMatches Trace) {
-       BkTrace = Trace;
-       posBkStr = posStr;
-       return true;
-};
-
-#define EVAL_MATCHES 16
-#define EVAL_CHUNKSIZE 256
-
-#define EVAL_LOWERCASE 1
-#define EVAL_UPPERCASE 2
-#define EVAL_LOWERCASE_NEXT 4
-#define EVAL_UPPERCASE_NEXT 8
-
-bool PosRegExp::Evaluate(char *Expr, int posStr, PMatches Mtch, char **Res) {
-       int length,
-       newlength,
-       chunklength,
-       value,
-       size,
-       src,
-       end;
-       unsigned flag;
-       char ch,
-       *dest,
-       *pool;
-
-       size = EVAL_CHUNKSIZE;
-       pool = (char*) malloc (size);
-       dest = pool;
-       length = 0;
-       flag = 0;
-       while (*Expr) {
-               switch (ch = *Expr++) {
-               case '\\':
-                       switch (ch = *Expr++) {
-                       case 'A':
-                       case 'B':
-                       case 'C':
-                       case 'D':
-                       case 'E':
-                       case 'F':
-                               ch -= ('A' - '0');
-                       case '0':
-                       case '1':
-                       case '2':
-                       case '3':
-                       case '4':
-                       case '5':
-                       case '6':
-                       case '7':
-                       case '8':
-                       case '9':
-                               value = ch - '0';
-                               if (Mtch->s[value] != -1 && value < EVAL_MATCHES) {
-                                       chunklength = Mtch->e[value] - Mtch->s[value];
-                                       if (chunklength) {
-                                               newlength = chunklength + length;
-                                               if (newlength > size) {
-                                                       do
-                                                               size += EVAL_CHUNKSIZE;
-                                                       while (size < newlength);
-                                                       pool = (char*) realloc (pool, size);
-                                                       dest = pool + length;
-                                               }
-                                               length = newlength;
-                                               src = posStr + Mtch->s[value];
-                                               end = posStr + Mtch->e[value];
-                                               if (flag & EVAL_UPPERCASE) {
-                                                       if (flag & EVAL_LOWERCASE_NEXT) {
-                                                               *dest++ = tolower (CharAt(src++,param));
-                                                               flag &= ~EVAL_LOWERCASE_NEXT;
-                                                       }
-                                                       while (src < end)
-                                                               *dest++ = toupper (CharAt(src++,param));
-                                               } else if (flag & EVAL_LOWERCASE) {
-                                                       if (flag & EVAL_UPPERCASE_NEXT) {
-                                                               *dest++ = toupper (CharAt(src++,param));
-                                                               flag &= ~EVAL_UPPERCASE_NEXT;
-                                                       }
-                                                       while (src < end)
-                                                               *dest++ = tolower (CharAt(src++,param));
-                                               } else {
-                                                       if (flag & EVAL_LOWERCASE_NEXT) {
-                                                               *dest++ = tolower (CharAt(src++,param));
-                                                               flag &= ~EVAL_LOWERCASE_NEXT;
-                                                       } else if (flag & EVAL_UPPERCASE_NEXT) {
-                                                               *dest++ = toupper (CharAt(src++,param));
-                                                               flag &= ~EVAL_UPPERCASE_NEXT;
-                                                       }
-                                                       while (src < end)
-                                                               *dest++ = CharAt(src++,param);
-                                               }
-                                       }
-                               } else
-                                       goto error;
-                               continue;
-                       case '\0':
-                               goto error;
-                       case 'r':
-                               ch = '\r';
-                               break;
-                       case 'n':
-                               ch = '\n';
-                               break;
-                       case 'b':
-                               ch = '\b';
-                               break;
-                       case 'a':
-                               ch = '\a';
-                               break;
-                       case 't':
-                               ch = '\t';
-                               break;
-                       case 'U':
-                               flag |= EVAL_UPPERCASE;
-                               continue;
-                       case 'u':
-                               flag |= EVAL_UPPERCASE_NEXT;
-                               continue;
-                       case 'L':
-                               flag |= EVAL_LOWERCASE;
-                               continue;
-                       case 'l':
-                               flag |= EVAL_LOWERCASE_NEXT;
-                               continue;
-                       case 'Q':
-                       case 'q':
-                               flag &= ~(EVAL_UPPERCASE | EVAL_LOWERCASE);
-                               continue;
-                       case 'x':
-                               {
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               value = value + '0' - 'A' + 10;
-                                       if (value > 15)
-                                               goto error;
-                                       ch = value << 4;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               value = value + '0' - 'A' + 10;
-                                       if (value > 15)
-                                               goto error;
-                                       Expr++;
-                                       ch |= value;
-                                       break;
-                               }
-                       case 'd':
-                               {
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch = value * 100;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch += value * 10;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch += value;
-                                       Expr++;
-                                       break;
-                               }
-                       case 'o':
-                               {
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch = value << 6;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch += value << 3;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch |= value;
-                                       Expr++;
-                                       /* break; */
-                               }
-                               /* default:
-                                       break; */
-                       }
-               default:
-                       if (++length > size) {
-                               do
-                                       size += EVAL_CHUNKSIZE;
-                               while (size < length);
-                               pool = (char*) realloc (pool, size);
-                               dest = pool + length - 1;
-                       }
-                       if (flag & EVAL_LOWERCASE_NEXT) {
-                               *dest++ = tolower (ch);
-                               flag &= ~EVAL_LOWERCASE_NEXT;
-                       } else if (flag & EVAL_UPPERCASE_NEXT) {
-                               *dest++ = toupper (ch);
-                               flag &= ~EVAL_UPPERCASE_NEXT;
-                       } else if (flag & EVAL_UPPERCASE)
-                               *dest++ = toupper (ch);
-                       else if (flag & EVAL_LOWERCASE)
-                               *dest++ = tolower (ch);
-                       else
-                               *dest++ = ch;
-               }
-       }
-       if (++length > size) {
-               do
-                       size += EVAL_CHUNKSIZE;
-               while (size < length);
-               pool = (char*) realloc (pool, size);
-               dest = pool + length - 1;
-       }
-       *dest = '\0';
-       *Res = pool;
-       return true;
-error:
-       free (pool);
-       return false;
-}
index a58d143164faea4b6a010e54f3c5028bdec17d31..701b2a82c75aa9f2c164b935ab6589c49ec7cf0b 100644 (file)
@@ -1,6 +1,8 @@
 // SciTE - Scintilla based Text Editor
-// PropSet.cxx - a java style properties file module
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file PropSet.cxx
+ ** A Java style properties file module.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Maintain a dictionary of properties
 
 #include "PropSet.h"
 
-bool EqualCaseInsensitive(const char *a, const char *b) {
-#if PLAT_GTK
-       return 0 == strcasecmp(a, b);
-#elif PLAT_WIN
-       return 0 == stricmp(a, b);
-#elif PLAT_WX
-       return 0 == wxStricmp(a, b);
-#endif
-}
-
-SString::size_type SString::npos = -1;
-
-inline unsigned int HashString(const char *s) {
-    unsigned int ret = 0;
-    while (*s) {
-        ret <<= 4;
-        ret ^= *s;
-        s++;
-    }
-    return ret;
-}
-
-// Get a line of input. If end of line escaped with '\\' then continue reading.
-static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
-       bool continuation = true;
-       s[0] = '\0';
-       while ((len > 1) && lenData > 0) {
-               char ch = *fpc;
-               fpc++;
-               lenData--;
-               if ((ch == '\r') || (ch == '\n')) {
-                       if (!continuation) {
-                               if ((lenData > 0) && (ch == '\r') && ((*fpc) == '\n')) {
-                                       // munch the second half of a crlf
-                                       fpc++;
-                                       lenData--;
-                               }
-                               *s = '\0';
-                               return true;
-                       }
-               } else if ((ch == '\\') && (lenData > 0) && ((*fpc == '\r') || (*fpc == '\n'))) {
-                       continuation = true;
-               } else {
-                       continuation = false;
-                       *s++ = ch;
-                       *s = '\0';
-                       len--;
+// The comparison and case changing functions here assume ASCII
+// or extended ASCII such as the normal Windows code page.
+
+static inline char MakeUpperCase(char ch) {
+       if (ch < 'a' || ch > 'z')
+               return ch;
+       else
+               return static_cast<char>(ch - 'a' + 'A');
+}
+
+int CompareCaseInsensitive(const char *a, const char *b) {
+       while (*a && *b) {
+               if (*a != *b) {
+                       char upperA = MakeUpperCase(*a);
+                       char upperB = MakeUpperCase(*b);
+                       if (upperA != upperB)
+                               return upperA - upperB;
                }
+               a++;
+               b++;
        }
-       return false;
+       // Either *a or *b is nul
+       return *a - *b;
+}
+
+int CompareNCaseInsensitive(const char *a, const char *b, int len) {
+       while (*a && *b && len) {
+               if (*a != *b) {
+                       char upperA = MakeUpperCase(*a);
+                       char upperB = MakeUpperCase(*b);
+                       if (upperA != upperB)
+                               return upperA - upperB;
+               }
+               a++;
+               b++;
+               len--;
+       }
+       if (len == 0)
+               return 0;
+       else
+               // Either *a or *b is nul
+               return *a - *b;
+}
+
+bool EqualCaseInsensitive(const char *a, const char *b) {
+       return 0 == CompareCaseInsensitive(a, b);
+}
+
+inline unsigned int HashString(const char *s, int len) {
+       unsigned int ret = 0;
+       while (len--) {
+               ret <<= 4;
+               ret ^= *s;
+               s++;
+       }
+       return ret;
 }
 
 PropSet::PropSet() {
        superPS = 0;
-    for (int root=0; root < hashRoots; root++)
-        props[root] = 0;
+       for (int root = 0; root < hashRoots; root++)
+               props[root] = 0;
 }
 
 PropSet::~PropSet() {
@@ -77,45 +85,66 @@ PropSet::~PropSet() {
        Clear();
 }
 
-void PropSet::Set(const char *key, const char *val) {
-    unsigned int hash = HashString(key);
-       for (Property *p=props[hash % hashRoots]; p; p=p->next) {
-               if ((hash == p->hash) && (0 == strcmp(p->key, key))) {
+void PropSet::Set(const char *key, const char *val, int lenKey, int lenVal) {
+       if (!*key)      // Empty keys are not supported
+               return;
+       if (lenKey == -1)
+               lenKey = strlen(key);
+       if (lenVal == -1)
+               lenVal = strlen(val);
+       unsigned int hash = HashString(key, lenKey);
+       for (Property *p = props[hash % hashRoots]; p; p = p->next) {
+               if ((hash == p->hash) && 
+                       ((strlen(p->key) == static_cast<unsigned int>(lenKey)) && 
+                               (0 == strncmp(p->key, key, lenKey)))) {
                        // Replace current value
                        delete [](p->val);
-                       p->val = StringDup(val);
-                       return;
+                       p->val = StringDup(val, lenVal);
+                       return ;
                }
        }
        // Not found
-    Property *pNew = new Property;
-    if (pNew) {
-        pNew->hash = HashString(key);
-           pNew->key = StringDup(key);
-           pNew->val = StringDup(val);
-           pNew->next = props[hash % hashRoots];
-        props[hash % hashRoots] = pNew;
-    }
+       Property *pNew = new Property;
+       if (pNew) {
+               pNew->hash = hash;
+               pNew->key = StringDup(key, lenKey);
+               pNew->val = StringDup(val, lenVal);
+               pNew->next = props[hash % hashRoots];
+               props[hash % hashRoots] = pNew;
+       }
 }
 
-void PropSet::Set(char *keyval) {
-    while (isspace(*keyval))
-        keyval++;
-       char *eqat = strchr(keyval, '=');
-       if (eqat) {
-               *eqat = '\0';
-               Set(keyval, eqat + 1);
-               *eqat = '=';
+void PropSet::Set(const char *keyVal) {
+       while (isspace(*keyVal))
+               keyVal++;
+       const char *endVal = keyVal;
+       while (*endVal && (*endVal != '\n'))
+               endVal++;
+       const char *eqAt = strchr(keyVal, '=');
+       if (eqAt) {
+               Set(keyVal, eqAt + 1, eqAt-keyVal, endVal - eqAt - 1);
+       } else if (*keyVal) {   // No '=' so assume '=1'
+               Set(keyVal, "1", endVal-keyVal, 1);
        }
 }
 
+void PropSet::SetMultiple(const char *s) {
+       const char *eol = strchr(s, '\n');
+       while (eol) {
+               Set(s);
+               s = eol + 1;
+               eol = strchr(s, '\n');
+       }
+       Set(s);
+}
+
 SString PropSet::Get(const char *key) {
-    unsigned int hash = HashString(key);
-       for (Property *p=props[hash % hashRoots]; p; p=p->next) {
+       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))) {
-            return p->val;
-        }
-    }
+                       return p->val;
+               }
+       }
        if (superPS) {
                // Failed here, so try in base property set
                return superPS->Get(key);
@@ -124,19 +153,35 @@ SString PropSet::Get(const char *key) {
        }
 }
 
+static bool 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;
+}
+
 SString PropSet::GetExpanded(const char *key) {
-    SString val = Get(key);
-    return Expand(val.c_str());
+       SString val = Get(key);
+       if (IncludesVar(val.c_str(), key))
+               return val;
+       return Expand(val.c_str());
 }
 
-SString PropSet::Expand(const char *withvars) {
-       char *base = StringDup(withvars);
+SString PropSet::Expand(const char *withVars) {
+       char *base = StringDup(withVars);
        char *cpvar = strstr(base, "$(");
        while (cpvar) {
                char *cpendvar = strchr(cpvar, ')');
                if (cpendvar) {
                        int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
-                       char *var = StringDup(cpvar+2, lenvar);
+                       char *var = StringDup(cpvar + 2, lenvar);
                        SString val = GetExpanded(var);
                        int newlenbase = strlen(base) + val.length() - lenvar;
                        char *newbase = new char[newlenbase];
@@ -155,14 +200,13 @@ SString PropSet::Expand(const char *withvars) {
 }
 
 int PropSet::GetInt(const char *key, int defaultValue) {
-       SString val = Get(key);
+       SString val = GetExpanded(key);
        if (val.length())
                return val.value();
-       else
-               return defaultValue;
+       return defaultValue;
 }
 
-inline bool isprefix(const char *target, const char *prefix) {
+bool isprefix(const char *target, const char *prefix) {
        while (*target && *prefix) {
                if (*target != *prefix)
                        return false;
@@ -175,69 +219,70 @@ inline bool isprefix(const char *target, const char *prefix) {
                return true;
 }
 
-bool issuffix(const char *target, const char *suffix) {
+static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) {
        int lentarget = strlen(target);
        int lensuffix = strlen(suffix);
        if (lensuffix > lentarget)
                return false;
        for (int i = lensuffix - 1; i >= 0; i--) {
-               if (target[i + lentarget - lensuffix] != suffix[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 = Get(orgkeyfile + 2);
-                                           *cpendvar= ')';
-                                           keyfile = strdup(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)) {
-                                                   *del = delchr;
-                                                   free(keyptr);
-                                                   return p->val;
-                                           }
-                                   } else if (0 == strcmp(keyfile, filename)) {
-                                           *del = delchr;
-                                           free(keyptr);
-                                           return p->val;
-                                   }
-                                   if (delchr == '\0')
-                                           break;
-                                   *del = delchr;
-                                   keyfile = del + 1;
-                           }
-                           free(keyptr);
-
-                           if (0 == strcmp(p->key, keybase)) {
-                                   return p->val;
-                           }
-                   }
-           }
-    }
+       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 (IsSuffixCaseInsensitive(filename, keyfile + 1)) {
+                                                       *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);
@@ -246,6 +291,8 @@ SString PropSet::GetWild(const char *keybase, const char *filename) {
        }
 }
 
+// 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, "$(");
@@ -253,7 +300,7 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
                char *cpendvar = strchr(cpvar, ')');
                if (cpendvar) {
                        int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
-                       char *var = StringDup(cpvar+2, lenvar);
+                       char *var = StringDup(cpvar + 2, lenvar);
                        SString val = GetWild(var, filename);
                        int newlenbase = strlen(base) + val.length() - lenvar;
                        char *newbase = new char[newlenbase];
@@ -272,57 +319,92 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
 }
 
 void PropSet::Clear() {
-    for (int root=0; root < hashRoots; root++) {
-        Property *p=props[root];
-           while (p) {
-            Property *pNext=p->next;
-                   p->hash = 0;
-                   delete p->key;
-                   p->key = 0;
-                   delete p->val;
-                   p->val = 0;
-            delete p;
-            p = pNext;
-        }
-        props[root] = 0;
-    }
-}
-
-void PropSet::ReadFromMemory(const char *data, int len, const char *directoryForImports) {
-       const char *pd = data;
-       char linebuf[60000];
-       bool ifIsTrue = true;
-       while (len > 0) {
-               GetFullLine(pd, len, linebuf, sizeof(linebuf));
-               if (isalpha(linebuf[0]))    // If clause ends with first non-indented line
-                       ifIsTrue = true;
-               if (isprefix(linebuf, "if ")) {
-                       const char *expr = linebuf + strlen("if") + 1;
-                       ifIsTrue = GetInt(expr);
-               } else if (isprefix(linebuf, "import ") && directoryForImports) {
-                       char importPath[1024];
-                       strcpy(importPath, directoryForImports);
-                       strcat(importPath, linebuf + strlen("import") + 1);
-                       strcat(importPath, ".properties");
-                       Read(importPath,directoryForImports);
-               } else if (isalpha(linebuf[0])) {
-                       Set(linebuf);
-               } else if (isspace(linebuf[0]) && ifIsTrue) {
-                       Set(linebuf);
+       for (int root = 0; root < hashRoots; root++) {
+               Property *p = props[root];
+               while (p) {
+                       Property *pNext = p->next;
+                       p->hash = 0;
+                       delete p->key;
+                       p->key = 0;
+                       delete p->val;
+                       p->val = 0;
+                       delete p;
+                       p = pNext;
                }
+               props[root] = 0;
        }
 }
 
-void PropSet::Read(const char *filename, const char *directoryForImports) {
-       char propsData[60000];
-       FILE *rcfile = fopen(filename, "rb");
-       if (rcfile) {
-               int lenFile = fread(propsData, 1, sizeof(propsData), rcfile);
-               fclose(rcfile);
-               ReadFromMemory(propsData, lenFile, directoryForImports);
-       } else {
-               //printf("Could not open <%s>\n", filename);
+char *PropSet::ToString() {
+       unsigned int len=0;
+       for (int r = 0; r < hashRoots; r++) {
+               for (Property *p = props[r]; p; p = p->next) {
+                       len += strlen(p->key) + 1;
+                       len += strlen(p->val) + 1;
+               }
+       }
+       if (len == 0)
+               len = 1;        // Return as empty string
+       char *ret = new char [len];
+       if (ret) {
+               char *w = ret;
+               for (int root = 0; root < hashRoots; root++) {
+                       for (Property *p = props[root]; p; p = p->next) {
+                               strcpy(w, p->key);
+                               w += strlen(p->key);
+                               *w++ = '=';
+                               strcpy(w, p->val);
+                               w += strlen(p->val);
+                               *w++ = '\n';
+                       }
+               }
+               ret[len-1] = '\0';
+       }
+       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;
 }
 
 static bool iswordsep(char ch, bool onlyLineEnds) {
@@ -333,10 +415,11 @@ static bool iswordsep(char ch, bool onlyLineEnds) {
        return ch == '\r' || ch == '\n';
 }
 
-// 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.
+ */
 static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) {
-#if 1
        char prev = '\n';
        int words = 0;
        for (int j = 0; wordlist[j]; j++) {
@@ -365,50 +448,14 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
        } else {
                *len = 0;
        }
-#else
-       int words = 0; // length of the returned buffer of pointers
-       #undef APICHUNK // how many pointers will be pre-allocated (to avoid buffer reallocation on each new pointer)
-       #define APICHUNK 256
-       int size = APICHUNK; // real size of the returned buffer of pointers
-       char **keywords; // buffer for the pointers returned
-       int slen = strlen(wordlist); //length of the buffer with api file
-       keywords = (char**) malloc((size + 1) * sizeof (*keywords));
-       words = 0;
-       for (int k = 0;;) {
-               while (iswordsep(wordlist[k], onlyLineEnds))
-                       wordlist[k++] = '\0';
-               if (k >= slen)
-                       break;
-               if (words >= size) {
-                       do
-                               size += APICHUNK;
-                       while (size <= words);
-                       keywords = (char**) realloc(keywords, (size + 1) * sizeof (*keywords));
-               }
-               keywords[words++] = wordlist + k;
-               do
-                       if (k < slen)
-                               k++;
-                       else
-                               goto out;
-               while (!iswordsep(wordlist[k], onlyLineEnds));
-       }
-out:
-       keywords[words] = wordlist + slen;
-       *len = words;
-#endif
        return keywords;
 }
 
 void WordList::Clear() {
        if (words) {
                delete []list;
-#if 1
-        delete []words;
-#else
-               free(words);
-#endif
-               free(wordsNoCase);
+               delete []words;
+               delete []wordsNoCase;
        }
        words = 0;
        wordsNoCase = 0;
@@ -421,7 +468,7 @@ void WordList::Set(const char *s) {
        list = StringDup(s);
        sorted = false;
        words = ArrayFromWordList(list, &len, onlyLineEnds);
-       wordsNoCase = (char**) malloc ((len + 1) * sizeof (*wordsNoCase));
+       wordsNoCase = new char * [len + 1];
        memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
 }
 
@@ -434,27 +481,27 @@ char *WordList::Allocate(int size) {
 void WordList::SetFromAllocated() {
        sorted = false;
        words = ArrayFromWordList(list, &len, onlyLineEnds);
-       wordsNoCase = (char**) malloc ((len + 1) * sizeof (*wordsNoCase));
+       wordsNoCase = new char * [len + 1];
        memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
 }
 
 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 strcasecmp(*(char**)(a1), *(char**)(a2));
+       // Can't work out the correct incantation to use modern casts here
+       return CompareCaseInsensitive(*(char**)(a1), *(char**)(a2));
 }
 
 static void SortWordList(char **words, char **wordsNoCase, unsigned int len) {
        qsort(reinterpret_cast<void*>(words), len, sizeof(*words),
-               cmpString);
+             cmpString);
        qsort(reinterpret_cast<void*>(wordsNoCase), len, sizeof(*wordsNoCase),
-               cmpStringNoCase);
+             cmpStringNoCase);
 }
+
 bool WordList::InList(const char *s) {
        if (0 == words)
                return false;
@@ -485,13 +532,28 @@ bool WordList::InList(const char *s) {
                        j++;
                }
        }
+       j = starts['^'];
+       if (j >= 0) {
+               while (words[j][0] == '^') {
+                       const char *a = words[j] + 1;
+                       const char *b = s;
+                       while (*a && *a == *b) {
+                               a++;
+                               b++;
+                       }
+                       if (!*a)
+                               return true;
+                       j++;
+               }
+       }
        return false;
 }
 
 /**
- * Returns an element (complete) of the wordlist array which has the beginning
- * the same as the passed string. The length of the word to compare is passed
- * too. Letter case can be ignored or preserved (default).
+ * 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 /*= -1*/, bool ignoreCase /*= false*/) {
        int start = 0; // lower bound of the api array block to search
@@ -506,57 +568,84 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1
                sorted = true;
                SortWordList(words, wordsNoCase, len);
        }
-       if (ignoreCase)
+       if (ignoreCase) {
                while (start <= end) { // binary searching loop
                        pivot = (start + end) >> 1;
                        word = wordsNoCase[pivot];
-                       cond = strncasecmp(wordStart, word, searchLen);
+                       cond = CompareNCaseInsensitive(wordStart, word, searchLen);
                        if (!cond && nonFuncChar(word[searchLen])) // maybe there should be a "non-word character" test here?
                                return word; // result must not be freed with free()
-                       else if (cond < 0)
-                               end = pivot - 1;
                        else if (cond > 0)
                                start = pivot + 1;
+                       else if (cond <= 0)
+                               end = pivot - 1;
                }
-       else // preserve the letter case
+       } else { // preserve the letter case
                while (start <= end) { // binary searching loop
                        pivot = (start + end) >> 1;
                        word = words[pivot];
                        cond = strncmp(wordStart, word, searchLen);
                        if (!cond && nonFuncChar(word[searchLen])) // maybe there should be a "non-word character" test here?
                                return word; // result must not be freed with free()
-                       else if (cond >= 0)
+                       else if (cond > 0)
                                start = pivot + 1;
-                       else if (cond < 0)
+                       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:" 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 '(', or ':'. If that fails go to the end of the string.
+       const char *endWord = strchr(word, '(');
+       if (!endWord)
+               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 '(', ':', or '\0'
+               // Move backwards over any spaces
+               while ((endWord > word) && (isspace(*endWord))) {
+                       endWord--;
+               }
+       }
+       return endWord - word;
+}
+
 /**
  * Returns elements (first words of them) of the wordlist array which have
- * the beginning the same as the passed string. The length of the word to
- * compare is passed too. Letter case can be ignored or preserved (default).
+ * 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 a free() call.
+ * NOTE: returned buffer has to be freed with delete[].
  */
-char *WordList::GetNearestWords(const char *wordStart, int searchLen /*= -1*/, bool ignoreCase /*= false*/) {
+char *WordList::GetNearestWords(
+    const char *wordStart,
+    int searchLen /*= -1*/,
+    bool ignoreCase /*= false*/,
+    char otherSeparator /*= '\0'*/) {
        int wordlen; // length of the word part (before the '(' brace) of the api array element
-       int length = 0; // length of the returned buffer of words (string)
-       int newlength; // length of the new buffer before the reallocating itself
-       #undef WORDCHUNK // how many characters will be pre-allocated (to avoid buffer reallocation on each new word)
-       #define WORDCHUNK 100
-       int size = WORDCHUNK; // real size of the returned buffer of words
-       char *buffer; // buffer for the words returned
+       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)
-       int oldpivot; // pivot storage to be able to browse the api array upwards and then downwards
-       const char *word; // api array element just being compared
-       const char *brace; // position of the opening brace in the api array element just being compared
 
        if (0 == words)
                return NULL;
@@ -564,179 +653,58 @@ char *WordList::GetNearestWords(const char *wordStart, int searchLen /*= -1*/, b
                sorted = true;
                SortWordList(words, wordsNoCase, len);
        }
-       buffer = (char*) malloc(size);
-       *buffer = '\0';
-       if (ignoreCase)
-               while (start <= end) { // binary searching loop
-                       pivot = (start + end) >> 1;
-                       word = wordsNoCase[pivot];
-                       cond = strncasecmp(wordStart, word, searchLen);
+       if (ignoreCase) {
+               while (start <= end) { // Binary searching loop
+                       pivot = (start + end) / 2;
+                       cond = CompareNCaseInsensitive(wordStart, wordsNoCase[pivot], searchLen);
                        if (!cond) {
-                               oldpivot = pivot;
-                               do { // browse sequentially the rest after the hit
-                                       brace = strchr(word, '(');
-                                       if (brace)
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       else {
-                                               brace = word + strlen(word);
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       }
-                                       wordlen = brace - word + 1;
-                                       newlength = length + wordlen; // stretch the buffer
-                                       if (length)
-                                               newlength++;
-                                       if (newlength >= size) {
-                                               do
-                                                       size += WORDCHUNK;
-                                               while (size <= newlength);
-                                               buffer = (char*) realloc(buffer, size);
-                                       }
-                                       if (length) // append a new entry
-                                               buffer[length++] = ' ';
-                                       memcpy(buffer + length, word, wordlen);
-                                       length = newlength;
-                                       buffer[length] = '\0';
-                                       if (++pivot > end)
-                                               break;
-                                       word = wordsNoCase[pivot];
-                               } while (!strncasecmp(wordStart, word, searchLen));
-
-                               pivot = oldpivot;
-                               for (;;) { // browse sequentially the rest before the hit
-                                       if (--pivot < start)
-                                               break;
-                                       word = wordsNoCase[pivot];
-                                       if (strncasecmp(wordStart, word, searchLen))
-                                               break;                 
-                                       brace = strchr(word, '(');
-                                       if (brace)
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       else {
-                                               brace = word + strlen(word);
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       }
-                                       wordlen = brace - word + 1;
-                                       newlength = length + wordlen; // stretch the buffer
-                                       if (length)
-                                               newlength++;
-                                       if (newlength >= size)
-                                       {
-                                               do
-                                                       size += WORDCHUNK;
-                                               while (size <= newlength);
-                                               buffer = (char*) realloc(buffer, size);
-                                       }
-                                       if (length) // append a new entry
-                                               buffer[length++] = ' ';
-                                       memcpy(buffer + length, word, wordlen);
-                                       length = newlength;
-                                       buffer[length] = '\0';
+                               // Find first match
+                               while ((pivot > start) &&
+                                       (0 == CompareNCaseInsensitive(wordStart, 
+                                               wordsNoCase[pivot-1], searchLen))) {
+                                       --pivot;
                                }
-                               return buffer; // result has to be freed with free()
-                       }
-                       else if (cond < 0)
+                               // Grab each match
+                               while ((pivot <= end) &&
+                                       (0 == CompareNCaseInsensitive(wordStart, 
+                                               wordsNoCase[pivot], searchLen))) {
+                                       wordlen = LengthWord(wordsNoCase[pivot], otherSeparator) + 1;
+                                       wordsNear.append(wordsNoCase[pivot], wordlen, ' ');
+                                       ++pivot;
+                               }
+                               return wordsNear.detach();
+                       } else if (cond < 0) {
                                end = pivot - 1;
-                       else if (cond > 0)
+                       } else if (cond > 0) {
                                start = pivot + 1;
+                       }
                }
-       else // preserve the letter case
-               while (start <= end) { // binary searching loop
-                       pivot = (start + end) >> 1;
-                       word = words[pivot];
-                       cond = strncmp(wordStart, word, searchLen);
+       } else {        // Preserve the letter case
+               while (start <= end) { // Binary searching loop
+                       pivot = (start + end) / 2;
+                       cond = strncmp(wordStart, words[pivot], searchLen);
                        if (!cond) {
-                               oldpivot = pivot;
-                               do { // browse sequentially the rest after the hit
-                                       brace = strchr(word, '(');
-                                       if (brace)
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       else {
-                                               brace = word + strlen(word);
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       }
-                                       wordlen = brace - word + 1;
-                                       newlength = length + wordlen; // stretch the buffer
-                                       if (length)
-                                               newlength++;
-                                       if (newlength >= size)
-                                       {
-                                               do
-                                                       size += WORDCHUNK;
-                                               while (size <= newlength);
-                                               buffer = (char*) realloc(buffer, size);
-                                       }
-                                       if (length) // append a new entry
-                                               buffer[length++] = ' ';
-                                       memcpy(buffer + length, word, wordlen);
-                                       length = newlength;
-                                       buffer[length] = '\0';
-                                       if (++pivot > end)
-                                               break;
-                                       word = words[pivot];
-                               } while (!strncmp(wordStart, word, searchLen));
-
-                               pivot = oldpivot;
-                               for (;;) { // browse sequentially the rest before the hit
-                                       if (--pivot < start)
-                                               break;
-                                       word = words[pivot];
-                                       if (strncmp(wordStart, word, searchLen))
-                                               break;
-                                       brace = strchr(word, '(');
-                                       if (brace)
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       else {
-                                               brace = word + strlen(word);
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       }
-                                       wordlen = brace - word + 1;
-                                       newlength = length + wordlen; // stretch the buffer
-                                       if (length)
-                                               newlength++;
-                                       if (newlength >= size)
-                                       {
-                                               do
-                                                       size += WORDCHUNK;
-                                               while (size <= newlength);
-                                               buffer = (char*) realloc(buffer, size);
-                                       }
-                                       if (length) // append a new entry
-                                               buffer[length++] = ' ';
-                                       memcpy(buffer + length, word, wordlen);
-                                       length = newlength;
-                                       buffer[length] = '\0';
+                               // Find first match
+                               while ((pivot > start) &&
+                                       (0 == strncmp(wordStart, 
+                                               words[pivot-1], searchLen))) { 
+                                       --pivot;
                                }
-                               return buffer; // result has to be freed with free()
-                       }
-                       else if (cond < 0)
+                               // Grab each match
+                               while ((pivot <= end) &&
+                                       (0 == strncmp(wordStart, 
+                                               words[pivot], searchLen))) { 
+                                       wordlen = LengthWord(words[pivot], otherSeparator) + 1;
+                                       wordsNear.append(words[pivot], wordlen, ' ');
+                                       ++pivot;
+                               }
+                               return wordsNear.detach();
+                       } else if (cond < 0) {
                                end = pivot - 1;
-                       else if (cond > 0)
+                       } else if (cond > 0) {
                                start = pivot + 1;
+                       }
                }
-       free(buffer);
+       }
        return NULL;
 }
diff --git a/contrib/src/stc/scintilla/src/RESearch.cxx b/contrib/src/stc/scintilla/src/RESearch.cxx
new file mode 100644 (file)
index 0000000..07534db
--- /dev/null
@@ -0,0 +1,865 @@
+// Scintilla source code edit control
+/** @file RESearch.cxx
+ ** Regular expression search library.
+ **/
+
+/*
+ * regex - Regular expression pattern matching  and replacement
+ *
+ * By:  Ozan S. Yigit (oz)
+ *      Dept. of Computer Science
+ *      York University
+ *
+ * Original code available from http://www.cs.yorku.ca/~oz/ 
+ * Translation to C++ by Neil Hodgson neilh@scintilla.org
+ * Removed all use of register.
+ * Converted to modern function prototypes.
+ * Put all global/static variables into an object so this code can be 
+ * used from multiple threads etc.
+ *
+ * These routines are the PUBLIC DOMAIN equivalents of regex
+ * routines as found in 4.nBSD UN*X, with minor extensions.
+ *
+ * These routines are derived from various implementations found
+ * in software tools books, and Conroy's grep. They are NOT derived
+ * from licensed/restricted software.
+ * For more interesting/academic/complicated implementations,
+ * see Henry Spencer's regexp routines, or GNU Emacs pattern
+ * matching module.
+ *
+ * Modification history:
+ *
+ * $Log$
+ * Revision 1.1  2001/09/01 03:05:24  RD
+ * Upgraded to version 1.39 of Scintilla, and upated wxStyledTextCtrl
+ * accordingly.
+ *
+ * Revision 1.6  2001/04/29 13:32:10  nyamatongwe
+ * Addition of new target methods - versions of ReplaceTarget that take counted
+ * strings to allow for nulls, SearchInTarget and Get/SetSearchFlags to use a
+ * series of calls rather than a structure.
+ * Handling of \000 in search and replace.
+ * Handling of /escapes within character ranges of regular expressions.
+ * Some handling of bare ^ and $ regular expressions.
+ *
+ * Revision 1.5  2001/04/20 07:36:09  nyamatongwe
+ * Removed DEBUG code that failed to compile on GTK+.
+ *
+ * Revision 1.4  2001/04/13 03:52:13  nyamatongwe
+ * Added URL to find original code to comments.
+ *
+ * Revision 1.3  2001/04/06 12:24:21  nyamatongwe
+ * Made regular expression searching work on a line by line basis, made ^ and
+ * $ work, made [set] work, and added a case insensitive option.
+ *
+ * Revision 1.2  2001/04/05 01:58:04  nyamatongwe
+ * Replace target functionality to make find and replace operations faster
+ * by diminishing screen updates and allow for \d patterns in the replacement
+ * text.
+ *
+ * Revision 1.1  2001/04/04 12:52:44  nyamatongwe
+ * Moved to public domain regular expresion implementation.
+ *
+ * Revision 1.4  1991/10/17  03:56:42  oz
+ * miscellaneous changes, small cleanups etc.
+ *
+ * Revision 1.3  1989/04/01  14:18:09  oz
+ * Change all references to a dfa: this is actually an nfa.
+ *
+ * Revision 1.2  88/08/28  15:36:04  oz
+ * Use a complement bitmap to represent NCL.
+ * This removes the need to have seperate 
+ * code in the PMatch case block - it is 
+ * just CCL code now.
+ * 
+ * Use the actual CCL code in the CLO
+ * section of PMatch. No need for a recursive
+ * PMatch call.
+ * 
+ * Use a bitmap table to set char bits in an
+ * 8-bit chunk.
+ * 
+ * Interfaces:
+ *      RESearch::Compile:        compile a regular expression into a NFA.
+ *
+ *                     char *RESearch::Compile(s)
+ *                     char *s;
+ *
+ *      RESearch::Execute:        execute the NFA to match a pattern.
+ *
+ *                     int RESearch::Execute(s)
+ *                     char *s;
+ *
+ *     RESearch::ModifyWord            change RESearch::Execute's understanding of what a "word"
+ *                     looks like (for \< and \>) by adding into the
+ *                     hidden word-syntax table.
+ *
+ *                     void RESearch::ModifyWord(s)
+ *                     char *s;
+ *
+ *      RESearch::Substitute:  substitute the matched portions in a new string.
+ *
+ *                     int RESearch::Substitute(src, dst)
+ *                     char *src;
+ *                     char *dst;
+ *
+ *     re_fail:        failure routine for RESearch::Execute.
+ *
+ *                     void re_fail(msg, op)
+ *                     char *msg;
+ *                     char op;
+ *  
+ * Regular Expressions:
+ *
+ *      [1]     char    matches itself, unless it is a special
+ *                      character (metachar): . \ [ ] * + ^ $
+ *
+ *      [2]     .       matches any character.
+ *
+ *      [3]     \       matches the character following it, except
+ *                     when followed by a left or right round bracket,
+ *                     a digit 1 to 9 or a left or right angle bracket. 
+ *                     (see [7], [8] and [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.
+ *
+ *      [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 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.
+ *                      examples:        match:
+ *
+ *                              [a-z]    any lowercase alpha
+ *
+ *                              [^]-]    any char except ] and -
+ *
+ *                              [^A-Z]   any char except uppercase
+ *                                       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.
+ *
+ *      [6]     +       same as [5], except it matches one or more.
+ *
+ *      [7]             a regular expression in the form [1] to [10], enclosed
+ *                      as \(form\) matches what form matches. The enclosure
+ *                      creates a set of tags, used for [8] and for
+ *                      pattern substution. The tagged forms are numbered
+ *                     starting from 1.
+ *
+ *      [8]             a \ followed by a digit 1 to 9 matches whatever a
+ *                      previously tagged regular expression ([7]) matched.
+ *
+ *     [9]     \<      a regular expression starting with a \< construct
+ *             \>      and/or ending with a \> construct, restricts the
+ *                     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
+ *                     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
+ *                      match of x followed by a match for y.
+ *
+ *      [11]   ^       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
+ *                     pattern, ^ and $ are treated as ordinary characters.
+ *
+ *
+ * Acknowledgements:
+ *
+ *     HCR's Hugh Redelmeier has been most helpful in various
+ *     stages of development. He convinced me to include BOW
+ *     and EOW constructs, originally invented by Rob Pike at
+ *     the University of Toronto.
+ *
+ * References:
+ *              Software tools                 Kernighan & Plauger
+ *              Software tools in Pascal        Kernighan & Plauger
+ *              Grep [rsx-11 C dist]            David Conroy
+ *             ed - text editor                Un*x Programmer's Manual
+ *             Advanced editing on Un*x        B. W. Kernighan
+ *             RegExp routines                 Henry Spencer
+ *
+ * Notes:
+ *
+ *     This implementation uses a bit-set representation for character
+ *     classes for speed and compactness. Each character is represented 
+ *     by one bit in a 128-bit block. Thus, CCL always takes a 
+ *     constant 16 bytes in the internal nfa, and RESearch::Execute does a single
+ *     bit comparison to locate the character in the set.
+ *
+ * Examples:
+ *
+ *     pattern:        foo*.*
+ *     compile:        CHR f CHR o CLO CHR o END CLO ANY END END
+ *     matches:        fo foo fooo foobar fobar foxx ...
+ *
+ *     pattern:        fo[ob]a[rz]     
+ *     compile:        CHR f CHR o CCL bitset CHR a CCL bitset END
+ *     matches:        fobar fooar fobaz fooaz
+ *
+ *     pattern:        foo\\+
+ *     compile:        CHR f CHR o CHR o CHR \ CLO CHR \ END END
+ *     matches:        foo\ foo\\ foo\\\  ...
+ *
+ *     pattern:        \(foo\)[1-3]\1  (same as foo[1-3]foo)
+ *     compile:        BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
+ *     matches:        foo1foo foo2foo foo3foo
+ *
+ *     pattern:        \(fo.*\)-\1
+ *     compile:        BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
+ *     matches:        foo-foo fo-fo fob-fob foobar-foobar ...
+ */
+
+#include "RESearch.h"
+
+#define OKP     1
+#define NOP     0
+
+#define CHR     1
+#define ANY     2
+#define CCL     3
+#define BOL     4
+#define EOL     5
+#define BOT     6
+#define EOT     7
+#define BOW    8
+#define EOW    9
+#define REF     10
+#define CLO     11
+
+#define END     0
+
+/*
+ * The following defines are not meant to be changeable.
+ * They are for readability only.
+ */
+#define BLKIND 0170
+#define BITIND 07
+
+#define ASCIIB 0177
+
+const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
+
+#define badpat(x)      (*nfa = END, x)
+RESearch::RESearch() {
+       Init();
+}
+
+RESearch::~RESearch() {
+       Clear();
+}
+
+void RESearch::Init() {
+       sta = NOP;                      /* status of lastpat */
+       bol = 0;
+       for (int i=0; i<MAXTAG; i++)
+               pat[i] = 0;
+       for (int j=0; j<BITBLK; j++)
+               bittab[j] = 0;
+}
+
+void RESearch::Clear() {
+       for (int i=0; i<MAXTAG; i++) {
+               delete []pat[i];
+               pat[i] = 0;
+               bopat[i] = NOTFOUND;
+               eopat[i] = NOTFOUND;
+       }
+}
+
+bool RESearch::GrabMatches(CharacterIndexer &ci) {
+       bool success = true;
+       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]) {
+                               for (unsigned int j=0; j<len; j++)
+                                       pat[i][j] = ci.CharAt(bopat[i] + j);
+                               pat[i][len] = '\0';
+                       } else {
+                               success = false;
+                       }
+               }
+       }
+       return success;
+}
+
+void RESearch::ChSet(char c) {
+       bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND];
+}
+
+void RESearch::ChSetWithCase(char c, bool caseSensitive) {
+       if (caseSensitive) {
+               ChSet(c);
+       } else {
+               if ((c >= 'a') && (c <= 'z')) {
+                       ChSet(c);
+                       ChSet(static_cast<char>(c - 'a' + 'A'));
+               } else if ((c >= 'A') && (c <= 'Z')) {
+                       ChSet(c);
+                       ChSet(static_cast<char>(c - 'A' + 'a'));
+               } else {
+                       ChSet(c);
+               }
+       }
+}
+
+const char escapeValue(char ch) {
+       switch (ch) {
+       case 'a':       return '\a';
+       case 'b':       return '\b';
+       case 'f':       return '\f';
+       case 'n':       return '\n';
+       case 'r':       return '\r';
+       case 't':       return '\t';
+       case 'v':       return '\v';
+       }
+       return 0;
+}
+
+const char *RESearch::Compile(const char *pat, int length, bool caseSensitive) {
+       char *mp=nfa;          /* nfa pointer       */
+       char *lp;              /* saved pointer..   */
+       char *sp=nfa;          /* another one..     */
+
+       int tagi = 0;          /* tag stack index   */
+       int tagc = 1;          /* actual tag count  */
+
+       int n;
+       char mask;              /* xor mask -CCL/NCL */
+       int c1, c2;
+               
+       if (!pat || !length)
+               if (sta)
+                       return 0;
+               else
+                       return badpat("No previous regular expression");
+       sta = NOP;
+
+       const char *p=pat;               /* pattern pointer   */
+       for (int i=0; i<length; i++, p++) {
+               lp = mp;
+               switch(*p) {
+
+               case '.':               /* match any char..  */
+                       *mp++ = ANY;
+                       break;
+
+               case '^':               /* match beginning.. */
+                       if (p == pat)
+                               *mp++ = BOL;
+                       else {
+                               *mp++ = CHR;
+                               *mp++ = *p;
+                       }
+                       break;
+
+               case '$':               /* match endofline.. */
+                       if (!*(p+1))
+                               *mp++ = EOL;
+                       else {
+                               *mp++ = CHR;
+                               *mp++ = *p;
+                       }
+                       break;
+
+               case '[':               /* match char class..*/
+                       *mp++ = CCL;
+
+                       i++;
+                       if (*++p == '^') {
+                               mask = '\377';  
+                               i++;
+                               p++;
+                       } else
+                               mask = 0;
+
+                       if (*p == '-') {                /* real dash */
+                               i++;
+                               ChSet(*p++);
+                       }
+                       if (*p == ']') {        /* real brace */
+                               i++;
+                               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);
+                                       }
+                               } else if (*p == '\\' && *(p+1)) {
+                                       i++;
+                                       p++;
+                                       char escape = escapeValue(*p);
+                                       if (escape)
+                                               ChSetWithCase(escape, caseSensitive);
+                                       else
+                                               ChSetWithCase(*p, caseSensitive);
+                                       i++;
+                                       p++;
+                               } else {
+                                       i++;
+                                       ChSetWithCase(*p++, caseSensitive);
+                               }
+                       }
+                       if (!*p)
+                               return badpat("Missing ]");
+
+                       for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
+                               *mp++ = static_cast<char>(mask ^ bittab[n]);
+       
+                       break;
+
+               case '*':               /* match 0 or more.. */
+               case '+':               /* match 1 or more.. */
+                       if (p == pat)
+                               return badpat("Empty closure");
+                       lp = sp;                /* previous opcode */
+                       if (*lp == CLO)         /* equivalence..   */
+                               break;
+                       switch(*lp) {
+
+                       case BOL:
+                       case BOT:
+                       case EOT:
+                       case BOW:
+                       case EOW:
+                       case REF:
+                               return badpat("Illegal closure");
+                       default:
+                               break;
+                       }
+
+                       if (*p == '+')
+                               for (sp = mp; lp < sp; lp++)
+                                       *mp++ = *lp;
+
+                       *mp++ = END;
+                       *mp++ = END;
+                       sp = mp;
+                       while (--mp > lp)
+                               *mp = mp[-1];
+                       *mp = CLO;
+                       mp = sp;
+                       break;
+
+               case '\\':              /* tags, backrefs .. */
+                       i++;
+                       switch(*++p) {
+
+                       case '(':
+                               if (tagc < MAXTAG) {
+                                       tagstk[++tagi] = tagc;
+                                       *mp++ = BOT;
+                                       *mp++ = static_cast<char>(tagc++);
+                               }
+                               else
+                                       return badpat("Too many \\(\\) pairs");
+                               break;
+                       case ')':
+                               if (*sp == BOT)
+                                       return badpat("Null pattern inside \\(\\)");
+                               if (tagi > 0) {
+                                       *mp++ = static_cast<char>(EOT);
+                                       *mp++ = static_cast<char>(tagstk[tagi--]);
+                               }
+                               else
+                                       return badpat("Unmatched \\)");
+                               break;
+                       case '<':
+                               *mp++ = BOW;
+                               break;
+                       case '>':
+                               if (*sp == BOW)
+                                       return badpat("Null pattern inside \\<\\>");
+                               *mp++ = EOW;
+                               break;
+                       case '1':
+                       case '2':
+                       case '3':
+                       case '4':
+                       case '5':
+                       case '6':
+                       case '7':
+                       case '8':
+                       case '9':
+                               n = *p-'0';
+                               if (tagi > 0 && tagstk[tagi] == n)
+                                       return badpat("Cyclical reference");
+                               if (tagc > n) {
+                                       *mp++ = static_cast<char>(REF);
+                                       *mp++ = static_cast<char>(n);
+                               }
+                               else
+                                       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:
+                               *mp++ = CHR;
+                               *mp++ = *p;
+                       }
+                       break;
+
+               default :               /* an ordinary char  */
+                       if (caseSensitive) {
+                               *mp++ = CHR;
+                               *mp++ = *p;
+                       } else {
+                               *mp++ = CCL;
+                               mask = 0;
+                               ChSetWithCase(*p, false);
+                               for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
+                                       *mp++ = static_cast<char>(mask ^ bittab[n]);
+                       }
+                       break;
+               }
+               sp = lp;
+       }
+       if (tagi > 0)
+               return badpat("Unmatched \\(");
+       *mp = END;
+       sta = OKP;
+       return 0;
+}
+
+/*
+ * RESearch::Execute:
+ *     execute nfa to find a match.
+ *
+ *     special cases: (nfa[0]) 
+ *             BOL
+ *                     Match only once, starting from the
+ *                     beginning.
+ *             CHR
+ *                     First locate the character without
+ *                     calling PMatch, and if found, call
+ *                     PMatch for the remaining string.
+ *             END
+ *                     RESearch::Compile failed, poor luser did not
+ *                     check for it. Fail fast.
+ *
+ *     If a match is found, bopat[0] and eopat[0] are set
+ *     to the beginning and the end of the matched fragment,
+ *     respectively.
+ *
+ */
+
+int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
+       char c;
+       int ep = NOTFOUND;
+       char *ap = nfa;
+
+       bol = lp;
+       failure = 0;
+       
+       Clear();
+
+       switch(*ap) {
+
+       case BOL:                       /* anchored: match from BOL only */
+               ep = PMatch(ci, lp, endp, ap);
+               break;
+       case EOL:                       /* just searching for end of line normal path doesn't work */
+               if (*(ap+1) == END) {
+                       lp = endp;
+                       ep = lp;
+                       break;
+               } else {
+                       return 0;
+               }
+       case CHR:                       /* ordinary char: locate it fast */
+               c = *(ap+1);
+               while ((lp < endp) && (ci.CharAt(lp) != c))
+                       lp++;
+               if (lp >= endp)         /* if EOS, fail, else fall thru. */
+                       return 0;
+       default:                        /* regular matching all the way. */
+               while (lp < endp) {
+                       ep = PMatch(ci, lp, endp, ap);
+                       if (ep != NOTFOUND)
+                               break;
+                       lp++;
+               }
+               break;
+       case END:                       /* munged automaton. fail always */
+               return 0;
+       }
+       if (ep == NOTFOUND)
+               return 0;
+
+       bopat[0] = lp;
+       eopat[0] = ep;
+       return 1;
+}
+
+/* 
+ * PMatch: internal routine for the hard part
+ *
+ *     This code is partly snarfed from an early grep written by
+ *     David Conroy. The backref and tag stuff, and various other
+ *     innovations are by oz.
+ *
+ *     special case optimizations: (nfa[n], nfa[n+1])
+ *             CLO ANY
+ *                     We KNOW .* will match everything upto the
+ *                     end of line. Thus, directly go to the end of
+ *                     line, without recursive PMatch calls. As in
+ *                     the other closure cases, the remaining pattern
+ *                     must be matched by moving backwards on the
+ *                     string recursively, to find a match for xy
+ *                     (x is ".*" and y is the remaining pattern)
+ *                     where the match satisfies the LONGEST match for
+ *                     x followed by a match for y.
+ *             CLO CHR
+ *                     We can again scan the string forward for the
+ *                     single char and at the point of failure, we
+ *                     execute the remaining nfa recursively, same as
+ *                     above.
+ *
+ *     At the end of a successful match, bopat[n] and eopat[n]
+ *     are set to the beginning and end of subpatterns matched
+ *     by tagged expressions (n = 1 to 9).     
+ *
+ */
+
+extern void re_fail(char *,char);
+
+/*
+ * character classification table for word boundary operators BOW
+ * and EOW. the reason for not using ctype macros is that we can
+ * let the user add into our own table. see RESearch::ModifyWord. This table
+ * is not in the bitset form, since we may wish to extend it in the
+ * future for other character classifications. 
+ *
+ *     TRUE for 0-9 A-Z a-z _
+ */
+static char chrtyp[MAXCHR] = {
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 
+       0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+       1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+       1, 1, 1, 0, 0, 0, 0, 0
+       };
+
+#define inascii(x)     (0177&(x))
+#define iswordc(x)     chrtyp[inascii(x)]
+#define isinset(x,y)   ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
+
+/*
+ * skip values for CLO XXX to skip past the closure
+ */
+
+#define ANYSKIP        2       /* [CLO] ANY END ...         */
+#define CHRSKIP        3       /* [CLO] CHR chr END ...     */
+#define CCLSKIP 18     /* [CLO] CCL 16bytes END ... */
+
+int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
+       int op, c, n;
+       int e;          /* extra pointer for CLO */
+       int bp;         /* beginning of subpat.. */
+       int ep;         /* ending of subpat..    */
+       int are;                        /* to save the line ptr. */
+
+       while ((op = *ap++) != END)
+               switch(op) {
+
+               case CHR:
+                       if (ci.CharAt(lp++) != *ap++)
+                               return NOTFOUND;
+                       break;
+               case ANY:
+                       if (lp++ >= endp)
+                               return NOTFOUND;
+                       break;
+               case CCL:
+                       c = ci.CharAt(lp++);
+                       if (!isinset(ap,c))
+                               return NOTFOUND;
+                       ap += BITBLK;
+                       break;
+               case BOL:
+                       if (lp != bol)
+                               return NOTFOUND;
+                       break;
+               case EOL:
+                       if (lp < endp)
+                               return NOTFOUND;
+                       break;
+               case BOT:
+                       bopat[*ap++] = lp;
+                       break;
+               case EOT:
+                       eopat[*ap++] = lp;
+                       break;
+               case BOW:
+                       if (lp!=bol && iswordc(ci.CharAt(lp-1)) || !iswordc(ci.CharAt(lp)))
+                               return NOTFOUND;
+                       break;
+               case EOW:
+                       if (lp==bol || !iswordc(ci.CharAt(lp-1)) || iswordc(ci.CharAt(lp)))
+                               return NOTFOUND;
+                       break;
+               case REF:
+                       n = *ap++;
+                       bp = bopat[n];
+                       ep = eopat[n];
+                       while (bp < ep)
+                               if (ci.CharAt(bp++) != ci.CharAt(lp++))
+                                       return NOTFOUND;
+                       break;
+               case CLO:
+                       are = lp;
+                       switch(*ap) {
+
+                       case ANY:
+                               while (lp < endp)
+                                       lp++;
+                               n = ANYSKIP;
+                               break;
+                       case CHR:
+                               c = *(ap+1);
+                               while ((lp < endp) && (c == ci.CharAt(lp)))
+                                       lp++;
+                               n = CHRSKIP;
+                               break;
+                       case CCL:
+                               while ((lp < endp) && isinset(ap+1,ci.CharAt(lp)))
+                                       lp++;
+                               n = CCLSKIP;
+                               break;
+                       default:
+                               failure = true;
+                               //re_fail("closure: bad nfa.", *ap);
+                               return NOTFOUND;
+                       }
+
+                       ap += n;
+
+                       while (lp >= are) {
+                               if ((e = PMatch(ci, lp, endp, ap)) != NOTFOUND)
+                                       return e;
+                               --lp;
+                       }
+                       return NOTFOUND;
+               default:
+                       //re_fail("RESearch::Execute: bad nfa.", static_cast<char>(op));
+                       return NOTFOUND;
+               }
+       return lp;
+}
+
+/*
+ * RESearch::ModifyWord:
+ *     add new characters into the word table to change RESearch::Execute's
+ *     understanding of what a word should look like. Note that we
+ *     only accept additions into the word definition.
+ *
+ *     If the string parameter is 0 or null string, the table is
+ *     reset back to the default containing A-Z a-z 0-9 _. [We use
+ *     the compact bitset representation for the default table]
+ */
+
+static char deftab[16] = {     
+       0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',  
+       '\376', '\377', '\377', 007 
+}; 
+
+void RESearch::ModifyWord(char *s) {
+       int i;
+
+       if (!s || !*s) {
+               for (i = 0; i < MAXCHR; i++)
+                       if (!isinset(deftab,i))
+                               iswordc(i) = 0;
+       }
+       else
+               while(*s)
+                       iswordc(*s++) = 1;
+}
+
+/*
+ * RESearch::Substitute:
+ *     substitute the matched portions of the src in dst.
+ *
+ *     &       substitute the entire matched pattern.
+ *
+ *     \digit  substitute a subpattern, with the given tag number.
+ *             Tags are numbered from 1 to 9. If the particular
+ *             tagged subpattern does not exist, null is substituted.
+ */
+int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
+       char c;
+       int  pin;
+       int bp;
+       int ep;
+
+       if (!*src || !bopat[0])
+               return 0;
+
+       while ((c = *src++) != 0) {
+               switch(c) {
+
+               case '&':
+                       pin = 0;
+                       break;
+
+               case '\\':
+                       c = *src++;
+                       if (c >= '0' && c <= '9') {
+                               pin = c - '0';
+                               break;
+                       }
+                       
+               default:
+                       *dst++ = c;
+                       continue;
+               }
+
+               if ((bp = bopat[pin]) != 0 && (ep = eopat[pin]) != 0) {
+                       while (ci.CharAt(bp) && bp < ep)
+                               *dst++ = ci.CharAt(bp++);
+                       if (bp < ep)
+                               return 0;
+               }
+       }
+       *dst = (char) 0;
+       return 1;
+}
diff --git a/contrib/src/stc/scintilla/src/RESearch.h b/contrib/src/stc/scintilla/src/RESearch.h
new file mode 100644 (file)
index 0000000..28238bf
--- /dev/null
@@ -0,0 +1,60 @@
+// Scintilla source code edit control
+/** @file RESearch.h
+ ** Interface to the regular expression search library.
+ **/
+// Written by Neil Hodgson <neilh@scintilla.org>
+// Based on the work of Ozan S. Yigit.
+// This file is in the public domain.
+
+#ifndef RESEARCH_H
+#define RESEARCH_H
+
+/*
+ * The following defines are not meant to be changeable.
+ * They are for readability only.
+ */
+#define MAXCHR 128
+#define CHRBIT 8
+#define BITBLK MAXCHR/CHRBIT
+
+class CharacterIndexer {
+public: 
+       virtual char CharAt(int index)=0;
+};
+
+class RESearch {
+
+public:
+       RESearch();
+       ~RESearch();
+       void Init();
+       void Clear();
+       bool GrabMatches(CharacterIndexer &ci);
+       void ChSet(char c);
+       void ChSetWithCase(char c, bool caseSensitive);
+       const char *Compile(const char *pat, int length, bool caseSensitive);
+       int Execute(CharacterIndexer &ci, int lp, int endp);
+       void ModifyWord(char *s);
+       int Substitute(CharacterIndexer &ci, char *src, char *dst);
+
+       enum {MAXTAG=10};
+       enum {MAXNFA=2048};
+       enum {NOTFOUND=-1};
+
+       int bopat[MAXTAG];
+       int eopat[MAXTAG];
+       char *pat[MAXTAG];
+
+private:
+       int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
+
+       int bol;
+       int  tagstk[MAXTAG];             /* subpat tag stack..*/
+       char nfa[MAXNFA];               /* automaton..       */
+       int sta;
+       char bittab[BITBLK];            /* bit table for CCL */
+                                               /* pre-set bits...   */
+       int failure;
+};
+
+#endif
index d4d49c717d6f30f876513281f2f7d1480a690888..c8edb513bc3fdca89e6ef43f7341ee4a73f5ed13 100644 (file)
@@ -1,26 +1,31 @@
 // Scintilla source code edit control
-// SVector.h - a simple expandable vector
-// Copyright 1998-1999 by Neil Hodgson <neilh@hare.net.au>
+/** @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.
-
+/**
+ * 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 {
-       int *v;
-       unsigned int size;      // Number of elements allocated
-       unsigned int len;       // Number of elements in vector
-       bool allocFailure;      // A memory allocation call has failed
+       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 
-       // thrashng the memory allocator
+       /** Internally allocate more elements than the user wants
+        * to avoid thrashing the memory allocator. */
        void SizeTo(int newSize) {
-               if (newSize < 4000)
-                       newSize += 4000;
+               if (newSize < allocSize)
+                       newSize += allocSize;
                else 
                        newSize = (newSize * 3) / 2;
                int* newv = new int[newSize];
@@ -50,6 +55,7 @@ public:
        ~SVector() {
                Free();
        }
+       /// Constructor from another vector.
        SVector(const SVector &other) {
                allocFailure = false;
                v = 0;
@@ -64,6 +70,7 @@ public:
                        }
                }
        }
+       /// Copy constructor.
        SVector &operator=(const SVector &other) {
                if (this != &other) {
                        delete []v;
@@ -82,6 +89,9 @@ public:
                }
                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) {
@@ -91,12 +101,15 @@ public:
                }
                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) {
@@ -105,6 +118,7 @@ public:
                }
                len = newLength;
        }
+       /// Get the current length (number of used elements) of the vector.
        int Length() const {
                return len;
        }
index 4f182850ad452d6e37620458bf9529579e877541..707f59b9f440978ee0ea10dc1dd321d8bf22e40e 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// ScintillaBase.cxx - an enhanced subclass of Editor with calltips, autocomplete and context menu
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ScintillaBase.cxx
+ ** An enhanced subclass of Editor with calltips, autocomplete and context menu.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
@@ -15,7 +17,6 @@
 #ifdef SCI_LEXER
 #include "SciLexer.h"
 #include "Accessor.h"
-#include "WindowAccessor.h"
 #include "DocumentAccessor.h"
 #include "KeyWords.h"
 #endif
 #include "ScintillaBase.h"
 
 ScintillaBase::ScintillaBase() {
-#ifdef SCI_LEXER       
+       listType = 0;
+#ifdef SCI_LEXER
        lexLanguage = SCLEX_CONTAINER;
-       for (int wl=0;wl<numWordLists;wl++)
+       lexCurrent = 0;
+       for (int wl = 0;wl < numWordLists;wl++)
                keyWordLists[wl] = new WordList;
+       keyWordLists[numWordLists] = 0;
 #endif
 }
 
 ScintillaBase::~ScintillaBase() {
-#ifdef SCI_LEXER       
-       for (int wl=0;wl<numWordLists;wl++)
+#ifdef SCI_LEXER
+       for (int wl = 0;wl < numWordLists;wl++)
                delete keyWordLists[wl];
 #endif
 }
 
 void ScintillaBase::Finalise() {
-    Editor::Finalise();
+       Editor::Finalise();
        popup.Destroy();
 }
 
@@ -70,10 +74,12 @@ void ScintillaBase::Command(int cmdId) {
 
        switch (cmdId) {
 
-       case idAutoComplete:    // Nothing to do
+       case idAutoComplete:    // Nothing to do
+
                break;
 
-       case idCallTip:         // Nothing to do
+       case idCallTip:         // Nothing to do
+
                break;
 
        case idcmdUndo:
@@ -170,7 +176,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        //Platform::DebugPrintf("AutoComplete %s\n", list);
        ct.CallTipCancel();
 
-       if (ac.chooseSingle) {
+       if (ac.chooseSingle && (listType == 0)) {
                if (list && !strchr(list, ac.GetSeparator())) {
                        if (ac.ignoreCase) {
                                SetEmptySelection(currentPos - lenEntered);
@@ -183,13 +189,13 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
                                pdoc->InsertString(currentPos, list + lenEntered);
                                SetEmptySelection(currentPos + strlen(list + lenEntered));
                        }
-                       return;
+                       return ;
                }
        }
-       ac.Start(wDraw, idAutoComplete, currentPos, lenEntered);
+       ac.Start(wMain, idAutoComplete, currentPos, lenEntered);
 
        PRectangle rcClient = GetClientRectangle();
-       Point pt = LocationFromPosition(currentPos-lenEntered);
+       Point pt = LocationFromPosition(currentPos - lenEntered);
 
        int heightLB = 100;
        int widthLB = 100;
@@ -200,8 +206,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        }
        PRectangle rcac;
        rcac.left = pt.x - 5;
-       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 >= rcClient.bottom - heightLB &&  // Wont fit below.
+               pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
                rcac.top = pt.y - heightLB;
                if (rcac.top < 0) {
                        heightLB += rcac.top;
@@ -225,8 +231,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        // Make an allowance for large strings in list
        rcList.left = pt.x - 5;
        rcList.right = rcList.left + widthLB;
-       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 >= rcClient.bottom - heightLB &&  // Wont fit below.
+               pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
                rcList.top = pt.y - heightAlloced;
        } else {
                rcList.top = pt.y + vs.lineHeight;
@@ -236,7 +242,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        ac.Show();
        if (lenEntered != 0) {
                AutoCompleteMoveToCurrentWord();
-       }               
+       }
 }
 
 void ScintillaBase::AutoCompleteCancel() {
@@ -278,44 +284,45 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
                ac.lb.GetValue(item, selected, sizeof(selected));
        }
        ac.Cancel();
-       
-       if (ac.ignoreCase) {
-               if (currentPos != ac.posStart) {
-                       pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
-               }
-               SetEmptySelection(ac.posStart - ac.startLen);
-               pdoc->DeleteChars(ac.posStart - ac.startLen, ac.startLen);
-               if (item != -1) {
-                       SString piece = selected;
-                       if (fillUp)
-                               piece += fillUp;
-                       pdoc->InsertString(currentPos, piece.c_str());
-                       SetEmptySelection(currentPos + piece.length());
-               }
-       } else {
-               if (currentPos != ac.posStart) {
-                       pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
-               }
-               SetEmptySelection(ac.posStart);
-               if (item != -1) {
-                       SString piece = selected + ac.startLen;
-                       if (fillUp)
-                               piece += fillUp;
-                       pdoc->InsertString(currentPos, piece.c_str());
-                       SetEmptySelection(currentPos + piece.length());
-               }
+
+       if (listType > 0) {
+               userListSelected = selected;
+               SCNotification scn;
+               scn.nmhdr.code = SCN_USERLISTSELECTION;
+               scn.message = 0;
+               scn.wParam = listType;
+               scn.lParam = 0;
+               scn.text = userListSelected.c_str();
+               NotifyParent(scn);
+               return ;
+       }
+
+       Position firstPos = ac.posStart - ac.startLen;
+       if (currentPos < firstPos)
+               return ;
+       if (currentPos != firstPos) {
+               pdoc->DeleteChars(firstPos, currentPos - firstPos);
+       }
+       SetEmptySelection(ac.posStart);
+       if (item != -1) {
+               SString piece = selected;
+               if (fillUp)
+                       piece += fillUp;
+               pdoc->InsertString(firstPos, piece.c_str());
+               SetEmptySelection(firstPos + piece.length());
        }
 }
 
 void ScintillaBase::ContextMenu(Point pt) {
+       bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
        popup.CreatePopUp();
-       AddToPopUp("Undo", idcmdUndo, pdoc->CanUndo());
-       AddToPopUp("Redo", idcmdRedo, pdoc->CanRedo());
+       AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
+       AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
        AddToPopUp("");
-       AddToPopUp("Cut", idcmdCut, currentPos != anchor);
+       AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
        AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
-       AddToPopUp("Paste", idcmdPaste, WndProc(SCI_CANPASTE, 0, 0));
-       AddToPopUp("Delete", idcmdDelete, currentPos != anchor);
+       AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
+       AddToPopUp("Delete", idcmdDelete, writable && currentPos != anchor);
        AddToPopUp("");
        AddToPopUp("Select All", idcmdSelectAll);
        popup.Show(pt, wMain);
@@ -333,41 +340,67 @@ void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool
 }
 
 #ifdef SCI_LEXER
+void ScintillaBase::SetLexer(uptr_t wParam) {
+       lexLanguage = wParam;
+       lexCurrent = LexerModule::Find(lexLanguage);
+       if (!lexCurrent)
+               lexCurrent = LexerModule::Find(SCLEX_NULL);
+}
+
+void ScintillaBase::SetLexerLanguage(const char *languageName) {
+       lexLanguage = SCLEX_CONTAINER;
+       lexCurrent = LexerModule::Find(languageName);
+       if (!lexCurrent)
+               lexCurrent = LexerModule::Find(SCLEX_NULL);
+       if (lexCurrent)
+               lexLanguage = lexCurrent->GetLanguage();
+}
+
 void ScintillaBase::Colourise(int start, int end) {
-       int lengthDoc = Platform::SendScintilla(wMain.GetID(), SCI_GETLENGTH, 0, 0);
+       int lengthDoc = pdoc->Length();
        if (end == -1)
                end = lengthDoc;
        int len = end - start;
 
+       PLATFORM_ASSERT(len >= 0);
+       PLATFORM_ASSERT(start + len <= lengthDoc);
+
        //WindowAccessor styler(wMain.GetID(), props);
-       DocumentAccessor styler(pdoc, props);
+       DocumentAccessor styler(pdoc, props, wMain.GetID());
 
        int styleStart = 0;
        if (start > 0)
                styleStart = styler.StyleAt(start - 1);
        styler.SetCodePage(pdoc->dbcsCodePage);
-       
-       LexerModule::Colourise(start, len, styleStart, lexLanguage, keyWordLists, styler);
-       styler.Flush();
+
+       if (lexCurrent) {       // Should always succeed as null lexer should always be available
+               lexCurrent->Lex(start, len, styleStart, keyWordLists, styler);
+               styler.Flush();
+               if (styler.GetPropertyInt("fold")) {
+                       lexCurrent->Fold(start, len, styleStart, keyWordLists, styler);
+                       styler.Flush();
+               }
+       }
 }
 #endif
 
 void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
 #ifdef SCI_LEXER
        if (lexLanguage != SCLEX_CONTAINER) {
-               int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0);
-               int lineEndStyled = Platform::SendScintilla(wMain.GetID(), SCI_LINEFROMPOSITION, endStyled, 0);
-               endStyled = Platform::SendScintilla(wMain.GetID(), SCI_POSITIONFROMLINE, lineEndStyled, 0);
+               int endStyled = WndProc(SCI_GETENDSTYLED, 0, 0);
+               int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0);
+               endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0);
                Colourise(endStyled, endStyleNeeded);
-               return;
+               return ;
        }
 #endif
        Editor::NotifyStyleToNeeded(endStyleNeeded);
 }
 
-long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
+sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        switch (iMessage) {
        case SCI_AUTOCSHOW:
+               listType = 0;
                AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
                break;
 
@@ -395,15 +428,15 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
        case SCI_AUTOCSTOPS:
                ac.SetStopChars(reinterpret_cast<char *>(lParam));
                break;
-               
+
        case SCI_AUTOCSELECT:
                ac.Select(reinterpret_cast<char *>(lParam));
                break;
-       
+
        case SCI_AUTOCSETCANCELATSTART:
                ac.cancelAtStartPos = wParam;
                break;
-       
+
        case SCI_AUTOCGETCANCELATSTART:
                return ac.cancelAtStartPos;
 
@@ -417,20 +450,35 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
 
        case SCI_AUTOCGETCHOOSESINGLE:
                return ac.chooseSingle;
-               
+
        case SCI_AUTOCSETIGNORECASE:
                ac.ignoreCase = wParam;
                break;
-               
+
        case SCI_AUTOCGETIGNORECASE:
                return ac.ignoreCase;
-               
+
+       case SCI_USERLISTSHOW:
+               listType = wParam;
+               AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
+               break;
+
+       case SCI_AUTOCSETAUTOHIDE:
+               ac.autoHide = wParam;
+               break;
+
+       case SCI_AUTOCGETAUTOHIDE:
+               return ac.autoHide;
+
        case SCI_CALLTIPSHOW: {
                        AutoCompleteCancel();
                        if (!ct.wCallTip.Created()) {
-                               PRectangle rc = ct.CallTipStart(currentPos, LocationFromPosition(wParam),
+                               Point pt = LocationFromPosition(wParam);
+                               pt.y += vs.lineHeight;
+                               PRectangle rc = ct.CallTipStart(currentPos, pt,
                                                                reinterpret_cast<char *>(lParam),
-                                                               vs.styles[STYLE_DEFAULT].fontName, vs.styles[STYLE_DEFAULT].size);
+                                                               vs.styles[STYLE_DEFAULT].fontName,
+                                                               vs.styles[STYLE_DEFAULT].sizeZoomed);
                                // If the call-tip window would be out of the client
                                // space, adjust so it displays above the text.
                                PRectangle rcClient = GetClientRectangle();
@@ -441,7 +489,7 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
                                }
                                // Now display the window.
                                CreateCallTipWindow(rc);
-                               ct.wCallTip.SetPositionRelative(rc, wDraw);
+                               ct.wCallTip.SetPositionRelative(rc, wMain);
                                ct.wCallTip.Show();
                        }
                }
@@ -465,31 +513,37 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
                ct.colourBG = Colour(wParam);
                InvalidateStyleRedraw();
                break;
-               
+
 #ifdef SCI_LEXER
        case SCI_SETLEXER:
+               SetLexer(wParam);
                lexLanguage = wParam;
                break;
-               
+
        case SCI_GETLEXER:
                return lexLanguage;
-               
+
        case SCI_COLOURISE:
                Colourise(wParam, lParam);
                Redraw();
                break;
-               
+
        case SCI_SETPROPERTY:
-               props.Set(reinterpret_cast<const char *>(wParam), 
-                       reinterpret_cast<const char *>(lParam));
+               props.Set(reinterpret_cast<const char *>(wParam),
+                         reinterpret_cast<const char *>(lParam));
                break;
-               
+
        case SCI_SETKEYWORDS:
                if (wParam < numWordLists) {
                        keyWordLists[wParam]->Clear();
                        keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam));
                }
                break;
+
+       case SCI_SETLEXERLANGUAGE:
+               SetLexerLanguage(reinterpret_cast<const char *>(lParam));
+               break;
+
 #endif
 
        default:
index e630ba1aac6b0b1e9da84db8acaedaf4be809c3a..d5b1e8ba0ccae8b98666326d2711112cef0917d5 100644 (file)
@@ -1,17 +1,22 @@
 // Scintilla source code edit control
-// ScintillaBase.h - defines an enhanced subclass of Editor with calltips, autocomplete and context menu
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ScintillaBase.h
+ ** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef SCINTILLABASE_H
 #define SCINTILLABASE_H
 
+/**
+ */
 class ScintillaBase : public Editor {
        // Private so ScintillaBase objects can not be copied
        ScintillaBase(const ScintillaBase &) : Editor() {}
        ScintillaBase &operator=(const ScintillaBase &) { return *this; }
+
 protected:
-       // Enumeration of commands and child windows
+       /** Enumeration of commands and child windows. */
        enum {
                idCallTip=1,
                idAutoComplete=2,
@@ -30,11 +35,17 @@ protected:
 
        CallTip ct;
 
+       int listType;                   ///< 0 is an autocomplete list
+       SString userListSelected;       ///< Receives listbox selected string
+       
 #ifdef SCI_LEXER
        int lexLanguage;
+       LexerModule *lexCurrent;
        PropSet props;
        enum {numWordLists=5};
-       WordList *keyWordLists[numWordLists];
+       WordList *keyWordLists[numWordLists+1];
+       void SetLexer(uptr_t wParam);
+       void SetLexerLanguage(const char *languageName);
        void Colourise(int start, int end);
 #endif
 
@@ -67,7 +78,7 @@ protected:
        virtual void NotifyStyleToNeeded(int endStyleNeeded);
 public:
        // Public so scintilla_send_message can use it
-       virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
+       virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 };
 
 #endif
index 0a52ed41a3209184ca8a517c66ad99bbe1c89851..4a352679100516e02ccf6efb4182ac12c3b0b104 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Style.cxx - defines the font and colour style for a class of text
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Style.cxx
+ ** Defines the font and colour style for a class of text.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <string.h>
 
 Style::Style() {
        aliasOfDefaultFont = true;
-       Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
-               Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
-               false, false, false, false, true);
+       Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
+             Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
+             false, false, false, false, caseMixed, true);
 }
-       
+
 Style::Style(const Style &source) {
-       Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
-               0, 0, 0,
-               false, false, false, false, true);
+       Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
+             0, 0, 0,
+             false, false, false, false, caseMixed, true);
        fore.desired = source.fore.desired;
        back.desired = source.back.desired;
        characterSet = source.characterSet;
@@ -29,7 +31,8 @@ Style::Style(const Style &source) {
        size = source.size;
        eolFilled = source.eolFilled;
        underline = source.underline;
-    visible = source.visible;
+       caseForce = source.caseForce;
+       visible = source.visible;
 }
 
 Style::~Style() {
@@ -42,10 +45,10 @@ Style::~Style() {
 
 Style &Style::operator=(const Style &source) {
        if (this == &source)
-               return *this;
-       Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
-               0, 0, SC_CHARSET_DEFAULT,
-               false, false, false, false, true);
+               return * this;
+       Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
+             0, 0, SC_CHARSET_DEFAULT,
+             false, false, false, false, caseMixed, true);
        fore.desired = source.fore.desired;
        back.desired = source.back.desired;
        characterSet = source.characterSet;
@@ -54,13 +57,15 @@ Style &Style::operator=(const Style &source) {
        size = source.size;
        eolFilled = source.eolFilled;
        underline = source.underline;
-    visible = source.visible;
+       caseForce = source.caseForce;
+       visible = source.visible;
        return *this;
 }
 
-void Style::Clear(Colour fore_, Colour back_, int size_, 
-       const char *fontName_, int characterSet_,
-       bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_) {
+void Style::Clear(Colour fore_, Colour back_, int size_,
+                  const char *fontName_, int characterSet_,
+                  bool bold_, bool italic_, bool eolFilled_, 
+                  bool underline_, ecaseForced caseForce_, bool visible_) {
        fore.desired = fore_;
        back.desired = back_;
        characterSet = characterSet_;
@@ -70,19 +75,35 @@ void Style::Clear(Colour fore_, Colour back_, int size_,
        fontName = fontName_;
        eolFilled = eolFilled_;
        underline = underline_;
-    visible = visible_;
+       caseForce = caseForce_;
+       visible = visible_;
        if (aliasOfDefaultFont)
                font.SetID(0);
-       else 
+       else
                font.Release();
        aliasOfDefaultFont = false;
 }
 
+void Style::ClearTo(const Style &source) {
+       Clear(
+               source.fore.desired,
+               source.back.desired,
+               source.size,
+               source.fontName,
+               source.characterSet,
+               source.bold,
+               source.italic,
+               source.eolFilled,
+               source.underline,
+               source.caseForce,
+               source.visible);
+}
+
 bool Style::EquivalentFontTo(const Style *other) const {
        if (bold != other->bold ||
-               italic != other->italic ||
-               size != other->size ||
-               characterSet != other->characterSet)
+               italic != other->italic ||
+               size != other->size ||
+               characterSet != other->characterSet)
                return false;
        if (fontName == other->fontName)
                return true;
@@ -94,17 +115,17 @@ bool Style::EquivalentFontTo(const Style *other) const {
 }
 
 void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
-       int sizeZoomed = size + zoomLevel;
+       sizeZoomed = size + zoomLevel;
        if (sizeZoomed <= 2)    // Hangs if sizeZoomed <= 1
                sizeZoomed = 2;
 
        if (aliasOfDefaultFont)
                font.SetID(0);
-       else 
+       else
                font.Release();
        int deviceHeight = surface.DeviceHeightFont(sizeZoomed);
-       aliasOfDefaultFont = defaultStyle && 
-               (EquivalentFontTo(defaultStyle) || !fontName);
+       aliasOfDefaultFont = defaultStyle &&
+                            (EquivalentFontTo(defaultStyle) || !fontName);
        if (aliasOfDefaultFont) {
                font.SetID(defaultStyle->font.GetID());
        } else if (fontName) {
index 9a2b4586a37442277bde4a32fe1123997286cf00..3600886b35efbd65cbe96c979c7f94121483c9ba 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// Style.h - defines the font and colour style for a class of text
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Style.h
+ ** Defines the font and colour style for a class of text.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef STYLE_H
 #define STYLE_H
 
+/**
+ */
 class Style {
 public:
        ColourPair fore;
@@ -18,9 +22,12 @@ public:
        int characterSet;
        bool eolFilled;
        bool underline;
+       enum ecaseForced {caseMixed, caseUpper, caseLower};
+       ecaseForced caseForce;
        bool visible;
 
        Font font;
+       int sizeZoomed;
        unsigned int lineHeight;
        unsigned int ascent;
        unsigned int descent;
@@ -33,11 +40,13 @@ public:
        ~Style();
        Style &operator=(const Style &source);
        void Clear(Colour fore_, Colour back_,
-               int size_, 
-               const char *fontName_, int characterSet_,
-               bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_);
+                  int size_,
+                  const char *fontName_, int characterSet_,
+                  bool bold_, bool italic_, bool eolFilled_, 
+                  bool underline_, ecaseForced caseForce_, bool visible_);
+       void ClearTo(const Style &source);
        bool EquivalentFontTo(const Style *other) const;
-       void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0);
+       void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0);
 };
 
 #endif
index 9306f307c245da0ee01cad2eb80c380af300f1da..c3f960c62cfa374f6038f68f38f9de26dfac0ebf 100644 (file)
@@ -1,5 +1,8 @@
-// UniConversion.h - functions to handle UFT-8 and UCS-2 strings
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file UniConversion.cxx
+ ** Functions to handle UFT-8 and UCS-2 strings.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
index cace497c48a426014a99c02dae682abae993a60e..bd1d7754d45a9924f631d0d592491786dc8e8ea4 100644 (file)
@@ -1,5 +1,8 @@
-// UniConversion.h - functions to handle UFT-8 and UCS-2 strings
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file UniConversion.h
+ ** Functions to handle UFT-8 and UCS-2 strings.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen);
index 9b7a8535e9269a5594b8afa3d2120d62ee86dbef..4db7e2508bcd128b30c3d5f956dbd19d4e85ef30 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// ViewStyle.cxx - store information on how the document is to be viewed
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ViewStyle.cxx
+ ** Store information on how the document is to be viewed.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <string.h>
@@ -13,7 +15,7 @@
 #include "Style.h"
 #include "ViewStyle.h"
 
-MarginStyle::MarginStyle() : 
+MarginStyle::MarginStyle() :
        symbol(false), width(16), mask(0xffffffff), sensitive(false) {
 }
 
@@ -64,7 +66,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
        for (int ind=0;ind<=INDIC_MAX;ind++) {
                indicators[ind] = source.indicators[ind];
        }
-       
+
        selforeset = source.selforeset;
        selforeground.desired = source.selforeground.desired;
        selbackset = source.selbackset;
@@ -73,8 +75,11 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
        selbar.desired = source.selbar.desired;
        selbarlight.desired = source.selbarlight.desired;
        caretcolour.desired = source.caretcolour.desired;
+       showCaretLineBackground = source.showCaretLineBackground;
+       caretLineBackground.desired = source.caretLineBackground.desired;
        edgecolour.desired = source.edgecolour.desired;
        edgeState = source.edgeState;
+       caretWidth = source.caretWidth;
        leftMarginWidth = source.leftMarginWidth;
        rightMarginWidth = source.rightMarginWidth;
        for (int i=0;i < margins; i++) {
@@ -87,7 +92,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
        viewWhitespace = source.viewWhitespace;
        viewIndentationGuides = source.viewIndentationGuides;
        viewEOL = source.viewEOL;
-       showMarkedLines = source.showMarkedLines;               
+       showMarkedLines = source.showMarkedLines;
 }
 
 ViewStyle::~ViewStyle() {
@@ -96,7 +101,7 @@ ViewStyle::~ViewStyle() {
 void ViewStyle::Init() {
        fontNames.Clear();
        ResetDefaultStyle();
-       
+
        indicators[0].style = INDIC_SQUIGGLE;
        indicators[0].fore = Colour(0, 0x7f, 0);
        indicators[1].style = INDIC_TT;
@@ -119,11 +124,13 @@ void ViewStyle::Init() {
        selbarlight.desired = Platform::ChromeHighlight();
        styles[STYLE_LINENUMBER].fore.desired = Colour(0, 0, 0);
        styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
-       //caretcolour.desired = Colour(0xff, 0, 0);
        caretcolour.desired = Colour(0, 0, 0);
+       showCaretLineBackground = false;
+       caretLineBackground.desired = Colour(0xff, 0xff, 0);
        edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
        edgeState = EDGE_NONE;
-       
+       caretWidth = 1;
+
        leftMarginWidth = 1;
        rightMarginWidth = 1;
        ms[0].symbol = false;
@@ -172,6 +179,7 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
        pal.WantFind(selbar, want);
        pal.WantFind(selbarlight, want);
        pal.WantFind(caretcolour, want);
+       pal.WantFind(caretLineBackground, want);
        pal.WantFind(edgecolour, want);
 }
 
@@ -190,7 +198,7 @@ void ViewStyle::Refresh(Surface &surface) {
                                maxDescent = styles[i].descent;
                }
        }
-       
+
        lineHeight = maxAscent + maxDescent;
        aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
        spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
@@ -208,26 +216,16 @@ void ViewStyle::Refresh(Surface &surface) {
 
 void ViewStyle::ResetDefaultStyle() {
        styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
-               Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), 
+               Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()),
                SC_CHARSET_DEFAULT,
-               false, false, false, false, true);
+               false, false, false, false, Style::caseMixed, true);
 }
 
 void ViewStyle::ClearStyles() {
        // Reset all styles to be like the default style
        for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
                if (i != STYLE_DEFAULT) {
-                       styles[i].Clear(
-                               styles[STYLE_DEFAULT].fore.desired, 
-                               styles[STYLE_DEFAULT].back.desired, 
-                               styles[STYLE_DEFAULT].size, 
-                               styles[STYLE_DEFAULT].fontName, 
-                               styles[STYLE_DEFAULT].characterSet, 
-                               styles[STYLE_DEFAULT].bold, 
-                               styles[STYLE_DEFAULT].italic,
-                               styles[STYLE_DEFAULT].eolFilled,
-                               styles[STYLE_DEFAULT].underline,
-                               styles[STYLE_DEFAULT].visible);
+                       styles[i].ClearTo(styles[STYLE_DEFAULT]);
                }
        }
        styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
index 5b0ab1925f340b6708829b9bd927c96910bcdb6e..7528638c59058075fb5eb44a685b15064699a15b 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// ViewStyle.h - store information on how the document is to be viewed
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ViewStyle.h
+ ** Store information on how the document is to be viewed.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef VIEWSTYLE_H
 #define VIEWSTYLE_H
 
+/**
+ */
 class MarginStyle {
 public:
        bool symbol;
@@ -15,10 +19,13 @@ public:
        MarginStyle();
 };
 
+/**
+ */
 class FontNames {
 private:
        char *names[STYLE_MAX + 1];
        int max;
+
 public:
        FontNames();
        ~FontNames();
@@ -27,6 +34,9 @@ public:
 };
 
 enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
+
+/**
+ */
 class ViewStyle {
 public:
        FontNames fontNames;
@@ -45,12 +55,12 @@ public:
        ColourPair selbackground2;
        ColourPair selbar;
        ColourPair selbarlight;
-       // Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
-       int leftMarginWidth;            // Spacing margin on left of text
-       int rightMarginWidth;   // Spacing margin on left of text
+       /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
        enum { margins=3 };
+       int leftMarginWidth;    ///< Spacing margin on left of text
+       int rightMarginWidth;   ///< Spacing margin on left of text
        bool symbolMargin;
-       int maskInLine; // Mask for markers to be put into text because there is nowhere for them to go in margin
+       int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
        MarginStyle ms[margins];
        int fixedColumnWidth;
        int zoomLevel;
@@ -59,8 +69,11 @@ public:
        bool viewEOL;
        bool showMarkedLines;
        ColourPair caretcolour;
+       bool showCaretLineBackground;
+       ColourPair caretLineBackground;
        ColourPair edgecolour;
        int edgeState;
+       int caretWidth;
        
        ViewStyle();
        ViewStyle(const ViewStyle &source);
index 5f3deac7db969f7fb0dbe038fd8adde7d501e135..db2f938f301fe27f3ee538c709911a2fd1aae9ea 100644 (file)
@@ -1,6 +1,8 @@
-// SciTE - Scintilla based Text Editor
-// Accessor.cxx - rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file WindowAccessor.cxx
+ ** Rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
index 6adfd80a8452e4c8a1f78bad4ffa4b0f9ca40ab7..944df02c536d2af3533035265ef2cea0bb70e275 100644 (file)
 
 int wxForceScintillaLexers(void)
 {
+  extern LexerModule lmAda;
+  extern LexerModule lmAVE;
+  extern LexerModule lmConf;
   extern LexerModule lmCPP;
+  extern LexerModule lmEiffel;
   extern LexerModule lmHTML;
-  extern LexerModule lmXML;
-  extern LexerModule lmProps;
-  extern LexerModule lmErrorList;
-  extern LexerModule lmMake;
-  extern LexerModule lmBatch;
+  extern LexerModule lmLISP;
+  extern LexerModule lmLua;
+  extern LexerModule lmBatch;  // In LexOthers.cxx
+  extern LexerModule lmPascal;
   extern LexerModule lmPerl;
   extern LexerModule lmPython;
+  extern LexerModule lmRuby;
   extern LexerModule lmSQL;
   extern LexerModule lmVB;
 
-  if (
-      &lmCPP
-      && &lmHTML
-      && &lmXML
-      && &lmProps
-      && &lmErrorList
-      && &lmMake
-      && &lmBatch
-      && &lmPerl
-      && &lmPython
-      && &lmSQL
-      && &lmVB
-      )
+  if (  &lmAda
+     && &lmAVE
+     && &lmConf
+     && &lmCPP
+     && &lmEiffel
+     && &lmHTML
+     && &lmLISP
+     && &lmLua
+     && &lmBatch
+     && &lmPascal
+     && &lmPerl
+     && &lmPython
+     && &lmRuby
+     && &lmSQL
+     && &lmVB )
     {
       return 1;
     }
@@ -66,21 +72,27 @@ int wxForceScintillaLexers(void)
 
 const wxChar* wxSTCNameStr = "stcwindow";
 
-
 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE )
 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED )
 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED )
-DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED )
 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT )
 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT )
+DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK )
+DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED )
-DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD )
 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN )
 DEFINE_EVENT_TYPE( wxEVT_STC_POSCHANGED )
+DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED )
+DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION )
+DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
+DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
+DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
+
+
 
 
 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -94,7 +106,7 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
 #endif
     EVT_MOTION                  (wxStyledTextCtrl::OnMouseMove)
     EVT_LEFT_UP                 (wxStyledTextCtrl::OnMouseLeftUp)
-    EVT_RIGHT_UP                (wxStyledTextCtrl::OnMouseRightUp)
+    EVT_CONTEXT_MENU            (wxStyledTextCtrl::OnContextMenu)
     EVT_MOUSEWHEEL              (wxStyledTextCtrl::OnMouseWheel)
     EVT_CHAR                    (wxStyledTextCtrl::OnChar)
     EVT_KEY_DOWN                (wxStyledTextCtrl::OnKeyDown)
@@ -299,6 +311,12 @@ int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) {
                               return SendMsg(2022, pt.x, pt.y);
 }
 
+// Find the position from a point within the window but return
+// INVALID_POSITION if not close to text.
+int wxStyledTextCtrl::PositionFromPointClose(int x, int y) {
+    return SendMsg(2023, x, y);
+}
+
 // Set caret to start of a line and ensure it is visible.
 void wxStyledTextCtrl::GotoLine(int line) {
     SendMsg(2024, line, 0);
@@ -335,9 +353,9 @@ int wxStyledTextCtrl::GetEndStyled() {
     return SendMsg(2028, 0, 0);
 }
 
-// Convert all line endings in the document to use the current mode.
-void wxStyledTextCtrl::ConvertEOLs() {
-    SendMsg(2029, 0, 0);
+// Convert all line endings in the document to one mode.
+void wxStyledTextCtrl::ConvertEOLs(int eolMode) {
+    SendMsg(2029, eolMode, 0);
 }
 
 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
@@ -534,6 +552,11 @@ void wxStyledTextCtrl::StyleSetUnderline(int style, bool underline) {
     SendMsg(2059, style, underline);
 }
 
+// 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 the foreground colour of the selection and whether to use this setting.
 void wxStyledTextCtrl::SetSelForeground(bool useSetting, const wxColour& fore) {
     SendMsg(2067, useSetting, wxColourAsLong(fore));
@@ -649,6 +672,27 @@ int wxStyledTextCtrl::GetMaxLineState() {
     return SendMsg(2094, 0, 0);
 }
 
+// Is the background of the line containing the caret in a different colour?
+bool wxStyledTextCtrl::GetCaretLineVisible() {
+    return SendMsg(2095, 0, 0) != 0;
+}
+
+// Display the background of the line containing the caret in a different colour.
+void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
+    SendMsg(2096, show, 0);
+}
+
+// Get the colour of the background of the line containing the caret.
+wxColour wxStyledTextCtrl::GetCaretLineBack() {
+    long c = SendMsg(2097, 0, 0);
+    return wxColourFromLong(c);
+}
+
+// Set the colour of the background of the line containing the caret.
+void wxStyledTextCtrl::SetCaretLineBack(const wxColour& back) {
+    SendMsg(2098, wxColourAsLong(back), 0);
+}
+
 // Display a auto-completion list.
 // The lenEntered parameter indicates how many characters before
 // the caret should be used to provide context.
@@ -734,6 +778,21 @@ bool wxStyledTextCtrl::AutoCompGetIgnoreCase() {
     return SendMsg(2116, 0, 0) != 0;
 }
 
+// Display a list of strings and send notification when user chooses one.
+void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList) {
+    SendMsg(2117, listType, (long)itemList.c_str());
+}
+
+// Set whether or not autocompletion is hidden automatically when nothing matches
+void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide) {
+    SendMsg(2118, autoHide, 0);
+}
+
+// Retrieve whether or not autocompletion is hidden automatically when nothing matches
+bool wxStyledTextCtrl::AutoCompGetAutoHide() {
+    return SendMsg(2119, 0, 0) != 0;
+}
+
 // Set the number of spaces used for one level of indentation.
 void wxStyledTextCtrl::SetIndent(int indentSize) {
     SendMsg(2122, indentSize, 0);
@@ -938,8 +997,8 @@ int wxStyledTextCtrl::GetLineCount() {
 }
 
 // Sets the size in pixels of the left margin.
-void wxStyledTextCtrl::SetMarginLeft(int width) {
-    SendMsg(2155, 0, width);
+void wxStyledTextCtrl::SetMarginLeft(int pixelWidth) {
+    SendMsg(2155, 0, pixelWidth);
 }
 
 // Returns the size in pixels of the left margin.
@@ -948,8 +1007,8 @@ int wxStyledTextCtrl::GetMarginLeft() {
 }
 
 // Sets the size in pixels of the right margin.
-void wxStyledTextCtrl::SetMarginRight(int width) {
-    SendMsg(2157, 0, width);
+void wxStyledTextCtrl::SetMarginRight(int pixelWidth) {
+    SendMsg(2157, 0, pixelWidth);
 }
 
 // Returns the size in pixels of the right margin.
@@ -1105,6 +1164,76 @@ bool wxStyledTextCtrl::GetOvertype() {
     return SendMsg(2187, 0, 0) != 0;
 }
 
+// Set the width of the insert mode caret
+void wxStyledTextCtrl::SetCaretWidth(int pixelWidth) {
+    SendMsg(2188, pixelWidth, 0);
+}
+
+// Returns the width of the insert mode caret
+int wxStyledTextCtrl::GetCaretWidth() {
+    return SendMsg(2189, 0, 0);
+}
+
+// Sets the position that starts the target which is used for updating the
+// document without affecting the scroll position.
+void wxStyledTextCtrl::SetTargetStart(int pos) {
+    SendMsg(2190, pos, 0);
+}
+
+// Get the position that starts the target.
+int wxStyledTextCtrl::GetTargetStart() {
+    return SendMsg(2191, 0, 0);
+}
+
+// Sets the position that ends the target which is used for updating the
+// document without affecting the scroll position.
+void wxStyledTextCtrl::SetTargetEnd(int pos) {
+    SendMsg(2192, pos, 0);
+}
+
+// Get the position that ends the target.
+int wxStyledTextCtrl::GetTargetEnd() {
+    return SendMsg(2193, 0, 0);
+}
+
+// Replace the target text with the argument text.
+// Returns the length of the replacement text.
+
+                       int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
+                           return SendMsg(2194, text.Len(), (long)text.c_str());
+                       
+}
+
+// Replace the target text with the argument text after \d processing.
+// Looks for \d where d is between 1 and 9 and replaces these with the strings
+// matched in the last search operation which were surrounded by \( and \).
+// Returns the length of the replacement text including any change
+// caused by processing the \d patterns.
+
+                       int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
+                           return SendMsg(2195, text.Len(), (long)text.c_str());
+                       
+}
+
+// Search for a counted string in the target and set the target to the found
+// range.
+// Returns length of range or -1 for failure in which case target is not moved.
+
+                       int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
+                           return SendMsg(2197, text.Len(), (long)text.c_str());
+                       
+}
+
+// Set the search flags used by SearchInTarget
+void wxStyledTextCtrl::SetSearchFlags(int flags) {
+    SendMsg(2198, flags, 0);
+}
+
+// Get the search flags used by SearchInTarget
+int wxStyledTextCtrl::GetSearchFlags() {
+    return SendMsg(2199, 0, 0);
+}
+
 // Show a call tip containing a definition near position pos.
 void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition) {
     SendMsg(2200, pos, (long)definition.c_str());
@@ -1207,6 +1336,47 @@ void wxStyledTextCtrl::SetFoldFlags(int flags) {
     SendMsg(2233, flags, 0);
 }
 
+// Ensure a particular line is visible by expanding any header line hiding it.
+// Use the currently set visibility policy to determine which range to display.
+void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line) {
+    SendMsg(2234, line, 0);
+}
+
+// Sets whether a tab pressed when caret is within indentation indents
+void wxStyledTextCtrl::SetTabIndents(bool tabIndents) {
+    SendMsg(2260, tabIndents, 0);
+}
+
+// Does a tab pressed when caret is within indentation indent?
+bool wxStyledTextCtrl::GetTabIndents() {
+    return SendMsg(2261, 0, 0) != 0;
+}
+
+// Sets whether a backspace pressed when caret is within indentation unindents
+void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents) {
+    SendMsg(2262, bsUnIndents, 0);
+}
+
+// Does a backspace pressed when caret is within indentation unindent?
+bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
+    return SendMsg(2263, 0, 0) != 0;
+}
+
+// Sets the time the mouse must sit still to generate a mouse dwell event
+void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds) {
+    SendMsg(2264, periodMilliseconds, 0);
+}
+
+// Retrieve the time the mouse must sit still to generate a mouse dwell event
+int wxStyledTextCtrl::GetMouseDwellTime() {
+    return SendMsg(2265, 0, 0);
+}
+
+// Move the caret inside current view if it's not there already
+void wxStyledTextCtrl::MoveCaretInsideView() {
+    SendMsg(2401, 0, 0);
+}
+
 // How many characters are on a line, not including end of line characters.
 int wxStyledTextCtrl::LineLength(int line) {
     return SendMsg(2350, line, 0);
@@ -1244,7 +1414,7 @@ void* wxStyledTextCtrl::GetDocPointer() {
 
 // Change the document object used.
 void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
-                           SendMsg(2358, (long)docPointer);
+                           SendMsg(2358, 0, (long)docPointer);
 }
 
 // Set which document modification events are sent to the container.
@@ -1291,11 +1461,13 @@ void wxStyledTextCtrl::SearchAnchor() {
 }
 
 // Find some text starting at the search anchor.
+// Does not ensure the selection is visible.
 int wxStyledTextCtrl::SearchNext(int flags, const wxString& text) {
     return SendMsg(2367, flags, (long)text.c_str());
 }
 
 // Find some text starting at the search anchor and moving backwards.
+// Does not ensure the selection is visible.
 int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text) {
     return SendMsg(2368, flags, (long)text.c_str());
 }
@@ -1353,6 +1525,81 @@ int wxStyledTextCtrl::GetModEventMask() {
     return SendMsg(2378, 0, 0);
 }
 
+// Change internal focus flag
+void wxStyledTextCtrl::SetFocus(bool focus) {
+    SendMsg(2380, focus, 0);
+}
+
+// Get internal focus flag
+bool wxStyledTextCtrl::GetFocus() {
+    return SendMsg(2381, 0, 0) != 0;
+}
+
+// Change error status - 0 = OK
+void wxStyledTextCtrl::SetStatus(int statusCode) {
+    SendMsg(2382, statusCode, 0);
+}
+
+// Get error status
+int wxStyledTextCtrl::GetStatus() {
+    return SendMsg(2383, 0, 0);
+}
+
+// Set whether the mouse is captured when its button is pressed
+void wxStyledTextCtrl::SetMouseDownCaptures(bool captures) {
+    SendMsg(2384, captures, 0);
+}
+
+// Get whether mouse gets captured
+bool wxStyledTextCtrl::GetMouseDownCaptures() {
+    return SendMsg(2385, 0, 0) != 0;
+}
+
+// Sets the cursor to one of the SC_CURSOR* values
+void wxStyledTextCtrl::SetCursor(int cursorType) {
+    SendMsg(2386, cursorType, 0);
+}
+
+// Get cursor type
+int wxStyledTextCtrl::GetCursor() {
+    return SendMsg(2387, 0, 0);
+}
+
+// Move to the previous change in capitalistion
+void wxStyledTextCtrl::WordPartLeft() {
+    SendMsg(2390, 0, 0);
+}
+
+// Move to the previous change in capitalistion extending selection to new caret position.
+void wxStyledTextCtrl::WordPartLeftExtend() {
+    SendMsg(2391, 0, 0);
+}
+
+// Move to the change next in capitalistion
+void wxStyledTextCtrl::WordPartRight() {
+    SendMsg(2392, 0, 0);
+}
+
+// Move to the next change in capitalistion extending selection to new caret position.
+void wxStyledTextCtrl::WordPartRightExtend() {
+    SendMsg(2393, 0, 0);
+}
+
+// Set the way the display area is determined when a particular line is to be moved to.
+void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop) {
+    SendMsg(2394, visiblePolicy, visibleSlop);
+}
+
+// Delete back from the current position to the start of the line
+void wxStyledTextCtrl::DelLineLeft() {
+    SendMsg(2395, 0, 0);
+}
+
+// Delete forwards from the current position to the end of the line
+void wxStyledTextCtrl::DelLineRight() {
+    SendMsg(2396, 0, 0);
+}
+
 // Start notifying the container of all key presses and commands.
 void wxStyledTextCtrl::StartRecord() {
     SendMsg(3001, 0, 0);
@@ -1388,6 +1635,11 @@ void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords) {
     SendMsg(4005, keywordSet, (long)keyWords.c_str());
 }
 
+// Set the lexing language of the document based on string name.
+void wxStyledTextCtrl::SetLexerLanguage(const wxString& language) {
+    SendMsg(4006, 0, (long)language.c_str());
+}
+
 // END of generated section
 //----------------------------------------------------------------------
 
@@ -1560,8 +1812,9 @@ void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
 }
 
 
-void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
+void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
     wxPoint pt = evt.GetPosition();
+    ScreenToClient(&pt.x, &pt.y);
     m_swx->DoContextMenu(Point(pt.x, pt.y));
 }
 
@@ -1569,7 +1822,8 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
     m_swx->DoMouseWheel(evt.GetWheelRotation(),
                         evt.GetWheelDelta(),
-                        evt.GetLinesPerAction());
+                        evt.GetLinesPerAction(),
+                        evt.ControlDown());
 }
 
 
@@ -1588,10 +1842,14 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
 
 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
     long key = evt.KeyCode();
-    key = toupper(key);
-    int processed = m_swx->DoKeyDown(key, evt.ShiftDown(),
-                                     evt.ControlDown(), evt.AltDown());
-    if (! processed)
+    //key = toupper(key);  //**** ????
+    bool consumed = FALSE;
+    int processed = m_swx->DoKeyDown(key,
+                                     evt.ShiftDown(),
+                                     evt.ControlDown(),
+                                     evt.AltDown(),
+                                     &consumed);
+    if (!processed && !consumed)
         evt.Skip();
 }
 
@@ -1634,73 +1892,110 @@ void wxStyledTextCtrl::NotifyChange() {
 
 void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
     SCNotification& scn = *_scn;
-    int eventType = 0;
+    wxStyledTextEvent evt(0, GetId());
+
+    evt.SetPosition(scn.position);
+    evt.SetKey(scn.ch);
+    evt.SetModifiers(scn.modifiers);
+
     switch (scn.nmhdr.code) {
     case SCN_STYLENEEDED:
-        eventType = wxEVT_STC_STYLENEEDED;
+        evt.SetEventType(wxEVT_STC_STYLENEEDED);
         break;
+
     case SCN_CHARADDED:
-        eventType = wxEVT_STC_CHARADDED;
-        break;
-    case SCN_UPDATEUI:
-        eventType = wxEVT_STC_UPDATEUI;
+        evt.SetEventType(wxEVT_STC_CHARADDED);
         break;
+
     case SCN_SAVEPOINTREACHED:
-        eventType = wxEVT_STC_SAVEPOINTREACHED;
+        evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
         break;
+
     case SCN_SAVEPOINTLEFT:
-        eventType = wxEVT_STC_SAVEPOINTLEFT;
+        evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
         break;
+
     case SCN_MODIFYATTEMPTRO:
-        eventType = wxEVT_STC_ROMODIFYATTEMPT;
+        evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
         break;
+
+    case SCN_KEY:
+        evt.SetEventType(wxEVT_STC_KEY);
+        break;
+
     case SCN_DOUBLECLICK:
-        eventType = wxEVT_STC_DOUBLECLICK;
+        evt.SetEventType(wxEVT_STC_DOUBLECLICK);
         break;
-    case SCN_MODIFIED:
-        eventType = wxEVT_STC_MODIFIED;
+
+    case SCN_UPDATEUI:
+        evt.SetEventType(wxEVT_STC_UPDATEUI);
         break;
-    case SCN_KEY:
-        eventType = wxEVT_STC_KEY;
+
+    case SCN_MODIFIED:
+        evt.SetEventType(wxEVT_STC_MODIFIED);
+        evt.SetModificationType(scn.modificationType);
+        if (scn.text)
+            evt.SetText(wxString(scn.text, scn.length));
+        evt.SetLength(scn.length);
+        evt.SetLinesAdded(scn.linesAdded);
+        evt.SetLine(scn.line);
+        evt.SetFoldLevelNow(scn.foldLevelNow);
+        evt.SetFoldLevelPrev(scn.foldLevelPrev);
         break;
+
     case SCN_MACRORECORD:
-        eventType = wxEVT_STC_MACRORECORD;
+        evt.SetEventType(wxEVT_STC_MACRORECORD);
+        evt.SetMessage(scn.message);
+        evt.SetWParam(scn.wParam);
+        evt.SetLParam(scn.lParam);
         break;
+
     case SCN_MARGINCLICK:
-        eventType = wxEVT_STC_MARGINCLICK;
+        evt.SetEventType(wxEVT_STC_MARGINCLICK);
+        evt.SetMargin(scn.margin);
         break;
+
     case SCN_NEEDSHOWN:
-        eventType = wxEVT_STC_NEEDSHOWN;
+        evt.SetEventType(wxEVT_STC_NEEDSHOWN);
+        evt.SetLength(scn.length);
         break;
+
     case SCN_POSCHANGED:
-        eventType = wxEVT_STC_POSCHANGED;
+        evt.SetEventType(wxEVT_STC_POSCHANGED);
         break;
-    }
-    if (eventType) {
-        wxStyledTextEvent evt(eventType, GetId());
-        evt.SetPosition(scn.position);
-        evt.SetKey(scn.ch);
-        evt.SetModifiers(scn.modifiers);
-        if (eventType == wxEVT_STC_MODIFIED) {
-            evt.SetModificationType(scn.modificationType);
-            if (scn.text)
-                evt.SetText(wxString(scn.text, scn.length));
-            evt.SetLength(scn.length);
-            evt.SetLinesAdded(scn.linesAdded);
-            evt.SetLine(scn.line);
-            evt.SetFoldLevelNow(scn.foldLevelNow);
-            evt.SetFoldLevelPrev(scn.foldLevelPrev);
-        }
-        if (eventType == wxEVT_STC_MARGINCLICK)
-            evt.SetMargin(scn.margin);
-        if (eventType == wxEVT_STC_MACRORECORD) {
-            evt.SetMessage(scn.message);
-            evt.SetWParam(scn.wParam);
-            evt.SetLParam(scn.lParam);
-        }
 
-        GetEventHandler()->ProcessEvent(evt);
+    case SCN_PAINTED:
+        evt.SetEventType(wxEVT_STC_PAINTED);
+        break;
+
+    case SCN_USERLISTSELECTION:
+        evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
+        evt.SetListType(scn.listType);
+        evt.SetText(scn.text);
+        break;
+
+    case SCN_URIDROPPED:
+        evt.SetEventType(wxEVT_STC_URIDROPPED);
+        evt.SetText(scn.text);
+        break;
+
+    case SCN_DWELLSTART:
+        evt.SetEventType(wxEVT_STC_DWELLSTART);
+        evt.SetX(scn.x);
+        evt.SetY(scn.y);
+        break;
+
+    case SCN_DWELLEND:
+        evt.SetEventType(wxEVT_STC_DWELLEND);
+        evt.SetX(scn.x);
+        evt.SetY(scn.y);
+        break;
+
+    default:
+        return;
     }
+
+    GetEventHandler()->ProcessEvent(evt);
 }
 
 
@@ -1725,8 +2020,9 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
     m_message = 0;
     m_wParam = 0;
     m_lParam = 0;
-
-
+    m_listType = 0;
+    m_x = 0;
+    m_y = 0;
 }
 
 bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
@@ -1754,7 +2050,9 @@ void wxStyledTextEvent::CopyObject(wxObject& obj) const {
     o->m_wParam =        m_wParam;
     o->m_lParam =        m_lParam;
 
-
+    o->m_listType =     m_listType;
+    o->m_x =            m_x;
+    o->m_y =            m_y;
 
 }
 
index 890c97ab8abda737f0ab41da0f0f9d6f14d48125..65c88c28fb6fde30becf30b9d432ccaa753a24a0 100644 (file)
 
 int wxForceScintillaLexers(void)
 {
+  extern LexerModule lmAda;
+  extern LexerModule lmAVE;
+  extern LexerModule lmConf;
   extern LexerModule lmCPP;
+  extern LexerModule lmEiffel;
   extern LexerModule lmHTML;
-  extern LexerModule lmXML;
-  extern LexerModule lmProps;
-  extern LexerModule lmErrorList;
-  extern LexerModule lmMake;
-  extern LexerModule lmBatch;
+  extern LexerModule lmLISP;
+  extern LexerModule lmLua;
+  extern LexerModule lmBatch;  // In LexOthers.cxx
+  extern LexerModule lmPascal;
   extern LexerModule lmPerl;
   extern LexerModule lmPython;
+  extern LexerModule lmRuby;
   extern LexerModule lmSQL;
   extern LexerModule lmVB;
 
-  if (
-      &lmCPP
-      && &lmHTML
-      && &lmXML
-      && &lmProps
-      && &lmErrorList
-      && &lmMake
-      && &lmBatch
-      && &lmPerl
-      && &lmPython
-      && &lmSQL
-      && &lmVB
-      )
+  if (  &lmAda
+     && &lmAVE
+     && &lmConf
+     && &lmCPP
+     && &lmEiffel
+     && &lmHTML
+     && &lmLISP
+     && &lmLua
+     && &lmBatch
+     && &lmPascal
+     && &lmPerl
+     && &lmPython
+     && &lmRuby
+     && &lmSQL
+     && &lmVB )
     {
       return 1;
     }
@@ -66,21 +72,27 @@ int wxForceScintillaLexers(void)
 
 const wxChar* wxSTCNameStr = "stcwindow";
 
-
 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE )
 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED )
 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED )
-DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED )
 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT )
 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT )
+DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK )
+DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED )
-DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD )
 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN )
 DEFINE_EVENT_TYPE( wxEVT_STC_POSCHANGED )
+DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED )
+DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION )
+DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
+DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
+DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
+
+
 
 
 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -94,7 +106,7 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
 #endif
     EVT_MOTION                  (wxStyledTextCtrl::OnMouseMove)
     EVT_LEFT_UP                 (wxStyledTextCtrl::OnMouseLeftUp)
-    EVT_RIGHT_UP                (wxStyledTextCtrl::OnMouseRightUp)
+    EVT_CONTEXT_MENU            (wxStyledTextCtrl::OnContextMenu)
     EVT_MOUSEWHEEL              (wxStyledTextCtrl::OnMouseWheel)
     EVT_CHAR                    (wxStyledTextCtrl::OnChar)
     EVT_KEY_DOWN                (wxStyledTextCtrl::OnKeyDown)
@@ -350,8 +362,9 @@ void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
 }
 
 
-void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
+void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
     wxPoint pt = evt.GetPosition();
+    ScreenToClient(&pt.x, &pt.y);
     m_swx->DoContextMenu(Point(pt.x, pt.y));
 }
 
@@ -359,7 +372,8 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
     m_swx->DoMouseWheel(evt.GetWheelRotation(),
                         evt.GetWheelDelta(),
-                        evt.GetLinesPerAction());
+                        evt.GetLinesPerAction(),
+                        evt.ControlDown());
 }
 
 
@@ -378,10 +392,14 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
 
 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
     long key = evt.KeyCode();
-    key = toupper(key);
-    int processed = m_swx->DoKeyDown(key, evt.ShiftDown(),
-                                     evt.ControlDown(), evt.AltDown());
-    if (! processed)
+    //key = toupper(key);  //**** ????
+    bool consumed = FALSE;
+    int processed = m_swx->DoKeyDown(key,
+                                     evt.ShiftDown(),
+                                     evt.ControlDown(),
+                                     evt.AltDown(),
+                                     &consumed);
+    if (!processed && !consumed)
         evt.Skip();
 }
 
@@ -424,73 +442,110 @@ void wxStyledTextCtrl::NotifyChange() {
 
 void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
     SCNotification& scn = *_scn;
-    int eventType = 0;
+    wxStyledTextEvent evt(0, GetId());
+
+    evt.SetPosition(scn.position);
+    evt.SetKey(scn.ch);
+    evt.SetModifiers(scn.modifiers);
+
     switch (scn.nmhdr.code) {
     case SCN_STYLENEEDED:
-        eventType = wxEVT_STC_STYLENEEDED;
+        evt.SetEventType(wxEVT_STC_STYLENEEDED);
         break;
+
     case SCN_CHARADDED:
-        eventType = wxEVT_STC_CHARADDED;
-        break;
-    case SCN_UPDATEUI:
-        eventType = wxEVT_STC_UPDATEUI;
+        evt.SetEventType(wxEVT_STC_CHARADDED);
         break;
+
     case SCN_SAVEPOINTREACHED:
-        eventType = wxEVT_STC_SAVEPOINTREACHED;
+        evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
         break;
+
     case SCN_SAVEPOINTLEFT:
-        eventType = wxEVT_STC_SAVEPOINTLEFT;
+        evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
         break;
+
     case SCN_MODIFYATTEMPTRO:
-        eventType = wxEVT_STC_ROMODIFYATTEMPT;
+        evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
+        break;
+
+    case SCN_KEY:
+        evt.SetEventType(wxEVT_STC_KEY);
         break;
+
     case SCN_DOUBLECLICK:
-        eventType = wxEVT_STC_DOUBLECLICK;
+        evt.SetEventType(wxEVT_STC_DOUBLECLICK);
         break;
-    case SCN_MODIFIED:
-        eventType = wxEVT_STC_MODIFIED;
+
+    case SCN_UPDATEUI:
+        evt.SetEventType(wxEVT_STC_UPDATEUI);
         break;
-    case SCN_KEY:
-        eventType = wxEVT_STC_KEY;
+
+    case SCN_MODIFIED:
+        evt.SetEventType(wxEVT_STC_MODIFIED);
+        evt.SetModificationType(scn.modificationType);
+        if (scn.text)
+            evt.SetText(wxString(scn.text, scn.length));
+        evt.SetLength(scn.length);
+        evt.SetLinesAdded(scn.linesAdded);
+        evt.SetLine(scn.line);
+        evt.SetFoldLevelNow(scn.foldLevelNow);
+        evt.SetFoldLevelPrev(scn.foldLevelPrev);
         break;
+
     case SCN_MACRORECORD:
-        eventType = wxEVT_STC_MACRORECORD;
+        evt.SetEventType(wxEVT_STC_MACRORECORD);
+        evt.SetMessage(scn.message);
+        evt.SetWParam(scn.wParam);
+        evt.SetLParam(scn.lParam);
         break;
+
     case SCN_MARGINCLICK:
-        eventType = wxEVT_STC_MARGINCLICK;
+        evt.SetEventType(wxEVT_STC_MARGINCLICK);
+        evt.SetMargin(scn.margin);
         break;
+
     case SCN_NEEDSHOWN:
-        eventType = wxEVT_STC_NEEDSHOWN;
+        evt.SetEventType(wxEVT_STC_NEEDSHOWN);
+        evt.SetLength(scn.length);
         break;
+
     case SCN_POSCHANGED:
-        eventType = wxEVT_STC_POSCHANGED;
+        evt.SetEventType(wxEVT_STC_POSCHANGED);
+        break;
+
+    case SCN_PAINTED:
+        evt.SetEventType(wxEVT_STC_PAINTED);
+        break;
+
+    case SCN_USERLISTSELECTION:
+        evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
+        evt.SetListType(scn.listType);
+        evt.SetText(scn.text);
         break;
-    }
-    if (eventType) {
-        wxStyledTextEvent evt(eventType, GetId());
-        evt.SetPosition(scn.position);
-        evt.SetKey(scn.ch);
-        evt.SetModifiers(scn.modifiers);
-        if (eventType == wxEVT_STC_MODIFIED) {
-            evt.SetModificationType(scn.modificationType);
-            if (scn.text)
-                evt.SetText(wxString(scn.text, scn.length));
-            evt.SetLength(scn.length);
-            evt.SetLinesAdded(scn.linesAdded);
-            evt.SetLine(scn.line);
-            evt.SetFoldLevelNow(scn.foldLevelNow);
-            evt.SetFoldLevelPrev(scn.foldLevelPrev);
-        }
-        if (eventType == wxEVT_STC_MARGINCLICK)
-            evt.SetMargin(scn.margin);
-        if (eventType == wxEVT_STC_MACRORECORD) {
-            evt.SetMessage(scn.message);
-            evt.SetWParam(scn.wParam);
-            evt.SetLParam(scn.lParam);
-        }
 
-        GetEventHandler()->ProcessEvent(evt);
+    case SCN_URIDROPPED:
+        evt.SetEventType(wxEVT_STC_URIDROPPED);
+        evt.SetText(scn.text);
+        break;
+
+    case SCN_DWELLSTART:
+        evt.SetEventType(wxEVT_STC_DWELLSTART);
+        evt.SetX(scn.x);
+        evt.SetY(scn.y);
+        break;
+
+    case SCN_DWELLEND:
+        evt.SetEventType(wxEVT_STC_DWELLEND);
+        evt.SetX(scn.x);
+        evt.SetY(scn.y);
+        break;
+
+    default:
+        return;
     }
+
+    GetEventHandler()->ProcessEvent(evt);
 }
 
 
@@ -515,8 +570,9 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
     m_message = 0;
     m_wParam = 0;
     m_lParam = 0;
-
-
+    m_listType = 0;
+    m_x = 0;
+    m_y = 0;
 }
 
 bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
@@ -544,7 +600,9 @@ void wxStyledTextEvent::CopyObject(wxObject& obj) const {
     o->m_wParam =        m_wParam;
     o->m_lParam =        m_lParam;
 
-
+    o->m_listType =     m_listType;
+    o->m_x =            m_x;
+    o->m_y =            m_y;
 
 }
 
index bab374459a231a9680a379ac03b03c5371aac593..a742614327e9bcc29e3325663fb21617476bb457 100644 (file)
@@ -141,6 +141,10 @@ public:
     // Scroll enough to make the given column visible
     void ScrollToColumn(int column);
 
+
+    // Send a message to Scintilla
+    long SendMsg(int msg, long wp=0, long lp=0);
+
 //----------------------------------------------------------------------
 
 
@@ -153,7 +157,7 @@ private:
     void OnMouseLeftDown(wxMouseEvent& evt);
     void OnMouseMove(wxMouseEvent& evt);
     void OnMouseLeftUp(wxMouseEvent& evt);
-    void OnMouseRightUp(wxMouseEvent& evt);
+    void OnContextMenu(wxContextMenuEvent& evt);
     void OnMouseWheel(wxMouseEvent& evt);
     void OnChar(wxKeyEvent& evt);
     void OnKeyDown(wxKeyEvent& evt);
@@ -169,8 +173,6 @@ private:
     void NotifyChange();
     void NotifyParent(SCNotification* scn);
 
-    long SendMsg(int msg, long wp=0, long lp=0);
-
 private:
     DECLARE_EVENT_TABLE()
     DECLARE_CLASS(wxStyledTextCtrl)
@@ -205,6 +207,9 @@ public:
     void SetMessage(int val)         { m_message = val; }
     void SetWParam(int val)          { m_wParam = val; }
     void SetLParam(int val)          { m_lParam = val; }
+    void SetListType(int val)        { m_listType = val; }
+    void SetX(int val)               { m_x = val; }
+    void SetY(int val)               { m_y = val; }
 
     int  GetPosition() const         { return m_position; }
     int  GetKey()  const             { return m_key; }
@@ -220,6 +225,9 @@ public:
     int  GetMessage() const          { return m_message; }
     int  GetWParam() const           { return m_wParam; }
     int  GetLParam() const           { return m_lParam; }
+    int  GetListType() const         { return m_listType; }
+    int  GetX() const                { return m_x; }
+    int  GetY() const                { return m_y; }
 
     bool GetShift() const;
     bool GetControl() const;
@@ -248,42 +256,56 @@ private:
     int  m_message;             // wxEVT_STC_MACRORECORD
     int  m_wParam;
     int  m_lParam;
+
+    int m_listType;
+    int m_x;
+    int m_y;
 #endif
 };
 
 #ifndef SWIG
 BEGIN_DECLARE_EVENT_TYPES()
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED, 1651)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED, 1652)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI, 1653)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED, 1654)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT, 1655)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT, 1656)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK, 1657)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED, 1658)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY, 1659)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD, 1660)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK, 1661)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN, 1662)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED, 1663)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE,                  1650)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED,             1651)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED,               1652)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED,        1653)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT,           1654)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT,         1655)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY,                     1656)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK,             1657)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI,                1658)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED,                1659)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD,             1660)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK,             1661)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN,               1662)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED,              1663)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_PAINTED,                 1664)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_USERLISTSELECTION,       1665)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED,              1666)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART,              1667)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND,                1668)
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
         wxEVT_STC_CHANGE,
         wxEVT_STC_STYLENEEDED,
         wxEVT_STC_CHARADDED,
-        wxEVT_STC_UPDATEUI,
         wxEVT_STC_SAVEPOINTREACHED,
         wxEVT_STC_SAVEPOINTLEFT,
         wxEVT_STC_ROMODIFYATTEMPT,
+        wxEVT_STC_KEY,
         wxEVT_STC_DOUBLECLICK,
+        wxEVT_STC_UPDATEUI,
         wxEVT_STC_MODIFIED,
-        wxEVT_STC_KEY,
         wxEVT_STC_MACRORECORD,
         wxEVT_STC_MARGINCLICK,
         wxEVT_STC_NEEDSHOWN,
-        wxEVT_STC_POSCHANGED
+        wxEVT_STC_POSCHANGED,
+        wxEVT_STC_PAINTED,
+        wxEVT_STC_USERLISTSELECTION,
+        wxEVT_STC_URIDROPPED,
+        wxEVT_STC_DWELLSTART,
+        wxEVT_STC_DWELLEND,
     };
 #endif
 
@@ -292,20 +314,26 @@ END_DECLARE_EVENT_TYPES()
 #ifndef SWIG
 typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 
-#define EVT_STC_CHANGE(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_STYLENEEDED(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_CHARADDED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_UPDATEUI(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_SAVEPOINTLEFT(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_ROMODIFYATTEMPT(id, fn)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_DOUBLECLICK(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MODIFIED(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_KEY(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MACRORECORD(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MARGINCLICK(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_NEEDSHOWN(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_POSCHANGED(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_CHANGE(id, fn)                  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE,                id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_STYLENEEDED(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_CHARADDED(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTREACHED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED,      id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTLEFT(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT,         id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ROMODIFYATTEMPT(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT,       id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_KEY(id, fn)                     DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY,                   id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DOUBLECLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_UPDATEUI(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MODIFIED(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MACRORECORD(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MARGINCLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_NEEDSHOWN(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_POSCHANGED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_PAINTED(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED,               id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_USERLISTSELECTION(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION,     id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_URIDROPPED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DWELLSTART(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DWELLEND(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+
 
 #endif
 
index f9b26bdb8ac3ca535fc29cfff40ab3956313865a..8dfe9a92f469b43ae27d631b00c5870bdb850e48 100644 (file)
 #define wxSTC_MARK_ARROWDOWN 6
 #define wxSTC_MARK_MINUS 7
 #define wxSTC_MARK_PLUS 8
+
+// Shapes used for outlining column
+#define wxSTC_MARK_VLINE 9
+#define wxSTC_MARK_LCORNER 10
+#define wxSTC_MARK_TCORNER 11
+#define wxSTC_MARK_BOXPLUS 12
+#define wxSTC_MARK_BOXPLUSCONNECTED 13
+#define wxSTC_MARK_BOXMINUS 14
+#define wxSTC_MARK_BOXMINUSCONNECTED 15
+#define wxSTC_MARK_LCORNERCURVE 16
+#define wxSTC_MARK_TCORNERCURVE 17
+#define wxSTC_MARK_CIRCLEPLUS 18
+#define wxSTC_MARK_CIRCLEPLUSCONNECTED 19
+#define wxSTC_MARK_CIRCLEMINUS 20
+#define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
+
+// Markers used for outlining column
+#define wxSTC_MARKNUM_FOLDEREND 25
+#define wxSTC_MARKNUM_FOLDEROPENMID 26
+#define wxSTC_MARKNUM_FOLDERMIDTAIL 27
+#define wxSTC_MARKNUM_FOLDERTAIL 28
+#define wxSTC_MARKNUM_FOLDERSUB 29
 #define wxSTC_MARKNUM_FOLDER 30
 #define wxSTC_MARKNUM_FOLDEROPEN 31
 #define wxSTC_MARGIN_SYMBOL 0
 #define wxSTC_CHARSET_ARABIC 178
 #define wxSTC_CHARSET_VIETNAMESE 163
 #define wxSTC_CHARSET_THAI 222
+#define wxSTC_CASE_MIXED 0
+#define wxSTC_CASE_UPPER 1
+#define wxSTC_CASE_LOWER 2
 #define wxSTC_INDIC_MAX 7
 #define wxSTC_INDIC_PLAIN 0
 #define wxSTC_INDIC_SQUIGGLE 1
 
 // PrintColourMode - force black text on white background for printing.
 #define wxSTC_PRINT_BLACKONWHITE 2
-#define wxSTC_FIND_DOWN 1
+
+// PrintColourMode - text stays coloured, but all background is forced to be white for printing.
+#define wxSTC_PRINT_COLOURONWHITE 3
+
+// PrintColourMode - only the default-background is forced to be white for printing.
+#define wxSTC_PRINT_COLOURONWHITEDEFAULTBG 4
 #define wxSTC_FIND_WHOLEWORD 2
 #define wxSTC_FIND_MATCHCASE 4
 #define wxSTC_FIND_WORDSTART 0x00100000
-
-// SCFIND_REGEXP is not yet implemented.
 #define wxSTC_FIND_REGEXP 0x00200000
 #define wxSTC_CMD_UNDO 2176
 #define wxSTC_CMD_CUT 2177
 #define wxSTC_FOLDLEVELWHITEFLAG 0x1000
 #define wxSTC_FOLDLEVELHEADERFLAG 0x2000
 #define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF
+#define wxSTC_TIME_FOREVER 10000000
 #define wxSTC_CMD_LINEDOWN 2300
 #define wxSTC_CMD_LINEDOWNEXTEND 2301
 #define wxSTC_CMD_LINEUP 2302
 #define wxSTC_EDGE_BACKGROUND 2
 
 // Show caret within N lines of edge when it's scrolled to view
+// If CARET_SLOP not set then centre caret on screen when it's
+// scrolled to view
 #define wxSTC_CARET_SLOP 0x01
 
-// Center caret on screen when it's scrolled to view
+// Value not used
 #define wxSTC_CARET_CENTER 0x02
 
-// OR this with CARET_CENTER to reposition even when visible, or
-// OR this with CARET_SLOP to reposition whenever outside slop border
+// If CARET_SLOP also set then reposition whenever outside slop border
+// If CARET_SLOP not set then recentre even when visible
 #define wxSTC_CARET_STRICT 0x04
 
+// If CARET_XEVEN set then both left and right margins are given equal weight
+// rather than favouring left following behaviour.
+#define wxSTC_CARET_XEVEN 0x08
+
+// If CARET_XJUMPS set then when caret reaches the margin the display jumps
+// enough to leave the caret solidly within the display.
+#define wxSTC_CARET_XJUMPS 0x10
+#define wxSTC_CURSORNORMAL -1
+#define wxSTC_CURSORWAIT 3
+
+// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
+#define wxSTC_VISIBLE_SLOP 0x01
+#define wxSTC_VISIBLE_STRICT 0x04
+
 // Notifications
 // Type of modification and the action which caused the modification
 // These are defined as a bit mask to make it easy to specify which notifications are wanted.
 #define wxSTC_LEX_LATEX 14
 #define wxSTC_LEX_LUA 15
 #define wxSTC_LEX_DIFF 16
+#define wxSTC_LEX_CONF 17
+#define wxSTC_LEX_PASCAL 18
+#define wxSTC_LEX_AVE 19
+#define wxSTC_LEX_ADA 20
+#define wxSTC_LEX_LISP 21
+#define wxSTC_LEX_RUBY 22
+#define wxSTC_LEX_EIFFEL 23
+#define wxSTC_LEX_EIFFELKW 24
+#define wxSTC_LEX_TCL 25
+
+// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
+// value assigned in sequence from SCLEX_AUTOMATIC+1.
+#define wxSTC_LEX_AUTOMATIC 1000
 
 // Lexical states for SCLEX_PYTHON
 #define wxSTC_P_DEFAULT 0
 #define wxSTC_C_IDENTIFIER 11
 #define wxSTC_C_STRINGEOL 12
 #define wxSTC_C_VERBATIM 13
+#define wxSTC_C_REGEX 14
+#define wxSTC_C_COMMENTLINEDOC 15
+#define wxSTC_C_WORD2 16
 
 // Lexical states for SCLEX_HTML, SCLEX_XML
 #define wxSTC_H_DEFAULT 0
 // More HTML
 #define wxSTC_H_VALUE 19
 
+// X-Code
+#define wxSTC_H_XCCOMMENT 20
+
+// SGML
+#define wxSTC_H_SGML 21
+
 // Embedded Javascript
 #define wxSTC_HJ_START 40
 #define wxSTC_HJ_DEFAULT 41
 #define wxSTC_HJ_SINGLESTRING 49
 #define wxSTC_HJ_SYMBOLS 50
 #define wxSTC_HJ_STRINGEOL 51
+#define wxSTC_HJ_REGEX 52
 
 // ASP Javascript
 #define wxSTC_HJA_START 55
 #define wxSTC_HJA_SINGLESTRING 64
 #define wxSTC_HJA_SYMBOLS 65
 #define wxSTC_HJA_STRINGEOL 66
+#define wxSTC_HJA_REGEX 67
 
 // Embedded VBScript
 #define wxSTC_HB_START 70
 #define wxSTC_HPHP_VARIABLE 123
 #define wxSTC_HPHP_COMMENT 124
 #define wxSTC_HPHP_COMMENTLINE 125
-#define wxSTC_HPHP_STRINGEOL 126
+#define wxSTC_HPHP_HSTRING_VARIABLE 126
+#define wxSTC_HPHP_OPERATOR 127
 
 // Lexical states for SCLEX_PERL
 #define wxSTC_PL_DEFAULT 0
-#define wxSTC_PL_HERE 1
+#define wxSTC_PL_ERROR 1
 #define wxSTC_PL_COMMENTLINE 2
 #define wxSTC_PL_POD 3
 #define wxSTC_PL_NUMBER 4
 #define wxSTC_PL_ARRAY 13
 #define wxSTC_PL_HASH 14
 #define wxSTC_PL_SYMBOLTABLE 15
-#define wxSTC_PL_REF 16
 #define wxSTC_PL_REGEX 17
 #define wxSTC_PL_REGSUBST 18
 #define wxSTC_PL_LONGQUOTE 19
 #define wxSTC_PL_BACKTICKS 20
 #define wxSTC_PL_DATASECTION 21
+#define wxSTC_PL_HERE_DELIM 22
+#define wxSTC_PL_HERE_Q 23
+#define wxSTC_PL_HERE_QQ 24
+#define wxSTC_PL_HERE_QX 25
+#define wxSTC_PL_STRING_Q 26
+#define wxSTC_PL_STRING_QQ 27
+#define wxSTC_PL_STRING_QX 28
+#define wxSTC_PL_STRING_QR 29
+#define wxSTC_PL_STRING_QW 30
 
 // Lexical states for SCLEX_LATEX
 #define wxSTC_L_DEFAULT 0
 #define wxSTC_LUA_OPERATOR 10
 #define wxSTC_LUA_IDENTIFIER 11
 #define wxSTC_LUA_STRINGEOL 12
+
+// Lexical states for SCLEX_ERRORLIST
 #define wxSTC_ERR_DEFAULT 0
 #define wxSTC_ERR_PYTHON 1
 #define wxSTC_ERR_GCC 2
 #define wxSTC_ERR_CMD 4
 #define wxSTC_ERR_BORLAND 5
 #define wxSTC_ERR_PERL 6
+#define wxSTC_ERR_NET 7
+#define wxSTC_ERR_LUA 8
+#define wxSTC_ERR_DIFF_CHANGED 10
+#define wxSTC_ERR_DIFF_ADDITION 11
+#define wxSTC_ERR_DIFF_DELETION 12
+#define wxSTC_ERR_DIFF_MESSAGE 13
+
+// Lexical states for SCLEX_BATCH
+#define wxSTC_BAT_DEFAULT 0
+#define wxSTC_BAT_COMMENT 1
+#define wxSTC_BAT_WORD 2
+#define wxSTC_BAT_LABEL 3
+#define wxSTC_BAT_HIDE 4
+#define wxSTC_BAT_COMMAND 5
+#define wxSTC_BAT_IDENTIFIER 6
+#define wxSTC_BAT_OPERATOR 7
+
+// Lexical states for SCLEX_MAKEFILE
+#define wxSTC_MAKE_DEFAULT 0
+#define wxSTC_MAKE_COMMENT 1
+#define wxSTC_MAKE_PREPROCESSOR 2
+#define wxSTC_MAKE_IDENTIFIER 3
+#define wxSTC_MAKE_OPERATOR 4
+#define wxSTC_MAKE_TARGET 5
+#define wxSTC_MAKE_IDEOL 9
+
+// Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+#define wxSTC_CONF_DEFAULT 0
+#define wxSTC_CONF_COMMENT 1
+#define wxSTC_CONF_NUMBER 2
+#define wxSTC_CONF_IDENTIFIER 3
+#define wxSTC_CONF_EXTENSION 4
+#define wxSTC_CONF_PARAMETER 5
+#define wxSTC_CONF_STRING 6
+#define wxSTC_CONF_OPERATOR 7
+#define wxSTC_CONF_IP 8
+#define wxSTC_CONF_DIRECTIVE 9
+
+// Avenue
+#define wxSTC_AVE_DEFAULT 0
+#define wxSTC_AVE_COMMENT 1
+#define wxSTC_AVE_NUMBER 2
+#define wxSTC_AVE_WORD 3
+#define wxSTC_AVE_KEYWORD 4
+#define wxSTC_AVE_STATEMENT 5
+#define wxSTC_AVE_STRING 6
+#define wxSTC_AVE_ENUM 7
+#define wxSTC_AVE_STRINGEOL 8
+#define wxSTC_AVE_IDENTIFIER 9
+#define wxSTC_AVE_OPERATOR 10
+
+// Lexical states for SCLEX_ADA
+#define wxSTC_ADA_DEFAULT 0
+#define wxSTC_ADA_COMMENT 1
+#define wxSTC_ADA_NUMBER 2
+#define wxSTC_ADA_WORD 3
+#define wxSTC_ADA_STRING 4
+#define wxSTC_ADA_CHARACTER 5
+#define wxSTC_ADA_OPERATOR 6
+#define wxSTC_ADA_IDENTIFIER 7
+#define wxSTC_ADA_STRINGEOL 8
+
+// Lexical states for SCLEX_LISP
+#define wxSTC_LISP_DEFAULT 0
+#define wxSTC_LISP_COMMENT 1
+#define wxSTC_LISP_NUMBER 2
+#define wxSTC_LISP_KEYWORD 3
+#define wxSTC_LISP_STRING 6
+#define wxSTC_LISP_STRINGEOL 8
+#define wxSTC_LISP_IDENTIFIER 9
+#define wxSTC_LISP_OPERATOR 10
+
+// Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+#define wxSTC_EIFFEL_DEFAULT 0
+#define wxSTC_EIFFEL_COMMENTLINE 1
+#define wxSTC_EIFFEL_NUMBER 2
+#define wxSTC_EIFFEL_WORD 3
+#define wxSTC_EIFFEL_STRING 4
+#define wxSTC_EIFFEL_CHARACTER 5
+#define wxSTC_EIFFEL_OPERATOR 6
+#define wxSTC_EIFFEL_IDENTIFIER 7
+#define wxSTC_EIFFEL_STRINGEOL 8
 
 // END of generated section
 //----------------------------------------------------------------------
@@ -556,6 +718,10 @@ public:
     // Find the position from a point within the window.
     int PositionFromPoint(wxPoint pt);
 
+    // Find the position from a point within the window but return
+    // INVALID_POSITION if not close to text.
+    int PositionFromPointClose(int x, int y);
+
     // Set caret to start of a line and ensure it is visible.
     void GotoLine(int line);
 
@@ -573,8 +739,8 @@ public:
     // Retrieve the position of the last correctly styled character.
     int GetEndStyled();
 
-    // Convert all line endings in the document to use the current mode.
-    void ConvertEOLs();
+    // Convert all line endings in the document to one mode.
+    void ConvertEOLs(int eolMode);
 
     // Retrieve the current end of line mode - one of CRLF, CR, or LF.
     int GetEOLMode();
@@ -693,6 +859,9 @@ public:
     // Set a style to be underlined or not.
     void StyleSetUnderline(int style, bool underline);
 
+    // Set a style to be mixed case, or to force upper or lower case.
+    void StyleSetCase(int style, int caseForce);
+
     // Set the foreground colour of the selection and whether to use this setting.
     void SetSelForeground(bool useSetting, const wxColour& fore);
 
@@ -763,6 +932,18 @@ public:
     // Retrieve the last line number that has line state.
     int GetMaxLineState();
 
+    // Is the background of the line containing the caret in a different colour?
+    bool GetCaretLineVisible();
+
+    // Display the background of the line containing the caret in a different colour.
+    void SetCaretLineVisible(bool show);
+
+    // Get the colour of the background of the line containing the caret.
+    wxColour GetCaretLineBack();
+
+    // Set the colour of the background of the line containing the caret.
+    void SetCaretLineBack(const wxColour& back);
+
     // Display a auto-completion list.
     // The lenEntered parameter indicates how many characters before
     // the caret should be used to provide context.
@@ -816,6 +997,15 @@ public:
     // Retrieve state of ignore case flag.
     bool AutoCompGetIgnoreCase();
 
+    // Display a list of strings and send notification when user chooses one.
+    void UserListShow(int listType, const wxString& itemList);
+
+    // Set whether or not autocompletion is hidden automatically when nothing matches
+    void AutoCompSetAutoHide(bool autoHide);
+
+    // Retrieve whether or not autocompletion is hidden automatically when nothing matches
+    bool AutoCompGetAutoHide();
+
     // Set the number of spaces used for one level of indentation.
     void SetIndent(int indentSize);
 
@@ -923,13 +1113,13 @@ public:
     int GetLineCount();
 
     // Sets the size in pixels of the left margin.
-    void SetMarginLeft(int width);
+    void SetMarginLeft(int pixelWidth);
 
     // Returns the size in pixels of the left margin.
     int GetMarginLeft();
 
     // Sets the size in pixels of the right margin.
-    void SetMarginRight(int width);
+    void SetMarginRight(int pixelWidth);
 
     // Returns the size in pixels of the right margin.
     int GetMarginRight();
@@ -1006,6 +1196,48 @@ public:
     // Returns true if overtype mode is active otherwise false is returned.
     bool GetOvertype();
 
+    // Set the width of the insert mode caret
+    void SetCaretWidth(int pixelWidth);
+
+    // Returns the width of the insert mode caret
+    int GetCaretWidth();
+
+    // Sets the position that starts the target which is used for updating the
+    // document without affecting the scroll position.
+    void SetTargetStart(int pos);
+
+    // Get the position that starts the target.
+    int GetTargetStart();
+
+    // Sets the position that ends the target which is used for updating the
+    // document without affecting the scroll position.
+    void SetTargetEnd(int pos);
+
+    // Get the position that ends the target.
+    int GetTargetEnd();
+
+    // Replace the target text with the argument text.
+    // Returns the length of the replacement text.
+    int ReplaceTarget(const wxString& text);
+
+    // Replace the target text with the argument text after \d processing.
+    // Looks for \d where d is between 1 and 9 and replaces these with the strings
+    // matched in the last search operation which were surrounded by \( and \).
+    // Returns the length of the replacement text including any change
+    // caused by processing the \d patterns.
+    int ReplaceTargetRE(const wxString& text);
+
+    // Search for a counted string in the target and set the target to the found
+    // range.
+    // Returns length of range or -1 for failure in which case target is not moved.
+    int SearchInTarget(const wxString& text);
+
+    // Set the search flags used by SearchInTarget
+    void SetSearchFlags(int flags);
+
+    // Get the search flags used by SearchInTarget
+    int GetSearchFlags();
+
     // Show a call tip containing a definition near position pos.
     void CallTipShow(int pos, const wxString& definition);
 
@@ -1068,6 +1300,31 @@ public:
     // Set some debugging options for folding
     void SetFoldFlags(int flags);
 
+    // Ensure a particular line is visible by expanding any header line hiding it.
+    // Use the currently set visibility policy to determine which range to display.
+    void EnsureVisibleEnforcePolicy(int line);
+
+    // Sets whether a tab pressed when caret is within indentation indents
+    void SetTabIndents(bool tabIndents);
+
+    // Does a tab pressed when caret is within indentation indent?
+    bool GetTabIndents();
+
+    // Sets whether a backspace pressed when caret is within indentation unindents
+    void SetBackSpaceUnIndents(bool bsUnIndents);
+
+    // Does a backspace pressed when caret is within indentation unindent?
+    bool GetBackSpaceUnIndents();
+
+    // Sets the time the mouse must sit still to generate a mouse dwell event
+    void SetMouseDwellTime(int periodMilliseconds);
+
+    // Retrieve the time the mouse must sit still to generate a mouse dwell event
+    int GetMouseDwellTime();
+
+    // Move the caret inside current view if it's not there already
+    void MoveCaretInsideView();
+
     // How many characters are on a line, not including end of line characters.
     int LineLength(int line);
 
@@ -1119,9 +1376,11 @@ public:
     void SearchAnchor();
 
     // Find some text starting at the search anchor.
+    // Does not ensure the selection is visible.
     int SearchNext(int flags, const wxString& text);
 
     // Find some text starting at the search anchor and moving backwards.
+    // Does not ensure the selection is visible.
     int SearchPrev(int flags, const wxString& text);
 
     // Set the way the line the caret is on is kept visible.
@@ -1157,6 +1416,51 @@ public:
     // Get which document modification events are sent to the container.
     int GetModEventMask();
 
+    // Change internal focus flag
+    void SetFocus(bool focus);
+
+    // Get internal focus flag
+    bool GetFocus();
+
+    // Change error status - 0 = OK
+    void SetStatus(int statusCode);
+
+    // Get error status
+    int GetStatus();
+
+    // Set whether the mouse is captured when its button is pressed
+    void SetMouseDownCaptures(bool captures);
+
+    // Get whether mouse gets captured
+    bool GetMouseDownCaptures();
+
+    // Sets the cursor to one of the SC_CURSOR* values
+    void SetCursor(int cursorType);
+
+    // Get cursor type
+    int GetCursor();
+
+    // Move to the previous change in capitalistion
+    void WordPartLeft();
+
+    // Move to the previous change in capitalistion extending selection to new caret position.
+    void WordPartLeftExtend();
+
+    // Move to the change next in capitalistion
+    void WordPartRight();
+
+    // Move to the next change in capitalistion extending selection to new caret position.
+    void WordPartRightExtend();
+
+    // Set the way the display area is determined when a particular line is to be moved to.
+    void SetVisiblePolicy(int visiblePolicy, int visibleSlop);
+
+    // Delete back from the current position to the start of the line
+    void DelLineLeft();
+
+    // Delete forwards from the current position to the end of the line
+    void DelLineRight();
+
     // Start notifying the container of all key presses and commands.
     void StartRecord();
 
@@ -1178,6 +1482,9 @@ public:
     // Set up the key words used by the lexer.
     void SetKeyWords(int keywordSet, const wxString& keyWords);
 
+    // Set the lexing language of the document based on string name.
+    void SetLexerLanguage(const wxString& language);
+
 // END of generated section
 //----------------------------------------------------------------------
 // Others...
@@ -1243,6 +1550,10 @@ public:
     // Scroll enough to make the given column visible
     void ScrollToColumn(int column);
 
+
+    // Send a message to Scintilla
+    long SendMsg(int msg, long wp=0, long lp=0);
+
 //----------------------------------------------------------------------
 
 
@@ -1255,7 +1566,7 @@ private:
     void OnMouseLeftDown(wxMouseEvent& evt);
     void OnMouseMove(wxMouseEvent& evt);
     void OnMouseLeftUp(wxMouseEvent& evt);
-    void OnMouseRightUp(wxMouseEvent& evt);
+    void OnContextMenu(wxContextMenuEvent& evt);
     void OnMouseWheel(wxMouseEvent& evt);
     void OnChar(wxKeyEvent& evt);
     void OnKeyDown(wxKeyEvent& evt);
@@ -1271,8 +1582,6 @@ private:
     void NotifyChange();
     void NotifyParent(SCNotification* scn);
 
-    long SendMsg(int msg, long wp=0, long lp=0);
-
 private:
     DECLARE_EVENT_TABLE()
     DECLARE_CLASS(wxStyledTextCtrl)
@@ -1307,6 +1616,9 @@ public:
     void SetMessage(int val)         { m_message = val; }
     void SetWParam(int val)          { m_wParam = val; }
     void SetLParam(int val)          { m_lParam = val; }
+    void SetListType(int val)        { m_listType = val; }
+    void SetX(int val)               { m_x = val; }
+    void SetY(int val)               { m_y = val; }
 
     int  GetPosition() const         { return m_position; }
     int  GetKey()  const             { return m_key; }
@@ -1322,6 +1634,9 @@ public:
     int  GetMessage() const          { return m_message; }
     int  GetWParam() const           { return m_wParam; }
     int  GetLParam() const           { return m_lParam; }
+    int  GetListType() const         { return m_listType; }
+    int  GetX() const                { return m_x; }
+    int  GetY() const                { return m_y; }
 
     bool GetShift() const;
     bool GetControl() const;
@@ -1350,42 +1665,56 @@ private:
     int  m_message;             // wxEVT_STC_MACRORECORD
     int  m_wParam;
     int  m_lParam;
+
+    int m_listType;
+    int m_x;
+    int m_y;
 #endif
 };
 
 #ifndef SWIG
 BEGIN_DECLARE_EVENT_TYPES()
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED, 1651)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED, 1652)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI, 1653)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED, 1654)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT, 1655)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT, 1656)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK, 1657)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED, 1658)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY, 1659)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD, 1660)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK, 1661)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN, 1662)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED, 1663)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE,                  1650)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED,             1651)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED,               1652)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED,        1653)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT,           1654)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT,         1655)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY,                     1656)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK,             1657)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI,                1658)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED,                1659)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD,             1660)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK,             1661)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN,               1662)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED,              1663)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_PAINTED,                 1664)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_USERLISTSELECTION,       1665)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED,              1666)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART,              1667)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND,                1668)
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
         wxEVT_STC_CHANGE,
         wxEVT_STC_STYLENEEDED,
         wxEVT_STC_CHARADDED,
-        wxEVT_STC_UPDATEUI,
         wxEVT_STC_SAVEPOINTREACHED,
         wxEVT_STC_SAVEPOINTLEFT,
         wxEVT_STC_ROMODIFYATTEMPT,
+        wxEVT_STC_KEY,
         wxEVT_STC_DOUBLECLICK,
+        wxEVT_STC_UPDATEUI,
         wxEVT_STC_MODIFIED,
-        wxEVT_STC_KEY,
         wxEVT_STC_MACRORECORD,
         wxEVT_STC_MARGINCLICK,
         wxEVT_STC_NEEDSHOWN,
-        wxEVT_STC_POSCHANGED
+        wxEVT_STC_POSCHANGED,
+        wxEVT_STC_PAINTED,
+        wxEVT_STC_USERLISTSELECTION,
+        wxEVT_STC_URIDROPPED,
+        wxEVT_STC_DWELLSTART,
+        wxEVT_STC_DWELLEND,
     };
 #endif
 
@@ -1394,20 +1723,26 @@ END_DECLARE_EVENT_TYPES()
 #ifndef SWIG
 typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 
-#define EVT_STC_CHANGE(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_STYLENEEDED(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_CHARADDED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_UPDATEUI(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_SAVEPOINTLEFT(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_ROMODIFYATTEMPT(id, fn)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_DOUBLECLICK(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MODIFIED(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_KEY(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MACRORECORD(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MARGINCLICK(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_NEEDSHOWN(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_POSCHANGED(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_CHANGE(id, fn)                  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE,                id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_STYLENEEDED(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_CHARADDED(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTREACHED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED,      id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTLEFT(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT,         id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ROMODIFYATTEMPT(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT,       id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_KEY(id, fn)                     DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY,                   id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DOUBLECLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_UPDATEUI(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MODIFIED(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MACRORECORD(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MARGINCLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_NEEDSHOWN(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_POSCHANGED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_PAINTED(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED,               id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_USERLISTSELECTION(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION,     id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_URIDROPPED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DWELLSTART(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DWELLEND(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+
 
 #endif
 
index 2b478141af6e6ddc62f8e84c00752f15b7665240..862d16456d3fe6e6c3e71267cf1326033f267aa3 100644 (file)
@@ -112,6 +112,8 @@ Font::~Font() {
 }
 
 void Font::Create(const char *faceName, int characterSet, int size, bool bold, bool italic) {
+    // TODO:  what to do about the characterSet?
+
     Release();
     id = new wxFont(size,
                     wxDEFAULT,
@@ -161,13 +163,11 @@ void Surface::Init() {
     Release();
     hdc = new wxMemoryDC();
     hdcOwned = true;
-    // **** ::SetTextAlign(hdc, TA_BASELINE);
 }
 
 void Surface::Init(SurfaceID hdc_) {
     Release();
     hdc = hdc_;
-    // **** ::SetTextAlign(hdc, TA_BASELINE);
 }
 
 void Surface::InitPixMap(int width, int height, Surface *surface_) {
@@ -176,7 +176,6 @@ void Surface::InitPixMap(int width, int height, Surface *surface_) {
     hdcOwned = true;
     bitmap = new wxBitmap(width, height);
     ((wxMemoryDC*)hdc)->SelectObject(*bitmap);
-    // **** ::SetTextAlign(hdc, TA_BASELINE);
 }
 
 void Surface::PenColour(Colour fore) {
@@ -353,7 +352,7 @@ int Surface::AverageCharWidth(Font &font) {
 }
 
 int Surface::SetPalette(Palette *pal, bool inBackGround) {
-    return 0;  // **** figure out what to do with palettes...
+    return 0;
 }
 
 void Surface::SetClip(PRectangle rc) {
@@ -697,6 +696,36 @@ void Platform::DebugPrintf(const char *format, ...) {
 #endif
 }
 
+
+static bool assertionPopUps = true;
+
+bool Platform::ShowAssertionPopUps(bool assertionPopUps_) {
+       bool ret = assertionPopUps;
+       assertionPopUps = assertionPopUps_;
+       return ret;
+}
+
+void Platform::Assert(const char *c, const char *file, int line) {
+       char buffer[2000];
+       sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line);
+       if (assertionPopUps) {
+               int idButton = wxMessageBox(buffer, "Assertion failure",
+                                            wxICON_HAND | wxOK);
+//             if (idButton == IDRETRY) {
+//                     ::DebugBreak();
+//             } else if (idButton == IDIGNORE) {
+//                     // all OK
+//             } else {
+//                     abort();
+//             }
+       } else {
+               strcat(buffer, "\r\n");
+               Platform::DebugDisplay(buffer);
+               abort();
+       }
+}
+
+
 int Platform::Clamp(int val, int minVal, int maxVal) {
     if (val > maxVal)
         val = maxVal;
index 30a896b9038e23101c679210c62bbc41d09b5269..127c172a909523365d4a076007c35b78ab1b381c 100644 (file)
@@ -93,7 +93,6 @@ END_EVENT_TABLE()
 ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
     capturedMouse = false;
     wMain = win;
-    wDraw = win;
     stc   = win;
     wheelRotation = 0;
     Initialise();
@@ -170,8 +169,8 @@ bool ScintillaWX::HaveMouseCapture() {
 
 void ScintillaWX::ScrollText(int linesToMove) {
     int dy = vs.lineHeight * (linesToMove);
-    // TODO: calculate the rectangle to refreshed...
     wMain.GetID()->ScrollWindow(0, dy);
+    wMain.GetID()->Update();
 }
 
 void ScintillaWX::SetVerticalScrollPos() {
@@ -261,7 +260,7 @@ bool ScintillaWX::CanPaste() {
 }
 
 void ScintillaWX::CreateCallTipWindow(PRectangle) {
-    ct.wCallTip = new wxSTCCallTip(wDraw.GetID(), -1, &ct);
+    ct.wCallTip = new wxSTCCallTip(wMain.GetID(), -1, &ct);
     ct.wDraw = ct.wCallTip;
 }
 
@@ -365,17 +364,27 @@ void ScintillaWX::DoVScroll(int type, int pos) {
 }
 
 
-void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction) {
+void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown) {
     int topLineNew = topLine;
     int lines;
 
-    wheelRotation += rotation;
-    lines = wheelRotation / delta;
-    wheelRotation -= lines * delta;
-    if (lines != 0) {
-        lines *= linesPerAction;
-        topLineNew -= lines;
-        ScrollTo(topLineNew);
+    if (ctrlDown) {  // Zoom the fonts if Ctrl key down
+        if (rotation < 0) {
+            KeyCommand(SCI_ZOOMIN);
+        }
+        else {
+            KeyCommand(SCI_ZOOMOUT);
+        }
+    }
+    else { // otherwise just scroll the window
+        wheelRotation += rotation;
+        lines = wheelRotation / delta;
+        wheelRotation -= lines * delta;
+        if (lines != 0) {
+            lines *= linesPerAction;
+            topLineNew -= lines;
+            ScrollTo(topLineNew);
+        }
     }
 }
 
@@ -387,11 +396,11 @@ void ScintillaWX::DoSize(int width, int height) {
 }
 
 void ScintillaWX::DoLoseFocus(){
-    DropCaret();
+    SetFocusState(false);
 }
 
 void ScintillaWX::DoGainFocus(){
-    ShowCaretAtCurrentPosition();
+    SetFocusState(true);
 }
 
 void ScintillaWX::DoSysColourChange() {
@@ -418,7 +427,7 @@ void ScintillaWX::DoAddChar(char ch) {
     //    AutoCompleteChanged(ch);
 }
 
-int  ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) {
+int  ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) {
     switch (key) {
         case WXK_DOWN: key = SCK_DOWN; break;
         case WXK_UP: key = SCK_UP; break;
@@ -442,7 +451,7 @@ int  ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) {
         case WXK_SHIFT: key = 0; break;
     }
 
-    return KeyDown(key, shift, ctrl, alt);
+    return KeyDown(key, shift, ctrl, alt, consumed);
 }
 
 
index fdd4f98dbdf3e8d6e882fcc208c75d22ed06436c..00528bcd0a4e3d03577760c5b29e7c4d1eb212c0 100644 (file)
@@ -119,9 +119,9 @@ public:
     void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
     void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
     void DoButtonMove(Point pt);
-    void DoMouseWheel(int rotation, int delta, int linesPerAction);
+    void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown);
     void DoAddChar(char ch);
-    int  DoKeyDown(int key, bool shift, bool ctrl, bool alt);
+    int  DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
     void DoTick() { Tick(); }
 
     bool DoDropText(long x, long y, const wxString& data);
index eba0f3c586333492ff94dbbb753f602f8d47db2f..e198bdc6e0af7d48d44406324283e45e2d8d45bd 100644 (file)
 #----------------------------------------------------------------------------
 
 
-import sys, string, re
+import sys, string, re, os
 from fileinput import FileInput
 
 
-IFACE         = './scintilla/include/Scintilla.iface'
-H_TEMPLATE    = './stc.h.in'
-CPP_TEMPLATE  = './stc.cpp.in'
-H_DEST        = '../../include/wx/stc/stc.h'
-CPP_DEST      = './stc.cpp'
+IFACE         = os.path.abspath('./scintilla/include/Scintilla.iface')
+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')
 
 
 # Value prefixes to convert
@@ -215,6 +215,9 @@ methodOverrideMap = {
     'AutoCGetChooseSingle' : ('AutoCompGetChooseSingle', 0, 0, 0),
     'AutoCSetIgnoreCase' : ('AutoCompSetIgnoreCase', 0, 0, 0),
     'AutoCGetIgnoreCase' : ('AutoCompGetIgnoreCase', 0, 0, 0),
+    'AutoCSetAutoHide' : ('AutoCompSetAutoHide', 0, 0, 0),
+    'AutoCGetAutoHide' : ('AutoCompGetAutoHide', 0, 0, 0),
+
 
     'SetHScrollBar' : ('SetUseHorizontalScrollBar', 0, 0, 0),
     'GetHScrollBar' : ('GetUseHorizontalScrollBar', 0, 0, 0),
@@ -360,6 +363,38 @@ methodOverrideMap = {
     'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0),
 
 
+    'ReplaceTarget' : (0,
+                       'int %s(const wxString& text);',
+
+                       '''
+                       int %s(const wxString& text) {
+                           return SendMsg(%s, text.Len(), (long)text.c_str());
+                       ''',
+
+                       0),
+
+    'ReplaceTargetRE' : (0,
+                       'int %s(const wxString& text);',
+
+                       '''
+                       int %s(const wxString& text) {
+                           return SendMsg(%s, text.Len(), (long)text.c_str());
+                       ''',
+
+                       0),
+
+    'SearchInTarget' : (0,
+                       'int %s(const wxString& text);',
+
+                       '''
+                       int %s(const wxString& text) {
+                           return SendMsg(%s, text.Len(), (long)text.c_str());
+                       ''',
+
+                       0),
+
+
+
     # Remove all methods that are key commands since they can be
     # executed with CmdKeyExecute
     'LineDown' : (None, 0, 0, 0),
@@ -417,7 +452,7 @@ methodOverrideMap = {
     'SetDocPointer' : (0,
                        'void %s(void* docPointer);',
                        '''void %s(void* docPointer) {
-                           SendMsg(%s, (long)docPointer);''',
+                           SendMsg(%s, 0, (long)docPointer);''',
                        0),
 
     'CreateDocument' : (0,
@@ -685,4 +720,3 @@ if __name__ == '__main__':
 
 #----------------------------------------------------------------------------
 
-
index b88d57495ce6e4123d5a8eba5f9ff935a1d743d3..598da70f58b7750830d6a3857bfd8e80903418f9 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.
 
-The current version of the Scintilla code is 1.32
+The current version of the Scintilla code is 1.39
 
index b4b7e62ecf2d8573d18b9d4b8b9c18bbb3df3234..17c951067221fa0b246dab36e7ee9194da39d462 100644 (file)
@@ -1,6 +1,8 @@
-// SciTE - Scintilla based Text Editor
-// Accessor.h - rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file Accessor.h
+ ** Rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
@@ -9,12 +11,16 @@ class Accessor;
 
 typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len);
 
-// Interface to data in a Scintilla
+/**
+ * Interface to data in a Scintilla.
+ */
 class Accessor {
 protected:
        enum {extremePosition=0x7FFFFFFF};
-       // bufferSize is a trade off between time taken to copy the characters and retrieval overhead
-       // slopSize positions the buffer before the desired position in case there is some backtracking
+       /** @a bufferSize is a trade off between time taken to copy the characters
+        * and retrieval overhead.
+        * @a slopSize positions the buffer before the desired position
+        * in case there is some backtracking. */
        enum {bufferSize=4000, slopSize=bufferSize/8};
        char buf[bufferSize+1];
        int startPos;
@@ -23,6 +29,7 @@ protected:
 
        virtual bool InternalIsLeadByte(char ch)=0;
        virtual void Fill(int position)=0;
+
 public:
        Accessor() : startPos(extremePosition), endPos(0), codePage(0) {}
        virtual ~Accessor() {}
@@ -32,8 +39,8 @@ public:
                }
                return buf[position - startPos];
        }
+       /** Safe version of operator[], returning a defined value for invalid position. */
        char SafeGetCharAt(int position, char chDefault=' ') {
-               // Safe version of operator[], returning a defined value for invalid position 
                if (position < startPos || position >= endPos) {
                        Fill(position);
                        if (position < startPos || position >= endPos) {
@@ -57,6 +64,7 @@ public:
        virtual int GetLineState(int line)=0;
        virtual int SetLineState(int line, int state)=0;
        virtual int GetPropertyInt(const char *key, int defaultValue=0)=0;
+       virtual char *GetProperties()=0;
 
        // Style setting
        virtual void StartAt(unsigned int start, char chMask=31)=0;
@@ -67,4 +75,3 @@ public:
        virtual void SetLevel(int line, int level)=0;
        virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0;
 };
-
index 3159dcc1b43762085db9af17de6086d3c35d4be7..869b59d2674a4a3226885fb1738d6e683407ef64 100644 (file)
@@ -1,32 +1,59 @@
-// SciTE - Scintilla based Text Editor
-// KeyWords.h - colourise for particular languages
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file KeyWords.h
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
                   WordList *keywordlists[], Accessor &styler);
                   
+/**
+ * A LexerModule is responsible for lexing and folding a particular language.
+ * The class maintains a list of LexerModules which can be searched to find a
+ * module appropriate to a particular language.
+ */
 class LexerModule {
-       static LexerModule *base;
+protected:
        LexerModule *next;
        int language;
-       LexerFunction fn;
+       const char *languageName;
+       LexerFunction fnLexer;
+       LexerFunction fnFolder;
+       
+       static LexerModule *base;
+       static int nextLanguage;
+
 public:
-       LexerModule(int language_, LexerFunction fn_);
-       static void Colourise(unsigned int startPos, int lengthDoc, int initStyle,
-                  int language, WordList *keywordlists[], Accessor &styler);
+       LexerModule(int language_, LexerFunction fnLexer_, 
+               const char *languageName_=0, LexerFunction fnFolder_=0);
+       int GetLanguage() { return language; }
+       virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
+                  WordList *keywordlists[], Accessor &styler);
+       virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
+                  WordList *keywordlists[], Accessor &styler);
+       static LexerModule *Find(int language);
+       static LexerModule *Find(const char *languageName);
 };
 
+/**
+ * Check if a character is a space.
+ * This is ASCII specific but is safe with chars >= 0x80.
+ */
+inline bool isspacechar(unsigned char ch) {
+    return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
+
 inline bool iswordchar(char ch) {
-       return isalnum(ch) || ch == '.' || ch == '_';
+       return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_');
 }
 
 inline bool iswordstart(char ch) {
-       return isalnum(ch) || ch == '_';
+       return isascii(ch) && (isalnum(ch) || ch == '_');
 }
 
 inline bool isoperator(char ch) {
-       if (isalnum(ch))
+       if (isascii(ch) && isalnum(ch))
                return false;
        // '.' left out as it is used to make up numbers
        if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
@@ -38,4 +65,3 @@ inline bool isoperator(char ch) {
                return true;
        return false;
 }
-
index de9cf202a131ada7b386c9cc3713c76fdd368906..74de63174ff41ec539df764f3bd771c9554e9e23 100644 (file)
@@ -1,18 +1,21 @@
 // Scintilla source code edit control
-// 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 wxWindows
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @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 wxWindows.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef PLATFORM_H
 #define PLATFORM_H
 
-// PLAT_GTK = GTK+ on Linux, 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 wxWindows on any supported platform
-// Could also have PLAT_GTKWIN = GTK+ on Win32 OS in future
 
 #define PLAT_GTK 0
+#define PLAT_GTK_WIN32 0
 #define PLAT_WIN 0
 #define PLAT_WX  0
 
 #undef PLAT_GTK
 #define PLAT_GTK 1
 
+#ifdef _MSC_VER
+#undef PLAT_GTK_WIN32
+#define PLAT_GTK_WIN32 1
+#endif
+
 #else
 #undef PLAT_WIN
 #define PLAT_WIN 1
@@ -34,6 +42,9 @@
 // Include the main header for each platform
 
 #if PLAT_GTK
+#ifdef _MSC_VER
+#pragma warning(disable: 4505 4514 4710 4800)
+#endif
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #endif
@@ -42,7 +53,7 @@
 #define _WIN32_WINNT  0x0400 // Otherwise some required stuff gets ifdef'd out
 // Vassili Bourdo: shut up annoying Visual C++ warnings:
 #ifdef _MSC_VER
-#pragma warning(disable: 4800 4244 4309)
+#pragma warning(disable: 4244 4309 4710 4800)
 #endif
 #include <windows.h>
 #include <commctrl.h>
@@ -80,23 +91,28 @@ typedef wxWindow* WindowID;
 typedef wxMenu* MenuID;
 #endif
 
-// Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably
-
+/**
+ * A geometric point class.
+ * Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably.
+ */
 class Point {
 public:
        int x;
        int y;
-       
+
        Point(int x_=0, int y_=0) : x(x_), y(y_) {
        }
 
        // Other automatically defined methods (assignment, copy constructor, destructor) are fine
-       
+
        static Point FromLong(long lpoint);
 };
 
-// PRectangle is exactly the same as the Win32 RECT so can be used interchangeably
-// PRectangles contain their top and left sides, but not their right and bottom sides
+/**
+ * A geometric rectangle class.
+ * PRectangle is exactly the same as the Win32 RECT so can be used interchangeably.
+ * PRectangles contain their top and left sides, but not their right and bottom sides.
+ */
 class PRectangle {
 public:
        int left;
@@ -110,6 +126,10 @@ public:
 
        // Other automatically defined methods (assignment, copy constructor, destructor) are fine
 
+       bool operator==(PRectangle &rc) {
+               return (rc.left == left) && (rc.right == right) &&
+                       (rc.top == top) && (rc.bottom == bottom);
+       }
        bool Contains(Point pt) {
                return (pt.x >= left) && (pt.x <= right) &&
                        (pt.y >= top) && (pt.y <= bottom);
@@ -131,6 +151,9 @@ wxRect wxRectFromPRectangle(PRectangle prc);
 PRectangle PRectangleFromwxRect(wxRect rc);
 #endif
 
+/**
+ * A colour class.
+ */
 class Colour {
        ColourID co;
 public:
@@ -141,15 +164,17 @@ public:
        unsigned int GetRed();
        unsigned int GetGreen();
        unsigned int GetBlue();
-       
+
        friend class Surface;
        friend class Palette;
 };
 
-// Colour pairs hold a desired colour and the colour that the graphics engine
-// allocates to approximate the desired colour.
-// To make palette management more automatic, ColourPairs could register at 
-// construction time with a palette management object.
+/**
+ * Colour pairs hold a desired colour and the colour that the graphics engine
+ * allocates to approximate the desired colour.
+ * To make palette management more automatic, ColourPairs could register at
+ * construction time with a palette management object.
+ */
 struct ColourPair {
        Colour desired;
        Colour allocated;
@@ -162,6 +187,9 @@ struct ColourPair {
 
 class Window;  // Forward declaration for Palette
 
+/**
+ * Colour palette management.
+ */
 class Palette {
        int used;
        enum {numEntries = 100};
@@ -176,22 +204,27 @@ class Palette {
 #endif
 public:
        bool allowRealization;
-       
+
        Palette();
        ~Palette();
 
        void Release();
-       
-       // This method either adds a colour to the list of wanted colours (want==true)
-       // or retrieves the allocated colour back to the ColourPair.
-       // This is one method to make it easier to keep the code for wanting and retrieving in sync.
+
+       /**
+        * This method either adds a colour to the list of wanted colours (want==true)
+        * or retrieves the allocated colour back to the ColourPair.
+        * This is one method to make it easier to keep the code for wanting and retrieving in sync.
+        */
        void WantFind(ColourPair &cp, bool want);
 
        void Allocate(Window &w);
-       
+
        friend class Surface;
 };
 
+/**
+ * Font management.
+ */
 class Font {
 protected:
        FontID id;
@@ -214,7 +247,9 @@ public:
        friend class Surface;
 };
 
-// A surface abstracts a place to draw
+/**
+ * A surface abstracts a place to draw.
+ */
 class Surface {
 private:
        bool unicodeMode;
@@ -256,7 +291,7 @@ private:
 public:
        Surface();
        ~Surface();
-       
+
        void Init();
        void Init(SurfaceID hdc_);
        void InitPixMap(int width, int height, Surface *surface_);
@@ -287,7 +322,7 @@ public:
        int ExternalLeading(Font &font_);
        int Height(Font &font_);
        int AverageCharWidth(Font &font_);
-       
+
        int SetPalette(Palette *pal, bool inBackGround);
        void SetClip(PRectangle rc);
        void FlushCachedState();
@@ -297,8 +332,10 @@ public:
        }
 };
 
-// Class to hide the details of window manipulation
-// Does not own the window which will normally have a longer life than this object
+/**
+ * Class to hide the details of window manipulation.
+ * Does not own the window which will normally have a longer life than this object.
+ */
 class Window {
        friend class ListBox;
 protected:
@@ -333,6 +370,9 @@ public:
 #endif
 };
 
+/**
+ * Listbox management.
+ */
 class ListBox : public Window {
 #if PLAT_GTK
        WindowID list;
@@ -360,6 +400,9 @@ public:
        void Sort();
 };
 
+/**
+ * Menu management.
+ */
 class Menu {
        MenuID id;
 public:
@@ -370,8 +413,10 @@ public:
        void Show(Point pt, Window &w);
 };
 
-// Platform class used to retrieve system wide parameters such as double click speed
-// and chrome colour. Not a creatable object, more of a module with several functions.
+/**
+ * Platform class used to retrieve system wide parameters such as double click speed
+ * and chrome colour. Not a creatable object, more of a module with several functions.
+ */
 class Platform {
        // Private so Platform objects can not be copied
        Platform(const Platform &) {}
@@ -390,7 +435,7 @@ public:
        static bool IsKeyDown(int key);
        static long SendScintilla(
                WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
-       
+
        // These are utility functions not really tied to a platform
        static int Minimum(int a, int b);
        static int Maximum(int a, int b);
@@ -405,7 +450,15 @@ public:
                return static_cast<short>(x & 0xffff);
        }
        static void DebugPrintf(const char *format, ...);
+       static bool ShowAssertionPopUps(bool assertionPopUps_);
+       static void Assert(const char *c, const char *file, int line);
        static int Clamp(int val, int minVal, int maxVal);
 };
 
+#ifdef  NDEBUG
+#define PLATFORM_ASSERT(c) ((void)0)
+#else
+#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__))
+#endif
+
 #endif
diff --git a/src/stc/scintilla/include/PosRegExp.h b/src/stc/scintilla/include/PosRegExp.h
deleted file mode 100644 (file)
index b915b1e..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifndef POSREGEXP_H
-#define POSREGEXP_H
-
-#define MatchesNum 0x10
-
-enum EOps
-{
-  ReBlockOps = 0x1000,
-  ReMul,              // *
-  RePlus,             // +
-  ReQuest,            // ?
-  ReNGMul,            // *?
-  ReNGPlus,           // +?
-  ReNGQuest,          // ??
-  ReRangeN,           // {n,}
-  ReRangeNM,          // {n,m}
-  ReNGRangeN,         // {n,}?
-  ReNGRangeNM,        // {n,m}?
-  ReOr,               // |
-  ReBehind  = 0x1100, // ?#n
-  ReNBehind = 0x1200, // ?~n
-  ReAhead   = 0x1300, // ?=
-  ReNAhead  = 0x1400, // ?!
-
-  ReSymbolOps = 0x2000,
-  ReEmpty,
-  ReSymb,             // a b \W \s ...
-  ReEnum,             // []
-  ReNEnum,            // [^]
-  ReBrackets,         // (...)
-  ReBkTrace = 0x2100, // \yN
-  ReBkBrack = 0x2200 // \N
-};
-
-enum ESymbols
-{
-  ReAnyChr = 0x4000,  // .
-  ReSoL,              // ^
-  ReEoL,              // $
-  ReDigit,            // \d
-  ReNDigit,           // \D
-  ReWordSymb,         // \w
-  ReNWordSymb,        // \W
-  ReWSpace,           // \s
-  ReNWSpace,          // \S
-  ReUCase,            // \u
-  ReNUCase ,          // \l
-  ReWBound,           // \b
-  ReNWBound,          // \B
-  RePreNW,            // \c
-  ReStart,            // \m
-  ReEnd,              // \M
-
-  ReChr    = 0x0      // Char in Lower Byte
-};
-enum ETempSymb
-{
-  ReTemp = 0x7000,
-  ReLBrack, ReRBrack,
-  ReEnumS, ReEnumE, ReNEnumS,
-  ReRangeS, ReRangeE, ReNGRangeE, ReFrToEnum
-};
-
-#define BackSlash '\\'
-
-typedef union SCharData
-{
-  int  IArr[8];
-  char CArr[32];
-  void SetBit(unsigned char Bit);
-  void ClearBit(unsigned char Bit);
-  bool GetBit(unsigned char Bit);
-} *PCharData;
-
-typedef struct SRegInfo
-{
-  SRegInfo();
-  ~SRegInfo();
-
-  EOps   Op;
-  union{
-    SRegInfo *Param;
-    int Symb;
-    PCharData ChrClass;
-  }un;
-  int s,e;
-  SRegInfo *Parent;
-  SRegInfo *Next;
-} *PRegInfo;
-
-typedef struct SMatches
-{
-  int s[MatchesNum];
-  int e[MatchesNum];
-  int CurMatch;
-} *PMatches;
-
-typedef class PosRegExp
-{
-  PRegInfo Info;
-  PMatches BkTrace;
-  bool NoCase,Extend,NoMoves;
-  bool Error;
-  int  *Exprn;
-  int  posParse;
-  int  posEnd,posStart;
-  int  posBkStr;
-  int  FirstChar;
-
-  bool SetExprLow(const char *Expr);
-  bool SetStructs(PRegInfo &Info,int st,int end);
-  void Optimize();
-  bool CheckSymb(int Symb,bool Inc);
-  bool LowParse(PRegInfo Re);
-  bool LowParseRe(PRegInfo &Next);
-  bool LowCheckNext(PRegInfo Re);
-  bool ParseRe(int posStr);
-  bool QuickCheck();
-public:
-  PMatches Matches;
-  int Ok, CurMatch;
-
-  void *param;
-  char (*CharAt)(int pos, void *param);
-
-  PosRegExp();
-  ~PosRegExp();
-
-  bool isok();
-  bool SetNoMoves(bool Moves);
-  bool SetBkTrace(int posStr,PMatches Trace);
-  bool SetExpr(const char *Expr);
-  bool Parse(int posStr, int posStop, PMatches Mtch);
-  bool Parse(int posStr,int posSol, int posEol, PMatches Mtch, int Moves = -1);
-  bool Evaluate(char *Expr, int posStr, PMatches Mtch, char **Res);
-} *PPosRegExp;
-
-#endif /* POSREGEXP_H */
index 025174f8abda8ff5b0851d61a97d1d9dc0e4bc3f..6f6bf410f14b87a4519cd8fa63bc6d1815cd5dc0 100644 (file)
-// SciTE - Scintilla based Text Editor
-// PropSet.h - a java style properties file module
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file PropSet.h
+ ** A Java style properties file module.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef PROPSET_H
 #define PROPSET_H
+#include "SString.h"
 
 bool EqualCaseInsensitive(const char *a, const char *b);
 
-#if PLAT_WIN
-#define strcasecmp  stricmp
-#define strncasecmp strnicmp
-#endif
-
-#ifdef __WXMSW__
-#define strcasecmp  stricmp
-#define strncasecmp strnicmp
-#endif
-
-// Define another string class.
-// While it would be 'better' to use std::string, that doubles the executable size.
-
-inline char *StringDup(const char *s, int len=-1) {
-       if (!s)
-               return 0;
-       if (len == -1)
-               len = strlen(s);
-       char *sNew = new char[len + 1];
-       if (sNew) {
-               strncpy(sNew, s, len);
-               sNew[len] = '\0';
-       }
-       return sNew;
-}
-
-class SString {
-       char *s;
-       int ssize;
-public:
-       typedef const char* const_iterator;
-       typedef int size_type;
-       static size_type npos;
-       const char* begin(void) const {
-               return s;
-       }
-       const char* end(void) const {
-               return &s[ssize];
-       }
-       size_type size(void) const {
-               if (s)
-                       return ssize;
-               else
-                       return 0;
-       }
-       SString &assign(const char* sother, int size_ = -1) {
-               char *t = s;
-               s = StringDup(sother,size_);
-               ssize = (s) ? strlen(s) : 0;
-               delete []t;
-               return *this;
-       }
-       SString &assign(const SString& sother, int size_ = -1) {
-               return assign(sother.s,size_);
-       }
-       SString &assign(const_iterator ibeg, const_iterator iend) {
-               return assign(ibeg,iend - ibeg);
-       }
-       SString() {
-               s = 0;
-               ssize = 0;
-       }
-       SString(const SString &source) {
-               s = StringDup(source.s);
-               ssize = (s) ? strlen(s) : 0;
-       }
-       SString(const char *s_) {
-               s = StringDup(s_);
-               ssize = (s) ? strlen(s) : 0;
-       }
-       SString(int i) {
-               char number[100];
-               sprintf(number, "%0d", i);
-               s = StringDup(number);
-               ssize = (s) ? strlen(s) : 0;
-       }
-       ~SString() {
-               delete []s;
-               s = 0;
-               ssize = 0;
-       }
-       SString &operator=(const SString &source) {
-               if (this != &source) {
-                       delete []s;
-                       s = StringDup(source.s);
-                       ssize = (s) ? strlen(s) : 0;
-               }
-               return *this;
-       }
-       bool operator==(const SString &other) const {
-               if ((s == 0) && (other.s == 0))
-                       return true;
-               if ((s == 0) || (other.s == 0))
-                       return false;
-               return strcmp(s, other.s) == 0;
-       }
-       bool operator!=(const SString &other) const {
-               return !operator==(other);
-       }
-       bool operator==(const char *sother) const {
-               if ((s == 0) && (sother == 0))
-                       return true;
-               if ((s == 0) || (sother == 0))
-                       return false;
-               return strcmp(s, sother) == 0;
-       }
-       bool operator!=(const char *sother) const {
-               return !operator==(sother);
-       }
-       const char *c_str() const {
-               if (s)
-                       return s;
-               else
-                       return "";
-       }
-       int length() const {
-               if (s)
-                       return strlen(s);
-               else
-                       return 0;
-       }
-       char operator[](int i) const {
-               if (s)
-                       return s[i];
-               else
-                       return '\0';
-       }
-       SString &operator +=(const char *sother) {
-               return append(sother,-1);
-       }
-       SString &operator +=(const SString &sother) {
-               return append(sother.s,sother.ssize);
-       }
-       SString &operator +=(char ch) {
-               return append(&ch,1);
-       }
-       SString &append(const char* sother, int lenOther) {
-               int len = length();
-               if(lenOther < 0)
-                       lenOther = strlen(sother);
-               char *sNew = new char[len + lenOther + 1];
-               if (sNew) {
-                       if (s)
-                               memcpy(sNew, s, len);
-                       strncpy(&sNew[len], sother, lenOther);
-                       sNew[len + lenOther] = '\0';
-                       delete []s;
-                       s = sNew;
-                       ssize = (s) ? strlen(s) : 0;
-               }
-               return *this;
-       }
-       int value() const {
-               if (s)
-                       return atoi(s);
-               else
-                       return 0;
-       }
-       void substitute(char find, char replace) {
-               char *t = s;
-               while (t) {
-                       t = strchr(t, find);
-                       if (t)
-                               *t = replace;
-               }
-       }
-       // I don't think this really belongs here -- Neil
-       void correctPath() {
-#ifdef unix
-               substitute('\\', '/');
-#else
-               substitute('/', '\\');
-#endif
-       }
-};
+bool isprefix(const char *target, const char *prefix);
 
 struct Property {
        unsigned int hash;
@@ -192,53 +21,66 @@ struct Property {
        Property() : hash(0), key(0), val(0), next(0) {}
 };
 
+/**
+ */
 class PropSet {
 private:
        enum { hashRoots=31 };
        Property *props[hashRoots];
+       Property *enumnext;
+       int enumhash;
 public:
        PropSet *superPS;
        PropSet();
        ~PropSet();
-       void Set(const char *key, const char *val);
-       void Set(char *keyval);
+       void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1);
+       void Set(const char *keyVal);
+       void SetMultiple(const char *s);
        SString Get(const char *key);
        SString GetExpanded(const char *key);
-       SString Expand(const char *withvars);
+       SString Expand(const char *withVars);
        int GetInt(const char *key, int defaultValue=0);
        SString GetWild(const char *keybase, const char *filename);
        SString GetNewExpand(const char *keybase, const char *filename);
        void Clear();
-       void ReadFromMemory(const char *data, int len, const char *directoryForImports=0);
-       void Read(const char *filename, const char *directoryForImports);
+       char *ToString();       // Caller must delete[] the return value
+       bool GetFirst(char **key, char **val);
+       bool GetNext(char **key, char **val);
 };
 
+/**
+ */
 class WordList {
 public:
-       // Each word contains at least one character - a empty word acts as sentinal at the end.
+       // 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 onlyLineEnds;      ///< Delimited by any white space or only line ends
        bool sorted;
        int starts[256];
-       WordList(bool onlyLineEnds_ = false) :
+       WordList(bool onlyLineEnds_ = false) : 
                words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false) {}
        ~WordList() { Clear(); }
-       operator bool() { return words ? true : false; }
-       const char *operator[](int ind) { return words[ind]; }
+       operator bool() { return len ? true : false; }
+       char *operator[](int ind) { return words[ind]; }
        void Clear();
        void Set(const char *s);
        char *Allocate(int size);
        void SetFromAllocated();
        bool InList(const char *s);
        const char *GetNearestWord(const char *wordStart, int searchLen = -1, bool ignoreCase = false);
-       char *GetNearestWords(const char *wordStart, int searchLen = -1, bool ignoreCase = false);
+       char *GetNearestWords(const char *wordStart, int searchLen=-1, 
+               bool ignoreCase=false, char otherSeparator='\0');
 };
 
 inline bool nonFuncChar(char ch) {
        return strchr("\t\n\r !\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~", ch) != NULL;
 }
 
+inline bool IsAlphabetic(unsigned int ch) {
+       return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'));
+}
+
 #endif
diff --git a/src/stc/scintilla/include/SString.h b/src/stc/scintilla/include/SString.h
new file mode 100644 (file)
index 0000000..aeb5940
--- /dev/null
@@ -0,0 +1,255 @@
+// SciTE - Scintilla based Text Editor
+/** @file SString.h
+ ** A simple string class.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#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, int len);
+bool EqualCaseInsensitive(const char *a, const char *b);
+
+// 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.
+
+/**
+ * Duplicate a C string.
+ * Allocate memory of the given size, or big enough to fit the string if length isn't given;
+ * then copy the given string in the allocated memory.
+ * @return the pointer to the new string
+ */
+inline char *StringDup(
+       const char *s,  ///< The string to duplicate
+       int len=-1)             ///< The length of memory to allocate. Optional.
+{
+       if (!s)
+               return 0;
+       if (len == -1)
+               len = strlen(s);
+       char *sNew = new char[len + 1];
+       if (sNew) {
+               strncpy(sNew, s, len);
+               sNew[len] = '\0';
+       }
+       return sNew;
+}
+
+/**
+ * @brief A simple string class.
+ * Hold the length of the string for quick operations,
+ * can have a buffer bigger than the string to avoid too many memory allocations and copies.
+ * May have embedded zeroes as a result of @a substitute, but rely too heavily on C string
+ * functions to allow reliable manipulations of these strings.
+ **/
+class SString {
+       char *s;                        ///< The C string
+       int sSize;      ///< The size of the buffer, less 1: ie. the maximum size of the string
+       int sLen;       ///< The size of the string in s
+       int sizeGrowth; ///< Minimum growth size when appending strings
+       enum { sizeGrowthDefault = 64 };
+
+public:
+       typedef int size_type;
+
+       SString() : s(0), sSize(0), sLen(0), sizeGrowth(sizeGrowthDefault) {
+       }
+       SString(const SString &source) : sizeGrowth(sizeGrowthDefault) {
+               s = StringDup(source.s);
+               sSize = sLen = (s) ? strlen(s) : 0;
+       }
+       SString(const char *s_) : sizeGrowth(sizeGrowthDefault) {
+               s = StringDup(s_);
+               sSize = sLen = (s) ? strlen(s) : 0;
+       }
+       SString(const char *s_, int first, int last) : sizeGrowth(sizeGrowthDefault) {
+               s = StringDup(s_ + first, last - first);
+               sSize = sLen = (s) ? strlen(s) : 0;
+       }
+       SString(int i) : sizeGrowth(sizeGrowthDefault) {
+               char number[32];
+               sprintf(number, "%0d", i);
+               s = StringDup(number);
+               sSize = sLen = (s) ? strlen(s) : 0;
+       }
+       ~SString() {
+               delete []s;
+               s = 0;
+               sSize = 0;
+               sLen = 0;
+       }
+       void clear(void) {
+               if (s) {
+                       *s = '\0';
+               }
+               sLen = 0;
+       }
+       /** Size of buffer. */
+       size_type size(void) const {    ///<
+               if (s)
+                       return sSize;
+               else
+                       return 0;
+       }
+       /** Size of string in buffer. */
+       int length() const {
+               return sLen;
+       }
+       SString &assign(const char* sOther, int sSize_ = -1) {
+               if (!sOther) {
+                       sSize_ = 0;
+               }
+               if (sSize_ < 0) {
+                       sSize_ = strlen(sOther);
+               }
+               if (sSize > 0 && sSize_ <= sSize) {     // Does not allocate new buffer if the current is big enough
+                       if (s && sSize_) {
+                               strncpy(s, sOther, sSize_);
+                       }
+                       s[sSize_] = '\0';
+                       sLen = sSize_;
+               } else {
+                       delete []s;
+                       s = StringDup(sOther, sSize_);
+                       if (s) {
+                               sSize = sSize_; // Allow buffer bigger than real string, thus providing space to grow
+                               sLen = strlen(s);
+                       } else {
+                               sSize = sLen = 0;
+                       }
+               }
+               return *this;
+       }
+       SString &assign(const SString& sOther, int sSize_ = -1) {
+               return assign(sOther.s, sSize_);
+       }
+       SString &operator=(const char *source) {
+               return assign(source);
+       }
+       SString &operator=(const SString &source) {
+               if (this != &source) {
+                       assign(source.c_str());
+               }
+               return *this;
+       }
+       bool operator==(const SString &sOther) const {
+               if ((s == 0) && (sOther.s == 0))
+                       return true;
+               if ((s == 0) || (sOther.s == 0))
+                       return false;
+               return strcmp(s, sOther.s) == 0;
+       }
+       bool operator!=(const SString &sOther) const {
+               return !operator==(sOther);
+       }
+       bool operator==(const char *sOther) const {
+               if ((s == 0) && (sOther == 0))
+                       return true;
+               if ((s == 0) || (sOther == 0))
+                       return false;
+               return strcmp(s, sOther) == 0;
+       }
+       bool operator!=(const char *sOther) const {
+               return !operator==(sOther);
+       }
+       bool contains(char ch) {
+               if (s && *s)
+                       return strchr(s, ch) != 0;
+               else
+                       return false;
+       }
+       void setsizegrowth(int sizeGrowth_) {
+               sizeGrowth = sizeGrowth_;
+       }
+       const char *c_str() const {
+               if (s)
+                       return s;
+               else
+                       return "";
+       }
+       /** Give ownership of buffer to caller which must use delete[] to free buffer. */
+       char *detach() {
+               char *sRet = s;
+               s = 0;
+               sSize = 0;
+               sLen = 0;
+               return sRet;
+       }
+       char operator[](int i) const {
+               if (s && i < sSize)     // Or < sLen? Depends on the use, both are OK
+                       return s[i];
+               else
+                       return '\0';
+       }
+       SString &append(const char* sOther, int sLenOther=-1, char sep=0) {
+               if (sLenOther < 0)
+                       sLenOther = strlen(sOther);
+               int lenSep = 0;
+               if (sLen && sep)        // Only add a separator if not empty
+                       lenSep = 1;
+               int lenNew = sLen + sLenOther + lenSep;
+               if (lenNew + 1 < sSize) {
+                       // Conservative about growing the buffer: don't do it, unless really needed
+                       if (lenSep) {
+                               s[sLen] = sep;
+                               sLen++;
+                       }
+                       strncpy(&s[sLen], sOther, sLenOther);
+                       s[sLen + sLenOther] = '\0';
+                       sLen += sLenOther;
+               } else {
+                       // Grow the buffer bigger than really needed, to have room for other appends
+                       char *sNew = new char[lenNew + sizeGrowth + 1];
+                       if (sNew) {
+                               if (s) {
+                                       memcpy(sNew, s, sLen);
+                                       delete []s;
+                               }
+                               s = sNew;
+                               sSize = lenNew + sizeGrowth;
+                               if (lenSep) {
+                                       s[sLen] = sep;
+                                       sLen++;
+                               }
+                               strncpy(&s[sLen], sOther, sLenOther);
+                               sNew[sLen + sLenOther] = '\0';
+                               sLen += sLenOther;
+                       }
+               }
+               return *this;
+       }
+       SString &operator +=(const char *sOther) {
+               return append(sOther, -1);
+       }
+       SString &operator +=(const SString &sOther) {
+               return append(sOther.s, sOther.sSize);
+       }
+       SString &operator +=(char ch) {
+               return append(&ch, 1);
+       }
+       SString &appendwithseparator(const char* sOther, char sep) {
+               return append(sOther, strlen(sOther), sep);
+       }
+       int value() const {
+               if (s)
+                       return atoi(s);
+               else
+                       return 0;
+       }
+       void substitute(char find, char replace) {
+               char *t = s;
+               while (t) {
+                       t = strchr(t, find);
+                       if (t) {
+                               *t = replace;
+                               t++;
+                       }
+               }
+       }
+};
+
+#endif
index 69402ab9ab4bebbfafb086a59ed5e46d8f5d7195..591bd06aa1a4a6a8bbd4765d3da8aa34af146cc3 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// SciLexer - interface to the added lexer functions in the SciLexer version of the edit control
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file SciLexer.h
+ ** Interface to the added lexer functions in the SciLexer version of the edit control.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Most of this file is automatically generated from the Scintilla.iface interface definition
 #define SCLEX_LATEX 14
 #define SCLEX_LUA 15
 #define SCLEX_DIFF 16
+#define SCLEX_CONF 17
+#define SCLEX_PASCAL 18
+#define SCLEX_AVE 19
+#define SCLEX_ADA 20
+#define SCLEX_LISP 21
+#define SCLEX_RUBY 22
+#define SCLEX_EIFFEL 23
+#define SCLEX_EIFFELKW 24
+#define SCLEX_TCL 25
+#define SCLEX_AUTOMATIC 1000
 #define SCE_P_DEFAULT 0
 #define SCE_P_COMMENTLINE 1
 #define SCE_P_NUMBER 2
@@ -57,6 +69,9 @@
 #define SCE_C_IDENTIFIER 11
 #define SCE_C_STRINGEOL 12
 #define SCE_C_VERBATIM 13
+#define SCE_C_REGEX 14
+#define SCE_C_COMMENTLINEDOC 15
+#define SCE_C_WORD2 16
 #define SCE_H_DEFAULT 0
 #define SCE_H_TAG 1
 #define SCE_H_TAGUNKNOWN 2
@@ -77,6 +92,8 @@
 #define SCE_H_CDATA 17
 #define SCE_H_QUESTION 18
 #define SCE_H_VALUE 19
+#define SCE_H_XCCOMMENT 20
+#define SCE_H_SGML 21
 #define SCE_HJ_START 40
 #define SCE_HJ_DEFAULT 41
 #define SCE_HJ_COMMENT 42
 #define SCE_HJ_SINGLESTRING 49
 #define SCE_HJ_SYMBOLS 50
 #define SCE_HJ_STRINGEOL 51
+#define SCE_HJ_REGEX 52
 #define SCE_HJA_START 55
 #define SCE_HJA_DEFAULT 56
 #define SCE_HJA_COMMENT 57
 #define SCE_HJA_SINGLESTRING 64
 #define SCE_HJA_SYMBOLS 65
 #define SCE_HJA_STRINGEOL 66
+#define SCE_HJA_REGEX 67
 #define SCE_HB_START 70
 #define SCE_HB_DEFAULT 71
 #define SCE_HB_COMMENTLINE 72
 #define SCE_HPHP_VARIABLE 123
 #define SCE_HPHP_COMMENT 124
 #define SCE_HPHP_COMMENTLINE 125
-#define SCE_HPHP_STRINGEOL 126
+#define SCE_HPHP_HSTRING_VARIABLE 126
+#define SCE_HPHP_OPERATOR 127
 #define SCE_PL_DEFAULT 0
-#define SCE_PL_HERE 1
+#define SCE_PL_ERROR 1
 #define SCE_PL_COMMENTLINE 2
 #define SCE_PL_POD 3
 #define SCE_PL_NUMBER 4
 #define SCE_PL_ARRAY 13
 #define SCE_PL_HASH 14
 #define SCE_PL_SYMBOLTABLE 15
-#define SCE_PL_REF 16
 #define SCE_PL_REGEX 17
 #define SCE_PL_REGSUBST 18
 #define SCE_PL_LONGQUOTE 19
 #define SCE_PL_BACKTICKS 20
 #define SCE_PL_DATASECTION 21
+#define SCE_PL_HERE_DELIM 22
+#define SCE_PL_HERE_Q 23
+#define SCE_PL_HERE_QQ 24
+#define SCE_PL_HERE_QX 25
+#define SCE_PL_STRING_Q 26
+#define SCE_PL_STRING_QQ 27
+#define SCE_PL_STRING_QX 28
+#define SCE_PL_STRING_QR 29
+#define SCE_PL_STRING_QW 30
 #define SCE_L_DEFAULT 0
 #define SCE_L_COMMAND 1
 #define SCE_L_TAG 2
 #define SCE_ERR_CMD 4
 #define SCE_ERR_BORLAND 5
 #define SCE_ERR_PERL 6
+#define SCE_ERR_NET 7
+#define SCE_ERR_LUA 8
+#define SCE_ERR_DIFF_CHANGED 10
+#define SCE_ERR_DIFF_ADDITION 11
+#define SCE_ERR_DIFF_DELETION 12
+#define SCE_ERR_DIFF_MESSAGE 13
+#define SCE_BAT_DEFAULT 0
+#define SCE_BAT_COMMENT 1
+#define SCE_BAT_WORD 2
+#define SCE_BAT_LABEL 3
+#define SCE_BAT_HIDE 4
+#define SCE_BAT_COMMAND 5
+#define SCE_BAT_IDENTIFIER 6
+#define SCE_BAT_OPERATOR 7
+#define SCE_MAKE_DEFAULT 0
+#define SCE_MAKE_COMMENT 1
+#define SCE_MAKE_PREPROCESSOR 2
+#define SCE_MAKE_IDENTIFIER 3
+#define SCE_MAKE_OPERATOR 4
+#define SCE_MAKE_TARGET 5
+#define SCE_MAKE_IDEOL 9
+#define SCE_CONF_DEFAULT 0
+#define SCE_CONF_COMMENT 1
+#define SCE_CONF_NUMBER 2
+#define SCE_CONF_IDENTIFIER 3
+#define SCE_CONF_EXTENSION 4
+#define SCE_CONF_PARAMETER 5
+#define SCE_CONF_STRING 6
+#define SCE_CONF_OPERATOR 7
+#define SCE_CONF_IP 8
+#define SCE_CONF_DIRECTIVE 9
+#define SCE_AVE_DEFAULT 0
+#define SCE_AVE_COMMENT 1
+#define SCE_AVE_NUMBER 2
+#define SCE_AVE_WORD 3
+#define SCE_AVE_KEYWORD 4
+#define SCE_AVE_STATEMENT 5
+#define SCE_AVE_STRING 6
+#define SCE_AVE_ENUM 7
+#define SCE_AVE_STRINGEOL 8
+#define SCE_AVE_IDENTIFIER 9
+#define SCE_AVE_OPERATOR 10
+#define SCE_ADA_DEFAULT 0
+#define SCE_ADA_COMMENT 1
+#define SCE_ADA_NUMBER 2
+#define SCE_ADA_WORD 3
+#define SCE_ADA_STRING 4
+#define SCE_ADA_CHARACTER 5
+#define SCE_ADA_OPERATOR 6
+#define SCE_ADA_IDENTIFIER 7
+#define SCE_ADA_STRINGEOL 8
+#define SCE_LISP_DEFAULT 0
+#define SCE_LISP_COMMENT 1
+#define SCE_LISP_NUMBER 2
+#define SCE_LISP_KEYWORD 3
+#define SCE_LISP_STRING 6
+#define SCE_LISP_STRINGEOL 8
+#define SCE_LISP_IDENTIFIER 9
+#define SCE_LISP_OPERATOR 10
+#define SCE_EIFFEL_DEFAULT 0
+#define SCE_EIFFEL_COMMENTLINE 1
+#define SCE_EIFFEL_NUMBER 2
+#define SCE_EIFFEL_WORD 3
+#define SCE_EIFFEL_STRING 4
+#define SCE_EIFFEL_CHARACTER 5
+#define SCE_EIFFEL_OPERATOR 6
+#define SCE_EIFFEL_IDENTIFIER 7
+#define SCE_EIFFEL_STRINGEOL 8
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
 
 #endif
index ca81d135bd71290712859b83b670488ba6337bb5..0185d3e5be6cac69c7b19f8e888bba79cc4235b0 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Scintilla.h - interface to the edit control
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Scintilla.h
+ ** Interface to the edit control.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Most of this file is automatically generated from the Scintilla.iface interface definition
@@ -18,7 +20,13 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);
 #endif
 #endif
 
-typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wParam, long lParam);
+// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
+// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
+// May need to be changed for 64 bit platforms.
+typedef unsigned long uptr_t;
+typedef long sptr_t;
+
+typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
 //++Autogenerated -- start of section automatically generated from Scintilla.iface
 #define INVALID_POSITION -1
@@ -50,15 +58,16 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_GETVIEWWS 2020
 #define SCI_SETVIEWWS 2021
 #define SCI_POSITIONFROMPOINT 2022
+#define SCI_POSITIONFROMPOINTCLOSE 2023
 #define SCI_GOTOLINE 2024
 #define SCI_GOTOPOS 2025
 #define SCI_SETANCHOR 2026
 #define SCI_GETCURLINE 2027
 #define SCI_GETENDSTYLED 2028
-#define SCI_CONVERTEOLS 2029
 #define SC_EOL_CRLF 0
 #define SC_EOL_CR 1
 #define SC_EOL_LF 2
+#define SCI_CONVERTEOLS 2029
 #define SCI_GETEOLMODE 2030
 #define SCI_SETEOLMODE 2031
 #define SCI_STARTSTYLING 2032
@@ -80,6 +89,24 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SC_MARK_ARROWDOWN 6
 #define SC_MARK_MINUS 7
 #define SC_MARK_PLUS 8
+#define SC_MARK_VLINE 9
+#define SC_MARK_LCORNER 10
+#define SC_MARK_TCORNER 11
+#define SC_MARK_BOXPLUS 12
+#define SC_MARK_BOXPLUSCONNECTED 13
+#define SC_MARK_BOXMINUS 14
+#define SC_MARK_BOXMINUSCONNECTED 15
+#define SC_MARK_LCORNERCURVE 16
+#define SC_MARK_TCORNERCURVE 17
+#define SC_MARK_CIRCLEPLUS 18
+#define SC_MARK_CIRCLEPLUSCONNECTED 19
+#define SC_MARK_CIRCLEMINUS 20
+#define SC_MARK_CIRCLEMINUSCONNECTED 21
+#define SC_MARKNUM_FOLDEREND 25
+#define SC_MARKNUM_FOLDEROPENMID 26
+#define SC_MARKNUM_FOLDERMIDTAIL 27
+#define SC_MARKNUM_FOLDERTAIL 28
+#define SC_MARKNUM_FOLDERSUB 29
 #define SC_MARKNUM_FOLDER 30
 #define SC_MARKNUM_FOLDEROPEN 31
 #define SCI_MARKERDEFINE 2040
@@ -137,6 +164,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_STYLESETEOLFILLED 2057
 #define SCI_STYLERESETDEFAULT 2058
 #define SCI_STYLESETUNDERLINE 2059
+#define SC_CASE_MIXED 0
+#define SC_CASE_UPPER 1
+#define SC_CASE_LOWER 2
+#define SCI_STYLESETCASE 2060
 #define SCI_STYLESETCHARACTERSET 2066
 #define SCI_SETSELFORE 2067
 #define SCI_SETSELBACK 2068
@@ -170,6 +201,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_SETLINESTATE 2092
 #define SCI_GETLINESTATE 2093
 #define SCI_GETMAXLINESTATE 2094
+#define SCI_GETCARETLINEVISIBLE 2095
+#define SCI_SETCARETLINEVISIBLE 2096
+#define SCI_GETCARETLINEBACK 2097
+#define SCI_SETCARETLINEBACK 2098
 #define SCI_AUTOCSHOW 2100
 #define SCI_AUTOCCANCEL 2101
 #define SCI_AUTOCACTIVE 2102
@@ -186,6 +221,9 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_AUTOCGETCHOOSESINGLE 2114
 #define SCI_AUTOCSETIGNORECASE 2115
 #define SCI_AUTOCGETIGNORECASE 2116
+#define SCI_USERLISTSHOW 2117
+#define SCI_AUTOCSETAUTOHIDE 2118
+#define SCI_AUTOCGETAUTOHIDE 2119
 #define SCI_SETINDENT 2122
 #define SCI_GETINDENT 2123
 #define SCI_SETUSETABS 2124
@@ -215,9 +253,10 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SC_PRINT_NORMAL 0
 #define SC_PRINT_INVERTLIGHT 1
 #define SC_PRINT_BLACKONWHITE 2
+#define SC_PRINT_COLOURONWHITE 3
+#define SC_PRINT_COLOURONWHITEDEFAULTBG 4
 #define SCI_SETPRINTCOLOURMODE 2148
 #define SCI_GETPRINTCOLOURMODE 2149
-#define SCFIND_DOWN 1
 #define SCFIND_WHOLEWORD 2
 #define SCFIND_MATCHCASE 4
 #define SCFIND_WORDSTART 0x00100000
@@ -260,6 +299,17 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_GETDIRECTPOINTER 2185
 #define SCI_SETOVERTYPE 2186
 #define SCI_GETOVERTYPE 2187
+#define SCI_SETCARETWIDTH 2188
+#define SCI_GETCARETWIDTH 2189
+#define SCI_SETTARGETSTART 2190
+#define SCI_GETTARGETSTART 2191
+#define SCI_SETTARGETEND 2192
+#define SCI_GETTARGETEND 2193
+#define SCI_REPLACETARGET 2194
+#define SCI_REPLACETARGETRE 2195
+#define SCI_SEARCHINTARGET 2197
+#define SCI_SETSEARCHFLAGS 2198
+#define SCI_GETSEARCHFLAGS 2199
 #define SCI_CALLTIPSHOW 2200
 #define SCI_CALLTIPCANCEL 2201
 #define SCI_CALLTIPACTIVE 2202
@@ -284,6 +334,14 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_TOGGLEFOLD 2231
 #define SCI_ENSUREVISIBLE 2232
 #define SCI_SETFOLDFLAGS 2233
+#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
+#define SCI_SETTABINDENTS 2260
+#define SCI_GETTABINDENTS 2261
+#define SCI_SETBACKSPACEUNINDENTS 2262
+#define SCI_GETBACKSPACEUNINDENTS 2263
+#define SC_TIME_FOREVER 10000000
+#define SCI_SETMOUSEDWELLTIME 2264
+#define SCI_GETMOUSEDWELLTIME 2265
 #define SCI_LINEDOWN 2300
 #define SCI_LINEDOWNEXTEND 2301
 #define SCI_LINEUP 2302
@@ -328,6 +386,7 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_UPPERCASE 2341
 #define SCI_LINESCROLLDOWN 2342
 #define SCI_LINESCROLLUP 2343
+#define SCI_MOVECARETINSIDEVIEW 2401
 #define SCI_LINELENGTH 2350
 #define SCI_BRACEHIGHLIGHT 2351
 #define SCI_BRACEBADLIGHT 2352
@@ -352,6 +411,8 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define CARET_SLOP 0x01
 #define CARET_CENTER 0x02
 #define CARET_STRICT 0x04
+#define CARET_XEVEN 0x08
+#define CARET_XJUMPS 0x10
 #define SCI_SETCARETPOLICY 2369
 #define SCI_LINESONSCREEN 2370
 #define SCI_USEPOPUP 2371
@@ -362,6 +423,25 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_ADDREFDOCUMENT 2376
 #define SCI_RELEASEDOCUMENT 2377
 #define SCI_GETMODEVENTMASK 2378
+#define SCI_SETFOCUS 2380
+#define SCI_GETFOCUS 2381
+#define SCI_SETSTATUS 2382
+#define SCI_GETSTATUS 2383
+#define SCI_SETMOUSEDOWNCAPTURES 2384
+#define SCI_GETMOUSEDOWNCAPTURES 2385
+#define SC_CURSORNORMAL -1
+#define SC_CURSORWAIT 3
+#define SCI_SETCURSOR 2386
+#define SCI_GETCURSOR 2387
+#define SCI_WORDPARTLEFT 2390
+#define SCI_WORDPARTLEFTEXTEND 2391
+#define SCI_WORDPARTRIGHT 2392
+#define SCI_WORDPARTRIGHTEXTEND 2393
+#define VISIBLE_SLOP 0x01
+#define VISIBLE_STRICT 0x04
+#define SCI_SETVISIBLEPOLICY 2394
+#define SCI_DELLINELEFT 2395
+#define SCI_DELLINERIGHT 2396
 #define SCI_GRABFOCUS 2400
 #define SCI_STARTRECORD 3001
 #define SCI_STOPRECORD 3002
@@ -370,6 +450,7 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCI_COLOURISE 4003
 #define SCI_SETPROPERTY 4004
 #define SCI_SETKEYWORDS 4005
+#define SCI_SETLEXERLANGUAGE 4006
 #define SC_MOD_INSERTTEXT 0x1
 #define SC_MOD_DELETETEXT 0x2
 #define SC_MOD_CHANGESTYLE 0x4
@@ -419,6 +500,11 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara
 #define SCN_MARGINCLICK 2010
 #define SCN_NEEDSHOWN 2011
 #define SCN_POSCHANGED 2012
+#define SCN_PAINTED 2013
+#define SCN_USERLISTSELECTION 2014
+#define SCN_URIDROPPED 2015
+#define SCN_DWELLSTART 2016
+#define SCN_DWELLEND 2017
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
 
 // Optional module for macro recording
@@ -437,14 +523,14 @@ struct CharacterRange {
 };
 
 struct TextRange {
-       CharacterRange chrg;
+       struct CharacterRange chrg;
        char *lpstrText;
 };
 
 struct TextToFind {
-       CharacterRange chrg;
+       struct CharacterRange chrg;
        char *lpstrText;
-       CharacterRange chrgText;
+       struct CharacterRange chrgText;
 };
 
 #ifdef PLATFORM_H
@@ -463,8 +549,8 @@ struct RangeToFormat {
 #endif
 
 struct NotifyHeader {
-    // hwndFrom is really an environment specifc window handle or pointer
-    // but most clients of Scintilla.h do not have this type visible.
+       // hwndFrom is really an environment specifc window handle or pointer
+       // but most clients of Scintilla.h do not have this type visible.
        //WindowID hwndFrom;
        void *hwndFrom; 
        unsigned int idFrom;
@@ -472,26 +558,35 @@ struct NotifyHeader {
 };
 
 struct SCNotification {
-       NotifyHeader nmhdr;
-       int position;                   // SCN_STYLENEEDED, SCN_MODIFIED
-       int ch;                                 // SCN_CHARADDED, SCN_KEY
-       int modifiers;                  // SCN_KEY
-       int modificationType;   // SCN_MODIFIED
-       const char *text;               // SCN_MODIFIED
-       int length;                             // SCN_MODIFIED
-       int linesAdded; // SCN_MODIFIED
+       struct NotifyHeader nmhdr;
+       int position;   // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND
+       int ch;         // SCN_CHARADDED, SCN_KEY
+       int modifiers;  // SCN_KEY
+       int modificationType;   // SCN_MODIFIED
+       const char *text;       // SCN_MODIFIED
+       int length;             // SCN_MODIFIED
+       int linesAdded; // SCN_MODIFIED
 #ifdef MACRO_SUPPORT
        int message;    // SCN_MACRORECORD
-       int wParam;     // SCN_MACRORECORD
-       int lParam;     // SCN_MACRORECORD
+       uptr_t wParam;  // SCN_MACRORECORD
+       sptr_t lParam;          // SCN_MACRORECORD
 #endif
-       int line;                       // SCN_MODIFIED
+       int line;               // SCN_MODIFIED
        int foldLevelNow;       // SCN_MODIFIED
        int foldLevelPrev;      // SCN_MODIFIED
-       int margin;     // SCN_MARGINCLICK
+       int margin;             // SCN_MARGINCLICK
+       int listType;   // SCN_USERLISTSELECTION
+       int x;                  // SCN_DWELLSTART, SCN_DWELLEND
+       int y;          // SCN_DWELLSTART, SCN_DWELLEND
 };
 
-#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | (1<<SC_MARKNUM_FOLDEROPEN))
+#define SC_MASK_FOLDERS ((1<<SC_MARKNUM_FOLDER) | \
+       (1<<SC_MARKNUM_FOLDEROPEN) | \
+       (1<<SC_MARKNUM_FOLDERSUB) | \
+       (1<<SC_MARKNUM_FOLDERTAIL) | \
+       (1<<SC_MARKNUM_FOLDERMIDTAIL) | \
+       (1<<SC_MARKNUM_FOLDEROPENMID) | \
+       (1<<SC_MARKNUM_FOLDEREND))
 
 // Deprecation section listing all API features that are deprecated and will
 // will be removed completely in a future version.
@@ -499,10 +594,6 @@ struct SCNotification {
 
 #ifdef INCLUDE_DEPRECATED_FEATURES
 
-// Deprecated in 1.27
-#define SC_UNDOCOLLECT_NONE 0
-#define SC_UNDOCOLLECT_AUTOSTART 1
-
 #endif
 
 #endif
index 416063efa50c2d24b557f976afb2358e26f7f7a6..90360076fa5f48bd032cd19ed705ef3b50ca48b2 100644 (file)
@@ -134,6 +134,10 @@ set void SetViewWS=2021(int viewWS,)
 # Find the position from a point within the window.
 fun int PositionFromPoint=2022(int x, int y)
 
+# Find the position from a point within the window but return
+# INVALID_POSITION if not close to text.
+fun int PositionFromPointClose=2023(int x, int y)
+
 # Set caret to start of a line and ensure it is visible.
 fun void GotoLine=2024(int line,)
 
@@ -151,13 +155,13 @@ fun int GetCurLine=2027(int length, stringresult text)
 # Retrieve the position of the last correctly styled character.
 get position GetEndStyled=2028(,)
 
-# Convert all line endings in the document to use the current mode.
-fun void ConvertEOLs=2029(,)
-
 val SC_EOL_CRLF=0
 val SC_EOL_CR=1
 val SC_EOL_LF=2
 
+# Convert all line endings in the document to one mode.
+fun void ConvertEOLs=2029(int eolMode,)
+
 # Retrieve the current end of line mode - one of CRLF, CR, or LF.
 get int GetEOLMode=2030(,)
 
@@ -210,6 +214,27 @@ val SC_MARK_ARROWDOWN=6
 val SC_MARK_MINUS=7
 val SC_MARK_PLUS=8
 
+# Shapes used for outlining column
+val SC_MARK_VLINE=9
+val SC_MARK_LCORNER=10
+val SC_MARK_TCORNER=11
+val SC_MARK_BOXPLUS=12
+val SC_MARK_BOXPLUSCONNECTED=13
+val SC_MARK_BOXMINUS=14
+val SC_MARK_BOXMINUSCONNECTED=15
+val SC_MARK_LCORNERCURVE=16
+val SC_MARK_TCORNERCURVE=17
+val SC_MARK_CIRCLEPLUS=18
+val SC_MARK_CIRCLEPLUSCONNECTED=19
+val SC_MARK_CIRCLEMINUS=20
+val SC_MARK_CIRCLEMINUSCONNECTED=21
+
+# Markers used for outlining column
+val SC_MARKNUM_FOLDEREND=25
+val SC_MARKNUM_FOLDEROPENMID=26
+val SC_MARKNUM_FOLDERMIDTAIL=27
+val SC_MARKNUM_FOLDERTAIL=28
+val SC_MARKNUM_FOLDERSUB=29
 val SC_MARKNUM_FOLDER=30
 val SC_MARKNUM_FOLDEROPEN=31
 
@@ -327,6 +352,12 @@ fun void StyleResetDefault=2058(,)
 # Set a style to be underlined or not.
 set void StyleSetUnderline=2059(int style, bool underline)
 
+val SC_CASE_MIXED=0
+val SC_CASE_UPPER=1
+val SC_CASE_LOWER=2
+# Set a style to be mixed case, or to force upper or lower case.
+set void StyleSetCase=2060(int style, int caseForce)
+
 # Set the character set of the font in a style.
 set void StyleSetCharacterSet=2066(int style, int characterSet)
 
@@ -412,6 +443,18 @@ get int GetLineState=2093(int line,)
 # Retrieve the last line number that has line state.
 get int GetMaxLineState=2094(,)
 
+# Is the background of the line containing the caret in a different colour?
+get bool GetCaretLineVisible=2095(,)
+
+# Display the background of the line containing the caret in a different colour.
+set void SetCaretLineVisible=2096(bool show,)
+
+# Get the colour of the background of the line containing the caret.
+get colour GetCaretLineBack=2097(,)
+
+# Set the colour of the background of the line containing the caret.
+set void SetCaretLineBack=2098(colour back,)
+
 # Display a auto-completion list.
 # The lenEntered parameter indicates how many characters before
 # the caret should be used to provide context.
@@ -465,6 +508,15 @@ set void AutoCSetIgnoreCase=2115(bool ignoreCase,)
 # Retrieve state of ignore case flag.
 get bool AutoCGetIgnoreCase=2116(,)
 
+# Display a list of strings and send notification when user chooses one.
+fun void UserListShow=2117(int listType, string itemList)
+
+# Set whether or not autocompletion is hidden automatically when nothing matches
+set void AutoCSetAutoHide=2118(bool autoHide,)
+
+# Retrieve whether or not autocompletion is hidden automatically when nothing matches
+get bool AutoCGetAutoHide=2119(,)
+
 # Set the number of spaces used for one level of indentation.
 set void SetIndent=2122(int indentSize,)
 
@@ -551,6 +603,10 @@ val SC_PRINT_NORMAL=0
 val SC_PRINT_INVERTLIGHT=1
 # PrintColourMode - force black text on white background for printing.
 val SC_PRINT_BLACKONWHITE=2
+# PrintColourMode - text stays coloured, but all background is forced to be white for printing.
+val SC_PRINT_COLOURONWHITE=3
+# PrintColourMode - only the default-background is forced to be white for printing.
+val SC_PRINT_COLOURONWHITEDEFAULTBG=4
 
 # Modify colours when printing for clearer printed text.
 set void SetPrintColourMode=2148(int mode,)
@@ -558,11 +614,9 @@ set void SetPrintColourMode=2148(int mode,)
 # Returns the print colour mode.
 get int GetPrintColourMode=2149(,)
 
-val SCFIND_DOWN=1
 val SCFIND_WHOLEWORD=2
 val SCFIND_MATCHCASE=4
 val SCFIND_WORDSTART=0x00100000
-# SCFIND_REGEXP is not yet implemented.
 val SCFIND_REGEXP=0x00200000
 
 # Find some text in the document.
@@ -582,13 +636,13 @@ fun int GetLine=2153(int line, stringresult text)
 get int GetLineCount=2154(,)
 
 # Sets the size in pixels of the left margin.
-set void SetMarginLeft=2155(, int width)
+set void SetMarginLeft=2155(, int pixelWidth)
 
 # Returns the size in pixels of the left margin.
 get int GetMarginLeft=2156(,)
 
 # Sets the size in pixels of the right margin.
-set void SetMarginRight=2157(, int width)
+set void SetMarginRight=2157(, int pixelWidth)
 
 # Returns the size in pixels of the right margin.
 get int GetMarginRight=2158(,)
@@ -684,6 +738,48 @@ set void SetOvertype=2186(bool overtype,)
 # Returns true if overtype mode is active otherwise false is returned.
 get bool GetOvertype=2187(,)
 
+# Set the width of the insert mode caret
+set void SetCaretWidth=2188(int pixelWidth,)
+
+# Returns the width of the insert mode caret
+get int GetCaretWidth=2189(,)
+
+# Sets the position that starts the target which is used for updating the
+# document without affecting the scroll position.
+set void SetTargetStart=2190(position pos,)
+
+# Get the position that starts the target.
+get position GetTargetStart=2191(,)
+
+# Sets the position that ends the target which is used for updating the
+# document without affecting the scroll position.
+set void SetTargetEnd=2192(position pos,)
+
+# Get the position that ends the target.
+get position GetTargetEnd=2193(,)
+
+# Replace the target text with the argument text.
+# Returns the length of the replacement text.
+fun int ReplaceTarget=2194(int length, string text)
+
+# Replace the target text with the argument text after \d processing.
+# Looks for \d where d is between 1 and 9 and replaces these with the strings
+# matched in the last search operation which were surrounded by \( and \).
+# Returns the length of the replacement text including any change
+# caused by processing the \d patterns.
+fun int ReplaceTargetRE=2195(int length, string text)
+
+# Search for a counted string in the target and set the target to the found
+# range.
+# Returns length of range or -1 for failure in which case target is not moved.
+fun int SearchInTarget=2197(int length, string text)
+
+# Set the search flags used by SearchInTarget
+set void SetSearchFlags=2198(int flags,)
+
+# Get the search flags used by SearchInTarget
+get int GetSearchFlags=2199(,)
+
 # Show a call tip containing a definition near position pos.
 fun void CallTipShow=2200(position pos, string definition)
 
@@ -751,6 +847,30 @@ fun void EnsureVisible=2232(int line,)
 # Set some debugging options for folding
 fun void SetFoldFlags=2233(int flags,)
 
+# Ensure a particular line is visible by expanding any header line hiding it.
+# Use the currently set visibility policy to determine which range to display.
+fun void EnsureVisibleEnforcePolicy=2234(int line,)
+
+# Sets whether a tab pressed when caret is within indentation indents
+set void SetTabIndents=2260(bool tabIndents,)
+
+# Does a tab pressed when caret is within indentation indent?
+get bool GetTabIndents=2261(,)
+
+# Sets whether a backspace pressed when caret is within indentation unindents
+set void SetBackSpaceUnIndents=2262(bool bsUnIndents,)
+
+# Does a backspace pressed when caret is within indentation unindent?
+get bool GetBackSpaceUnIndents=2263(,)
+
+val SC_TIME_FOREVER=10000000
+
+# Sets the time the mouse must sit still to generate a mouse dwell event
+set void SetMouseDwellTime=2264(int periodMilliseconds,)
+
+# Retrieve the time the mouse must sit still to generate a mouse dwell event
+get int GetMouseDwellTime=2265(,)
+
 ## Start of key messages
 # Move caret down one line.
 fun void LineDown=2300(,)
@@ -887,6 +1007,9 @@ fun void LineScrollDown=2342(,)
 # Scroll the document up, keeping the caret visible.
 fun void LineScrollUp=2343(,)
 
+# Move the caret inside current view if it's not there already
+fun void MoveCaretInsideView=2401(,)
+
 # How many characters are on a line, not including end of line characters.
 fun int LineLength=2350(int line,)
 
@@ -909,7 +1032,7 @@ set void SetViewEOL=2356(bool visible,)
 get int GetDocPointer=2357(,)
 
 # Change the document object used.
-set void SetDocPointer=2358(int pointer,)
+set void SetDocPointer=2358(,int pointer)
 
 # Set which document modification events are sent to the container.
 set void SetModEventMask=2359(int mask,)
@@ -942,18 +1065,28 @@ set void SetEdgeColour=2365(colour edgeColour,)
 fun void SearchAnchor=2366(,)
 
 # Find some text starting at the search anchor.
+# Does not ensure the selection is visible.
 fun int SearchNext=2367(int flags, string text)
 
 # Find some text starting at the search anchor and moving backwards.
+# Does not ensure the selection is visible.
 fun int SearchPrev=2368(int flags, string text)
 
 # Show caret within N lines of edge when it's scrolled to view
+# If CARET_SLOP not set then centre caret on screen when it's
+# scrolled to view
 val CARET_SLOP=0x01
-# Center caret on screen when it's scrolled to view
+# Value not used
 val CARET_CENTER=0x02
-# OR this with CARET_CENTER to reposition even when visible, or
-# OR this with CARET_SLOP to reposition whenever outside slop border
+# If CARET_SLOP also set then reposition whenever outside slop border
+# If CARET_SLOP not set then recentre even when visible
 val CARET_STRICT=0x04
+# If CARET_XEVEN set then both left and right margins are given equal weight
+# rather than favouring left following behaviour.
+val CARET_XEVEN=0x08
+# If CARET_XJUMPS set then when caret reaches the margin the display jumps
+# enough to leave the caret solidly within the display.
+val CARET_XJUMPS=0x10
 # Set the way the line the caret is on is kept visible.
 fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
 
@@ -984,6 +1117,49 @@ fun void ReleaseDocument=2377(, int doc)
 # Get which document modification events are sent to the container.
 get int GetModEventMask=2378(,)
 
+# Change internal focus flag
+set void SetFocus=2380(bool focus,)
+# Get internal focus flag
+get bool GetFocus=2381(,)
+
+# Change error status - 0 = OK
+set void SetStatus=2382(int statusCode,)
+# Get error status
+get int GetStatus=2383(,)
+
+# Set whether the mouse is captured when its button is pressed
+set void SetMouseDownCaptures=2384(bool captures,)
+# Get whether mouse gets captured
+get bool GetMouseDownCaptures=2385(,)
+
+val SC_CURSORNORMAL=-1
+val SC_CURSORWAIT=3
+# Sets the cursor to one of the SC_CURSOR* values
+set void SetCursor=2386(int cursorType,)
+# Get cursor type
+get int GetCursor=2387(,)
+
+# Move to the previous change in capitalistion
+fun void WordPartLeft=2390(,)
+# Move to the previous change in capitalistion extending selection to new caret position.
+fun void WordPartLeftExtend=2391(,)
+# Move to the change next in capitalistion
+fun void WordPartRight=2392(,)
+# Move to the next change in capitalistion extending selection to new caret position.
+fun void WordPartRightExtend=2393(,)
+
+# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
+val VISIBLE_SLOP=0x01
+val VISIBLE_STRICT=0x04
+# Set the way the display area is determined when a particular line is to be moved to.
+fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop)
+
+# Delete back from the current position to the start of the line
+fun void DelLineLeft=2395(,)
+
+# Delete forwards from the current position to the end of the line
+fun void DelLineRight=2396(,)
+
 # Set the focus to this Scintilla widget.
 # GTK+ Specific
 fun void GrabFocus=2400(,)
@@ -1009,6 +1185,9 @@ set void SetProperty=4004(string key, string value)
 # Set up the key words used by the lexer.
 set void SetKeyWords=4005(int keywordSet, string keyWords)
 
+# Set the lexing language of the document based on string name.
+set void SetLexerLanguage=4006(, string language)
+
 # Notifications
 # Type of modification and the action which caused the modification
 # These are defined as a bit mask to make it easy to specify which notifications are wanted.
@@ -1077,6 +1256,18 @@ val SCLEX_XCODE=13
 val SCLEX_LATEX=14
 val SCLEX_LUA=15
 val SCLEX_DIFF=16
+val SCLEX_CONF=17
+val SCLEX_PASCAL=18
+val SCLEX_AVE=19
+val SCLEX_ADA=20
+val SCLEX_LISP=21
+val SCLEX_RUBY=22
+val SCLEX_EIFFEL=23
+val SCLEX_EIFFELKW=24
+val SCLEX_TCL=25
+# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
+# value assigned in sequence from SCLEX_AUTOMATIC+1.
+val SCLEX_AUTOMATIC=1000
 # Lexical states for SCLEX_PYTHON
 val SCE_P_DEFAULT=0
 val SCE_P_COMMENTLINE=1
@@ -1107,6 +1298,9 @@ val SCE_C_OPERATOR=10
 val SCE_C_IDENTIFIER=11
 val SCE_C_STRINGEOL=12
 val SCE_C_VERBATIM=13
+val SCE_C_REGEX=14
+val SCE_C_COMMENTLINEDOC=15
+val SCE_C_WORD2=16
 # Lexical states for SCLEX_HTML, SCLEX_XML
 val SCE_H_DEFAULT=0
 val SCE_H_TAG=1
@@ -1130,6 +1324,10 @@ val SCE_H_CDATA=17
 val SCE_H_QUESTION=18
 # More HTML
 val SCE_H_VALUE=19
+# X-Code
+val SCE_H_XCCOMMENT=20
+# SGML
+val SCE_H_SGML=21
 # Embedded Javascript
 val SCE_HJ_START=40
 val SCE_HJ_DEFAULT=41
@@ -1143,6 +1341,7 @@ val SCE_HJ_DOUBLESTRING=48
 val SCE_HJ_SINGLESTRING=49
 val SCE_HJ_SYMBOLS=50
 val SCE_HJ_STRINGEOL=51
+val SCE_HJ_REGEX=52
 # ASP Javascript
 val SCE_HJA_START=55
 val SCE_HJA_DEFAULT=56
@@ -1156,6 +1355,7 @@ val SCE_HJA_DOUBLESTRING=63
 val SCE_HJA_SINGLESTRING=64
 val SCE_HJA_SYMBOLS=65
 val SCE_HJA_STRINGEOL=66
+val SCE_HJA_REGEX=67
 # Embedded VBScript
 val SCE_HB_START=70
 val SCE_HB_DEFAULT=71
@@ -1211,10 +1411,11 @@ val SCE_HPHP_NUMBER=122
 val SCE_HPHP_VARIABLE=123
 val SCE_HPHP_COMMENT=124
 val SCE_HPHP_COMMENTLINE=125
-val SCE_HPHP_STRINGEOL=126
+val SCE_HPHP_HSTRING_VARIABLE=126
+val SCE_HPHP_OPERATOR=127
 # Lexical states for SCLEX_PERL
 val SCE_PL_DEFAULT=0
-val SCE_PL_HERE=1
+val SCE_PL_ERROR=1
 val SCE_PL_COMMENTLINE=2
 val SCE_PL_POD=3
 val SCE_PL_NUMBER=4
@@ -1229,12 +1430,20 @@ val SCE_PL_SCALAR=12
 val SCE_PL_ARRAY=13
 val SCE_PL_HASH=14
 val SCE_PL_SYMBOLTABLE=15
-val SCE_PL_REF=16
 val SCE_PL_REGEX=17
 val SCE_PL_REGSUBST=18
 val SCE_PL_LONGQUOTE=19
 val SCE_PL_BACKTICKS=20
 val SCE_PL_DATASECTION=21
+val SCE_PL_HERE_DELIM=22
+val SCE_PL_HERE_Q=23
+val SCE_PL_HERE_QQ=24
+val SCE_PL_HERE_QX=25
+val SCE_PL_STRING_Q=26
+val SCE_PL_STRING_QQ=27
+val SCE_PL_STRING_QX=28
+val SCE_PL_STRING_QR=29
+val SCE_PL_STRING_QW=30
 # Lexical states for SCLEX_LATEX
 val SCE_L_DEFAULT=0
 val SCE_L_COMMAND=1
@@ -1255,6 +1464,7 @@ val SCE_LUA_PREPROCESSOR=9
 val SCE_LUA_OPERATOR=10
 val SCE_LUA_IDENTIFIER=11
 val SCE_LUA_STRINGEOL=12
+# Lexical states for SCLEX_ERRORLIST
 val SCE_ERR_DEFAULT=0
 val SCE_ERR_PYTHON=1
 val SCE_ERR_GCC=2
@@ -1262,6 +1472,81 @@ val SCE_ERR_MS=3
 val SCE_ERR_CMD=4
 val SCE_ERR_BORLAND=5
 val SCE_ERR_PERL=6
+val SCE_ERR_NET=7
+val SCE_ERR_LUA=8
+val SCE_ERR_DIFF_CHANGED=10
+val SCE_ERR_DIFF_ADDITION=11
+val SCE_ERR_DIFF_DELETION=12
+val SCE_ERR_DIFF_MESSAGE=13
+# Lexical states for SCLEX_BATCH
+val SCE_BAT_DEFAULT=0
+val SCE_BAT_COMMENT=1
+val SCE_BAT_WORD=2
+val SCE_BAT_LABEL=3
+val SCE_BAT_HIDE=4
+val SCE_BAT_COMMAND=5
+val SCE_BAT_IDENTIFIER=6
+val SCE_BAT_OPERATOR=7
+# Lexical states for SCLEX_MAKEFILE
+val SCE_MAKE_DEFAULT=0
+val SCE_MAKE_COMMENT=1
+val SCE_MAKE_PREPROCESSOR=2
+val SCE_MAKE_IDENTIFIER=3
+val SCE_MAKE_OPERATOR=4
+val SCE_MAKE_TARGET=5
+val SCE_MAKE_IDEOL=9
+# Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+val SCE_CONF_DEFAULT=0
+val SCE_CONF_COMMENT=1
+val SCE_CONF_NUMBER=2
+val SCE_CONF_IDENTIFIER=3
+val SCE_CONF_EXTENSION=4
+val SCE_CONF_PARAMETER=5
+val SCE_CONF_STRING=6
+val SCE_CONF_OPERATOR=7
+val SCE_CONF_IP=8
+val SCE_CONF_DIRECTIVE=9
+# Avenue
+val SCE_AVE_DEFAULT=0
+val SCE_AVE_COMMENT=1
+val SCE_AVE_NUMBER=2
+val SCE_AVE_WORD=3
+val SCE_AVE_KEYWORD=4
+val SCE_AVE_STATEMENT=5
+val SCE_AVE_STRING=6
+val SCE_AVE_ENUM=7
+val SCE_AVE_STRINGEOL=8
+val SCE_AVE_IDENTIFIER=9
+val SCE_AVE_OPERATOR=10
+# Lexical states for SCLEX_ADA
+val SCE_ADA_DEFAULT=0
+val SCE_ADA_COMMENT=1
+val SCE_ADA_NUMBER=2
+val SCE_ADA_WORD=3
+val SCE_ADA_STRING=4
+val SCE_ADA_CHARACTER=5
+val SCE_ADA_OPERATOR=6
+val SCE_ADA_IDENTIFIER=7
+val SCE_ADA_STRINGEOL=8
+# Lexical states for SCLEX_LISP
+val SCE_LISP_DEFAULT=0
+val SCE_LISP_COMMENT=1
+val SCE_LISP_NUMBER=2
+val SCE_LISP_KEYWORD=3
+val SCE_LISP_STRING=6
+val SCE_LISP_STRINGEOL=8
+val SCE_LISP_IDENTIFIER=9
+val SCE_LISP_OPERATOR=10
+# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+val SCE_EIFFEL_DEFAULT=0
+val SCE_EIFFEL_COMMENTLINE=1
+val SCE_EIFFEL_NUMBER=2
+val SCE_EIFFEL_WORD=3
+val SCE_EIFFEL_STRING=4
+val SCE_EIFFEL_CHARACTER=5
+val SCE_EIFFEL_OPERATOR=6
+val SCE_EIFFEL_IDENTIFIER=7
+val SCE_EIFFEL_STRINGEOL=8
 
 # Events
 
@@ -1282,9 +1567,16 @@ evt void MacroRecord=2009(int message, int wParam, int lParam)
 evt void MarginClick=2010(int modifiers, int position, int margin)
 evt void NeedShown=2011(int position, int length)
 evt void PosChanged=2012(int position)
+evt void Painted=2013(void)
+evt void UserListSelection=2014(int listType, string text)
+evt void URIDropped=2015(string text)
+evt void DwellStart=2016(int position)
+evt void DwellEnd=2017(int position)
 
 cat Deprecated
 
+val SCFIND_DOWN=1
+
 ################################################
 # From WinDefs.h
 
index 980557a2e7450a594efc0001e5e21c89be1ebcd4..f6c2fc3542c343af2c1cd05622063e6c6da084d3 100644 (file)
@@ -1,7 +1,9 @@
 // Scintilla source code edit control
-// ScintillaWidget.h - definition of Scintilla widget for GTK+
-// Only needed by GTK+ code but is harmless on other platforms.
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ScintillaWidget.h
+ ** Definition of Scintilla widget for GTK+.
+ ** Only needed by GTK+ code but is harmless on other platforms.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef SCINTILLAWIDGET_H
@@ -9,6 +11,17 @@
 
 #if PLAT_GTK
 
+#ifndef SCINTILLA_H
+#ifdef _MSC_VER
+#pragma message(__FILE__ "(1) : warning : Scintilla.h should be included before ScintillaWidget.h")
+#pragma message("This will be required in the next version of Scintilla")
+#else
+#warning Scintilla.h should be included before ScintillaWidget.h
+#warning This will be required in the next version of Scintilla
+#endif
+#include "Scintilla.h"
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -21,7 +34,7 @@ typedef struct _ScintillaObject ScintillaObject;
 typedef struct _ScintillaClass  ScintillaClass;
 
 struct _ScintillaObject {
-       GtkFixed vbox;
+       GtkContainer cont;
        void *pscin;
 };
 
@@ -35,7 +48,7 @@ struct _ScintillaClass {
 guint          scintilla_get_type      (void);
 GtkWidget*     scintilla_new           (void);
 void           scintilla_set_id        (ScintillaObject *sci,int id);
-long           scintilla_send_message  (ScintillaObject *sci,int iMessage,int wParam,int lParam);
+sptr_t scintilla_send_message  (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
 #ifdef __cplusplus
 }
index c56f02d8109e9e331dfb9dd93a4acdccb511fdf0..b3421c0bcceee5f6e820504a97f45699e143e1a9 100644 (file)
@@ -1,11 +1,23 @@
 // Scintilla source code edit control
-// WinDefs.h - the subset of definitions from Windows needed by Scintilla for GTK+
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file WinDefs.h
+ ** The subset of definitions from Windows needed by Scintilla for GTK+.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef WINDEFS_H
 #define WINDEFS_H
 
+/* Running GTK version on win32 */
+#if PLAT_GTK_WIN32
+#include "Windows.h"
+#include "Richedit.h"
+
+/* Name conflicts */
+#undef DrawText
+#undef FindText
+#else
+
 #define WORD short
 #define WPARAM unsigned long
 #define LPARAM long
@@ -180,4 +192,6 @@ struct FORMATRANGE {
 //#define LOWORD(x) (x & 0xffff)
 //#define HIWORD(x) (x >> 16)
 
+#endif /* !_MSC_VER */
+
 #endif
index 4f41dfc7ff4db6948e87ad3ca6b13afd1254e581..7fd8e30fd7db980e0adeca21d8c49b53b3ec07e1 100644 (file)
@@ -1,7 +1,13 @@
-// WindowAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file WindowAccessor.h
+ ** Implementation of BufferAccess and StylingAccess on a Scintilla
+ ** rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
+/**
+ */
 class WindowAccessor : public Accessor {
        // Private so WindowAccessor objects can not be copied
        WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {}
@@ -36,6 +42,9 @@ public:
        int GetPropertyInt(const char *key, int defaultValue=0) { 
                return props.GetInt(key, defaultValue); 
        }
+       char *GetProperties() {
+               return props.ToString();
+       }
 
        void StartAt(unsigned int start, char chMask=31);
        void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
index 5bc50d1efab3dfe8db55159a75ff693d6349e4e0..7f7412e43fa9f10d37910ff87248d6ff616a2267 100644 (file)
@@ -1,13 +1,17 @@
 // Scintilla source code edit control
-// AutoComplete.cxx - defines the auto completion list box
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file AutoComplete.cxx
+ ** Defines the auto completion list box.
+ **/
+// Copyright 1998-2001 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 "Platform.h"
 
+#include "PropSet.h"
 #include "AutoComplete.h"
 
 AutoComplete::AutoComplete() : 
@@ -17,7 +21,8 @@ AutoComplete::AutoComplete() :
        chooseSingle(false),
        posStart(0),
        startLen(0),
-       cancelAtStartPos(true) {
+       cancelAtStartPos(true),
+       autoHide(true) {
        stopChars[0] = '\0';
        fillUpChars[0] = '\0';
 }
@@ -85,7 +90,6 @@ void AutoComplete::SetList(const char *list) {
                }
                delete []words;
        }
-       lb.Sort();
 }
 
 void AutoComplete::Show() {
@@ -113,9 +117,42 @@ void AutoComplete::Move(int delta) {
 }
 
 void AutoComplete::Select(const char *word) {
-       int pos = lb.Find(word);
-       //Platform::DebugPrintf("Autocompleting at <%s> %d\n", wordCurrent, pos);
-       if (pos != -1)
-               lb.Select(pos);
+       int lenWord = strlen(word);
+       int location = -1;
+       const int maxItemLen=1000;
+       char item[maxItemLen];
+       int start = 0; // lower bound of the api array block to search
+       int end = lb.Length() - 1; // upper bound of the api array block to search
+       while ((start <= end) && (location == -1)) { // Binary searching loop
+               int pivot = (start + end) / 2;
+               lb.GetValue(pivot, item, maxItemLen);
+               int cond;
+               if (ignoreCase)
+                       cond = CompareNCaseInsensitive(word, item, lenWord);
+               else
+                       cond = strncmp(word, item, lenWord);
+               if (!cond) {
+                       // Find first match
+                       while (pivot > start) {
+                               lb.GetValue(pivot-1, item, maxItemLen);
+                               if (ignoreCase)
+                                       cond = CompareNCaseInsensitive(word, item, lenWord);
+                               else
+                                       cond = strncmp(word, item, lenWord);
+                               if (0 != cond)
+                                       break;
+                               --pivot;
+                       }
+                       location = pivot;
+               } else if (cond < 0) {
+                       end = pivot - 1;
+               } else if (cond > 0) {
+                       start = pivot + 1;
+               }
+       }
+       if (location == -1 && autoHide)
+               Cancel();
+       else
+               lb.Select(location);
 }
 
index c1789ad7b6c88a9529674651ce31fd47183095bf..79d467529134261c3bc2f39bf72fa225b28dfda6 100644 (file)
@@ -1,56 +1,62 @@
 // Scintilla source code edit control
-// AutoComplete.h - defines the auto completion list box
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file AutoComplete.h
+ ** Defines the auto completion list box.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef AUTOCOMPLETE_H
 #define AUTOCOMPLETE_H
 
+/**
+ */
 class AutoComplete {
        bool active;
        char stopChars[256];
        char fillUpChars[256];
        char separator;
+
 public:
        bool ignoreCase;
        bool chooseSingle;
        ListBox lb;
        int posStart;
        int startLen;
-       // Should autocompletion be canceled if editor's currentPos <= startPos?
+       /// Should autocompletion be canceled if editor's currentPos <= startPos?
        bool cancelAtStartPos;
-       
+       bool autoHide;
+
        AutoComplete();
        ~AutoComplete();
 
-       // Is the auto completion list displayed?       
+       /// Is the auto completion list displayed?
        bool Active();
-       
-       // Display the auto completion list positioned to be near a character position
+
+       /// Display the auto completion list positioned to be near a character position
        void Start(Window &parent, int ctrlID, int position, int startLen_);
-       
-       // The stop chars are characters which, when typed, cause the auto completion list to disappear
+
+       /// The stop chars are characters which, when typed, cause the auto completion list to disappear
        void SetStopChars(const char *stopChars_);
        bool IsStopChar(char ch);
-       
-       // The fillup chars are characters which, when typed, fill up the selected word
+
+       /// The fillup chars are characters which, when typed, fill up the selected word
        void SetFillUpChars(const char *fillUpChars_);
        bool IsFillUpChar(char ch);
 
-       // The separator character is used when interpreting the list in SetList
+       /// The separator character is used when interpreting the list in SetList
        void SetSeparator(char separator_);
        char GetSeparator();
-       
-       // The list string contains a sequence of words separated by the separator character
+
+       /// The list string contains a sequence of words separated by the separator character
        void SetList(const char *list);
-       
+
        void Show();
        void Cancel();
-       
-       // Move the current list element by delta, scrolling appropriately
+
+       /// Move the current list element by delta, scrolling appropriately
        void Move(int delta);
-       
-       // Select a list element that starts with word as the current element
+
+       /// Select a list element that starts with word as the current element
        void Select(const char *word);
 };
 
index d22a96364567ff8329cb0af146d8a43bcf7df861..3422de69696a697a4952871abfe35c298f31731f 100644 (file)
@@ -1,10 +1,12 @@
 // Scintilla source code edit control
-// CallTip.cxx - code for displaying call tips
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file CallTip.cxx
+ ** Code for displaying call tips.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
 
 #include "Platform.h"
 
@@ -27,6 +29,7 @@ CallTip::CallTip() {
 }
 
 CallTip::~CallTip() {
+       font.Release();
        wCallTip.Destroy();
        delete []val;
        val = 0;
@@ -42,7 +45,7 @@ void CallTip::RefreshColourPalette(Palette &pal, bool want) {
 
 void CallTip::PaintCT(Surface *surfaceWindow) {
        if (!val)
-               return;
+               return ;
        PRectangle rcClientPos = wCallTip.GetClientPosition();
        PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left,
                                rcClientPos.bottom - rcClientPos.top);
@@ -117,7 +120,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
                                  const char *faceName, int size) {
        Surface surfaceMeasure;
        surfaceMeasure.Init();
-       int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72;
+       int deviceHeight = surfaceMeasure.DeviceHeightFont(size);
        font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false);
        if (val)
                delete []val;
@@ -146,10 +149,9 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
        int lineHeight = surfaceMeasure.Height(font);
        // Extra line for border and an empty line at top and bottom
        int height = lineHeight * numLines - surfaceMeasure.InternalLeading(font) + 2 + 2;
-       return PRectangle(pt.x -5, pt.y + lineHeight + 1, pt.x + width - 5, pt.y + lineHeight + 1 + height);
+       return PRectangle(pt.x -5, pt.y + 1, pt.x + width - 5, pt.y + 1 + height);
 }
 
-
 void CallTip::CallTipCancel() {
        inCallTipMode = false;
        if (wCallTip.Created()) {
index cb5bc29032fb3914d5740631fda935f3227c1b77..b38a4840abbd058b4fa15a8000895f51fe16664c 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// CallTip.h - interface to the call tip control
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file CallTip.h
+ ** Interface to the call tip control.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef CALLTIP_H
 #define CALLTIP_H
 
+/**
+ */
 class CallTip {
        int startHighlight;
        int endHighlight;
@@ -14,6 +18,7 @@ class CallTip {
        // Private so CallTip objects can not be copied
        CallTip(const CallTip &) {}
        CallTip &operator=(const CallTip &) { return *this; }
+
 public:
        Window wCallTip;
        Window wDraw;
@@ -28,19 +33,19 @@ public:
        CallTip();
        ~CallTip();
        
-       // Claim or accept palette entries for the colours required to paint a calltip
+       /// Claim or accept palette entries for the colours required to paint a calltip.
        void RefreshColourPalette(Palette &pal, bool want);
        
        void PaintCT(Surface *surfaceWindow);
        
-       // Setup the calltip and return a rectangle of the area required
+       /// Setup the calltip and return a rectangle of the area required.
        PRectangle CallTipStart(int pos, Point pt, const char *defn, 
                const char *faceName, int size);
                
        void CallTipCancel();
        
-       // Set a range of characters to be displayed in a highlight style.
-       // Commonly used to highlight the current parameter.
+       /// Set a range of characters to be displayed in a highlight style.
+       /// Commonly used to highlight the current parameter.
        void SetHighlight(int start, int end);
 };
 
index befec75fc34273b8e206543946730ed5542e082b..ecb5bc1801554749e8146743a134125639ffea2a 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// CellBuffer.cxx - manages a buffer of cells
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file CellBuffer.cxx
+ ** Manages a buffer of cells.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdio.h>
@@ -416,22 +418,19 @@ UndoHistory::~UndoHistory() {
 }
 
 void UndoHistory::EnsureUndoRoom() {
-       //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, length, currentAction);
-       if (currentAction >= 2) {
-               // Have to test that there is room for 2 more actions in the array
-               // as two actions may be created by this function
-               if (currentAction >= (lenActions - 2)) {
-                       // Run out of undo nodes so extend the array
-                       int lenActionsNew = lenActions * 2;
-                       Action *actionsNew = new Action[lenActionsNew];
-                       if (!actionsNew)
-                               return ;
-                       for (int act = 0; act <= currentAction; act++)
-                               actionsNew[act].Grab(&actions[act]);
-                       delete []actions;
-                       lenActions = lenActionsNew;
-                       actions = actionsNew;
-               }
+       // Have to test that there is room for 2 more actions in the array
+       // as two actions may be created by the calling function
+       if (currentAction >= (lenActions - 2)) {
+               // Run out of undo nodes so extend the array
+               int lenActionsNew = lenActions * 2;
+               Action *actionsNew = new Action[lenActionsNew];
+               if (!actionsNew)
+                       return ;
+               for (int act = 0; act <= currentAction; act++)
+                       actionsNew[act].Grab(&actions[act]);
+               delete []actions;
+               lenActions = lenActionsNew;
+               actions = actionsNew;
        }
 }
 
@@ -450,14 +449,27 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
                                currentAction++;
                        } else if (currentAction == savePoint) {
                                currentAction++;
-                       } else if ((at == removeAction) &&
-                                  ((position + lengthData * 2) != actPrevious.position)) {
-                               // Removals must be at same position to coalesce
-                               currentAction++;
                        } else if ((at == insertAction) &&
                                   (position != (actPrevious.position + actPrevious.lenData*2))) {
                                // Insertions must be immediately after to coalesce
                                currentAction++;
+                       } else if (!actions[currentAction].mayCoalesce) {
+                               // Not allowed to coalesce if this set
+                               currentAction++;
+                       } else if (at == removeAction) {
+                               if ((lengthData == 1) || (lengthData == 2)){
+                                       if ((position + lengthData * 2) == actPrevious.position) {
+                                               ; // Backspace -> OK
+                                       } else if (position == actPrevious.position) {
+                                               ; // Delete -> OK
+                                       } else {
+                                               // Removals must be at same position to coalesce
+                                               currentAction++;
+                                       }
+                               } else {
+                                       // Removals must be of one character to coalesce
+                                       currentAction++;
+                               }
                        } else {
                                //Platform::DebugPrintf("action coalesced\n");
                        }
@@ -582,6 +594,7 @@ CellBuffer::CellBuffer(int initialLength) {
        part2body = body + gaplen;
        readOnly = false;
        collectingUndo = true;
+       growSize = 4000;
 }
 
 CellBuffer::~CellBuffer() {
@@ -612,7 +625,9 @@ void CellBuffer::RoomFor(int insertionLength) {
        if (gaplen <= insertionLength) {
                //Platform::DebugPrintf("need room %d %d\n", gaplen, insertionLength);
                GapTo(length);
-               int newSize = size + insertionLength + 4000;
+               if (growSize * 6 < size)
+                       growSize *= 2;
+               int newSize = size + insertionLength + growSize;
                //Platform::DebugPrintf("moved gap %d\n", newSize);
                char *newBody = new char[newSize];
                memcpy(newBody, body, size);
@@ -733,6 +748,8 @@ bool CellBuffer::SetStyleAt(int position, char style, char mask) {
 bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mask) {
        int bytePos = position * 2 + 1;
        bool changed = false;
+       PLATFORM_ASSERT(lengthStyle == 0 ||
+               (lengthStyle > 0 && lengthStyle + position < length));
        while (lengthStyle--) {
                char curVal = ByteAt(bytePos);
                if ((curVal & mask) != style) {
@@ -779,7 +796,7 @@ int CellBuffer::LineStart(int line) {
        if (line < 0)
                return 0;
        else if (line > lv.lines)
-               return length;
+               return Length();
        else
                return lv.linesData[line].startPosition;
 }
@@ -930,7 +947,6 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
                        ignoreNL = true;        // First \n is not real deletion
                }
 
-
                char ch = chNext;
                for (int i = 0; i < deleteLength; i += 2) {
                        chNext = ' ';
@@ -948,7 +964,6 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
                                ignoreNL = false;       // Further \n are not real deletions
                        }
 
-
                        ch = chNext;
                }
                // May have to fix up end if last deletion causes cr to be next to lf
index 4a1ecb39899ba8023114ff0aaa8f1d6ed01b0694..b5c90f57a51b4f46433ff4bde1fa091641bebc1d 100644 (file)
@@ -1,28 +1,35 @@
 // Scintilla source code edit control
-// CellBuffer.h - manages the text of the document
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file CellBuffer.h
+ ** Manages the text of the document.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef CELLBUFFER_H
 #define CELLBUFFER_H
 
-// 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.
+ */
 struct MarkerHandleNumber {
        int handle;
        int number;
        MarkerHandleNumber *next;
 };
 
-// A marker handle set contains any number of MarkerHandleNumbers
+/**
+ * A marker handle set contains any number of MarkerHandleNumbers.
+ */
 class MarkerHandleSet {
        MarkerHandleNumber *root;
+
 public:
        MarkerHandleSet();
        ~MarkerHandleSet();
        int Length();
        int NumberFromHandle(int handle);
-       int MarkValue();        // Bit set of marker numbers
+       int MarkValue();        ///< Bit set of marker numbers.
        bool Contains(int handle);
        bool InsertHandle(int handle, int markerNum);
        void RemoveHandle(int handle);
@@ -30,8 +37,10 @@ public:
        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.
+/**
+ * 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;
@@ -39,7 +48,9 @@ struct LineData {
        }
 };
 
-// The line vector contains information about each of the lines in a cell buffer.
+/**
+ * The line vector contains information about each of the lines in a cell buffer.
+ */
 class LineVector {
 public:
        enum { growSize = 4000 };
@@ -48,22 +59,22 @@ public:
        int size;
        int *levels;
        int sizeLevels;
-       
-       // Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
+
+       /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
        int handleCurrent;
-       
+
        LineVector();
        ~LineVector();
        void Init();
 
        void Expand(int sizeNew);
        void ExpandLevels(int sizeNew=-1);
-    void ClearLevels();
+       void ClearLevels();
        void InsertValue(int pos, int value);
        void SetValue(int pos, int value);
        void Remove(int pos);
        int LineFromPosition(int pos);
-       
+
        int AddMark(int line, int marker);
        void MergeMarkers(int pos);
        void DeleteMark(int line, int markerNum);
@@ -71,9 +82,11 @@ public:
        int LineFromHandle(int markerHandle);
 };
 
-// Actions are used to store all the information required to perform one undo/redo step.
 enum actionType { insertAction, removeAction, startAction };
 
+/**
+ * Actions are used to store all the information required to perform one undo/redo step.
+ */
 class Action {
 public:
        actionType at;
@@ -89,6 +102,9 @@ public:
        void Grab(Action *source);
 };
 
+/**
+ *
+ */
 class UndoHistory {
        Action *actions;
        int lenActions;
@@ -98,25 +114,25 @@ class UndoHistory {
        int savePoint;
 
        void EnsureUndoRoom();
-       
+
 public:
        UndoHistory();
        ~UndoHistory();
-       
+
        void AppendAction(actionType at, int position, char *data, int length);
 
        void BeginUndoAction();
        void EndUndoAction();
        void DropUndoSequence();
        void DeleteUndoHistory();
-       
-       // The save point is a marker in the undo stack where the container has stated that 
-       // the buffer was saved. Undo and redo can move over the save point.
+
+       /// The save point is a marker in the undo stack where the container has stated that
+       /// the buffer was saved. Undo and redo can move over the save point.
        void SetSavePoint();
        bool IsSavePoint() const;
 
-       // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is 
-       // called that many times. Similarly for redo.
+       /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
+       /// called that many times. Similarly for redo.
        bool CanUndo() const;
        int StartUndo();
        const Action &GetUndoStep() const;
@@ -127,9 +143,11 @@ public:
        void CompletedRedoStep();
 };
 
-// Holder for an expandable array of characters that supports undo and line markers
-// Based on article "Data Structures in a Bit-Mapped Text Editor"
-// by Wilfred J. Hansen, Byte January 1987, page 183
+/**
+ * Holder for an expandable array of characters that supports undo and line markers.
+ * Based on article "Data Structures in a Bit-Mapped Text Editor"
+ * by Wilfred J. Hansen, Byte January 1987, page 183.
+ */
 class CellBuffer {
 private:
        char *body;
@@ -139,6 +157,7 @@ private:
        int gaplen;
        char *part2body;
        bool readOnly;
+       int growSize;
 
        bool collectingUndo;
        UndoHistory uh;
@@ -157,12 +176,12 @@ public:
 
        CellBuffer(int initialLength = 4000);
        ~CellBuffer();
-       
-       // Retrieving positions outside the range of the buffer works and returns 0
+
+       /// Retrieving positions outside the range of the buffer works and returns 0
        char CharAt(int position);
        void GetCharRange(char *buffer, int position, int lengthRetrieve);
        char StyleAt(int position);
-       
+
        int ByteLength();
        int Length();
        int Lines();
@@ -170,23 +189,23 @@ public:
        int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
        const char *InsertString(int position, char *s, int insertLength);
        void InsertCharStyle(int position, char ch, char style);
-       
-       // Setting styles for positions outside the range of the buffer is safe and has no effect.
-       // True is returned if the style of a character 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);
-       
+
        const char *DeleteChars(int position, int deleteLength);
 
        bool IsReadOnly();
        void SetReadOnly(bool set);
 
-       // The save point is a marker in the undo stack where the container has stated that 
-       // the buffer was saved. Undo and redo can move over the save point.
+       /// The save point is a marker in the undo stack where the container has stated that
+       /// the buffer was saved. Undo and redo can move over the save point.
        void SetSavePoint();
        bool IsSavePoint();
 
-       // Line marker functions
+       /// Line marker functions
        int AddMark(int line, int markerNum);
        void DeleteMark(int line, int markerNum);
        void DeleteMarkFromHandle(int markerHandle);
@@ -194,7 +213,7 @@ public:
        void DeleteAllMarks(int markerNum);
        int LineFromHandle(int markerHandle);
  
-       // Without undo
+       /// Actions without undo
        void BasicInsertString(int position, char *s, int insertLength);
        void BasicDeleteChars(int position, int deleteLength);
 
@@ -203,9 +222,9 @@ public:
        void BeginUndoAction();
        void EndUndoAction();
        void DeleteUndoHistory();
-       
-       // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is 
-       // called that many times. Similarly for redo.
+
+       /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
+       /// called that many times. Similarly for redo.
        bool CanUndo();
        int StartUndo();
        const Action &GetUndoStep() const;
@@ -214,14 +233,14 @@ public:
        int StartRedo();
        const Action &GetRedoStep() const;
        void PerformRedoStep();
-       
+
        int SetLineState(int line, int state);
        int GetLineState(int line);
        int GetMaxLineState();
-               
+
        int SetLevel(int line, int level);
        int GetLevel(int line);
-    void ClearLevels();
+       void ClearLevels();
 };
 
 #define CELL_SIZE      2
index 0558b4c3652911ed374a1a6f0f95b62b76edbb5c..1f146966502d34788ae6a6130662dff573e33f49 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// ContractionState.cxx - manages visibility of lines for folding
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ContractionState.cxx
+ ** Manages visibility of lines for folding.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Platform.h"
index 2c344efeea42ff96cfd98710b570dc26d4b84348..0d7881c7b227c1ae2dc93ff23d51dca471c4a8c9 100644 (file)
@@ -1,15 +1,19 @@
 // Scintilla source code edit control
-// ContractionState.h - manages visibility of lines for folding
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ContractionState.h
+ ** Manages visibility of lines for folding.
+ **/
+// Copyright 1998-2001 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
 
+/**
+ */
 class OneLine {
 public:
-       int displayLine;        // position within set of visible lines
-       int docLine;            // inverse of displayLine
+       int displayLine;        ///< Position within set of visible lines
+       int docLine;            ///< Inverse of @a displayLine
        bool visible;
        bool expanded;
        
@@ -17,6 +21,8 @@ public:
        virtual ~OneLine() {}
 };
 
+/**
+ */
 class ContractionState {
        void Grow(int sizeNew);
        enum { growSize = 4000 };
@@ -26,6 +32,7 @@ class ContractionState {
        int size;
        mutable bool valid;
        void MakeValid() const;
+
 public:
        ContractionState();
        virtual ~ContractionState();
index c883dd253f9a3bd1a5b65b6d0bd578e78fabefde..10403242b9378ffc64a181c3de46197a753fddbd 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Document.cxx - text document that handles notifications, DBCS, styling, words and end of line
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Document.cxx
+ ** Text document that handles notifications, DBCS, styling, words and end of line.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
 #include "SVector.h"
 #include "CellBuffer.h"
 #include "Document.h"
+#include "RESearch.h"
+
+// This is ASCII specific but is safe with chars >= 0x80
+inline bool isspacechar(unsigned char ch) {
+       return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
 
 Document::Document() {
        refCount = 0;
@@ -25,7 +33,6 @@ Document::Document() {
        dbcsCodePage = 0;
        stylingBits = 5;
        stylingBitsMask = 0x1F;
-       stylingPos = 0;
        stylingMask = 0;
        for (int ch = 0; ch < 256; ch++) {
                wordchars[ch] = isalnum(ch) || ch == '_';
@@ -36,8 +43,14 @@ Document::Document() {
        tabInChars = 8;
        indentInChars = 0;
        useTabs = true;
+       tabIndents = true;
+       backspaceUnindents = false;
        watchers = 0;
        lenWatchers = 0;
+
+       matchesValid = false;
+       pre = 0;
+       substituted = 0;
 }
 
 Document::~Document() {
@@ -47,6 +60,10 @@ Document::~Document() {
        delete []watchers;
        watchers = 0;
        lenWatchers = 0;
+       delete pre;
+       pre = 0;
+       delete []substituted;
+       substituted = 0;
 }
 
 // Increase reference count and return its previous value.
@@ -68,27 +85,27 @@ void Document::SetSavePoint() {
        NotifySavePoint(true);
 }
 
-int Document::AddMark(int line, int markerNum) { 
-       int prev = cb.AddMark(line, markerNum); 
+int Document::AddMark(int line, int markerNum) {
+       int prev = cb.AddMark(line, markerNum);
        DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
        NotifyModified(mh);
        return prev;
 }
 
-void Document::DeleteMark(int line, int markerNum) { 
-       cb.DeleteMark(line, markerNum); 
+void Document::DeleteMark(int line, int markerNum) {
+       cb.DeleteMark(line, markerNum);
        DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
        NotifyModified(mh);
 }
 
-void Document::DeleteMarkFromHandle(int markerHandle) { 
-       cb.DeleteMarkFromHandle(markerHandle); 
+void Document::DeleteMarkFromHandle(int markerHandle) {
+       cb.DeleteMarkFromHandle(markerHandle);
        DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
        NotifyModified(mh);
 }
 
-void Document::DeleteAllMarks(int markerNum) { 
-       cb.DeleteAllMarks(markerNum); 
+void Document::DeleteAllMarks(int markerNum) {
+       cb.DeleteAllMarks(markerNum);
        DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
        NotifyModified(mh);
 }
@@ -131,10 +148,11 @@ int Document::VCHomePosition(int position) {
                return startText;
 }
 
-int Document::SetLevel(int line, int level) { 
-       int prev = cb.SetLevel(line, level); 
+int Document::SetLevel(int line, int level) {
+       int prev = cb.SetLevel(line, level);
        if (prev != level) {
-               DocModification mh(SC_MOD_CHANGEFOLD, LineStart(line), 0, 0, 0);
+               DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
+                                  LineStart(line), 0, 0, 0);
                mh.line = line;
                mh.foldLevelNow = level;
                mh.foldLevelPrev = prev;
@@ -146,7 +164,7 @@ int Document::SetLevel(int line, int level) {
 static bool IsSubordinate(int levelStart, int levelTry) {
        if (levelTry & SC_FOLDLEVELWHITEFLAG)
                return true;
-       else 
+       else
                return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
 }
 
@@ -155,16 +173,16 @@ int Document::GetLastChild(int lineParent, int level) {
                level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK;
        int maxLine = LinesTotal();
        int lineMaxSubord = lineParent;
-       while (lineMaxSubord < maxLine-1) {
-               EnsureStyledTo(LineStart(lineMaxSubord+2));
-               if (!IsSubordinate(level, GetLevel(lineMaxSubord+1)))
+       while (lineMaxSubord < maxLine - 1) {
+               EnsureStyledTo(LineStart(lineMaxSubord + 2));
+               if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1)))
                        break;
                lineMaxSubord++;
        }
        if (lineMaxSubord > lineParent) {
-               if (level > (GetLevel(lineMaxSubord+1) & SC_FOLDLEVELNUMBERMASK)) {
-                       // Have chewed up some whitespace that belongs to a parent so seek back 
-                       if ((lineMaxSubord > lineParent) && (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) {
+               if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) {
+                       // Have chewed up some whitespace that belongs to a parent so seek back
+                       if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) {
                                lineMaxSubord--;
                        }
                }
@@ -174,15 +192,15 @@ int Document::GetLastChild(int lineParent, int level) {
 
 int Document::GetFoldParent(int line) {
        int level = GetLevel(line);
-       int lineLook = line-1;
+       int lineLook = line - 1;
        while ((lineLook > 0) && (
-               (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || 
-               ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
-       ) {
+                   (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
+                   ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
+             ) {
                lineLook--;
        }
        if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) &&
-               ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) {
+               ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) {
                return lineLook;
        } else {
                return -1;
@@ -241,12 +259,12 @@ int Document::LenChar(int pos) {
                if (ch < 0x80)
                        return 1;
                int len = 2;
-               if (ch >= (0x80+0x40+0x20))
+               if (ch >= (0x80 + 0x40 + 0x20))
                        len = 3;
                int lengthDoc = Length();
                if ((pos + len) > lengthDoc)
-                       return lengthDoc-pos;
-               else 
+                       return lengthDoc -pos;
+               else
                        return len;
        } else if (IsDBCS(pos)) {
                return 2;
@@ -292,7 +310,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
                                // ch is a trail byte
                                if (moveDir > 0)
                                        pos++;
-                               else 
+                               else
                                        pos--;
                                ch = static_cast<unsigned char>(cb.CharAt(pos));
                        }
@@ -314,6 +332,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
                                //Platform::DebugPrintf("DBCS %s\n", atlead ? "D" : "-");
                        }
 
+
                        if (atLeadByte) {
                                // Position is between a lead byte and a trail byte
                                if (moveDir > 0)
@@ -338,9 +357,9 @@ void Document::ModifiedAt(int pos) {
 
 // Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
 void Document::DeleteChars(int pos, int len) {
-    if ((pos + len) > Length())
-        return;
-       if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
+       if ((pos + len) > Length())
+               return ;
+       if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
                enteredReadOnlyCount++;
                NotifyModifyAttempt();
                enteredReadOnlyCount--;
@@ -349,28 +368,31 @@ void Document::DeleteChars(int pos, int len) {
                enteredCount++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
-                DocModification(
-                    SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, 
-                    pos, len, 
-                    0, 0));
+                           DocModification(
+                               SC_MOD_BEFOREDELETE | SC_PERFORMED_USER,
+                               pos, len,
+                               0, 0));
                        int prevLinesTotal = LinesTotal();
                        bool startSavePoint = cb.IsSavePoint();
-                       const char *text = cb.DeleteChars(pos*2, len * 2);
+                       const char *text = cb.DeleteChars(pos * 2, len * 2);
                        if (startSavePoint && cb.IsCollectingUndo())
                                NotifySavePoint(!startSavePoint);
-                       ModifiedAt(pos);
+                       if ((pos < Length()) || (pos == 0))
+                               ModifiedAt(pos);
+                       else
+                               ModifiedAt(pos-1);
                        NotifyModified(
-                DocModification(
-                    SC_MOD_DELETETEXT | SC_PERFORMED_USER, 
-                    pos, len, 
-                    LinesTotal() - prevLinesTotal, text));
+                           DocModification(
+                               SC_MOD_DELETETEXT | SC_PERFORMED_USER,
+                               pos, len,
+                               LinesTotal() - prevLinesTotal, text));
                }
                enteredCount--;
        }
 }
 
 void Document::InsertStyledString(int position, char *s, int insertLength) {
-       if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
+       if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
                enteredReadOnlyCount++;
                NotifyModifyAttempt();
                enteredReadOnlyCount--;
@@ -379,10 +401,10 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
                enteredCount++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
-                DocModification(
-                    SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, 
-                    position / 2, insertLength / 2, 
-                    0, 0));
+                           DocModification(
+                               SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
+                               position / 2, insertLength / 2,
+                               0, 0));
                        int prevLinesTotal = LinesTotal();
                        bool startSavePoint = cb.IsSavePoint();
                        const char *text = cb.InsertString(position, s, insertLength);
@@ -390,10 +412,10 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
                                NotifySavePoint(!startSavePoint);
                        ModifiedAt(position / 2);
                        NotifyModified(
-                DocModification(
-                    SC_MOD_INSERTTEXT | SC_PERFORMED_USER, 
-                    position / 2, insertLength / 2, 
-                    LinesTotal() - prevLinesTotal, text));
+                           DocModification(
+                               SC_MOD_INSERTTEXT | SC_PERFORMED_USER,
+                               position / 2, insertLength / 2,
+                               LinesTotal() - prevLinesTotal, text));
                }
                enteredCount--;
        }
@@ -406,21 +428,21 @@ int Document::Undo() {
                bool startSavePoint = cb.IsSavePoint();
                int steps = cb.StartUndo();
                //Platform::DebugPrintf("Steps=%d\n", steps);
-               for (int step=0; step<steps; step++) {
+               for (int step = 0; step < steps; step++) {
                        int prevLinesTotal = LinesTotal();
                        const Action &action = cb.GetUndoStep();
                        if (action.at == removeAction) {
-                           NotifyModified(DocModification(
-                    SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
-            } else {
-                           NotifyModified(DocModification(
-                    SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
-            }
+                               NotifyModified(DocModification(
+                                                  SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
+                       } else {
+                               NotifyModified(DocModification(
+                                                  SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
+                       }
                        cb.PerformUndoStep();
                        int cellPosition = action.position / 2;
                        ModifiedAt(cellPosition);
                        newPos = cellPosition;
-                       
+
                        int modFlags = SC_PERFORMED_UNDO;
                        // With undo, an insertion action becomes a deletion notification
                        if (action.at == removeAction) {
@@ -429,12 +451,12 @@ int Document::Undo() {
                        } else {
                                modFlags |= SC_MOD_DELETETEXT;
                        }
-                       if (step == steps-1)
+                       if (step == steps - 1)
                                modFlags |= SC_LASTSTEPINUNDOREDO;
-                       NotifyModified(DocModification(modFlags, cellPosition, action.lenData, 
-                               LinesTotal() - prevLinesTotal, action.data));
+                       NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
+                                                      LinesTotal() - prevLinesTotal, action.data));
                }
-       
+
                bool endSavePoint = cb.IsSavePoint();
                if (startSavePoint != endSavePoint)
                        NotifySavePoint(endSavePoint);
@@ -449,20 +471,20 @@ int Document::Redo() {
                enteredCount++;
                bool startSavePoint = cb.IsSavePoint();
                int steps = cb.StartRedo();
-               for (int step=0; step<steps; step++) {
+               for (int step = 0; step < steps; step++) {
                        int prevLinesTotal = LinesTotal();
                        const Action &action = cb.GetRedoStep();
                        if (action.at == insertAction) {
-                           NotifyModified(DocModification(
-                    SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
-            } else {
-                           NotifyModified(DocModification(
-                    SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
-            }
+                               NotifyModified(DocModification(
+                                                  SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
+                       } else {
+                               NotifyModified(DocModification(
+                                                  SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
+                       }
                        cb.PerformRedoStep();
                        ModifiedAt(action.position / 2);
                        newPos = action.position / 2;
-                       
+
                        int modFlags = SC_PERFORMED_REDO;
                        if (action.at == insertAction) {
                                newPos += action.lenData;
@@ -470,13 +492,13 @@ int Document::Redo() {
                        } else {
                                modFlags |= SC_MOD_DELETETEXT;
                        }
-                       if (step == steps-1)
+                       if (step == steps - 1)
                                modFlags |= SC_LASTSTEPINUNDOREDO;
                        NotifyModified(
-                DocModification(modFlags, action.position / 2, action.lenData, 
-                               LinesTotal() - prevLinesTotal, action.data));
+                           DocModification(modFlags, action.position / 2, action.lenData,
+                                           LinesTotal() - prevLinesTotal, action.data));
                }
-       
+
                bool endSavePoint = cb.IsSavePoint();
                if (startSavePoint != endSavePoint)
                        NotifySavePoint(endSavePoint);
@@ -526,7 +548,7 @@ int Document::DelCharBack(int pos) {
                DeleteChars(pos - 2, 2);
                return pos - 2;
        } else if (SC_CP_UTF8 == dbcsCodePage) {
-               int startChar = MovePositionOutsideChar(pos-1, -1, false);
+               int startChar = MovePositionOutsideChar(pos - 1, -1, false);
                DeleteChars(startChar, pos - startChar);
                return startChar;
        } else if (IsDBCS(pos - 1)) {
@@ -568,13 +590,13 @@ int Document::GetLineIndentation(int line) {
        if ((line >= 0) && (line < LinesTotal())) {
                int lineStart = LineStart(line);
                int length = Length();
-               for (int i=lineStart;i<length;i++) {
+               for (int i = lineStart;i < length;i++) {
                        char ch = cb.CharAt(i);
                        if (ch == ' ')
                                indent++;
                        else if (ch == '\t')
                                indent = NextTab(indent, tabInChars);
-                       else 
+                       else
                                return indent;
                }
        }
@@ -596,8 +618,8 @@ void Document::SetLineIndentation(int line, int indent) {
 }
 
 int Document::GetLineIndentPosition(int line) {
-    if (line < 0)
-        return 0;
+       if (line < 0)
+               return 0;
        int pos = LineStart(line);
        int length = Length();
        while ((pos < length) && isindentchar(cb.CharAt(pos))) {
@@ -610,7 +632,7 @@ int Document::GetColumn(int pos) {
        int column = 0;
        int line = LineFromPosition(pos);
        if ((line >= 0) && (line < LinesTotal())) {
-               for (int i=LineStart(line);i<pos;i++) {
+               for (int i = LineStart(line);i < pos;i++) {
                        char ch = cb.CharAt(i);
                        if (ch == '\t')
                                column = NextTab(column, tabInChars);
@@ -640,7 +662,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
        BeginUndoAction();
        for (int pos = 0; pos < Length(); pos++) {
                if (cb.CharAt(pos) == '\r') {
-                       if (cb.CharAt(pos+1) == '\n') {
+                       if (cb.CharAt(pos + 1) == '\n') {
                                if (eolModeSet != SC_EOL_CRLF) {
                                        DeleteChars(pos, 2);
                                        if (eolModeSet == SC_EOL_CR)
@@ -677,7 +699,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
 }
 
 bool Document::IsWordChar(unsigned char ch) {
-       if ((SC_CP_UTF8 == dbcsCodePage) && (ch >0x80))
+       if ((SC_CP_UTF8 == dbcsCodePage) && (ch > 0x80))
                return true;
        return wordchars[ch];
 }
@@ -697,19 +719,19 @@ int Document::NextWordStart(int pos, int delta) {
        if (delta < 0) {
                while (pos > 0 && (cb.CharAt(pos - 1) == ' ' || cb.CharAt(pos - 1) == '\t'))
                        pos--;
-               if (isspace(cb.CharAt(pos - 1))) {      // Back up to previous line
-                       while (pos > 0 && isspace(cb.CharAt(pos - 1)))
+               if (isspacechar(cb.CharAt(pos - 1))) {  // Back up to previous line
+                       while (pos > 0 && isspacechar(cb.CharAt(pos - 1)))
                                pos--;
                } else {
                        bool startAtWordChar = IsWordChar(cb.CharAt(pos - 1));
-                       while (pos > 0 && !isspace(cb.CharAt(pos - 1)) && (startAtWordChar == IsWordChar(cb.CharAt(pos - 1))))
+                       while (pos > 0 && !isspacechar(cb.CharAt(pos - 1)) && (startAtWordChar == IsWordChar(cb.CharAt(pos - 1))))
                                pos--;
                }
        } else {
                bool startAtWordChar = IsWordChar(cb.CharAt(pos));
-               while (pos < (Length()) && isspace(cb.CharAt(pos)))
+               while (pos < (Length()) && isspacechar(cb.CharAt(pos)))
                        pos++;
-               while (pos < (Length()) && !isspace(cb.CharAt(pos)) && (startAtWordChar == IsWordChar(cb.CharAt(pos))))
+               while (pos < (Length()) && !isspacechar(cb.CharAt(pos)) && (startAtWordChar == IsWordChar(cb.CharAt(pos))))
                        pos++;
                while (pos < (Length()) && (cb.CharAt(pos) == ' ' || cb.CharAt(pos) == '\t'))
                        pos++;
@@ -717,6 +739,10 @@ int Document::NextWordStart(int pos, int delta) {
        return pos;
 }
 
+/**
+ * Check that the character before the given position
+ * is not a word character.
+ */
 bool Document::IsWordStartAt(int pos) {
        if (pos > 0) {
                return !IsWordChar(CharAt(pos - 1));
@@ -724,6 +750,10 @@ bool Document::IsWordStartAt(int pos) {
        return true;
 }
 
+/**
+ * Check that the character after the given position
+ * is not a word character.
+ */
 bool Document::IsWordEndAt(int pos) {
        if (pos < Length() - 1) {
                return !IsWordChar(CharAt(pos));
@@ -731,74 +761,233 @@ bool Document::IsWordEndAt(int pos) {
        return true;
 }
 
+/**
+ * Check that the given range is delimited by
+ * non word characters.
+ */
 bool Document::IsWordAt(int start, int end) {
        return IsWordStartAt(start) && IsWordEndAt(end);
 }
 
-// Find text in document, supporting both forward and backward
-// searches (just pass minPos > maxPos to do a backward search)
-// Has not been tested with backwards DBCS searches yet.
-long Document::FindText(int minPos, int maxPos, const char *s, 
-       bool caseSensitive, bool word, bool wordStart) {
-       bool forward = minPos <= maxPos;
-       int increment = forward ? 1 : -1;
-
-       // Range endpoints should not be inside DBCS characters, but just in case, move them.
-       int startPos = MovePositionOutsideChar(minPos, increment, false);
-       int endPos = MovePositionOutsideChar(maxPos, increment, false);
-       
-       // Compute actual search ranges needed
-       int lengthFind = strlen(s);
-       int endSearch = endPos;
-       if (startPos <= endPos) {
-               endSearch = endPos - lengthFind + 1;
-       }
-       //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
-       char firstChar = s[0];
-       if (!caseSensitive)
-               firstChar = static_cast<char>(toupper(firstChar));
-       int pos = startPos;
-       while (forward ? (pos < endSearch) : (pos >= endSearch)) {
-               char ch = CharAt(pos);
-               if (caseSensitive) {
-                       if (ch == firstChar) {
-                               bool found = true;
-                               for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
-                                       ch = CharAt(pos + posMatch);
-                                       if (ch != s[posMatch])
-                                               found = false;
-                               }
-                               if (found) {
-                                       if ((!word && !wordStart) ||
-                                               word && IsWordAt(pos, pos + lengthFind) ||
-                                               wordStart && IsWordStartAt(pos))
-                                               return pos;
-                               }
-                       }
+// The comparison and case changing functions here assume ASCII
+// or extended ASCII such as the normal Windows code page.
+
+static inline char MakeUpperCase(char ch) {
+       if (ch < 'a' || ch > 'z')
+               return ch;
+       else
+               return static_cast<char>(ch - 'a' + 'A');
+}
+
+static inline char MakeLowerCase(char ch) {
+       if (ch < 'A' || ch > 'Z')
+               return ch;
+       else
+               return static_cast<char>(ch - 'A' + 'a');
+}
+
+// Define a way for the Regular Expression code to access the document
+class DocumentIndexer : public CharacterIndexer {
+       Document *pdoc;
+       int end;
+public:
+DocumentIndexer(Document *pdoc_, int end_) :
+       pdoc(pdoc_), end(end_) {}
+
+       virtual char CharAt(int index) {
+               if (index < 0 || index >= end)
+                       return 0;
+               else
+                       return pdoc->CharAt(index);
+       }
+};
+
+/**
+ * Find text in document, supporting both forward and backward
+ * searches (just pass minPos > maxPos to do a backward search)
+ * Has not been tested with backwards DBCS searches yet.
+ */
+long Document::FindText(int minPos, int maxPos, const char *s,
+                        bool caseSensitive, bool word, bool wordStart, bool regExp,
+                        int *length) {
+       if (regExp) {
+               if (!pre)
+                       pre = new RESearch();
+               if (!pre)
+                       return -1;
+
+               int startPos;
+               int endPos;
+
+               if (minPos <= maxPos) {
+                       startPos = minPos;
+                       endPos = maxPos;
                } else {
-                       if (toupper(ch) == firstChar) {
-                               bool found = true;
-                               for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
-                                       ch = CharAt(pos + posMatch);
-                                       if (toupper(ch) != toupper(s[posMatch]))
-                                               found = false;
+                       startPos = maxPos;
+                       endPos = minPos;
+               }
+
+               // Range endpoints should not be inside DBCS characters, but just in case, move them.
+               startPos = MovePositionOutsideChar(startPos, 1, false);
+               endPos = MovePositionOutsideChar(endPos, 1, false);
+
+               const char *errmsg = pre->Compile(s, *length, caseSensitive);
+               if (errmsg) {
+                       return -1;
+               }
+               // Find a variable in a property file: \$(\([A-Za-z0-9_.]+\))
+               // Replace first '.' with '-' in each property file variable reference:
+               //     Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
+               //     Replace: $(\1-\2)
+               int lineRangeStart = LineFromPosition(startPos);
+               int lineRangeEnd = LineFromPosition(endPos);
+               if ((startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) {
+                       // the start position is at end of line or between line end characters.
+                       lineRangeStart++;
+                       startPos = LineStart(lineRangeStart);
+               }
+               int pos = -1;
+               int lenRet = 0;
+               char searchEnd = s[*length - 1];
+               if (*length == 1) {
+                       // These produce empty selections so nudge them on if needed
+                       if (s[0] == '^') {
+                               if (startPos == LineStart(lineRangeStart))
+                                       startPos++;
+                       } else if (s[0] == '$') {
+                               if ((startPos == LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd))
+                                       startPos = LineStart(lineRangeStart + 1);
+                       }
+                       lineRangeStart = LineFromPosition(startPos);
+                       lineRangeEnd = LineFromPosition(endPos);
+               }
+               for (int line = lineRangeStart; line <= lineRangeEnd; line++) {
+                       int startOfLine = LineStart(line);
+                       int endOfLine = LineEnd(line);
+                       if (line == lineRangeStart) {
+                               if ((startPos != startOfLine) && (s[0] == '^'))
+                                       continue;       // Can't match start of line if start position after start of line
+                               startOfLine = startPos;
+                       }
+                       if (line == lineRangeEnd) {
+                               if ((endPos != endOfLine) && (searchEnd == '$'))
+                                       continue;       // Can't match end of line if end position before end of line
+                               endOfLine = endPos;
+                       }
+                       DocumentIndexer di(this, endOfLine);
+                       int success = pre->Execute(di, startOfLine, endOfLine);
+                       if (success) {
+                               pos = pre->bopat[0];
+                               lenRet = pre->eopat[0] - pre->bopat[0];
+                               break;
+                       }
+               }
+               *length = lenRet;
+               return pos;
+
+       } else {
+
+               bool forward = minPos <= maxPos;
+               int increment = forward ? 1 : -1;
+
+               // Range endpoints should not be inside DBCS characters, but just in case, move them.
+               int startPos = MovePositionOutsideChar(minPos, increment, false);
+               int endPos = MovePositionOutsideChar(maxPos, increment, false);
+
+               // Compute actual search ranges needed
+               int lengthFind = *length;
+               if (lengthFind == -1)
+                       lengthFind = strlen(s);
+               int endSearch = endPos;
+               if (startPos <= endPos) {
+                       endSearch = endPos - lengthFind + 1;
+               }
+               //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
+               char firstChar = s[0];
+               if (!caseSensitive)
+                       firstChar = static_cast<char>(MakeUpperCase(firstChar));
+               int pos = startPos;
+               while (forward ? (pos < endSearch) : (pos >= endSearch)) {
+                       char ch = CharAt(pos);
+                       if (caseSensitive) {
+                               if (ch == firstChar) {
+                                       bool found = true;
+                                       for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
+                                               ch = CharAt(pos + posMatch);
+                                               if (ch != s[posMatch])
+                                                       found = false;
+                                       }
+                                       if (found) {
+                                               if ((!word && !wordStart) ||
+                                                       word && IsWordAt(pos, pos + lengthFind) ||
+                                                       wordStart && IsWordStartAt(pos))
+                                                       return pos;
+                                       }
                                }
-                               if (found) {
-                                       if (!(word && wordStart) ||
-                                               word && IsWordAt(pos, pos + lengthFind) ||
-                                               wordStart && IsWordStartAt(pos))
-                                               return pos;
+                       } else {
+                               if (MakeUpperCase(ch) == firstChar) {
+                                       bool found = true;
+                                       for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
+                                               ch = CharAt(pos + posMatch);
+                                               if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch]))
+                                                       found = false;
+                                       }
+                                       if (found) {
+                                               if ((!word && !wordStart) ||
+                                                       word && IsWordAt(pos, pos + lengthFind) ||
+                                                       wordStart && IsWordStartAt(pos))
+                                                       return pos;
+                                       }
                                }
                        }
-               }
-               pos += increment;
-               if (dbcsCodePage) {
-                       // Ensure trying to match from start of character
-                       pos = MovePositionOutsideChar(pos, increment, false);
+                       pos += increment;
+                       if (dbcsCodePage) {
+                               // Ensure trying to match from start of character
+                               pos = MovePositionOutsideChar(pos, increment, false);
+                       }
                }
        }
        //Platform::DebugPrintf("Not found\n");
-       return - 1;
+       return -1;
+}
+
+const char *Document::SubstituteByPosition(const char *text, int *length) {
+       if (!pre)
+               return 0;
+       delete []substituted;
+       substituted = 0;
+       DocumentIndexer di(this, Length());
+       if (!pre->GrabMatches(di))
+               return 0;
+       unsigned int lenResult = 0;
+       for (int i = 0; i < *length; i++) {
+               if ((text[i] == '\\') && (text[i + 1] >= '1' && text[i + 1] <= '9')) {
+                       unsigned int patNum = text[i + 1] - '0';
+                       lenResult += pre->eopat[patNum] - pre->bopat[patNum];
+                       i++;
+               } else {
+                       lenResult++;
+               }
+       }
+       substituted = new char[lenResult + 1];
+       if (!substituted)
+               return 0;
+       char *o = substituted;
+       for (int j = 0; j < *length; j++) {
+               if ((text[j] == '\\') && (text[j + 1] >= '1' && text[j + 1] <= '9')) {
+                       unsigned int patNum = text[j + 1] - '0';
+                       unsigned int len = pre->eopat[patNum] - pre->bopat[patNum];
+                       if (pre->pat[patNum])   // Will be null if try for a match that did not occur
+                               memcpy(o, pre->pat[patNum], len);
+                       o += len;
+                       j++;
+               } else {
+                       *o++ = text[j];
+               }
+       }
+       *o = '\0';
+       *length = lenResult;
+       return substituted;
 }
 
 int Document::LinesTotal() {
@@ -806,18 +995,18 @@ int Document::LinesTotal() {
 }
 
 void Document::ChangeCase(Range r, bool makeUpperCase) {
-       for (int pos=r.start; pos<r.end; pos++) {
+       for (int pos = r.start; pos < r.end; pos++) {
                char ch = CharAt(pos);
                if (dbcsCodePage && IsDBCS(pos)) {
                        pos += LenChar(pos);
                } else {
                        if (makeUpperCase) {
                                if (islower(ch)) {
-                                       ChangeChar(pos, static_cast<char>(toupper(ch)));
+                                       ChangeChar(pos, static_cast<char>(MakeUpperCase(ch)));
                                }
                        } else {
                                if (isupper(ch)) {
-                                       ChangeChar(pos, static_cast<char>(tolower(ch)));
+                                       ChangeChar(pos, static_cast<char>(MakeLowerCase(ch)));
                                }
                        }
                }
@@ -844,28 +1033,27 @@ void Document::SetWordChars(unsigned char *chars) {
 void Document::SetStylingBits(int bits) {
        stylingBits = bits;
        stylingBitsMask = 0;
-       for (int bit=0; bit<stylingBits; bit++) {
+       for (int bit = 0; bit < stylingBits; bit++) {
                stylingBitsMask <<= 1;
                stylingBitsMask |= 1;
        }
 }
 
 void Document::StartStyling(int position, char mask) {
-       stylingPos = position;
        stylingMask = mask;
+       endStyled = position;
 }
 
 void Document::SetStyleFor(int length, char style) {
        if (enteredCount == 0) {
                enteredCount++;
                int prevEndStyled = endStyled;
-               if (cb.SetStyleFor(stylingPos, length, style, stylingMask)) {
-                       DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, 
-                               prevEndStyled, length);
+               if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
+                       DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
+                                          prevEndStyled, length);
                        NotifyModified(mh);
                }
-               stylingPos += length;
-               endStyled = stylingPos;
+               endStyled += length;
                enteredCount--;
        }
 }
@@ -875,15 +1063,14 @@ void Document::SetStyles(int length, char *styles) {
                enteredCount++;
                int prevEndStyled = endStyled;
                bool didChange = false;
-               for (int iPos = 0; iPos < length; iPos++, stylingPos++) {
-                       if (cb.SetStyleAt(stylingPos, styles[iPos], stylingMask)) {
+               for (int iPos = 0; iPos < length; iPos++, endStyled++) {
+                       if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
                                didChange = true;
                        }
                }
-               endStyled = stylingPos;
                if (didChange) {
-                       DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, 
-                               prevEndStyled, endStyled - prevEndStyled);
+                       DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
+                                          prevEndStyled, endStyled - prevEndStyled);
                        NotifyModified(mh);
                }
                enteredCount--;
@@ -958,3 +1145,85 @@ void Document::NotifyModified(DocModification mh) {
                watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData);
        }
 }
+
+bool Document::IsWordPartSeparator(char ch) {
+       return ispunct(ch) && IsWordChar(ch);
+}
+
+int Document::WordPartLeft(int pos) {
+       if (pos > 0) {
+               --pos;
+               char startChar = cb.CharAt(pos);
+               if (IsWordPartSeparator(startChar)) {
+                       while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) {
+                               --pos;
+                       }
+               }
+               if (pos > 0) {
+                       startChar = cb.CharAt(pos);
+                       --pos;
+                       if (islower(startChar)) {
+                               while (pos > 0 && islower(cb.CharAt(pos)))
+                                       --pos;
+                               if (!isupper(cb.CharAt(pos)) && !islower(cb.CharAt(pos)))
+                                       ++pos;
+                       } else if (isupper(startChar)) {
+                               while (pos > 0 && isupper(cb.CharAt(pos)))
+                                       --pos;
+                               if (!isupper(cb.CharAt(pos)))
+                                       ++pos;
+                       } else if (isdigit(startChar)) {
+                               while (pos > 0 && isdigit(cb.CharAt(pos)))
+                                       --pos;
+                               if (!isdigit(cb.CharAt(pos)))
+                                       ++pos;
+                       } else if (ispunct(startChar)) {
+                               while (pos > 0 && ispunct(cb.CharAt(pos)))
+                                       --pos;
+                               if (!ispunct(cb.CharAt(pos)))
+                                       ++pos;
+                       } else if (isspacechar(startChar)) {
+                               while (pos > 0 && isspacechar(cb.CharAt(pos)))
+                                       --pos;
+                               if (!isspacechar(cb.CharAt(pos)))
+                                       ++pos;
+                       }
+               }
+       }
+       return pos;
+}
+
+int Document::WordPartRight(int pos) {
+       char startChar = cb.CharAt(pos);
+       int length = Length();
+       if (IsWordPartSeparator(startChar)) {
+               while (pos < length && IsWordPartSeparator(cb.CharAt(pos)))
+                       ++pos;
+               startChar = cb.CharAt(pos);
+       }
+       if (islower(startChar)) {
+               while (pos < length && islower(cb.CharAt(pos)))
+                       ++pos;
+       } else if (isupper(startChar)) {
+               if (islower(cb.CharAt(pos + 1))) {
+                       ++pos;
+                       while (pos < length && islower(cb.CharAt(pos)))
+                               ++pos;
+               } else {
+                       while (pos < length && isupper(cb.CharAt(pos)))
+                               ++pos;
+               }
+               if (islower(cb.CharAt(pos)) && isupper(cb.CharAt(pos - 1)))
+                       --pos;
+       } else if (isdigit(startChar)) {
+               while (pos < length && isdigit(cb.CharAt(pos)))
+                       ++pos;
+       } else if (ispunct(startChar)) {
+               while (pos < length && ispunct(cb.CharAt(pos)))
+                       ++pos;
+       } else if (isspacechar(startChar)) {
+               while (pos < length && isspacechar(cb.CharAt(pos)))
+                       ++pos;
+       }
+       return pos;
+}
index af477dd79bbc78a97206fcd46a4e451da4b403f0..394c8f94b0cb7b2af48a50cdb8f15cecc291f958 100644 (file)
@@ -1,36 +1,42 @@
 // Scintilla source code edit control
-// Document.h - text document that handles notifications, DBCS, styling, words and end of line
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Document.h
+ ** Text document that handles notifications, DBCS, styling, words and end of line.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef DOCUMENT_H
 #define DOCUMENT_H
 
-// 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.
+ */
 typedef int Position;
 const Position invalidPosition = -1;
 
-// The range class represents a range of text in a document.
-// The two values are not sorted as one end may be more significant than the other
-// as is the case for the selection where the end position is the position of the caret.
-// If either position is invalidPosition then the range is invalid and most operations will fail.
+/**
+ * The range class represents a range of text in a document.
+ * The two values are not sorted as one end may be more significant than the other
+ * as is the case for the selection where the end position is the position of the caret.
+ * If either position is invalidPosition then the range is invalid and most operations will fail.
+ */
 class Range {
 public:
        Position start;
        Position end;
-       
+
        Range(Position pos=0) : 
                start(pos), end(pos) {
        };
        Range(Position start_, Position end_) : 
                start(start_), end(end_) {
        };
-       
+
        bool Valid() const {
                return (start != invalidPosition) && (end != invalidPosition);
        }
-       
+
        bool Contains(Position pos) const {
                if (start < end) {
                        return (pos >= start && pos <= end);
@@ -38,11 +44,11 @@ public:
                        return (pos <= start && pos >= end);
                }
        }
-       
+
        bool Contains(Range other) const {
                return Contains(other.start) && Contains(other.end);
        }
-       
+
        bool Overlaps(Range other) const {
                return 
                Contains(other.start) ||
@@ -54,11 +60,14 @@ public:
 
 class DocWatcher;
 class DocModification;
+class RESearch;
 
+/**
+ */
 class Document {
 
 public:
-       // Used to pair watcher pointer with user data
+       /** Used to pair watcher pointer with user data. */
        class WatcherWithUserData {
        public:
                DocWatcher *watcher;
@@ -68,37 +77,42 @@ public:
                        userData = 0;
                }
        };
-       
+
 private:       
        int refCount;
        CellBuffer cb;
        bool wordchars[256];
-       int stylingPos;
        char stylingMask;
        int endStyled;
        int enteredCount;
        int enteredReadOnlyCount;
-       
+
        WatcherWithUserData *watchers;
        int lenWatchers;
-       
+
+       bool matchesValid;
+       RESearch *pre;
+       char *substituted;
+
 public:
        int stylingBits;
        int stylingBitsMask;
-       
+
        int eolMode;
-       // dbcsCodePage can also be SC_CP_UTF8 to enable UTF-8 mode
+       /// Can also be SC_CP_UTF8 to enable UTF-8 mode
        int dbcsCodePage;
        int tabInChars;
        int indentInChars;
        bool useTabs;
-       
+       bool tabIndents;
+       bool backspaceUnindents;
+
        Document();
        virtual ~Document();
-       
+
        int AddRef();
        int Release();
-       
+
        int LineFromPosition(int pos);
        int ClampPositionIntoDocument(int pos);
        bool IsCrLf(int pos);
@@ -165,12 +179,13 @@ public:
        int NextWordStart(int pos, int delta);
        int Length() { return cb.Length(); }
        long FindText(int minPos, int maxPos, const char *s, 
-               bool caseSensitive, bool word, bool wordStart);
+               bool caseSensitive, bool word, bool wordStart, bool regExp, int *length);
        long FindText(int iMessage, unsigned long wParam, long lParam);
+       const char *SubstituteByPosition(const char *text, int *length);
        int LinesTotal();
-       
+
        void ChangeCase(Range r, bool makeUpperCase);
-       
+
        void SetWordChars(unsigned char *chars);
        void SetStylingBits(int bits);
        void StartStyling(int position, char mask);
@@ -182,12 +197,16 @@ public:
        int SetLineState(int line, int state) { return cb.SetLineState(line, state); }
        int GetLineState(int line) { return cb.GetLineState(line); }
        int GetMaxLineState() { return cb.GetMaxLineState(); }
-               
+
        bool AddWatcher(DocWatcher *watcher, void *userData);
        bool RemoveWatcher(DocWatcher *watcher, void *userData);
        const WatcherWithUserData *GetWatchers() const { return watchers; }
        int GetLenWatchers() const { return lenWatchers; }
-       
+
+       bool IsWordPartSeparator(char ch);
+       int WordPartLeft(int pos);
+       int WordPartRight(int pos);
+
 private:
        bool IsDBCS(int pos);
        bool IsWordChar(unsigned char ch);
@@ -195,24 +214,26 @@ private:
        bool IsWordEndAt(int pos);
        bool IsWordAt(int start, int end);
        void ModifiedAt(int pos);
-       
+
        void NotifyModifyAttempt();
        void NotifySavePoint(bool atSavePoint);
        void NotifyModified(DocModification mh);
-       
+
        int IndentSize() { return indentInChars ? indentInChars : tabInChars; }
 };
 
-// To optimise processing of document modifications by DocWatchers, a hint is passed indicating the 
-// scope of the change.
-// If the DocWatcher is a document view then this can be used to optimise screen updating.
+/**
+ * To optimise processing of document modifications by DocWatchers, a hint is passed indicating the
+ * scope of the change.
+ * If the DocWatcher is a document view then this can be used to optimise screen updating.
+ */
 class DocModification {
 public:
        int modificationType;
        int position;
        int length;
-       int linesAdded; // Negative if lines deleted
-       const char *text;       // Only valid for changes to text, not for changes to style
+       int linesAdded; /**< Negative if lines deleted. */
+       const char *text;       /**< Only valid for changes to text, not for changes to style. */
        int line;
        int foldLevelNow;
        int foldLevelPrev;
@@ -239,12 +260,14 @@ public:
                foldLevelPrev(0) {}
 };
 
-// A class that wants to receive notifications from a Document must be derived from DocWatcher 
-// and implement the notification methods. It can then be added to the watcher list with AddWatcher.
+/**
+ * A class that wants to receive notifications from a Document must be derived from DocWatcher
+ * and implement the notification methods. It can then be added to the watcher list with AddWatcher.
+ */
 class DocWatcher {
 public:
        virtual ~DocWatcher() {}
-       
+
        virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0;
        virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0;
        virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0;
index 6828e37c3f3c0640e3233a7753ec9a5129bac341..c187f2a442b781cb80721729fa9960150b0731a7 100644 (file)
@@ -1,11 +1,13 @@
-// SciTE - Scintilla based Text Editor
-// Accessor.cxx - rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file DocumentAccessor.cxx
+ ** Rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 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 <ctype.h>
 #include <stdio.h>
 
 #include "Platform.h"
 DocumentAccessor::~DocumentAccessor() {
 }
 
-#if PLAT_WIN 
+#if PLAT_WIN
 bool DocumentAccessor::InternalIsLeadByte(char ch) {
        if (SC_CP_UTF8 == codePage)
                // For lexing, all characters >= 0x80 are treated the
                // same so none is considered a lead byte.
-               return false;   
+               return false;
        else
                return IsDBCSLeadByteEx(codePage, ch);
 }
@@ -36,7 +38,7 @@ bool DocumentAccessor::InternalIsLeadByte(char ch) {
 bool DocumentAccessor::InternalIsLeadByte(char) {
        return false;
 }
-#endif 
+#endif
 
 void DocumentAccessor::Fill(int position) {
        if (lenDoc == -1)
@@ -70,10 +72,10 @@ int DocumentAccessor::LevelAt(int line) {
        return pdoc->GetLevel(line);
 }
 
-int DocumentAccessor::Length() { 
-       if (lenDoc == -1) 
+int DocumentAccessor::Length() {
+       if (lenDoc == -1)
                lenDoc = pdoc->Length();
-       return lenDoc; 
+       return lenDoc;
 }
 
 int DocumentAccessor::GetLineState(int line) {
@@ -132,12 +134,12 @@ void DocumentAccessor::Flush() {
 int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
        int end = Length();
        int spaceFlags = 0;
-       
-       // Determines the indentation level of the current line and also checks for consistent 
+
+       // Determines the indentation level of the current line and also checks for consistent
        // indentation compared to the previous line.
-       // Indentation is judged consistent when the indentation whitespace of each line lines 
+       // Indentation is judged consistent when the indentation whitespace of each line lines
        // the same or the indentation of one line is a prefix of the other.
-       
+
        int pos = LineStart(line);
        char ch = (*this)[pos];
        int indent = 0;
@@ -164,11 +166,12 @@ int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnI
                }
                ch = (*this)[++pos];
        }
-       
+
        *flags = spaceFlags;
        indent += SC_FOLDLEVELBASE;
        // if completely empty line or the start of a comment...
-       if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
+       if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || 
+               (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) )
                return indent | SC_FOLDLEVELWHITEFLAG;
        else
                return indent;
index ccc05fee9fc4a9ba8f7f05695a65214ec1122374..48742a9b40564e3a1a7093a4ab889a458c14cedf 100644 (file)
@@ -1,16 +1,24 @@
-// DocumentAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file DocumentAccessor.h
+ ** Implementation of BufferAccess and StylingAccess on a Scintilla
+ ** rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 class Document;
 
+/**
+ */
 class DocumentAccessor : public Accessor {
        // Private so DocumentAccessor objects can not be copied
        DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {}
        DocumentAccessor &operator=(const DocumentAccessor &) { return *this; }
+
 protected:
        Document *pdoc;
        PropSet &props;
+       WindowID id;
        int lenDoc;
 
        char styleBuf[bufferSize];
@@ -21,9 +29,10 @@ protected:
 
        bool InternalIsLeadByte(char ch);
        void Fill(int position);
+
 public:
-       DocumentAccessor(Document *pdoc_, PropSet &props_) : 
-               Accessor(), pdoc(pdoc_), props(props_), 
+       DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) : 
+               Accessor(), pdoc(pdoc_), props(props_), id(id_),
                lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
        }
        ~DocumentAccessor();
@@ -38,6 +47,10 @@ public:
        int GetPropertyInt(const char *key, int defaultValue=0) { 
                return props.GetInt(key, defaultValue); 
        }
+       char *GetProperties() {
+               return props.ToString();
+       }
+       WindowID GetWindow() { return id; }
 
        void StartAt(unsigned int start, char chMask=31);
        void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
index 87b579bbc1bb6634b90f4bcf421375fa08292e3c..5b72ac579d28886b60c18035c20d7f1ddd955c85 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Editor.cxx - main code for the edit control
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Editor.cxx
+ ** Main code for the edit control.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
@@ -14,7 +16,7 @@
 
 #if PLAT_WX || PLAT_GTK
 #include "WinDefs.h"
-#endif
+#endif 
 
 #include "ContractionState.h"
 #include "SVector.h"
@@ -28,7 +30,7 @@
 #include "Editor.h"
 
 Caret::Caret() :
-active(true), on(true), period(500) {}
+active(false), on(false), period(500) {}
 
 Timer::Timer() :
 ticking(false), ticksToWait(0), tickerID(0) {}
@@ -40,13 +42,20 @@ Editor::Editor() {
 
        printMagnification = 0;
        printColourMode = SC_PRINT_NORMAL;
+       cursorMode = SC_CURSORNORMAL;
 
+       hasFocus = false;
        hideSelection = false;
        inOverstrike = false;
+       errorStatus = 0;
+       mouseDownCaptures = true;
 
        bufferedDraw = true;
 
        lastClickTime = 0;
+       dwellDelay = SC_TIME_FOREVER;
+       ticksToDwell = SC_TIME_FOREVER;
+       dwelling = false;
        ptMouseLast.x = 0;
        ptMouseLast.y = 0;
        firstExpose = true;
@@ -71,6 +80,9 @@ Editor::Editor() {
        caretPolicy = CARET_SLOP;
        caretSlop = 0;
 
+       visiblePolicy = VISIBLE_SLOP;
+       visibleSlop = 0;
+
        searchAnchor = 0;
 
        ucWheelScrollLines = 0;
@@ -83,6 +95,10 @@ Editor::Editor() {
        currentPos = 0;
        anchor = 0;
 
+       targetStart = 0;
+       targetEnd = 0;
+       searchFlags = 0;
+
        topLine = 0;
        posTopLine = 0;
 
@@ -106,7 +122,7 @@ Editor::Editor() {
 
 #ifdef MACRO_SUPPORT
        recordingMacro = 0;
-#endif
+#endif 
        foldFlags = 0;
 }
 
@@ -161,7 +177,7 @@ void Editor::RefreshStyleData() {
 }
 
 PRectangle Editor::GetClientRectangle() {
-       return wDraw.GetClientPosition();
+       return wMain.GetClientPosition();
 }
 
 PRectangle Editor::GetTextRectangle() {
@@ -215,15 +231,17 @@ const char *ControlCharacterString(unsigned char ch) {
        }
 }
 
-Point Editor::LocationFromPosition(unsigned int pos) {
+Point Editor::LocationFromPosition(int pos) {
+       Point pt;
        RefreshStyleData();
+       if (pos == INVALID_POSITION)
+               return pt;
        int line = pdoc->LineFromPosition(pos);
        int lineVisible = cs.DisplayFromDoc(line);
        //Platform::DebugPrintf("line=%d\n", line);
        Surface surface;
        surface.Init();
        surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage);
-       Point pt;
        pt.y = (lineVisible - topLine) * vs.lineHeight;         // + half a lineheight?
        unsigned int posLineStart = pdoc->LineStart(line);
        LineLayout ll;
@@ -237,7 +255,7 @@ Point Editor::LocationFromPosition(unsigned int pos) {
        return pt;
 }
 
-int Editor::XFromPosition(unsigned int pos) {
+int Editor::XFromPosition(int pos) {
        Point pt = LocationFromPosition(pos);
        return pt.x - vs.fixedColumnWidth + xOffset;
 }
@@ -262,7 +280,6 @@ int Editor::PositionFromLocation(Point pt) {
                return 0;
        if (line >= pdoc->LinesTotal())
                return pdoc->Length();
-       //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine);
        Surface surface;
        surface.Init();
        surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage);
@@ -280,6 +297,42 @@ int Editor::PositionFromLocation(Point pt) {
        return ll.numCharsInLine + posLineStart;
 }
 
+// Like PositionFromLocation but INVALID_POSITION returned when not near any text.
+int Editor::PositionFromLocationClose(Point pt) {
+       RefreshStyleData();
+       PRectangle rcClient = GetTextRectangle();
+       if (!rcClient.Contains(pt))
+               return INVALID_POSITION;
+       if (pt.x < vs.fixedColumnWidth)
+               return INVALID_POSITION;
+       if (pt.y < 0)
+               return INVALID_POSITION;
+       pt.x = pt.x - vs.fixedColumnWidth + xOffset;
+       int line = cs.DocFromDisplay(pt.y / vs.lineHeight + topLine);
+       if (pt.y < 0) { // Division rounds towards 0
+               line = cs.DocFromDisplay((pt.y - (vs.lineHeight - 1)) / vs.lineHeight + topLine);
+       }
+       if (line < 0)
+               return INVALID_POSITION;
+       if (line >= pdoc->LinesTotal())
+               return INVALID_POSITION;
+       Surface surface;
+       surface.Init();
+       surface.SetUnicodeMode(SC_CP_UTF8 == pdoc->dbcsCodePage);
+       unsigned int posLineStart = pdoc->LineStart(line);
+
+       LineLayout ll;
+       LayoutLine(line, &surface, vs, ll);
+       for (int i = 0; i < ll.numCharsInLine; i++) {
+               if (pt.x < ((ll.positions[i] + ll.positions[i + 1]) / 2) ||
+                       ll.chars[i] == '\r' || ll.chars[i] == '\n') {
+                       return i + posLineStart;
+               }
+       }
+
+       return INVALID_POSITION;
+}
+
 int Editor::PositionFromLineX(int line, int x) {
        RefreshStyleData();
        if (line >= pdoc->LinesTotal())
@@ -303,27 +356,27 @@ int Editor::PositionFromLineX(int line, int x) {
 }
 
 void Editor::RedrawRect(PRectangle rc) {
-    //Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
-
-    // Clip the redraw rectangle into the client area
-    PRectangle rcClient = GetClientRectangle();
-    if (rc.top < rcClient.top)
-        rc.top = rcClient.top;
-    if (rc.bottom > rcClient.bottom)
-        rc.bottom = rcClient.bottom;
-    if (rc.left < rcClient.left)
-        rc.left = rcClient.left;
-    if (rc.right > rcClient.right)
-        rc.right = rcClient.right;
+       //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom);
 
-    if ((rc.bottom > rc.top) && (rc.right > rc.left)) {
-        wDraw.InvalidateRectangle(rc);
-    }
+       // Clip the redraw rectangle into the client area
+       PRectangle rcClient = GetClientRectangle();
+       if (rc.top < rcClient.top)
+               rc.top = rcClient.top;
+       if (rc.bottom > rcClient.bottom)
+               rc.bottom = rcClient.bottom;
+       if (rc.left < rcClient.left)
+               rc.left = rcClient.left;
+       if (rc.right > rcClient.right)
+               rc.right = rcClient.right;
+
+       if ((rc.bottom > rc.top) && (rc.right > rc.left)) {
+               wMain.InvalidateRectangle(rc);
+       }
 }
 
 void Editor::Redraw() {
        //Platform::DebugPrintf("Redraw all\n");
-       wDraw.InvalidateAll();
+       wMain.InvalidateAll();
 }
 
 void Editor::RedrawSelMargin() {
@@ -332,7 +385,7 @@ void Editor::RedrawSelMargin() {
        } else {
                PRectangle rcSelMargin = GetClientRectangle();
                rcSelMargin.right = vs.fixedColumnWidth;
-               wDraw.InvalidateRectangle(rcSelMargin);
+               wMain.InvalidateRectangle(rcSelMargin);
        }
 }
 
@@ -384,7 +437,6 @@ int Editor::SelectionStart(int line) {
                        return -1;
                } else {
                        int minX = Platform::Minimum(xStartSelect, xEndSelect);
-                       //return PositionFromLineX(line, minX + vs.fixedColumnWidth - xOffset);
                        return PositionFromLineX(line, minX);
                }
        }
@@ -455,6 +507,7 @@ void Editor::SetSelection(int currentPos_) {
 }
 
 void Editor::SetEmptySelection(int currentPos_) {
+       selType = selStream;
        SetSelection(currentPos_, currentPos_);
 }
 
@@ -485,6 +538,7 @@ int Editor::MovePositionTo(int newPos, bool extend) {
        }
        EnsureCaretVisible();
        ShowCaretAtCurrentPosition();
+       NotifyMove(newPos);
        return 0;
 }
 
@@ -541,7 +595,7 @@ void Editor::HorizontalScrollTo(int xPos) {
        if (xOffset < 0)
                xOffset = 0;
        SetHorizontalScrollPos();
-       Redraw();
+       RedrawRect(GetClientRectangle());
 }
 
 void Editor::MoveCaretInsideView() {
@@ -557,9 +611,10 @@ void Editor::MoveCaretInsideView() {
        }
 }
 
-void Editor::EnsureCaretVisible(bool useMargin) {
-       //Platform::DebugPrintf("EnsureCaretVisible %d\n", xOffset);
+void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) {
+       //Platform::DebugPrintf("EnsureCaretVisible %d %s\n", xOffset, useMargin ? " margin" : " ");
        PRectangle rcClient = GetTextRectangle();
+       //int rcClientFullWidth = rcClient.Width();
        int posCaret = currentPos;
        if (posDrag >= 0)
                posCaret = posDrag;
@@ -569,17 +624,26 @@ void Editor::EnsureCaretVisible(bool useMargin) {
        int lineCaret = cs.DisplayFromDoc(pdoc->LineFromPosition(posCaret));
        ptBottomCaret.y += vs.lineHeight - 1;
 
-       // Ensure the caret is reasonably visible in context.
+       // Ensure the caret is reasonably visible in context:
+       // xMargin must equal to xCaretMargin, with a minimum of 2 and a maximum of
+       // slightly less than half the width of the text area.
        int xMargin = Platform::Clamp(xCaretMargin, 2, Platform::Maximum(rcClient.Width() - 10, 4) / 2);
        if (!useMargin)
                xMargin = 2;
 
-       // Ensure certain amount of text visible on both sides of caretSo move if caret just on edge
-       rcClient.left = rcClient.left + xMargin;
-       rcClient.right = rcClient.right - xMargin;
+       // If we scroll the display, we use a minimum amount of xMargin.
+       int offsetLeft = rcClient.left + xMargin;
+       int offsetRight = rcClient.right - xMargin;
+       // If we are in XJUMPS mode, then when the margin is reached, the 
+       // offset jumps so that it won't need to move agin for a while.
+       if (!(caretPolicy & CARET_XJUMPS)) {
+               rcClient.left = offsetLeft;
+               rcClient.right = offsetRight;
+       }
 
-       if (!rcClient.Contains(pt) || !rcClient.Contains(ptBottomCaret) || (caretPolicy & CARET_STRICT)) {
-               //Platform::DebugPrintf("EnsureCaretVisible move, (%d,%d) (%d,%d)\n", pt.x, pt.y, rcClient.left, rcClient.right);
+       // Vertical positioning
+       if (vert && (!rcClient.Contains(pt) || !rcClient.Contains(ptBottomCaret) || (caretPolicy & CARET_STRICT))) {
+               //Platform::DebugPrintf("EnsureCaretVisible move, (%d,%d)(%d,%d)\n", pt.x, pt.y, rcClient.left, rcClient.right);
                // It should be possible to scroll the window to show the caret,
                // but this fails to remove the caret on GTK+
                if (caretPolicy & CARET_SLOP) {
@@ -600,12 +664,16 @@ void Editor::EnsureCaretVisible(bool useMargin) {
                                Redraw();
                        }
                }
+       }
+
+       // Horizontal positioning
+       if (horiz) {
                int xOffsetNew = xOffset;
                if (pt.x < rcClient.left) {
-                       xOffsetNew = xOffset - (rcClient.left - pt.x);
-               } else if (pt.x >= rcClient.right) {
-                       xOffsetNew = xOffset + (pt.x - rcClient.right);
-                       int xOffsetEOL = xOffset + (ptEOL.x - rcClient.right) - xMargin + 2;
+                       xOffsetNew = xOffset - (offsetLeft - pt.x);
+               } else if ((!(caretPolicy & CARET_XEVEN) && ((xOffset > 0) && useMargin)) || pt.x >= rcClient.right) {
+                       xOffsetNew = xOffset + (pt.x - offsetRight);
+                       int xOffsetEOL = xOffset + (ptEOL.x - offsetRight) - xMargin + 2;
                        //Platform::DebugPrintf("Margin %d %d\n", xOffsetNew, xOffsetEOL);
                        // Ensure don't scroll out into empty space
                        if (xOffsetNew > xOffsetEOL)
@@ -622,10 +690,10 @@ void Editor::EnsureCaretVisible(bool useMargin) {
 }
 
 void Editor::ShowCaretAtCurrentPosition() {
-       if (!wMain.HasFocus()) {
+       if (!hasFocus) {
                caret.active = false;
                caret.on = false;
-               return ;
+               return;
        }
        caret.active = true;
        caret.on = true;
@@ -644,15 +712,21 @@ void Editor::InvalidateCaret() {
                InvalidateRange(currentPos, currentPos + 1);
 }
 
+int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) {
+       if (vs.markers[markerCheck].markType == SC_MARK_EMPTY)
+               return markerDefault;
+       return markerCheck;
+}
+
 void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
        if (vs.fixedColumnWidth == 0)
-               return ;
+               return;
 
        PRectangle rcMargin = GetClientRectangle();
        rcMargin.right = vs.fixedColumnWidth;
 
        if (!rc.Intersects(rcMargin))
-               return ;
+               return;
 
        Surface *surface;
        if (bufferedDraw) {
@@ -691,15 +765,89 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
                        int line = cs.DocFromDisplay(visibleLine);
                        int yposScreen = 0;
 
+                       // Work out whether the top line is whitespace located after a 
+                       // lessening of fold level which implies a 'fold tail' but which should not
+                       // be displayed until the last of a sequence of whitespace.
+                       bool needWhiteClosure = false;  
+                       int level = pdoc->GetLevel(line);
+                       if (level & SC_FOLDLEVELWHITEFLAG) {
+                               int lineBack = line;
+                               int levelPrev = level;
+                               while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) {
+                                       lineBack--;
+                                       levelPrev = pdoc->GetLevel(lineBack);
+                               }
+                               if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) {
+                                       if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK))
+                                               needWhiteClosure = true;
+                               }
+                       }
+                       
+                       // Old code does not know about new markers needed to distinguish all cases
+                       int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, 
+                               SC_MARKNUM_FOLDEROPEN);
+                       int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND, 
+                               SC_MARKNUM_FOLDER);
+                       
                        while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) {
+
+                               // Decide which fold indicator should be displayed
+                               level = pdoc->GetLevel(line);
+                               int levelNext = pdoc->GetLevel(line+1);
                                int marks = pdoc->GetMark(line);
-                               if (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) {
+                               int levelNum = level & SC_FOLDLEVELNUMBERMASK;
+                               int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK;
+                               if (level & SC_FOLDLEVELHEADERFLAG) {
                                        if (cs.GetExpanded(line)) {
-                                               marks |= 1 << SC_MARKNUM_FOLDEROPEN;
+                                               if (levelNum == SC_FOLDLEVELBASE)
+                                                       marks |= 1 << SC_MARKNUM_FOLDEROPEN;
+                                               else 
+                                                       marks |= 1 << folderOpenMid;
                                        } else {
-                                               marks |= 1 << SC_MARKNUM_FOLDER;
+                                               if (levelNum == SC_FOLDLEVELBASE)
+                                                       marks |= 1 << SC_MARKNUM_FOLDER;
+                                               else
+                                                       marks |= 1 << folderEnd;
+                                       }
+                                       needWhiteClosure = false;
+                               } else if (level & SC_FOLDLEVELWHITEFLAG) {
+                                       if (needWhiteClosure) {
+                                               if (levelNext & SC_FOLDLEVELWHITEFLAG) {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERSUB;
+                                               } else if (levelNum > SC_FOLDLEVELBASE) {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+                                                       needWhiteClosure = false;
+                                               } else {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+                                                       needWhiteClosure = false;
+                                               }
+                                       } else if (levelNum > SC_FOLDLEVELBASE) {
+                                               if (levelNextNum < levelNum) {
+                                                       if (levelNextNum > SC_FOLDLEVELBASE) {
+                                                               marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+                                                       } else {
+                                                               marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+                                                       }
+                                               } else {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERSUB;
+                                               }
+                                       }
+                               } else if (levelNum > SC_FOLDLEVELBASE) {
+                                       if (levelNextNum < levelNum) {
+                                               needWhiteClosure = false;
+                                               if (levelNext & SC_FOLDLEVELWHITEFLAG) {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERSUB;
+                                                       needWhiteClosure = true;
+                                               } else if (levelNextNum > SC_FOLDLEVELBASE) {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+                                               } else {
+                                                       marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+                                               }
+                                       } else {
+                                               marks |= 1 << SC_MARKNUM_FOLDERSUB;
                                        }
                                }
+
                                marks &= vs.ms[margin].mask;
                                PRectangle rcMarker = rcSelMargin;
                                rcMarker.top = yposScreen;
@@ -726,8 +874,6 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
                                if (marks) {
                                        for (int markBit = 0; (markBit < 32) && marks; markBit++) {
                                                if (marks & 1) {
-                                                       rcMarker.top++;
-                                                       rcMarker.bottom--;
                                                        vs.markers[markBit].Draw(surface, rcMarker);
                                                }
                                                marks >>= 1;
@@ -763,6 +909,11 @@ void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) {
        surface->LineTo(xhead, ymid + ydiff);
 }
 
+/**
+ * Fill in the LineLayout data for the given line.
+ * Copy the given @a line and its styles from the document into local arrays.
+ * Also determine the x position at which each character starts.
+ */
 void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout &ll) {
        int numCharsInLine = 0;
        int posLineStart = pdoc->LineStart(line);
@@ -771,9 +922,11 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
        char styleByte = 0;
        int styleMask = pdoc->stylingBitsMask;
        ll.xHighlightGuide = 0;
+       // If the line is very long, limit the treatment to a length that should fit in the viewport
        if (posLineEnd > (posLineStart + LineLayout::maxLineLength)) {
                posLineEnd = posLineStart + LineLayout::maxLineLength;
        }
+       // Fill base line layout
        for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) {
                char chDoc = pdoc->CharAt(charInDoc);
                styleByte = pdoc->StyleAt(charInDoc);
@@ -781,6 +934,10 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                        ll.chars[numCharsInLine] = chDoc;
                        ll.styles[numCharsInLine] = static_cast<char>(styleByte & styleMask);
                        ll.indicators[numCharsInLine] = static_cast<char>(styleByte & ~styleMask);
+                       if (vstyle.styles[ll.styles[numCharsInLine]].caseForce == Style::caseUpper)
+                               ll.chars[numCharsInLine] = static_cast<char>(toupper(chDoc));
+                       else if (vstyle.styles[ll.styles[numCharsInLine]].caseForce == Style::caseLower)
+                               ll.chars[numCharsInLine] = static_cast<char>(tolower(chDoc));
                        numCharsInLine++;
                }
        }
@@ -791,10 +948,11 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
 
        // Layout the line, determining the position of each character,
        // with an extra element at the end for the end of the line.
-       int startseg = 0;
-       int startsegx = 0;
+       int startseg = 0;       // Start of the current segment, in char. number
+       int startsegx = 0;      // Start of the current segment, in pixels
        ll.positions[0] = 0;
        unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars;
+       bool lastSegItalics = false;
 
        for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
                if ((ll.styles[charInLine] != ll.styles[charInLine + 1]) ||
@@ -810,14 +968,16 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                                                // +3 For a blank on front and rounded edge each side:
                                                ll.positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, strlen(ctrlChar)) + 3;
                                        }
-                               } else {
+                                       lastSegItalics = false;
+                               } else {        // Regular character
+                                       lastSegItalics = vstyle.styles[ll.styles[charInLine]].italic;
                                        int lenSeg = charInLine - startseg + 1;
                                        if ((lenSeg == 1) && (' ' == ll.chars[startseg])) {
                                                // Over half the segments are single characters and of these about half are space characters.
                                                ll.positions[charInLine + 1] = vstyle.styles[ll.styles[charInLine]].spaceWidth;
                                        } else {
                                                surface->MeasureWidths(vstyle.styles[ll.styles[charInLine]].font, ll.chars + startseg,
-                                                                      charInLine - startseg + 1, ll.positions + startseg + 1);
+                                                                      lenSeg, ll.positions + startseg + 1);
                                        }
                                }
                        } else {    // invisible
@@ -832,6 +992,10 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                        startseg = charInLine + 1;
                }
        }
+       // Small hack to make lines that end with italics not cut off the edge of the last character
+       if ((startseg > 0) && lastSegItalics) {
+               ll.positions[startseg] += 2;
+       }
        ll.numCharsInLine = numCharsInLine;
 }
 
@@ -845,19 +1009,23 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
        // is taken by an individual character - internal leading gives varying results.
        Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font;
 
-       int marks = 0;
-       Colour markBack = Colour(0, 0, 0);
+       bool overrideBackground = false;
+       Colour background = Colour(0, 0, 0);
+       if (caret.active && vsDraw.showCaretLineBackground && ll.containsCaret) {
+               overrideBackground = true;
+               background = vsDraw.caretLineBackground.allocated;
+       }
        if (vsDraw.maskInLine) {
-               marks = pdoc->GetMark(line) & vsDraw.maskInLine;
+               int marks = pdoc->GetMark(line) & vsDraw.maskInLine;
                if (marks) {
+                       overrideBackground = true;
                        for (int markBit = 0; (markBit < 32) && marks; markBit++) {
                                if (marks & 1) {
-                                       markBack = vsDraw.markers[markBit].back.allocated;
+                                       background = vsDraw.markers[markBit].back.allocated;
                                }
                                marks >>= 1;
                        }
                }
-               marks = pdoc->GetMark(line) & vsDraw.maskInLine;
        }
 
        bool inIndentation = true;
@@ -893,8 +1061,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
                                if (vsDraw.selforeset)
                                        textFore = vsDraw.selforeground.allocated;
                        } else {
-                               if (marks)
-                                       textBack = markBack;
+                               if (overrideBackground)
+                                       textBack = background;
                                if ((vsDraw.edgeState == EDGE_BACKGROUND) && (i >= ll.edgeColumn) && (ll.chars[i] != '\n') && (ll.chars[i] != '\r'))
                                        textBack = vsDraw.edgecolour.allocated;
                        }
@@ -948,7 +1116,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
                                                         rcSegment.top + vsDraw.maxAscent, ctrlChar, strlen(ctrlChar),
                                                         textBack, textFore);
                                // Manage normal display
-                       } else {
+                       }
+                       else {
                                rcSegment.left = ll.positions[startseg] + xStart;
                                rcSegment.right = ll.positions[i + 1] + xStart;
                                // Only try to draw if really visible - enhances performance by not calling environment to
@@ -1032,16 +1201,16 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
                        surface->FillRectangle(rcSegment, vsDraw.selbackground.allocated);
                else
                        surface->FillRectangle(rcSegment, vsDraw.selbackground2.allocated);
-       } else if (marks) {
-               surface->FillRectangle(rcSegment, markBack);
+       } else if (overrideBackground) {
+               surface->FillRectangle(rcSegment, background);
        } else {
                surface->FillRectangle(rcSegment, vsDraw.styles[ll.styles[ll.numCharsInLine] & styleMask].back.allocated);
        }
 
        rcSegment.left = xEol + vsDraw.aveCharWidth + xStart;
        rcSegment.right = rcLine.right;
-       if (marks) {
-               surface->FillRectangle(rcSegment, markBack);
+       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 {
@@ -1110,14 +1279,14 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
        }
 
        surfaceWindow->SetPalette(&palette, true);
-       pixmapLine.SetPalette(&palette, !wMain.HasFocus());
+       pixmapLine.SetPalette(&palette, !hasFocus);
 
        //Platform::DebugPrintf("Paint: (%3d,%3d) ... (%3d,%3d)\n",
        //      rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
 
        int screenLinePaintFirst = rcArea.top / vs.lineHeight;
        // The area to be painted plus one extra line is styled.
-       // The extra line is to determine when a style change, such as statrting a comment flows on to other lines.
+       // The extra line is to determine when a style change, such as starting a comment flows on to other lines.
        int lineStyleLast = topLine + (rcArea.bottom - 1) / vs.lineHeight + 1;
        //Platform::DebugPrintf("Paint lines = %d .. %d\n", topLine + screenLinePaintFirst, lineStyleLast);
        int endPosPaint = pdoc->Length();
@@ -1150,10 +1319,11 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                // Either styling or NotifyUpdateUI noticed that painting is needed
                // outside the current painting rectangle
                //Platform::DebugPrintf("Abandoning paint\n");
-               return ;
+               return;
        }
        //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset);
 
+       // Do the painting
        if (rcArea.right > vs.fixedColumnWidth) {
 
                Surface *surface = surfaceWindow;
@@ -1176,11 +1346,29 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                rcTextArea.left = vs.fixedColumnWidth;
                rcTextArea.right -= vs.rightMarginWidth;
                surfaceWindow->SetClip(rcTextArea);
+
+               // Loop on visible lines
                //GTimer *tim=g_timer_new();
                while (visibleLine < cs.LinesDisplayed() && yposScreen < rcArea.bottom) {
                        //g_timer_start(tim);
                        //Platform::DebugPrintf("Painting line %d\n", line);
 
+                       // Copy this line and its styles from the document into local arrays
+                       // and determine the x position at which each character starts.
+                       LineLayout ll;
+                       LayoutLine(line, surface, vs, ll);
+
+                       ll.selStart = SelectionStart(line);
+                       ll.selEnd = SelectionEnd(line);
+                       ll.containsCaret = line == lineCaret;
+                       if (hideSelection) {
+                               ll.selStart = -1;
+                               ll.selEnd = -1;
+                               ll.containsCaret = false;
+                       }
+                       // Need to fix this up so takes account of Unicode and DBCS
+                       ll.edgeColumn = theEdge;
+
                        int posLineStart = pdoc->LineStart(line);
                        int posLineEnd = pdoc->LineStart(line + 1);
                        //Platform::DebugPrintf("line %d %d - %d\n", line, posLineStart, posLineEnd);
@@ -1189,11 +1377,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                        rcLine.top = ypos;
                        rcLine.bottom = ypos + vs.lineHeight;
 
-                       // Copy this line and its styles from the document into local arrays
-                       // and determine the x position at which each character starts.
-                       LineLayout ll;
-                       LayoutLine(line, surface, vs, ll);
-
                        // Highlight the current braces if any
                        if ((braces[0] >= posLineStart) && (braces[0] < posLineEnd)) {
                                int braceOffset = braces[0] - posLineStart;
@@ -1210,15 +1393,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                                ll.xHighlightGuide = highlightGuideColumn * vs.spaceWidth;
                        }
 
-                       ll.selStart = SelectionStart(line);
-                       ll.selEnd = SelectionEnd(line);
-                       if (hideSelection) {
-                               ll.selStart = -1;
-                               ll.selEnd = -1;
-                       }
-                       // Need to fix this up so takes account of Unicode and DBCS
-                       ll.edgeColumn = theEdge;
-
                        // Draw the line
                        if (cs.GetVisible(line))
                                DrawLine(surface, vs, line, visibleLine, xStart, rcLine, ll);
@@ -1255,17 +1429,20 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                                        widthOverstrikeCaret = 3;
                                if (((caret.active && caret.on) || (posDrag >= 0)) && xposCaret >= 0) {
                                        PRectangle rcCaret = rcLine;
+                                       int caretWidthOffset = 0;
+                                       if ((offset > 0) && (vs.caretWidth > 1))
+                                               caretWidthOffset = 1;   // Move back so overlaps both character cells.
                                        if (posDrag >= 0) {
-                                               rcCaret.left = xposCaret;
-                                               rcCaret.right = xposCaret + 1;
+                                               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 {
-                                                       rcCaret.left = xposCaret;
-                                                       rcCaret.right = xposCaret + 1;
+                                                       rcCaret.left = xposCaret - caretWidthOffset;
+                                                       rcCaret.right = rcCaret.left + vs.caretWidth;
                                                }
                                        }
                                        surface->FillRectangle(rcCaret, vs.caretcolour.allocated);
@@ -1294,6 +1471,10 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                }
                //g_timer_destroy(tim);
 
+               // Right column limit indicator
+
+
+
                PRectangle rcBeyondEOF = rcClient;
                rcBeyondEOF.left = vs.fixedColumnWidth;
                rcBeyondEOF.right = rcBeyondEOF.right;
@@ -1307,6 +1488,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                                surfaceWindow->FillRectangle(rcBeyondEOF, vs.edgecolour.allocated);
                        }
                }
+               NotifyPainted();
        }
 }
 
@@ -1360,8 +1542,9 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
        // Don't show the selection when printing
        vsPrint.selbackset = false;
        vsPrint.selforeset = false;
-       // White background for the line numbers
-       vsPrint.styles[STYLE_LINENUMBER].back.desired = Colour(0xff, 0xff, 0xff);
+       vsPrint.showCaretLineBackground = false;
+
+       // Set colours for printing according to users settings
        for (int sty = 0;sty <= STYLE_MAX;sty++) {
                if (printColourMode == SC_PRINT_INVERTLIGHT) {
                        vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired);
@@ -1369,8 +1552,15 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
                } else if (printColourMode == SC_PRINT_BLACKONWHITE) {
                        vsPrint.styles[sty].fore.desired = Colour(0, 0, 0);
                        vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff);
+               } else if (printColourMode == SC_PRINT_COLOURONWHITE) {
+                       vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff);
+               } else if (printColourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) {
+                       if (sty <= STYLE_DEFAULT) {
+                               vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff);
+                       }
                }
        }
+       // White background for the line numbers
        vsPrint.styles[STYLE_LINENUMBER].back.desired = Colour(0xff, 0xff, 0xff);
 
        vsPrint.Refresh(*surfaceMeasure);
@@ -1381,7 +1571,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
        int lineNumberWidth = 0;
        if (lineNumberIndex >= 0) {
                lineNumberWidth = surface->WidthText(vsPrint.styles[STYLE_LINENUMBER].font,
-                                                    "9999" lineNumberPrintSpace, 4 + strlen(lineNumberPrintSpace));
+                                                    "99999" lineNumberPrintSpace, 5 + strlen(lineNumberPrintSpace));
                vsPrint.ms[lineNumberIndex].width = lineNumberWidth;
        }
 
@@ -1410,6 +1600,22 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
 
                while (line <= linePrintLast && ypos < pfr->rc.bottom) {
 
+                       // When printing, the hdc and hdcTarget may be the same, so
+                       // changing the state of surfaceMeasure may change the underlying
+                       // state of surface. Therefore, any cached state is discarded before
+                       // using each surface.
+                       surfaceMeasure->FlushCachedState();
+
+                       // Copy this line and its styles from the document into local arrays
+                       // and determine the x position at which each character starts.
+                       LineLayout ll;
+                       LayoutLine(line, surfaceMeasure, vsPrint, ll);
+                       ll.selStart = -1;
+                       ll.selEnd = -1;
+                       ll.containsCaret = false;
+                       // Need to fix this up so takes account of Unicode and DBCS
+                       ll.edgeColumn = theEdge;
+
                        PRectangle rcLine;
                        rcLine.left = pfr->rc.left + lineNumberWidth;
                        rcLine.top = ypos;
@@ -1430,21 +1636,6 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
                                                  vsPrint.styles[STYLE_LINENUMBER].back.allocated);
                        }
 
-                       // When printing, the hdc and hdcTarget may be the same, so
-                       // changing the state of surfaceMeasure may change the underlying
-                       // state of surface. Therefore, any cached state is discarded before
-                       // using each surface.
-
-                       // Copy this line and its styles from the document into local arrays
-                       // and determine the x position at which each character starts.
-                       surfaceMeasure->FlushCachedState();
-                       LineLayout ll;
-                       LayoutLine(line, surfaceMeasure, vsPrint, ll);
-                       ll.selStart = -1;
-                       ll.selEnd = -1;
-                       // Need to fix this up so takes account of Unicode and DBCS
-                       ll.edgeColumn = theEdge;
-
                        // Draw the line
                        surface->FlushCachedState();
                        DrawLine(surface, vsPrint, line, line, xStart, rcLine, ll);
@@ -1463,7 +1654,6 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
 // Empty method is overridden on GTK+ to show / hide scrollbars
 void Editor::ReconfigureScrollBars() {}
 
-
 void Editor::SetScrollBarsTo(PRectangle) {
        RefreshStyleData();
 
@@ -1483,7 +1673,6 @@ void Editor::SetScrollBarsTo(PRectangle) {
        //Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage);
 }
 
-
 void Editor::SetScrollBars() {
        PRectangle rsClient = GetClientRectangle();
        SetScrollBarsTo(rsClient);
@@ -1512,7 +1701,38 @@ void Editor::AddCharUTF(char *s, unsigned int len) {
        // Avoid blinking during rapid typing:
        ShowCaretAtCurrentPosition();
        SetLastXChosen();
-       NotifyChar(s[0]);
+
+       int byte = static_cast<unsigned char>(s[0]);
+       if ((byte < 0xC0) || (1 == len)) {
+               // Handles UTF-8 characters between 0x01 and 0x7F and single byte 
+               // characters when not in UTF-8 mode. 
+               // Also treats \0 and naked trail bytes 0x80 to 0xBF as valid
+               // characters representing themselves.
+       } else {
+               // Unroll 1 to 3 byte UTF-8 sequences.  See reference data at:
+               // http://www.cl.cam.ac.uk/~mgk25/unicode.html
+               // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
+               if (byte < 0xE0) {
+                       int byte2 = static_cast<unsigned char>(s[1]);
+                       if ((byte2 & 0xC0) == 0x80) {
+                               // Two-byte-character lead-byte followed by a trail-byte.
+                               byte = (((byte & 0x1F) << 6) | (byte2 & 0x3F));
+                       }
+                       // A two-byte-character lead-byte not followed by trail-byte
+                       // represents itself.
+               } else if (byte < 0xF0) {
+                       int byte2 = static_cast<unsigned char>(s[1]);
+                       int byte3 = static_cast<unsigned char>(s[2]);
+                       if (((byte2 & 0xC0) == 0x80) && ((byte3 & 0xC0) == 0x80)) {
+                               // Three-byte-character lead byte followed by two trail bytes.
+                               byte = (((byte & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
+                                       (byte3 & 0x3F));
+                       }
+                       // A three-byte-character lead-byte not followed by two trail-bytes
+                       // represents itself.
+               }
+       }
+       NotifyChar(byte);
 }
 
 void Editor::ClearSelection() {
@@ -1529,23 +1749,27 @@ void Editor::ClearSelection() {
                        }
                }
                SetEmptySelection(startPos);
-               selType = selStream;
                pdoc->EndUndoAction();
+               selType = selStream;
        } else {
                int startPos = SelectionStart();
                unsigned int chars = SelectionEnd() - startPos;
                SetEmptySelection(startPos);
                if (0 != chars) {
+                       pdoc->BeginUndoAction();
                        pdoc->DeleteChars(startPos, chars);
+                       pdoc->EndUndoAction();
                }
        }
 }
 
 void Editor::ClearAll() {
+       pdoc->BeginUndoAction();
        if (0 != pdoc->Length()) {
                pdoc->DeleteChars(0, pdoc->Length());
        }
        cs.Clear();
+       pdoc->EndUndoAction();
        anchor = 0;
        currentPos = 0;
        SetTopLine(0);
@@ -1560,16 +1784,22 @@ void Editor::ClearDocumentStyle() {
 }
 
 void Editor::Cut() {
-       Copy();
-       ClearSelection();
+       if (!pdoc->IsReadOnly()) {
+               Copy();
+               ClearSelection();
+       }
 }
 
 void Editor::PasteRectangular(int pos, const char *ptr, int len) {
+       if (pdoc->IsReadOnly()) {
+               return;
+       }
        currentPos = pos;
        int insertPos = currentPos;
        int xInsert = XFromPosition(currentPos);
        int line = pdoc->LineFromPosition(currentPos);
        bool prevCr = false;
+       pdoc->BeginUndoAction();
        for (int i = 0; i < len; i++) {
                if ((ptr[i] == '\r') || (ptr[i] == '\n')) {
                        if ((ptr[i] == '\r') || (!prevCr))
@@ -1580,7 +1810,15 @@ void Editor::PasteRectangular(int pos, const char *ptr, int len) {
                                if (pdoc->eolMode != SC_EOL_CR)
                                        pdoc->InsertChar(pdoc->Length(), '\n');
                        }
+                       // Pad the end of lines with spaces if required
                        currentPos = PositionFromLineX(line, xInsert);
+                       if ((XFromPosition(currentPos) < xInsert) && (i + 1 < len)) {
+                               for (int i = 0; i < xInsert - XFromPosition(currentPos); i++) {
+                                       pdoc->InsertChar(currentPos, ' ');
+                                       currentPos++;
+                               }
+                               insertPos = currentPos;
+                       }
                        prevCr = ptr[i] == '\r';
                } else {
                        pdoc->InsertString(currentPos, ptr + i, 1);
@@ -1589,9 +1827,14 @@ void Editor::PasteRectangular(int pos, const char *ptr, int len) {
                        prevCr = false;
                }
        }
+       pdoc->EndUndoAction();
        SetEmptySelection(insertPos);
 }
 
+bool Editor::CanPaste() {
+       return !pdoc->IsReadOnly();
+}
+
 void Editor::Clear() {
        if (currentPos == anchor) {
                DelChar();
@@ -1608,7 +1851,7 @@ void Editor::SelectAll() {
 
 void Editor::Undo() {
        if (pdoc->CanUndo()) {
-        InvalidateCaret();
+               InvalidateCaret();
                int newPos = pdoc->Undo();
                SetEmptySelection(newPos);
                EnsureCaretVisible();
@@ -1631,8 +1874,23 @@ void Editor::DelChar() {
 
 void Editor::DelCharBack() {
        if (currentPos == anchor) {
-               int newPos = pdoc->DelCharBack(currentPos);
-               SetEmptySelection(newPos);
+               int lineCurrentPos = pdoc->LineFromPosition(currentPos);
+               if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) &&
+                       pdoc->GetColumn(currentPos) > 0 && pdoc->backspaceUnindents) {
+                       pdoc->BeginUndoAction();
+                       int indentation = pdoc->GetLineIndentation(lineCurrentPos);
+                       int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars);
+                       if (indentation % indentationStep == 0) {
+                               pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep);
+                       } else {
+                               pdoc->SetLineIndentation(lineCurrentPos, indentation - (indentation % indentationStep));
+                       }
+                       SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
+                       pdoc->EndUndoAction();
+               } else {
+                       int newPos = pdoc->DelCharBack(currentPos);
+                       SetEmptySelection(newPos);
+               }
        } else {
                ClearSelection();
                SetEmptySelection(currentPos);
@@ -1643,7 +1901,6 @@ void Editor::DelCharBack() {
 
 void Editor::NotifyFocus(bool) {}
 
-
 void Editor::NotifyStyleToNeeded(int endStyleNeeded) {
        SCNotification scn;
        scn.nmhdr.code = SCN_STYLENEEDED;
@@ -1655,7 +1912,7 @@ void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) {
        NotifyStyleToNeeded(endStyleNeeded);
 }
 
-void Editor::NotifyChar(char ch) {
+void Editor::NotifyChar(int ch) {
        SCNotification scn;
        scn.nmhdr.code = SCN_CHARADDED;
        scn.ch = ch;
@@ -1663,11 +1920,11 @@ void Editor::NotifyChar(char ch) {
 #ifdef MACRO_SUPPORT
        if (recordingMacro) {
                char txt[2];
-               txt[0] = ch;
+               txt[0] = static_cast<char>(ch);
                txt[1] = '\0';
                NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
        }
-#endif
+#endif 
 }
 
 void Editor::NotifySavePoint(bool isSavePoint) {
@@ -1698,6 +1955,12 @@ void Editor::NotifyUpdateUI() {
        NotifyParent(scn);
 }
 
+void Editor::NotifyPainted() {
+       SCNotification scn;
+       scn.nmhdr.code = SCN_PAINTED;
+       NotifyParent(scn);
+}
+
 bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) {
        int marginClicked = -1;
        int x = 0;
@@ -1728,6 +1991,15 @@ void Editor::NotifyNeedShown(int pos, int len) {
        NotifyParent(scn);
 }
 
+void Editor::NotifyDwelling(Point pt, bool state) {
+       SCNotification scn;
+       scn.nmhdr.code = state ? SCN_DWELLSTART : SCN_DWELLEND;
+       scn.position = PositionFromLocationClose(pt);
+       scn.x = pt.x;
+       scn.y = pt.y;
+       NotifyParent(scn);
+}
+
 // Notifications from document
 void Editor::NotifyModifyAttempt(Document*, void *) {
        //Platform::DebugPrintf("** Modify Attempt\n");
@@ -1808,13 +2080,12 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
                                // Some lines are hidden so may need shown.
                                // TODO: check if the modified area is hidden.
                                if (mh.modificationType & SC_MOD_BEFOREINSERT) {
-                                       NotifyNeedShown(mh.position, 0);
+                                       NotifyNeedShown(mh.position, mh.length);
                                } else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
                                        NotifyNeedShown(mh.position, mh.length);
                                }
                        }
                        if (mh.linesAdded != 0) {
-
                                // Update contraction state for inserted and removed lines
                                // lineOfPos should be calculated in context of state before modification, shouldn't it
                                int lineOfPos = pdoc->LineFromPosition(mh.position);
@@ -1859,6 +2130,8 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
                        NotifyChange(); // Send EN_CHANGE
                }
 
+
+
                SCNotification scn;
                scn.nmhdr.code = SCN_MODIFIED;
                scn.position = mh.position;
@@ -1886,6 +2159,10 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        case SCI_COPY:
        case SCI_PASTE:
        case SCI_CLEAR:
+       case WM_CUT:
+       case WM_COPY:
+       case WM_PASTE:
+       case WM_CLEAR:
        case SCI_REPLACESEL:
        case SCI_ADDTEXT:
        case SCI_INSERTTEXT:
@@ -1908,6 +2185,10 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        case SCI_WORDLEFTEXTEND:
        case SCI_WORDRIGHT:
        case SCI_WORDRIGHTEXTEND:
+       case SCI_WORDPARTLEFT:
+       case SCI_WORDPARTLEFTEXTEND:
+       case SCI_WORDPARTRIGHT:
+       case SCI_WORDPARTRIGHTEXTEND:
        case SCI_HOME:
        case SCI_HOMEEXTEND:
        case SCI_LINEEND:
@@ -1925,12 +2206,13 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        case SCI_DELETEBACK:
        case SCI_TAB:
        case SCI_BACKTAB:
-       case SCI_NEWLINE:
        case SCI_FORMFEED:
        case SCI_VCHOME:
        case SCI_VCHOMEEXTEND:
        case SCI_DELWORDLEFT:
        case SCI_DELWORDRIGHT:
+       case SCI_DELLINELEFT:
+       case SCI_DELLINERIGHT:
        case SCI_LINECUT:
        case SCI_LINEDELETE:
        case SCI_LINETRANSPOSE:
@@ -1938,11 +2220,12 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        case SCI_UPPERCASE:
                break;
 
-               // Filter out all others (display changes, etc)
+               // 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);
-
-               return ;
+               return;
        }
 
        // Send notification
@@ -1953,7 +2236,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long
        scn.lParam = lParam;
        NotifyParent(scn);
 }
-#endif
+#endif 
 
 // Force scroll and keep position relative to top of window
 void Editor::PageMove(int direction, bool extend) {
@@ -1995,7 +2278,6 @@ void Editor::ChangeCaseOfSelection(bool makeUpperCase) {
        pdoc->EndUndoAction();
 }
 
-
 void Editor::LineTranspose() {
        int line = pdoc->LineFromPosition(currentPos);
        if (line > 0) {
@@ -2028,7 +2310,6 @@ void Editor::LineTranspose() {
 
 void Editor::CancelModes() {}
 
-
 int Editor::KeyCommand(unsigned int iMessage) {
        Point pt = LocationFromPosition(currentPos);
 
@@ -2147,7 +2428,7 @@ int Editor::KeyCommand(unsigned int iMessage) {
                ShowCaretAtCurrentPosition();
                NotifyUpdateUI();
                break;
-       case SCI_CANCEL:        // Cancel any modes - handled in subclass
+       case SCI_CANCEL:                // Cancel any modes - handled in subclass
                // Also unselect text
                CancelModes();
                break;
@@ -2219,6 +2500,21 @@ int Editor::KeyCommand(unsigned int iMessage) {
                        MovePositionTo(currentPos);
                }
                break;
+       case SCI_DELLINELEFT: {
+                       int line = pdoc->LineFromPosition(currentPos);
+                       int start = pdoc->LineStart(line);
+                       pdoc->DeleteChars(start, currentPos - start);
+                       MovePositionTo(start);
+                       SetLastXChosen();
+               }
+               break;
+       case SCI_DELLINERIGHT: {
+                       int line = pdoc->LineFromPosition(currentPos);
+                       int end = pdoc->LineEnd(line);
+                       pdoc->DeleteChars(currentPos, end - currentPos);
+                       MovePositionTo(currentPos);
+               }
+               break;
        case SCI_LINECUT: {
                        int lineStart = pdoc->LineFromPosition(currentPos);
                        int lineEnd = pdoc->LineFromPosition(anchor);
@@ -2250,6 +2546,22 @@ int Editor::KeyCommand(unsigned int iMessage) {
        case SCI_UPPERCASE:
                ChangeCaseOfSelection(true);
                break;
+       case SCI_WORDPARTLEFT:
+               MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(currentPos), -1));
+               SetLastXChosen();
+               break;
+       case SCI_WORDPARTLEFTEXTEND:
+               MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(currentPos), -1), true);
+               SetLastXChosen();
+               break;
+       case SCI_WORDPARTRIGHT:
+               MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(currentPos), 1));
+               SetLastXChosen();
+               break;
+       case SCI_WORDPARTRIGHTEXTEND:
+               MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(currentPos), 1), true);
+               SetLastXChosen();
+               break;
        }
        return 0;
 }
@@ -2258,14 +2570,20 @@ int Editor::KeyDefault(int, int) {
        return 0;
 }
 
-int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt) {
+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);
        int msg = kmap.Find(key, modifiers);
-       if (msg)
+       if (msg) {
+               if (consumed)
+                       *consumed = true;
                return WndProc(msg, 0, 0);
-       else
+       } else {
+               if (consumed)
+                       *consumed = false;
                return KeyDefault(key, modifiers);
+       }
 }
 
 void Editor::SetWhitespaceVisible(int view) {
@@ -2281,15 +2599,50 @@ void Editor::Indent(bool forwards) {
        int lineOfAnchor = pdoc->LineFromPosition(anchor);
        int lineCurrentPos = pdoc->LineFromPosition(currentPos);
        if (lineOfAnchor == lineCurrentPos) {
-               ClearSelection();
-               if (pdoc->useTabs) {
-                       pdoc->InsertChar(currentPos, '\t');
-                       SetEmptySelection(currentPos + 1);
+               if (forwards) {
+                       ClearSelection();
+                       if (pdoc->GetColumn(currentPos) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) &&
+                               pdoc->tabIndents) {
+                               pdoc->BeginUndoAction();
+                               int indentation = pdoc->GetLineIndentation(lineCurrentPos);
+                               int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars);
+                               pdoc->SetLineIndentation(lineCurrentPos, indentation + indentationStep);
+                               SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
+                               pdoc->EndUndoAction();
+                       } else {
+                               if (pdoc->useTabs) {
+                                       pdoc->InsertChar(currentPos, '\t');
+                                       SetEmptySelection(currentPos + 1);
+                               } else {
+                                       int numSpaces = (pdoc->tabInChars) -
+                                                       (pdoc->GetColumn(currentPos) % (pdoc->tabInChars));
+                                       if (numSpaces < 1)
+                                               numSpaces = pdoc->tabInChars;
+                                       for (int i = 0; i < numSpaces; i++) {
+                                               pdoc->InsertChar(currentPos, ' ');
+                                       }
+                                       SetEmptySelection(currentPos + numSpaces);
+                               }
+                       }
                } else {
-                       for (int i = 0; i < pdoc->tabInChars; i++) {
-                               pdoc->InsertChar(currentPos, ' ');
+                       if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) &&
+                               pdoc->tabIndents) {
+                               pdoc->BeginUndoAction();
+                               int indentation = pdoc->GetLineIndentation(lineCurrentPos);
+                               int indentationStep = (pdoc->indentInChars ? pdoc->indentInChars : pdoc->tabInChars);
+                               pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep);
+                               SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
+                               pdoc->EndUndoAction();
+                       } else {
+                               int newColumn = ((pdoc->GetColumn(currentPos) - 1) / pdoc->tabInChars) *
+                                               pdoc->tabInChars;
+                               if (newColumn < 0)
+                                       newColumn = 0;
+                               int newPos = currentPos;
+                               while (pdoc->GetColumn(newPos) > newColumn)
+                                       newPos--;
+                               SetEmptySelection(newPos);
                        }
-                       SetEmptySelection(currentPos + pdoc->tabInChars);
                }
        } else {
                int anchorPosOnLine = anchor - pdoc->LineStart(lineOfAnchor);
@@ -2316,59 +2669,104 @@ void Editor::Indent(bool forwards) {
        }
 }
 
-long Editor::FindText(unsigned int iMessage, unsigned long wParam, long lParam) {
+/**
+ * Search of a text in the document, in the given range.
+ * @return The position of the found text, -1 if not found.
+ */
+long Editor::FindText(
+    unsigned int iMessage,     ///< Can be @c EM_FINDTEXT or @c EM_FINDTEXTEX or @c SCI_FINDTEXT.
+    unsigned long wParam,      ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+    ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
+    long lParam) {                     ///< @c TextToFind structure: The text to search for in the given range.
+
        TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
+       int lengthFound = strlen(ft->lpstrText);
        int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText,
-                               wParam & SCFIND_MATCHCASE, wParam & SCFIND_WHOLEWORD,
-                               wParam & SCFIND_WORDSTART);
+                                wParam & SCFIND_MATCHCASE,
+                                wParam & SCFIND_WHOLEWORD,
+                                wParam & SCFIND_WORDSTART,
+                                wParam & SCFIND_REGEXP,
+                                &lengthFound);
        if (pos != -1) {
                if (iMessage != EM_FINDTEXT) {
                        ft->chrgText.cpMin = pos;
-                       ft->chrgText.cpMax = pos + strlen(ft->lpstrText);
+                       ft->chrgText.cpMax = pos + lengthFound;
                }
        }
        return pos;
 }
 
-// Relocatable search support : Searches relative to current selection
-// point and sets the selection to the found text range with
-// each search.
-
-// Anchor following searches at current selection start:  This allows
-// multiple incremental interactive searches to be macro recorded
-// while still setting the selection to found text so the find/select
-// operation is self-contained.
+/**
+ * Relocatable search support : Searches relative to current selection
+ * point and sets the selection to the found text range with
+ * each search.
+ */
+/**
+ * Anchor following searches at current selection start: This allows
+ * multiple incremental interactive searches to be macro recorded
+ * while still setting the selection to found text so the find/select
+ * operation is self-contained.
+ */
 void Editor::SearchAnchor() {
        searchAnchor = SelectionStart();
 }
 
-// Find text from current search anchor:  Must call SearchAnchor first.
-// Accepts both SCI_SEARCHNEXT and SCI_SEARCHPREV.
-// wParam contains search modes : ORed FR_MATCHCASE and FR_WHOLEWORD.
-// lParam contains the text to search for.
-long Editor::SearchText(unsigned int iMessage, unsigned long wParam, long lParam) {
+/**
+ * Find text from current search anchor: Must call @c SearchAnchor first.
+ * Used for next text and previous text requests.
+ * @return The position of the found text, -1 if not found.
+ */
+long Editor::SearchText(
+    unsigned int iMessage,     ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV.
+    unsigned long wParam,      ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+    ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
+    long lParam) {                     ///< The text to search for.
+
        const char *txt = reinterpret_cast<char *>(lParam);
        int pos;
-
+       int lengthFound = strlen(txt);
        if (iMessage == SCI_SEARCHNEXT) {
                pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt,
-                       wParam & SCFIND_MATCHCASE,
-                       wParam & SCFIND_WHOLEWORD,
-                       wParam & SCFIND_WORDSTART);
+                                    wParam & SCFIND_MATCHCASE,
+                                    wParam & SCFIND_WHOLEWORD,
+                                    wParam & SCFIND_WORDSTART,
+                                    wParam & SCFIND_REGEXP,
+                                    &lengthFound);
        } else {
                pos = pdoc->FindText(searchAnchor, 0, txt,
-                       wParam & SCFIND_MATCHCASE,
-                       wParam & SCFIND_WHOLEWORD,
-                       wParam & SCFIND_WORDSTART);
+                                    wParam & SCFIND_MATCHCASE,
+                                    wParam & SCFIND_WHOLEWORD,
+                                    wParam & SCFIND_WORDSTART,
+                                    wParam & SCFIND_REGEXP,
+                                    &lengthFound);
        }
 
        if (pos != -1) {
-               SetSelection(pos, pos + strlen(txt));
+               SetSelection(pos, pos + lengthFound);
        }
 
        return pos;
 }
 
+/**
+ * Search for text in the target range of the document.
+ * @return The position of the found text, -1 if not found.
+ */
+long Editor::SearchInTarget(const char *text, int length) {
+       int lengthFound = length;
+       int pos = pdoc->FindText(targetStart, targetEnd, text,
+                                searchFlags & SCFIND_MATCHCASE,
+                                searchFlags & SCFIND_WHOLEWORD,
+                                searchFlags & SCFIND_WORDSTART,
+                                searchFlags & SCFIND_REGEXP,
+                                &lengthFound);
+       if (pos != -1) {
+               targetStart = pos;
+               targetEnd = pos + lengthFound;
+       }
+       return pos;
+}
+
 void Editor::GoToLine(int lineNo) {
        if (lineNo > pdoc->LinesTotal())
                lineNo = pdoc->LinesTotal();
@@ -2471,13 +2869,21 @@ void Editor::SetDragPosition(int newPos) {
        }
 }
 
+void Editor::DisplayCursor(Window::Cursor c) {
+       if (cursorMode == SC_CURSORNORMAL)
+               wMain.SetCursor(c);
+       else
+               wMain.SetCursor(static_cast<Window::Cursor>(cursorMode));
+}
+
 void Editor::StartDrag() {
        // Always handled by subclasses
        //SetMouseCapture(true);
-       //wDraw.SetCursor(Window::cursorArrow);
+       //DisplayCursor(Window::cursorArrow);
 }
 
 
+
 void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) {
        //Platform::DebugPrintf("DropAt %d\n", inDragDrop);
        if (inDragDrop)
@@ -2598,6 +3004,30 @@ bool Editor::PointInSelMargin(Point pt) {
        }
 }
 
+void Editor::LineSelection(int lineCurrent_, int lineAnchor_) {
+       if (lineAnchor_ < lineCurrent_) {
+               SetSelection(pdoc->LineStart(lineCurrent_ + 1),
+                            pdoc->LineStart(lineAnchor_));
+       } else if (lineAnchor_ > lineCurrent_) {
+               SetSelection(pdoc->LineStart(lineCurrent_),
+                            pdoc->LineStart(lineAnchor_ + 1));
+       } else { // Same line, select it
+               SetSelection(pdoc->LineStart(lineAnchor_ + 1),
+                            pdoc->LineStart(lineAnchor_));
+       }
+}
+
+void Editor::DwellEnd(bool mouseMoved) {
+       if (mouseMoved)
+               ticksToDwell = dwellDelay;
+       else
+               ticksToDwell = SC_TIME_FOREVER;
+       if (dwelling && (dwellDelay < SC_TIME_FOREVER)) {
+               dwelling = false;
+               NotifyDwelling(ptMouseLast, dwelling);
+       }
+}
+
 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);
        ptMouseLast = pt;
@@ -2607,9 +3037,10 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
 
        bool processed = NotifyMarginClick(pt, shift, ctrl, alt);
        if (processed)
-               return ;
+               return;
 
-       if (shift) {
+       bool inSelMargin = PointInSelMargin(pt);
+       if (shift & !inSelMargin) {
                SetSelection(newPos);
        }
        if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick)) {
@@ -2650,21 +3081,30 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
                if (doubleClick)
                        NotifyDoubleClick(pt, shift);
        } else {        // Single click
-               if (PointInSelMargin(pt)) {
+               if (inSelMargin) {
+                       selType = selStream;
                        if (ctrl) {
                                SelectAll();
                                lastClickTime = curTime;
-                               return ;
+                               return;
                        }
-                       lineAnchor = LineFromLocation(pt);
-                       // While experimenting with folding turn off line selection
                        if (!shift) {
+                               lineAnchor = LineFromLocation(pt);
                                // Single click in margin: select whole line
-                               SetSelection(pdoc->LineStart(lineAnchor + 1), pdoc->LineStart(lineAnchor));
+                               LineSelection(lineAnchor, lineAnchor);
+                               SetSelection(pdoc->LineStart(lineAnchor + 1),
+                                            pdoc->LineStart(lineAnchor));
                        } else {
-                               // Single shift+click in margin: select from anchor to beginning of clicked line
-                               SetSelection(pdoc->LineStart(lineAnchor), anchor);
+                               // Single shift+click in margin: select from line anchor to clicked line
+                               if (anchor > currentPos)
+                                       lineAnchor = pdoc->LineFromPosition(anchor - 1);
+                               else
+                                       lineAnchor = pdoc->LineFromPosition(anchor);
+                               int lineStart = LineFromLocation(pt);
+                               LineSelection(lineStart, lineAnchor);
+                               //lineAnchor = lineStart; // Keep the same anchor for ButtonMove
                        }
+
                        SetDragPosition(invalidPosition);
                        SetMouseCapture(true);
                        selectionType = selLine;
@@ -2678,13 +3118,13 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
                                CopySelectionIntoDrag();
                                StartDrag();
                        } else {
-                               selType = alt ? selRectangle : selStream;
                                xStartSelect = pt.x - vs.fixedColumnWidth + xOffset;
                                xEndSelect = pt.x - vs.fixedColumnWidth + xOffset;
                                SetDragPosition(invalidPosition);
                                SetMouseCapture(true);
                                if (!shift)
                                        SetEmptySelection(newPos);
+                               selType = alt ? selRectangle : selStream;
                                selectionType = selChar;
                                originalAnchorPos = currentPos;
                        }
@@ -2696,10 +3136,21 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
 }
 
 void Editor::ButtonMove(Point pt) {
+       if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) {
+               DwellEnd(true);
+       }
+       ptMouseLast = pt;
        //Platform::DebugPrintf("Move %d %d\n", pt.x, pt.y);
        if (HaveMouseCapture()) {
+
+               // Slow down autoscrolling/selection
+               autoScrollTimer.ticksToWait -= timer.tickSize;
+               if (autoScrollTimer.ticksToWait > 0)
+                       return;
+               autoScrollTimer.ticksToWait = autoScrollDelay;
+
+               // Adjust selection
                xEndSelect = pt.x - vs.fixedColumnWidth + xOffset;
-               ptMouseLast = pt;
                int movePos = PositionFromLocation(pt);
                movePos = MovePositionOutsideChar(movePos, currentPos - movePos);
                if (posDrag >= 0) {
@@ -2719,29 +3170,35 @@ void Editor::ButtonMove(Point pt) {
                        } else {
                                // Continue selecting by line
                                int lineMove = LineFromLocation(pt);
-                               if (lineAnchor < lineMove) {
-                                       SetSelection(pdoc->LineStart(lineMove + 1),
-                                                    pdoc->LineStart(lineAnchor));
-                               } else {
-                                       SetSelection(pdoc->LineStart(lineMove),
-                                                    pdoc->LineStart(lineAnchor + 1));
-                               }
+                               LineSelection(lineMove, lineAnchor);
                        }
                }
-               EnsureCaretVisible(false);
+
+               // Autoscroll
+               PRectangle rcClient = GetClientRectangle();
+               if (pt.y > rcClient.bottom) {
+                       int lineMove = cs.DisplayFromDoc(LineFromLocation(pt));
+                       ScrollTo(lineMove - LinesOnScreen() + 5);
+                       Redraw();
+               } else if (pt.y < rcClient.top) {
+                       int lineMove = cs.DisplayFromDoc(LineFromLocation(pt));
+                       ScrollTo(lineMove - 5);
+                       Redraw();
+               }
+               EnsureCaretVisible(false, false, true);
+
        } else {
                if (vs.fixedColumnWidth > 0) {  // There is a margin
                        if (PointInSelMargin(pt)) {
-                               wDraw.SetCursor(Window::cursorReverseArrow);
-                               return ;        // No need to test for selection
+                               DisplayCursor(Window::cursorReverseArrow);
+                               return        // No need to test for selection
                        }
-
                }
                // Display regular (drag) cursor over selection
                if (PointInSelection(pt))
-                       wDraw.SetCursor(Window::cursorArrow);
+                       DisplayCursor(Window::cursorArrow);
                else
-                       wDraw.SetCursor(Window::cursorText);
+                       DisplayCursor(Window::cursorText);
        }
 
 }
@@ -2750,9 +3207,9 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
        //Platform::DebugPrintf("ButtonUp %d\n", HaveMouseCapture());
        if (HaveMouseCapture()) {
                if (PointInSelMargin(pt)) {
-                       wDraw.SetCursor(Window::cursorReverseArrow);
+                       DisplayCursor(Window::cursorReverseArrow);
                } else {
-                       wDraw.SetCursor(Window::cursorText);
+                       DisplayCursor(Window::cursorText);
                }
                xEndSelect = pt.x - vs.fixedColumnWidth + xOffset;
                ptMouseLast = pt;
@@ -2813,6 +3270,26 @@ void Editor::Tick() {
                        InvalidateCaret();
                }
        }
+       if ((dwellDelay < SC_TIME_FOREVER) && 
+               (ticksToDwell > 0) &&
+               (!HaveMouseCapture())) {
+               ticksToDwell -= timer.tickSize;
+               if (ticksToDwell <= 0) {
+                       dwelling = true;
+                       NotifyDwelling(ptMouseLast, dwelling);
+               }
+       }
+}
+
+void Editor::SetFocusState(bool focusState) {
+       hasFocus = focusState;
+       NotifyFocus(hasFocus);
+       if (hasFocus) {
+               ShowCaretAtCurrentPosition();
+               InvalidateCaret();
+       } else {
+               DropCaret();
+       }
 }
 
 static bool IsIn(int a, int minimum, int maximum) {
@@ -2831,7 +3308,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
        if (paintState == painting && !paintingAllText) {
                //Platform::DebugPrintf("Checking range in paint %d-%d\n", r.start, r.end);
                if (!r.Valid())
-                       return ;
+                       return;
 
                PRectangle rcText = GetTextRectangle();
                // Determine number of lines displayed including a possible partially displayed last line
@@ -2843,7 +3320,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                if (!IsOverlap(topLine, bottomLine, lineRangeStart, lineRangeEnd)) {
                        //Platform::DebugPrintf("No overlap (%d-%d) with window(%d-%d)\n",
                        //              lineRangeStart, lineRangeEnd, topLine, bottomLine);
-                       return ;
+                       return;
                }
 
                // Assert rcPaint contained within or equal to rcText
@@ -2855,7 +3332,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                                //Platform::DebugPrintf("Change (%d-%d) in top npv(%d-%d)\n",
                                //      lineRangeStart, lineRangeEnd, topLine, paintTopLine);
                                paintState = paintAbandoned;
-                               return ;
+                               return;
                        }
                }
                if (rcPaint.bottom < rcText.bottom) {
@@ -2866,7 +3343,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                                //Platform::DebugPrintf("Change (%d-%d) in bottom npv(%d-%d)\n",
                                //      lineRangeStart, lineRangeEnd, paintBottomLine, bottomLine);
                                paintState = paintAbandoned;
-                               return ;
+                               return;
                        }
                }
        }
@@ -3005,12 +3482,12 @@ void Editor::ToggleContraction(int line) {
 
 // Recurse up from this line to find any folds that prevent this line from being visible
 // and unfold them all.
-void Editor::EnsureLineVisible(int line) {
-       if (!cs.GetVisible(line)) {
-               int lineParent = pdoc->GetFoldParent(line);
+void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) {
+       if (!cs.GetVisible(lineDoc)) {
+               int lineParent = pdoc->GetFoldParent(lineDoc);
                if (lineParent >= 0) {
-                       if (line != lineParent)
-                               EnsureLineVisible(lineParent);
+                       if (lineDoc != lineParent)
+                               EnsureLineVisible(lineParent, enforcePolicy);
                        if (!cs.GetExpanded(lineParent)) {
                                cs.SetExpanded(lineParent, 1);
                                Expand(lineParent, true);
@@ -3019,21 +3496,59 @@ void Editor::EnsureLineVisible(int line) {
                SetScrollBars();
                Redraw();
        }
+       if (enforcePolicy) {
+               int lineDisplay = cs.DisplayFromDoc(lineDoc);
+               if (visiblePolicy & VISIBLE_SLOP) {
+                       if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) {
+                               SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos()));
+                               SetVerticalScrollPos();
+                               Redraw();
+                       } else if ((lineDisplay > topLine + LinesOnScreen() - 1) ||
+                                          ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) {
+                               SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos()));
+                               SetVerticalScrollPos();
+                               Redraw();
+                       }
+               } else {
+                       if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) {
+                               SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos()));
+                               SetVerticalScrollPos();
+                               Redraw();
+                       }
+               }
+       }
+}
+
+int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) {
+       pdoc->BeginUndoAction();
+       if (length == -1)
+               length = strlen(text);
+       if (replacePatterns) {
+               text = pdoc->SubstituteByPosition(text, &length);
+               if (!text)
+                       return 0;
+       }
+       if (targetStart != targetEnd)
+               pdoc->DeleteChars(targetStart, targetEnd - targetStart);
+       targetEnd = targetStart;
+       pdoc->InsertString(targetStart, text, length);
+       targetEnd = targetStart + length;
+       pdoc->EndUndoAction();
+       return length;
 }
 
 static bool ValidMargin(unsigned long wParam) {
        return wParam < ViewStyle::margins;
 }
 
-
-long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long 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);
 
        // Optional macro recording hook
 #ifdef MACRO_SUPPORT
        if (recordingMacro)
                NotifyMacroRecord(iMessage, wParam, lParam);
-#endif
+#endif 
 
        switch (iMessage) {
 
@@ -3095,7 +3610,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                SetLastXChosen();
                break;
 
-               // Edit control mesages
+               // Edit control messages
 
                // Not supported (no-ops):
                //              EM_GETWORDBREAKPROC
@@ -3164,31 +3679,37 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                return topLine;
 
        case EM_GETLINE: {
-                       if (lParam == 0)
+                       if (lParam == 0) {
                                return 0;
-                       int lineStart = pdoc->LineStart(wParam);
-                       int lineEnd = pdoc->LineStart(wParam + 1);
+                       }
                        char *ptr = reinterpret_cast<char *>(lParam);
                        short *pBufSize = reinterpret_cast<short *>(lParam);
-                       if (*pBufSize < lineEnd - lineStart) {
-                               ptr[0] = '\0';  // If no characters copied have to put a NUL into buffer
+                       short bufSize = *pBufSize;
+                       ptr[0] = '\0';  // If no characters copied, have to put a NUL into buffer
+                       if (static_cast<int>(wParam) > pdoc->LinesTotal()) {
                                return 0;
                        }
+                       int lineStart = pdoc->LineStart(wParam);
+                       int lineEnd = pdoc->LineStart(wParam + 1);
+                       // The first word of the buffer is the size, in TCHARs, of the buffer
                        int iPlace = 0;
-                       for (int iChar = lineStart; iChar < lineEnd; iChar++)
+                       for (int iChar = lineStart; iChar < lineEnd && iPlace < bufSize; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
+                       }
                        return iPlace;
                }
 
-       case SCI_GETLINE: {
-                       if (lParam == 0)
+       case SCI_GETLINE: {     // Simpler than EM_GETLINE, but with risk of overwriting the end of the buffer
+                       if (lParam == 0) {
                                return 0;
+                       }
                        int lineStart = pdoc->LineStart(wParam);
                        int lineEnd = pdoc->LineStart(wParam + 1);
                        char *ptr = reinterpret_cast<char *>(lParam);
                        int iPlace = 0;
-                       for (int iChar = lineStart; iChar < lineEnd; iChar++)
+                       for (int iChar = lineStart; iChar < lineEnd; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
+                       }
                        return iPlace;
                }
 
@@ -3268,6 +3789,8 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                                        ptr[iChar] = text[iChar];
                                ptr[iChar] = '\0';
                                delete []text;
+                       } else {
+                               ptr[0] = '\0';
                        }
                        return iChar;
                }
@@ -3294,7 +3817,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                if (wParam == 0)
                        return 0;       // Even if there is no text, there is a first line that starts at 0
                if (static_cast<int>(wParam) > pdoc->LinesTotal())
-                       return - 1;
+                       return -1;
                //if (wParam > pdoc->LineFromPosition(pdoc->Length()))  // Useful test, anyway...
                //      return -1;
                return pdoc->LineStart(wParam);
@@ -3334,6 +3857,39 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                }
                break;
 
+       case SCI_SETTARGETSTART:
+               targetStart = wParam;
+               break;
+
+       case SCI_GETTARGETSTART:
+               return targetStart;
+
+       case SCI_SETTARGETEND:
+               targetEnd = wParam;
+               break;
+
+       case SCI_GETTARGETEND:
+               return targetEnd;
+
+       case SCI_REPLACETARGET:
+               PLATFORM_ASSERT(lParam);
+               return ReplaceTarget(false, reinterpret_cast<char *>(lParam), wParam);
+
+       case SCI_REPLACETARGETRE:
+               PLATFORM_ASSERT(lParam);
+               return ReplaceTarget(true, reinterpret_cast<char *>(lParam), wParam);
+
+       case SCI_SEARCHINTARGET:
+               PLATFORM_ASSERT(lParam);
+               return SearchInTarget(reinterpret_cast<char *>(lParam), wParam);
+
+       case SCI_SETSEARCHFLAGS:
+               searchFlags = wParam;
+               break;
+
+       case SCI_GETSEARCHFLAGS:
+               return searchFlags;
+
        case EM_LINESCROLL:
        case SCI_LINESCROLL:
                ScrollTo(topLine + lParam);
@@ -3355,7 +3911,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
 
        case EM_CANPASTE:
        case SCI_CANPASTE:
-               return 1;
+               return CanPaste();
 
        case EM_CHARFROMPOS: {
                        if (lParam == 0)
@@ -3419,15 +3975,16 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                }
 
 
+
        case EM_SELECTIONTYPE:
 #ifdef SEL_EMPTY
                if (currentPos == anchor)
                        return SEL_EMPTY;
                else
                        return SEL_TEXT;
-#else
+#else 
                return 0;
-#endif
+#endif 
 
        case EM_HIDESELECTION:
                hideSelection = wParam;
@@ -3461,7 +4018,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                        vs.rightMarginWidth = vs.aveCharWidth / 2;
                }
                InvalidateStyleRedraw();
-#endif
+#endif 
                break;
 
        case SCI_SETMARGINLEFT:
@@ -3611,7 +4168,6 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
 
        case SCI_SETSAVEPOINT:
                pdoc->SetSavePoint();
-               NotifySavePoint(true);
                break;
 
        case SCI_GETSTYLEDTEXT: {
@@ -3649,6 +4205,9 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_POSITIONFROMPOINT:
                return PositionFromLocation(Point(wParam, lParam));
 
+       case SCI_POSITIONFROMPOINTCLOSE:
+               return PositionFromLocationClose(Point(wParam, lParam));
+
        case SCI_GOTOLINE:
                GoToLine(wParam);
                break;
@@ -3660,15 +4219,17 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                break;
 
        case SCI_GETCURLINE: {
-                       if (lParam == 0)
+                       if (lParam == 0) {
                                return 0;
+                       }
                        int lineCurrentPos = pdoc->LineFromPosition(currentPos);
                        int lineStart = pdoc->LineStart(lineCurrentPos);
                        unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1);
                        char *ptr = reinterpret_cast<char *>(lParam);
                        unsigned int iPlace = 0;
-                       for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam; iChar++)
+                       for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
+                       }
                        ptr[iPlace] = '\0';
                        return currentPos - lineStart;
                }
@@ -3691,7 +4252,7 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                pdoc->SetStyleFor(wParam, static_cast<char>(lParam));
                break;
 
-       case SCI_SETSTYLINGEX:    // Specify a complete styling buffer
+       case SCI_SETSTYLINGEX:           // Specify a complete styling buffer
                if (lParam == 0)
                        return 0;
                pdoc->SetStyles(wParam, reinterpret_cast<char *>(lParam));
@@ -3739,6 +4300,28 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_GETLINEINDENTPOSITION:
                return pdoc->GetLineIndentPosition(wParam);
 
+       case SCI_SETTABINDENTS:
+               pdoc->tabIndents = wParam;
+               break;
+
+       case SCI_GETTABINDENTS:
+               return pdoc->tabIndents;
+
+       case SCI_SETBACKSPACEUNINDENTS:
+               pdoc->backspaceUnindents = wParam;
+               break;
+
+       case SCI_GETBACKSPACEUNINDENTS:
+               return pdoc->backspaceUnindents;
+
+       case SCI_SETMOUSEDWELLTIME:
+               dwellDelay = wParam;
+               ticksToDwell = dwellDelay;
+               break;
+       
+       case SCI_GETMOUSEDWELLTIME:
+               return dwellDelay;
+       
        case SCI_GETCOLUMN:
                return pdoc->GetColumn(wParam);
 
@@ -3946,6 +4529,12 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                        InvalidateStyleRedraw();
                }
                break;
+       case SCI_STYLESETCASE:
+               if (wParam <= STYLE_MAX) {
+                       vs.styles[wParam].caseForce = static_cast<Style::ecaseForced>(lParam);
+                       InvalidateStyleRedraw();
+               }
+               break;
        case SCI_STYLESETCHARACTERSET:
                if (wParam <= STYLE_MAX) {
                        vs.styles[wParam].characterSet = lParam;
@@ -3979,6 +4568,19 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_GETMAXLINESTATE:
                return pdoc->GetMaxLineState();
 
+       case SCI_GETCARETLINEVISIBLE:
+               return vs.showCaretLineBackground;
+       case SCI_SETCARETLINEVISIBLE:
+               vs.showCaretLineBackground = wParam;
+               InvalidateStyleRedraw();
+               break;
+       case SCI_GETCARETLINEBACK:
+               return vs.caretLineBackground.desired.AsLong();
+       case SCI_SETCARETLINEBACK:
+               vs.caretLineBackground.desired = wParam;
+               InvalidateStyleRedraw();
+               break;
+
                // Folding messages
 
        case SCI_VISIBLEFROMDOCLINE:
@@ -4037,7 +4639,11 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                break;
 
        case SCI_ENSUREVISIBLE:
-               EnsureLineVisible(wParam);
+               EnsureLineVisible(wParam, false);
+               break;
+
+       case SCI_ENSUREVISIBLEENFORCEPOLICY:
+               EnsureLineVisible(wParam, true);
                break;
 
        case SCI_SEARCHANCHOR:
@@ -4053,6 +4659,11 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
                caretSlop = lParam;
                break;
 
+       case SCI_SETVISIBLEPOLICY:
+               visiblePolicy = wParam;
+               visibleSlop = lParam;
+               break;
+
        case SCI_LINESONSCREEN:
                return LinesOnScreen();
 
@@ -4080,6 +4691,19 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_GETCARETFORE:
                return vs.caretcolour.desired.AsLong();
 
+       case SCI_SETCARETWIDTH:
+               if (wParam <= 1)
+                       vs.caretWidth = 1;
+               else if (wParam >= 3)
+                       vs.caretWidth = 3;
+               else
+                       vs.caretWidth = wParam;
+               InvalidateStyleRedraw();
+               break;
+
+       case SCI_GETCARETWIDTH:
+               return vs.caretWidth;
+
        case SCI_ASSIGNCMDKEY:
                kmap.AssignCmdKey(Platform::LowShortFromLong(wParam),
                                  Platform::HighShortFromLong(wParam), lParam);
@@ -4151,6 +4775,8 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_ZOOMOUT:
        case SCI_DELWORDLEFT:
        case SCI_DELWORDRIGHT:
+       case SCI_DELLINELEFT:
+       case SCI_DELLINERIGHT:
        case SCI_LINECUT:
        case SCI_LINEDELETE:
        case SCI_LINETRANSPOSE:
@@ -4158,6 +4784,10 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_UPPERCASE:
        case SCI_LINESCROLLDOWN:
        case SCI_LINESCROLLUP:
+       case SCI_WORDPARTLEFT:
+       case SCI_WORDPARTLEFTEXTEND:
+       case SCI_WORDPARTRIGHT:
+       case SCI_WORDPARTRIGHTEXTEND:
                return KeyCommand(iMessage);
 
        case SCI_BRACEHIGHLIGHT:
@@ -4256,6 +4886,35 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_GETOVERTYPE:
                return inOverstrike ? TRUE : FALSE;
 
+       case SCI_SETFOCUS:
+               SetFocusState(wParam);
+               break;
+
+       case SCI_GETFOCUS:
+               return hasFocus;
+
+       case SCI_SETSTATUS:
+               errorStatus = wParam;
+               break;
+
+       case SCI_GETSTATUS:
+               return errorStatus;
+
+       case SCI_SETMOUSEDOWNCAPTURES:
+               mouseDownCaptures = wParam;
+               break;
+
+       case SCI_GETMOUSEDOWNCAPTURES:
+               return mouseDownCaptures;
+
+       case SCI_SETCURSOR:
+               cursorMode = wParam;
+               DisplayCursor(Window::cursorText);
+               break;
+
+       case SCI_GETCURSOR:
+               return cursorMode;
+
 #ifdef MACRO_SUPPORT
        case SCI_STARTRECORD:
                recordingMacro = 1;
@@ -4264,7 +4923,11 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
        case SCI_STOPRECORD:
                recordingMacro = 0;
                return 0;
-#endif
+#endif 
+
+       case SCI_MOVECARETINSIDEVIEW:
+               MoveCaretInsideView();
+               break;
 
        default:
                return DefWndProc(iMessage, wParam, lParam);
index 83967cfd6a3ae4f6f904dbb01fc344123a461c59..d42f5ad14a133b0d53b1f31f12a7cc05b5cfe9a2 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// Editor.h - defines the main editor class
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Editor.h
+ ** Defines the main editor class.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef EDITOR_H
 #define EDITOR_H
 
+/**
+ */
 class Caret {
 public:
        bool active;
@@ -15,8 +19,9 @@ public:
        Caret();
 };
 
+/**
+ */
 class Timer {
-
 public:
        bool ticking;
        int ticksToWait;
@@ -26,15 +31,18 @@ public:
        Timer();
 };
 
+/**
+ */
 class LineLayout {
 public:
-       // Drawing is only performed for maxLineLength characters on each line.
+       /// Drawing is only performed for @a maxLineLength characters on each line.
        enum {maxLineLength = 4000};
        int numCharsInLine;
        int xHighlightGuide;
        bool highlightColumn;
        int selStart;
        int selEnd;
+       bool containsCaret;
        int edgeColumn;
        char chars[maxLineLength+1];
        char styles[maxLineLength+1];
@@ -42,35 +50,40 @@ public:
        int positions[maxLineLength+1];
 };
 
+/**
+ */
 class Editor : public DocWatcher {
        // Private so Editor objects can not be copied
        Editor(const Editor &) : DocWatcher() {}
        Editor &operator=(const Editor &) { return *this; }
+
 protected:     // ScintillaBase subclass needs access to much of Editor
 
-       // On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area
-       // whereas on Windows there is just one window with both scroll bars turned on.
-       // Therefore, on GTK+ the following are separate windows but only one window on Windows.
-       Window wMain;   // The Scintilla parent window
-       Window wDraw;   // The text drawing area
+       /** On GTK+, Scintilla is a container widget holding two scroll bars
+        * whereas on Windows there is just one window with both scroll bars turned on. */
+       Window wMain;   ///< The Scintilla parent window
 
-       // Style resources may be expensive to allocate so are cached between uses.
-       // When a style attribute is changed, this cache is flushed.
+       /** Style resources may be expensive to allocate so are cached between uses.
+        * When a style attribute is changed, this cache is flushed. */
        bool stylesValid;       
        ViewStyle vs;
        Palette palette;
        int printMagnification;
        int printColourMode;
-       
+       int cursorMode;
+
+       bool hasFocus;
        bool hideSelection;
        bool inOverstrike;
-
-       // In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to 
-       // the screen. This avoids flashing but is about 30% slower.
+       int errorStatus;
+       bool mouseDownCaptures;
+       
+       /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
+        * the screen. This avoids flashing but is about 30% slower. */
        bool bufferedDraw;
 
-       int xOffset;                            // Horizontal scrolled amount in pixels
-       int xCaretMargin;       // Ensure this many pixels visible on both sides of caret
+       int xOffset;            ///< Horizontal scrolled amount in pixels
+       int xCaretMargin;       ///< Ensure this many pixels visible on both sides of caret
        bool horizontalScrollBarVisible;
        
        Surface pixmapLine;
@@ -80,15 +93,20 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        Surface pixmapIndentGuideHighlight;
        // Intellimouse support - currently only implemented for Windows
        unsigned int ucWheelScrollLines;
-       int cWheelDelta; //wheel delta from roll
+       int cWheelDelta; ///< Wheel delta from roll
 
        KeyMap kmap;
 
        Caret caret;
        Timer timer;
+       Timer autoScrollTimer;
+       enum { autoScrollDelay = 200 };
 
        Point lastClick;
        unsigned int lastClickTime;
+       int dwellDelay;
+       int ticksToDwell;
+       bool dwelling;
        enum { selChar, selWord, selLine } selectionType;
        Point ptMouseLast;
        bool firstExpose;
@@ -101,6 +119,9 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        int originalAnchorPos;
        int currentPos;
        int anchor;
+       int targetStart;
+       int targetEnd;
+       int searchFlags;
        int topLine;
        int posTopLine;
        
@@ -128,6 +149,9 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        int caretPolicy;
        int caretSlop;
 
+       int visiblePolicy;
+       int visibleSlop;
+       
        int searchAnchor;
 
        int displayPopupMenu;
@@ -152,15 +176,16 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        void RefreshStyleData();
        void DropGraphics();
 
-       PRectangle GetClientRectangle();
+       virtual PRectangle GetClientRectangle();
        PRectangle GetTextRectangle();
        
        int LinesOnScreen();
        int LinesToScroll();
        int MaxScrollPos();
-       Point LocationFromPosition(unsigned int pos);
-       int XFromPosition(unsigned int pos);
+       Point LocationFromPosition(int pos);
+       int XFromPosition(int pos);
        int PositionFromLocation(Point pt);
+       int PositionFromLocationClose(Point pt);
        int PositionFromLineX(int line, int x);
        int LineFromLocation(Point pt);
        void SetTopLine(int topLineNew);
@@ -187,11 +212,12 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        virtual void ScrollText(int linesToMove);
        void HorizontalScrollTo(int xPos);
        void MoveCaretInsideView();
-       void EnsureCaretVisible(bool useMargin=true);
+       void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true);
        void ShowCaretAtCurrentPosition();
        void DropCaret();
        void InvalidateCaret();
 
+       int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
        void PaintSelMargin(Surface *surface, PRectangle &rc);
         void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout &ll);
        void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, 
@@ -214,6 +240,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        void Cut();
        void PasteRectangular(int pos, const char *ptr, int len);
        virtual void Copy() = 0;
+       virtual bool CanPaste();
        virtual void Paste() = 0;
        void Clear();
        void SelectAll();
@@ -227,14 +254,16 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        virtual void NotifyFocus(bool focus);
        virtual void NotifyParent(SCNotification scn) = 0;
        virtual void NotifyStyleToNeeded(int endStyleNeeded);
-       void NotifyChar(char ch);
+       void NotifyChar(int ch);
        void NotifyMove(int position);
        void NotifySavePoint(bool isSavePoint);
        void NotifyModifyAttempt();
        virtual void NotifyDoubleClick(Point pt, bool shift);
        void NotifyUpdateUI();
+       void NotifyPainted();
        bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
        void NotifyNeedShown(int pos, int len);
+       void NotifyDwelling(Point pt, bool state);
        
        void NotifyModifyAttempt(Document *document, void *userData);
        void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
@@ -253,7 +282,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        virtual void CancelModes();
        virtual int KeyCommand(unsigned int iMessage);
        virtual int KeyDefault(int /* key */, int /*modifiers*/);
-       int KeyDown(int key, bool shift, bool ctrl, bool alt);
+       int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
 
        int GetWhitespaceVisible();
        void SetWhitespaceVisible(int view);
@@ -263,6 +292,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        long FindText(unsigned int iMessage, unsigned long wParam, long lParam);
        void SearchAnchor();
        long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
+       long SearchInTarget(const char *text, int length);
        void GoToLine(int lineNo);
 
        char *CopyRange(int start, int end);
@@ -270,13 +300,16 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        char *CopySelectionRange();
        void CopySelectionIntoDrag();
        void SetDragPosition(int newPos);
+       void DisplayCursor(Window::Cursor c);
        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.
-       // Before means either before any line of selection or before selection on its line, with a similar meaning to after
+       /** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after.
+        * Before means either before any line of selection or before selection on its line, with a similar meaning to after. */
        int PositionInSelection(int pos);
        bool PointInSelection(Point pt);
        bool PointInSelMargin(Point pt);
+       void LineSelection(int lineCurrent_, int lineAnchor_);
+       void DwellEnd(bool mouseMoved);
        virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
        void ButtonMove(Point pt);
        void ButtonUp(Point pt, unsigned int curTime, bool ctrl);
@@ -285,6 +318,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        virtual void SetTicking(bool on) = 0;
        virtual void SetMouseCapture(bool on) = 0;
        virtual bool HaveMouseCapture() = 0;
+       void SetFocusState(bool focusState);
 
        void CheckForChangeOutsidePaint(Range r);
        int BraceMatch(int position, int maxReStyle);
@@ -294,13 +328,14 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        
        void Expand(int &line, bool doExpand);
        void ToggleContraction(int line);
-       void EnsureLineVisible(int line);
+       void EnsureLineVisible(int lineDoc, bool enforcePolicy);
+       int ReplaceTarget(bool replacePatterns, const char *text, int length=-1);
 
-       virtual long DefWndProc(unsigned int iMessage, unsigned long wParam, long lParam) = 0;
+       virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
        
 public:
        // Public so scintilla_send_message can use it
-       virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
+       virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
        // Public so scintilla_set_id can use it
        int ctrlID;     
 };
index 05bdf66b53d69a4db04c361ffef854ba5bb08e8b..580e9f86da9e34cbd0615d607bd394a87d1752cd 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Indicator.cxx - defines the style of indicators which are text decorations such as underlining
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Indicator.cxx
+ ** Defines the style of indicators which are text decorations such as underlining.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Platform.h"
index 2472cedc14cd3f64c8625d2a030d7dd0940de0e9..a19b46b5e249da99da843bf5730f1bbccc124b43 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// Indicator.h - defines the style of indicators which are text decorations such as underlining
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Indicator.h
+ ** Defines the style of indicators which are text decorations such as underlining.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef INDICATOR_H
 #define INDICATOR_H
 
+/**
+ */
 class Indicator {
 public:
        int style;
index d2a6660f3c7e3240971cd2ff2b42103d67a75d31..e1fe8e03223e943fb1b8807c17cd2b05e869186e 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// KeyMap.cxx  - defines a mapping between keystrokes and commands
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file KeyMap.cxx 
+ ** Defines a mapping between keystrokes and commands.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Platform.h"
@@ -71,10 +73,14 @@ KeyToCommand KeyMap::MapDefault[] = {
     {SCK_LEFT,         SCI_SHIFT,      SCI_CHARLEFTEXTEND},
     {SCK_LEFT,         SCI_CTRL,       SCI_WORDLEFT},
     {SCK_LEFT,         SCI_CSHIFT,     SCI_WORDLEFTEXTEND},
+    {SCK_LEFT,         SCI_ALT,                SCI_WORDPARTLEFT},
+    {SCK_LEFT,         SCI_ASHIFT,     SCI_WORDPARTLEFTEXTEND},
     {SCK_RIGHT,                SCI_NORM,       SCI_CHARRIGHT},
     {SCK_RIGHT,                SCI_SHIFT,      SCI_CHARRIGHTEXTEND},
     {SCK_RIGHT,                SCI_CTRL,       SCI_WORDRIGHT},
     {SCK_RIGHT,                SCI_CSHIFT,     SCI_WORDRIGHTEXTEND},
+    {SCK_RIGHT,                SCI_ALT,                SCI_WORDPARTRIGHT},
+    {SCK_RIGHT,                SCI_ASHIFT,     SCI_WORDPARTRIGHTEXTEND},
     {SCK_HOME,                 SCI_NORM,       SCI_VCHOME},
     {SCK_HOME,                 SCI_SHIFT,      SCI_VCHOMEEXTEND},
     {SCK_HOME,                 SCI_CTRL,       SCI_DOCUMENTSTART},
@@ -90,6 +96,7 @@ KeyToCommand KeyMap::MapDefault[] = {
     {SCK_DELETE,       SCI_NORM,       SCI_CLEAR},
     {SCK_DELETE,       SCI_SHIFT,      SCI_CUT},
     {SCK_DELETE,       SCI_CTRL,       SCI_DELWORDRIGHT},
+    {SCK_DELETE,       SCI_CSHIFT,     SCI_DELLINERIGHT},
     {SCK_INSERT,               SCI_NORM,       SCI_EDITTOGGLEOVERTYPE},
     {SCK_INSERT,               SCI_SHIFT,      SCI_PASTE},
     {SCK_INSERT,               SCI_CTRL,       SCI_COPY},
@@ -98,6 +105,7 @@ KeyToCommand KeyMap::MapDefault[] = {
     {SCK_BACK,         SCI_SHIFT,      SCI_DELETEBACK},
     {SCK_BACK,         SCI_CTRL,       SCI_DELWORDLEFT},
     {SCK_BACK,                 SCI_ALT,        SCI_UNDO},
+    {SCK_BACK,         SCI_CSHIFT,     SCI_DELLINELEFT},    
     {'Z',                      SCI_CTRL,       SCI_UNDO},
     {'Y',                      SCI_CTRL,       SCI_REDO},
     {'X',                      SCI_CTRL,       SCI_CUT},
index c84310417415db89bc426cfc09d6820410e96560..8232b7160bad68472d80245e0977bb48f7461f32 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// KeyMap.h - defines a mapping between keystrokes and commands
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file KeyMap.h
+ ** Defines a mapping between keystrokes and commands.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef KEYTOCOMMAND_H
@@ -13,6 +15,8 @@
 #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
 #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
 
+/**
+ */
 class KeyToCommand {
 public:
        int key;
@@ -20,11 +24,14 @@ public:
        unsigned int msg;
 };
 
+/**
+ */
 class KeyMap {
        KeyToCommand *kmap;
        int len;
        int alloc;
        static KeyToCommand MapDefault[];
+
 public:
        KeyMap();
        ~KeyMap();
index 113ba222dfbb16ff37b2e6d4dde3d09554404c5f..0728580fdfeb69c50b434c377f58726b7ed659ca 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// KeyWords.cxx - colourise for particular languages
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file KeyWords.cxx
+ ** Colourise for particular languages.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "SciLexer.h"
 
 LexerModule *LexerModule::base = 0;
+int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
 
-LexerModule::LexerModule(int language_, LexerFunction fn_) :
-       language(language_), fn(fn_) {
+LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
+       const char *languageName_, LexerFunction fnFolder_) :
+       language(language_), 
+       languageName(languageName_), 
+       fnLexer(fnLexer_), 
+       fnFolder(fnFolder_) {
        next = base;
        base = this;
+       if (language == SCLEX_AUTOMATIC) {
+               language = nextLanguage;
+               nextLanguage++;
+       }
 }
 
-void LexerModule::Colourise(unsigned int startPos, int lengthDoc, int initStyle,
-               int language, WordList *keywordlists[], Accessor &styler) {
+LexerModule *LexerModule::Find(int language) {
        LexerModule *lm = base;
        while (lm) {
                if (lm->language == language) {
-                       lm->fn(startPos, lengthDoc, initStyle, keywordlists, styler);
-                       return;
+                       return lm;
                }
                lm = lm->next;
        }
-       // Unknown language
+       return 0;
+}
+
+LexerModule *LexerModule::Find(const char *languageName) {
+       if (languageName) {
+               LexerModule *lm = base;
+               while (lm) {
+                       if (lm->languageName && 0 == strcmp(lm->languageName, languageName)) {
+                               return lm;
+                       }
+                       lm = lm->next;
+               }
+       }
+       return 0;
+}
+
+void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle,
+         WordList *keywordlists[], Accessor &styler) {
+       if (fnLexer)
+               fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler);
+}
+
+void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
+         WordList *keywordlists[], Accessor &styler) {
+       if (fnFolder) {
+               int lineCurrent = styler.GetLine(startPos);
+               // Move back one line in case deletion wrecked current line fold state
+               if (lineCurrent > 0) {
+                       lineCurrent--;
+                       int newStartPos = styler.LineStart(lineCurrent);
+                       lengthDoc += startPos - newStartPos;
+                       startPos = newStartPos;
+                       initStyle = 0;
+                       if (startPos > 0) {
+                               initStyle = styler.StyleAt(startPos - 1);
+                       }
+               }
+               fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler);
+       }
+}
+
+static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[],
+                            Accessor &styler) {
        // Null language means all style bytes are 0 so just mark the end - no need to fill in.
-       if (lengthDoc > 0) {
-               styler.StartAt(startPos + lengthDoc - 1);
-               styler.StartSegment(startPos + lengthDoc - 1);
-               styler.ColourTo(startPos + lengthDoc - 1, 0);
+       if (length > 0) {
+               styler.StartAt(startPos + length - 1);
+               styler.StartSegment(startPos + length - 1);
+               styler.ColourTo(startPos + length - 1, 0);
        }
 }
+
+LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
+
+#ifdef __vms
+
+// The following code forces a reference to all of the Scintilla lexers.
+// If we don't do something like this, then the linker tends to "optimize"
+// them away. (eric@sourcegear.com)
+
+// Taken from wxWindow's stc.cpp. Walter.
+
+int wxForceScintillaLexers(void) {
+  extern LexerModule lmAda;
+  extern LexerModule lmAVE;
+  extern LexerModule lmConf;
+  extern LexerModule lmDiff;
+  extern LexerModule lmLatex;
+  extern LexerModule lmPascal;
+  extern LexerModule lmCPP;
+  extern LexerModule lmHTML;
+  extern LexerModule lmXML;
+  extern LexerModule lmProps;
+  extern LexerModule lmErrorList;
+  extern LexerModule lmMake;
+  extern LexerModule lmBatch;
+  extern LexerModule lmPerl;
+  extern LexerModule lmPython;
+  extern LexerModule lmSQL;
+  extern LexerModule lmVB;
+  extern LexerModule lmRuby;
+
+  if (
+      &lmAda
+      && &lmAVE
+      && &lmConf
+      && &lmDiff
+      && &lmLatex
+      && &lmPascal
+      && &lmCPP
+      && &lmHTML
+      && &lmXML
+      && &lmProps
+      && &lmErrorList
+      && &lmMake
+      && &lmBatch
+      && &lmPerl
+      && &lmPython
+      && &lmSQL
+      && &lmVB
+      && &lmRuby      
+      )
+    {
+      return 1;
+    }
+  else
+    {
+      return 0;
+    }
+}
+#endif
diff --git a/src/stc/scintilla/src/LexAVE.cxx b/src/stc/scintilla/src/LexAVE.cxx
new file mode 100644 (file)
index 0000000..a742274
--- /dev/null
@@ -0,0 +1,188 @@
+// SciTE - Scintilla based Text Editor
+/** @file LexAVE.cxx
+ ** Lexer for Avenue.
+ **/
+// Copyright 1998-2001 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 "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+static void ColouriseAveDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+       Accessor &styler) {
+
+       WordList &keywords = *keywordlists[0];
+
+       styler.StartAt(startPos);
+
+       bool fold = styler.GetPropertyInt("fold");
+       int lineCurrent = styler.GetLine(startPos);
+       int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+       int levelCurrent = levelPrev;
+
+       int state = initStyle;
+       if (state == SCE_AVE_STRINGEOL) // Does not leak onto next line
+               state = SCE_AVE_DEFAULT;
+       char chNext = styler[startPos];
+       unsigned int lengthDoc = startPos + length;
+       int visibleChars = 0;
+       styler.StartSegment(startPos);
+
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
+                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+                       // Avoid triggering two times on Dos/Win
+                       // End of line
+                       if (state == SCE_AVE_STRINGEOL) {
+                               styler.ColourTo(i, state);
+                               state = SCE_AVE_DEFAULT;
+                       }
+                       if (fold) {
+                               int lev = levelPrev;
+                               if (visibleChars == 0)
+                                       lev |= SC_FOLDLEVELWHITEFLAG;
+                               if ((levelCurrent > levelPrev) && (visibleChars > 0))
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               styler.SetLevel(lineCurrent, lev);
+                               lineCurrent++;
+                               levelPrev = levelCurrent;
+                       }
+                       visibleChars = 0;
+               }
+               if (!isspace(ch))
+                       visibleChars++;
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_AVE_DEFAULT) {
+                       if (iswordstart(ch) || (ch == '.') )  {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_IDENTIFIER;
+                       } else if (ch == '\'') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_COMMENT;
+                       } else if (ch == '\"') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_STRING;
+                       } else if (ch == '#') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_ENUM;
+                       } else if (isoperator(ch) ) {
+                               styler.ColourTo(i-1, state);
+                               styler.ColourTo(i, SCE_AVE_OPERATOR);
+                       }
+               }
+               else if (state == SCE_AVE_COMMENT) {
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_DEFAULT;
+                       }
+               }
+               else if (state == SCE_AVE_ENUM) {
+                       if (isoperator(ch)  || ch == ' ' || ch == '\'' || ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_AVE_DEFAULT;
+                       }
+               }
+               else if (state == SCE_AVE_STRING) {
+                       if (ch == '\"') {
+                               if (chNext == '\"') {
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               } else
+                               {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_AVE_DEFAULT;
+                               }
+                       } else if (chNext == '\r' || chNext == '\n') {
+                               styler.ColourTo(i-1, SCE_AVE_STRINGEOL);
+                               state = SCE_AVE_STRINGEOL;
+                       }
+               }
+               if ((state == SCE_AVE_IDENTIFIER)) {
+                       if (!iswordchar(ch) || ch == '.' ) {
+                               char s[100];
+                               unsigned int start = styler.GetStartSegment();
+                               unsigned int end = i - 1;
+                               for (unsigned int ii = 0; ii < end - start + 1 && ii < 30; ii++)        {
+                                       s[ii] = static_cast<char>(tolower(styler[start + ii]));
+                                       s[ii + 1] = '\0';
+                               }
+
+                               char chAttr = SCE_AVE_IDENTIFIER;
+
+                               if (isdigit(s[0]))
+                                       chAttr = SCE_AVE_NUMBER;
+                               else {
+                                       if ((strcmp(s, "for") == 0) || (strcmp(s, "if") == 0) || (strcmp(s, "while") == 0))
+                                       {
+                                               levelCurrent +=1;
+                                               chAttr = SCE_AVE_STATEMENT;
+                                       }
+
+                                       if (strcmp(s, "end") == 0)
+                                       {
+                                               levelCurrent -=1;
+                                               chAttr = SCE_AVE_STATEMENT;
+                                       }
+
+                                       if ( (strcmp(s, "then") == 0) ||  (strcmp(s, "else") == 0)       || (strcmp(s, "break") == 0) ||
+                                               (strcmp(s, "each") == 0) ||
+                                               (strcmp(s, "exit") == 0) ||  (strcmp(s, "continue") == 0) || (strcmp(s, "return") == 0) ||
+                                               (strcmp(s, "by") == 0)   ||  (strcmp(s, "in") == 0)          || (strcmp(s, "elseif") == 0))
+                                       {
+                                               chAttr = SCE_AVE_STATEMENT;
+                                       }
+
+                                       if ((strcmp(s, "av") == 0) || (strcmp(s, "self") == 0))
+                                       {
+                                               chAttr = SCE_AVE_KEYWORD;
+                                       }
+
+                                       if (keywords.InList(s))
+                                       {
+                                               chAttr = SCE_AVE_WORD;
+                                       }
+                               }
+                               styler.ColourTo(end, chAttr);
+                               state = SCE_AVE_DEFAULT;
+
+                               if (ch == '\'') {
+                                       state = SCE_AVE_COMMENT;
+                               } else if (ch == '\"') {
+                                       state = SCE_AVE_STRING;
+                               } else if (isoperator(ch)) {
+                                       styler.ColourTo(i, SCE_AVE_OPERATOR);
+                               }
+                       }
+               }
+
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+
+       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+       if (fold) {
+               int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+               styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+
+       }
+}
+
+LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave");
diff --git a/src/stc/scintilla/src/LexAda.cxx b/src/stc/scintilla/src/LexAda.cxx
new file mode 100644 (file)
index 0000000..91bf00e
--- /dev/null
@@ -0,0 +1,198 @@
+// SciTE - Scintilla based Text Editor
+// LexAda.cxx - lexer for Ada95
+// by Tahir Karaca <tahir@bigfoot.de>
+// 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"
+
+inline void classifyWordAda(unsigned int start, unsigned int end,
+       WordList &keywords, Accessor &styler) {
+
+       static const unsigned KEWORD_LEN_MAX = 30;
+
+       char wordLower[KEWORD_LEN_MAX + 1];
+       unsigned i;
+       for(i = 0; ( i < KEWORD_LEN_MAX ) && ( i < end - start + 1 ); i++) {
+               wordLower[i] = static_cast<char>(tolower(styler[start + i]));           
+       }
+       wordLower[i] = '\0';
+               
+//     int levelChange = 0;
+       char chAttr = SCE_ADA_IDENTIFIER;
+       if (keywords.InList(wordLower)) {
+               chAttr = SCE_ADA_WORD;
+
+// Folding doesn't work this way since the semantics of some keywords depends
+// on the current context.
+// E.g. - "cond1 and THEN cond2" <-> "if ... THEN ..."         
+//      - "procedure X IS ... end X;" <-> "procedure X IS new Y;"
+//             if (strcmp(wordLower, "is") == 0 || strcmp(wordLower, "then") == 0)
+//                     levelChange=1;
+//             else if (strcmp(wordLower, "end") == 0)
+//                     levelChange=-1;
+       }
+       styler.ColourTo(end, chAttr);
+       
+//     return levelChange;
+}
+
+
+inline bool isAdaOperator(char ch) {
+       
+       if (ch == '&' || ch == '\'' || ch == '(' || ch == ')' ||
+               ch == '*' || ch == '+' || ch == ',' || ch == '-' ||
+               ch == '.' || ch == '/' || ch == ':' || ch == ';' ||
+               ch == '<' || ch == '=' || ch == '>')
+               return true;
+       return false;
+}
+
+
+inline void styleTokenBegin(char beginChar, unsigned int pos, int &state,
+       Accessor &styler) {
+               
+       if (isalpha(beginChar)) {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_IDENTIFIER;
+       } else if (isdigit(beginChar)) {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_NUMBER;
+       } else if (beginChar == '-' && styler.SafeGetCharAt(pos + 1) == '-') {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_COMMENT;
+       } else if (beginChar == '\"') {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_STRING;
+       } else if (beginChar == '\'' && styler.SafeGetCharAt(pos + 2) == '\'') {
+               styler.ColourTo(pos-1, state);
+               state = SCE_ADA_CHARACTER;
+       } else if (isAdaOperator(beginChar)) {
+               styler.ColourTo(pos-1, state);
+               styler.ColourTo(pos, SCE_ADA_OPERATOR);
+       }
+}
+
+
+static void ColouriseAdaDoc(unsigned int startPos, int length, int initStyle,
+       WordList *keywordlists[], Accessor &styler) {
+       
+       WordList &keywords = *keywordlists[0];
+       
+       styler.StartAt(startPos);
+       
+//     bool fold = styler.GetPropertyInt("fold");
+//     int lineCurrent = styler.GetLine(startPos);
+//     int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+//     int levelCurrent = levelPrev;
+
+       int state = initStyle;
+       if (state == SCE_ADA_STRINGEOL) // Does not leak onto next line
+               state = SCE_ADA_DEFAULT;
+       char chNext = styler[startPos];
+       const unsigned int lengthDoc = startPos + length;
+       //int visibleChars = 0;
+       styler.StartSegment(startPos);
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
+                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+                       // Avoid triggering two times on Dos/Win
+                       if (state == SCE_ADA_STRINGEOL) {
+                               styler.ColourTo(i, state);
+                               state = SCE_ADA_DEFAULT;
+                       }
+//                     if (fold) {
+//                             int lev = levelPrev;
+//                             if (visibleChars == 0)
+//                                     lev |= SC_FOLDLEVELWHITEFLAG;
+//                             if ((levelCurrent > levelPrev) && (visibleChars > 0))
+//                                     lev |= SC_FOLDLEVELHEADERFLAG;
+//                             styler.SetLevel(lineCurrent, lev);
+//                             lineCurrent++;
+//                             levelPrev = levelCurrent;
+//                     }
+                       //visibleChars = 0;
+               }
+               //if (!isspacechar(ch))
+               //      visibleChars++;
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_ADA_DEFAULT) {
+                       styleTokenBegin(ch, i, state, styler);
+               } else if (state == SCE_ADA_IDENTIFIER) {
+                       if (!iswordchar(ch)) {
+                               classifyWordAda(styler.GetStartSegment(),
+                                                               i - 1,
+                                                               keywords,
+                                                               styler);
+                               state = SCE_ADA_DEFAULT;
+                               styleTokenBegin(ch, i, state, styler);
+                       }
+               } else if (state == SCE_ADA_COMMENT) {
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_ADA_DEFAULT;
+                       }
+               } else if (state == SCE_ADA_STRING) {
+                       if (ch == '"' ) {
+                               if( chNext == '"' ) {
+                                       i++;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               } else {                                        
+                                       styler.ColourTo(i, state);
+                                       state = SCE_ADA_DEFAULT;
+                               }
+                       } else if (chNext == '\r' || chNext == '\n') {
+                               styler.ColourTo(i-1, SCE_ADA_STRINGEOL);
+                               state = SCE_ADA_STRINGEOL;
+                       }
+               } else if (state == SCE_ADA_CHARACTER) {
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i-1, SCE_ADA_STRINGEOL);
+                               state = SCE_ADA_STRINGEOL;
+                       } else if (ch == '\'' && styler.SafeGetCharAt(i - 2) == '\'') {
+                               styler.ColourTo(i, state);
+                               state = SCE_ADA_DEFAULT;
+                       }
+               } else if (state == SCE_ADA_NUMBER) {
+                       if ( !( isdigit(ch) || ch == '.' || ch == '_' || ch == '#'
+                                   || ch == 'A' || ch == 'B' || ch == 'C' || ch == 'D'
+                                       || ch == 'E' || ch == 'F'
+                                       || ch == 'a' || ch == 'b' || ch == 'c' || ch == 'd'
+                                       || ch == 'e' || ch == 'f' ) ) {
+                               styler.ColourTo(i-1, SCE_ADA_NUMBER);
+                               state = SCE_ADA_DEFAULT;
+                               styleTokenBegin(ch, i, state, styler);
+                       }
+               }
+
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+
+//     // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+//     if (fold) {
+//             int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+//             styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+//     }
+}
+
+LexerModule lmAda(SCLEX_ADA, ColouriseAdaDoc, "ada");
index b6358ab3328a955401678b72d455d674dedb40ee..19aa329bafdc2cf76f762de6be183260f54e8d54 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexCPP.cxx - lexer for C++, C, Java, and Javascript
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexCPP.cxx
+ ** Lexer for C++, C, Java, and Javascript.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-static bool classifyWordCpp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
-       char s[100];
-       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+static bool IsOKBeforeRE(int ch) {
+       return (ch == '(') || (ch == '=') || (ch == ',');
+}
+
+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] = styler[start + i];
-               s[i + 1] = '\0';
+               i++;
+       }
+       s[i] = '\0';
+}
+
+inline bool IsASpace(int ch) {
+    return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
+
+inline bool IsAWordChar(int  ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+}
+
+inline bool IsAWordStart(int ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '_');
+}
+
+inline bool IsADigit(int ch) {
+       return (ch >= '0') && (ch <= '9');
+}
+
+// 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 
+// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
+class ColouriseContext {
+       Accessor &styler;
+       int lengthDoc;
+       int currentPos;
+       ColouriseContext& operator=(const ColouriseContext&) {
+               return *this;
        }
-       bool wordIsUUID = false;
-       char chAttr = SCE_C_IDENTIFIER;
-       if (isdigit(s[0]) || (s[0] == '.'))
-               chAttr = SCE_C_NUMBER;
-       else {
-               if (keywords.InList(s)) {
-                       chAttr = SCE_C_WORD;
-                       wordIsUUID = strcmp(s, "uuid") == 0; 
+public:
+       bool atEOL;
+       int state;
+       int chPrev;
+       int ch;
+       int chNext;
+
+       ColouriseContext(unsigned int startPos, int length,
+                        int initStyle, Accessor &styler_) : 
+               styler(styler_),
+               lengthDoc(startPos + length),
+               currentPos(startPos), 
+               atEOL(false),
+               state(initStyle), 
+               chPrev(0),
+               ch(0), 
+               chNext(0) {
+               styler.StartAt(startPos);
+               styler.StartSegment(startPos);
+               int pos = currentPos;
+               ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
+               if (styler.IsLeadByte(static_cast<char>(ch))) {
+                       pos++;
+                       ch = ch << 8;
+                       ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
+               }
+               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
+               if (styler.IsLeadByte(static_cast<char>(chNext))) {
+                       chNext = chNext << 8;
+                       chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
                }
+               atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
        }
-       styler.ColourTo(end, chAttr);
-       return wordIsUUID;
-}
+       void Complete() {
+               styler.ColourTo(currentPos - 1, state);
+       }
+       bool More() {
+               return currentPos <= lengthDoc;
+       }
+       void Forward() {
+               // A lot of this is repeated from the constructor - TODO: merge code
+               chPrev = ch;
+               currentPos++;
+               if (ch >= 0x100)
+                       currentPos++;
+               ch = chNext;
+               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
+               if (styler.IsLeadByte(static_cast<char>(chNext))) {
+                       chNext = chNext << 8;
+                       chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
+               }
+               // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+               // Avoid triggering two times on Dos/Win
+               // End of line
+               atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+       }
+       void ChangeState(int state_) {
+               state = state_;
+       }
+       void SetState(int state_) {
+               styler.ColourTo(currentPos - 1, state);
+               state = state_;
+       }
+       void ForwardSetState(int state_) {
+               Forward();
+               styler.ColourTo(currentPos - 1, state);
+               state = state_;
+       }
+       void GetCurrent(char *s, int len) {
+               getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
+       }
+       int LengthCurrent() {
+               return currentPos - styler.GetStartSegment();
+       }
+       bool Match(char ch0) {
+               return ch == ch0;
+       }
+       bool Match(char ch0, char ch1) {
+               return (ch == ch0) && (chNext == ch1);
+       }
+       bool Match(const char *s) {
+               if (ch != *s)
+                       return false;
+               s++;
+               if (chNext != *s)
+                       return false;
+               s++;
+               for (int n=2; *s; n++) {
+                       if (*s != styler.SafeGetCharAt(currentPos+n))
+                               return false;
+                       s++;
+               }
+               return true;
+       }
+};
+
+static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+                            Accessor &styler) {
 
-static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], 
-       Accessor &styler) {
-       
        WordList &keywords = *keywordlists[0];
-       
-       styler.StartAt(startPos);
-       
-       bool fold = styler.GetPropertyInt("fold");
+       WordList &keywords2 = *keywordlists[1];
+
        bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor");
-       int lineCurrent = styler.GetLine(startPos);
-       int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
-       int levelCurrent = levelPrev;
 
-       int state = initStyle;
-       if (state == SCE_C_STRINGEOL)   // Does not leak onto next line
-               state = SCE_C_DEFAULT;
-       char chPrev = ' ';
-       char chNext = styler[startPos];
-       unsigned int lengthDoc = startPos + length;
+       if (initStyle == SCE_C_STRINGEOL)       // Does not leak onto next line
+               initStyle = SCE_C_DEFAULT;
+
+       int chPrevNonWhite = ' ';
        int visibleChars = 0;
-       styler.StartSegment(startPos);
        bool lastWordWasUUID = false;
-       for (unsigned int i = startPos; i < lengthDoc; i++) {
-               char ch = chNext;
-               chNext = styler.SafeGetCharAt(i + 1);
 
-               if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
-                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
-                       // Avoid triggering two times on Dos/Win
-                       // End of line
-                       if (state == SCE_C_STRINGEOL) {
-                               styler.ColourTo(i, state);
-                               state = SCE_C_DEFAULT;
-                       }
-                       if (fold) {
-                               int lev = levelPrev;
-                               if (visibleChars == 0)
-                                       lev |= SC_FOLDLEVELWHITEFLAG;
-                               if ((levelCurrent > levelPrev) && (visibleChars > 0))
-                                       lev |= SC_FOLDLEVELHEADERFLAG;
-                               styler.SetLevel(lineCurrent, lev);
-                               lineCurrent++;
-                               levelPrev = levelCurrent;
-                       }
-                       visibleChars = 0;
-               }
-               if (!isspace(ch))
-                       visibleChars++;
+       ColouriseContext cc(startPos, length, initStyle, styler);
 
-               if (styler.IsLeadByte(ch)) {
-                       chNext = styler.SafeGetCharAt(i + 2);
-                       chPrev = ' ';
-                       i += 1;
-                       continue;
-               }
+       for (; cc.More(); cc.Forward()) {
 
-               if (state == SCE_C_DEFAULT) {
-                       if (ch == '@' && chNext == '\"') {
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_VERBATIM;
-                               i++;
-                               ch = chNext;
-                               chNext = styler.SafeGetCharAt(i + 1);
-                       } else if (iswordstart(ch) || (ch == '@')) {
-                               styler.ColourTo(i-1, state);
-                               if (lastWordWasUUID) {
-                                       state = SCE_C_UUID;
-                                       lastWordWasUUID = false;
-                               } else {
-                                       state = SCE_C_IDENTIFIER;
-                               }
-                       } else if (ch == '/' && chNext == '*') {
-                               styler.ColourTo(i-1, state);
-                               if (styler.SafeGetCharAt(i + 2) == '*')
-                                       state = SCE_C_COMMENTDOC;
-                               else
-                                       state = SCE_C_COMMENT;
-                       } else if (ch == '/' && chNext == '/') {
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_COMMENTLINE;
-                       } else if (ch == '\"') {
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_STRING;
-                       } else if (ch == '\'') {
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_CHARACTER;
-                       } else if (ch == '#' && visibleChars == 1) {
-                               // Preprocessor commands are alone on their line
-                               styler.ColourTo(i-1, state);
-                               state = SCE_C_PREPROCESSOR;
-                               // Skip whitespace between # and preprocessor word
-                               do {
-                                       i++;
-                                       ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
-                               } while (isspace(ch) && (i < lengthDoc));
-                       } else if (isoperator(ch)) {
-                               styler.ColourTo(i-1, state);
-                               styler.ColourTo(i, SCE_C_OPERATOR);
-                               if ((ch == '{') || (ch == '}')) {
-                                       levelCurrent += (ch == '{') ? 1 : -1;
-                               }
+               if (cc.state == SCE_C_STRINGEOL) {
+                       if (cc.atEOL) {
+                               cc.SetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_OPERATOR) {
+                       cc.SetState(SCE_C_DEFAULT);
+               } else if (cc.state == SCE_C_NUMBER) {
+                       if (!IsAWordChar(cc.ch)) {
+                               cc.SetState(SCE_C_DEFAULT);
                        }
-               } else if (state == SCE_C_IDENTIFIER) {
-                       if (!iswordchar(ch)) {
-                               lastWordWasUUID = classifyWordCpp(styler.GetStartSegment(), i - 1, keywords, styler);
-                               state = SCE_C_DEFAULT;
-                               if (ch == '/' && chNext == '*') {
-                                       if (styler.SafeGetCharAt(i + 2) == '*')
-                                               state = SCE_C_COMMENTDOC;
-                                       else
-                                               state = SCE_C_COMMENT;
-                               } else if (ch == '/' && chNext == '/') {
-                                       state = SCE_C_COMMENTLINE;
-                               } else if (ch == '\"') {
-                                       state = SCE_C_STRING;
-                               } else if (ch == '\'') {
-                                       state = SCE_C_CHARACTER;
-                               } else if (isoperator(ch)) {
-                                       styler.ColourTo(i, SCE_C_OPERATOR);
-                                       if ((ch == '{') || (ch == '}')) {
-                                               levelCurrent += (ch == '{') ? 1 : -1;
-                                       }
+               } else if (cc.state == SCE_C_IDENTIFIER) {
+                       if (!IsAWordChar(cc.ch) || (cc.ch == '.')) {
+                               char s[100];
+                               cc.GetCurrent(s, sizeof(s));
+                               if (keywords.InList(s)) {
+                                       lastWordWasUUID = strcmp(s, "uuid") == 0;
+                                       cc.ChangeState(SCE_C_WORD);
+                               } else if (keywords2.InList(s)) {
+                                       cc.ChangeState(SCE_C_WORD2);
                                }
+                               cc.SetState(SCE_C_DEFAULT);
                        }
-               } else {
-                       if (state == SCE_C_PREPROCESSOR) {
-                               if (stylingWithinPreprocessor) {
-                                       if (isspace(ch)) {
-                                               styler.ColourTo(i-1, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
-                               } else {
-                                       if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
-                                               styler.ColourTo(i-1, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
+               } if (cc.state == SCE_C_PREPROCESSOR) {
+                       if (stylingWithinPreprocessor) {
+                               if (IsASpace(cc.ch)) {
+                                       cc.SetState(SCE_C_DEFAULT);
                                }
-                       } else if (state == SCE_C_COMMENT) {
-                               if (ch == '/' && chPrev == '*') {
-                                       if (((i > styler.GetStartSegment() + 2) || (
-                                               (initStyle == SCE_C_COMMENT) && 
-                                               (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
-                                               styler.ColourTo(i, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
+                       } else {
+                               if (cc.atEOL && (cc.chPrev != '\\')) {
+                                       cc.SetState(SCE_C_DEFAULT);
                                }
-                       } else if (state == SCE_C_COMMENTDOC) {
-                               if (ch == '/' && chPrev == '*') {
-                                       if (((i > styler.GetStartSegment() + 2) || (
-                                               (initStyle == SCE_C_COMMENTDOC) && 
-                                               (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
-                                               styler.ColourTo(i, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
+                       }
+               } else if (cc.state == SCE_C_COMMENT) {
+                       if (cc.Match('*', '/')) {
+                               cc.Forward();
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_COMMENTDOC) {
+                       if (cc.Match('*', '/')) {
+                               cc.Forward();
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_COMMENTLINE || cc.state == SCE_C_COMMENTLINEDOC) {
+                       if (cc.ch == '\r' || cc.ch == '\n') {
+                               cc.SetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_STRING) {
+                       if (cc.ch == '\\') {
+                               if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
+                                       cc.Forward();
                                }
-                       } else if (state == SCE_C_COMMENTLINE) {
-                               if (ch == '\r' || ch == '\n') {
-                                       styler.ColourTo(i-1, state);
-                                       state = SCE_C_DEFAULT;
+                       } else if (cc.ch == '\"') {
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       } else if ((cc.atEOL) && (cc.chPrev != '\\')) {
+                               cc.ChangeState(SCE_C_STRINGEOL);
+                       }
+               } else if (cc.state == SCE_C_CHARACTER) {
+                       if ((cc.ch == '\r' || cc.ch == '\n') && (cc.chPrev != '\\')) {
+                               cc.ChangeState(SCE_C_STRINGEOL);
+                       } else if (cc.ch == '\\') {
+                               if (cc.chNext == '\"' || cc.chNext == '\'' || cc.chNext == '\\') {
+                                       cc.Forward();
                                }
-                       } else if (state == SCE_C_STRING) {
-                               if (ch == '\\') {
-                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
-                                               i++;
-                                               ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       }
-                               } else if (ch == '\"') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_C_DEFAULT;
-                               } else if (chNext == '\r' || chNext == '\n') {
-                                       styler.ColourTo(i-1, SCE_C_STRINGEOL);
-                                       state = SCE_C_STRINGEOL;
+                       } else if (cc.ch == '\'') {
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       }
+               } else if (cc.state == SCE_C_REGEX) {
+                       if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == '/') {
+                               cc.ForwardSetState(SCE_C_DEFAULT);
+                       } else if (cc.ch == '\\') {
+                               // Gobble up the quoted character
+                               if (cc.chNext == '\\' || cc.chNext == '/') {
+                                       cc.Forward();
                                }
-                       } else if (state == SCE_C_CHARACTER) {
-                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
-                                       styler.ColourTo(i-1, SCE_C_STRINGEOL);
-                                       state = SCE_C_STRINGEOL;
-                               } else if (ch == '\\') {
-                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
-                                               i++;
-                                               ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       }
-                               } else if (ch == '\'') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_C_DEFAULT;
+                       }
+               } else if (cc.state == SCE_C_VERBATIM) {
+                       if (cc.ch == '\"') {
+                               if (cc.chNext == '\"') {
+                                       cc.Forward();
+                               } else {
+                                       cc.ForwardSetState(SCE_C_DEFAULT);
                                }
-                       } else if (state == SCE_C_VERBATIM) {
-                               if (ch == '\"') {
-                                       if (chNext == '\"') {
-                                               i++;
-                                               ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       } else {
-                                               styler.ColourTo(i, state);
-                                               state = SCE_C_DEFAULT;
-                                       }
+                       }
+               } else if (cc.state == SCE_C_UUID) {
+                       if (cc.ch == '\r' || cc.ch == '\n' || cc.ch == ')') {
+                               cc.SetState(SCE_C_DEFAULT);
+                       }
+               }
+
+               if (cc.state == SCE_C_DEFAULT) {
+                       if (cc.Match('@', '\"')) {
+                               cc.SetState(SCE_C_VERBATIM);
+                               cc.Forward();
+                       } else if (IsADigit(cc.ch) || (cc.ch == '.' && IsADigit(cc.chNext))) {
+                               if (lastWordWasUUID) {
+                                       cc.SetState(SCE_C_UUID);
+                                       lastWordWasUUID = false;
+                               } else {
+                                       cc.SetState(SCE_C_NUMBER);
                                }
-                       } else if (state == SCE_C_UUID) {
-                               if (ch == '\r' || ch == '\n' || ch == ')') {
-                                       styler.ColourTo(i-1, state);
-                                       if (ch == ')')
-                                               styler.ColourTo(i, SCE_C_OPERATOR);
-                                       state = SCE_C_DEFAULT;
+                       } else if (IsAWordStart(cc.ch) || (cc.ch == '@')) {
+                               if (lastWordWasUUID) {
+                                       cc.SetState(SCE_C_UUID);
+                                       lastWordWasUUID = false;
+                               } else {
+                                       cc.SetState(SCE_C_IDENTIFIER);
                                }
+                       } else if (cc.Match('/', '*')) {
+                               if (cc.Match("/**") || cc.Match("/*!")) // Support of Qt/Doxygen doc. style
+                                       cc.SetState(SCE_C_COMMENTDOC);
+                               else
+                                       cc.SetState(SCE_C_COMMENT);
+                               cc.Forward();   // Eat the * so it isn't used for the end of the comment
+                       } else if (cc.Match('/', '/')) {
+                               if (cc.Match("///") || cc.Match("//!")) // Support of Qt/Doxygen doc. style
+                                       cc.SetState(SCE_C_COMMENTLINEDOC);
+                               else
+                                       cc.SetState(SCE_C_COMMENTLINE);
+                       } else if (cc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
+                               cc.SetState(SCE_C_REGEX);
+                       } else if (cc.ch == '\"') {
+                               cc.SetState(SCE_C_STRING);
+                       } else if (cc.ch == '\'') {
+                               cc.SetState(SCE_C_CHARACTER);
+                       } else if (cc.ch == '#' && visibleChars == 0) {
+                               // Preprocessor commands are alone on their line
+                               cc.SetState(SCE_C_PREPROCESSOR);
+                               // Skip whitespace between # and preprocessor word
+                               do {
+                                       cc.Forward();
+                               } while (IsASpace(cc.ch) && cc.More());
+                       } else if (isoperator(static_cast<char>(cc.ch))) {
+                               cc.SetState(SCE_C_OPERATOR);
                        }
                }
-               chPrev = ch;
+               if (cc.atEOL) {
+                       // Reset states to begining of colourise so no surprises 
+                       // if different sets of lines lexed.
+                       chPrevNonWhite = ' ';
+                       visibleChars = 0;
+                       lastWordWasUUID = false;
+               }
+               if (!IsASpace(cc.ch)) {
+                       chPrevNonWhite = cc.ch;
+                       visibleChars++;
+               }
        }
-       styler.ColourTo(lengthDoc - 1, state);
+       cc.Complete();
+}
 
-       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
-       if (fold) {
-               int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
-               //styler.SetLevel(lineCurrent, levelCurrent | flagsNext);
-               styler.SetLevel(lineCurrent, levelPrev | flagsNext);
-               
+static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
+                            Accessor &styler) {
+       bool foldComment = styler.GetPropertyInt("fold.comment");
+       bool foldCompact = styler.GetPropertyInt("fold.compact", 1);
+       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;
+       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 &&
+                       (style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC)) {
+                       if (style != stylePrev) {
+                               levelCurrent++;
+                       } else if ((style != styleNext) && !atEOL) {
+                               // Comments don't end at end of line and the next character may be unstyled.
+                               levelCurrent--;
+                       }
+               }
+               if (style == SCE_C_OPERATOR) {
+                       if (ch == '{') {
+                               levelCurrent++;
+                       } else if (ch == '}') {
+                               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);
 }
 
-LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc);
+LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc);
+LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc);
diff --git a/src/stc/scintilla/src/LexConf.cxx b/src/stc/scintilla/src/LexConf.cxx
new file mode 100644 (file)
index 0000000..2dbb65c
--- /dev/null
@@ -0,0 +1,177 @@
+// Scintilla source code edit control
+/** @file LexConf.cxx
+ ** Lexer for Apache Configuration Files.
+ **
+ ** First working version contributed by Ahmad Zawawi <zeus_go64@hotmail.com> on October 28, 2000.
+ ** i created this lexer because i needed something pretty when dealing
+ ** when Apache Configuration files...
+ **/
+// Copyright 1998-2001 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 "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
+{
+       int state = SCE_CONF_DEFAULT;
+       char chNext = styler[startPos];
+       int lengthDoc = startPos + length;
+       // create a buffer large enough to take the largest chunk...
+       char *buffer = new char[length];
+       int bufferCount = 0;
+
+       // this assumes that we have 2 keyword list in conf.properties
+       WordList &directives = *keywordLists[0];
+       WordList &params = *keywordLists[1];
+
+       // go through all provided text segment
+       // using the hand-written state machine shown below
+       styler.StartAt(startPos);
+       styler.StartSegment(startPos);
+       for (int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       i++;
+                       continue;
+               }
+               switch(state) {
+                       case SCE_CONF_DEFAULT:
+                               if( ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') {
+                                       // whitespace is simply ignored here...
+                                       styler.ColourTo(i,SCE_CONF_DEFAULT);
+                                       break;
+                               } else if( ch == '#' ) {
+                                       // signals the start of a comment...
+                                       state = SCE_CONF_COMMENT;
+                                       styler.ColourTo(i,SCE_CONF_COMMENT);
+                               } else if( ch == '.' /*|| ch == '/'*/) {
+                                       // signals the start of a file...
+                                       state = SCE_CONF_EXTENSION;
+                                       styler.ColourTo(i,SCE_CONF_EXTENSION);
+                               } else if( ch == '"') {
+                                       state = SCE_CONF_STRING;
+                                       styler.ColourTo(i,SCE_CONF_STRING);
+                               } else if( ispunct(ch) ) {
+                                       // signals an operator...
+                                       // no state jump necessary for this
+                                       // simple case...
+                                       styler.ColourTo(i,SCE_CONF_OPERATOR);
+                               } else if( isalpha(ch) ) {
+                                       // signals the start of an identifier
+                                       bufferCount = 0;
+                                       buffer[bufferCount++] = static_cast<char>(tolower(ch));
+                                       state = SCE_CONF_IDENTIFIER;
+                               } else if( isdigit(ch) ) {
+                                       // signals the start of a number
+                                       bufferCount = 0;
+                                       buffer[bufferCount++] = ch;
+                                       //styler.ColourTo(i,SCE_CONF_NUMBER);
+                                       state = SCE_CONF_NUMBER;
+                               } else {
+                                       // style it the default style..
+                                       styler.ColourTo(i,SCE_CONF_DEFAULT);
+                               }
+                               break;
+
+                       case SCE_CONF_COMMENT:
+                               // if we find a newline here,
+                               // we simply go to default state
+                               // else continue to work on it...
+                               if( ch == '\n' || ch == '\r' ) {
+                                       state = SCE_CONF_DEFAULT;
+                               } else {
+                                       styler.ColourTo(i,SCE_CONF_COMMENT);
+                               }
+                               break;
+
+                       case SCE_CONF_EXTENSION:
+                               // if we find a non-alphanumeric char,
+                               // we simply go to default state
+                               // else we're still dealing with an extension...
+                               if( isalnum(ch) || (ch == '_') ||
+                                       (ch == '-') || (ch == '$') ||
+                                       (ch == '/') || (ch == '.') || (ch == '*') )
+                               {
+                                       styler.ColourTo(i,SCE_CONF_EXTENSION);
+                               } else {
+                                       state = SCE_CONF_DEFAULT;
+                                       chNext = styler[i--];
+                               }
+                               break;
+
+                       case SCE_CONF_STRING:
+                               // if we find the end of a string char, we simply go to default state
+                               // else we're still dealing with an string...
+                               if( (ch == '"' && styler.SafeGetCharAt(i-1)!='\\') || (ch == '\n') || (ch == '\r') ) {
+                                       state = SCE_CONF_DEFAULT;
+                               }
+                               styler.ColourTo(i,SCE_CONF_STRING);
+                               break;
+
+                       case SCE_CONF_IDENTIFIER:
+                               // stay  in CONF_IDENTIFIER state until we find a non-alphanumeric
+                               if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) {
+                                       buffer[bufferCount++] = static_cast<char>(tolower(ch));
+                               } else {
+                                       state = SCE_CONF_DEFAULT;
+                                       buffer[bufferCount] = '\0';
+
+                                       // check if the buffer contains a keyword, and highlight it if it is a keyword...
+                                       if(directives.InList(buffer)) {
+                                               styler.ColourTo(i-1,SCE_CONF_DIRECTIVE );
+                                       } else if(params.InList(buffer)) {
+                                               styler.ColourTo(i-1,SCE_CONF_PARAMETER );
+                                       } else if(strchr(buffer,'/') || strchr(buffer,'.')) {
+                                               styler.ColourTo(i-1,SCE_CONF_EXTENSION);
+                                       } else {
+                                               styler.ColourTo(i-1,SCE_CONF_DEFAULT);
+                                       }
+
+                                       // push back the faulty character
+                                       chNext = styler[i--];
+
+                               }
+                               break;
+
+                       case SCE_CONF_NUMBER:
+                               // stay  in CONF_NUMBER state until we find a non-numeric
+                               if( isdigit(ch) || ch == '.') {
+                                       buffer[bufferCount++] = ch;
+                               } else {
+                                       state = SCE_CONF_DEFAULT;
+                                       buffer[bufferCount] = '\0';
+
+                                       // Colourize here...
+                                       if( strchr(buffer,'.') ) {
+                                               // it is an IP address...
+                                               styler.ColourTo(i-1,SCE_CONF_IP);
+                                       } else {
+                                               // normal number
+                                               styler.ColourTo(i-1,SCE_CONF_NUMBER);
+                                       }
+
+                                       // push back a character
+                                       chNext = styler[i--];
+                               }
+                               break;
+
+               }
+       }
+}
+
+LexerModule lmConf(SCLEX_CONF, ColouriseConfDoc, "conf");
diff --git a/src/stc/scintilla/src/LexEiffel.cxx b/src/stc/scintilla/src/LexEiffel.cxx
new file mode 100644 (file)
index 0000000..1296fb2
--- /dev/null
@@ -0,0 +1,321 @@
+// Scintilla source code edit control
+/** @file LexEiffel.cxx
+ ** Lexer for Eiffel.
+ **/
+// Copyright 1998-2001 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 <stdarg.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+inline bool isEiffelOperator(unsigned int ch) {
+       // '.' left out as it is used to make up numbers
+       return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' ||
+               ch == '(' || ch == ')' || ch == '=' ||
+               ch == '{' || ch == '}' || ch == '~' ||
+               ch == '[' || ch == ']' || ch == ';' ||
+               ch == '<' || ch == '>' || ch == ',' ||
+               ch == '.' || ch == '^' || ch == '%' || ch == ':' || 
+               ch == '!' || ch == '@' || ch == '?';
+}
+
+static void getRangeLowered(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';
+}
+
+inline bool IsASpace(unsigned int ch) {
+    return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
+}
+
+inline bool IsAWordChar(unsigned int  ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+}
+
+inline bool IsAWordStart(unsigned int ch) {
+       return (ch < 0x80) && (isalnum(ch) || ch == '_');
+}
+
+inline bool IsADigit(unsigned int ch) {
+       return (ch >= '0') && (ch <= '9');
+}
+
+// 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 
+// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80
+class xColouriseContext {
+       Accessor &styler;
+       int lengthDoc;
+       int currentPos;
+       xColouriseContext& operator=(const xColouriseContext&) {
+               return *this;
+       }
+public:
+       int state;
+       unsigned int chPrev;
+       unsigned int ch;
+       unsigned int chNext;
+
+       xColouriseContext(unsigned int startPos, int length,
+                        int initStyle, Accessor &styler_) : 
+               styler(styler_),
+               lengthDoc(startPos + length),
+               currentPos(startPos), 
+               state(initStyle), 
+               chPrev(0),
+               ch(0), 
+               chNext(0) {
+               styler.StartAt(startPos);
+               styler.StartSegment(startPos);
+               int pos = currentPos;
+               ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
+               if (styler.IsLeadByte(static_cast<char>(ch))) {
+                       pos++;
+                       ch = ch << 8;
+                       ch |= static_cast<unsigned char>(styler.SafeGetCharAt(pos));
+               }
+               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(pos+1));
+               if (styler.IsLeadByte(static_cast<char>(chNext))) {
+                       chNext = chNext << 8;
+                       chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(pos+2));
+               }
+       }
+       void Complete() {
+               styler.ColourTo(currentPos - 1, state);
+       }
+       bool More() {
+               return currentPos <= lengthDoc;
+       }
+       void Forward() {
+               chPrev = ch;
+               currentPos++;
+               if (ch >= 0x100)
+                       currentPos++;
+               ch = chNext;
+               chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+1));
+               if (styler.IsLeadByte(static_cast<char>(chNext))) {
+                       chNext = chNext << 8;
+                       chNext |= static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + 2));
+               }
+       }
+       void ChangeState(int state_) {
+               state = state_;
+       }
+       void SetState(int state_) {
+               styler.ColourTo(currentPos - 1, state);
+               state = state_;
+       }
+       void GetCurrentLowered(char *s, int len) {
+               getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
+       }
+};
+
+static void ColouriseEiffelDoc(unsigned int startPos,
+                            int length,
+                            int initStyle,
+                            WordList *keywordlists[],
+                            Accessor &styler) {
+
+       WordList &keywords = *keywordlists[0];
+
+       xColouriseContext lc(startPos, length, initStyle, styler);
+
+       for (; lc.More(); lc.Forward()) {
+
+               if (lc.state == SCE_EIFFEL_STRINGEOL) {
+                       if (lc.ch != '\r' && lc.ch != '\n') {
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_OPERATOR) {
+                       lc.SetState(SCE_EIFFEL_DEFAULT);
+               } else if (lc.state == SCE_EIFFEL_WORD) {
+                       if (!IsAWordChar(lc.ch)) {
+                               char s[100];
+                               lc.GetCurrentLowered(s, sizeof(s));
+                               if (!keywords.InList(s)) {
+                                       lc.ChangeState(SCE_EIFFEL_IDENTIFIER);
+                               }
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_NUMBER) {
+                       if (!IsAWordChar(lc.ch)) {
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_COMMENTLINE) {
+                       if (lc.ch == '\r' || lc.ch == '\n') {
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_STRING) {
+                       if (lc.ch == '%') {
+                               lc.Forward();
+                       } else if (lc.ch == '\"') {
+                               lc.Forward();
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               } else if (lc.state == SCE_EIFFEL_CHARACTER) {
+                       if (lc.ch == '\r' || lc.ch == '\n') {
+                               lc.SetState(SCE_EIFFEL_STRINGEOL);
+                       } else if (lc.ch == '%') {
+                               lc.Forward();
+                       } else if (lc.ch == '\'') {
+                               lc.Forward();
+                               lc.SetState(SCE_EIFFEL_DEFAULT);
+                       }
+               }
+
+               if (lc.state == SCE_EIFFEL_DEFAULT) {
+                       if (lc.ch == '-' && lc.chNext == '-') {
+                               lc.SetState(SCE_EIFFEL_COMMENTLINE);
+                       } else if (lc.ch == '\"') {
+                               lc.SetState(SCE_EIFFEL_STRING);
+                       } else if (lc.ch == '\'') {
+                               lc.SetState(SCE_EIFFEL_CHARACTER);
+                       } else if (IsADigit(lc.ch) || (lc.ch == '.')) {
+                               lc.SetState(SCE_EIFFEL_NUMBER);
+                       } else if (IsAWordStart(lc.ch)) {
+                               lc.SetState(SCE_EIFFEL_WORD);
+                       } else if (isEiffelOperator(lc.ch)) {
+                               lc.SetState(SCE_EIFFEL_OPERATOR);
+                       }
+               }
+       }
+       lc.Complete();
+}
+
+static bool IsEiffelComment(Accessor &styler, int pos, int len) {
+       return len>1 && styler[pos]=='-' && styler[pos+1]=='-';
+}
+
+static void FoldEiffelDocIndent(unsigned int startPos, int length, int,
+                                                  WordList *[], Accessor &styler) {
+       int lengthDoc = startPos + length;
+
+       // Backtrack to previous line in case need to fix its fold status
+       int lineCurrent = styler.GetLine(startPos);
+       if (startPos > 0) {
+               if (lineCurrent > 0) {
+                       lineCurrent--;
+                       startPos = styler.LineStart(lineCurrent);
+               }
+       }
+       int spaceFlags = 0;
+       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment);
+       char chNext = styler[startPos];
+       for (int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
+                       int lev = indentCurrent;
+                       int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsEiffelComment);
+                       if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
+                               // Only non whitespace lines can be headers
+                               if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
+                                       // Line after is blank so check the next - maybe should continue further?
+                                       int spaceFlags2 = 0;
+                                       int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsEiffelComment);
+                                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
+                                               lev |= SC_FOLDLEVELHEADERFLAG;
+                                       }
+                               }
+                       }
+                       indentCurrent = indentNext;
+                       styler.SetLevel(lineCurrent, lev);
+                       lineCurrent++;
+               }
+       }
+}
+
+static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+                       Accessor &styler) {
+       unsigned int lengthDoc = 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 stylePrev = 0;
+       int styleNext = styler.StyleAt(startPos);
+       // lastDeferred should be determined by looking back to last keyword in case
+       // the "deferred" is on a line before "class"
+       bool lastDeferred = false;
+       for (unsigned int i = startPos; i < lengthDoc; 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 ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) {
+                       char s[20];
+                       unsigned int j = 0;
+                       while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) {
+                               s[j] = styler[i + j];
+                               j++;
+                       }
+                       s[j] = '\0';
+
+                       if (
+                               (strcmp(s, "check") == 0) || 
+                               (strcmp(s, "debug") == 0) || 
+                               (strcmp(s, "deferred") == 0) || 
+                               (strcmp(s, "do") == 0) || 
+                               (strcmp(s, "from") == 0) ||
+                               (strcmp(s, "if") == 0) ||
+                               (strcmp(s, "inspect") == 0) || 
+                               (strcmp(s, "once") == 0)
+                       )
+                               levelCurrent++;
+                       if (!lastDeferred && (strcmp(s, "class") == 0))
+                               levelCurrent++;
+                       if (strcmp(s, "end") == 0) 
+                               levelCurrent--;
+                       lastDeferred = strcmp(s, "deferred") == 0;
+               }
+
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0)
+                               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++;
+               stylePrev = style;
+       }
+       // 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 lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent);
+LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords);
index 7868b47fc8c11d283b3da0d70b22a7ac5419b468..c28a43279544eaa2d76ac4a27927d51a4ccc9c34 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexHTML.cxx - lexer for HTML
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexHTML.cxx
+ ** Lexer for HTML.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
@@ -32,6 +34,8 @@ static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigne
                s[i + 1] = '\0';
        }
        //Platform::DebugPrintf("Scripting indicator [%s]\n", s);
+       if (strstr(s, "src"))   // External script
+               return eScriptNone;
        if (strstr(s, "vbs"))
                return eScriptVBS;
        if (strstr(s, "pyth"))
@@ -63,7 +67,6 @@ static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, u
        return iResult;
 }
 
-//static int ScriptOfState(int state,int defaultScript)
 static int ScriptOfState(int state) {
        int scriptLanguage;
 
@@ -71,7 +74,7 @@ static int ScriptOfState(int state) {
                scriptLanguage = eScriptPython;
        } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) {
                scriptLanguage = eScriptVBS;
-       } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_STRINGEOL)) {
+       } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
                scriptLanguage = eScriptJS;
        } else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) {
                scriptLanguage = eScriptPHP;
@@ -90,7 +93,7 @@ static int statePrintForState(int state, int inScriptType) {
                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_STRINGEOL)) {
+       } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) {
                StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS);
        } else {
                StateToPrint = state;
@@ -106,7 +109,7 @@ static int stateForPrintState(int StateToPrint) {
                state = StateToPrint - SCE_HA_PYTHON;
        } else if ((StateToPrint >= SCE_HBA_START) && (StateToPrint <= SCE_HBA_STRINGEOL)) {
                state = StateToPrint - SCE_HA_VBS;
-       } else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_STRINGEOL)) {
+       } else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_REGEX)) {
                state = StateToPrint - SCE_HA_JS;
        } else {
                state = StateToPrint;
@@ -117,7 +120,51 @@ static int stateForPrintState(int StateToPrint) {
 
 static inline bool IsNumber(unsigned int start, Accessor &styler) {
        return isdigit(styler[start]) || (styler[start] == '.') ||
-                           (styler[start] == '-') || (styler[start] == '#');
+              (styler[start] == '-') || (styler[start] == '#');
+}
+
+static inline bool isStringState(int state) {
+       bool bResult;
+
+       switch (state) {
+       case SCE_HJ_DOUBLESTRING:
+       case SCE_HJ_SINGLESTRING:
+       case SCE_HJA_DOUBLESTRING:
+       case SCE_HJA_SINGLESTRING:
+       case SCE_HB_STRING:
+       case SCE_HBA_STRING:
+       case SCE_HP_STRING:
+       case SCE_HPA_STRING:
+       case SCE_HPHP_HSTRING:
+       case SCE_HPHP_SIMPLESTRING:
+               bResult = true;
+               break;
+       default :
+               bResult = false;
+               break;
+       }
+       return bResult;
+}
+
+// not really well done, since it's only comments that should lex the %> and <%
+static inline bool isCommentASPState(int state) {
+       bool bResult;
+
+       switch (state) {
+       case SCE_HJ_COMMENT:
+       case SCE_HJ_COMMENTLINE:
+       case SCE_HJ_COMMENTDOC:
+       case SCE_HB_COMMENTLINE:
+       case SCE_HP_COMMENTLINE:
+       case SCE_HPHP_COMMENT:
+       case SCE_HPHP_COMMENTLINE:
+               bResult = true;
+               break;
+       default :
+               bResult = false;
+               break;
+       }
+       return bResult;
 }
 
 static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
@@ -152,27 +199,28 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
                        s[i++] = static_cast<char>(tolower(ch));
        }
        s[i] = '\0';
+       bool isScript = false;
        char chAttr = SCE_H_TAGUNKNOWN;
        if (s[0] == '!' && s[1] == '-' && s[2] == '-') {        //Comment
                chAttr = SCE_H_COMMENT;
        } else if (strcmp(s, "![cdata[") == 0) {        // In lower case because already converted
                chAttr = SCE_H_CDATA;
+       } else if (s[0] == '!') {
+               chAttr = SCE_H_SGML;
        } else if (s[0] == '/') {       // Closing tag
                if (keywords.InList(s + 1))
                        chAttr = SCE_H_TAG;
        } else {
                if (keywords.InList(s)) {
                        chAttr = SCE_H_TAG;
-               }
-               if (0 == strcmp(s, "script")) {
-                       chAttr = SCE_H_SCRIPT;
+                       isScript = 0 == strcmp(s, "script");
                }
        }
        if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords)
                // No keywords -> all are known
                chAttr = SCE_H_TAG;
        styler.ColourTo(end, chAttr);
-       return chAttr;
+       return isScript ? SCE_H_SCRIPT : chAttr;
 }
 
 static void classifyWordHTJS(unsigned int start, unsigned int end,
@@ -295,6 +343,17 @@ static bool isLineEnd(char ch) {
        return ch == '\r' || ch == '\n';
 }
 
+static bool isOKBeforeRE(char ch) {
+       return (ch == '(') || (ch == '=') || (ch == ',');
+}
+
+static bool isPHPStringState(int state) {
+       return 
+               (state == SCE_HPHP_HSTRING) ||
+               (state == SCE_HPHP_SIMPLESTRING) ||
+               (state == SCE_HPHP_HSTRING_VARIABLE);
+}
+
 static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
                                   Accessor &styler) {
 
@@ -313,8 +372,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 
        // If inside a tag, it may be a script tag, so reread from the start to ensure any language tags are seen
        if (InTagState(state)) {
-               while ((startPos > 1) && (InTagState(styler.StyleAt(startPos - 1)))) {
+               while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) {
                        startPos--;
+            length++;
                }
                state = SCE_H_DEFAULT;
        }
@@ -324,25 +384,36 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
        int lineCurrent = styler.GetLine(startPos);
        if (lineCurrent > 0)
                lineState = styler.GetLineState(lineCurrent);
-       int inScriptType = (lineState >> 0) & 0x03; // 2 bits
-       int defaultScript = (lineState >> 4) & 0x0F; // 4 bits
-       int beforePreProc = (lineState >> 8) & 0xFF; // 8 bits
+       int inScriptType  = (lineState >> 0) & 0x03; // 2 bits of scripting type
+       bool tagOpened    = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag
+       bool tagClosing   = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag
+       int defaultScript = (lineState >> 4) & 0x0F; // 4 bits of script name
+       int beforePreProc = (lineState >> 8) & 0xFF; // 8 bits of state
 
-       //      int scriptLanguage = ScriptOfState(state,defaultScript);
        int scriptLanguage = ScriptOfState(state);
 
        bool fold = styler.GetPropertyInt("fold");
+       bool foldHTML = styler.GetPropertyInt("fold.html",0);
+       bool foldCompact = styler.GetPropertyInt("fold.compact",1);
+
+       fold = foldHTML && fold;
+
        int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
        int levelCurrent = levelPrev;
-       int visibleChars = 0;
+       int visibleChars;
+
+       visibleChars = 0;
 
        char chPrev = ' ';
        char ch = ' ';
+       char chPrevNonWhite = ' ';
        styler.StartSegment(startPos);
        int lengthDoc = startPos + length;
        for (int i = startPos; i < lengthDoc; i++) {
                char chPrev2 = chPrev;
                chPrev = ch;
+               if (ch != ' ' && ch != '\t')
+                       chPrevNonWhite = ch;
                ch = styler[i];
                char chNext = styler.SafeGetCharAt(i + 1);
                char chNext2 = styler.SafeGetCharAt(i + 2);
@@ -354,40 +425,44 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        continue;
                }
 
-               if (fold && !isspace(ch))
+               if ((!isspacechar(ch) || !foldCompact) && fold)
                        visibleChars++;
 
+               // decide what is the current state to print (depending of the script tag)
+               StateToPrint = statePrintForState(state, inScriptType);
+
                // handle script folding
                if (fold) {
                        switch (scriptLanguage) {
                        case eScriptJS:
                        case eScriptPHP:
                                //not currently supported                               case eScriptVBS:
+
                                if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC)) {
-                               if ((ch == '{') || (ch == '}')) {
-                                       levelCurrent += (ch == '{') ? 1 : -1;
+                                       if ((ch == '{') || (ch == '}')) {
+                                               levelCurrent += (ch == '{') ? 1 : -1;
                                        }
                                }
                                break;
                        case eScriptPython:
                                if (state != SCE_HP_COMMENTLINE) {
-                               if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) {
-                                       levelCurrent++;
-                               } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
-                                       // check if the number of tabs is lower than the level
-                                       int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
-                                       for (int j = 0;Findlevel > 0;j++) {
-                                               char chTmp = styler.SafeGetCharAt(i + j + 1);
-                                               if (chTmp == '\t') {
-                                                       Findlevel -= 8;
-                                               }       else if (chTmp == ' ') {
-                                                       Findlevel--;
-                                               }       else break;
-                                       }
+                                       if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) {
+                                               levelCurrent++;
+                                       } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
+                                               // check if the number of tabs is lower than the level
+                                               int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8;
+                                               for (int j = 0;Findlevel > 0;j++) {
+                                                       char chTmp = styler.SafeGetCharAt(i + j + 1);
+                                                       if (chTmp == '\t') {
+                                                               Findlevel -= 8;
+                                                       }       else if (chTmp == ' ') {
+                                                               Findlevel--;
+                                                       }       else break;
+                                               }
 
-                                       if (Findlevel > 0) {
-                                               levelCurrent -= Findlevel / 8;
-                                               if (Findlevel % 8) levelCurrent--;
+                                               if (Findlevel > 0) {
+                                                       levelCurrent -= Findlevel / 8;
+                                                       if (Findlevel % 8) levelCurrent--;
                                                }
                                        }
                                }
@@ -395,9 +470,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                }
 
-               // decide what is the current state to print (depending of the script tag)
-               StateToPrint = statePrintForState(state, inScriptType);
-
                if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
                        // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
                        // Avoid triggering two times on Dos/Win
@@ -408,13 +480,16 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        lev |= SC_FOLDLEVELWHITEFLAG;
                                if ((levelCurrent > levelPrev) && (visibleChars > 0))
                                        lev |= SC_FOLDLEVELHEADERFLAG;
+
                                styler.SetLevel(lineCurrent, lev);
                                visibleChars = 0;
                                levelPrev = levelCurrent;
                        }
                        lineCurrent++;
                        styler.SetLineState(lineCurrent,
-                                           ((inScriptType & 0x03) << 0) |
+                                           ((inScriptType  & 0x03) << 0) |
+                                                               ((tagOpened     & 0x01) << 2) |
+                                                               ((tagClosing    & 0x01) << 3) |
                                            ((defaultScript & 0x0F) << 4) |
                                            ((beforePreProc & 0xFF) << 8));
                }
@@ -428,7 +503,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        case SCE_H_SINGLESTRING:
                        case SCE_HJ_COMMENT:
                        case SCE_HJ_COMMENTDOC:
-                       case SCE_HJ_COMMENTLINE:
+                       // 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_COMMENTLINE:
                        case SCE_HJ_DOUBLESTRING:
                        case SCE_HJ_SINGLESTRING:
                        case SCE_HB_STRING:
@@ -438,19 +515,24 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                break;
                        default :
                                // maybe we should check here if it's a tag and if it's SCRIPT
-
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_H_TAGUNKNOWN;
                                inScriptType = eHtml;
                                scriptLanguage = eScriptNone;
                                i += 2;
+                               // unfold closing script
+                               levelCurrent--;
                                continue;
                        }
                }
 
                /////////////////////////////////////
                // handle the start of PHP pre-processor = Non-HTML
-               else if ((ch == '<') && (chNext == '?')) {
+               else if ((state != SCE_H_ASPAT) && 
+                               !isPHPStringState(state) && 
+                               (state != SCE_HPHP_COMMENT) && 
+                               (ch == '<') && 
+                               (chNext == '?')) {
                        styler.ColourTo(i - 1, StateToPrint);
                        beforePreProc = state;
                        scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
@@ -465,11 +547,17 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                inScriptType = eNonHtmlScriptPreProc;
                        else
                                inScriptType = eNonHtmlPreProc;
+                       // fold whole script
+                       levelCurrent++;
+                       if (scriptLanguage == eScriptXML)
+                               levelCurrent--; // no folding of the XML first tag (all XML-like tags in this case)
+                       // should be better
+                       ch = styler.SafeGetCharAt(i);
                        continue;
                }
 
                // handle the start of ASP pre-processor = Non-HTML
-               else if ((ch == '<') && (chNext == '%')) {
+               else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%')) {
                        styler.ColourTo(i - 1, StateToPrint);
                        beforePreProc = state;
                        if (inScriptType == eNonHtmlScript)
@@ -480,25 +568,40 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        if (chNext2 == '@') {
                                i += 2; // place as if it was the second next char treated
                                state = SCE_H_ASPAT;
+                       } else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) {
+                               styler.ColourTo(i + 3, SCE_H_ASP);
+                               state = SCE_H_XCCOMMENT;
+                               scriptLanguage = eScriptVBS;
+                               continue;
                        } else {
                                if (chNext2 == '=') {
                                        i += 2; // place as if it was the second next char treated
-                               }
-                               else {
+                               } else {
                                        i++; // place as if it was the next char treated
                                }
 
-
                                state = StateForScript(defaultScript);
                        }
+                       scriptLanguage = eScriptVBS;
                        styler.ColourTo(i, SCE_H_ASP);
+                       // fold whole script
+                       levelCurrent++;
+                       // should be better
+                       ch = styler.SafeGetCharAt(i);
                        continue;
                }
 
                // handle the end of a pre-processor = Non-HTML
-               else if (((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && ((ch == '?') || (ch == '%')) && (chNext == '>')) {
+               else if (
+                       ((inScriptType == eNonHtmlPreProc)
+                               || (inScriptType == eNonHtmlScriptPreProc)) && (
+                               ((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) || 
+                               ((scriptLanguage != eScriptNone) && !isStringState(state) &&
+                                (ch == '%'))
+                       ) && (chNext == '>')) {
                        if (state == SCE_H_ASPAT) {
-                               defaultScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, defaultScript);
+                               defaultScript = segIsScriptingIndicator(styler,
+                                       styler.GetStartSegment(), i - 1, defaultScript);
                        }
                        // Bounce out of any ASP mode
                        switch (state) {
@@ -514,6 +617,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        case SCE_HPHP_WORD:
                                classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
                                break;
+                       case SCE_H_XCCOMMENT:
+                               styler.ColourTo(i - 1, state);
+                               break;
                        default :
                                styler.ColourTo(i - 1, StateToPrint);
                                break;
@@ -531,6 +637,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        else
                                inScriptType = eHtml;
                        scriptLanguage = eScriptNone;
+                       // unfold all scripting languages
+                       levelCurrent--;
                        continue;
                }
                /////////////////////////////////////
@@ -538,10 +646,21 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                switch (state) {
                case SCE_H_DEFAULT:
                        if (ch == '<') {
+                               // in HTML, fold on tag open and unfold on tag close
+                               tagOpened = true;
+                               if (chNext == '/') {
+                                       tagClosing = true;
+                               } else {
+                                       tagClosing = false;
+                               }
+
                                styler.ColourTo(i - 1, StateToPrint);
-                               if (chNext == '!' && chNext2 == '-' && styler.SafeGetCharAt(i + 3) == '-')
+                               if (chNext == '!' && chNext2 == '-' && styler.SafeGetCharAt(i + 3) == '-') {
+                                       // should be better
+                                       i += 3;
+                                       levelCurrent++;
                                        state = SCE_H_COMMENT;
-                               else
+                               else
                                        state = SCE_H_TAGUNKNOWN;
                        } else if (ch == '&') {
                                styler.ColourTo(i - 1, SCE_H_DEFAULT);
@@ -550,14 +669,26 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        break;
                case SCE_H_COMMENT:
                        if ((ch == '>') && (chPrev == '-') && (chPrev2 == '-')) {
+                               // unfold HTML comment
+                               levelCurrent--;
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_H_DEFAULT;
+                               tagOpened = false;
                        }
                        break;
                case SCE_H_CDATA:
                        if ((ch == '>') && (chPrev == ']') && (chPrev2 == ']')) {
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_H_DEFAULT;
+                               tagOpened = false;
+                       }
+                       break;
+               case SCE_H_SGML:
+                       if (ch == '>') {
+                               levelCurrent--;
+                               styler.ColourTo(i, StateToPrint);
+                               state = SCE_H_DEFAULT;
+                               tagOpened = false;
                        }
                        break;
                case SCE_H_ENTITY:
@@ -571,7 +702,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        }
                        break;
                case SCE_H_TAGUNKNOWN:
-                       if (!ishtmlwordchar(ch) && ch != '/' && ch != '-' && ch != '[') {
+                       if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') {
                                int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler);
                                if (eClass == SCE_H_SCRIPT) {
                                        inScriptType = eNonHtmlScript;
@@ -579,17 +710,38 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        eClass = SCE_H_TAG;
                                }
                                if (ch == '>') {
-                                       styler.ColourTo(i, SCE_H_TAG);
+                                       styler.ColourTo(i, eClass);
                                        if (inScriptType == eNonHtmlScript) {
                                                state = StateForScript(scriptLanguage);
                                        } else {
                                                state = SCE_H_DEFAULT;
                                        }
-                               } else {
-                                       if (eClass == SCE_H_CDATA) {
-                                               state = SCE_H_CDATA;
+                                       tagOpened = false;
+                                       if (tagClosing)
+                                               levelCurrent--;
+                                       else
+                                               levelCurrent++;
+                                       tagClosing = false;
+                           } else if (ch == '/' && chNext == '>') {
+                                       if (eClass == SCE_H_TAGUNKNOWN) {
+                                           styler.ColourTo(i + 1, SCE_H_TAGUNKNOWN);
                                        } else {
-                                               state = SCE_H_OTHER;
+                                           styler.ColourTo(i - 1, StateToPrint);
+                                           styler.ColourTo(i + 1, SCE_H_TAGEND);
+                                       }
+                                   i++;
+                                   ch = chNext;
+                                   state = SCE_H_DEFAULT;
+                                       tagOpened = false;
+                               } else {
+                                       if (eClass != SCE_H_TAGUNKNOWN) {
+                                               if (eClass == SCE_H_CDATA) {
+                                                       state = SCE_H_CDATA;
+                                               } else if (eClass == SCE_H_SGML) {
+                                                       state = SCE_H_SGML;
+                                               } else {
+                                                       state = SCE_H_OTHER;
+                                               }
                                        }
                                }
                        }
@@ -597,7 +749,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                case SCE_H_ATTRIBUTE:
                        if (!ishtmlwordchar(ch) && ch != '/' && ch != '-') {
                                if (inScriptType == eNonHtmlScript) {
+                                       int scriptLanguagePrev = scriptLanguage;
                                        scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage);
+                                       if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone))
+                                               inScriptType = eHtml;
                                }
                                classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler);
                                if (ch == '>') {
@@ -607,6 +762,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        } else {
                                                state = SCE_H_DEFAULT;
                                        }
+                                       tagOpened = false;
+                                       if (tagClosing)
+                                               levelCurrent--;
+                                       else
+                                               levelCurrent++;
+                                       tagClosing = false;
                                } else if (ch == '=') {
                                        styler.ColourTo(i, SCE_H_OTHER);
                                        state = SCE_H_VALUE;
@@ -624,6 +785,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                } else {
                                        state = SCE_H_DEFAULT;
                                }
+                               tagOpened = false;
+                               if (tagClosing)
+                                       levelCurrent--;
+                               else
+                                       levelCurrent++;
+                               tagClosing = false;
                        } else if (ch == '\"') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_H_DOUBLESTRING;
@@ -639,6 +806,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                i++;
                                ch = chNext;
                                state = SCE_H_DEFAULT;
+                               tagOpened = false;
                        } else if (ch == '?' && chNext == '>') {
                                styler.ColourTo(i - 1, StateToPrint);
                                styler.ColourTo(i + 1, SCE_H_XMLEND);
@@ -688,6 +856,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                                } else {
                                                        state = SCE_H_DEFAULT;
                                                }
+                                               tagOpened = false;
+                                               if (tagClosing)
+                                                       levelCurrent--;
+                                               else
+                                                       levelCurrent++;
+                                               tagClosing = false;
                                        } else {
                                                state = SCE_H_OTHER;
                                        }
@@ -709,6 +883,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        } else if (ch == '/' && chNext == '/') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_COMMENTLINE;
+                       } else if (ch == '/' && isOKBeforeRE(chPrevNonWhite)) {
+                               styler.ColourTo(i - 1, StateToPrint);
+                               state = SCE_HJ_REGEX;
                        } else if (ch == '\"') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_DOUBLESTRING;
@@ -781,8 +958,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        } else if (ch == '\"') {
                                styler.ColourTo(i, statePrintForState(SCE_HJ_DOUBLESTRING, inScriptType));
                                state = SCE_HJ_DEFAULT;
-                               i++;
-                               ch = chNext;
                        } else if ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_COMMENTLINE;
@@ -800,8 +975,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        } else if (ch == '\'') {
                                styler.ColourTo(i, statePrintForState(SCE_HJ_SINGLESTRING, inScriptType));
                                state = SCE_HJ_DEFAULT;
-                               i++;
-                               ch = chNext;
                        } else if ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HJ_COMMENTLINE;
@@ -820,6 +993,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HJ_DEFAULT;
                        }
                        break;
+               case SCE_HJ_REGEX:
+                       if (ch == '\r' || ch == '\n' || ch == '/') {
+                               styler.ColourTo(i, StateToPrint);
+                               state = SCE_HJ_DEFAULT;
+                       } else if (ch == '\\') {
+                               // Gobble up the quoted character
+                               if (chNext == '\\' || chNext == '/') {
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               }
+                       }
+                       break;
                case SCE_HB_DEFAULT:
                case SCE_HB_START:
                        if (iswordstart(ch)) {
@@ -837,7 +1023,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HB_COMMENTLINE;
                        } else if (isoperator(ch)) {
                                styler.ColourTo(i - 1, StateToPrint);
-                               styler.ColourTo(i, SCE_HB_DEFAULT);
+                               styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType));
                                state = SCE_HB_DEFAULT;
                        } else if ((ch == ' ') || (ch == '\t')) {
                                if (state == SCE_HB_START) {
@@ -865,8 +1051,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        if (ch == '\"') {
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_HB_DEFAULT;
-                               i++;
-                               ch = chNext;
                        } else if (ch == '\r' || ch == '\n') {
                                styler.ColourTo(i - 1, StateToPrint);
                                state = SCE_HB_STRINGEOL;
@@ -1023,6 +1207,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        state = SCE_HPHP_SIMPLESTRING;
                                } else if (ch == '$') {
                                        state = SCE_HPHP_VARIABLE;
+                               } else if (isoperator(ch)) {
+                                       state = SCE_HPHP_OPERATOR;
                                } else {
                                        state = SCE_HPHP_DEFAULT;
                                }
@@ -1031,13 +1217,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                case SCE_HPHP_NUMBER:
                        if (!isdigit(ch)) {
                                styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
-                               state = SCE_HPHP_DEFAULT;
+                               if (isoperator(ch)) 
+                                       state =SCE_HPHP_OPERATOR;
+                               else 
+                                       state = SCE_HPHP_DEFAULT;
                        }
                        break;
                case SCE_HPHP_VARIABLE:
                        if (!iswordstart(ch)) {
                                styler.ColourTo(i - 1, SCE_HPHP_VARIABLE);
-                               state = SCE_HPHP_DEFAULT;
+                               if (isoperator(ch)) 
+                                       state =SCE_HPHP_OPERATOR;
+                               else 
+                                       state = SCE_HPHP_DEFAULT;
                        }
                        break;
                case SCE_HPHP_COMMENT:
@@ -1054,20 +1246,34 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                        break;
                case SCE_HPHP_HSTRING:
                        if (ch == '\\') {
-        // skip the next char
-                                       i++;
+                               // skip the next char
+                               i++;
+                       } else if (ch == '$') {
+                               styler.ColourTo(i-1, StateToPrint);
+                               state = SCE_HPHP_HSTRING_VARIABLE;
                        } else if (ch == '\"') {
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_HPHP_DEFAULT;
                        }
                        break;
                case SCE_HPHP_SIMPLESTRING:
-                        if (ch == '\'') {
+                       if (ch == '\\') {
+                               // skip the next char
+                               i++;
+                       } else if (ch == '\'') {
                                styler.ColourTo(i, StateToPrint);
                                state = SCE_HPHP_DEFAULT;
                        }
                        break;
-               case SCE_HPHP_DEFAULT:
+               case SCE_HPHP_HSTRING_VARIABLE:
+                       if (!iswordstart(ch)) {
+                               styler.ColourTo(i-1, StateToPrint);
+                               i--; // strange but it works
+                               state = SCE_HPHP_HSTRING;
+                       }
+                       break;
+               case SCE_HPHP_OPERATOR:
+               case SCE_HPHP_DEFAULT:
                        styler.ColourTo(i - 1, StateToPrint);
                        if (isdigit(ch)) {
                                state = SCE_HPHP_NUMBER;
@@ -1087,15 +1293,20 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                state = SCE_HPHP_SIMPLESTRING;
                        } else if (ch == '$') {
                                state = SCE_HPHP_VARIABLE;
+                       } else if (isoperator(ch)) {
+                               state = SCE_HPHP_OPERATOR;
+                       } else if ((state == SCE_HPHP_OPERATOR) && (isspacechar(ch))) {
+                               state = SCE_HPHP_DEFAULT;
                        }
                        break;
                        ///////////// end - PHP state handling
                }
 
-
-
+               // Some of the above terminated their lexeme but since the same character starts
+               // the same class again, only reenter if non empty segment.
+               bool nonEmptySegment = i >= static_cast<int>(styler.GetStartSegment());
                if (state == SCE_HB_DEFAULT) {    // One of the above succeeded
-                       if (ch == '\"') {
+                       if ((ch == '\"') && (nonEmptySegment)) {
                                state = SCE_HB_STRING;
                        } else if (ch == '\'') {
                                state = SCE_HB_COMMENTLINE;
@@ -1105,7 +1316,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                styler.ColourTo(i, SCE_HB_DEFAULT);
                        }
                } else if (state == SCE_HBA_DEFAULT) {    // One of the above succeeded
-                       if (ch == '\"') {
+                       if ((ch == '\"') && (nonEmptySegment)) {
                                state = SCE_HBA_STRING;
                        } else if (ch == '\'') {
                                state = SCE_HBA_COMMENTLINE;
@@ -1122,14 +1333,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                        state = SCE_HJ_COMMENT;
                        } else if (ch == '/' && chNext == '/') {
                                state = SCE_HJ_COMMENTLINE;
-                       } else if (ch == '\"') {
+                       } else if ((ch == '\"') && (nonEmptySegment)) {
                                state = SCE_HJ_DOUBLESTRING;
-                       } else if (ch == '\'') {
+                       } else if ((ch == '\'')  && (nonEmptySegment)) {
                                state = SCE_HJ_SINGLESTRING;
                        } else if (iswordstart(ch)) {
                                state = SCE_HJ_WORD;
                        } else if (isoperator(ch)) {
-                               styler.ColourTo(i, SCE_HJ_SYMBOLS);
+                               styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType));
                        }
                }
        }
@@ -1140,12 +1351,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
        // Fill in the real level of the next line, keeping the current flags as they will be filled in later
        if (fold) {
                int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
-               //styler.SetLevel(lineCurrent, levelCurrent | flagsNext);
                styler.SetLevel(lineCurrent, levelPrev | flagsNext);
-
        }
 }
 
-LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc);
-LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc);
+LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
+LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
 
diff --git a/src/stc/scintilla/src/LexLisp.cxx b/src/stc/scintilla/src/LexLisp.cxx
new file mode 100644 (file)
index 0000000..623ca7c
--- /dev/null
@@ -0,0 +1,195 @@
+// Scintilla source code edit control
+/** @file LexLisp.cxx
+ ** Lexer for Lisp.
+ ** Written by Alexey Yutkin.
+ **/
+// Copyright 1998-2001 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 "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+
+inline bool isLispoperator(char ch) {
+       if (isascii(ch) && isalnum(ch))
+               return false;
+       if (ch == '\'' || ch == '(' || ch == ')' )
+               return true;
+       return false;
+}
+
+inline bool isLispwordstart(char ch) {
+       return isascii(ch) && ch != ';'  && !isspacechar(ch) && !isLispoperator(ch) &&
+               ch != '\n' && ch != '\r' &&  ch != '\"';
+}
+
+
+static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
+       PLATFORM_ASSERT(end >= start);
+       char s[100];
+       unsigned int i;
+       bool digit_flag = true;
+       for (i = 0; (i < end - start + 1) && (i < 99); i++) {
+               s[i] = styler[start + i];
+               s[i + 1] = '\0';
+               if (!isdigit(s[i]) && (s[i] != '.')) digit_flag = false;
+       }
+       char chAttr = SCE_LISP_IDENTIFIER;
+
+       if(digit_flag) chAttr = SCE_LISP_NUMBER;
+       else {
+               if (keywords.InList(s)) {
+                       chAttr = SCE_LISP_KEYWORD;
+               }
+       }
+       styler.ColourTo(end, chAttr);
+       return;
+}
+
+
+static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+                            Accessor &styler) {
+
+       WordList &keywords = *keywordlists[0];
+
+       styler.StartAt(startPos);
+
+       int state = initStyle;
+       if (state == SCE_LISP_STRINGEOL)        // Does not leak onto next line
+               state = SCE_LISP_DEFAULT;
+       char chPrev = ' ';
+       char chNext = styler[startPos];
+       unsigned int lengthDoc = startPos + length;
+       styler.StartSegment(startPos);
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+               if (atEOL) {
+                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+                       // Avoid triggering two times on Dos/Win
+                       // End of line
+                       if (state == SCE_LISP_STRINGEOL) {
+                               styler.ColourTo(i, state);
+                               state = SCE_LISP_DEFAULT;
+                       }
+               }
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       chPrev = ' ';
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_LISP_DEFAULT) {
+                       if (isLispwordstart(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LISP_IDENTIFIER;
+                       } 
+                       else if (ch == ';') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LISP_COMMENT;
+                       }
+                       else if (isLispoperator(ch) || ch=='\'') {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i, SCE_LISP_OPERATOR);
+                       }
+                       
+                       else if (ch == '\"') {
+                                       state = SCE_LISP_STRING;
+                       }
+               } else if (state == SCE_LISP_IDENTIFIER) {
+                       if (!isLispwordstart(ch)) {
+                               classifyWordLisp(styler.GetStartSegment(), i - 1, keywords, styler);
+                               state = SCE_LISP_DEFAULT;
+                       } /*else*/ 
+                       if (isLispoperator(ch) || ch=='\'') {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i, SCE_LISP_OPERATOR);
+                       }
+                       
+               } else {
+                       if (state == SCE_LISP_COMMENT) {
+                               if (atEOL) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LISP_DEFAULT;
+                               }
+                       } else if (state == SCE_LISP_STRING) {
+                               if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\"') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_LISP_DEFAULT;
+                               } else if ((chNext == '\r' || chNext == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, SCE_LISP_STRINGEOL);
+                                       state = SCE_LISP_STRINGEOL;
+                               }
+                       }
+               }
+
+               chPrev = ch;
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+}
+
+static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+                            Accessor &styler) {
+       unsigned int lengthDoc = 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);
+       for (unsigned int i = startPos; i < lengthDoc; 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_LISP_OPERATOR) {
+                       if (ch == '(') {
+                               levelCurrent++;
+                       } else if (ch == ')') {
+                               levelCurrent--;
+                       }
+               }
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0)
+                               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 lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc);
index e6da7668ddc73017de13ef5fda9395c26f49fd1d..2791d98ada3d86e8c6086471cc4e2ec896b9b820 100644 (file)
@@ -1,5 +1,10 @@
-// LexLua.cxx - lexer for Lua language
-// Written by Paul Winwood 
+// Scintilla source code edit control
+/** @file LexLua.cxx
+ ** Lexer for Lua language.
+ **
+ ** Written by Paul Winwood.
+ ** Folder by Alexey Yutkin.
+ **/
 
 #include <stdlib.h>
 #include <string.h>
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-static void classifyWordLua(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler)
-{
-    char s[100];
-    bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
-    
-    for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
-    {
-        s[i] = styler[start + i];
-        s[i + 1] = '\0';
-    }
+inline bool isLuaOperator(char ch) {
+       if (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 == ':')
+               return true;
+       return false;
+}
+
+static void classifyWordLua(unsigned int start,
+                            unsigned int end,
+                            WordList   &keywords,
+                            Accessor   &styler) {
+       char s[100];
+       bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
+
+       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+               s[i] = styler[start + i];
+               s[i + 1] = '\0';
+       }
 
-    char chAttr = SCE_LUA_IDENTIFIER;
-    
-    if (wordIsNumber)
-        chAttr = SCE_LUA_NUMBER;
-    else
-    {
-        if (keywords.InList(s))
-        {
-            chAttr = SCE_LUA_WORD;
-        }
-    }
-    styler.ColourTo(end, chAttr);
+       char chAttr = SCE_LUA_IDENTIFIER;
+
+       if (wordIsNumber)
+               chAttr = SCE_LUA_NUMBER;
+       else {
+               if (keywords.InList(s)) {
+                       chAttr = SCE_LUA_WORD;
+               }
+       }
+       styler.ColourTo(end, chAttr);
 }
 
-static void ColouriseLuaDoc(unsigned int startPos, 
-                            int          length, 
-                            int          initStyle, 
-                            WordList    *keywordlists[],
-                            Accessor    &styler)
-{
+static void ColouriseLuaDoc(unsigned int startPos,
+                            int length,
+                            int initStyle,
+                            WordList *keywordlists[],
+                            Accessor &styler) {
+
+       WordList &keywords = *keywordlists[0];
 
-    WordList &keywords = *keywordlists[0];
+       styler.StartAt(startPos);
+       styler.GetLine(startPos);
 
-    styler.StartAt(startPos);
-    styler.GetLine(startPos);
+       int state = initStyle;
+       char chPrev = ' ';
+       char chNext = styler[startPos];
+       unsigned int lengthDoc = startPos + length;
+       bool firstChar = true;
 
-    int  state = initStyle;
-    char chPrev = ' ';
-    char chNext = styler[startPos];
-    unsigned int lengthDoc = startPos + length;
-    bool firstChar = true;
-    int  literalString = 0;
+       /* Must initialize the literalString level, if we are inside such a string.
+        * Note: this isn't enough, because literal strings can be nested,
+        * we should go back to see at what level we are...
+        */
+       int literalString = (initStyle == SCE_LUA_LITERALSTRING) ? 1 : 0;
 
-    styler.StartSegment(startPos);
-    for (unsigned int i = startPos; i <= lengthDoc; i++)
-    {
-        char ch = chNext;
-        chNext = styler.SafeGetCharAt(i + 1);
+       styler.StartSegment(startPos);
+       for (unsigned int i = startPos; i <= lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
 
-        if (styler.IsLeadByte(ch))
-        {
-            chNext = styler.SafeGetCharAt(i + 2);
-            chPrev = ' ';
-            i += 1;
-            continue;
-        }
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       chPrev = ' ';
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_LUA_STRINGEOL) {
+                       if (ch != '\r' && ch != '\n') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_DEFAULT;
+                       }
+               }
+
+               if (state == SCE_LUA_LITERALSTRING && ch == '[' && chNext == '[') {
+                       literalString++;
+               } else if (state == SCE_LUA_DEFAULT) {
+                       if (ch == '-' && chNext == '-') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_COMMENTLINE;
+                       } else if (ch == '[' && chNext == '[') {
+                               state = SCE_LUA_LITERALSTRING;
+                               literalString = 1;
+                       } else if (ch == '\"') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_STRING;
+                       } else if (ch == '\'') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_CHARACTER;
+                       } else if (ch == '$' && firstChar) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_PREPROCESSOR;
+                       } else if (ch == '#' && firstChar)      // Should be only on the first line of the file! Cannot be tested here
+                       {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_COMMENTLINE;
+                       } else if (isLuaOperator(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i, SCE_LUA_OPERATOR);
+                       } else if (iswordstart(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_LUA_WORD;
+                       }
+               } else if (state == SCE_LUA_WORD) {
+                       if (!iswordchar(ch)) {
+                               classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
+                               state = SCE_LUA_DEFAULT;
+                               if (ch == '[' && chNext == '[') {
+                                       literalString = 1;
+                                       state = SCE_LUA_LITERALSTRING;
+                               } else if (ch == '-' && chNext == '-') {
+                                       state = SCE_LUA_COMMENTLINE;
+                               } else if (ch == '\"') {
+                                       state = SCE_LUA_STRING;
+                               } else if (ch == '\'') {
+                                       state = SCE_LUA_CHARACTER;
+                               } else if (ch == '$' && firstChar) {
+                                       state = SCE_LUA_PREPROCESSOR;
+                               } else if (isLuaOperator(ch)) {
+                                       styler.ColourTo(i, SCE_LUA_OPERATOR);
+                               }
+                       } else if (ch == '.' && chNext == '.') {
+                               classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
+                               styler.ColourTo(i, SCE_LUA_OPERATOR);
+                               state = SCE_LUA_DEFAULT;
+                       }
+               } else {
+                       if (state == SCE_LUA_LITERALSTRING) {
+                               if (ch == ']' && (chPrev == ']') && (--literalString == 0)) {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_LUA_DEFAULT;
+                               }
+                       } else if (state == SCE_LUA_PREPROCESSOR) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LUA_DEFAULT;
+                               }
+                       } else if (state == SCE_LUA_COMMENTLINE) {
+                               if (ch == '\r' || ch == '\n') {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LUA_DEFAULT;
+                               }
+                       } else if (state == SCE_LUA_STRING) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LUA_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\"') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_LUA_DEFAULT;
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               }
+                       } else if (state == SCE_LUA_CHARACTER) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_LUA_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\'') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_LUA_DEFAULT;
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               }
+                       }
+
+                       if (state == SCE_LUA_DEFAULT) {
+                               if (ch == '-' && chNext == '-') {
+                                       state = SCE_LUA_COMMENTLINE;
+                               } else if (ch == '\"') {
+                                       state = SCE_LUA_STRING;
+                               } else if (ch == '\'') {
+                                       state = SCE_LUA_CHARACTER;
+                               } else if (ch == '$' && firstChar) {
+                                       state = SCE_LUA_PREPROCESSOR;
+                               } else if (iswordstart(ch)) {
+                                       state = SCE_LUA_WORD;
+                               } else if (isLuaOperator(ch)) {
+                                       styler.ColourTo(i, SCE_LUA_OPERATOR);
+                               }
+                       }
+               }
+               chPrev = ch;
+               firstChar = (ch == '\r' || ch == '\n');
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+}
 
-        if (state == SCE_LUA_STRINGEOL)
-        {
-            if (ch != '\r' && ch != '\n')
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_DEFAULT;
-            }
-        }
+static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+                       Accessor &styler) {
+       unsigned int lengthDoc = 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);
+       char s[10];
+       for (unsigned int i = startPos; i < lengthDoc; 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_LUA_WORD)
+                       if ( ch == 'e' || ch == 't' || ch == 'd' || ch == 'f') {
+                               for (unsigned int j = 0; j < 8; j++) {
+                                       if (!iswordchar(styler[i + j])) break;
+                                       s[j] = styler[i + j];
+                                       s[j + 1] = '\0';
+                               }
 
-        if (state == SCE_LUA_LITERALSTRING && ch == '[' && chNext == '[')
-        {
-            literalString++;
-        }
-        else
-        if (state == SCE_LUA_DEFAULT)
-        {
-            if (ch == '-' && chNext == '-')
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_COMMENTLINE;
-            }
-            else
-            if (ch == '[' && chNext == '[')
-            {
-                state = SCE_LUA_LITERALSTRING;
-                literalString = 1;
-            }
-            else
-            if (iswordstart(ch))
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_WORD;
-            }
-            else
-            if (ch == '\"')
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_STRING;
-            }
-            else
-            if (ch == '\'')
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_CHARACTER;
-            }
-            else
-            if (ch == '$' && firstChar)
-            {
-                styler.ColourTo(i-1, state);
-                state = SCE_LUA_PREPROCESSOR;
-            }
-            else
-            if (isoperator(ch))
-            {
-                styler.ColourTo(i-1, state);
-                styler.ColourTo(i, SCE_LUA_OPERATOR);
-            }
-        }
-        else
-        if (state == SCE_LUA_WORD)
-        {
-            if (!iswordchar(ch))
-            {
-                classifyWordLua(styler.GetStartSegment(), i - 1, keywords, styler);
-                state = SCE_LUA_DEFAULT;
-                if (ch == '[' && chNext == '[')
-                {
-                    literalString = 1;
-                    state = SCE_LUA_LITERALSTRING;
-                }
-                else
-                if (ch == '-' && chNext == '-')
-                {
-                    state = SCE_LUA_COMMENTLINE;
-                }
-                else
-                if (ch == '\"')
-                {
-                    state = SCE_LUA_STRING;
-                }
-                else
-                if (ch == '\'')
-                {
-                    state = SCE_LUA_CHARACTER;
-                }
-                else
-                if (ch == '$' && firstChar)
-                {
-                    state = SCE_LUA_PREPROCESSOR;
-                }
-                else
-                if (isoperator(ch))
-                {
-                    styler.ColourTo(i, SCE_LUA_OPERATOR);
-                }
-            }
-        }
-        else
-        {
-            if (state == SCE_LUA_LITERALSTRING)
-            {
-                if (ch == ']' && (chPrev == ']') && (--literalString == 0))
-                {
-                    styler.ColourTo(i, state);
-                    state = SCE_LUA_DEFAULT;
-                }
-            }
-            else
-            if (state == SCE_LUA_PREPROCESSOR)
-            {
-                if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
-                {
-                    styler.ColourTo(i-1, state);
-                    state = SCE_LUA_DEFAULT;
-                }
-            }
-            else
-            if (state == SCE_LUA_COMMENTLINE)
-            {
-                if (ch == '\r' || ch == '\n')
-                {
-                    styler.ColourTo(i-1, state);
-                    state = SCE_LUA_DEFAULT;
-                }
-            }
-            else
-            if (state == SCE_LUA_STRING)
-            {
-                if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
-                {
-                    styler.ColourTo(i-1, state);
-                    state = SCE_LUA_STRINGEOL;
-                }
-                else
-                if (ch == '\\')
-                {
-                    if (chNext == '\"' || chNext == '\\')
-                    {
-                        i++;
-                        ch = chNext;
-                        chNext = styler.SafeGetCharAt(i + 1);
-                    }
-                }
-                else
-                if (ch == '\"')
-                {
-                    styler.ColourTo(i, state);
-                    state = SCE_LUA_DEFAULT;
-                    i++;
-                    ch = chNext;
-                    chNext = styler.SafeGetCharAt(i + 1);
-                }
-            }
-            else
-            if (state == SCE_LUA_CHARACTER)
-            {
-                if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
-                {
-                    styler.ColourTo(i-1, state);
-                    state = SCE_LUA_STRINGEOL;
-                }
-                else
-                if (ch == '\\')
-                {
-                    if (chNext == '\'' || chNext == '\\')
-                    {
-                        i++;
-                        ch = chNext;
-                        chNext = styler.SafeGetCharAt(i + 1);
-                    }
-                }
-                else
-                if (ch == '\'')
-                {
-                    styler.ColourTo(i, state);
-                    state = SCE_LUA_DEFAULT;
-                    i++;
-                    ch = chNext;
-                    chNext = styler.SafeGetCharAt(i + 1);
-                }
-            }
+                               if ((strcmp(s, "then") == 0) || (strcmp(s, "do") == 0)
+                                       || (strcmp(s, "function") == 0))
+                                       levelCurrent++;
+                               if (strcmp(s, "end") == 0) levelCurrent--;
+                       }
 
-            if (state == SCE_LUA_DEFAULT)
-            {    
-                if (ch == '-' && chNext == '-')
-                {
-                    state = SCE_LUA_COMMENTLINE;
-                }
-                else
-                if (ch == '\"')
-                {
-                    state = SCE_LUA_STRING;
-                }
-                else
-                if (ch == '\'')
-                {
-                    state = SCE_LUA_CHARACTER;
-                }
-                else
-                if (ch == '$' && firstChar)
-                {
-                    state = SCE_LUA_PREPROCESSOR;
-                }
-                else
-                if (iswordstart(ch))
-                {
-                    state = SCE_LUA_WORD;
-                }
-                else
-                if (isoperator(ch))
-                {
-                    styler.ColourTo(i, SCE_LUA_OPERATOR);
-                }
-            }
-        }
-        chPrev = ch;
-        firstChar = (ch == '\r' || ch == '\n');
-    }
-    styler.ColourTo(lengthDoc - 1, state);
+               if (atEOL) {
+                       int lev = levelPrev;
+                       if (visibleChars == 0)
+                               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 lmLua(SCLEX_LUA, ColouriseLuaDoc);
+LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc, "lua", FoldLuaDoc);
index dd8603368790b11695121b13ea8a6b6f23953880..0814d518c32b1498a8522f058b1ef9695d93486a 100644 (file)
@@ -1,13 +1,16 @@
-// SciTE - Scintilla based Text Editor
-// LexOthers.cxx - lexers for properties files, batch files, make files and error lists
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexOthers.cxx
+ ** Lexers for batch files, diff results, properties files, make files and error lists.
+ ** Also lexer for LaTeX documents.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-static void ColouriseBatchLine(char *lineBuffer, int endLine, Accessor &styler) {
-       if (0 == strncmp(lineBuffer, "REM", 3)) {
-               styler.ColourTo(endLine, 1);
-       } else if (0 == strncmp(lineBuffer, "rem", 3)) {
-               styler.ColourTo(endLine, 1);
-       } else if (0 == strncmp(lineBuffer, "SET", 3)) {
-               styler.ColourTo(endLine, 2);
-       } else if (0 == strncmp(lineBuffer, "set", 3)) {
-               styler.ColourTo(endLine, 2);
-       } else if (lineBuffer[0] == ':') {
-               styler.ColourTo(endLine, 3);
+static void ColouriseBatchLine(
+    char *lineBuffer,
+    unsigned int lengthLine,
+    unsigned int startLine,
+    unsigned int endPos,
+    WordList &keywords,
+    Accessor &styler) {
+
+       unsigned int i = 0;
+       unsigned int state = SCE_BAT_DEFAULT;
+
+       while (isspacechar(lineBuffer[i]) && (i < lengthLine)) {        // Skip initial spaces
+               i++;
+       }
+       if (lineBuffer[i] == '@') {     // Hide command (ECHO OFF)
+               styler.ColourTo(startLine + i, SCE_BAT_HIDE);
+               i++;
+               while (isspacechar(lineBuffer[i]) && (i < lengthLine)) {        // Skip next spaces
+                       i++;
+               }
+       }
+       if (lineBuffer[i] == ':') {
+               // Label
+               if (lineBuffer[i + 1] == ':') {
+                       // :: is a fake label, similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
+                       styler.ColourTo(endPos, SCE_BAT_COMMENT);
+               } else {        // Real label
+                       styler.ColourTo(endPos, SCE_BAT_LABEL);
+               }
        } else {
-               styler.ColourTo(endLine, 0);
+               // Check if initial word is a keyword
+               char wordBuffer[21];
+               unsigned int wbl = 0, offset = i;
+               // Copy word in buffer
+               for (; offset < lengthLine && wbl < 20 &&
+                       !isspacechar(lineBuffer[offset]); wbl++, offset++) {
+                       wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset]));
+               }
+               wordBuffer[wbl] = '\0';
+               // Check if it is a comment
+               if (CompareCaseInsensitive(wordBuffer, "rem") == 0) {
+                       styler.ColourTo(endPos, SCE_BAT_COMMENT);
+                       return ;
+               }
+               // Check if it is in the list
+               if (keywords.InList(wordBuffer)) {
+                       styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD);  // Regular keyword
+               } else {
+                       // Search end of word (can be a long path)
+                       while (offset < lengthLine &&
+                               !isspacechar(lineBuffer[offset])) {
+                               offset++;
+                       }
+                       styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);       // External command / program
+               }
+               // Remainder of the line: colourise the variables.
+
+               while (offset < lengthLine) {
+                       if (state == SCE_BAT_DEFAULT && lineBuffer[offset] == '%') {
+                               styler.ColourTo(startLine + offset - 1, state);
+                               if (isdigit(lineBuffer[offset + 1])) {
+                                       styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
+                                       offset += 2;
+                               } else if (lineBuffer[offset + 1] == '%' &&
+                                          !isspacechar(lineBuffer[offset + 2])) {
+                                       // Should be safe, as there is CRLF at the end of the line...
+                                       styler.ColourTo(startLine + offset + 2, SCE_BAT_IDENTIFIER);
+                                       offset += 3;
+                               } else {
+                                       state = SCE_BAT_IDENTIFIER;
+                               }
+                       } else if (state == SCE_BAT_IDENTIFIER && lineBuffer[offset] == '%') {
+                               styler.ColourTo(startLine + offset, state);
+                               state = SCE_BAT_DEFAULT;
+                       } else if (state == SCE_BAT_DEFAULT &&
+                                  (lineBuffer[offset] == '*' ||
+                                   lineBuffer[offset] == '?' ||
+                                   lineBuffer[offset] == '=' ||
+                                   lineBuffer[offset] == '<' ||
+                                   lineBuffer[offset] == '>' ||
+                                   lineBuffer[offset] == '|')) {
+                               styler.ColourTo(startLine + offset - 1, state);
+                               styler.ColourTo(startLine + offset, SCE_BAT_OPERATOR);
+                       }
+                       offset++;
+               }
+               //              if (endPos > startLine + offset - 1) {
+               styler.ColourTo(endPos, SCE_BAT_DEFAULT);               // Remainder of line, currently not lexed
+               //              }
        }
+
 }
+// ToDo: (not necessarily at beginning of line) GOTO, [IF] NOT, ERRORLEVEL
+// IF [NO] (test) (command) -- test is EXIST (filename) | (string1)==(string2) | ERRORLEVEL (number)
+// FOR %%(variable) IN (set) DO (command) -- variable is [a-zA-Z] -- eg for %%X in (*.txt) do type %%X
+// ToDo: %n (parameters), %EnvironmentVariable% colourising
+// ToDo: Colourise = > >> < | "
+
+static void ColouriseBatchDoc(
+    unsigned int startPos,
+    int length,
+    int /*initStyle*/,
+    WordList *keywordlists[],
+    Accessor &styler) {
 
-static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
        char lineBuffer[1024];
+       WordList &keywords = *keywordlists[0];
+
        styler.StartAt(startPos);
        styler.StartSegment(startPos);
-       unsigned int linePos = 0;
-       for (unsigned int i = startPos; i < startPos + length; i++) {
+       unsigned int linePos = 0, startLine = startPos;
+       for (unsigned int i = startPos; i <= startPos + length; i++) {
                lineBuffer[linePos++] = styler[i];
-               if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
-                       ColouriseBatchLine(lineBuffer, i, styler);
+               if (styler[i] == '\r' || styler[i] == '\n' || (linePos >=
+                       sizeof(lineBuffer) - 1)) {
+                       // End of line (or of line buffer) met, colourise it
+                       if (styler[i + 1] == '\n') {
+                               lineBuffer[linePos++] = styler[++i];
+                       }
+                       lineBuffer[linePos] = '\0';
+                       ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywords, styler);
                        linePos = 0;
+                       startLine = i + 1;
                }
        }
-       if (linePos > 0)
-               ColouriseBatchLine(lineBuffer, startPos + length, styler);
+       if (linePos > 0) {
+               ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length,
+                                  keywords, styler);
+       }
 }
 
 static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
@@ -89,25 +191,32 @@ static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[
                ColouriseDiffLine(lineBuffer, startPos + length, styler);
 }
 
-static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, Accessor &styler) {
-       int i = 0;
-       while (isspace(lineBuffer[i]) && (i < lengthLine))      // Skip initial spaces
+static void ColourisePropsLine(
+    char *lineBuffer,
+    unsigned int lengthLine,
+    unsigned int startLine,
+    unsigned int endPos,
+    Accessor &styler) {
+
+       unsigned int i = 0;
+       while (isspacechar(lineBuffer[i]) && (i < lengthLine))  // Skip initial spaces
                i++;
        if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
                styler.ColourTo(endPos, 1);
        } else if (lineBuffer[i] == '[') {
                styler.ColourTo(endPos, 2);
        } else if (lineBuffer[i] == '@') {
-               styler.ColourTo(startLine+i, 4);
+               styler.ColourTo(startLine + i, 4);
                if (lineBuffer[++i] == '=')
-                       styler.ColourTo(startLine+i, 3);
+                       styler.ColourTo(startLine + i, 3);
                styler.ColourTo(endPos, 0);
        } else {
-               while (lineBuffer[i] != '=' && (i < lengthLine))        // Search the '=' character
+               // Search for the '=' character
+               while (lineBuffer[i] != '=' && (i < lengthLine - 1))
                        i++;
                if (lineBuffer[i] == '=') {
-                       styler.ColourTo(startLine+i-1, 0);
-                       styler.ColourTo(startLine+i, 3);
+                       styler.ColourTo(startLine + i - 1, 0);
+                       styler.ColourTo(startLine + i, 3);
                        styler.ColourTo(endPos, 0);
                } else {
                        styler.ColourTo(endPos, 0);
@@ -119,31 +228,77 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *
        char lineBuffer[1024];
        styler.StartAt(startPos);
        styler.StartSegment(startPos);
-       unsigned int linePos = 0;
-       int startLine = startPos;
+       unsigned int linePos = 0, startLine = startPos;
        for (unsigned int i = startPos; i <= startPos + length; i++) {
                lineBuffer[linePos++] = styler[i];
-               if ((styler[i] == '\r' && styler.SafeGetCharAt(i+1) != '\n') || 
-                       styler[i] == '\n' || 
-                       (linePos >= sizeof(lineBuffer) - 1)) {
+               if ((styler[i] == '\r' && styler.SafeGetCharAt(i + 1) != '\n') ||
+                       styler[i] == '\n' ||
+                       (linePos >= sizeof(lineBuffer) - 1)) {
                        lineBuffer[linePos] = '\0';
                        ColourisePropsLine(lineBuffer, linePos, startLine, i, styler);
                        linePos = 0;
-                       startLine = i+1;
+                       startLine = i + 1;
                }
        }
        if (linePos > 0)
                ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length, styler);
 }
 
-static void ColouriseMakeLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) {
-       int i = 0;
-       while (isspace(lineBuffer[i]) && (i < lengthLine))
+static void ColouriseMakeLine(
+    char *lineBuffer,
+    unsigned int lengthLine,
+    unsigned int startLine,
+    unsigned int endPos,
+    Accessor &styler) {
+
+       unsigned int i = 0;
+        unsigned int lastNonSpace = 0;
+       unsigned int state = SCE_MAKE_DEFAULT;
+       bool bSpecial = false;
+       // Skip initial spaces
+       while (isspacechar(lineBuffer[i]) && (i < lengthLine)) {
                i++;
-       if (lineBuffer[i] == '#' || lineBuffer[i] == '!') {
-               styler.ColourTo(endPos, 1);
+       }
+       if (lineBuffer[i] == '#') {     // Comment
+               styler.ColourTo(endPos, SCE_MAKE_COMMENT);
+               return;
+       }
+       if (lineBuffer[i] == '!') {     // Special directive
+               styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR);
+               return;
+       }
+       while (i < lengthLine) {
+               if (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(') {
+                       styler.ColourTo(startLine + i - 1, state);
+                       state = SCE_MAKE_IDENTIFIER;
+               } else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') {
+                       styler.ColourTo(startLine + i, state);
+                       state = SCE_MAKE_DEFAULT;
+               }
+               if (!bSpecial) {
+                       if (lineBuffer[i] == ':') {
+                               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] == '=') {
+                               styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER);
+                               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;
+                       }
+               }
+               if (!isspacechar(lineBuffer[i])) {
+                       lastNonSpace = i;
+               }
+               i++;
+       }
+       if (state == SCE_MAKE_IDENTIFIER) {
+               styler.ColourTo(endPos, SCE_MAKE_IDEOL);        // Error, variable reference not ended
        } else {
-               styler.ColourTo(endPos, 0);
+               styler.ColourTo(endPos, SCE_MAKE_DEFAULT);
        }
 }
 
@@ -151,22 +306,38 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[
        char lineBuffer[1024];
        styler.StartAt(startPos);
        styler.StartSegment(startPos);
-       unsigned int linePos = 0;
+       unsigned int linePos = 0, startLine = startPos;
        for (unsigned int i = startPos; i <= startPos + length; i++) {
                lineBuffer[linePos++] = styler[i];
                if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) {
-                       ColouriseMakeLine(lineBuffer, linePos, i, styler);
+                       lineBuffer[linePos] = '\0';
+                       ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler);
                        linePos = 0;
+                       startLine = i + 1;
                }
        }
-       if (linePos > 0)
-               ColouriseMakeLine(lineBuffer, linePos, startPos + length, styler);
+       if (linePos > 0) {
+               ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length, styler);
+       }
 }
 
-static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos, Accessor &styler) {
+static void ColouriseErrorListLine(
+    char *lineBuffer,
+    unsigned int lengthLine,
+    //         unsigned int startLine,
+    unsigned int endPos,
+    Accessor &styler) {
        if (lineBuffer[0] == '>') {
                // Command or return status
                styler.ColourTo(endPos, SCE_ERR_CMD);
+       } else if (lineBuffer[0] == '!') {
+               styler.ColourTo(endPos, SCE_ERR_DIFF_CHANGED);
+       } else if (lineBuffer[0] == '+') {
+               styler.ColourTo(endPos, SCE_ERR_DIFF_ADDITION);
+       } else if (lineBuffer[0] == '-' && lineBuffer[1] == '-' && lineBuffer[2] == '-') {
+               styler.ColourTo(endPos, SCE_ERR_DIFF_MESSAGE);
+       } else if (lineBuffer[0] == '-') {
+               styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION);
        } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
                styler.ColourTo(endPos, SCE_ERR_PYTHON);
        } else if (0 == strncmp(lineBuffer, "Error ", strlen("Error "))) {
@@ -175,18 +346,28 @@ static void ColouriseErrorListLine(char *lineBuffer, int lengthLine, int endPos,
        } else if (0 == strncmp(lineBuffer, "Warning ", strlen("Warning "))) {
                // Borland warning message
                styler.ColourTo(endPos, SCE_ERR_BORLAND);
-       } else if (strstr(lineBuffer, " at "  ) && 
-               strstr(lineBuffer, " at "  ) < lineBuffer+lengthLine && 
-               strstr(lineBuffer, " line ") && 
-               strstr(lineBuffer, " line ") < lineBuffer+lengthLine) {
+       } else if (strstr(lineBuffer, "at line " ) &&
+                  strstr(lineBuffer, "at line " ) < lineBuffer + lengthLine &&
+                  strstr(lineBuffer, "file ") &&
+                  strstr(lineBuffer, "file ") < lineBuffer + lengthLine) {
+               // Lua error message
+               styler.ColourTo(endPos, SCE_ERR_LUA);
+       } else if (strstr(lineBuffer, " at " ) &&
+                  strstr(lineBuffer, " at " ) < lineBuffer + lengthLine &&
+                  strstr(lineBuffer, " line ") &&
+                  strstr(lineBuffer, " line ") < lineBuffer + lengthLine) {
                // perl error message
                styler.ColourTo(endPos, SCE_ERR_PERL);
+       } else if ((memcmp(lineBuffer, "   at ", 6) == 0) &&
+               strstr(lineBuffer, ":line ")) {
+               // A .NET traceback
+               styler.ColourTo(endPos, SCE_ERR_NET);
        } else {
                // Look for <filename>:<line>:message
                // Look for <filename>(line)message
                // Look for <filename>(line,pos)message
                int state = 0;
-               for (int i = 0; i < lengthLine; i++) {
+               for (unsigned int i = 0; i < lengthLine; i++) {
                        if (state == 0 && lineBuffer[i] == ':' && isdigit(lineBuffer[i + 1])) {
                                state = 1;
                        } else if (state == 0 && lineBuffer[i] == '(') {
@@ -240,15 +421,13 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi
 }
 
 static int isSpecial(char s) {
-
        return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') ||
               (s == '\"') || (s == '`') || (s == '^') || (s == '~');
 }
 
 static int isTag(int start, Accessor &styler) {
-
        char s[6];
-       unsigned int i = 0, e=1;
+       unsigned int i = 0, e = 1;
        while (i < 5 && e) {
                s[i] = styler[start + i];
                i++;
@@ -259,7 +438,7 @@ static int isTag(int start, Accessor &styler) {
 }
 
 static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
-                          WordList *[], Accessor &styler) {
+                              WordList *[], Accessor &styler) {
 
        styler.StartAt(startPos);
 
@@ -277,75 +456,74 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
                        i++;
                        continue;
                }
-               switch(state) {
-                       case SCE_L_DEFAULT :
-                               switch(ch) {
-                                       case '\\' :
-                                               styler.ColourTo(i - 1, state);
-                                               if (isSpecial(styler[i + 1])) {
-                                                       styler.ColourTo(i + 1, SCE_L_COMMAND);
-                                                       i++;
-                                                       chNext = styler.SafeGetCharAt(i + 1);
-                                               }               
-                                               else {
-                                                   if (isTag(i+1, styler))
-                                                       state = SCE_L_TAG;
-                                                   else
-                                                       state = SCE_L_COMMAND;
-                                               }
-                                               break;
-                                       case '$' :
-                                               styler.ColourTo(i - 1, state);
-                                               state = SCE_L_MATH;
-                                               if (chNext == '$') {
-                                                       i++;
-                                                       chNext = styler.SafeGetCharAt(i + 1);
-                                               }
-                                               break;
-                                       case '%' :
-                                               styler.ColourTo(i - 1, state);
-                                               state = SCE_L_COMMENT;
-                                               break;
-                               }
-                               break;                          
-                       case SCE_L_COMMAND :
-                               if (chNext == '[' || chNext == '{' || chNext == '}' || 
-                                   chNext == ' ' || chNext == '\r' || chNext == '\n') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_L_DEFAULT;
+               switch (state) {
+               case SCE_L_DEFAULT :
+                       switch (ch) {
+                       case '\\' :
+                               styler.ColourTo(i - 1, state);
+                               if (isSpecial(styler[i + 1])) {
+                                       styler.ColourTo(i + 1, SCE_L_COMMAND);
                                        i++;
                                        chNext = styler.SafeGetCharAt(i + 1);
-                               }
-                               break;                                  
-                       case SCE_L_TAG :
-                               if (ch == '}') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_L_DEFAULT;
+                               } else {
+                                       if (isTag(i + 1, styler))
+                                               state = SCE_L_TAG;
+                                       else
+                                               state = SCE_L_COMMAND;
                                }
                                break;
-                       case SCE_L_MATH :
-                               if (ch == '$') {
-                                       if (chNext == '$') {
-                                               i++;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       }
-                                       styler.ColourTo(i, state);
-                                       state = SCE_L_DEFAULT;
+                       case '$' :
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_L_MATH;
+                               if (chNext == '$') {
+                                       i++;
+                                       chNext = styler.SafeGetCharAt(i + 1);
                                }
                                break;
-                       case SCE_L_COMMENT :
-                               if (ch == '\r' || ch == '\n') {
-                                       styler.ColourTo(i - 1, state);
-                                       state = SCE_L_DEFAULT;
+                       case '%' :
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_L_COMMENT;
+                               break;
+                       }
+                       break;
+               case SCE_L_COMMAND :
+                       if (chNext == '[' || chNext == '{' || chNext == '}' ||
+                               chNext == ' ' || chNext == '\r' || chNext == '\n') {
+                               styler.ColourTo(i, state);
+                               state = SCE_L_DEFAULT;
+                               i++;
+                               chNext = styler.SafeGetCharAt(i + 1);
+                       }
+                       break;
+               case SCE_L_TAG :
+                       if (ch == '}') {
+                               styler.ColourTo(i, state);
+                               state = SCE_L_DEFAULT;
+                       }
+                       break;
+               case SCE_L_MATH :
+                       if (ch == '$') {
+                               if (chNext == '$') {
+                                       i++;
+                                       chNext = styler.SafeGetCharAt(i + 1);
                                }
-               }               
+                               styler.ColourTo(i, state);
+                               state = SCE_L_DEFAULT;
+                       }
+                       break;
+               case SCE_L_COMMENT :
+                       if (ch == '\r' || ch == '\n') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_L_DEFAULT;
+                       }
+               }
        }
        styler.ColourTo(lengthDoc, state);
 }
 
-LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc);
-LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc);
-LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc);
-LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc);
-LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc);
-LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc);
+LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch");
+LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff");
+LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props");
+LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile");
+LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist");
+LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex");
diff --git a/src/stc/scintilla/src/LexPascal.cxx b/src/stc/scintilla/src/LexPascal.cxx
new file mode 100644 (file)
index 0000000..acc38b5
--- /dev/null
@@ -0,0 +1,222 @@
+// Scintilla source code edit control
+/** @file LexPascal.cxx
+ ** Lexer for Pascal.
+ ** Written by Laurent le Tynevez
+ **/
+
+#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"
+
+
+static int classifyWordPascal(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
+       char s[100];
+       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+               s[i] = static_cast<char>(tolower(styler[start + i]));
+               s[i + 1] = '\0';
+       }
+       int lev= 0;
+       char chAttr = SCE_C_IDENTIFIER;
+       if (isdigit(s[0]) || (s[0] == '.')){
+               chAttr = SCE_C_NUMBER;
+       }
+       else {
+               if (keywords.InList(s)) {
+                       chAttr = SCE_C_WORD;
+                       if (strcmp(s, "begin") == 0 || strcmp(s, "object") == 0)
+                               lev=1;
+                       else if (strcmp(s, "end") == 0)
+                               lev=-1;
+               }
+       }
+       styler.ColourTo(end, chAttr);
+       return lev;
+}
+
+static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+       Accessor &styler) {
+       WordList &keywords = *keywordlists[0];
+
+       styler.StartAt(startPos);
+
+       bool fold = styler.GetPropertyInt("fold");
+       int lineCurrent = styler.GetLine(startPos);
+       int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+       int levelCurrent = levelPrev;
+
+       int state = initStyle;
+       if (state == SCE_C_STRINGEOL)   // Does not leak onto next line
+               state = SCE_C_DEFAULT;
+       char chPrev = ' ';
+       char chNext = styler[startPos];
+       unsigned int lengthDoc = startPos + length;
+       int visibleChars = 0;
+       styler.StartSegment(startPos);
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
+                       // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+                       // Avoid triggering two times on Dos/Win
+                       // End of line
+                       if (state == SCE_C_STRINGEOL) {
+                               styler.ColourTo(i, state);
+                               state = SCE_C_DEFAULT;
+                       }
+                       if (fold) {
+                               int lev = levelPrev;
+                               if (visibleChars == 0)
+                                       lev |= SC_FOLDLEVELWHITEFLAG;
+                               if ((levelCurrent > levelPrev) && (visibleChars > 0))
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               styler.SetLevel(lineCurrent, lev);
+                               lineCurrent++;
+                               levelPrev = levelCurrent;
+                       }
+                       visibleChars = 0;
+               }
+               if (!isspacechar(ch))
+                       visibleChars++;
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       chPrev = ' ';
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_C_DEFAULT) {
+                       if (iswordstart(ch) || (ch == '@')) {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_IDENTIFIER;
+                       } else if (ch == '{' && chNext != '$' && chNext != '&') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_COMMENT;
+                       } else if (ch == '(' && chNext == '*'
+                                               && styler.SafeGetCharAt(i + 2) != '$'
+                                               && styler.SafeGetCharAt(i + 2) != '&') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_COMMENTDOC;
+                       } else if (ch == '/' && chNext == '/') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_COMMENTLINE;
+                       } else if (ch == '\"') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_STRING;
+                       } else if (ch == '\'') {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_CHARACTER;
+                       } else if (ch == '{' && (chNext == '$' || chNext=='&') && visibleChars == 1) {
+                               styler.ColourTo(i-1, state);
+                               state = SCE_C_PREPROCESSOR;
+                       } else if (isoperator(ch)) {
+                               styler.ColourTo(i-1, state);
+                               styler.ColourTo(i, SCE_C_OPERATOR);
+
+                       }
+               } else if (state == SCE_C_IDENTIFIER) {
+                       if (!iswordchar(ch)) {
+                               int levelChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywords, styler);
+                               state = SCE_C_DEFAULT;
+                               chNext = styler.SafeGetCharAt(i + 1);
+                               if (ch == '{' && chNext != '$' && chNext != '&') {
+                                       state = SCE_C_COMMENT;
+                               } else if (ch == '(' && chNext == '*'
+                                               && styler.SafeGetCharAt(i + 2) != '$'
+                                               && styler.SafeGetCharAt(i + 2) != '&') {
+                                       styler.ColourTo(i-1, state);
+                                       state = SCE_C_COMMENTDOC;
+                               } else if (ch == '/' && chNext == '/') {
+                                       state = SCE_C_COMMENTLINE;
+                               } else if (ch == '\"') {
+                                       state = SCE_C_STRING;
+                               } else if (ch == '\'') {
+                                       state = SCE_C_CHARACTER;
+                               } else if (isoperator(ch)) {
+                                       styler.ColourTo(i, SCE_C_OPERATOR);
+                               }
+                               levelCurrent+=levelChange;
+                       }
+               } else {
+                       if (state == SCE_C_PREPROCESSOR) {
+                               if (ch=='}'){
+                                       styler.ColourTo(i, state);
+                                       state = SCE_C_DEFAULT;
+                               } else {
+                                       if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
+                                               styler.ColourTo(i-1, state);
+                                               state = SCE_C_DEFAULT;
+                                       }
+                               }
+                       } else if (state == SCE_C_COMMENT) {
+                               if (ch == '}' ) {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_C_DEFAULT;
+                               }
+                       } else if (state == SCE_C_COMMENTDOC) {
+                               if (ch == ')' && chPrev == '*') {
+                                       if (((i > styler.GetStartSegment() + 2) || (
+                                               (initStyle == SCE_C_COMMENTDOC) &&
+                                               (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
+                                                       styler.ColourTo(i, state);
+                                                       state = SCE_C_DEFAULT;
+                                       }
+                               }
+                       } else if (state == SCE_C_COMMENTLINE) {
+                               if (ch == '\r' || ch == '\n') {
+                                       styler.ColourTo(i-1, state);
+                                       state = SCE_C_DEFAULT;
+                               }
+                       } else if (state == SCE_C_STRING) {
+                               if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\"') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_C_DEFAULT;
+                               } else if (chNext == '\r' || chNext == '\n') {
+                                       styler.ColourTo(i-1, SCE_C_STRINGEOL);
+                                       state = SCE_C_STRINGEOL;
+                               }
+                       } else if (state == SCE_C_CHARACTER) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i-1, SCE_C_STRINGEOL);
+                                       state = SCE_C_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\'') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_C_DEFAULT;
+                               }
+                       }
+               }
+               chPrev = ch;
+       }
+       styler.ColourTo(lengthDoc - 1, state);
+
+       // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+       if (fold) {
+               int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+               styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+       }
+}
+
+LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal");
index a7186fe5525641672f16b746da4cbdc68830aec1..590d05d2a3de5dd9c526a7d025a58db6c6ecd220 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexPerl.cxx - lexer for subset of Perl
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexPerl.cxx
+ ** Lexer for subset of Perl.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-inline bool isPerlOperator(char ch) {
+static inline bool isEOLChar(char ch) {
+       return (ch == '\r') || (ch == '\n');
+}
+
+static bool isSingleCharOp(char ch) {
+       char strCharSet[2];
+       strCharSet[0] = ch;
+       strCharSet[1] = '\0';
+       return (NULL != strstr("rwxoRWXOezsfdlpSbctugkTBMAC", strCharSet));
+}
+
+static inline bool isPerlOperator(char ch) {
        if (isalnum(ch))
                return false;
        // '.' left out as it is used to make up numbers
@@ -49,7 +62,7 @@ static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keyw
        return chAttr;
 }
 
-static bool isEndVar(char ch) {
+static inline bool isEndVar(char ch) {
        return !isalnum(ch) && ch != '#' && ch != '$' &&
               ch != '_' && ch != '\'';
 }
@@ -85,32 +98,86 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
        // Lexer for perl often has to backtrack to start of current style to determine
        // which characters are being used as quotes, how deeply nested is the
        // start position and what the termination string is for here documents
-       
+
        WordList &keywords = *keywordlists[0];
-       
+
+       class HereDocCls {
+       public:
+               int State;              // 0: '<<' encountered
+               // 1: collect the delimiter
+               // 2: here doc text (lines after the delimiter)
+               char Quote;             // the char after '<<'
+               bool Quoted;            // true if Quote in ('\'','"','`')
+               int DelimiterLength;    // strlen(Delimiter)
+               char Delimiter[256];    // the Delimiter, 256: sizeof PL_tokenbuf
+               HereDocCls() {
+                       State = 0;
+                       DelimiterLength = 0;
+                       Delimiter[0] = '\0';
+               }
+       };
+       HereDocCls HereDoc;     // TODO: FIFO for stacked here-docs
+
+       class QuoteCls {
+               public:
+               int  Rep;
+               int  Count;
+               char Up;
+               char Down;
+               QuoteCls() {
+                       this->New(1);
+               }
+               void New(int r) {
+                       Rep   = r;
+                       Count = 0;
+                       Up    = '\0';
+                       Down  = '\0';
+               }
+               void Open(char u) {
+                       Count++;
+                       Up    = u;
+                       Down  = opposite(Up);
+               }
+       };
+       QuoteCls Quote;
+
        char sooked[100];
-       int quotes = 0;
-       char quoteDown = 'd';
-       char quoteUp = 'd';
-       int quoteRep = 1;
        int sookedpos = 0;
        bool preferRE = true;
        sooked[sookedpos] = '\0';
        int state = initStyle;
-       int lengthDoc = startPos + length;
+       unsigned int lengthDoc = startPos + length;
+
        // If in a long distance lexical state, seek to the beginning  to find quote characters
-       if (state == SCE_PL_HERE || state == SCE_PL_REGEX || 
-               state == SCE_PL_REGSUBST || state == SCE_PL_LONGQUOTE) {
+       if (state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX) {
+               while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_PL_HERE_DELIM)) {
+                       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
+       || state == SCE_PL_STRING_QR
+       || state == SCE_PL_STRING_QW
+       || state == SCE_PL_REGEX
+       || state == SCE_PL_REGSUBST
+       ) {
                while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
                        startPos--;
                }
                state = SCE_PL_DEFAULT;
        }
+
        styler.StartAt(startPos);
        char chPrev = styler.SafeGetCharAt(startPos - 1);
+       if (startPos == 0)
+               chPrev = '\n';
        char chNext = styler[startPos];
        styler.StartSegment(startPos);
-       for (int i = startPos; i < lengthDoc; i++) {
+
+       for (unsigned int i = startPos; i < lengthDoc; i++) {
                char ch = chNext;
                chNext = styler.SafeGetCharAt(i + 1);
                char chNext2 = styler.SafeGetCharAt(i + 2);
@@ -121,41 +188,81 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                        i += 1;
                        continue;
                }
+               if ((chPrev == '\r' && ch == '\n')) {   // skip on DOS/Windows
+                       chPrev = ch;
+                       continue;
+               }
+
+               if (HereDoc.State == 1 && isEOLChar(ch)) {
+                       // Begin of here-doc (the line after the here-doc delimiter):
+                       HereDoc.State = 2;
+                       styler.ColourTo(i - 1, state);
+                       if (HereDoc.Quoted) {
+                               if (state == SCE_PL_HERE_DELIM) {
+                                       // Missing quote at end of string! We are stricter than perl.
+                                       state = SCE_PL_ERROR;
+                               } else {
+                                       switch (HereDoc.Quote) {
+                                       case '\'':
+                                               state = SCE_PL_HERE_Q ;
+                                               break;
+                                       case '"':
+                                               state = SCE_PL_HERE_QQ;
+                                               break;
+                                       case '`':
+                                               state = SCE_PL_HERE_QX;
+                                               break;
+                                       }
+                               }
+                       } else {
+                               switch (HereDoc.Quote) {
+                               case '\\':
+                                       state = SCE_PL_HERE_Q ;
+                                       break;
+                               default :
+                                       state = SCE_PL_HERE_QQ;
+                               }
+                       }
+               }
 
                if (state == SCE_PL_DEFAULT) {
                        if (iswordstart(ch)) {
                                styler.ColourTo(i - 1, state);
                                if (ch == 's' && !isalnum(chNext)) {
                                        state = SCE_PL_REGSUBST;
-                                       quotes = 0;
-                                       quoteUp = '\0';
-                                       quoteDown = '\0';
-                                       quoteRep = 2;
+                                       Quote.New(2);
                                } else if (ch == 'm' && !isalnum(chNext)) {
                                        state = SCE_PL_REGEX;
-                                       quotes = 0;
-                                       quoteUp = '\0';
-                                       quoteDown = '\0';
-                                       quoteRep = 1;
+                                       Quote.New(1);
+                               } else if (ch == 'q' && !isalnum(chNext)) {
+                                       state = SCE_PL_STRING_Q;
+                                       Quote.New(1);
+                               } else if (ch == 'y' && !isalnum(chNext)) {
+                                       state = SCE_PL_REGSUBST;
+                                       Quote.New(2);
                                } else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) {
                                        state = SCE_PL_REGSUBST;
-                                       quotes = 0;
-                                       quoteUp = '\0';
-                                       quoteDown = '\0';
-                                       quoteRep = 2;
+                                       Quote.New(2);
                                        i++;
                                        chNext = chNext2;
                                } else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) {
-                                       state = SCE_PL_LONGQUOTE;
+                                       if      (chNext == 'q') state = SCE_PL_STRING_QQ;
+                                       else if (chNext == 'x') state = SCE_PL_STRING_QX;
+                                       else if (chNext == 'r') state = SCE_PL_STRING_QR;
+                                       else if (chNext == 'w') state = SCE_PL_STRING_QW;
                                        i++;
                                        chNext = chNext2;
-                                       quotes = 0;
-                                       quoteUp = '\0';
-                                       quoteDown = '\0';
-                                       quoteRep = 1;
+                                       Quote.New(1);
                                } else {
                                        state = SCE_PL_WORD;
                                        preferRE = false;
+                                       if ((!iswordchar(chNext) && chNext != '\'')
+                                               || (chNext == '.' && chNext2 == '.')) {
+                                               // We need that if length of word == 1!
+                                               // This test is copied from the SCE_PL_WORD handler.
+                                               classifyWordPerl(styler.GetStartSegment(), i, keywords, styler);
+                                               state = SCE_PL_DEFAULT;
+                                       }
                                }
                        } else if (ch == '#') {
                                styler.ColourTo(i - 1, state);
@@ -163,6 +270,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                        } else if (ch == '\"') {
                                styler.ColourTo(i - 1, state);
                                state = SCE_PL_STRING;
+                               Quote.New(1);
+                               Quote.Open(ch);
                        } else if (ch == '\'') {
                                if (chPrev == '&') {
                                        // Archaic call
@@ -170,22 +279,24 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                } else {
                                        styler.ColourTo(i - 1, state);
                                        state = SCE_PL_CHARACTER;
+                                       Quote.New(1);
+                                       Quote.Open(ch);
                                }
                        } else if (ch == '`') {
                                styler.ColourTo(i - 1, state);
                                state = SCE_PL_BACKTICKS;
+                               Quote.New(1);
+                               Quote.Open(ch);
                        } else if (ch == '$') {
                                preferRE = false;
                                styler.ColourTo(i - 1, state);
-                               if (isalnum(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
-                                       state = SCE_PL_SCALAR;
-                               } else if (chNext != '{' && chNext != '[') {
+                               if ((chNext == '{') || isspacechar(chNext)) {
                                        styler.ColourTo(i, SCE_PL_SCALAR);
-                                       i++;
-                                       ch = ' ';
-                                       chNext = ' ';
                                } else {
-                                       styler.ColourTo(i, SCE_PL_SCALAR);
+                                       state = SCE_PL_SCALAR;
+                                       i++;
+                                       ch = chNext;
+                                       chNext = chNext2;
                                }
                        } else if (ch == '@') {
                                preferRE = false;
@@ -204,12 +315,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                styler.ColourTo(i - 1, state);
                                if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
                                        state = SCE_PL_HASH;
-                               } else if (chNext != '{' && chNext != '[') {
+                               } else if (chNext == '{') {
                                        styler.ColourTo(i, SCE_PL_HASH);
-                                       i++;
-                                       ch = ' ';
                                } else {
-                                       styler.ColourTo(i, SCE_PL_HASH);
+                                       styler.ColourTo(i, SCE_PL_OPERATOR);
                                }
                        } else if (ch == '*') {
                                styler.ColourTo(i - 1, state);
@@ -217,25 +326,29 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                        } else if (ch == '/' && preferRE) {
                                styler.ColourTo(i - 1, state);
                                state = SCE_PL_REGEX;
-                               quoteUp = '/';
-                               quoteDown = '/';
-                               quotes = 1;
-                               quoteRep = 1;
+                               Quote.New(1);
+                               Quote.Open(ch);
                        } else if (ch == '<' && chNext == '<') {
                                styler.ColourTo(i - 1, state);
-                               state = SCE_PL_HERE;
-                               i++;
-                               ch = chNext;
-                               chNext = chNext2;
-                               quotes = 0;
-                               sookedpos = 0;
-                               sooked[sookedpos] = '\0';
-                       } else if (ch == '=' && (chPrev == '\r' || chPrev == '\n') && isalpha(chNext)) {
+                               state = SCE_PL_HERE_DELIM;
+                               HereDoc.State = 0;
+                       } else if (ch == '='
+                                  && isalpha(chNext)
+                                  && (isEOLChar(chPrev))) {
                                styler.ColourTo(i - 1, state);
                                state = SCE_PL_POD;
-                               quotes = 0;
                                sookedpos = 0;
                                sooked[sookedpos] = '\0';
+                       } else if (ch == '-'
+                                  && isSingleCharOp(chNext)
+                                  && !isalnum((chNext2 = styler.SafeGetCharAt(i+2)))) {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i + 1, SCE_PL_WORD);
+                               state = SCE_PL_DEFAULT;
+                               preferRE = false;
+                               i += 2;
+                               ch = chNext2;
+                               chNext = chNext2 = styler.SafeGetCharAt(i + 1);
                        } else if (isPerlOperator(ch)) {
                                if (ch == ')' || ch == ']')
                                        preferRE = false;
@@ -245,7 +358,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                styler.ColourTo(i, SCE_PL_OPERATOR);
                        }
                } else if (state == SCE_PL_WORD) {
-                       if (!iswordchar(ch) && ch != '\'') {    // Archaic Perl has quotes inside names
+                       if ((!iswordchar(chNext) && chNext != '\'')
+                               || (chNext == '.' && chNext2 == '.')) {
+                               // ".." is always an operator if preceded by a SCE_PL_WORD.
+                               // Archaic Perl has quotes inside names
                                if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) {
                                        styler.ColourTo(i, SCE_PL_DATASECTION);
                                        state = SCE_PL_DATASECTION;
@@ -253,95 +369,106 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        styler.ColourTo(i, SCE_PL_DATASECTION);
                                        state = SCE_PL_DATASECTION;
                                } else {
-                                       if (classifyWordPerl(styler.GetStartSegment(), i - 1, keywords, styler) == SCE_PL_WORD)
+                                       if (classifyWordPerl(styler.GetStartSegment(), i, keywords, styler) == SCE_PL_WORD)
                                                preferRE = true;
                                        state = SCE_PL_DEFAULT;
-                                       if (ch == '#') {
-                                               state = SCE_PL_COMMENTLINE;
-                                       } else if (ch == '\"') {
-                                               state = SCE_PL_STRING;
-                                       } else if (ch == '\'') {
-                                               state = SCE_PL_CHARACTER;
-                                       } else if (ch == '<' && chNext == '<') {
-                                               state = SCE_PL_HERE;
-                                               quotes = 0;
-                                               sookedpos = 0;
-                                               sooked[sookedpos] = '\0';
-                                       } else if (isPerlOperator(ch)) {
-                                               if (ch == ')' || ch == ']')
-                                                       preferRE = false;
-                                               else
-                                                       preferRE = true;
-                                               styler.ColourTo(i, SCE_PL_OPERATOR);
-                                               state = SCE_PL_DEFAULT;
-                                       }
+                                       ch = ' ';
                                }
                        }
                } else {
                        if (state == SCE_PL_COMMENTLINE) {
-                               if (ch == '\r' || ch == '\n') {
+                               if (isEOLChar(ch)) {
                                        styler.ColourTo(i - 1, state);
                                        state = SCE_PL_DEFAULT;
                                }
-                       } else if (state == SCE_PL_HERE) {
-                               if ((isalnum(ch) || ch == '_') && quotes < 2) {
-                                       sooked[sookedpos++] = ch;
-                                       sooked[sookedpos] = '\0';
-                                       if (quotes == 0)
-                                               quotes = 1;
-                               } else {
-                                       quotes++;
-                               }
-                               if ((quotes > 1) && 
-                                       (chPrev == '\n' || chPrev == '\r') &&
-                                       isMatch(styler, lengthDoc, i, sooked)) {
-                                       i += sookedpos;
-                                       chNext = styler.SafeGetCharAt(i);
-                                       if (chNext == '\n' || chNext == '\r') {
-                                               styler.ColourTo(i - 1, SCE_PL_HERE);
-                                               state = SCE_PL_DEFAULT;
-                                       }
-                                       ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
-                               }
-                       } else if (state == SCE_PL_STRING) {
-                               if (ch == '\\') {
-                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                       } else if (state == SCE_PL_HERE_DELIM) {
+                               //
+                               // From perldata.pod:
+                               // ------------------
+                               // A line-oriented form of quoting is based on the shell ``here-doc''
+                               // syntax.
+                               // Following a << you specify a string to terminate the quoted material,
+                               // and all lines following the current line down to the terminating
+                               // string are the value of the item.
+                               // The terminating string may be either an identifier (a word),
+                               // or some quoted text.
+                               // If quoted, the type of quotes you use determines the treatment of
+                               // the text, just as in regular quoting.
+                               // An unquoted identifier works like double quotes.
+                               // There must be no space between the << and the identifier.
+                               // (If you put a space it will be treated as a null identifier,
+                               // which is valid, and matches the first empty line.)
+                               // The terminating string must appear by itself (unquoted and with no
+                               // surrounding whitespace) on the terminating line.
+                               //
+                               if (HereDoc.State == 0) { // '<<' encountered
+                                       HereDoc.State = 1;
+                                       HereDoc.Quote = chNext;
+                                       HereDoc.Quoted = false;
+                                       HereDoc.DelimiterLength = 0;
+                                       HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
+                                       if (chNext == '\'' || chNext == '"' || chNext == '`') { // a quoted here-doc delimiter
                                                i++;
                                                ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       }
-                               } else if (ch == '\"') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_PL_DEFAULT;
-                                       i++;
-                                       ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
-                               }
-                       } else if (state == SCE_PL_CHARACTER) {
-                               if (ch == '\\') {
-                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               chNext = chNext2;
+                                               HereDoc.Quoted = true;
+                                       } else if (chNext == '\\') { // ref?
                                                i++;
                                                ch = chNext;
-                                               chNext = styler.SafeGetCharAt(i + 1);
+                                               chNext = chNext2;
+                                       } else if (isalnum(chNext) || chNext == '_') { // an unquoted here-doc delimiter
+                                       }
+                                       else if (isspacechar(chNext)) { // deprecated here-doc delimiter || TODO: left shift operator
+                                       }
+                                       else { // TODO: ???
+                                       }
+
+                               } else if (HereDoc.State == 1) { // collect the delimiter
+                                       if (HereDoc.Quoted) { // a quoted here-doc delimiter
+                                               if (ch == HereDoc.Quote) { // closing quote => end of delimiter
+                                                       styler.ColourTo(i, state);
+                                                       state = SCE_PL_DEFAULT;
+                                                       i++;
+                                                       ch = chNext;
+                                                       chNext = chNext2;
+                                               } else {
+                                                       if (ch == '\\' && chNext == HereDoc.Quote) { // escaped quote
+                                                               i++;
+                                                               ch = chNext;
+                                                               chNext = chNext2;
+                                                       }
+                                                       HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
+                                                       HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
+                                               }
+                                       } else { // an unquoted here-doc delimiter
+                                               if (isalnum(ch) || ch == '_') {
+                                                       HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
+                                                       HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
+                                               } else {
+                                                       styler.ColourTo(i - 1, state);
+                                                       state = SCE_PL_DEFAULT;
+                                               }
+                                       }
+                                       if (HereDoc.DelimiterLength >= static_cast<int>(sizeof(HereDoc.Delimiter)) - 1) {
+                                               styler.ColourTo(i - 1, state);
+                                               state = SCE_PL_ERROR;
                                        }
-                               } else if (ch == '\'') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_PL_DEFAULT;
-                                       i++;
-                                       ch = chNext;
-                                       chNext = styler.SafeGetCharAt(i + 1);
                                }
-                       } else if (state == SCE_PL_BACKTICKS) {
-                               if (ch == '`') {
-                                       styler.ColourTo(i, state);
-                                       state = SCE_PL_DEFAULT;
-                                       i++;
+                       } else if (HereDoc.State == 2) {
+                               // state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX
+                               if (isEOLChar(chPrev) && isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) {
+                                       i += HereDoc.DelimiterLength;
+                                       chNext = styler.SafeGetCharAt(i);
+                                       if (isEOLChar(chNext)) {
+                                               styler.ColourTo(i - 1, state);
+                                               state = SCE_PL_DEFAULT;
+                                               HereDoc.State = 0;
+                                       }
                                        ch = chNext;
                                        chNext = styler.SafeGetCharAt(i + 1);
                                }
                        } else if (state == SCE_PL_POD) {
-                               if (ch == '=' && (chPrev == '\r' || chPrev == '\n')) {
+                               if (ch == '=' && isEOLChar(chPrev)) {
                                        if (isMatch(styler, lengthDoc, i, "=cut")) {
                                                styler.ColourTo(i - 1 + 4, state);
                                                i += 4;
@@ -352,7 +479,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                }
                        } else if (state == SCE_PL_SCALAR) {
                                if (isEndVar(ch)) {
-                                       styler.ColourTo(i - 1, state);
+                                       if (i == (styler.GetStartSegment() + 1)) {
+                                               // Special variable: $(, $_ etc.
+                                               styler.ColourTo(i, state);
+                                       } else {
+                                               styler.ColourTo(i - 1, state);
+                                       }
                                        state = SCE_PL_DEFAULT;
                                }
                        } else if (state == SCE_PL_ARRAY) {
@@ -370,36 +502,36 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        styler.ColourTo(i - 1, state);
                                        state = SCE_PL_DEFAULT;
                                }
-                       } else if (state == SCE_PL_REF) {
-                               if (isEndVar(ch)) {
-                                       styler.ColourTo(i - 1, state);
-                                       state = SCE_PL_DEFAULT;
-                               }
-                       } else if (state == SCE_PL_REGEX) {
-                               if (!quoteUp && !isspace(ch)) {
-                                       quoteUp = ch;
-                                       quoteDown = opposite(ch);
-                                       quotes++;
+                       } else if (state == SCE_PL_REGEX
+                               || state == SCE_PL_STRING_QR
+                               ) {
+                               if (!Quote.Up && !isspacechar(ch)) {
+                                       Quote.Open(ch);
+                               } else if (ch == '\\' && Quote.Up != '\\') {
+                                       // SG: Is it save to skip *every* escaped char?
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
                                } else {
-                                       if (ch == quoteDown && chPrev != '\\') {
-                                               quotes--;
-                                               if (quotes == 0) {
-                                                       quoteRep--;
-                                                       if (quoteUp == quoteDown) {
-                                                               quotes++;
+                                       if (ch == Quote.Down /*&& chPrev != '\\'*/) {
+                                               Quote.Count--;
+                                               if (Quote.Count == 0) {
+                                                       Quote.Rep--;
+                                                       if (Quote.Up == Quote.Down) {
+                                                               Quote.Count++;
                                                        }
                                                }
                                                if (!isalpha(chNext)) {
-                                                       if (quoteRep <= 0) {
+                                                       if (Quote.Rep <= 0) {
                                                                styler.ColourTo(i, state);
                                                                state = SCE_PL_DEFAULT;
                                                                ch = ' ';
                                                        }
                                                }
-                                       } else if (ch == quoteUp && chPrev != '\\') {
-                                               quotes++;
+                                       } else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
+                                               Quote.Count++;
                                        } else if (!isalpha(chNext)) {
-                                               if (quoteRep <= 0) {
+                                               if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
@@ -407,12 +539,15 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        }
                                }
                        } else if (state == SCE_PL_REGSUBST) {
-                               if (!quoteUp && !isspace(ch)) {
-                                       quoteUp = ch;
-                                       quoteDown = opposite(ch);
-                                       quotes++;
+                               if (!Quote.Up && !isspacechar(ch)) {
+                                       Quote.Open(ch);
+                               } else if (ch == '\\' && Quote.Up != '\\') {
+                                       // SG: Is it save to skip *every* escaped char?
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
                                } else {
-                                       if (quotes == 0 && quoteRep == 1) {
+                                       if (Quote.Count == 0 && Quote.Rep == 1) {
                                                /* We matched something like s(...) or tr{...}
                                                * and are looking for the next matcher characters,
                                                * which could be either bracketed ({...}) or non-bracketed
@@ -420,68 +555,76 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                                *
                                                * Number-signs are problematic.  If they occur after
                                                * the close of the first part, treat them like
-                                               * a quoteUp char, even if they actually start comments.
+                                               * a Quote.Up char, even if they actually start comments.
                                                *
                                                * If we find an alnum, we end the regsubst, and punt.
                                                *
                                                * Eric Promislow   ericp@activestate.com  Aug 9,2000
                                                */
-                                               if (isspace(ch)) {
+                                               if (isspacechar(ch)) {
                                                        // Keep going
-                                               } else if (isalnum(ch)) {
+                                               }
+                                               else if (isalnum(ch)) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
                                                } else {
-                                                       quoteUp = ch;
-                                                       quoteDown = opposite(ch);
-                                                       quotes++;
+                                                       Quote.Open(ch);
                                                }
-                                       } else if (ch == quoteDown && chPrev != '\\') {
-                                               quotes--;
-                                               if (quotes == 0) {
-                                                       quoteRep--;
+                                       } else if (ch == Quote.Down /*&& chPrev != '\\'*/) {
+                                               Quote.Count--;
+                                               if (Quote.Count == 0) {
+                                                       Quote.Rep--;
                                                }
                                                if (!isalpha(chNext)) {
-                                                       if (quoteRep <= 0) {
+                                                       if (Quote.Rep <= 0) {
                                                                styler.ColourTo(i, state);
                                                                state = SCE_PL_DEFAULT;
                                                                ch = ' ';
                                                        }
                                                }
-                                               if (quoteUp == quoteDown) {
-                                                       quotes++;
+                                               if (Quote.Up == Quote.Down) {
+                                                       Quote.Count++;
                                                }
-                                       } else if (ch == quoteUp && chPrev != '\\') {
-                                               quotes++;
+                                       } else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
+                                               Quote.Count++;
                                        } else if (!isalpha(chNext)) {
-                                               if (quoteRep <= 0) {
+                                               if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
                                                }
                                        }
                                }
-                       } else if (state == SCE_PL_LONGQUOTE) {
-                               if (!quoteDown && !isspace(ch)) {
-                                       quoteUp = ch;
-                                       quoteDown = opposite(quoteUp);
-                                       quotes++;
-                               } else if (ch == quoteDown) {
-                                       quotes--;
-                                       if (quotes == 0) {
-                                               quoteRep--;
-                                               if (quoteRep <= 0) {
+                       } else if (state == SCE_PL_STRING_Q
+                               || state == SCE_PL_STRING_QQ
+                               || state == SCE_PL_STRING_QX
+                               || state == SCE_PL_STRING_QW
+                               || state == SCE_PL_STRING
+                               || state == SCE_PL_CHARACTER
+                               || state == SCE_PL_BACKTICKS
+                               ) {
+                               if (!Quote.Down && !isspacechar(ch)) {
+                                       Quote.Open(ch);
+                               } else if (ch == '\\' && Quote.Up != '\\') {
+                                       i++;
+                                       ch = chNext;
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               } else if (ch == Quote.Down) {
+                                       Quote.Count--;
+                                       if (Quote.Count == 0) {
+                                               Quote.Rep--;
+                                               if (Quote.Rep <= 0) {
                                                        styler.ColourTo(i, state);
                                                        state = SCE_PL_DEFAULT;
                                                        ch = ' ';
                                                }
-                                               if (quoteUp == quoteDown) {
-                                                       quotes++;
+                                               if (Quote.Up == Quote.Down) {
+                                                       Quote.Count++;
                                                }
                                        }
-                               } else if (ch == quoteUp) {
-                                       quotes++;
+                               } else if (ch == Quote.Up) {
+                                       Quote.Count++;
                                }
                        }
 
@@ -490,19 +633,30 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
                                        state = SCE_PL_COMMENTLINE;
                                } else if (ch == '\"') {
                                        state = SCE_PL_STRING;
+                                       Quote.New(1);
+                                       Quote.Open(ch);
                                } else if (ch == '\'') {
                                        state = SCE_PL_CHARACTER;
+                                       Quote.New(1);
+                                       Quote.Open(ch);
                                } else if (iswordstart(ch)) {
                                        state = SCE_PL_WORD;
                                        preferRE = false;
-                               } else if (isoperator(ch)) {
+                               } else if (isPerlOperator(ch)) {
+                                       if (ch == ')' || ch == ']')
+                                               preferRE = false;
+                                       else
+                                               preferRE = true;
                                        styler.ColourTo(i, SCE_PL_OPERATOR);
                                }
                        }
                }
+               if (state == SCE_PL_ERROR) {
+                       break;
+               }
                chPrev = ch;
        }
        styler.ColourTo(lengthDoc, state);
 }
 
-LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc);
+LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl");
index 492d21c7d97ba660ee588e31fa6f029bb2dfd8e1..6669694d1d6451d9c0c1d56ef6b636359ffb0b52 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexPython.cxx - lexer for Python
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexPython.cxx
+ ** Lexer for Python.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+/* Returns true if the "as" word that begins at start follows an import statement */
+static bool IsImportAs(unsigned int start, Accessor &styler) {
+       unsigned int i;
+       unsigned int j;
+       char s[10];
+
+       /* Find any import before start but after any statement terminator or quote */
+       i = start;
+       while (i > 0) {
+               char ch = styler[i - 1];
+
+               if (ch == '\n' || ch == '\r' || ch == ';' || ch == '\'' || ch == '"' || ch == '`')
+                       break;
+               if (ch == 't' && i > 5) {
+                       for (j = 0; j < 6; j++)
+                               s[j] = styler[(i - 6) + j];
+                       s[j] = '\0';
+                       if (strcmp(s, "import") == 0)
+                               return true;
+               }
+               i--;
+       }
+
+        return false;
+}
+
 static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
        char s[100];
        bool wordIsNumber = isdigit(styler[start]);
@@ -33,6 +61,8 @@ static void ClassifyWordPy(unsigned int start, unsigned int end, WordList &keywo
                chAttr = SCE_P_NUMBER;
        else if (keywords.InList(s))
                chAttr = SCE_P_WORD;
+       else if (strcmp(s, "as") == 0 && IsImportAs(start, styler))
+               chAttr = SCE_P_WORD;
        // make sure that dot-qualifiers inside the word are lexed correct
        else for (unsigned int i = 0; i < end - start + 1; i++) {
                if (styler[start + i] == '.') {
@@ -48,50 +78,107 @@ static bool IsPyComment(Accessor &styler, int pos, int len) {
        return len>0 && styler[pos]=='#';
 }
 
-static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, 
+static bool IsPyStringStart(char ch, char chNext, char chNext2) {
+       if (ch == '\'' || ch == '"')
+               return true;
+       if (ch == 'u' || ch == 'U') {
+               if (chNext == '"' || chNext == '\'')
+                       return true;
+               if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
+                       return true;
+       }
+       if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\''))
+               return true;
+
+       return false;
+}
+
+static bool IsPyWordStart(char ch, char chNext, char chNext2) {
+       return (iswordchar(ch) && !IsPyStringStart(ch, chNext, chNext2));
+}
+
+/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
+static int GetPyStringState(Accessor &styler, int i, int *nextIndex) {
+       char ch = styler.SafeGetCharAt(i);
+       char chNext = styler.SafeGetCharAt(i + 1);
+
+       // Advance beyond r, u, or ur prefix, but bail if there are any unexpected chars
+       if (ch == 'r' || ch == 'R') {
+               i++;
+               ch = styler.SafeGetCharAt(i);
+               chNext = styler.SafeGetCharAt(i + 1);
+       }
+       else if (ch == 'u' || ch == 'U') {
+               if (chNext == 'r' || chNext == 'R')
+                       i += 2;
+               else
+                       i += 1;
+               ch = styler.SafeGetCharAt(i);
+               chNext = styler.SafeGetCharAt(i + 1);
+       }
+
+       if (ch != '"' && ch != '\'') {
+               *nextIndex = i + 1;
+               return SCE_P_DEFAULT;
+       }
+
+       if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) {
+               *nextIndex = i + 3;
+
+               if (ch == '"')
+                       return SCE_P_TRIPLEDOUBLE;
+               else
+                       return SCE_P_TRIPLE;
+       } else {
+               *nextIndex = i + 1;
+
+               if (ch == '"')
+                       return SCE_P_STRING;
+               else
+                       return SCE_P_CHARACTER;
+       }
+}
+
+static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                                                   WordList *keywordlists[], Accessor &styler) {
 
        int lengthDoc = startPos + length;
 
-       // Backtrack to previous line in case need to fix its fold status or tab whinging
+       // Backtrack to previous line in case need to fix its tab whinging
        int lineCurrent = styler.GetLine(startPos);
        if (startPos > 0) {
                if (lineCurrent > 0) {
-                       lineCurrent--;
-                       startPos = styler.LineStart(lineCurrent);
+                       startPos = styler.LineStart(lineCurrent-1);
                        if (startPos == 0)
                                initStyle = SCE_P_DEFAULT;
-                       else 
+                       else
                                initStyle = styler.StyleAt(startPos-1);
                }
        }
-       
+
        // Python uses a different mask because bad indentation is marked by oring with 32
        styler.StartAt(startPos, 127);
-       
+
        WordList &keywords = *keywordlists[0];
-       
-       bool fold = styler.GetPropertyInt("fold");
+
        int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
        char prevWord[200];
        prevWord[0] = '\0';
        if (length == 0)
                return ;
-       int spaceFlags = 0;
 
        int state = initStyle & 31;
 
-       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
-       if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) 
-               indentCurrent |= SC_FOLDLEVELWHITEFLAG;
-
+       int nextIndex = 0;
        char chPrev = ' ';
        char chPrev2 = ' ';
        char chNext = styler[startPos];
        styler.StartSegment(startPos);
        bool atStartLine = true;
+       int spaceFlags = 0;
+       styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
        for (int i = startPos; i < lengthDoc; i++) {
-       
+
                if (atStartLine) {
                        char chBad = static_cast<char>(64);
                        char chGood = static_cast<char>(0);
@@ -108,40 +195,19 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                        styler.SetFlags(chFlags, static_cast<char>(state));
                        atStartLine = false;
                }
-               
+
                char ch = chNext;
                chNext = styler.SafeGetCharAt(i + 1);
                char chNext2 = styler.SafeGetCharAt(i + 2);
-               
+
                if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
                        if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
                                // Perform colourisation of white space and triple quoted strings at end of each line to allow
                                // tab marking to work inside white space and triple quoted strings
                                styler.ColourTo(i, state);
                        }
-
-                       int lev = indentCurrent;
-                       int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsPyComment);
-                       if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) 
-                               indentNext |= SC_FOLDLEVELWHITEFLAG;
-                       if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
-                               // Only non whitespace lines can be headers
-                               if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
-                                       lev |= SC_FOLDLEVELHEADERFLAG;
-                               } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
-                                       // Line after is blank so check the next - maybe should continue further?
-                                       int spaceFlags2 = 0;
-                                       int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsPyComment);
-                                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
-                                               lev |= SC_FOLDLEVELHEADERFLAG;
-                                       }
-                               }
-                       }
-                       indentCurrent = indentNext;
-                       if (fold) {
-                               styler.SetLevel(lineCurrent, lev);
-                       }
                        lineCurrent++;
+                       styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
                        atStartLine = true;
                }
 
@@ -160,33 +226,20 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                        }
                }
                if (state == SCE_P_DEFAULT) {
-                       if (iswordstart(ch)) {
+                       if (IsPyWordStart(ch, chNext, chNext2)) {
                                styler.ColourTo(i - 1, state);
                                state = SCE_P_WORD;
                        } else if (ch == '#') {
                                styler.ColourTo(i - 1, state);
                                state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
-                       } else if (ch == '\"') {
+                       } else if (IsPyStringStart(ch, chNext, chNext2)) {
                                styler.ColourTo(i - 1, state);
-                               if (chNext == '\"' && chNext2 == '\"') {
-                                       i += 2;
-                                       state = SCE_P_TRIPLEDOUBLE;
+                               state = GetPyStringState(styler, i, &nextIndex);
+                               if (nextIndex != i + 1) {
+                                       i = nextIndex - 1;
                                        ch = ' ';
                                        chPrev = ' ';
                                        chNext = styler.SafeGetCharAt(i + 1);
-                               } else {
-                                       state = SCE_P_STRING;
-                               }
-                       } else if (ch == '\'') {
-                               styler.ColourTo(i - 1, state);
-                               if (chNext == '\'' && chNext2 == '\'') {
-                                       i += 2;
-                                       state = SCE_P_TRIPLE;
-                                       ch = ' ';
-                                       chPrev = ' ';
-                                       chNext = styler.SafeGetCharAt(i + 1);
-                               } else {
-                                       state = SCE_P_CHARACTER;
                                }
                        } else if (isoperator(ch)) {
                                styler.ColourTo(i - 1, state);
@@ -198,25 +251,14 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
                                state = SCE_P_DEFAULT;
                                if (ch == '#') {
                                        state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
-                               } else if (ch == '\"') {
-                                       if (chNext == '\"' && chNext2 == '\"') {
-                                               i += 2;
-                                               state = SCE_P_TRIPLEDOUBLE;
-                                               ch = ' ';
-                                               chPrev = ' ';
-                                               chNext = styler.SafeGetCharAt(i + 1);
-                                       } else {
-                                               state = SCE_P_STRING;
-                                       }
-                               } else if (ch == '\'') {
-                                       if (chNext == '\'' && chNext2 == '\'') {
-                                               i += 2;
-                                               state = SCE_P_TRIPLE;
+                               } else if (IsPyStringStart(ch, chNext, chNext2)) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = GetPyStringState(styler, i, &nextIndex);
+                                       if (nextIndex != i + 1) {
+                                               i = nextIndex - 1;
                                                ch = ' ';
                                                chPrev = ' ';
                                                chNext = styler.SafeGetCharAt(i + 1);
-                                       } else {
-                                               state = SCE_P_CHARACTER;
                                        }
                                } else if (isoperator(ch)) {
                                        styler.ColourTo(i, SCE_P_OPERATOR);
@@ -278,4 +320,131 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
        }
 }
 
-LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc);
+static bool IsCommentLine(int line, Accessor &styler) {
+       int pos = styler.LineStart(line);
+       int eol_pos = styler.LineStart(line+1) - 1;
+       for (int i = pos; i < eol_pos; i++) {
+               char ch = styler[i];
+               if (ch == '#')
+                       return true;
+               else if (ch != ' ' && ch != '\t')
+                       return false;
+       }
+       return false;
+}
+
+static bool IsQuoteLine(int line, Accessor &styler) {
+       int style = styler.StyleAt(styler.LineStart(line)) & 31;
+       return ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
+}
+
+static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
+                                       WordList *[], Accessor &styler) {
+       int maxPos = startPos + length;
+       int maxLines = styler.GetLine(maxPos-1);
+                                               
+       bool foldComment = styler.GetPropertyInt("fold.comment.python");
+       bool foldQuotes = styler.GetPropertyInt("fold.quotes.python");
+
+       // Backtrack to previous non-blank line so we can determine indent level
+       // for any white space lines (needed esp. within triple quoted strings)
+       // and so we can fix any preceding fold level (which is why we go back
+       // at least one line in all cases)
+       int spaceFlags = 0;
+       int lineCurrent = styler.GetLine(startPos);
+       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
+       while (lineCurrent > 0) {
+               lineCurrent--;
+               indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
+               if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) &&
+                       (!IsCommentLine(lineCurrent, styler)) &&
+                       (!IsQuoteLine(lineCurrent, styler)))
+                       break;
+       }
+       int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
+       
+       startPos = styler.LineStart(lineCurrent);
+       // Set up initial state
+       int prev_state = SCE_P_DEFAULT & 31;
+       if (lineCurrent >= 1)
+               prev_state = styler.StyleAt(startPos-1) & 31;
+       int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
+       int prevComment = 0;
+       if (lineCurrent >= 1)
+               prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
+
+       // Process all characters to end of requested range or end of any triple quote
+       // or comment that hangs over the end of the range
+       while ((lineCurrent <= maxLines) || prevQuote || prevComment) {
+
+               // Gather info
+               int lev = indentCurrent;
+               int lineNext = lineCurrent + 1;
+               int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
+               int indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
+               int quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE));
+               int quote_start = (quote && !prevQuote);
+               int quote_continue = (quote && prevQuote);
+               int comment = foldComment && IsCommentLine(lineCurrent, styler);
+               int comment_start = (comment && !prevComment && 
+                       IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
+               int comment_continue = (comment && prevComment);
+               if ((!quote || !prevQuote) && !comment)
+                       indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
+               if (quote)
+                       indentNext = indentCurrentLevel;
+               if (indentNext & SC_FOLDLEVELWHITEFLAG)
+                       indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
+
+               if (quote_start) {
+                       // Place fold point at start of triple quoted string
+                       lev |= SC_FOLDLEVELHEADERFLAG;
+               } else if (quote_continue || prevQuote) {
+                       // Add level to rest of lines in the string
+                       lev = lev + 1;
+               } else if (comment_start) {
+                       // Place fold point at start of a block of comments
+                       lev |= SC_FOLDLEVELHEADERFLAG;
+               } else if (comment_continue) {
+                       // Add level to rest of lines in the block
+                       lev = lev + 1;
+               }
+
+               // Skip past any blank lines for next indent level info; we skip also comments
+               // starting in column 0 which effectively folds them into surrounding code
+               // rather than screwing up folding.  Then set indent level on the lines
+               // we skipped to be same as maximum of current and next indent.  This approach
+               // does a reasonable job of collapsing white space into surrounding code
+               // without getting confused by white space at the start of an indented level.
+               while (!quote &&
+                      ((indentNext & SC_FOLDLEVELWHITEFLAG) || styler[styler.LineStart(lineNext)] == '#') &&
+                      (lineNext < maxLines)) {
+                       int level = Platform::Maximum(indentCurrent, indentNext);
+                       if (indentNext & SC_FOLDLEVELWHITEFLAG)
+                               level = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
+                       styler.SetLevel(lineNext, level);
+                       lineNext++;
+                       indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
+               }
+
+               // Set fold header on non-quote/non-comment line
+               if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
+                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
+                               lev |= SC_FOLDLEVELHEADERFLAG;
+               }
+
+               // Keep track of triple quote and block comment state of previous line
+               prevQuote = quote;
+               prevComment = comment_start || comment_continue;
+
+               // Set fold level for this line and move to next line
+               styler.SetLevel(lineCurrent, lev);
+               indentCurrent = indentNext;
+               lineCurrent = lineNext;
+       }
+
+       // Make sure last line indent level is set too
+       styler.SetLevel(lineCurrent, indentCurrent);
+}
+
+LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
diff --git a/src/stc/scintilla/src/LexRuby.cxx b/src/stc/scintilla/src/LexRuby.cxx
new file mode 100644 (file)
index 0000000..b29eee3
--- /dev/null
@@ -0,0 +1,355 @@
+// Scintilla source code edit control
+/** @file LexRuby.cxx
+ ** Lexer for Ruby.
+ **/
+// Copyright 2001- by Clemens Wyss <wys@helbling.ch>
+// 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"
+
+static void ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) {
+       char s[100];
+       bool wordIsNumber = isdigit(styler[start]);
+       for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
+               s[i] = styler[start + i];
+               s[i + 1] = '\0';
+       }
+       char chAttr = SCE_P_IDENTIFIER;
+       if (0 == strcmp(prevWord, "class"))
+               chAttr = SCE_P_CLASSNAME;
+       else if (0 == strcmp(prevWord, "module"))
+               chAttr = SCE_P_CLASSNAME;
+       else if (0 == strcmp(prevWord, "def"))
+               chAttr = SCE_P_DEFNAME;
+       else if (wordIsNumber)
+               chAttr = SCE_P_NUMBER;
+       else if (keywords.InList(s))
+               chAttr = SCE_P_WORD;
+       // make sure that dot-qualifiers inside the word are lexed correct
+       else for (unsigned int i = 0; i < end - start + 1; i++) {
+               if (styler[start + i] == '.') {
+                       styler.ColourTo(start + i - 1, chAttr);
+                       styler.ColourTo(start + i, SCE_P_OPERATOR);
+               }
+       }
+       styler.ColourTo(end, chAttr);
+       strcpy(prevWord, s);
+}
+
+static bool IsRbComment(Accessor &styler, int pos, int len) {
+       return len>0 && styler[pos]=='#';
+}
+
+static bool IsRbStringStart(char ch, char chNext, char chNext2) {
+       if (ch == '\'' || ch == '"')
+               return true;
+       if (ch == 'u' || ch == 'U') {
+               if (chNext == '"' || chNext == '\'')
+                       return true;
+               if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
+                       return true;
+       }
+       if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\''))
+               return true;
+
+       return false;
+}
+
+static bool IsRbWordStart(char ch, char chNext, char chNext2) {
+       return (iswordchar(ch) && !IsRbStringStart(ch, chNext, chNext2));
+}
+
+/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
+static int GetRbStringState(Accessor &styler, int i, int *nextIndex) {
+       char ch = styler.SafeGetCharAt(i);
+       char chNext = styler.SafeGetCharAt(i + 1);
+
+       // Advance beyond r, u, or ur prefix, but bail if there are any unexpected chars
+       if (ch == 'r' || ch == 'R') {
+               i++;
+               ch = styler.SafeGetCharAt(i);
+               chNext = styler.SafeGetCharAt(i + 1);
+       }
+       else if (ch == 'u' || ch == 'U') {
+               if (chNext == 'r' || chNext == 'R')
+                       i += 2;
+               else
+                       i += 1;
+               ch = styler.SafeGetCharAt(i);
+               chNext = styler.SafeGetCharAt(i + 1);
+       }
+
+       if (ch != '"' && ch != '\'') {
+               *nextIndex = i + 1;
+               return SCE_P_DEFAULT;
+       }
+
+       if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) {
+               *nextIndex = i + 3;
+
+               if (ch == '"')
+                       return SCE_P_TRIPLEDOUBLE;
+               else
+                       return SCE_P_TRIPLE;
+       } else {
+               *nextIndex = i + 1;
+
+               if (ch == '"')
+                       return SCE_P_STRING;
+               else
+                       return SCE_P_CHARACTER;
+       }
+}
+
+static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
+                                                  WordList *keywordlists[], Accessor &styler) {
+
+       int lengthDoc = startPos + length;
+
+       // Backtrack to previous line in case need to fix its tab whinging
+       if (startPos > 0) {
+               int lineCurrent = styler.GetLine(startPos);
+               if (lineCurrent > 0) {
+                       startPos = styler.LineStart(lineCurrent-1);
+                       if (startPos == 0)
+                               initStyle = SCE_P_DEFAULT;
+                       else
+                               initStyle = styler.StyleAt(startPos-1);
+               }
+       }
+
+       // Ruby uses a different mask because bad indentation is marked by oring with 32
+       styler.StartAt(startPos, 127);
+
+       WordList &keywords = *keywordlists[0];
+
+       int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
+       char prevWord[200];
+       prevWord[0] = '\0';
+       if (length == 0)
+               return ;
+
+       int state = initStyle & 31;
+
+       int nextIndex = 0;
+       char chPrev = ' ';
+       char chPrev2 = ' ';
+       char chNext = styler[startPos];
+       styler.StartSegment(startPos);
+       bool atStartLine = true;
+       int spaceFlags = 0;
+       for (int i = startPos; i < lengthDoc; i++) {
+
+               if (atStartLine) {
+                       char chBad = static_cast<char>(64);
+                       char chGood = static_cast<char>(0);
+                       char chFlags = chGood;
+                       if (whingeLevel == 1) {
+                               chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
+                       } else if (whingeLevel == 2) {
+                               chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
+                       } else if (whingeLevel == 3) {
+                               chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
+                       } else if (whingeLevel == 4) {
+                               chFlags = (spaceFlags & wsTab) ? chBad : chGood;
+                       }
+                       styler.SetFlags(chFlags, static_cast<char>(state));
+                       atStartLine = false;
+               }
+
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               char chNext2 = styler.SafeGetCharAt(i + 2);
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
+                       if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE)) {
+                               // Perform colourisation of white space and triple quoted strings at end of each line to allow
+                               // tab marking to work inside white space and triple quoted strings
+                               styler.ColourTo(i, state);
+                       }
+                       atStartLine = true;
+               }
+
+               if (styler.IsLeadByte(ch)) {
+                       chNext = styler.SafeGetCharAt(i + 2);
+                       chPrev = ' ';
+                       chPrev2 = ' ';
+                       i += 1;
+                       continue;
+               }
+
+               if (state == SCE_P_STRINGEOL) {
+                       if (ch != '\r' && ch != '\n') {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_P_DEFAULT;
+                       }
+               }
+               if (state == SCE_P_DEFAULT) {
+                       if (IsRbWordStart(ch, chNext, chNext2)) {
+                               styler.ColourTo(i - 1, state);
+                               state = SCE_P_WORD;
+                       } else if (ch == '#') {
+                               styler.ColourTo(i - 1, state);
+                               state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
+                       } else if (ch == '=' && chNext == 'b') {
+                               // =begin indicates the start of a comment (doc) block
+                               if(styler.SafeGetCharAt(i + 2) == 'e' && styler.SafeGetCharAt(i + 3) == 'g' && styler.SafeGetCharAt(i + 4) == 'i' && styler.SafeGetCharAt(i + 5) == 'n') {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_P_TRIPLEDOUBLE; //SCE_C_COMMENT;
+                               }
+                       }  else if (IsRbStringStart(ch, chNext, chNext2)) {
+                               styler.ColourTo(i - 1, state);
+                               state = GetRbStringState(styler, i, &nextIndex);
+                               if (nextIndex != i + 1) {
+                                       i = nextIndex - 1;
+                                       ch = ' ';
+                                       chPrev = ' ';
+                                       chNext = styler.SafeGetCharAt(i + 1);
+                               }
+                       } else if (isoperator(ch)) {
+                               styler.ColourTo(i - 1, state);
+                               styler.ColourTo(i, SCE_P_OPERATOR);
+                       } 
+                       } else if (state == SCE_P_WORD) {
+                       if (!iswordchar(ch)) {
+                               ClassifyWordRb(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
+                               state = SCE_P_DEFAULT;
+                               if (ch == '#') {
+                                       state = chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
+                               } else if (IsRbStringStart(ch, chNext, chNext2)) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = GetRbStringState(styler, i, &nextIndex);
+                                       if (nextIndex != i + 1) {
+                                               i = nextIndex - 1;
+                                               ch = ' ';
+                                               chPrev = ' ';
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (isoperator(ch)) {
+                                       styler.ColourTo(i, SCE_P_OPERATOR);
+                               }
+                       }
+               } else {
+                       if (state == SCE_P_COMMENTLINE || state == SCE_P_COMMENTBLOCK) {
+                               if (ch == '\r' || ch == '\n') {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_P_DEFAULT;
+                               }
+                       } else if (state == SCE_P_STRING) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_P_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\"') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_P_DEFAULT;
+                               }
+                       } else if (state == SCE_P_CHARACTER) {
+                               if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) {
+                                       styler.ColourTo(i - 1, state);
+                                       state = SCE_P_STRINGEOL;
+                               } else if (ch == '\\') {
+                                       if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+                                               i++;
+                                               ch = chNext;
+                                               chNext = styler.SafeGetCharAt(i + 1);
+                                       }
+                               } else if (ch == '\'') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_P_DEFAULT;
+                               }
+                       } else if (state == SCE_P_TRIPLE) {
+                               if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') {
+                                       styler.ColourTo(i, state);
+                                       state = SCE_P_DEFAULT;
+                               }
+                       } else if (state == SCE_P_TRIPLEDOUBLE) {
+                               // =end terminates the comment block
+                               if (ch == 'd' && chPrev == 'n' && chPrev2 == 'e') {
+                                       if  (styler.SafeGetCharAt(i - 3) == '=') {
+                                               styler.ColourTo(i, state);
+                                               state = SCE_P_DEFAULT;
+                                       }
+                               }
+                       }
+               }
+               chPrev2 = chPrev;
+               chPrev = ch;
+       }
+       if (state == SCE_P_WORD) {
+               ClassifyWordRb(styler.GetStartSegment(), lengthDoc, keywords, styler, prevWord);
+       } else {
+               styler.ColourTo(lengthDoc, state);
+       }
+}
+
+static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
+                                                  WordList *[], Accessor &styler) {
+       int lengthDoc = startPos + length;
+
+       // Backtrack to previous line in case need to fix its fold status
+       int lineCurrent = styler.GetLine(startPos);
+       if (startPos > 0) {
+               if (lineCurrent > 0) {
+                       lineCurrent--;
+                       startPos = styler.LineStart(lineCurrent);
+                       if (startPos == 0)
+                               initStyle = SCE_P_DEFAULT;
+                       else
+                               initStyle = styler.StyleAt(startPos-1);
+               }
+       }
+       int state = initStyle & 31;
+       int spaceFlags = 0;
+       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsRbComment);
+       if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
+               indentCurrent |= SC_FOLDLEVELWHITEFLAG;
+       char chNext = styler[startPos];
+       for (int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               int style = styler.StyleAt(i) & 31;
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
+                       int lev = indentCurrent;
+                       int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsRbComment);
+                       if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
+                               indentNext |= SC_FOLDLEVELWHITEFLAG;
+                       if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
+                               // Only non whitespace lines can be headers
+                               if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
+                                       // Line after is blank so check the next - maybe should continue further?
+                                       int spaceFlags2 = 0;
+                                       int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsRbComment);
+                                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
+                                               lev |= SC_FOLDLEVELHEADERFLAG;
+                                       }
+                               }
+                       }
+                       indentCurrent = indentNext;
+                       styler.SetLevel(lineCurrent, lev);
+                       lineCurrent++;
+               }
+       }
+}
+                                                  
+LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc);
index facd0e6b7bb64c617251fb59a18eb1c38079acce..84d7d1c52e7a9991861cda189958a3619bd07b1c 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexSQL.cxx - lexer for SQL
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexSQL.cxx
+ ** Lexer for SQL.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
@@ -38,7 +40,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
                             int initStyle, WordList *keywordlists[], Accessor &styler) {
 
        WordList &keywords = *keywordlists[0];
-       
+
        styler.StartAt(startPos);
 
        bool fold = styler.GetPropertyInt("fold");
@@ -153,4 +155,4 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
        styler.ColourTo(lengthDoc - 1, state);
 }
 
-LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc);
+LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc, "sql");
index 67dfa784276a84b25cb6dd813cdd41e53807d72a..61e4035b18f870b60767d2f4f760bad985eb74ac 100644 (file)
@@ -1,13 +1,15 @@
-// SciTE - Scintilla based Text Editor
-// LexVB.cxx - lexer for Visual Basic and VBScript
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file LexVB.cxx
+ ** Lexer for Visual Basic and VBScript.
+ **/
+// Copyright 1998-2001 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 <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
 
 #include "Platform.h"
 
@@ -43,11 +45,15 @@ static int classifyWordVB(unsigned int start, unsigned int end, WordList &keywor
                return SCE_C_DEFAULT;
 }
 
+static bool IsVBComment(Accessor &styler, int pos, int len) {
+       return len>0 && styler[pos]=='\'';
+}
+
 static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
                            WordList *keywordlists[], Accessor &styler) {
 
        WordList &keywords = *keywordlists[0];
-       
+
        styler.StartAt(startPos);
 
        int visibleChars = 0;
@@ -73,7 +79,7 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
                        }
                        visibleChars = 0;
                }
-               if (!isspace(ch))
+               if (!isspacechar(ch))
                        visibleChars++;
 
                if (state == SCE_C_DEFAULT) {
@@ -136,4 +142,56 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
        styler.ColourTo(lengthDoc, state);
 }
 
-LexerModule lmVB(SCLEX_VB, ColouriseVBDoc);
+static void FoldVBDoc(unsigned int startPos, int length, int initStyle,
+                                                  WordList *[], Accessor &styler) {
+       int lengthDoc = startPos + length;
+
+       // Backtrack to previous line in case need to fix its fold status
+       int lineCurrent = styler.GetLine(startPos);
+       if (startPos > 0) {
+               if (lineCurrent > 0) {
+                       lineCurrent--;
+                       startPos = styler.LineStart(lineCurrent);
+                       if (startPos == 0)
+                               initStyle = SCE_P_DEFAULT;
+                       else
+                               initStyle = styler.StyleAt(startPos-1);
+               }
+       }
+       int state = initStyle & 31;
+       int spaceFlags = 0;
+       int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsVBComment);
+       if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
+               indentCurrent |= SC_FOLDLEVELWHITEFLAG;
+       char chNext = styler[startPos];
+       for (int i = startPos; i < lengthDoc; i++) {
+               char ch = chNext;
+               chNext = styler.SafeGetCharAt(i + 1);
+               int style = styler.StyleAt(i) & 31;
+
+               if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) {
+                       int lev = indentCurrent;
+                       int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsVBComment);
+                       if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
+                               indentNext |= SC_FOLDLEVELWHITEFLAG;
+                       if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
+                               // Only non whitespace lines can be headers
+                               if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
+                                       lev |= SC_FOLDLEVELHEADERFLAG;
+                               } else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
+                                       // Line after is blank so check the next - maybe should continue further?
+                                       int spaceFlags2 = 0;
+                                       int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsVBComment);
+                                       if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
+                                               lev |= SC_FOLDLEVELHEADERFLAG;
+                                       }
+                               }
+                       }
+                       indentCurrent = indentNext;
+                       styler.SetLevel(lineCurrent, lev);
+                       lineCurrent++;
+               }
+       }
+}
+
+LexerModule lmVB(SCLEX_VB, ColouriseVBDoc, "vb", FoldVBDoc);
index f54978c3fc30ec35bb653acecc239fc9a84ab868..dc1468d8324ced046063c8eecea21b95ec0ac412 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// LineMarker.cxx - defines the look of a line marker in the margin 
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file LineMarker.cxx
+ ** Defines the look of a line marker in the margin .
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include "Platform.h"
 #include "Scintilla.h"
 #include "LineMarker.h"
 
-void LineMarker::Draw(Surface *surface, PRectangle &rc) {
+static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, Colour fore, Colour back) {
+       PRectangle rc;
+       rc.left = centreX - armSize;
+       rc.top = centreY - armSize;
+       rc.right = centreX + armSize + 1;
+       rc.bottom = centreY + armSize + 1;
+       surface->RectangleDraw(rc, back, fore);
+}
+
+static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, Colour fore, Colour back) {
+       PRectangle rcCircle;
+       rcCircle.left = centreX - armSize;
+       rcCircle.top = centreY - armSize;
+       rcCircle.right = centreX + armSize + 1;
+       rcCircle.bottom = centreY + armSize + 1;
+       surface->Ellipse(rcCircle, back, fore);
+}
+
+static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, Colour fore) {
+       PRectangle rcV(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1);
+       surface->FillRectangle(rcV, fore);
+       PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
+       surface->FillRectangle(rcH, fore);
+}
+
+static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, Colour fore) {
+       PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
+       surface->FillRectangle(rcH, fore);
+}
+
+void LineMarker::Draw(Surface *surface, PRectangle &rcWhole) {
+       // Restrict most shapes a bit
+       PRectangle rc = rcWhole;
+       rc.top++;
+       rc.bottom--;
        int minDim = Platform::Minimum(rc.Width(), rc.Height());
        minDim--;       // Ensure does not go beyond edge
        int centreX = (rc.right + rc.left) / 2;
        int centreY = (rc.bottom + rc.top) / 2;
        int dimOn2 = minDim / 2;
        int dimOn4 = minDim / 4;
+       int blobSize = dimOn2-1;
+       int armSize = dimOn2-2;
        if (rc.Width() > (rc.Height() * 2)) {
                // Wide column is line number so move to left to try to avoid overlapping number
                centreX = rc.left + dimOn2 + 1;
@@ -50,7 +88,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
                                fore.allocated, back.allocated);
 
        } else if (markType == SC_MARK_PLUS) {
-               int armSize = dimOn2-2;
                Point pts[] = {
                Point(centreX - armSize, centreY - 1),
                Point(centreX - 1, centreY - 1),
@@ -69,7 +106,6 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
                                fore.allocated, back.allocated);
 
        } else if (markType == SC_MARK_MINUS) {
-               int armSize = dimOn2-2;
                Point pts[] = {
                Point(centreX - armSize, centreY - 1),
                Point(centreX + armSize, centreY -1),
@@ -86,8 +122,114 @@ void LineMarker::Draw(Surface *surface, PRectangle &rc) {
                rcSmall.right = rc.right - 1;
                rcSmall.bottom = rc.bottom - 2;
                surface->RectangleDraw(rcSmall, fore.allocated, back.allocated);
+               
        } else if (markType == SC_MARK_EMPTY) {
                // An invisible marker so don't draw anything
+               
+       } else if (markType == SC_MARK_VLINE) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+       } else if (markType == SC_MARK_LCORNER) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rc.top + dimOn2);
+               surface->LineTo(rc.right - 2, rc.top + dimOn2);
+               
+       } else if (markType == SC_MARK_TCORNER) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rcWhole.bottom);
+               surface->MoveTo(centreX, rc.top + dimOn2);
+               surface->LineTo(rc.right - 2, rc.top + dimOn2);
+               
+       } else if (markType == SC_MARK_LCORNERCURVE) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rc.top + dimOn2-3);
+               surface->LineTo(centreX+3, rc.top + dimOn2);
+               surface->LineTo(rc.right - 1, rc.top + dimOn2);
+               
+       } else if (markType == SC_MARK_TCORNERCURVE) {
+               surface->PenColour(back.allocated);
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rc.top + dimOn2-3);
+               surface->LineTo(centreX+3, rc.top + dimOn2);
+               surface->LineTo(rc.right - 1, rc.top + dimOn2);
+               
+       } else if (markType == SC_MARK_BOXPLUS) {
+               surface->PenColour(back.allocated);
+               DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
+               
+       } else if (markType == SC_MARK_BOXPLUSCONNECTED) {
+               surface->PenColour(back.allocated);
+               DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, centreY - blobSize);
+               
+       } else if (markType == SC_MARK_BOXMINUS) {
+               surface->PenColour(back.allocated);
+               DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+       } else if (markType == SC_MARK_BOXMINUSCONNECTED) {
+               surface->PenColour(back.allocated);
+               DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, centreY - blobSize);
+               
+       } else if (markType == SC_MARK_CIRCLEPLUS) {
+               DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               surface->PenColour(back.allocated);
+               DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
+               
+       } else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) {
+               DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               surface->PenColour(back.allocated);
+               DrawPlus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, centreY - blobSize);
+               
+       } else if (markType == SC_MARK_CIRCLEMINUS) {
+               DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               surface->PenColour(back.allocated);
+               DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+       } else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) {
+               DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated);
+               surface->PenColour(back.allocated);
+               DrawMinus(surface, centreX, centreY, blobSize, back.allocated);
+               
+               surface->MoveTo(centreX, centreY + blobSize);
+               surface->LineTo(centreX, rcWhole.bottom);
+               
+               surface->MoveTo(centreX, rcWhole.top);
+               surface->LineTo(centreX, centreY - blobSize);
+               
        } else { // SC_MARK_SHORTARROW
                Point pts[] = {
                        Point(centreX, centreY + dimOn2),
index f22241bb193dc0ade12242e718714eaf0116d920..ee0f36c256611437b649a254d80b8d947de8b4f9 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// LineMarker.h - defines the look of a line marker in the margin 
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file LineMarker.h
+ ** Defines the look of a line marker in the margin .
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef LINEMARKER_H
 #define LINEMARKER_H
 
+/**
+ */
 class LineMarker {
 public:
        int markType;
diff --git a/src/stc/scintilla/src/PosRegExp.cxx b/src/stc/scintilla/src/PosRegExp.cxx
deleted file mode 100644 (file)
index ea719b7..0000000
+++ /dev/null
@@ -1,1181 +0,0 @@
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <malloc.h>
-
-#include "PosRegExp.h"
-
-//Up: /[A-Z \x80-\x9f \xf0 ]/x
-//Lo: /[a-z \xa0-\xaf \xe0-\xef \xf1 ]/x
-//Wd: /[\d _ A-Z a-z \xa0-\xaf \xe0-\xf1 \x80-\x9f]/x
-//*   // Dos866
-SCharData UCData  = {0x0, 0x0, 0x7fffffe, 0x0, 0xffffffff, 0x0, 0x0, 0x10000},
-                     LCData  = {0x0, 0x0, 0x0, 0x7fffffe, 0x0, 0xffff, 0x0, 0x2ffff},
-                     WdData  = {0x0, 0x3ff0000, 0x87fffffe, 0x7fffffe, 0xffffffff, 0xffff, 0x0, 0x3ffff},
-                     DigData = {0x0, 0x3ff0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
-/*/   // cp1251
-SCharData UCData  = {0x0, 0x0, 0x7fffffe, 0x0, 0x0, 0x0, 0xffffffff, 0x0},
-          LCData  = {0x0, 0x0, 0x0, 0x7fffffe, 0x0, 0x0, 0x0, 0xffffffff},
-          WdData  = {0x0, 0x3ff0000, 0x87fffffe, 0x7fffffe, 0x0, 0x0, 0xffffffff, 0xffffffff},
-          DigData = {0x0, 0x3ff0000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
-//*/
-
-///////////////////////////////////////////////
-
-int GetNumber(int *str,int s,int e) {
-       int r = 1, num = 0;
-       if (e < s) return -1;
-       for(int i = e-1; i >= s; i--) {
-               if (str[i] > '9' || str[i] < '0') return -1;
-               num += (str[i] - 0x30)*r;
-               r *= 10;
-       };
-       return num;
-       /*
-       char tmp[20];
-       double Res;
-         if (e == s) return -1;
-         for (int i = s;i < e;i++)
-           tmp[i-s] = (char)Str[i];
-         tmp[e-s] = 0;
-         GetNumber(tmp,&Res);
-         return (int)Res;
-       */
-};
-
-bool IsDigit(char Symb) {
-       return DigData.GetBit(Symb);
-};
-bool IsWord(char Symb) {
-       return WdData.GetBit(Symb);
-};
-bool IsUpperCase(char Symb) {
-       return UCData.GetBit(Symb);
-};
-bool IsLowerCase(char Symb) {
-       return LCData.GetBit(Symb);
-};
-char LowCase(char Chr) {
-       if (UCData.GetBit(Chr))
-               return Chr+0x20;
-       return Chr;
-};
-
-///////////////////////////////////////////////
-
-SRegInfo::SRegInfo() {
-       Next = Parent = 0;
-       un.Param = 0;
-       Op = ReEmpty;
-};
-SRegInfo::~SRegInfo() {
-       if (Next) delete Next;
-       if (un.Param)
-               switch(Op) {
-               case ReEnum:
-               case ReNEnum:
-                       delete un.ChrClass;
-                       break;
-               default:
-                       if (Op > ReBlockOps && Op < ReSymbolOps || Op == ReBrackets)
-                               delete un.Param;
-                       break;
-               };
-};
-
-///////////////////////////////////////////////
-
-void SCharData::SetBit(unsigned char Bit) {
-       int p = Bit/8;
-       CArr[p] |= (1 << Bit%8);
-};
-void SCharData::ClearBit(unsigned char Bit) {
-       int p = Bit/8;
-       CArr[p] &= ~(1 << Bit%8);
-};
-bool SCharData::GetBit(unsigned char Bit) {
-       int p = (unsigned char)Bit/8;
-       return (CArr[p] & (1 << Bit%8))!=0;
-};
-
-/////////////////////////////////////////////////////////////////
-//////////////////////  RegExp Class  ///////////////////////////
-/////////////////////////////////////////////////////////////////
-
-PosRegExp::PosRegExp() {
-       Info = 0;
-       Exprn = 0;
-       NoMoves = false;
-       Error = true;
-       FirstChar = 0;
-       CurMatch = 0;
-};
-PosRegExp::~PosRegExp() {
-       if (Info) delete Info;
-};
-
-bool PosRegExp::SetExpr(const char *Expr) {
-       if (!this) return false;
-       Error = true;
-       CurMatch = 0;
-       if (SetExprLow(Expr)) Error = false;
-       return !Error;
-};
-bool PosRegExp::isok() {
-       return !Error;
-};
-
-
-bool PosRegExp::SetExprLow(const char *Expr) {
-       int Len = strlen(Expr);
-       bool  Ok = false;
-       int i,j,s = 0,pos,tmp;
-       int EnterBr = 0,EnterGr = 0,EnterFg = 0;
-
-       if (Info) delete Info;
-       Info = new SRegInfo;
-       Exprn = new int[Len];
-
-       NoCase = false;
-       Extend = false;
-       if (Expr[0] == '/') s++;
-       else return false;
-
-       for (i = Len; i > 0 && !Ok;i--)
-               if (Expr[i] == '/') {
-                       Len = i-s;
-                       Ok = true;
-                       for (int j = i+1; Expr[j]; j++) {
-                               if (Expr[j] == 'i') NoCase = true;
-                               if (Expr[j] == 'x') Extend = true;
-                       };
-               };
-       if (!Ok) return false;
-
-       ////////////////////////////////
-       for (j = 0,pos = 0; j < Len; j++,pos++) {
-               if (Extend && Expr[j+s] == ' ') {
-                       pos--;
-                       continue;
-               };
-
-               Exprn[pos] = (int)(unsigned char)Expr[j+s];
-
-               if (Expr[j+s] == BackSlash) {
-                       switch (Expr[j+s+1]) {
-                       case 'd':
-                               Exprn[pos] = ReDigit;
-                               break;
-                       case 'D':
-                               Exprn[pos] = ReNDigit;
-                               break;
-                       case 'w':
-                               Exprn[pos] = ReWordSymb;
-                               break;
-                       case 'W':
-                               Exprn[pos] = ReNWordSymb;
-                               break;
-                       case 's':
-                               Exprn[pos] = ReWSpace;
-                               break;
-                       case 'S':
-                               Exprn[pos] = ReNWSpace;
-                               break;
-                       case 'u':
-                               Exprn[pos] = ReUCase;
-                               break;
-                       case 'l':
-                               Exprn[pos] = ReNUCase;
-                               break;
-                       case 't':
-                               Exprn[pos] = '\t';
-                               break;
-                       case 'n':
-                               Exprn[pos] = '\n';
-                               break;
-                       case 'r':
-                               Exprn[pos] = '\r';
-                               break;
-                       case 'b':
-                               Exprn[pos] = ReWBound;
-                               break;
-                       case 'B':
-                               Exprn[pos] = ReNWBound;
-                               break;
-                       case 'c':
-                               Exprn[pos] = RePreNW;
-                               break;
-                       case 'm':
-                               Exprn[pos] = ReStart;
-                               break;
-                       case 'M':
-                               Exprn[pos] = ReEnd;
-                               break;
-                       case 'x':
-                               tmp = toupper(Expr[j+s+2])-0x30;
-                               tmp = (tmp>9?tmp-7:tmp)<<4;
-                               tmp += (toupper(Expr[j+s+3])-0x30)>9?toupper(Expr[j+s+3])-0x37:(toupper(Expr[j+s+3])-0x30);
-                               Exprn[pos] = tmp;
-                               j+=2;
-                               break;
-                       case 'y':
-                               tmp = Expr[j+s+2] - 0x30;
-                               if (tmp >= 0 && tmp <= 9) {
-                                       if (tmp == 1) {
-                                               tmp = 10 + Expr[j+s+3] - 0x30;
-                                               if (tmp >= 10 && tmp <= 19) j++;
-                                               else tmp = 1;
-                                       };
-                                       Exprn[pos] = ReBkTrace + tmp;
-                                       j++;
-                                       break;
-                               };
-                       default:
-                               tmp = Expr[j+s+1] - 0x30;
-                               if (tmp >= 0 && tmp <= 9) {
-                                       if (tmp == 1) {
-                                               tmp = 10 + Expr[j+s+2] - 0x30;
-                                               if (tmp >= 10 && tmp <= 19) j++;
-                                               else tmp = 1;
-                                       };
-                                       Exprn[pos] = ReBkBrack + tmp;
-                                       break;
-                               } else
-                                       Exprn[pos] = Expr[j+s+1];
-                               break;
-                       };
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == ']') {
-                       Exprn[pos] = ReEnumE;
-                       if (EnterFg || !EnterGr) return false;
-                       EnterGr--;
-               };
-               if (Expr[j+s] == '-' && EnterGr) Exprn[pos] = ReFrToEnum;
-
-               if (EnterGr) continue;
-
-               if (Expr[j+s] == '[' && Expr[j+s+1] == '^') {
-                       Exprn[pos] = ReNEnumS;
-                       if (EnterFg) return false;
-                       EnterGr++;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '*' && Expr[j+s+1] == '?') {
-                       Exprn[pos] = ReNGMul;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '+' && Expr[j+s+1] == '?') {
-                       Exprn[pos] = ReNGPlus;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '?') {
-                       Exprn[pos] = ReNGQuest;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '#' &&
-                       Expr[j+s+2]>='0' && Expr[j+s+2]<='9') {
-                       Exprn[pos] = ReBehind+Expr[j+s+2]-0x30;
-                       j+=2;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '~' &&
-                       Expr[j+s+2]>='0' && Expr[j+s+2]<='9') {
-                       Exprn[pos] = ReNBehind+Expr[j+s+2]-0x30;
-                       j+=2;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '=') {
-                       Exprn[pos] = ReAhead;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '?' && Expr[j+s+1] == '!') {
-                       Exprn[pos] = ReNAhead;
-                       j++;
-                       continue;
-               };
-
-               if (Expr[j+s] == '(') {
-                       Exprn[pos] = ReLBrack;
-                       if (EnterFg) return false;
-                       EnterBr++;
-               };
-               if (Expr[j+s] == ')') {
-                       Exprn[pos] = ReRBrack;
-                       if (!EnterBr || EnterFg) return false;
-                       EnterBr--;
-               };
-               if (Expr[j+s] == '[') {
-                       Exprn[pos] = ReEnumS;
-                       if (EnterFg) return false;
-                       EnterGr++;
-               };
-               if (Expr[j+s] == '{') {
-                       Exprn[pos] = ReRangeS;
-                       if (EnterFg) return false;
-                       EnterFg++;
-               };
-               if (Expr[j+s] == '}' && Expr[j+s+1] == '?') {
-                       Exprn[pos] = ReNGRangeE;
-                       if (!EnterFg) return false;
-                       EnterFg--;
-                       j++;
-                       continue;
-               };
-               if (Expr[j+s] == '}') {
-                       Exprn[pos] = ReRangeE;
-                       if (!EnterFg) return false;
-                       EnterFg--;
-               };
-
-               if (Expr[j+s] == '^') Exprn[pos] = ReSoL;
-               if (Expr[j+s] == '$') Exprn[pos] = ReEoL;
-               if (Expr[j+s] == '.') Exprn[pos] = ReAnyChr;
-               if (Expr[j+s] == '*') Exprn[pos] = ReMul;
-               if (Expr[j+s] == '+') Exprn[pos] = RePlus;
-               if (Expr[j+s] == '?') Exprn[pos] = ReQuest;
-               if (Expr[j+s] == '|') Exprn[pos] = ReOr;
-       };
-       if (EnterGr || EnterBr || EnterFg) return false;
-
-       Info->Op = ReBrackets;
-       Info->un.Param = new SRegInfo;
-       Info->s = CurMatch++;
-
-       if (!SetStructs(Info->un.Param,0,pos)) return false;
-       Optimize();
-       delete Exprn;
-       return true;
-};
-
-void PosRegExp::Optimize() {
-       PRegInfo Next = Info;
-       FirstChar = 0;
-       while(Next) {
-               if (Next->Op == ReBrackets || Next->Op == RePlus  || Next->Op == ReNGPlus) {
-                       Next = Next->un.Param;
-                       continue;
-               };
-               if (Next->Op == ReSymb) {
-                       if (Next->un.Symb & 0xFF00 &&  Next->un.Symb != ReSoL && Next->un.Symb != ReWBound)
-                               break;
-                       FirstChar = Next->un.Symb;
-                       break;
-               };
-               break;
-       };
-};
-
-bool PosRegExp::SetStructs(PRegInfo &re,int start,int end) {
-       PRegInfo Next,Prev,Prev2;
-       int comma,st,en,ng,i, j,k;
-       int EnterBr;
-       bool Add;
-
-       if (end - start < 0) return false;
-       Next = re;
-       for (i = start; i < end; i++) {
-               Add = false;
-               // Ops
-               if (Exprn[i] > ReBlockOps && Exprn[i] < ReSymbolOps) {
-                       Next->un.Param = 0;
-                       Next->Op = (EOps)Exprn[i];
-                       Add = true;
-               };
-               // {n,m}
-               if (Exprn[i] == ReRangeS) {
-                       st = i;
-                       en = -1;
-                       comma = -1;
-                       ng = 0;
-                       for (j = i;j < end;j++) {
-                               if (Exprn[j] == ReNGRangeE) {
-                                       en = j;
-                                       ng = 1;
-                                       break;
-                               };
-                               if (Exprn[j] == ReRangeE) {
-                                       en = j;
-                                       break;
-                               };
-                               if ((char)Exprn[j] == ',')
-                                       comma = j;
-                       };
-                       if (en == -1) return false;
-                       if (comma == -1) comma = en;
-                       Next->s = (char)GetNumber(Exprn,st+1,comma);
-                       if (comma != en)
-                               Next->e = (char)GetNumber(Exprn,comma+1,en);
-                       else
-                               Next->e = Next->s;
-                       Next->un.Param = 0;
-                       Next->Op = ng?ReNGRangeNM:ReRangeNM;
-                       if (en-comma == 1) {
-                               Next->e = -1;
-                               Next->Op = ng?ReNGRangeN:ReRangeN;
-                       };
-                       i=j;
-                       Add = true;
-               };
-               // [] [^]
-               if (Exprn[i] == ReEnumS || Exprn[i] == ReNEnumS) {
-                       Next->Op = (Exprn[i] == ReEnumS)?ReEnum:ReNEnum;
-                       for (j = i+1;j < end;j++) {
-                               if (Exprn[j] == ReEnumE)
-                                       break;
-                       };
-                       if (j == end) return false;
-                       Next->un.ChrClass = new SCharData;
-                       memset(Next->un.ChrClass, 0, 32);
-                       for (j = i+1;Exprn[j] != ReEnumE;j++) {
-                               if (Exprn[j+1] == ReFrToEnum) {
-                                       for (i = (Exprn[j]&0xFF); i < (Exprn[j+2]&0xFF);i++)
-                                               Next->un.ChrClass->SetBit(i&0xFF);
-                                       j++;
-                                       continue;
-                               };
-                               switch(Exprn[j]) {
-                               case ReDigit:
-                                       for (k = 0x30;k < 0x40;k++)
-                                               if (IsDigit((char)k))
-                                                       Next->un.ChrClass->SetBit(k);
-                                       break;
-                               case ReNDigit:
-                                       for (k = 0x30;k < 0x40;k++)
-                                               if (!IsDigit((char)k))
-                                                       Next->un.ChrClass->SetBit(k);
-                                       Next->un.ChrClass->ClearBit(0x0a);
-                                       Next->un.ChrClass->ClearBit(0x0d);
-                                       break;
-                               case ReWordSymb:
-                                       for (k = 0;k < 256;k++)
-                                               if (IsWord((char)k))
-                                                       Next->un.ChrClass->SetBit(k);
-                                       break;
-                               case ReNWordSymb:
-                                       for (k = 0;k < 256;k++)
-                                               if (!IsWord((char)k))
-                                                       Next->un.ChrClass->SetBit(k);
-                                       Next->un.ChrClass->ClearBit(0x0a);
-                                       Next->un.ChrClass->ClearBit(0x0d);
-                                       break;
-                               case ReWSpace:
-                                       Next->un.ChrClass->SetBit(0x20);
-                                       Next->un.ChrClass->SetBit(0x09);
-                                       break;
-                               case ReNWSpace:
-                                       memset(Next->un.ChrClass->IArr, 0xFF, 32);
-                                       Next->un.ChrClass->ClearBit(0x20);
-                                       Next->un.ChrClass->ClearBit(0x09);
-                                       Next->un.ChrClass->ClearBit(0x0a);
-                                       Next->un.ChrClass->ClearBit(0x0d);
-                                       break;
-                               default:
-                                       if (!(Exprn[j]&0xFF00))
-                                               Next->un.ChrClass->SetBit(Exprn[j]&0xFF);
-                                       break;
-                               };
-                       };
-                       Add = true;
-                       i=j;
-               };
-               // ( ... )
-               if (Exprn[i] == ReLBrack) {
-                       EnterBr = 1;
-                       for (j = i+1;j < end;j++) {
-                               if (Exprn[j] == ReLBrack) EnterBr++;
-                               if (Exprn[j] == ReRBrack) EnterBr--;
-                               if (!EnterBr) break;
-                       };
-                       if (EnterBr) return false;
-                       Next->Op = ReBrackets;
-                       Next->un.Param = new SRegInfo;
-                       Next->un.Param->Parent = Next;
-                       Next->s = CurMatch++;
-                       if (CurMatch > MatchesNum) CurMatch = MatchesNum;
-                       if (!SetStructs(Next->un.Param,i+1,j)) return false;
-                       Add = true;
-                       i=j;
-               };
-               if ((Exprn[i]&0xFF00) == ReBkTrace) {
-                       Next->Op = ReBkTrace;
-                       Next->un.Symb = Exprn[i]&0xFF;
-                       Add = true;
-               };
-               if ((Exprn[i]&0xFF00) == ReBkBrack) {
-                       Next->Op = ReBkBrack;
-                       Next->un.Symb = Exprn[i]&0xFF;
-                       Add = true;
-               };
-               if ((Exprn[i]&0xFF00) == ReBehind) {
-                       Next->Op = ReBehind;
-                       Next->s = Exprn[i]&0xFF;
-                       Add = true;
-               };
-               if ((Exprn[i]&0xFF00) == ReNBehind) {
-                       Next->Op = ReNBehind;
-                       Next->s = Exprn[i]&0xFF;
-                       Add = true;
-               };
-               // Chars
-               if (Exprn[i] >= ReAnyChr && Exprn[i] < ReTemp || Exprn[i] < 0x100) {
-                       Next->Op = ReSymb;
-                       Next->un.Symb = Exprn[i];
-                       Add = true;
-               };
-               // Next
-               if (Add && i != end-1) {
-                       Next->Next = new SRegInfo;
-                       Next->Next->Parent = Next->Parent;
-                       Next = Next->Next;
-               };
-       };
-       Next = re;
-       Prev = Prev2 = 0;
-       while(Next) {
-               if (Next->Op > ReBlockOps && Next->Op < ReSymbolOps) {
-                       if (!Prev) return false;
-                       if (!Prev2) re = Next;
-                       else Prev2->Next = Next;
-                       //if (Prev->Op > ReBlockOps && Prev->Op < ReSymbolOps) return false;
-                       Prev->Parent = Next;
-                       Prev->Next = 0;
-                       Next->un.Param = Prev;
-                       Prev = Prev2;
-               };
-               Prev2 = Prev;
-               Prev = Next;
-               Next = Next->Next;
-       };
-
-       return true;
-};
-
-/////////////////////////////////////////////////////////////////
-/////////////////////////  Parsing  /////////////////////////////
-/////////////////////////////////////////////////////////////////
-
-bool PosRegExp::CheckSymb(int Symb,bool Inc) {
-       bool Res;
-       char ch;
-       switch(Symb) {
-       case ReAnyChr:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = ch != '\r' && ch != '\n';
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReSoL:
-               if (posStart == posParse)
-                       return true;
-               ch = CharAt(posParse-1,param);
-               return ch == '\n' || ch == '\r';
-       case ReEoL:
-               if (posEnd == posParse)
-                       return true;
-               ch = CharAt(posParse,param);
-               return ch == '\n' || ch == '\r';
-       case ReDigit:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = (ch >= 0x30 && ch <= 0x39);
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReNDigit:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = !(ch >= 0x30 && ch <= 0x39) && ch != '\r' && ch != '\n';
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReWordSymb:
-               if (posParse >= posEnd) return false;
-               Res = IsWord(CharAt(posParse,param));
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReNWordSymb:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = !IsWord(ch) && ch != '\r' && ch != '\n';
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReWSpace:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = (ch == 0x20 || ch == '\t');
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReNWSpace:
-               if (posParse >= posEnd) return false;
-               ch = CharAt(posParse,param);
-               Res = !(ch == 0x20 || ch == '\t') && ch != '\r' && ch != '\n';
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReUCase:
-               if (posParse >= posEnd) return false;
-               Res = IsUpperCase(CharAt(posParse,param));
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReNUCase:
-               if (posParse >= posEnd) return false;
-               Res = IsLowerCase(CharAt(posParse,param));
-               if (Res && Inc) posParse++;
-               return Res;
-       case ReWBound:
-               if (posParse >= posEnd) return true;
-               ch = CharAt(posParse,param);
-               return IsWord(CharAt(posParse,param)) && (posParse == posStart || !IsWord(CharAt(posParse-1,param)));
-       case ReNWBound:
-               if (posParse >= posEnd) return true;
-               return !IsWord(CharAt(posParse,param)) && IsWord(CharAt(posParse-1,param));
-       case RePreNW:
-               if (posParse >= posEnd) return true;
-               return (posParse == posStart || !IsWord(CharAt(posParse-1,param)));
-       case ReStart:
-               Matches->s[0] = (posParse-posStart);
-               return true;
-       case ReEnd:
-               Matches->e[0] = (posParse-posStart);
-               return true;
-       default:
-               if ((Symb & 0xFF00) || posParse >= posEnd) return false;
-               if (NoCase) {
-                       if (LowCase(CharAt(posParse,param)) != LowCase((char)Symb&0xFF)) return false;
-               } else
-                       if (CharAt(posParse,param) != (char)(Symb&0xFF)) return false;
-               if (Inc) posParse++;
-               return true;
-       };
-}
-
-bool PosRegExp::LowParseRe(PRegInfo &Next) {
-       PRegInfo OrNext;
-       int i,match,sv;
-       int posStr;
-
-       switch(Next->Op) {
-       case ReSymb:
-               if (!CheckSymb(Next->un.Symb,true)) return false;
-               break;
-       case ReEmpty:
-               break;
-       case ReBkTrace:
-               if (!posBkStr | !BkTrace) return false;
-               sv = Next->un.Symb;
-               posStr = posParse;
-               for (i = BkTrace->s[sv]; i < BkTrace->e[sv]; i++) {
-                       if (CharAt(posStr,param) != CharAt(posBkStr+i,param) || posEnd == posStr) return false;
-                       posStr++;
-               };
-               posParse = posStr;
-               break;
-       case ReBkBrack:
-               sv = Next->un.Symb;
-               posStr = posParse;
-               if (Matches->s[sv] == -1 || Matches->e[sv] == -1) return false;
-               for (i = Matches->s[sv]; i < Matches->e[sv]; i++) {
-                       if (CharAt(posStr,param) != CharAt(posStart+i,param) || posEnd == posStr) return false;
-                       posStr++;
-               };
-               posParse = posStr;
-               break;
-       case ReBehind:
-               sv = Next->s;
-               posStr = posParse;
-               posParse -= sv;
-               if (!LowParse(Next->un.Param)) return false;
-               posParse = posStr;
-               break;
-       case ReNBehind:
-               sv = Next->s;
-               posStr = posParse;
-               posParse -= sv;
-               if (LowParse(Next->un.Param)) return false;
-               posParse = posStr;
-               break;
-       case ReAhead:
-               posStr = posParse;
-               if (!LowParse(Next->un.Param)) return false;
-               posParse = posStr;
-               break;
-       case ReNAhead:
-               posStr = posParse;
-               if (LowParse(Next->un.Param)) return false;
-               posParse = posStr;
-               break;
-       case ReEnum:
-               if (posParse >= posEnd) return false;
-               if (!Next->un.ChrClass->GetBit(CharAt(posParse,param))) return false;
-               posParse++;
-               break;
-       case ReNEnum:
-               if (posParse >= posEnd) return false;
-               if (Next->un.ChrClass->GetBit(CharAt(posParse,param))) return false;
-               posParse++;
-               break;
-       case ReBrackets:
-               match = Next->s;
-               sv = posParse-posStart;
-               posStr = posParse;
-               if (LowParse(Next->un.Param)) {
-                       if (match || (Matches->s[match] == -1))
-                               Matches->s[match] = sv;
-                       if (match || (Matches->e[match] == -1))
-                               Matches->e[match] = posParse-posStart;
-                       return true;
-               };
-               posParse = posStr;
-               return false;
-       case ReMul:
-               posStr = posParse;
-               while (LowParse(Next->un.Param));
-               while(!LowCheckNext(Next) && posStr < posParse) posParse--;
-               break;
-       case ReNGMul:
-               do {
-                       if (LowCheckNext(Next)) break;
-               } while (LowParse(Next->un.Param));
-               break;
-       case RePlus:
-               posStr = posParse;
-               match = false;
-               while (LowParse(Next->un.Param))
-                       match = true;
-               if (!match) return false;
-               while(!LowCheckNext(Next) && posStr < posParse) posParse--;
-               break;
-       case ReNGPlus:
-               if (!LowParse(Next->un.Param)) return false;
-               do {
-                       if (LowCheckNext(Next)) break;
-               } while (LowParse(Next->un.Param));
-               break;
-       case ReQuest:
-               LowParse(Next->un.Param);
-               break;
-       case ReNGQuest:
-               if (LowCheckNext(Next)) break;
-               if (!LowParse(Next->un.Param)) return false;
-               break;
-       case ReOr:
-               OrNext = Next;
-               // posStr = posParse;
-               if (LowParse(Next->un.Param)) {
-                       while (OrNext && OrNext->Op == ReOr)
-                               OrNext = OrNext->Next;
-                       /*if (!LowCheckNext(OrNext)){
-                         posParse = posStr;
-                         OrNext = Next;
-               };*/
-               };
-               Next = OrNext;
-               break;
-       case ReRangeN:
-               posStr = posParse;
-               i = 0;
-               while (LowParse(Next->un.Param)) i++; // ???
-               do {
-                       if (i < Next->s) {
-                               posParse = posStr;
-                               return false;
-                       };
-                       i--;
-               } while(!LowCheckNext(Next) && posStr < posParse--);
-               break;
-       case ReNGRangeN:
-               posStr = posParse;
-               i = 0;
-               while (LowParse(Next->un.Param)) {
-                       i++;
-                       if (i >= Next->s && LowCheckNext(Next)) // ???
-                               break;
-               };
-               if (i < Next->s) {
-                       posParse = posStr;
-                       return false;
-               };
-               break;
-       case ReRangeNM:
-               posStr = posParse;
-               i = 0;
-               while (i < Next->s && LowParse(Next->un.Param)) // ???
-                       i++;
-               if (i < Next->s) {
-                       posParse = posStr;
-                       return false;
-               };
-               while (i < Next->e && LowParse(Next->un.Param)) // ???
-                       i++;
-
-               while(!LowCheckNext(Next)) {
-                       i--;
-                       posParse--;
-                       if (i < Next->s) {
-                               posParse = posStr;
-                               return false;
-                       };
-               };
-               break;
-       case ReNGRangeNM:
-               posStr = posParse;
-               i = 0;
-               while (i < Next->s && LowParse(Next->un.Param)) // ???
-                       i++;
-               if (i < Next->s) {
-                       posParse = posStr;
-                       return false;
-               };
-               while(!LowCheckNext(Next)) {
-                       i++;
-                       if (!LowParse(Next->un.Param) || i > Next->e) { // ???
-                               posParse = posStr;
-                               return false;
-                       };
-               };
-               break;
-       };
-       return true;
-};
-
-bool PosRegExp::LowCheckNext(PRegInfo Re) {
-       PRegInfo Next;
-       int tmp = posParse;
-       Next = Re;
-       do {
-               if (Next && Next->Op == ReOr)
-                       while (Next && Next->Op == ReOr)
-                               Next = Next->Next;
-               if (Next->Next && !LowParse(Next->Next)) {
-                       posParse = tmp;
-                       Ok = false;
-                       return false;
-               };
-               Next = Next->Parent;
-       } while(Next);
-       posParse = tmp;
-       if (Ok != false) Ok = true;
-       return true;
-};
-
-bool PosRegExp::LowParse(PRegInfo Re) {
-       while(Re && posParse <= posEnd) {
-               if (!LowParseRe(Re)) return false;
-               if (Re) Re = Re->Next;
-       };
-       return true;
-};
-
-bool PosRegExp::QuickCheck() {
-       if (!NoMoves || !FirstChar)
-               return true;
-       switch(FirstChar) {
-       case ReSoL:
-               if (posParse != posStart) return false;
-               return true;
-       case ReWBound:
-               return IsWord(CharAt(posParse,param)) && (posParse == posStart || !IsWord(CharAt(posParse-1,param)));
-       default:
-               if (NoCase && LowCase(CharAt(posParse,param)) != LowCase(FirstChar)) return false;
-               if (!NoCase && CharAt(posParse,param) != (char)FirstChar) return false;
-               return true;
-       };
-};
-
-bool PosRegExp::ParseRe(int posStr) {
-       if (Error) return false;
-
-       posParse = posStr;
-       if (!QuickCheck()) return false;
-
-       for (int i = 0; i < MatchesNum; i++)
-               Matches->s[i] = Matches->e[i] = -1;
-       Matches->CurMatch = CurMatch;
-
-       Ok = -1;
-       //try{
-       do {
-               if (!LowParse(Info)) {
-                       if (NoMoves) return false;
-               } else
-                       return true;
-               posParse = ++posStr;
-       } while(posParse != posEnd+1);
-       return false;
-       //}__except(){
-       //  return true;
-       //};
-}
-;
-
-bool PosRegExp::Parse(int posStr,int posSol, int posEol, PMatches Mtch, int Moves) {
-       if (!this) return false;
-
-       bool s = NoMoves;
-       if (Moves != -1) NoMoves = Moves!=0;
-       posStart = posSol;
-       posEnd   = posEol;
-       Matches = Mtch;
-       bool r = ParseRe(posStr);
-       NoMoves = s;
-       return r;
-};
-
-bool PosRegExp::Parse(int posStr, int posStop, PMatches Mtch) {
-       if (!this) return false;
-       posStart = posStr;
-       posEnd = posStop;
-       Matches = Mtch;
-       return ParseRe(posStr);
-};
-
-bool PosRegExp::SetNoMoves(bool Moves) {
-       NoMoves = Moves;
-       return true;
-};
-
-bool PosRegExp::SetBkTrace(int posStr,PMatches Trace) {
-       BkTrace = Trace;
-       posBkStr = posStr;
-       return true;
-};
-
-#define EVAL_MATCHES 16
-#define EVAL_CHUNKSIZE 256
-
-#define EVAL_LOWERCASE 1
-#define EVAL_UPPERCASE 2
-#define EVAL_LOWERCASE_NEXT 4
-#define EVAL_UPPERCASE_NEXT 8
-
-bool PosRegExp::Evaluate(char *Expr, int posStr, PMatches Mtch, char **Res) {
-       int length,
-       newlength,
-       chunklength,
-       value,
-       size,
-       src,
-       end;
-       unsigned flag;
-       char ch,
-       *dest,
-       *pool;
-
-       size = EVAL_CHUNKSIZE;
-       pool = (char*) malloc (size);
-       dest = pool;
-       length = 0;
-       flag = 0;
-       while (*Expr) {
-               switch (ch = *Expr++) {
-               case '\\':
-                       switch (ch = *Expr++) {
-                       case 'A':
-                       case 'B':
-                       case 'C':
-                       case 'D':
-                       case 'E':
-                       case 'F':
-                               ch -= ('A' - '0');
-                       case '0':
-                       case '1':
-                       case '2':
-                       case '3':
-                       case '4':
-                       case '5':
-                       case '6':
-                       case '7':
-                       case '8':
-                       case '9':
-                               value = ch - '0';
-                               if (Mtch->s[value] != -1 && value < EVAL_MATCHES) {
-                                       chunklength = Mtch->e[value] - Mtch->s[value];
-                                       if (chunklength) {
-                                               newlength = chunklength + length;
-                                               if (newlength > size) {
-                                                       do
-                                                               size += EVAL_CHUNKSIZE;
-                                                       while (size < newlength);
-                                                       pool = (char*) realloc (pool, size);
-                                                       dest = pool + length;
-                                               }
-                                               length = newlength;
-                                               src = posStr + Mtch->s[value];
-                                               end = posStr + Mtch->e[value];
-                                               if (flag & EVAL_UPPERCASE) {
-                                                       if (flag & EVAL_LOWERCASE_NEXT) {
-                                                               *dest++ = tolower (CharAt(src++,param));
-                                                               flag &= ~EVAL_LOWERCASE_NEXT;
-                                                       }
-                                                       while (src < end)
-                                                               *dest++ = toupper (CharAt(src++,param));
-                                               } else if (flag & EVAL_LOWERCASE) {
-                                                       if (flag & EVAL_UPPERCASE_NEXT) {
-                                                               *dest++ = toupper (CharAt(src++,param));
-                                                               flag &= ~EVAL_UPPERCASE_NEXT;
-                                                       }
-                                                       while (src < end)
-                                                               *dest++ = tolower (CharAt(src++,param));
-                                               } else {
-                                                       if (flag & EVAL_LOWERCASE_NEXT) {
-                                                               *dest++ = tolower (CharAt(src++,param));
-                                                               flag &= ~EVAL_LOWERCASE_NEXT;
-                                                       } else if (flag & EVAL_UPPERCASE_NEXT) {
-                                                               *dest++ = toupper (CharAt(src++,param));
-                                                               flag &= ~EVAL_UPPERCASE_NEXT;
-                                                       }
-                                                       while (src < end)
-                                                               *dest++ = CharAt(src++,param);
-                                               }
-                                       }
-                               } else
-                                       goto error;
-                               continue;
-                       case '\0':
-                               goto error;
-                       case 'r':
-                               ch = '\r';
-                               break;
-                       case 'n':
-                               ch = '\n';
-                               break;
-                       case 'b':
-                               ch = '\b';
-                               break;
-                       case 'a':
-                               ch = '\a';
-                               break;
-                       case 't':
-                               ch = '\t';
-                               break;
-                       case 'U':
-                               flag |= EVAL_UPPERCASE;
-                               continue;
-                       case 'u':
-                               flag |= EVAL_UPPERCASE_NEXT;
-                               continue;
-                       case 'L':
-                               flag |= EVAL_LOWERCASE;
-                               continue;
-                       case 'l':
-                               flag |= EVAL_LOWERCASE_NEXT;
-                               continue;
-                       case 'Q':
-                       case 'q':
-                               flag &= ~(EVAL_UPPERCASE | EVAL_LOWERCASE);
-                               continue;
-                       case 'x':
-                               {
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               value = value + '0' - 'A' + 10;
-                                       if (value > 15)
-                                               goto error;
-                                       ch = value << 4;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               value = value + '0' - 'A' + 10;
-                                       if (value > 15)
-                                               goto error;
-                                       Expr++;
-                                       ch |= value;
-                                       break;
-                               }
-                       case 'd':
-                               {
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch = value * 100;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch += value * 10;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch += value;
-                                       Expr++;
-                                       break;
-                               }
-                       case 'o':
-                               {
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch = value << 6;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch += value << 3;
-                                       Expr++;
-                                       if (!*Expr)
-                                               goto error;
-                                       value = toupper (*Expr) - '0';
-                                       if (value > 9)
-                                               goto error;
-                                       ch |= value;
-                                       Expr++;
-                                       /* break; */
-                               }
-                               /* default:
-                                       break; */
-                       }
-               default:
-                       if (++length > size) {
-                               do
-                                       size += EVAL_CHUNKSIZE;
-                               while (size < length);
-                               pool = (char*) realloc (pool, size);
-                               dest = pool + length - 1;
-                       }
-                       if (flag & EVAL_LOWERCASE_NEXT) {
-                               *dest++ = tolower (ch);
-                               flag &= ~EVAL_LOWERCASE_NEXT;
-                       } else if (flag & EVAL_UPPERCASE_NEXT) {
-                               *dest++ = toupper (ch);
-                               flag &= ~EVAL_UPPERCASE_NEXT;
-                       } else if (flag & EVAL_UPPERCASE)
-                               *dest++ = toupper (ch);
-                       else if (flag & EVAL_LOWERCASE)
-                               *dest++ = tolower (ch);
-                       else
-                               *dest++ = ch;
-               }
-       }
-       if (++length > size) {
-               do
-                       size += EVAL_CHUNKSIZE;
-               while (size < length);
-               pool = (char*) realloc (pool, size);
-               dest = pool + length - 1;
-       }
-       *dest = '\0';
-       *Res = pool;
-       return true;
-error:
-       free (pool);
-       return false;
-}
index a58d143164faea4b6a010e54f3c5028bdec17d31..701b2a82c75aa9f2c164b935ab6589c49ec7cf0b 100644 (file)
@@ -1,6 +1,8 @@
 // SciTE - Scintilla based Text Editor
-// PropSet.cxx - a java style properties file module
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file PropSet.cxx
+ ** A Java style properties file module.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 // Maintain a dictionary of properties
 
 #include "PropSet.h"
 
-bool EqualCaseInsensitive(const char *a, const char *b) {
-#if PLAT_GTK
-       return 0 == strcasecmp(a, b);
-#elif PLAT_WIN
-       return 0 == stricmp(a, b);
-#elif PLAT_WX
-       return 0 == wxStricmp(a, b);
-#endif
-}
-
-SString::size_type SString::npos = -1;
-
-inline unsigned int HashString(const char *s) {
-    unsigned int ret = 0;
-    while (*s) {
-        ret <<= 4;
-        ret ^= *s;
-        s++;
-    }
-    return ret;
-}
-
-// Get a line of input. If end of line escaped with '\\' then continue reading.
-static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
-       bool continuation = true;
-       s[0] = '\0';
-       while ((len > 1) && lenData > 0) {
-               char ch = *fpc;
-               fpc++;
-               lenData--;
-               if ((ch == '\r') || (ch == '\n')) {
-                       if (!continuation) {
-                               if ((lenData > 0) && (ch == '\r') && ((*fpc) == '\n')) {
-                                       // munch the second half of a crlf
-                                       fpc++;
-                                       lenData--;
-                               }
-                               *s = '\0';
-                               return true;
-                       }
-               } else if ((ch == '\\') && (lenData > 0) && ((*fpc == '\r') || (*fpc == '\n'))) {
-                       continuation = true;
-               } else {
-                       continuation = false;
-                       *s++ = ch;
-                       *s = '\0';
-                       len--;
+// The comparison and case changing functions here assume ASCII
+// or extended ASCII such as the normal Windows code page.
+
+static inline char MakeUpperCase(char ch) {
+       if (ch < 'a' || ch > 'z')
+               return ch;
+       else
+               return static_cast<char>(ch - 'a' + 'A');
+}
+
+int CompareCaseInsensitive(const char *a, const char *b) {
+       while (*a && *b) {
+               if (*a != *b) {
+                       char upperA = MakeUpperCase(*a);
+                       char upperB = MakeUpperCase(*b);
+                       if (upperA != upperB)
+                               return upperA - upperB;
                }
+               a++;
+               b++;
        }
-       return false;
+       // Either *a or *b is nul
+       return *a - *b;
+}
+
+int CompareNCaseInsensitive(const char *a, const char *b, int len) {
+       while (*a && *b && len) {
+               if (*a != *b) {
+                       char upperA = MakeUpperCase(*a);
+                       char upperB = MakeUpperCase(*b);
+                       if (upperA != upperB)
+                               return upperA - upperB;
+               }
+               a++;
+               b++;
+               len--;
+       }
+       if (len == 0)
+               return 0;
+       else
+               // Either *a or *b is nul
+               return *a - *b;
+}
+
+bool EqualCaseInsensitive(const char *a, const char *b) {
+       return 0 == CompareCaseInsensitive(a, b);
+}
+
+inline unsigned int HashString(const char *s, int len) {
+       unsigned int ret = 0;
+       while (len--) {
+               ret <<= 4;
+               ret ^= *s;
+               s++;
+       }
+       return ret;
 }
 
 PropSet::PropSet() {
        superPS = 0;
-    for (int root=0; root < hashRoots; root++)
-        props[root] = 0;
+       for (int root = 0; root < hashRoots; root++)
+               props[root] = 0;
 }
 
 PropSet::~PropSet() {
@@ -77,45 +85,66 @@ PropSet::~PropSet() {
        Clear();
 }
 
-void PropSet::Set(const char *key, const char *val) {
-    unsigned int hash = HashString(key);
-       for (Property *p=props[hash % hashRoots]; p; p=p->next) {
-               if ((hash == p->hash) && (0 == strcmp(p->key, key))) {
+void PropSet::Set(const char *key, const char *val, int lenKey, int lenVal) {
+       if (!*key)      // Empty keys are not supported
+               return;
+       if (lenKey == -1)
+               lenKey = strlen(key);
+       if (lenVal == -1)
+               lenVal = strlen(val);
+       unsigned int hash = HashString(key, lenKey);
+       for (Property *p = props[hash % hashRoots]; p; p = p->next) {
+               if ((hash == p->hash) && 
+                       ((strlen(p->key) == static_cast<unsigned int>(lenKey)) && 
+                               (0 == strncmp(p->key, key, lenKey)))) {
                        // Replace current value
                        delete [](p->val);
-                       p->val = StringDup(val);
-                       return;
+                       p->val = StringDup(val, lenVal);
+                       return ;
                }
        }
        // Not found
-    Property *pNew = new Property;
-    if (pNew) {
-        pNew->hash = HashString(key);
-           pNew->key = StringDup(key);
-           pNew->val = StringDup(val);
-           pNew->next = props[hash % hashRoots];
-        props[hash % hashRoots] = pNew;
-    }
+       Property *pNew = new Property;
+       if (pNew) {
+               pNew->hash = hash;
+               pNew->key = StringDup(key, lenKey);
+               pNew->val = StringDup(val, lenVal);
+               pNew->next = props[hash % hashRoots];
+               props[hash % hashRoots] = pNew;
+       }
 }
 
-void PropSet::Set(char *keyval) {
-    while (isspace(*keyval))
-        keyval++;
-       char *eqat = strchr(keyval, '=');
-       if (eqat) {
-               *eqat = '\0';
-               Set(keyval, eqat + 1);
-               *eqat = '=';
+void PropSet::Set(const char *keyVal) {
+       while (isspace(*keyVal))
+               keyVal++;
+       const char *endVal = keyVal;
+       while (*endVal && (*endVal != '\n'))
+               endVal++;
+       const char *eqAt = strchr(keyVal, '=');
+       if (eqAt) {
+               Set(keyVal, eqAt + 1, eqAt-keyVal, endVal - eqAt - 1);
+       } else if (*keyVal) {   // No '=' so assume '=1'
+               Set(keyVal, "1", endVal-keyVal, 1);
        }
 }
 
+void PropSet::SetMultiple(const char *s) {
+       const char *eol = strchr(s, '\n');
+       while (eol) {
+               Set(s);
+               s = eol + 1;
+               eol = strchr(s, '\n');
+       }
+       Set(s);
+}
+
 SString PropSet::Get(const char *key) {
-    unsigned int hash = HashString(key);
-       for (Property *p=props[hash % hashRoots]; p; p=p->next) {
+       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))) {
-            return p->val;
-        }
-    }
+                       return p->val;
+               }
+       }
        if (superPS) {
                // Failed here, so try in base property set
                return superPS->Get(key);
@@ -124,19 +153,35 @@ SString PropSet::Get(const char *key) {
        }
 }
 
+static bool 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;
+}
+
 SString PropSet::GetExpanded(const char *key) {
-    SString val = Get(key);
-    return Expand(val.c_str());
+       SString val = Get(key);
+       if (IncludesVar(val.c_str(), key))
+               return val;
+       return Expand(val.c_str());
 }
 
-SString PropSet::Expand(const char *withvars) {
-       char *base = StringDup(withvars);
+SString PropSet::Expand(const char *withVars) {
+       char *base = StringDup(withVars);
        char *cpvar = strstr(base, "$(");
        while (cpvar) {
                char *cpendvar = strchr(cpvar, ')');
                if (cpendvar) {
                        int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
-                       char *var = StringDup(cpvar+2, lenvar);
+                       char *var = StringDup(cpvar + 2, lenvar);
                        SString val = GetExpanded(var);
                        int newlenbase = strlen(base) + val.length() - lenvar;
                        char *newbase = new char[newlenbase];
@@ -155,14 +200,13 @@ SString PropSet::Expand(const char *withvars) {
 }
 
 int PropSet::GetInt(const char *key, int defaultValue) {
-       SString val = Get(key);
+       SString val = GetExpanded(key);
        if (val.length())
                return val.value();
-       else
-               return defaultValue;
+       return defaultValue;
 }
 
-inline bool isprefix(const char *target, const char *prefix) {
+bool isprefix(const char *target, const char *prefix) {
        while (*target && *prefix) {
                if (*target != *prefix)
                        return false;
@@ -175,69 +219,70 @@ inline bool isprefix(const char *target, const char *prefix) {
                return true;
 }
 
-bool issuffix(const char *target, const char *suffix) {
+static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) {
        int lentarget = strlen(target);
        int lensuffix = strlen(suffix);
        if (lensuffix > lentarget)
                return false;
        for (int i = lensuffix - 1; i >= 0; i--) {
-               if (target[i + lentarget - lensuffix] != suffix[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 = Get(orgkeyfile + 2);
-                                           *cpendvar= ')';
-                                           keyfile = strdup(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)) {
-                                                   *del = delchr;
-                                                   free(keyptr);
-                                                   return p->val;
-                                           }
-                                   } else if (0 == strcmp(keyfile, filename)) {
-                                           *del = delchr;
-                                           free(keyptr);
-                                           return p->val;
-                                   }
-                                   if (delchr == '\0')
-                                           break;
-                                   *del = delchr;
-                                   keyfile = del + 1;
-                           }
-                           free(keyptr);
-
-                           if (0 == strcmp(p->key, keybase)) {
-                                   return p->val;
-                           }
-                   }
-           }
-    }
+       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 (IsSuffixCaseInsensitive(filename, keyfile + 1)) {
+                                                       *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);
@@ -246,6 +291,8 @@ SString PropSet::GetWild(const char *keybase, const char *filename) {
        }
 }
 
+// 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, "$(");
@@ -253,7 +300,7 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
                char *cpendvar = strchr(cpvar, ')');
                if (cpendvar) {
                        int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
-                       char *var = StringDup(cpvar+2, lenvar);
+                       char *var = StringDup(cpvar + 2, lenvar);
                        SString val = GetWild(var, filename);
                        int newlenbase = strlen(base) + val.length() - lenvar;
                        char *newbase = new char[newlenbase];
@@ -272,57 +319,92 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
 }
 
 void PropSet::Clear() {
-    for (int root=0; root < hashRoots; root++) {
-        Property *p=props[root];
-           while (p) {
-            Property *pNext=p->next;
-                   p->hash = 0;
-                   delete p->key;
-                   p->key = 0;
-                   delete p->val;
-                   p->val = 0;
-            delete p;
-            p = pNext;
-        }
-        props[root] = 0;
-    }
-}
-
-void PropSet::ReadFromMemory(const char *data, int len, const char *directoryForImports) {
-       const char *pd = data;
-       char linebuf[60000];
-       bool ifIsTrue = true;
-       while (len > 0) {
-               GetFullLine(pd, len, linebuf, sizeof(linebuf));
-               if (isalpha(linebuf[0]))    // If clause ends with first non-indented line
-                       ifIsTrue = true;
-               if (isprefix(linebuf, "if ")) {
-                       const char *expr = linebuf + strlen("if") + 1;
-                       ifIsTrue = GetInt(expr);
-               } else if (isprefix(linebuf, "import ") && directoryForImports) {
-                       char importPath[1024];
-                       strcpy(importPath, directoryForImports);
-                       strcat(importPath, linebuf + strlen("import") + 1);
-                       strcat(importPath, ".properties");
-                       Read(importPath,directoryForImports);
-               } else if (isalpha(linebuf[0])) {
-                       Set(linebuf);
-               } else if (isspace(linebuf[0]) && ifIsTrue) {
-                       Set(linebuf);
+       for (int root = 0; root < hashRoots; root++) {
+               Property *p = props[root];
+               while (p) {
+                       Property *pNext = p->next;
+                       p->hash = 0;
+                       delete p->key;
+                       p->key = 0;
+                       delete p->val;
+                       p->val = 0;
+                       delete p;
+                       p = pNext;
                }
+               props[root] = 0;
        }
 }
 
-void PropSet::Read(const char *filename, const char *directoryForImports) {
-       char propsData[60000];
-       FILE *rcfile = fopen(filename, "rb");
-       if (rcfile) {
-               int lenFile = fread(propsData, 1, sizeof(propsData), rcfile);
-               fclose(rcfile);
-               ReadFromMemory(propsData, lenFile, directoryForImports);
-       } else {
-               //printf("Could not open <%s>\n", filename);
+char *PropSet::ToString() {
+       unsigned int len=0;
+       for (int r = 0; r < hashRoots; r++) {
+               for (Property *p = props[r]; p; p = p->next) {
+                       len += strlen(p->key) + 1;
+                       len += strlen(p->val) + 1;
+               }
+       }
+       if (len == 0)
+               len = 1;        // Return as empty string
+       char *ret = new char [len];
+       if (ret) {
+               char *w = ret;
+               for (int root = 0; root < hashRoots; root++) {
+                       for (Property *p = props[root]; p; p = p->next) {
+                               strcpy(w, p->key);
+                               w += strlen(p->key);
+                               *w++ = '=';
+                               strcpy(w, p->val);
+                               w += strlen(p->val);
+                               *w++ = '\n';
+                       }
+               }
+               ret[len-1] = '\0';
+       }
+       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;
 }
 
 static bool iswordsep(char ch, bool onlyLineEnds) {
@@ -333,10 +415,11 @@ static bool iswordsep(char ch, bool onlyLineEnds) {
        return ch == '\r' || ch == '\n';
 }
 
-// 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.
+ */
 static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) {
-#if 1
        char prev = '\n';
        int words = 0;
        for (int j = 0; wordlist[j]; j++) {
@@ -365,50 +448,14 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
        } else {
                *len = 0;
        }
-#else
-       int words = 0; // length of the returned buffer of pointers
-       #undef APICHUNK // how many pointers will be pre-allocated (to avoid buffer reallocation on each new pointer)
-       #define APICHUNK 256
-       int size = APICHUNK; // real size of the returned buffer of pointers
-       char **keywords; // buffer for the pointers returned
-       int slen = strlen(wordlist); //length of the buffer with api file
-       keywords = (char**) malloc((size + 1) * sizeof (*keywords));
-       words = 0;
-       for (int k = 0;;) {
-               while (iswordsep(wordlist[k], onlyLineEnds))
-                       wordlist[k++] = '\0';
-               if (k >= slen)
-                       break;
-               if (words >= size) {
-                       do
-                               size += APICHUNK;
-                       while (size <= words);
-                       keywords = (char**) realloc(keywords, (size + 1) * sizeof (*keywords));
-               }
-               keywords[words++] = wordlist + k;
-               do
-                       if (k < slen)
-                               k++;
-                       else
-                               goto out;
-               while (!iswordsep(wordlist[k], onlyLineEnds));
-       }
-out:
-       keywords[words] = wordlist + slen;
-       *len = words;
-#endif
        return keywords;
 }
 
 void WordList::Clear() {
        if (words) {
                delete []list;
-#if 1
-        delete []words;
-#else
-               free(words);
-#endif
-               free(wordsNoCase);
+               delete []words;
+               delete []wordsNoCase;
        }
        words = 0;
        wordsNoCase = 0;
@@ -421,7 +468,7 @@ void WordList::Set(const char *s) {
        list = StringDup(s);
        sorted = false;
        words = ArrayFromWordList(list, &len, onlyLineEnds);
-       wordsNoCase = (char**) malloc ((len + 1) * sizeof (*wordsNoCase));
+       wordsNoCase = new char * [len + 1];
        memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
 }
 
@@ -434,27 +481,27 @@ char *WordList::Allocate(int size) {
 void WordList::SetFromAllocated() {
        sorted = false;
        words = ArrayFromWordList(list, &len, onlyLineEnds);
-       wordsNoCase = (char**) malloc ((len + 1) * sizeof (*wordsNoCase));
+       wordsNoCase = new char * [len + 1];
        memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
 }
 
 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 strcasecmp(*(char**)(a1), *(char**)(a2));
+       // Can't work out the correct incantation to use modern casts here
+       return CompareCaseInsensitive(*(char**)(a1), *(char**)(a2));
 }
 
 static void SortWordList(char **words, char **wordsNoCase, unsigned int len) {
        qsort(reinterpret_cast<void*>(words), len, sizeof(*words),
-               cmpString);
+             cmpString);
        qsort(reinterpret_cast<void*>(wordsNoCase), len, sizeof(*wordsNoCase),
-               cmpStringNoCase);
+             cmpStringNoCase);
 }
+
 bool WordList::InList(const char *s) {
        if (0 == words)
                return false;
@@ -485,13 +532,28 @@ bool WordList::InList(const char *s) {
                        j++;
                }
        }
+       j = starts['^'];
+       if (j >= 0) {
+               while (words[j][0] == '^') {
+                       const char *a = words[j] + 1;
+                       const char *b = s;
+                       while (*a && *a == *b) {
+                               a++;
+                               b++;
+                       }
+                       if (!*a)
+                               return true;
+                       j++;
+               }
+       }
        return false;
 }
 
 /**
- * Returns an element (complete) of the wordlist array which has the beginning
- * the same as the passed string. The length of the word to compare is passed
- * too. Letter case can be ignored or preserved (default).
+ * 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 /*= -1*/, bool ignoreCase /*= false*/) {
        int start = 0; // lower bound of the api array block to search
@@ -506,57 +568,84 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1
                sorted = true;
                SortWordList(words, wordsNoCase, len);
        }
-       if (ignoreCase)
+       if (ignoreCase) {
                while (start <= end) { // binary searching loop
                        pivot = (start + end) >> 1;
                        word = wordsNoCase[pivot];
-                       cond = strncasecmp(wordStart, word, searchLen);
+                       cond = CompareNCaseInsensitive(wordStart, word, searchLen);
                        if (!cond && nonFuncChar(word[searchLen])) // maybe there should be a "non-word character" test here?
                                return word; // result must not be freed with free()
-                       else if (cond < 0)
-                               end = pivot - 1;
                        else if (cond > 0)
                                start = pivot + 1;
+                       else if (cond <= 0)
+                               end = pivot - 1;
                }
-       else // preserve the letter case
+       } else { // preserve the letter case
                while (start <= end) { // binary searching loop
                        pivot = (start + end) >> 1;
                        word = words[pivot];
                        cond = strncmp(wordStart, word, searchLen);
                        if (!cond && nonFuncChar(word[searchLen])) // maybe there should be a "non-word character" test here?
                                return word; // result must not be freed with free()
-                       else if (cond >= 0)
+                       else if (cond > 0)
                                start = pivot + 1;
-                       else if (cond < 0)
+                       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:" 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 '(', or ':'. If that fails go to the end of the string.
+       const char *endWord = strchr(word, '(');
+       if (!endWord)
+               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 '(', ':', or '\0'
+               // Move backwards over any spaces
+               while ((endWord > word) && (isspace(*endWord))) {
+                       endWord--;
+               }
+       }
+       return endWord - word;
+}
+
 /**
  * Returns elements (first words of them) of the wordlist array which have
- * the beginning the same as the passed string. The length of the word to
- * compare is passed too. Letter case can be ignored or preserved (default).
+ * 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 a free() call.
+ * NOTE: returned buffer has to be freed with delete[].
  */
-char *WordList::GetNearestWords(const char *wordStart, int searchLen /*= -1*/, bool ignoreCase /*= false*/) {
+char *WordList::GetNearestWords(
+    const char *wordStart,
+    int searchLen /*= -1*/,
+    bool ignoreCase /*= false*/,
+    char otherSeparator /*= '\0'*/) {
        int wordlen; // length of the word part (before the '(' brace) of the api array element
-       int length = 0; // length of the returned buffer of words (string)
-       int newlength; // length of the new buffer before the reallocating itself
-       #undef WORDCHUNK // how many characters will be pre-allocated (to avoid buffer reallocation on each new word)
-       #define WORDCHUNK 100
-       int size = WORDCHUNK; // real size of the returned buffer of words
-       char *buffer; // buffer for the words returned
+       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)
-       int oldpivot; // pivot storage to be able to browse the api array upwards and then downwards
-       const char *word; // api array element just being compared
-       const char *brace; // position of the opening brace in the api array element just being compared
 
        if (0 == words)
                return NULL;
@@ -564,179 +653,58 @@ char *WordList::GetNearestWords(const char *wordStart, int searchLen /*= -1*/, b
                sorted = true;
                SortWordList(words, wordsNoCase, len);
        }
-       buffer = (char*) malloc(size);
-       *buffer = '\0';
-       if (ignoreCase)
-               while (start <= end) { // binary searching loop
-                       pivot = (start + end) >> 1;
-                       word = wordsNoCase[pivot];
-                       cond = strncasecmp(wordStart, word, searchLen);
+       if (ignoreCase) {
+               while (start <= end) { // Binary searching loop
+                       pivot = (start + end) / 2;
+                       cond = CompareNCaseInsensitive(wordStart, wordsNoCase[pivot], searchLen);
                        if (!cond) {
-                               oldpivot = pivot;
-                               do { // browse sequentially the rest after the hit
-                                       brace = strchr(word, '(');
-                                       if (brace)
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       else {
-                                               brace = word + strlen(word);
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       }
-                                       wordlen = brace - word + 1;
-                                       newlength = length + wordlen; // stretch the buffer
-                                       if (length)
-                                               newlength++;
-                                       if (newlength >= size) {
-                                               do
-                                                       size += WORDCHUNK;
-                                               while (size <= newlength);
-                                               buffer = (char*) realloc(buffer, size);
-                                       }
-                                       if (length) // append a new entry
-                                               buffer[length++] = ' ';
-                                       memcpy(buffer + length, word, wordlen);
-                                       length = newlength;
-                                       buffer[length] = '\0';
-                                       if (++pivot > end)
-                                               break;
-                                       word = wordsNoCase[pivot];
-                               } while (!strncasecmp(wordStart, word, searchLen));
-
-                               pivot = oldpivot;
-                               for (;;) { // browse sequentially the rest before the hit
-                                       if (--pivot < start)
-                                               break;
-                                       word = wordsNoCase[pivot];
-                                       if (strncasecmp(wordStart, word, searchLen))
-                                               break;                 
-                                       brace = strchr(word, '(');
-                                       if (brace)
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       else {
-                                               brace = word + strlen(word);
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       }
-                                       wordlen = brace - word + 1;
-                                       newlength = length + wordlen; // stretch the buffer
-                                       if (length)
-                                               newlength++;
-                                       if (newlength >= size)
-                                       {
-                                               do
-                                                       size += WORDCHUNK;
-                                               while (size <= newlength);
-                                               buffer = (char*) realloc(buffer, size);
-                                       }
-                                       if (length) // append a new entry
-                                               buffer[length++] = ' ';
-                                       memcpy(buffer + length, word, wordlen);
-                                       length = newlength;
-                                       buffer[length] = '\0';
+                               // Find first match
+                               while ((pivot > start) &&
+                                       (0 == CompareNCaseInsensitive(wordStart, 
+                                               wordsNoCase[pivot-1], searchLen))) {
+                                       --pivot;
                                }
-                               return buffer; // result has to be freed with free()
-                       }
-                       else if (cond < 0)
+                               // Grab each match
+                               while ((pivot <= end) &&
+                                       (0 == CompareNCaseInsensitive(wordStart, 
+                                               wordsNoCase[pivot], searchLen))) {
+                                       wordlen = LengthWord(wordsNoCase[pivot], otherSeparator) + 1;
+                                       wordsNear.append(wordsNoCase[pivot], wordlen, ' ');
+                                       ++pivot;
+                               }
+                               return wordsNear.detach();
+                       } else if (cond < 0) {
                                end = pivot - 1;
-                       else if (cond > 0)
+                       } else if (cond > 0) {
                                start = pivot + 1;
+                       }
                }
-       else // preserve the letter case
-               while (start <= end) { // binary searching loop
-                       pivot = (start + end) >> 1;
-                       word = words[pivot];
-                       cond = strncmp(wordStart, word, searchLen);
+       } else {        // Preserve the letter case
+               while (start <= end) { // Binary searching loop
+                       pivot = (start + end) / 2;
+                       cond = strncmp(wordStart, words[pivot], searchLen);
                        if (!cond) {
-                               oldpivot = pivot;
-                               do { // browse sequentially the rest after the hit
-                                       brace = strchr(word, '(');
-                                       if (brace)
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       else {
-                                               brace = word + strlen(word);
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       }
-                                       wordlen = brace - word + 1;
-                                       newlength = length + wordlen; // stretch the buffer
-                                       if (length)
-                                               newlength++;
-                                       if (newlength >= size)
-                                       {
-                                               do
-                                                       size += WORDCHUNK;
-                                               while (size <= newlength);
-                                               buffer = (char*) realloc(buffer, size);
-                                       }
-                                       if (length) // append a new entry
-                                               buffer[length++] = ' ';
-                                       memcpy(buffer + length, word, wordlen);
-                                       length = newlength;
-                                       buffer[length] = '\0';
-                                       if (++pivot > end)
-                                               break;
-                                       word = words[pivot];
-                               } while (!strncmp(wordStart, word, searchLen));
-
-                               pivot = oldpivot;
-                               for (;;) { // browse sequentially the rest before the hit
-                                       if (--pivot < start)
-                                               break;
-                                       word = words[pivot];
-                                       if (strncmp(wordStart, word, searchLen))
-                                               break;
-                                       brace = strchr(word, '(');
-                                       if (brace)
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       else {
-                                               brace = word + strlen(word);
-                                               do
-                                                       if (--brace < word)
-                                                               break;
-                                               while (isspace(*brace));
-                                       }
-                                       wordlen = brace - word + 1;
-                                       newlength = length + wordlen; // stretch the buffer
-                                       if (length)
-                                               newlength++;
-                                       if (newlength >= size)
-                                       {
-                                               do
-                                                       size += WORDCHUNK;
-                                               while (size <= newlength);
-                                               buffer = (char*) realloc(buffer, size);
-                                       }
-                                       if (length) // append a new entry
-                                               buffer[length++] = ' ';
-                                       memcpy(buffer + length, word, wordlen);
-                                       length = newlength;
-                                       buffer[length] = '\0';
+                               // Find first match
+                               while ((pivot > start) &&
+                                       (0 == strncmp(wordStart, 
+                                               words[pivot-1], searchLen))) { 
+                                       --pivot;
                                }
-                               return buffer; // result has to be freed with free()
-                       }
-                       else if (cond < 0)
+                               // Grab each match
+                               while ((pivot <= end) &&
+                                       (0 == strncmp(wordStart, 
+                                               words[pivot], searchLen))) { 
+                                       wordlen = LengthWord(words[pivot], otherSeparator) + 1;
+                                       wordsNear.append(words[pivot], wordlen, ' ');
+                                       ++pivot;
+                               }
+                               return wordsNear.detach();
+                       } else if (cond < 0) {
                                end = pivot - 1;
-                       else if (cond > 0)
+                       } else if (cond > 0) {
                                start = pivot + 1;
+                       }
                }
-       free(buffer);
+       }
        return NULL;
 }
diff --git a/src/stc/scintilla/src/RESearch.cxx b/src/stc/scintilla/src/RESearch.cxx
new file mode 100644 (file)
index 0000000..07534db
--- /dev/null
@@ -0,0 +1,865 @@
+// Scintilla source code edit control
+/** @file RESearch.cxx
+ ** Regular expression search library.
+ **/
+
+/*
+ * regex - Regular expression pattern matching  and replacement
+ *
+ * By:  Ozan S. Yigit (oz)
+ *      Dept. of Computer Science
+ *      York University
+ *
+ * Original code available from http://www.cs.yorku.ca/~oz/ 
+ * Translation to C++ by Neil Hodgson neilh@scintilla.org
+ * Removed all use of register.
+ * Converted to modern function prototypes.
+ * Put all global/static variables into an object so this code can be 
+ * used from multiple threads etc.
+ *
+ * These routines are the PUBLIC DOMAIN equivalents of regex
+ * routines as found in 4.nBSD UN*X, with minor extensions.
+ *
+ * These routines are derived from various implementations found
+ * in software tools books, and Conroy's grep. They are NOT derived
+ * from licensed/restricted software.
+ * For more interesting/academic/complicated implementations,
+ * see Henry Spencer's regexp routines, or GNU Emacs pattern
+ * matching module.
+ *
+ * Modification history:
+ *
+ * $Log$
+ * Revision 1.1  2001/09/01 03:05:24  RD
+ * Upgraded to version 1.39 of Scintilla, and upated wxStyledTextCtrl
+ * accordingly.
+ *
+ * Revision 1.6  2001/04/29 13:32:10  nyamatongwe
+ * Addition of new target methods - versions of ReplaceTarget that take counted
+ * strings to allow for nulls, SearchInTarget and Get/SetSearchFlags to use a
+ * series of calls rather than a structure.
+ * Handling of \000 in search and replace.
+ * Handling of /escapes within character ranges of regular expressions.
+ * Some handling of bare ^ and $ regular expressions.
+ *
+ * Revision 1.5  2001/04/20 07:36:09  nyamatongwe
+ * Removed DEBUG code that failed to compile on GTK+.
+ *
+ * Revision 1.4  2001/04/13 03:52:13  nyamatongwe
+ * Added URL to find original code to comments.
+ *
+ * Revision 1.3  2001/04/06 12:24:21  nyamatongwe
+ * Made regular expression searching work on a line by line basis, made ^ and
+ * $ work, made [set] work, and added a case insensitive option.
+ *
+ * Revision 1.2  2001/04/05 01:58:04  nyamatongwe
+ * Replace target functionality to make find and replace operations faster
+ * by diminishing screen updates and allow for \d patterns in the replacement
+ * text.
+ *
+ * Revision 1.1  2001/04/04 12:52:44  nyamatongwe
+ * Moved to public domain regular expresion implementation.
+ *
+ * Revision 1.4  1991/10/17  03:56:42  oz
+ * miscellaneous changes, small cleanups etc.
+ *
+ * Revision 1.3  1989/04/01  14:18:09  oz
+ * Change all references to a dfa: this is actually an nfa.
+ *
+ * Revision 1.2  88/08/28  15:36:04  oz
+ * Use a complement bitmap to represent NCL.
+ * This removes the need to have seperate 
+ * code in the PMatch case block - it is 
+ * just CCL code now.
+ * 
+ * Use the actual CCL code in the CLO
+ * section of PMatch. No need for a recursive
+ * PMatch call.
+ * 
+ * Use a bitmap table to set char bits in an
+ * 8-bit chunk.
+ * 
+ * Interfaces:
+ *      RESearch::Compile:        compile a regular expression into a NFA.
+ *
+ *                     char *RESearch::Compile(s)
+ *                     char *s;
+ *
+ *      RESearch::Execute:        execute the NFA to match a pattern.
+ *
+ *                     int RESearch::Execute(s)
+ *                     char *s;
+ *
+ *     RESearch::ModifyWord            change RESearch::Execute's understanding of what a "word"
+ *                     looks like (for \< and \>) by adding into the
+ *                     hidden word-syntax table.
+ *
+ *                     void RESearch::ModifyWord(s)
+ *                     char *s;
+ *
+ *      RESearch::Substitute:  substitute the matched portions in a new string.
+ *
+ *                     int RESearch::Substitute(src, dst)
+ *                     char *src;
+ *                     char *dst;
+ *
+ *     re_fail:        failure routine for RESearch::Execute.
+ *
+ *                     void re_fail(msg, op)
+ *                     char *msg;
+ *                     char op;
+ *  
+ * Regular Expressions:
+ *
+ *      [1]     char    matches itself, unless it is a special
+ *                      character (metachar): . \ [ ] * + ^ $
+ *
+ *      [2]     .       matches any character.
+ *
+ *      [3]     \       matches the character following it, except
+ *                     when followed by a left or right round bracket,
+ *                     a digit 1 to 9 or a left or right angle bracket. 
+ *                     (see [7], [8] and [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.
+ *
+ *      [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 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.
+ *                      examples:        match:
+ *
+ *                              [a-z]    any lowercase alpha
+ *
+ *                              [^]-]    any char except ] and -
+ *
+ *                              [^A-Z]   any char except uppercase
+ *                                       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.
+ *
+ *      [6]     +       same as [5], except it matches one or more.
+ *
+ *      [7]             a regular expression in the form [1] to [10], enclosed
+ *                      as \(form\) matches what form matches. The enclosure
+ *                      creates a set of tags, used for [8] and for
+ *                      pattern substution. The tagged forms are numbered
+ *                     starting from 1.
+ *
+ *      [8]             a \ followed by a digit 1 to 9 matches whatever a
+ *                      previously tagged regular expression ([7]) matched.
+ *
+ *     [9]     \<      a regular expression starting with a \< construct
+ *             \>      and/or ending with a \> construct, restricts the
+ *                     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
+ *                     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
+ *                      match of x followed by a match for y.
+ *
+ *      [11]   ^       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
+ *                     pattern, ^ and $ are treated as ordinary characters.
+ *
+ *
+ * Acknowledgements:
+ *
+ *     HCR's Hugh Redelmeier has been most helpful in various
+ *     stages of development. He convinced me to include BOW
+ *     and EOW constructs, originally invented by Rob Pike at
+ *     the University of Toronto.
+ *
+ * References:
+ *              Software tools                 Kernighan & Plauger
+ *              Software tools in Pascal        Kernighan & Plauger
+ *              Grep [rsx-11 C dist]            David Conroy
+ *             ed - text editor                Un*x Programmer's Manual
+ *             Advanced editing on Un*x        B. W. Kernighan
+ *             RegExp routines                 Henry Spencer
+ *
+ * Notes:
+ *
+ *     This implementation uses a bit-set representation for character
+ *     classes for speed and compactness. Each character is represented 
+ *     by one bit in a 128-bit block. Thus, CCL always takes a 
+ *     constant 16 bytes in the internal nfa, and RESearch::Execute does a single
+ *     bit comparison to locate the character in the set.
+ *
+ * Examples:
+ *
+ *     pattern:        foo*.*
+ *     compile:        CHR f CHR o CLO CHR o END CLO ANY END END
+ *     matches:        fo foo fooo foobar fobar foxx ...
+ *
+ *     pattern:        fo[ob]a[rz]     
+ *     compile:        CHR f CHR o CCL bitset CHR a CCL bitset END
+ *     matches:        fobar fooar fobaz fooaz
+ *
+ *     pattern:        foo\\+
+ *     compile:        CHR f CHR o CHR o CHR \ CLO CHR \ END END
+ *     matches:        foo\ foo\\ foo\\\  ...
+ *
+ *     pattern:        \(foo\)[1-3]\1  (same as foo[1-3]foo)
+ *     compile:        BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
+ *     matches:        foo1foo foo2foo foo3foo
+ *
+ *     pattern:        \(fo.*\)-\1
+ *     compile:        BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
+ *     matches:        foo-foo fo-fo fob-fob foobar-foobar ...
+ */
+
+#include "RESearch.h"
+
+#define OKP     1
+#define NOP     0
+
+#define CHR     1
+#define ANY     2
+#define CCL     3
+#define BOL     4
+#define EOL     5
+#define BOT     6
+#define EOT     7
+#define BOW    8
+#define EOW    9
+#define REF     10
+#define CLO     11
+
+#define END     0
+
+/*
+ * The following defines are not meant to be changeable.
+ * They are for readability only.
+ */
+#define BLKIND 0170
+#define BITIND 07
+
+#define ASCIIB 0177
+
+const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
+
+#define badpat(x)      (*nfa = END, x)
+RESearch::RESearch() {
+       Init();
+}
+
+RESearch::~RESearch() {
+       Clear();
+}
+
+void RESearch::Init() {
+       sta = NOP;                      /* status of lastpat */
+       bol = 0;
+       for (int i=0; i<MAXTAG; i++)
+               pat[i] = 0;
+       for (int j=0; j<BITBLK; j++)
+               bittab[j] = 0;
+}
+
+void RESearch::Clear() {
+       for (int i=0; i<MAXTAG; i++) {
+               delete []pat[i];
+               pat[i] = 0;
+               bopat[i] = NOTFOUND;
+               eopat[i] = NOTFOUND;
+       }
+}
+
+bool RESearch::GrabMatches(CharacterIndexer &ci) {
+       bool success = true;
+       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]) {
+                               for (unsigned int j=0; j<len; j++)
+                                       pat[i][j] = ci.CharAt(bopat[i] + j);
+                               pat[i][len] = '\0';
+                       } else {
+                               success = false;
+                       }
+               }
+       }
+       return success;
+}
+
+void RESearch::ChSet(char c) {
+       bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND];
+}
+
+void RESearch::ChSetWithCase(char c, bool caseSensitive) {
+       if (caseSensitive) {
+               ChSet(c);
+       } else {
+               if ((c >= 'a') && (c <= 'z')) {
+                       ChSet(c);
+                       ChSet(static_cast<char>(c - 'a' + 'A'));
+               } else if ((c >= 'A') && (c <= 'Z')) {
+                       ChSet(c);
+                       ChSet(static_cast<char>(c - 'A' + 'a'));
+               } else {
+                       ChSet(c);
+               }
+       }
+}
+
+const char escapeValue(char ch) {
+       switch (ch) {
+       case 'a':       return '\a';
+       case 'b':       return '\b';
+       case 'f':       return '\f';
+       case 'n':       return '\n';
+       case 'r':       return '\r';
+       case 't':       return '\t';
+       case 'v':       return '\v';
+       }
+       return 0;
+}
+
+const char *RESearch::Compile(const char *pat, int length, bool caseSensitive) {
+       char *mp=nfa;          /* nfa pointer       */
+       char *lp;              /* saved pointer..   */
+       char *sp=nfa;          /* another one..     */
+
+       int tagi = 0;          /* tag stack index   */
+       int tagc = 1;          /* actual tag count  */
+
+       int n;
+       char mask;              /* xor mask -CCL/NCL */
+       int c1, c2;
+               
+       if (!pat || !length)
+               if (sta)
+                       return 0;
+               else
+                       return badpat("No previous regular expression");
+       sta = NOP;
+
+       const char *p=pat;               /* pattern pointer   */
+       for (int i=0; i<length; i++, p++) {
+               lp = mp;
+               switch(*p) {
+
+               case '.':               /* match any char..  */
+                       *mp++ = ANY;
+                       break;
+
+               case '^':               /* match beginning.. */
+                       if (p == pat)
+                               *mp++ = BOL;
+                       else {
+                               *mp++ = CHR;
+                               *mp++ = *p;
+                       }
+                       break;
+
+               case '$':               /* match endofline.. */
+                       if (!*(p+1))
+                               *mp++ = EOL;
+                       else {
+                               *mp++ = CHR;
+                               *mp++ = *p;
+                       }
+                       break;
+
+               case '[':               /* match char class..*/
+                       *mp++ = CCL;
+
+                       i++;
+                       if (*++p == '^') {
+                               mask = '\377';  
+                               i++;
+                               p++;
+                       } else
+                               mask = 0;
+
+                       if (*p == '-') {                /* real dash */
+                               i++;
+                               ChSet(*p++);
+                       }
+                       if (*p == ']') {        /* real brace */
+                               i++;
+                               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);
+                                       }
+                               } else if (*p == '\\' && *(p+1)) {
+                                       i++;
+                                       p++;
+                                       char escape = escapeValue(*p);
+                                       if (escape)
+                                               ChSetWithCase(escape, caseSensitive);
+                                       else
+                                               ChSetWithCase(*p, caseSensitive);
+                                       i++;
+                                       p++;
+                               } else {
+                                       i++;
+                                       ChSetWithCase(*p++, caseSensitive);
+                               }
+                       }
+                       if (!*p)
+                               return badpat("Missing ]");
+
+                       for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
+                               *mp++ = static_cast<char>(mask ^ bittab[n]);
+       
+                       break;
+
+               case '*':               /* match 0 or more.. */
+               case '+':               /* match 1 or more.. */
+                       if (p == pat)
+                               return badpat("Empty closure");
+                       lp = sp;                /* previous opcode */
+                       if (*lp == CLO)         /* equivalence..   */
+                               break;
+                       switch(*lp) {
+
+                       case BOL:
+                       case BOT:
+                       case EOT:
+                       case BOW:
+                       case EOW:
+                       case REF:
+                               return badpat("Illegal closure");
+                       default:
+                               break;
+                       }
+
+                       if (*p == '+')
+                               for (sp = mp; lp < sp; lp++)
+                                       *mp++ = *lp;
+
+                       *mp++ = END;
+                       *mp++ = END;
+                       sp = mp;
+                       while (--mp > lp)
+                               *mp = mp[-1];
+                       *mp = CLO;
+                       mp = sp;
+                       break;
+
+               case '\\':              /* tags, backrefs .. */
+                       i++;
+                       switch(*++p) {
+
+                       case '(':
+                               if (tagc < MAXTAG) {
+                                       tagstk[++tagi] = tagc;
+                                       *mp++ = BOT;
+                                       *mp++ = static_cast<char>(tagc++);
+                               }
+                               else
+                                       return badpat("Too many \\(\\) pairs");
+                               break;
+                       case ')':
+                               if (*sp == BOT)
+                                       return badpat("Null pattern inside \\(\\)");
+                               if (tagi > 0) {
+                                       *mp++ = static_cast<char>(EOT);
+                                       *mp++ = static_cast<char>(tagstk[tagi--]);
+                               }
+                               else
+                                       return badpat("Unmatched \\)");
+                               break;
+                       case '<':
+                               *mp++ = BOW;
+                               break;
+                       case '>':
+                               if (*sp == BOW)
+                                       return badpat("Null pattern inside \\<\\>");
+                               *mp++ = EOW;
+                               break;
+                       case '1':
+                       case '2':
+                       case '3':
+                       case '4':
+                       case '5':
+                       case '6':
+                       case '7':
+                       case '8':
+                       case '9':
+                               n = *p-'0';
+                               if (tagi > 0 && tagstk[tagi] == n)
+                                       return badpat("Cyclical reference");
+                               if (tagc > n) {
+                                       *mp++ = static_cast<char>(REF);
+                                       *mp++ = static_cast<char>(n);
+                               }
+                               else
+                                       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:
+                               *mp++ = CHR;
+                               *mp++ = *p;
+                       }
+                       break;
+
+               default :               /* an ordinary char  */
+                       if (caseSensitive) {
+                               *mp++ = CHR;
+                               *mp++ = *p;
+                       } else {
+                               *mp++ = CCL;
+                               mask = 0;
+                               ChSetWithCase(*p, false);
+                               for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
+                                       *mp++ = static_cast<char>(mask ^ bittab[n]);
+                       }
+                       break;
+               }
+               sp = lp;
+       }
+       if (tagi > 0)
+               return badpat("Unmatched \\(");
+       *mp = END;
+       sta = OKP;
+       return 0;
+}
+
+/*
+ * RESearch::Execute:
+ *     execute nfa to find a match.
+ *
+ *     special cases: (nfa[0]) 
+ *             BOL
+ *                     Match only once, starting from the
+ *                     beginning.
+ *             CHR
+ *                     First locate the character without
+ *                     calling PMatch, and if found, call
+ *                     PMatch for the remaining string.
+ *             END
+ *                     RESearch::Compile failed, poor luser did not
+ *                     check for it. Fail fast.
+ *
+ *     If a match is found, bopat[0] and eopat[0] are set
+ *     to the beginning and the end of the matched fragment,
+ *     respectively.
+ *
+ */
+
+int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
+       char c;
+       int ep = NOTFOUND;
+       char *ap = nfa;
+
+       bol = lp;
+       failure = 0;
+       
+       Clear();
+
+       switch(*ap) {
+
+       case BOL:                       /* anchored: match from BOL only */
+               ep = PMatch(ci, lp, endp, ap);
+               break;
+       case EOL:                       /* just searching for end of line normal path doesn't work */
+               if (*(ap+1) == END) {
+                       lp = endp;
+                       ep = lp;
+                       break;
+               } else {
+                       return 0;
+               }
+       case CHR:                       /* ordinary char: locate it fast */
+               c = *(ap+1);
+               while ((lp < endp) && (ci.CharAt(lp) != c))
+                       lp++;
+               if (lp >= endp)         /* if EOS, fail, else fall thru. */
+                       return 0;
+       default:                        /* regular matching all the way. */
+               while (lp < endp) {
+                       ep = PMatch(ci, lp, endp, ap);
+                       if (ep != NOTFOUND)
+                               break;
+                       lp++;
+               }
+               break;
+       case END:                       /* munged automaton. fail always */
+               return 0;
+       }
+       if (ep == NOTFOUND)
+               return 0;
+
+       bopat[0] = lp;
+       eopat[0] = ep;
+       return 1;
+}
+
+/* 
+ * PMatch: internal routine for the hard part
+ *
+ *     This code is partly snarfed from an early grep written by
+ *     David Conroy. The backref and tag stuff, and various other
+ *     innovations are by oz.
+ *
+ *     special case optimizations: (nfa[n], nfa[n+1])
+ *             CLO ANY
+ *                     We KNOW .* will match everything upto the
+ *                     end of line. Thus, directly go to the end of
+ *                     line, without recursive PMatch calls. As in
+ *                     the other closure cases, the remaining pattern
+ *                     must be matched by moving backwards on the
+ *                     string recursively, to find a match for xy
+ *                     (x is ".*" and y is the remaining pattern)
+ *                     where the match satisfies the LONGEST match for
+ *                     x followed by a match for y.
+ *             CLO CHR
+ *                     We can again scan the string forward for the
+ *                     single char and at the point of failure, we
+ *                     execute the remaining nfa recursively, same as
+ *                     above.
+ *
+ *     At the end of a successful match, bopat[n] and eopat[n]
+ *     are set to the beginning and end of subpatterns matched
+ *     by tagged expressions (n = 1 to 9).     
+ *
+ */
+
+extern void re_fail(char *,char);
+
+/*
+ * character classification table for word boundary operators BOW
+ * and EOW. the reason for not using ctype macros is that we can
+ * let the user add into our own table. see RESearch::ModifyWord. This table
+ * is not in the bitset form, since we may wish to extend it in the
+ * future for other character classifications. 
+ *
+ *     TRUE for 0-9 A-Z a-z _
+ */
+static char chrtyp[MAXCHR] = {
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+       0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 
+       0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+       1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+       1, 1, 1, 0, 0, 0, 0, 0
+       };
+
+#define inascii(x)     (0177&(x))
+#define iswordc(x)     chrtyp[inascii(x)]
+#define isinset(x,y)   ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
+
+/*
+ * skip values for CLO XXX to skip past the closure
+ */
+
+#define ANYSKIP        2       /* [CLO] ANY END ...         */
+#define CHRSKIP        3       /* [CLO] CHR chr END ...     */
+#define CCLSKIP 18     /* [CLO] CCL 16bytes END ... */
+
+int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
+       int op, c, n;
+       int e;          /* extra pointer for CLO */
+       int bp;         /* beginning of subpat.. */
+       int ep;         /* ending of subpat..    */
+       int are;                        /* to save the line ptr. */
+
+       while ((op = *ap++) != END)
+               switch(op) {
+
+               case CHR:
+                       if (ci.CharAt(lp++) != *ap++)
+                               return NOTFOUND;
+                       break;
+               case ANY:
+                       if (lp++ >= endp)
+                               return NOTFOUND;
+                       break;
+               case CCL:
+                       c = ci.CharAt(lp++);
+                       if (!isinset(ap,c))
+                               return NOTFOUND;
+                       ap += BITBLK;
+                       break;
+               case BOL:
+                       if (lp != bol)
+                               return NOTFOUND;
+                       break;
+               case EOL:
+                       if (lp < endp)
+                               return NOTFOUND;
+                       break;
+               case BOT:
+                       bopat[*ap++] = lp;
+                       break;
+               case EOT:
+                       eopat[*ap++] = lp;
+                       break;
+               case BOW:
+                       if (lp!=bol && iswordc(ci.CharAt(lp-1)) || !iswordc(ci.CharAt(lp)))
+                               return NOTFOUND;
+                       break;
+               case EOW:
+                       if (lp==bol || !iswordc(ci.CharAt(lp-1)) || iswordc(ci.CharAt(lp)))
+                               return NOTFOUND;
+                       break;
+               case REF:
+                       n = *ap++;
+                       bp = bopat[n];
+                       ep = eopat[n];
+                       while (bp < ep)
+                               if (ci.CharAt(bp++) != ci.CharAt(lp++))
+                                       return NOTFOUND;
+                       break;
+               case CLO:
+                       are = lp;
+                       switch(*ap) {
+
+                       case ANY:
+                               while (lp < endp)
+                                       lp++;
+                               n = ANYSKIP;
+                               break;
+                       case CHR:
+                               c = *(ap+1);
+                               while ((lp < endp) && (c == ci.CharAt(lp)))
+                                       lp++;
+                               n = CHRSKIP;
+                               break;
+                       case CCL:
+                               while ((lp < endp) && isinset(ap+1,ci.CharAt(lp)))
+                                       lp++;
+                               n = CCLSKIP;
+                               break;
+                       default:
+                               failure = true;
+                               //re_fail("closure: bad nfa.", *ap);
+                               return NOTFOUND;
+                       }
+
+                       ap += n;
+
+                       while (lp >= are) {
+                               if ((e = PMatch(ci, lp, endp, ap)) != NOTFOUND)
+                                       return e;
+                               --lp;
+                       }
+                       return NOTFOUND;
+               default:
+                       //re_fail("RESearch::Execute: bad nfa.", static_cast<char>(op));
+                       return NOTFOUND;
+               }
+       return lp;
+}
+
+/*
+ * RESearch::ModifyWord:
+ *     add new characters into the word table to change RESearch::Execute's
+ *     understanding of what a word should look like. Note that we
+ *     only accept additions into the word definition.
+ *
+ *     If the string parameter is 0 or null string, the table is
+ *     reset back to the default containing A-Z a-z 0-9 _. [We use
+ *     the compact bitset representation for the default table]
+ */
+
+static char deftab[16] = {     
+       0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',  
+       '\376', '\377', '\377', 007 
+}; 
+
+void RESearch::ModifyWord(char *s) {
+       int i;
+
+       if (!s || !*s) {
+               for (i = 0; i < MAXCHR; i++)
+                       if (!isinset(deftab,i))
+                               iswordc(i) = 0;
+       }
+       else
+               while(*s)
+                       iswordc(*s++) = 1;
+}
+
+/*
+ * RESearch::Substitute:
+ *     substitute the matched portions of the src in dst.
+ *
+ *     &       substitute the entire matched pattern.
+ *
+ *     \digit  substitute a subpattern, with the given tag number.
+ *             Tags are numbered from 1 to 9. If the particular
+ *             tagged subpattern does not exist, null is substituted.
+ */
+int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
+       char c;
+       int  pin;
+       int bp;
+       int ep;
+
+       if (!*src || !bopat[0])
+               return 0;
+
+       while ((c = *src++) != 0) {
+               switch(c) {
+
+               case '&':
+                       pin = 0;
+                       break;
+
+               case '\\':
+                       c = *src++;
+                       if (c >= '0' && c <= '9') {
+                               pin = c - '0';
+                               break;
+                       }
+                       
+               default:
+                       *dst++ = c;
+                       continue;
+               }
+
+               if ((bp = bopat[pin]) != 0 && (ep = eopat[pin]) != 0) {
+                       while (ci.CharAt(bp) && bp < ep)
+                               *dst++ = ci.CharAt(bp++);
+                       if (bp < ep)
+                               return 0;
+               }
+       }
+       *dst = (char) 0;
+       return 1;
+}
diff --git a/src/stc/scintilla/src/RESearch.h b/src/stc/scintilla/src/RESearch.h
new file mode 100644 (file)
index 0000000..28238bf
--- /dev/null
@@ -0,0 +1,60 @@
+// Scintilla source code edit control
+/** @file RESearch.h
+ ** Interface to the regular expression search library.
+ **/
+// Written by Neil Hodgson <neilh@scintilla.org>
+// Based on the work of Ozan S. Yigit.
+// This file is in the public domain.
+
+#ifndef RESEARCH_H
+#define RESEARCH_H
+
+/*
+ * The following defines are not meant to be changeable.
+ * They are for readability only.
+ */
+#define MAXCHR 128
+#define CHRBIT 8
+#define BITBLK MAXCHR/CHRBIT
+
+class CharacterIndexer {
+public: 
+       virtual char CharAt(int index)=0;
+};
+
+class RESearch {
+
+public:
+       RESearch();
+       ~RESearch();
+       void Init();
+       void Clear();
+       bool GrabMatches(CharacterIndexer &ci);
+       void ChSet(char c);
+       void ChSetWithCase(char c, bool caseSensitive);
+       const char *Compile(const char *pat, int length, bool caseSensitive);
+       int Execute(CharacterIndexer &ci, int lp, int endp);
+       void ModifyWord(char *s);
+       int Substitute(CharacterIndexer &ci, char *src, char *dst);
+
+       enum {MAXTAG=10};
+       enum {MAXNFA=2048};
+       enum {NOTFOUND=-1};
+
+       int bopat[MAXTAG];
+       int eopat[MAXTAG];
+       char *pat[MAXTAG];
+
+private:
+       int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
+
+       int bol;
+       int  tagstk[MAXTAG];             /* subpat tag stack..*/
+       char nfa[MAXNFA];               /* automaton..       */
+       int sta;
+       char bittab[BITBLK];            /* bit table for CCL */
+                                               /* pre-set bits...   */
+       int failure;
+};
+
+#endif
index d4d49c717d6f30f876513281f2f7d1480a690888..c8edb513bc3fdca89e6ef43f7341ee4a73f5ed13 100644 (file)
@@ -1,26 +1,31 @@
 // Scintilla source code edit control
-// SVector.h - a simple expandable vector
-// Copyright 1998-1999 by Neil Hodgson <neilh@hare.net.au>
+/** @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.
-
+/**
+ * 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 {
-       int *v;
-       unsigned int size;      // Number of elements allocated
-       unsigned int len;       // Number of elements in vector
-       bool allocFailure;      // A memory allocation call has failed
+       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 
-       // thrashng the memory allocator
+       /** Internally allocate more elements than the user wants
+        * to avoid thrashing the memory allocator. */
        void SizeTo(int newSize) {
-               if (newSize < 4000)
-                       newSize += 4000;
+               if (newSize < allocSize)
+                       newSize += allocSize;
                else 
                        newSize = (newSize * 3) / 2;
                int* newv = new int[newSize];
@@ -50,6 +55,7 @@ public:
        ~SVector() {
                Free();
        }
+       /// Constructor from another vector.
        SVector(const SVector &other) {
                allocFailure = false;
                v = 0;
@@ -64,6 +70,7 @@ public:
                        }
                }
        }
+       /// Copy constructor.
        SVector &operator=(const SVector &other) {
                if (this != &other) {
                        delete []v;
@@ -82,6 +89,9 @@ public:
                }
                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) {
@@ -91,12 +101,15 @@ public:
                }
                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) {
@@ -105,6 +118,7 @@ public:
                }
                len = newLength;
        }
+       /// Get the current length (number of used elements) of the vector.
        int Length() const {
                return len;
        }
index 4f182850ad452d6e37620458bf9529579e877541..707f59b9f440978ee0ea10dc1dd321d8bf22e40e 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// ScintillaBase.cxx - an enhanced subclass of Editor with calltips, autocomplete and context menu
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ScintillaBase.cxx
+ ** An enhanced subclass of Editor with calltips, autocomplete and context menu.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
@@ -15,7 +17,6 @@
 #ifdef SCI_LEXER
 #include "SciLexer.h"
 #include "Accessor.h"
-#include "WindowAccessor.h"
 #include "DocumentAccessor.h"
 #include "KeyWords.h"
 #endif
 #include "ScintillaBase.h"
 
 ScintillaBase::ScintillaBase() {
-#ifdef SCI_LEXER       
+       listType = 0;
+#ifdef SCI_LEXER
        lexLanguage = SCLEX_CONTAINER;
-       for (int wl=0;wl<numWordLists;wl++)
+       lexCurrent = 0;
+       for (int wl = 0;wl < numWordLists;wl++)
                keyWordLists[wl] = new WordList;
+       keyWordLists[numWordLists] = 0;
 #endif
 }
 
 ScintillaBase::~ScintillaBase() {
-#ifdef SCI_LEXER       
-       for (int wl=0;wl<numWordLists;wl++)
+#ifdef SCI_LEXER
+       for (int wl = 0;wl < numWordLists;wl++)
                delete keyWordLists[wl];
 #endif
 }
 
 void ScintillaBase::Finalise() {
-    Editor::Finalise();
+       Editor::Finalise();
        popup.Destroy();
 }
 
@@ -70,10 +74,12 @@ void ScintillaBase::Command(int cmdId) {
 
        switch (cmdId) {
 
-       case idAutoComplete:    // Nothing to do
+       case idAutoComplete:    // Nothing to do
+
                break;
 
-       case idCallTip:         // Nothing to do
+       case idCallTip:         // Nothing to do
+
                break;
 
        case idcmdUndo:
@@ -170,7 +176,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        //Platform::DebugPrintf("AutoComplete %s\n", list);
        ct.CallTipCancel();
 
-       if (ac.chooseSingle) {
+       if (ac.chooseSingle && (listType == 0)) {
                if (list && !strchr(list, ac.GetSeparator())) {
                        if (ac.ignoreCase) {
                                SetEmptySelection(currentPos - lenEntered);
@@ -183,13 +189,13 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
                                pdoc->InsertString(currentPos, list + lenEntered);
                                SetEmptySelection(currentPos + strlen(list + lenEntered));
                        }
-                       return;
+                       return ;
                }
        }
-       ac.Start(wDraw, idAutoComplete, currentPos, lenEntered);
+       ac.Start(wMain, idAutoComplete, currentPos, lenEntered);
 
        PRectangle rcClient = GetClientRectangle();
-       Point pt = LocationFromPosition(currentPos-lenEntered);
+       Point pt = LocationFromPosition(currentPos - lenEntered);
 
        int heightLB = 100;
        int widthLB = 100;
@@ -200,8 +206,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        }
        PRectangle rcac;
        rcac.left = pt.x - 5;
-       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 >= rcClient.bottom - heightLB &&  // Wont fit below.
+               pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
                rcac.top = pt.y - heightLB;
                if (rcac.top < 0) {
                        heightLB += rcac.top;
@@ -225,8 +231,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        // Make an allowance for large strings in list
        rcList.left = pt.x - 5;
        rcList.right = rcList.left + widthLB;
-       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 >= rcClient.bottom - heightLB &&  // Wont fit below.
+               pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.
                rcList.top = pt.y - heightAlloced;
        } else {
                rcList.top = pt.y + vs.lineHeight;
@@ -236,7 +242,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        ac.Show();
        if (lenEntered != 0) {
                AutoCompleteMoveToCurrentWord();
-       }               
+       }
 }
 
 void ScintillaBase::AutoCompleteCancel() {
@@ -278,44 +284,45 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
                ac.lb.GetValue(item, selected, sizeof(selected));
        }
        ac.Cancel();
-       
-       if (ac.ignoreCase) {
-               if (currentPos != ac.posStart) {
-                       pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
-               }
-               SetEmptySelection(ac.posStart - ac.startLen);
-               pdoc->DeleteChars(ac.posStart - ac.startLen, ac.startLen);
-               if (item != -1) {
-                       SString piece = selected;
-                       if (fillUp)
-                               piece += fillUp;
-                       pdoc->InsertString(currentPos, piece.c_str());
-                       SetEmptySelection(currentPos + piece.length());
-               }
-       } else {
-               if (currentPos != ac.posStart) {
-                       pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart);
-               }
-               SetEmptySelection(ac.posStart);
-               if (item != -1) {
-                       SString piece = selected + ac.startLen;
-                       if (fillUp)
-                               piece += fillUp;
-                       pdoc->InsertString(currentPos, piece.c_str());
-                       SetEmptySelection(currentPos + piece.length());
-               }
+
+       if (listType > 0) {
+               userListSelected = selected;
+               SCNotification scn;
+               scn.nmhdr.code = SCN_USERLISTSELECTION;
+               scn.message = 0;
+               scn.wParam = listType;
+               scn.lParam = 0;
+               scn.text = userListSelected.c_str();
+               NotifyParent(scn);
+               return ;
+       }
+
+       Position firstPos = ac.posStart - ac.startLen;
+       if (currentPos < firstPos)
+               return ;
+       if (currentPos != firstPos) {
+               pdoc->DeleteChars(firstPos, currentPos - firstPos);
+       }
+       SetEmptySelection(ac.posStart);
+       if (item != -1) {
+               SString piece = selected;
+               if (fillUp)
+                       piece += fillUp;
+               pdoc->InsertString(firstPos, piece.c_str());
+               SetEmptySelection(firstPos + piece.length());
        }
 }
 
 void ScintillaBase::ContextMenu(Point pt) {
+       bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
        popup.CreatePopUp();
-       AddToPopUp("Undo", idcmdUndo, pdoc->CanUndo());
-       AddToPopUp("Redo", idcmdRedo, pdoc->CanRedo());
+       AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
+       AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
        AddToPopUp("");
-       AddToPopUp("Cut", idcmdCut, currentPos != anchor);
+       AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
        AddToPopUp("Copy", idcmdCopy, currentPos != anchor);
-       AddToPopUp("Paste", idcmdPaste, WndProc(SCI_CANPASTE, 0, 0));
-       AddToPopUp("Delete", idcmdDelete, currentPos != anchor);
+       AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0));
+       AddToPopUp("Delete", idcmdDelete, writable && currentPos != anchor);
        AddToPopUp("");
        AddToPopUp("Select All", idcmdSelectAll);
        popup.Show(pt, wMain);
@@ -333,41 +340,67 @@ void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool
 }
 
 #ifdef SCI_LEXER
+void ScintillaBase::SetLexer(uptr_t wParam) {
+       lexLanguage = wParam;
+       lexCurrent = LexerModule::Find(lexLanguage);
+       if (!lexCurrent)
+               lexCurrent = LexerModule::Find(SCLEX_NULL);
+}
+
+void ScintillaBase::SetLexerLanguage(const char *languageName) {
+       lexLanguage = SCLEX_CONTAINER;
+       lexCurrent = LexerModule::Find(languageName);
+       if (!lexCurrent)
+               lexCurrent = LexerModule::Find(SCLEX_NULL);
+       if (lexCurrent)
+               lexLanguage = lexCurrent->GetLanguage();
+}
+
 void ScintillaBase::Colourise(int start, int end) {
-       int lengthDoc = Platform::SendScintilla(wMain.GetID(), SCI_GETLENGTH, 0, 0);
+       int lengthDoc = pdoc->Length();
        if (end == -1)
                end = lengthDoc;
        int len = end - start;
 
+       PLATFORM_ASSERT(len >= 0);
+       PLATFORM_ASSERT(start + len <= lengthDoc);
+
        //WindowAccessor styler(wMain.GetID(), props);
-       DocumentAccessor styler(pdoc, props);
+       DocumentAccessor styler(pdoc, props, wMain.GetID());
 
        int styleStart = 0;
        if (start > 0)
                styleStart = styler.StyleAt(start - 1);
        styler.SetCodePage(pdoc->dbcsCodePage);
-       
-       LexerModule::Colourise(start, len, styleStart, lexLanguage, keyWordLists, styler);
-       styler.Flush();
+
+       if (lexCurrent) {       // Should always succeed as null lexer should always be available
+               lexCurrent->Lex(start, len, styleStart, keyWordLists, styler);
+               styler.Flush();
+               if (styler.GetPropertyInt("fold")) {
+                       lexCurrent->Fold(start, len, styleStart, keyWordLists, styler);
+                       styler.Flush();
+               }
+       }
 }
 #endif
 
 void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {
 #ifdef SCI_LEXER
        if (lexLanguage != SCLEX_CONTAINER) {
-               int endStyled = Platform::SendScintilla(wMain.GetID(), SCI_GETENDSTYLED, 0, 0);
-               int lineEndStyled = Platform::SendScintilla(wMain.GetID(), SCI_LINEFROMPOSITION, endStyled, 0);
-               endStyled = Platform::SendScintilla(wMain.GetID(), SCI_POSITIONFROMLINE, lineEndStyled, 0);
+               int endStyled = WndProc(SCI_GETENDSTYLED, 0, 0);
+               int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0);
+               endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0);
                Colourise(endStyled, endStyleNeeded);
-               return;
+               return ;
        }
 #endif
        Editor::NotifyStyleToNeeded(endStyleNeeded);
 }
 
-long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) {
+sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        switch (iMessage) {
        case SCI_AUTOCSHOW:
+               listType = 0;
                AutoCompleteStart(wParam, reinterpret_cast<const char *>(lParam));
                break;
 
@@ -395,15 +428,15 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
        case SCI_AUTOCSTOPS:
                ac.SetStopChars(reinterpret_cast<char *>(lParam));
                break;
-               
+
        case SCI_AUTOCSELECT:
                ac.Select(reinterpret_cast<char *>(lParam));
                break;
-       
+
        case SCI_AUTOCSETCANCELATSTART:
                ac.cancelAtStartPos = wParam;
                break;
-       
+
        case SCI_AUTOCGETCANCELATSTART:
                return ac.cancelAtStartPos;
 
@@ -417,20 +450,35 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
 
        case SCI_AUTOCGETCHOOSESINGLE:
                return ac.chooseSingle;
-               
+
        case SCI_AUTOCSETIGNORECASE:
                ac.ignoreCase = wParam;
                break;
-               
+
        case SCI_AUTOCGETIGNORECASE:
                return ac.ignoreCase;
-               
+
+       case SCI_USERLISTSHOW:
+               listType = wParam;
+               AutoCompleteStart(0, reinterpret_cast<const char *>(lParam));
+               break;
+
+       case SCI_AUTOCSETAUTOHIDE:
+               ac.autoHide = wParam;
+               break;
+
+       case SCI_AUTOCGETAUTOHIDE:
+               return ac.autoHide;
+
        case SCI_CALLTIPSHOW: {
                        AutoCompleteCancel();
                        if (!ct.wCallTip.Created()) {
-                               PRectangle rc = ct.CallTipStart(currentPos, LocationFromPosition(wParam),
+                               Point pt = LocationFromPosition(wParam);
+                               pt.y += vs.lineHeight;
+                               PRectangle rc = ct.CallTipStart(currentPos, pt,
                                                                reinterpret_cast<char *>(lParam),
-                                                               vs.styles[STYLE_DEFAULT].fontName, vs.styles[STYLE_DEFAULT].size);
+                                                               vs.styles[STYLE_DEFAULT].fontName,
+                                                               vs.styles[STYLE_DEFAULT].sizeZoomed);
                                // If the call-tip window would be out of the client
                                // space, adjust so it displays above the text.
                                PRectangle rcClient = GetClientRectangle();
@@ -441,7 +489,7 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
                                }
                                // Now display the window.
                                CreateCallTipWindow(rc);
-                               ct.wCallTip.SetPositionRelative(rc, wDraw);
+                               ct.wCallTip.SetPositionRelative(rc, wMain);
                                ct.wCallTip.Show();
                        }
                }
@@ -465,31 +513,37 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP
                ct.colourBG = Colour(wParam);
                InvalidateStyleRedraw();
                break;
-               
+
 #ifdef SCI_LEXER
        case SCI_SETLEXER:
+               SetLexer(wParam);
                lexLanguage = wParam;
                break;
-               
+
        case SCI_GETLEXER:
                return lexLanguage;
-               
+
        case SCI_COLOURISE:
                Colourise(wParam, lParam);
                Redraw();
                break;
-               
+
        case SCI_SETPROPERTY:
-               props.Set(reinterpret_cast<const char *>(wParam), 
-                       reinterpret_cast<const char *>(lParam));
+               props.Set(reinterpret_cast<const char *>(wParam),
+                         reinterpret_cast<const char *>(lParam));
                break;
-               
+
        case SCI_SETKEYWORDS:
                if (wParam < numWordLists) {
                        keyWordLists[wParam]->Clear();
                        keyWordLists[wParam]->Set(reinterpret_cast<const char *>(lParam));
                }
                break;
+
+       case SCI_SETLEXERLANGUAGE:
+               SetLexerLanguage(reinterpret_cast<const char *>(lParam));
+               break;
+
 #endif
 
        default:
index e630ba1aac6b0b1e9da84db8acaedaf4be809c3a..d5b1e8ba0ccae8b98666326d2711112cef0917d5 100644 (file)
@@ -1,17 +1,22 @@
 // Scintilla source code edit control
-// ScintillaBase.h - defines an enhanced subclass of Editor with calltips, autocomplete and context menu
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ScintillaBase.h
+ ** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef SCINTILLABASE_H
 #define SCINTILLABASE_H
 
+/**
+ */
 class ScintillaBase : public Editor {
        // Private so ScintillaBase objects can not be copied
        ScintillaBase(const ScintillaBase &) : Editor() {}
        ScintillaBase &operator=(const ScintillaBase &) { return *this; }
+
 protected:
-       // Enumeration of commands and child windows
+       /** Enumeration of commands and child windows. */
        enum {
                idCallTip=1,
                idAutoComplete=2,
@@ -30,11 +35,17 @@ protected:
 
        CallTip ct;
 
+       int listType;                   ///< 0 is an autocomplete list
+       SString userListSelected;       ///< Receives listbox selected string
+       
 #ifdef SCI_LEXER
        int lexLanguage;
+       LexerModule *lexCurrent;
        PropSet props;
        enum {numWordLists=5};
-       WordList *keyWordLists[numWordLists];
+       WordList *keyWordLists[numWordLists+1];
+       void SetLexer(uptr_t wParam);
+       void SetLexerLanguage(const char *languageName);
        void Colourise(int start, int end);
 #endif
 
@@ -67,7 +78,7 @@ protected:
        virtual void NotifyStyleToNeeded(int endStyleNeeded);
 public:
        // Public so scintilla_send_message can use it
-       virtual long WndProc(unsigned int iMessage, unsigned long wParam, long lParam);
+       virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 };
 
 #endif
index 0a52ed41a3209184ca8a517c66ad99bbe1c89851..4a352679100516e02ccf6efb4182ac12c3b0b104 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// Style.cxx - defines the font and colour style for a class of text
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Style.cxx
+ ** Defines the font and colour style for a class of text.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <string.h>
 
 Style::Style() {
        aliasOfDefaultFont = true;
-       Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
-               Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
-               false, false, false, false, true);
+       Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
+             Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
+             false, false, false, false, caseMixed, true);
 }
-       
+
 Style::Style(const Style &source) {
-       Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
-               0, 0, 0,
-               false, false, false, false, true);
+       Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
+             0, 0, 0,
+             false, false, false, false, caseMixed, true);
        fore.desired = source.fore.desired;
        back.desired = source.back.desired;
        characterSet = source.characterSet;
@@ -29,7 +31,8 @@ Style::Style(const Style &source) {
        size = source.size;
        eolFilled = source.eolFilled;
        underline = source.underline;
-    visible = source.visible;
+       caseForce = source.caseForce;
+       visible = source.visible;
 }
 
 Style::~Style() {
@@ -42,10 +45,10 @@ Style::~Style() {
 
 Style &Style::operator=(const Style &source) {
        if (this == &source)
-               return *this;
-       Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
-               0, 0, SC_CHARSET_DEFAULT,
-               false, false, false, false, true);
+               return * this;
+       Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff),
+             0, 0, SC_CHARSET_DEFAULT,
+             false, false, false, false, caseMixed, true);
        fore.desired = source.fore.desired;
        back.desired = source.back.desired;
        characterSet = source.characterSet;
@@ -54,13 +57,15 @@ Style &Style::operator=(const Style &source) {
        size = source.size;
        eolFilled = source.eolFilled;
        underline = source.underline;
-    visible = source.visible;
+       caseForce = source.caseForce;
+       visible = source.visible;
        return *this;
 }
 
-void Style::Clear(Colour fore_, Colour back_, int size_, 
-       const char *fontName_, int characterSet_,
-       bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_) {
+void Style::Clear(Colour fore_, Colour back_, int size_,
+                  const char *fontName_, int characterSet_,
+                  bool bold_, bool italic_, bool eolFilled_, 
+                  bool underline_, ecaseForced caseForce_, bool visible_) {
        fore.desired = fore_;
        back.desired = back_;
        characterSet = characterSet_;
@@ -70,19 +75,35 @@ void Style::Clear(Colour fore_, Colour back_, int size_,
        fontName = fontName_;
        eolFilled = eolFilled_;
        underline = underline_;
-    visible = visible_;
+       caseForce = caseForce_;
+       visible = visible_;
        if (aliasOfDefaultFont)
                font.SetID(0);
-       else 
+       else
                font.Release();
        aliasOfDefaultFont = false;
 }
 
+void Style::ClearTo(const Style &source) {
+       Clear(
+               source.fore.desired,
+               source.back.desired,
+               source.size,
+               source.fontName,
+               source.characterSet,
+               source.bold,
+               source.italic,
+               source.eolFilled,
+               source.underline,
+               source.caseForce,
+               source.visible);
+}
+
 bool Style::EquivalentFontTo(const Style *other) const {
        if (bold != other->bold ||
-               italic != other->italic ||
-               size != other->size ||
-               characterSet != other->characterSet)
+               italic != other->italic ||
+               size != other->size ||
+               characterSet != other->characterSet)
                return false;
        if (fontName == other->fontName)
                return true;
@@ -94,17 +115,17 @@ bool Style::EquivalentFontTo(const Style *other) const {
 }
 
 void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
-       int sizeZoomed = size + zoomLevel;
+       sizeZoomed = size + zoomLevel;
        if (sizeZoomed <= 2)    // Hangs if sizeZoomed <= 1
                sizeZoomed = 2;
 
        if (aliasOfDefaultFont)
                font.SetID(0);
-       else 
+       else
                font.Release();
        int deviceHeight = surface.DeviceHeightFont(sizeZoomed);
-       aliasOfDefaultFont = defaultStyle && 
-               (EquivalentFontTo(defaultStyle) || !fontName);
+       aliasOfDefaultFont = defaultStyle &&
+                            (EquivalentFontTo(defaultStyle) || !fontName);
        if (aliasOfDefaultFont) {
                font.SetID(defaultStyle->font.GetID());
        } else if (fontName) {
index 9a2b4586a37442277bde4a32fe1123997286cf00..3600886b35efbd65cbe96c979c7f94121483c9ba 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// Style.h - defines the font and colour style for a class of text
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file Style.h
+ ** Defines the font and colour style for a class of text.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef STYLE_H
 #define STYLE_H
 
+/**
+ */
 class Style {
 public:
        ColourPair fore;
@@ -18,9 +22,12 @@ public:
        int characterSet;
        bool eolFilled;
        bool underline;
+       enum ecaseForced {caseMixed, caseUpper, caseLower};
+       ecaseForced caseForce;
        bool visible;
 
        Font font;
+       int sizeZoomed;
        unsigned int lineHeight;
        unsigned int ascent;
        unsigned int descent;
@@ -33,11 +40,13 @@ public:
        ~Style();
        Style &operator=(const Style &source);
        void Clear(Colour fore_, Colour back_,
-               int size_, 
-               const char *fontName_, int characterSet_,
-               bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_);
+                  int size_,
+                  const char *fontName_, int characterSet_,
+                  bool bold_, bool italic_, bool eolFilled_, 
+                  bool underline_, ecaseForced caseForce_, bool visible_);
+       void ClearTo(const Style &source);
        bool EquivalentFontTo(const Style *other) const;
-       void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0);
+       void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0);
 };
 
 #endif
index 9306f307c245da0ee01cad2eb80c380af300f1da..c3f960c62cfa374f6038f68f38f9de26dfac0ebf 100644 (file)
@@ -1,5 +1,8 @@
-// UniConversion.h - functions to handle UFT-8 and UCS-2 strings
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file UniConversion.cxx
+ ** Functions to handle UFT-8 and UCS-2 strings.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
index cace497c48a426014a99c02dae682abae993a60e..bd1d7754d45a9924f631d0d592491786dc8e8ea4 100644 (file)
@@ -1,5 +1,8 @@
-// UniConversion.h - functions to handle UFT-8 and UCS-2 strings
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file UniConversion.h
+ ** Functions to handle UFT-8 and UCS-2 strings.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen);
index 9b7a8535e9269a5594b8afa3d2120d62ee86dbef..4db7e2508bcd128b30c3d5f956dbd19d4e85ef30 100644 (file)
@@ -1,6 +1,8 @@
 // Scintilla source code edit control
-// ViewStyle.cxx - store information on how the document is to be viewed
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ViewStyle.cxx
+ ** Store information on how the document is to be viewed.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <string.h>
@@ -13,7 +15,7 @@
 #include "Style.h"
 #include "ViewStyle.h"
 
-MarginStyle::MarginStyle() : 
+MarginStyle::MarginStyle() :
        symbol(false), width(16), mask(0xffffffff), sensitive(false) {
 }
 
@@ -64,7 +66,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
        for (int ind=0;ind<=INDIC_MAX;ind++) {
                indicators[ind] = source.indicators[ind];
        }
-       
+
        selforeset = source.selforeset;
        selforeground.desired = source.selforeground.desired;
        selbackset = source.selbackset;
@@ -73,8 +75,11 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
        selbar.desired = source.selbar.desired;
        selbarlight.desired = source.selbarlight.desired;
        caretcolour.desired = source.caretcolour.desired;
+       showCaretLineBackground = source.showCaretLineBackground;
+       caretLineBackground.desired = source.caretLineBackground.desired;
        edgecolour.desired = source.edgecolour.desired;
        edgeState = source.edgeState;
+       caretWidth = source.caretWidth;
        leftMarginWidth = source.leftMarginWidth;
        rightMarginWidth = source.rightMarginWidth;
        for (int i=0;i < margins; i++) {
@@ -87,7 +92,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
        viewWhitespace = source.viewWhitespace;
        viewIndentationGuides = source.viewIndentationGuides;
        viewEOL = source.viewEOL;
-       showMarkedLines = source.showMarkedLines;               
+       showMarkedLines = source.showMarkedLines;
 }
 
 ViewStyle::~ViewStyle() {
@@ -96,7 +101,7 @@ ViewStyle::~ViewStyle() {
 void ViewStyle::Init() {
        fontNames.Clear();
        ResetDefaultStyle();
-       
+
        indicators[0].style = INDIC_SQUIGGLE;
        indicators[0].fore = Colour(0, 0x7f, 0);
        indicators[1].style = INDIC_TT;
@@ -119,11 +124,13 @@ void ViewStyle::Init() {
        selbarlight.desired = Platform::ChromeHighlight();
        styles[STYLE_LINENUMBER].fore.desired = Colour(0, 0, 0);
        styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
-       //caretcolour.desired = Colour(0xff, 0, 0);
        caretcolour.desired = Colour(0, 0, 0);
+       showCaretLineBackground = false;
+       caretLineBackground.desired = Colour(0xff, 0xff, 0);
        edgecolour.desired = Colour(0xc0, 0xc0, 0xc0);
        edgeState = EDGE_NONE;
-       
+       caretWidth = 1;
+
        leftMarginWidth = 1;
        rightMarginWidth = 1;
        ms[0].symbol = false;
@@ -172,6 +179,7 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
        pal.WantFind(selbar, want);
        pal.WantFind(selbarlight, want);
        pal.WantFind(caretcolour, want);
+       pal.WantFind(caretLineBackground, want);
        pal.WantFind(edgecolour, want);
 }
 
@@ -190,7 +198,7 @@ void ViewStyle::Refresh(Surface &surface) {
                                maxDescent = styles[i].descent;
                }
        }
-       
+
        lineHeight = maxAscent + maxDescent;
        aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
        spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
@@ -208,26 +216,16 @@ void ViewStyle::Refresh(Surface &surface) {
 
 void ViewStyle::ResetDefaultStyle() {
        styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
-               Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), 
+               Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()),
                SC_CHARSET_DEFAULT,
-               false, false, false, false, true);
+               false, false, false, false, Style::caseMixed, true);
 }
 
 void ViewStyle::ClearStyles() {
        // Reset all styles to be like the default style
        for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
                if (i != STYLE_DEFAULT) {
-                       styles[i].Clear(
-                               styles[STYLE_DEFAULT].fore.desired, 
-                               styles[STYLE_DEFAULT].back.desired, 
-                               styles[STYLE_DEFAULT].size, 
-                               styles[STYLE_DEFAULT].fontName, 
-                               styles[STYLE_DEFAULT].characterSet, 
-                               styles[STYLE_DEFAULT].bold, 
-                               styles[STYLE_DEFAULT].italic,
-                               styles[STYLE_DEFAULT].eolFilled,
-                               styles[STYLE_DEFAULT].underline,
-                               styles[STYLE_DEFAULT].visible);
+                       styles[i].ClearTo(styles[STYLE_DEFAULT]);
                }
        }
        styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
index 5b0ab1925f340b6708829b9bd927c96910bcdb6e..7528638c59058075fb5eb44a685b15064699a15b 100644 (file)
@@ -1,11 +1,15 @@
 // Scintilla source code edit control
-// ViewStyle.h - store information on how the document is to be viewed
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+/** @file ViewStyle.h
+ ** Store information on how the document is to be viewed.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #ifndef VIEWSTYLE_H
 #define VIEWSTYLE_H
 
+/**
+ */
 class MarginStyle {
 public:
        bool symbol;
@@ -15,10 +19,13 @@ public:
        MarginStyle();
 };
 
+/**
+ */
 class FontNames {
 private:
        char *names[STYLE_MAX + 1];
        int max;
+
 public:
        FontNames();
        ~FontNames();
@@ -27,6 +34,9 @@ public:
 };
 
 enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
+
+/**
+ */
 class ViewStyle {
 public:
        FontNames fontNames;
@@ -45,12 +55,12 @@ public:
        ColourPair selbackground2;
        ColourPair selbar;
        ColourPair selbarlight;
-       // Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
-       int leftMarginWidth;            // Spacing margin on left of text
-       int rightMarginWidth;   // Spacing margin on left of text
+       /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
        enum { margins=3 };
+       int leftMarginWidth;    ///< Spacing margin on left of text
+       int rightMarginWidth;   ///< Spacing margin on left of text
        bool symbolMargin;
-       int maskInLine; // Mask for markers to be put into text because there is nowhere for them to go in margin
+       int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
        MarginStyle ms[margins];
        int fixedColumnWidth;
        int zoomLevel;
@@ -59,8 +69,11 @@ public:
        bool viewEOL;
        bool showMarkedLines;
        ColourPair caretcolour;
+       bool showCaretLineBackground;
+       ColourPair caretLineBackground;
        ColourPair edgecolour;
        int edgeState;
+       int caretWidth;
        
        ViewStyle();
        ViewStyle(const ViewStyle &source);
index 5f3deac7db969f7fb0dbe038fd8adde7d501e135..db2f938f301fe27f3ee538c709911a2fd1aae9ea 100644 (file)
@@ -1,6 +1,8 @@
-// SciTE - Scintilla based Text Editor
-// Accessor.cxx - rapid easy access to contents of a Scintilla
-// Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
+// Scintilla source code edit control
+/** @file WindowAccessor.cxx
+ ** Rapid easy access to contents of a Scintilla.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
 
 #include <stdlib.h>
index 6adfd80a8452e4c8a1f78bad4ffa4b0f9ca40ab7..944df02c536d2af3533035265ef2cea0bb70e275 100644 (file)
 
 int wxForceScintillaLexers(void)
 {
+  extern LexerModule lmAda;
+  extern LexerModule lmAVE;
+  extern LexerModule lmConf;
   extern LexerModule lmCPP;
+  extern LexerModule lmEiffel;
   extern LexerModule lmHTML;
-  extern LexerModule lmXML;
-  extern LexerModule lmProps;
-  extern LexerModule lmErrorList;
-  extern LexerModule lmMake;
-  extern LexerModule lmBatch;
+  extern LexerModule lmLISP;
+  extern LexerModule lmLua;
+  extern LexerModule lmBatch;  // In LexOthers.cxx
+  extern LexerModule lmPascal;
   extern LexerModule lmPerl;
   extern LexerModule lmPython;
+  extern LexerModule lmRuby;
   extern LexerModule lmSQL;
   extern LexerModule lmVB;
 
-  if (
-      &lmCPP
-      && &lmHTML
-      && &lmXML
-      && &lmProps
-      && &lmErrorList
-      && &lmMake
-      && &lmBatch
-      && &lmPerl
-      && &lmPython
-      && &lmSQL
-      && &lmVB
-      )
+  if (  &lmAda
+     && &lmAVE
+     && &lmConf
+     && &lmCPP
+     && &lmEiffel
+     && &lmHTML
+     && &lmLISP
+     && &lmLua
+     && &lmBatch
+     && &lmPascal
+     && &lmPerl
+     && &lmPython
+     && &lmRuby
+     && &lmSQL
+     && &lmVB )
     {
       return 1;
     }
@@ -66,21 +72,27 @@ int wxForceScintillaLexers(void)
 
 const wxChar* wxSTCNameStr = "stcwindow";
 
-
 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE )
 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED )
 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED )
-DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED )
 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT )
 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT )
+DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK )
+DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED )
-DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD )
 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN )
 DEFINE_EVENT_TYPE( wxEVT_STC_POSCHANGED )
+DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED )
+DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION )
+DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
+DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
+DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
+
+
 
 
 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -94,7 +106,7 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
 #endif
     EVT_MOTION                  (wxStyledTextCtrl::OnMouseMove)
     EVT_LEFT_UP                 (wxStyledTextCtrl::OnMouseLeftUp)
-    EVT_RIGHT_UP                (wxStyledTextCtrl::OnMouseRightUp)
+    EVT_CONTEXT_MENU            (wxStyledTextCtrl::OnContextMenu)
     EVT_MOUSEWHEEL              (wxStyledTextCtrl::OnMouseWheel)
     EVT_CHAR                    (wxStyledTextCtrl::OnChar)
     EVT_KEY_DOWN                (wxStyledTextCtrl::OnKeyDown)
@@ -299,6 +311,12 @@ int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) {
                               return SendMsg(2022, pt.x, pt.y);
 }
 
+// Find the position from a point within the window but return
+// INVALID_POSITION if not close to text.
+int wxStyledTextCtrl::PositionFromPointClose(int x, int y) {
+    return SendMsg(2023, x, y);
+}
+
 // Set caret to start of a line and ensure it is visible.
 void wxStyledTextCtrl::GotoLine(int line) {
     SendMsg(2024, line, 0);
@@ -335,9 +353,9 @@ int wxStyledTextCtrl::GetEndStyled() {
     return SendMsg(2028, 0, 0);
 }
 
-// Convert all line endings in the document to use the current mode.
-void wxStyledTextCtrl::ConvertEOLs() {
-    SendMsg(2029, 0, 0);
+// Convert all line endings in the document to one mode.
+void wxStyledTextCtrl::ConvertEOLs(int eolMode) {
+    SendMsg(2029, eolMode, 0);
 }
 
 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
@@ -534,6 +552,11 @@ void wxStyledTextCtrl::StyleSetUnderline(int style, bool underline) {
     SendMsg(2059, style, underline);
 }
 
+// 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 the foreground colour of the selection and whether to use this setting.
 void wxStyledTextCtrl::SetSelForeground(bool useSetting, const wxColour& fore) {
     SendMsg(2067, useSetting, wxColourAsLong(fore));
@@ -649,6 +672,27 @@ int wxStyledTextCtrl::GetMaxLineState() {
     return SendMsg(2094, 0, 0);
 }
 
+// Is the background of the line containing the caret in a different colour?
+bool wxStyledTextCtrl::GetCaretLineVisible() {
+    return SendMsg(2095, 0, 0) != 0;
+}
+
+// Display the background of the line containing the caret in a different colour.
+void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
+    SendMsg(2096, show, 0);
+}
+
+// Get the colour of the background of the line containing the caret.
+wxColour wxStyledTextCtrl::GetCaretLineBack() {
+    long c = SendMsg(2097, 0, 0);
+    return wxColourFromLong(c);
+}
+
+// Set the colour of the background of the line containing the caret.
+void wxStyledTextCtrl::SetCaretLineBack(const wxColour& back) {
+    SendMsg(2098, wxColourAsLong(back), 0);
+}
+
 // Display a auto-completion list.
 // The lenEntered parameter indicates how many characters before
 // the caret should be used to provide context.
@@ -734,6 +778,21 @@ bool wxStyledTextCtrl::AutoCompGetIgnoreCase() {
     return SendMsg(2116, 0, 0) != 0;
 }
 
+// Display a list of strings and send notification when user chooses one.
+void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList) {
+    SendMsg(2117, listType, (long)itemList.c_str());
+}
+
+// Set whether or not autocompletion is hidden automatically when nothing matches
+void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide) {
+    SendMsg(2118, autoHide, 0);
+}
+
+// Retrieve whether or not autocompletion is hidden automatically when nothing matches
+bool wxStyledTextCtrl::AutoCompGetAutoHide() {
+    return SendMsg(2119, 0, 0) != 0;
+}
+
 // Set the number of spaces used for one level of indentation.
 void wxStyledTextCtrl::SetIndent(int indentSize) {
     SendMsg(2122, indentSize, 0);
@@ -938,8 +997,8 @@ int wxStyledTextCtrl::GetLineCount() {
 }
 
 // Sets the size in pixels of the left margin.
-void wxStyledTextCtrl::SetMarginLeft(int width) {
-    SendMsg(2155, 0, width);
+void wxStyledTextCtrl::SetMarginLeft(int pixelWidth) {
+    SendMsg(2155, 0, pixelWidth);
 }
 
 // Returns the size in pixels of the left margin.
@@ -948,8 +1007,8 @@ int wxStyledTextCtrl::GetMarginLeft() {
 }
 
 // Sets the size in pixels of the right margin.
-void wxStyledTextCtrl::SetMarginRight(int width) {
-    SendMsg(2157, 0, width);
+void wxStyledTextCtrl::SetMarginRight(int pixelWidth) {
+    SendMsg(2157, 0, pixelWidth);
 }
 
 // Returns the size in pixels of the right margin.
@@ -1105,6 +1164,76 @@ bool wxStyledTextCtrl::GetOvertype() {
     return SendMsg(2187, 0, 0) != 0;
 }
 
+// Set the width of the insert mode caret
+void wxStyledTextCtrl::SetCaretWidth(int pixelWidth) {
+    SendMsg(2188, pixelWidth, 0);
+}
+
+// Returns the width of the insert mode caret
+int wxStyledTextCtrl::GetCaretWidth() {
+    return SendMsg(2189, 0, 0);
+}
+
+// Sets the position that starts the target which is used for updating the
+// document without affecting the scroll position.
+void wxStyledTextCtrl::SetTargetStart(int pos) {
+    SendMsg(2190, pos, 0);
+}
+
+// Get the position that starts the target.
+int wxStyledTextCtrl::GetTargetStart() {
+    return SendMsg(2191, 0, 0);
+}
+
+// Sets the position that ends the target which is used for updating the
+// document without affecting the scroll position.
+void wxStyledTextCtrl::SetTargetEnd(int pos) {
+    SendMsg(2192, pos, 0);
+}
+
+// Get the position that ends the target.
+int wxStyledTextCtrl::GetTargetEnd() {
+    return SendMsg(2193, 0, 0);
+}
+
+// Replace the target text with the argument text.
+// Returns the length of the replacement text.
+
+                       int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
+                           return SendMsg(2194, text.Len(), (long)text.c_str());
+                       
+}
+
+// Replace the target text with the argument text after \d processing.
+// Looks for \d where d is between 1 and 9 and replaces these with the strings
+// matched in the last search operation which were surrounded by \( and \).
+// Returns the length of the replacement text including any change
+// caused by processing the \d patterns.
+
+                       int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
+                           return SendMsg(2195, text.Len(), (long)text.c_str());
+                       
+}
+
+// Search for a counted string in the target and set the target to the found
+// range.
+// Returns length of range or -1 for failure in which case target is not moved.
+
+                       int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
+                           return SendMsg(2197, text.Len(), (long)text.c_str());
+                       
+}
+
+// Set the search flags used by SearchInTarget
+void wxStyledTextCtrl::SetSearchFlags(int flags) {
+    SendMsg(2198, flags, 0);
+}
+
+// Get the search flags used by SearchInTarget
+int wxStyledTextCtrl::GetSearchFlags() {
+    return SendMsg(2199, 0, 0);
+}
+
 // Show a call tip containing a definition near position pos.
 void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition) {
     SendMsg(2200, pos, (long)definition.c_str());
@@ -1207,6 +1336,47 @@ void wxStyledTextCtrl::SetFoldFlags(int flags) {
     SendMsg(2233, flags, 0);
 }
 
+// Ensure a particular line is visible by expanding any header line hiding it.
+// Use the currently set visibility policy to determine which range to display.
+void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line) {
+    SendMsg(2234, line, 0);
+}
+
+// Sets whether a tab pressed when caret is within indentation indents
+void wxStyledTextCtrl::SetTabIndents(bool tabIndents) {
+    SendMsg(2260, tabIndents, 0);
+}
+
+// Does a tab pressed when caret is within indentation indent?
+bool wxStyledTextCtrl::GetTabIndents() {
+    return SendMsg(2261, 0, 0) != 0;
+}
+
+// Sets whether a backspace pressed when caret is within indentation unindents
+void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents) {
+    SendMsg(2262, bsUnIndents, 0);
+}
+
+// Does a backspace pressed when caret is within indentation unindent?
+bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
+    return SendMsg(2263, 0, 0) != 0;
+}
+
+// Sets the time the mouse must sit still to generate a mouse dwell event
+void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds) {
+    SendMsg(2264, periodMilliseconds, 0);
+}
+
+// Retrieve the time the mouse must sit still to generate a mouse dwell event
+int wxStyledTextCtrl::GetMouseDwellTime() {
+    return SendMsg(2265, 0, 0);
+}
+
+// Move the caret inside current view if it's not there already
+void wxStyledTextCtrl::MoveCaretInsideView() {
+    SendMsg(2401, 0, 0);
+}
+
 // How many characters are on a line, not including end of line characters.
 int wxStyledTextCtrl::LineLength(int line) {
     return SendMsg(2350, line, 0);
@@ -1244,7 +1414,7 @@ void* wxStyledTextCtrl::GetDocPointer() {
 
 // Change the document object used.
 void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
-                           SendMsg(2358, (long)docPointer);
+                           SendMsg(2358, 0, (long)docPointer);
 }
 
 // Set which document modification events are sent to the container.
@@ -1291,11 +1461,13 @@ void wxStyledTextCtrl::SearchAnchor() {
 }
 
 // Find some text starting at the search anchor.
+// Does not ensure the selection is visible.
 int wxStyledTextCtrl::SearchNext(int flags, const wxString& text) {
     return SendMsg(2367, flags, (long)text.c_str());
 }
 
 // Find some text starting at the search anchor and moving backwards.
+// Does not ensure the selection is visible.
 int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text) {
     return SendMsg(2368, flags, (long)text.c_str());
 }
@@ -1353,6 +1525,81 @@ int wxStyledTextCtrl::GetModEventMask() {
     return SendMsg(2378, 0, 0);
 }
 
+// Change internal focus flag
+void wxStyledTextCtrl::SetFocus(bool focus) {
+    SendMsg(2380, focus, 0);
+}
+
+// Get internal focus flag
+bool wxStyledTextCtrl::GetFocus() {
+    return SendMsg(2381, 0, 0) != 0;
+}
+
+// Change error status - 0 = OK
+void wxStyledTextCtrl::SetStatus(int statusCode) {
+    SendMsg(2382, statusCode, 0);
+}
+
+// Get error status
+int wxStyledTextCtrl::GetStatus() {
+    return SendMsg(2383, 0, 0);
+}
+
+// Set whether the mouse is captured when its button is pressed
+void wxStyledTextCtrl::SetMouseDownCaptures(bool captures) {
+    SendMsg(2384, captures, 0);
+}
+
+// Get whether mouse gets captured
+bool wxStyledTextCtrl::GetMouseDownCaptures() {
+    return SendMsg(2385, 0, 0) != 0;
+}
+
+// Sets the cursor to one of the SC_CURSOR* values
+void wxStyledTextCtrl::SetCursor(int cursorType) {
+    SendMsg(2386, cursorType, 0);
+}
+
+// Get cursor type
+int wxStyledTextCtrl::GetCursor() {
+    return SendMsg(2387, 0, 0);
+}
+
+// Move to the previous change in capitalistion
+void wxStyledTextCtrl::WordPartLeft() {
+    SendMsg(2390, 0, 0);
+}
+
+// Move to the previous change in capitalistion extending selection to new caret position.
+void wxStyledTextCtrl::WordPartLeftExtend() {
+    SendMsg(2391, 0, 0);
+}
+
+// Move to the change next in capitalistion
+void wxStyledTextCtrl::WordPartRight() {
+    SendMsg(2392, 0, 0);
+}
+
+// Move to the next change in capitalistion extending selection to new caret position.
+void wxStyledTextCtrl::WordPartRightExtend() {
+    SendMsg(2393, 0, 0);
+}
+
+// Set the way the display area is determined when a particular line is to be moved to.
+void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop) {
+    SendMsg(2394, visiblePolicy, visibleSlop);
+}
+
+// Delete back from the current position to the start of the line
+void wxStyledTextCtrl::DelLineLeft() {
+    SendMsg(2395, 0, 0);
+}
+
+// Delete forwards from the current position to the end of the line
+void wxStyledTextCtrl::DelLineRight() {
+    SendMsg(2396, 0, 0);
+}
+
 // Start notifying the container of all key presses and commands.
 void wxStyledTextCtrl::StartRecord() {
     SendMsg(3001, 0, 0);
@@ -1388,6 +1635,11 @@ void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords) {
     SendMsg(4005, keywordSet, (long)keyWords.c_str());
 }
 
+// Set the lexing language of the document based on string name.
+void wxStyledTextCtrl::SetLexerLanguage(const wxString& language) {
+    SendMsg(4006, 0, (long)language.c_str());
+}
+
 // END of generated section
 //----------------------------------------------------------------------
 
@@ -1560,8 +1812,9 @@ void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
 }
 
 
-void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
+void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
     wxPoint pt = evt.GetPosition();
+    ScreenToClient(&pt.x, &pt.y);
     m_swx->DoContextMenu(Point(pt.x, pt.y));
 }
 
@@ -1569,7 +1822,8 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
     m_swx->DoMouseWheel(evt.GetWheelRotation(),
                         evt.GetWheelDelta(),
-                        evt.GetLinesPerAction());
+                        evt.GetLinesPerAction(),
+                        evt.ControlDown());
 }
 
 
@@ -1588,10 +1842,14 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
 
 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
     long key = evt.KeyCode();
-    key = toupper(key);
-    int processed = m_swx->DoKeyDown(key, evt.ShiftDown(),
-                                     evt.ControlDown(), evt.AltDown());
-    if (! processed)
+    //key = toupper(key);  //**** ????
+    bool consumed = FALSE;
+    int processed = m_swx->DoKeyDown(key,
+                                     evt.ShiftDown(),
+                                     evt.ControlDown(),
+                                     evt.AltDown(),
+                                     &consumed);
+    if (!processed && !consumed)
         evt.Skip();
 }
 
@@ -1634,73 +1892,110 @@ void wxStyledTextCtrl::NotifyChange() {
 
 void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
     SCNotification& scn = *_scn;
-    int eventType = 0;
+    wxStyledTextEvent evt(0, GetId());
+
+    evt.SetPosition(scn.position);
+    evt.SetKey(scn.ch);
+    evt.SetModifiers(scn.modifiers);
+
     switch (scn.nmhdr.code) {
     case SCN_STYLENEEDED:
-        eventType = wxEVT_STC_STYLENEEDED;
+        evt.SetEventType(wxEVT_STC_STYLENEEDED);
         break;
+
     case SCN_CHARADDED:
-        eventType = wxEVT_STC_CHARADDED;
-        break;
-    case SCN_UPDATEUI:
-        eventType = wxEVT_STC_UPDATEUI;
+        evt.SetEventType(wxEVT_STC_CHARADDED);
         break;
+
     case SCN_SAVEPOINTREACHED:
-        eventType = wxEVT_STC_SAVEPOINTREACHED;
+        evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
         break;
+
     case SCN_SAVEPOINTLEFT:
-        eventType = wxEVT_STC_SAVEPOINTLEFT;
+        evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
         break;
+
     case SCN_MODIFYATTEMPTRO:
-        eventType = wxEVT_STC_ROMODIFYATTEMPT;
+        evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
         break;
+
+    case SCN_KEY:
+        evt.SetEventType(wxEVT_STC_KEY);
+        break;
+
     case SCN_DOUBLECLICK:
-        eventType = wxEVT_STC_DOUBLECLICK;
+        evt.SetEventType(wxEVT_STC_DOUBLECLICK);
         break;
-    case SCN_MODIFIED:
-        eventType = wxEVT_STC_MODIFIED;
+
+    case SCN_UPDATEUI:
+        evt.SetEventType(wxEVT_STC_UPDATEUI);
         break;
-    case SCN_KEY:
-        eventType = wxEVT_STC_KEY;
+
+    case SCN_MODIFIED:
+        evt.SetEventType(wxEVT_STC_MODIFIED);
+        evt.SetModificationType(scn.modificationType);
+        if (scn.text)
+            evt.SetText(wxString(scn.text, scn.length));
+        evt.SetLength(scn.length);
+        evt.SetLinesAdded(scn.linesAdded);
+        evt.SetLine(scn.line);
+        evt.SetFoldLevelNow(scn.foldLevelNow);
+        evt.SetFoldLevelPrev(scn.foldLevelPrev);
         break;
+
     case SCN_MACRORECORD:
-        eventType = wxEVT_STC_MACRORECORD;
+        evt.SetEventType(wxEVT_STC_MACRORECORD);
+        evt.SetMessage(scn.message);
+        evt.SetWParam(scn.wParam);
+        evt.SetLParam(scn.lParam);
         break;
+
     case SCN_MARGINCLICK:
-        eventType = wxEVT_STC_MARGINCLICK;
+        evt.SetEventType(wxEVT_STC_MARGINCLICK);
+        evt.SetMargin(scn.margin);
         break;
+
     case SCN_NEEDSHOWN:
-        eventType = wxEVT_STC_NEEDSHOWN;
+        evt.SetEventType(wxEVT_STC_NEEDSHOWN);
+        evt.SetLength(scn.length);
         break;
+
     case SCN_POSCHANGED:
-        eventType = wxEVT_STC_POSCHANGED;
+        evt.SetEventType(wxEVT_STC_POSCHANGED);
         break;
-    }
-    if (eventType) {
-        wxStyledTextEvent evt(eventType, GetId());
-        evt.SetPosition(scn.position);
-        evt.SetKey(scn.ch);
-        evt.SetModifiers(scn.modifiers);
-        if (eventType == wxEVT_STC_MODIFIED) {
-            evt.SetModificationType(scn.modificationType);
-            if (scn.text)
-                evt.SetText(wxString(scn.text, scn.length));
-            evt.SetLength(scn.length);
-            evt.SetLinesAdded(scn.linesAdded);
-            evt.SetLine(scn.line);
-            evt.SetFoldLevelNow(scn.foldLevelNow);
-            evt.SetFoldLevelPrev(scn.foldLevelPrev);
-        }
-        if (eventType == wxEVT_STC_MARGINCLICK)
-            evt.SetMargin(scn.margin);
-        if (eventType == wxEVT_STC_MACRORECORD) {
-            evt.SetMessage(scn.message);
-            evt.SetWParam(scn.wParam);
-            evt.SetLParam(scn.lParam);
-        }
 
-        GetEventHandler()->ProcessEvent(evt);
+    case SCN_PAINTED:
+        evt.SetEventType(wxEVT_STC_PAINTED);
+        break;
+
+    case SCN_USERLISTSELECTION:
+        evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
+        evt.SetListType(scn.listType);
+        evt.SetText(scn.text);
+        break;
+
+    case SCN_URIDROPPED:
+        evt.SetEventType(wxEVT_STC_URIDROPPED);
+        evt.SetText(scn.text);
+        break;
+
+    case SCN_DWELLSTART:
+        evt.SetEventType(wxEVT_STC_DWELLSTART);
+        evt.SetX(scn.x);
+        evt.SetY(scn.y);
+        break;
+
+    case SCN_DWELLEND:
+        evt.SetEventType(wxEVT_STC_DWELLEND);
+        evt.SetX(scn.x);
+        evt.SetY(scn.y);
+        break;
+
+    default:
+        return;
     }
+
+    GetEventHandler()->ProcessEvent(evt);
 }
 
 
@@ -1725,8 +2020,9 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
     m_message = 0;
     m_wParam = 0;
     m_lParam = 0;
-
-
+    m_listType = 0;
+    m_x = 0;
+    m_y = 0;
 }
 
 bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
@@ -1754,7 +2050,9 @@ void wxStyledTextEvent::CopyObject(wxObject& obj) const {
     o->m_wParam =        m_wParam;
     o->m_lParam =        m_lParam;
 
-
+    o->m_listType =     m_listType;
+    o->m_x =            m_x;
+    o->m_y =            m_y;
 
 }
 
index 890c97ab8abda737f0ab41da0f0f9d6f14d48125..65c88c28fb6fde30becf30b9d432ccaa753a24a0 100644 (file)
 
 int wxForceScintillaLexers(void)
 {
+  extern LexerModule lmAda;
+  extern LexerModule lmAVE;
+  extern LexerModule lmConf;
   extern LexerModule lmCPP;
+  extern LexerModule lmEiffel;
   extern LexerModule lmHTML;
-  extern LexerModule lmXML;
-  extern LexerModule lmProps;
-  extern LexerModule lmErrorList;
-  extern LexerModule lmMake;
-  extern LexerModule lmBatch;
+  extern LexerModule lmLISP;
+  extern LexerModule lmLua;
+  extern LexerModule lmBatch;  // In LexOthers.cxx
+  extern LexerModule lmPascal;
   extern LexerModule lmPerl;
   extern LexerModule lmPython;
+  extern LexerModule lmRuby;
   extern LexerModule lmSQL;
   extern LexerModule lmVB;
 
-  if (
-      &lmCPP
-      && &lmHTML
-      && &lmXML
-      && &lmProps
-      && &lmErrorList
-      && &lmMake
-      && &lmBatch
-      && &lmPerl
-      && &lmPython
-      && &lmSQL
-      && &lmVB
-      )
+  if (  &lmAda
+     && &lmAVE
+     && &lmConf
+     && &lmCPP
+     && &lmEiffel
+     && &lmHTML
+     && &lmLISP
+     && &lmLua
+     && &lmBatch
+     && &lmPascal
+     && &lmPerl
+     && &lmPython
+     && &lmRuby
+     && &lmSQL
+     && &lmVB )
     {
       return 1;
     }
@@ -66,21 +72,27 @@ int wxForceScintillaLexers(void)
 
 const wxChar* wxSTCNameStr = "stcwindow";
 
-
 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE )
 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED )
 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED )
-DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED )
 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT )
 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT )
+DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK )
+DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED )
-DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD )
 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK )
 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN )
 DEFINE_EVENT_TYPE( wxEVT_STC_POSCHANGED )
+DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED )
+DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION )
+DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
+DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
+DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
+
+
 
 
 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -94,7 +106,7 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
 #endif
     EVT_MOTION                  (wxStyledTextCtrl::OnMouseMove)
     EVT_LEFT_UP                 (wxStyledTextCtrl::OnMouseLeftUp)
-    EVT_RIGHT_UP                (wxStyledTextCtrl::OnMouseRightUp)
+    EVT_CONTEXT_MENU            (wxStyledTextCtrl::OnContextMenu)
     EVT_MOUSEWHEEL              (wxStyledTextCtrl::OnMouseWheel)
     EVT_CHAR                    (wxStyledTextCtrl::OnChar)
     EVT_KEY_DOWN                (wxStyledTextCtrl::OnKeyDown)
@@ -350,8 +362,9 @@ void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
 }
 
 
-void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
+void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
     wxPoint pt = evt.GetPosition();
+    ScreenToClient(&pt.x, &pt.y);
     m_swx->DoContextMenu(Point(pt.x, pt.y));
 }
 
@@ -359,7 +372,8 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
     m_swx->DoMouseWheel(evt.GetWheelRotation(),
                         evt.GetWheelDelta(),
-                        evt.GetLinesPerAction());
+                        evt.GetLinesPerAction(),
+                        evt.ControlDown());
 }
 
 
@@ -378,10 +392,14 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
 
 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
     long key = evt.KeyCode();
-    key = toupper(key);
-    int processed = m_swx->DoKeyDown(key, evt.ShiftDown(),
-                                     evt.ControlDown(), evt.AltDown());
-    if (! processed)
+    //key = toupper(key);  //**** ????
+    bool consumed = FALSE;
+    int processed = m_swx->DoKeyDown(key,
+                                     evt.ShiftDown(),
+                                     evt.ControlDown(),
+                                     evt.AltDown(),
+                                     &consumed);
+    if (!processed && !consumed)
         evt.Skip();
 }
 
@@ -424,73 +442,110 @@ void wxStyledTextCtrl::NotifyChange() {
 
 void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
     SCNotification& scn = *_scn;
-    int eventType = 0;
+    wxStyledTextEvent evt(0, GetId());
+
+    evt.SetPosition(scn.position);
+    evt.SetKey(scn.ch);
+    evt.SetModifiers(scn.modifiers);
+
     switch (scn.nmhdr.code) {
     case SCN_STYLENEEDED:
-        eventType = wxEVT_STC_STYLENEEDED;
+        evt.SetEventType(wxEVT_STC_STYLENEEDED);
         break;
+
     case SCN_CHARADDED:
-        eventType = wxEVT_STC_CHARADDED;
-        break;
-    case SCN_UPDATEUI:
-        eventType = wxEVT_STC_UPDATEUI;
+        evt.SetEventType(wxEVT_STC_CHARADDED);
         break;
+
     case SCN_SAVEPOINTREACHED:
-        eventType = wxEVT_STC_SAVEPOINTREACHED;
+        evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
         break;
+
     case SCN_SAVEPOINTLEFT:
-        eventType = wxEVT_STC_SAVEPOINTLEFT;
+        evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
         break;
+
     case SCN_MODIFYATTEMPTRO:
-        eventType = wxEVT_STC_ROMODIFYATTEMPT;
+        evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
+        break;
+
+    case SCN_KEY:
+        evt.SetEventType(wxEVT_STC_KEY);
         break;
+
     case SCN_DOUBLECLICK:
-        eventType = wxEVT_STC_DOUBLECLICK;
+        evt.SetEventType(wxEVT_STC_DOUBLECLICK);
         break;
-    case SCN_MODIFIED:
-        eventType = wxEVT_STC_MODIFIED;
+
+    case SCN_UPDATEUI:
+        evt.SetEventType(wxEVT_STC_UPDATEUI);
         break;
-    case SCN_KEY:
-        eventType = wxEVT_STC_KEY;
+
+    case SCN_MODIFIED:
+        evt.SetEventType(wxEVT_STC_MODIFIED);
+        evt.SetModificationType(scn.modificationType);
+        if (scn.text)
+            evt.SetText(wxString(scn.text, scn.length));
+        evt.SetLength(scn.length);
+        evt.SetLinesAdded(scn.linesAdded);
+        evt.SetLine(scn.line);
+        evt.SetFoldLevelNow(scn.foldLevelNow);
+        evt.SetFoldLevelPrev(scn.foldLevelPrev);
         break;
+
     case SCN_MACRORECORD:
-        eventType = wxEVT_STC_MACRORECORD;
+        evt.SetEventType(wxEVT_STC_MACRORECORD);
+        evt.SetMessage(scn.message);
+        evt.SetWParam(scn.wParam);
+        evt.SetLParam(scn.lParam);
         break;
+
     case SCN_MARGINCLICK:
-        eventType = wxEVT_STC_MARGINCLICK;
+        evt.SetEventType(wxEVT_STC_MARGINCLICK);
+        evt.SetMargin(scn.margin);
         break;
+
     case SCN_NEEDSHOWN:
-        eventType = wxEVT_STC_NEEDSHOWN;
+        evt.SetEventType(wxEVT_STC_NEEDSHOWN);
+        evt.SetLength(scn.length);
         break;
+
     case SCN_POSCHANGED:
-        eventType = wxEVT_STC_POSCHANGED;
+        evt.SetEventType(wxEVT_STC_POSCHANGED);
+        break;
+
+    case SCN_PAINTED:
+        evt.SetEventType(wxEVT_STC_PAINTED);
+        break;
+
+    case SCN_USERLISTSELECTION:
+        evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
+        evt.SetListType(scn.listType);
+        evt.SetText(scn.text);
         break;
-    }
-    if (eventType) {
-        wxStyledTextEvent evt(eventType, GetId());
-        evt.SetPosition(scn.position);
-        evt.SetKey(scn.ch);
-        evt.SetModifiers(scn.modifiers);
-        if (eventType == wxEVT_STC_MODIFIED) {
-            evt.SetModificationType(scn.modificationType);
-            if (scn.text)
-                evt.SetText(wxString(scn.text, scn.length));
-            evt.SetLength(scn.length);
-            evt.SetLinesAdded(scn.linesAdded);
-            evt.SetLine(scn.line);
-            evt.SetFoldLevelNow(scn.foldLevelNow);
-            evt.SetFoldLevelPrev(scn.foldLevelPrev);
-        }
-        if (eventType == wxEVT_STC_MARGINCLICK)
-            evt.SetMargin(scn.margin);
-        if (eventType == wxEVT_STC_MACRORECORD) {
-            evt.SetMessage(scn.message);
-            evt.SetWParam(scn.wParam);
-            evt.SetLParam(scn.lParam);
-        }
 
-        GetEventHandler()->ProcessEvent(evt);
+    case SCN_URIDROPPED:
+        evt.SetEventType(wxEVT_STC_URIDROPPED);
+        evt.SetText(scn.text);
+        break;
+
+    case SCN_DWELLSTART:
+        evt.SetEventType(wxEVT_STC_DWELLSTART);
+        evt.SetX(scn.x);
+        evt.SetY(scn.y);
+        break;
+
+    case SCN_DWELLEND:
+        evt.SetEventType(wxEVT_STC_DWELLEND);
+        evt.SetX(scn.x);
+        evt.SetY(scn.y);
+        break;
+
+    default:
+        return;
     }
+
+    GetEventHandler()->ProcessEvent(evt);
 }
 
 
@@ -515,8 +570,9 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
     m_message = 0;
     m_wParam = 0;
     m_lParam = 0;
-
-
+    m_listType = 0;
+    m_x = 0;
+    m_y = 0;
 }
 
 bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
@@ -544,7 +600,9 @@ void wxStyledTextEvent::CopyObject(wxObject& obj) const {
     o->m_wParam =        m_wParam;
     o->m_lParam =        m_lParam;
 
-
+    o->m_listType =     m_listType;
+    o->m_x =            m_x;
+    o->m_y =            m_y;
 
 }
 
index bab374459a231a9680a379ac03b03c5371aac593..a742614327e9bcc29e3325663fb21617476bb457 100644 (file)
@@ -141,6 +141,10 @@ public:
     // Scroll enough to make the given column visible
     void ScrollToColumn(int column);
 
+
+    // Send a message to Scintilla
+    long SendMsg(int msg, long wp=0, long lp=0);
+
 //----------------------------------------------------------------------
 
 
@@ -153,7 +157,7 @@ private:
     void OnMouseLeftDown(wxMouseEvent& evt);
     void OnMouseMove(wxMouseEvent& evt);
     void OnMouseLeftUp(wxMouseEvent& evt);
-    void OnMouseRightUp(wxMouseEvent& evt);
+    void OnContextMenu(wxContextMenuEvent& evt);
     void OnMouseWheel(wxMouseEvent& evt);
     void OnChar(wxKeyEvent& evt);
     void OnKeyDown(wxKeyEvent& evt);
@@ -169,8 +173,6 @@ private:
     void NotifyChange();
     void NotifyParent(SCNotification* scn);
 
-    long SendMsg(int msg, long wp=0, long lp=0);
-
 private:
     DECLARE_EVENT_TABLE()
     DECLARE_CLASS(wxStyledTextCtrl)
@@ -205,6 +207,9 @@ public:
     void SetMessage(int val)         { m_message = val; }
     void SetWParam(int val)          { m_wParam = val; }
     void SetLParam(int val)          { m_lParam = val; }
+    void SetListType(int val)        { m_listType = val; }
+    void SetX(int val)               { m_x = val; }
+    void SetY(int val)               { m_y = val; }
 
     int  GetPosition() const         { return m_position; }
     int  GetKey()  const             { return m_key; }
@@ -220,6 +225,9 @@ public:
     int  GetMessage() const          { return m_message; }
     int  GetWParam() const           { return m_wParam; }
     int  GetLParam() const           { return m_lParam; }
+    int  GetListType() const         { return m_listType; }
+    int  GetX() const                { return m_x; }
+    int  GetY() const                { return m_y; }
 
     bool GetShift() const;
     bool GetControl() const;
@@ -248,42 +256,56 @@ private:
     int  m_message;             // wxEVT_STC_MACRORECORD
     int  m_wParam;
     int  m_lParam;
+
+    int m_listType;
+    int m_x;
+    int m_y;
 #endif
 };
 
 #ifndef SWIG
 BEGIN_DECLARE_EVENT_TYPES()
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED, 1651)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED, 1652)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI, 1653)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED, 1654)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT, 1655)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT, 1656)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK, 1657)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED, 1658)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY, 1659)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD, 1660)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK, 1661)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN, 1662)
-    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED, 1663)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE,                  1650)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED,             1651)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED,               1652)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED,        1653)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT,           1654)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT,         1655)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY,                     1656)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK,             1657)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI,                1658)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED,                1659)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD,             1660)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK,             1661)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN,               1662)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED,              1663)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_PAINTED,                 1664)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_USERLISTSELECTION,       1665)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED,              1666)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART,              1667)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND,                1668)
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
         wxEVT_STC_CHANGE,
         wxEVT_STC_STYLENEEDED,
         wxEVT_STC_CHARADDED,
-        wxEVT_STC_UPDATEUI,
         wxEVT_STC_SAVEPOINTREACHED,
         wxEVT_STC_SAVEPOINTLEFT,
         wxEVT_STC_ROMODIFYATTEMPT,
+        wxEVT_STC_KEY,
         wxEVT_STC_DOUBLECLICK,
+        wxEVT_STC_UPDATEUI,
         wxEVT_STC_MODIFIED,
-        wxEVT_STC_KEY,
         wxEVT_STC_MACRORECORD,
         wxEVT_STC_MARGINCLICK,
         wxEVT_STC_NEEDSHOWN,
-        wxEVT_STC_POSCHANGED
+        wxEVT_STC_POSCHANGED,
+        wxEVT_STC_PAINTED,
+        wxEVT_STC_USERLISTSELECTION,
+        wxEVT_STC_URIDROPPED,
+        wxEVT_STC_DWELLSTART,
+        wxEVT_STC_DWELLEND,
     };
 #endif
 
@@ -292,20 +314,26 @@ END_DECLARE_EVENT_TYPES()
 #ifndef SWIG
 typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 
-#define EVT_STC_CHANGE(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_STYLENEEDED(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_CHARADDED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_UPDATEUI(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_SAVEPOINTLEFT(id, fn)    DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_ROMODIFYATTEMPT(id, fn)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_DOUBLECLICK(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MODIFIED(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_KEY(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MACRORECORD(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_MARGINCLICK(id, fn)      DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_NEEDSHOWN(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-#define EVT_STC_POSCHANGED(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_CHANGE(id, fn)                  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE,                id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_STYLENEEDED(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_CHARADDED(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTREACHED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED,      id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_SAVEPOINTLEFT(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT,         id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ROMODIFYATTEMPT(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT,       id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_KEY(id, fn)                     DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY,                   id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DOUBLECLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_UPDATEUI(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MODIFIED(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MACRORECORD(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_MARGINCLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK,           id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_NEEDSHOWN(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_POSCHANGED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_PAINTED(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED,               id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_USERLISTSELECTION(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION,     id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_URIDROPPED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DWELLSTART(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DWELLEND(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND,              id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+
 
 #endif
 
index 447d88fb8d0c8f3eb3fecf3f294ff67a08f838e2..6f56d251bc55f499de0ca1177b39fa2e92c32754 100644 (file)
@@ -28,7 +28,8 @@ resource.  The name of the new "constructor" is the original name of
 the class with a "Pre" in it.  For example, wxPreWindow, wxPreFrame,
 etc.
 
-
+Updated to version 1.39 of Scintilla and updated wxStyledTextCtrl
+accordingly.
 
 
 
index 49266313e55cce3fdc2b3d0ef647e87b64968bac..ebd8dec5b5222c3c71c11f7fb2306c3497258bdf 100644 (file)
@@ -870,6 +870,35 @@ static PyObject *_wrap_wxStyledTextCtrl_PositionFromPoint(PyObject *self, PyObje
     return _resultobj;
 }
 
+#define wxStyledTextCtrl_PositionFromPointClose(_swigobj,_swigarg0,_swigarg1)  (_swigobj->PositionFromPointClose(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_PositionFromPointClose(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    int  _arg2;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","x","y", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_PositionFromPointClose",_kwnames,&_argo0,&_arg1,&_arg2)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_PositionFromPointClose. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_PositionFromPointClose(_arg0,_arg1,_arg2);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
 #define wxStyledTextCtrl_GotoLine(_swigobj,_swigarg0)  (_swigobj->GotoLine(_swigarg0))
 static PyObject *_wrap_wxStyledTextCtrl_GotoLine(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -1023,15 +1052,16 @@ static PyObject *_wrap_wxStyledTextCtrl_GetEndStyled(PyObject *self, PyObject *a
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_ConvertEOLs(_swigobj)  (_swigobj->ConvertEOLs())
+#define wxStyledTextCtrl_ConvertEOLs(_swigobj,_swigarg0)  (_swigobj->ConvertEOLs(_swigarg0))
 static PyObject *_wrap_wxStyledTextCtrl_ConvertEOLs(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
+    int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self", NULL };
+    char *_kwnames[] = { "self","eolMode", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_ConvertEOLs",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_ConvertEOLs",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -1042,7 +1072,7 @@ static PyObject *_wrap_wxStyledTextCtrl_ConvertEOLs(PyObject *self, PyObject *ar
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_ConvertEOLs(_arg0);
+        wxStyledTextCtrl_ConvertEOLs(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -2155,6 +2185,35 @@ static PyObject *_wrap_wxStyledTextCtrl_StyleSetUnderline(PyObject *self, PyObje
     return _resultobj;
 }
 
+#define wxStyledTextCtrl_StyleSetCase(_swigobj,_swigarg0,_swigarg1)  (_swigobj->StyleSetCase(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_StyleSetCase(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    int  _arg2;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","style","caseForce", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_StyleSetCase",_kwnames,&_argo0,&_arg1,&_arg2)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_StyleSetCase. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_StyleSetCase(_arg0,_arg1,_arg2);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 #define wxStyledTextCtrl_SetSelForeground(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetSelForeground(_swigarg0,_swigarg1))
 static PyObject *_wrap_wxStyledTextCtrl_SetSelForeground(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -2834,6 +2893,127 @@ static PyObject *_wrap_wxStyledTextCtrl_GetMaxLineState(PyObject *self, PyObject
     return _resultobj;
 }
 
+#define wxStyledTextCtrl_GetCaretLineVisible(_swigobj)  (_swigobj->GetCaretLineVisible())
+static PyObject *_wrap_wxStyledTextCtrl_GetCaretLineVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetCaretLineVisible",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCaretLineVisible. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (bool )wxStyledTextCtrl_GetCaretLineVisible(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetCaretLineVisible(_swigobj,_swigarg0)  (_swigobj->SetCaretLineVisible(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetCaretLineVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    bool  _arg1;
+    PyObject * _argo0 = 0;
+    int tempbool1;
+    char *_kwnames[] = { "self","show", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetCaretLineVisible",_kwnames,&_argo0,&tempbool1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretLineVisible. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    _arg1 = (bool ) tempbool1;
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetCaretLineVisible(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetCaretLineBack(_swigobj)  (_swigobj->GetCaretLineBack())
+static PyObject *_wrap_wxStyledTextCtrl_GetCaretLineBack(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxColour * _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+    char _ptemp[128];
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetCaretLineBack",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCaretLineBack. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = new wxColour (wxStyledTextCtrl_GetCaretLineBack(_arg0));
+
+    wxPy_END_ALLOW_THREADS;
+}    SWIG_MakePtr(_ptemp, (void *) _result,"_wxColour_p");
+    _resultobj = Py_BuildValue("s",_ptemp);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetCaretLineBack(_swigobj,_swigarg0)  (_swigobj->SetCaretLineBack(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetCaretLineBack(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    wxColour * _arg1;
+    PyObject * _argo0 = 0;
+    wxColour  temp;
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","back", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetCaretLineBack",_kwnames,&_argo0,&_obj1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretLineBack. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    _arg1 = &temp;
+    if (! wxColour_helper(_obj1, &_arg1))
+        return NULL;
+}
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetCaretLineBack(_arg0,*_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 #define wxStyledTextCtrl_AutoCompShow(_swigobj,_swigarg0,_swigarg1)  (_swigobj->AutoCompShow(_swigarg0,_swigarg1))
 static PyObject *_wrap_wxStyledTextCtrl_AutoCompShow(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -3373,6 +3553,115 @@ static PyObject *_wrap_wxStyledTextCtrl_AutoCompGetIgnoreCase(PyObject *self, Py
     return _resultobj;
 }
 
+#define wxStyledTextCtrl_UserListShow(_swigobj,_swigarg0,_swigarg1)  (_swigobj->UserListShow(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_UserListShow(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    wxString * _arg2;
+    PyObject * _argo0 = 0;
+    PyObject * _obj2 = 0;
+    char *_kwnames[] = { "self","listType","itemList", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_UserListShow",_kwnames,&_argo0,&_arg1,&_obj2)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_UserListShow. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+#if PYTHON_API_VERSION >= 1009
+    char* tmpPtr; int tmpSize;
+    if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
+        return NULL;
+    _arg2 = new wxString(tmpPtr, tmpSize);
+#else
+    if (!PyString_Check(_obj2)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
+#endif
+}
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_UserListShow(_arg0,_arg1,*_arg2);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+{
+    if (_obj2)
+        delete _arg2;
+}
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_AutoCompSetAutoHide(_swigobj,_swigarg0)  (_swigobj->AutoCompSetAutoHide(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_AutoCompSetAutoHide(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    bool  _arg1;
+    PyObject * _argo0 = 0;
+    int tempbool1;
+    char *_kwnames[] = { "self","autoHide", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_AutoCompSetAutoHide",_kwnames,&_argo0,&tempbool1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompSetAutoHide. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    _arg1 = (bool ) tempbool1;
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_AutoCompSetAutoHide(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_AutoCompGetAutoHide(_swigobj)  (_swigobj->AutoCompGetAutoHide())
+static PyObject *_wrap_wxStyledTextCtrl_AutoCompGetAutoHide(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_AutoCompGetAutoHide",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AutoCompGetAutoHide. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (bool )wxStyledTextCtrl_AutoCompGetAutoHide(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
 #define wxStyledTextCtrl_SetIndent(_swigobj,_swigarg0)  (_swigobj->SetIndent(_swigarg0))
 static PyObject *_wrap_wxStyledTextCtrl_SetIndent(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -4344,7 +4633,7 @@ static PyObject *_wrap_wxStyledTextCtrl_SetMarginLeft(PyObject *self, PyObject *
     wxStyledTextCtrl * _arg0;
     int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","width", NULL };
+    char *_kwnames[] = { "self","pixelWidth", NULL };
 
     self = self;
     if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetMarginLeft",_kwnames,&_argo0,&_arg1)) 
@@ -4399,7 +4688,7 @@ static PyObject *_wrap_wxStyledTextCtrl_SetMarginRight(PyObject *self, PyObject
     wxStyledTextCtrl * _arg0;
     int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","width", NULL };
+    char *_kwnames[] = { "self","pixelWidth", NULL };
 
     self = self;
     if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetMarginRight",_kwnames,&_argo0,&_arg1)) 
@@ -5176,114 +5465,91 @@ static PyObject *_wrap_wxStyledTextCtrl_GetOvertype(PyObject *self, PyObject *ar
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_CallTipShow(_swigobj,_swigarg0,_swigarg1)  (_swigobj->CallTipShow(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_CallTipShow(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetCaretWidth(_swigobj,_swigarg0)  (_swigobj->SetCaretWidth(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetCaretWidth(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
-    wxString * _arg2;
     PyObject * _argo0 = 0;
-    PyObject * _obj2 = 0;
-    char *_kwnames[] = { "self","pos","definition", NULL };
+    char *_kwnames[] = { "self","pixelWidth", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_CallTipShow",_kwnames,&_argo0,&_arg1,&_obj2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetCaretWidth",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipShow. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretWidth. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
-{
-#if PYTHON_API_VERSION >= 1009
-    char* tmpPtr; int tmpSize;
-    if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
-        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
-        return NULL;
-    }
-    if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
-        return NULL;
-    _arg2 = new wxString(tmpPtr, tmpSize);
-#else
-    if (!PyString_Check(_obj2)) {
-        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
-        return NULL;
-    }
-    _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
-#endif
-}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_CallTipShow(_arg0,_arg1,*_arg2);
+        wxStyledTextCtrl_SetCaretWidth(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
     _resultobj = Py_None;
-{
-    if (_obj2)
-        delete _arg2;
-}
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_CallTipCancel(_swigobj)  (_swigobj->CallTipCancel())
-static PyObject *_wrap_wxStyledTextCtrl_CallTipCancel(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetCaretWidth(_swigobj)  (_swigobj->GetCaretWidth())
+static PyObject *_wrap_wxStyledTextCtrl_GetCaretWidth(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    int  _result;
     wxStyledTextCtrl * _arg0;
     PyObject * _argo0 = 0;
     char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipCancel",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetCaretWidth",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipCancel. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCaretWidth. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_CallTipCancel(_arg0);
+        _result = (int )wxStyledTextCtrl_GetCaretWidth(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_CallTipActive(_swigobj)  (_swigobj->CallTipActive())
-static PyObject *_wrap_wxStyledTextCtrl_CallTipActive(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetTargetStart(_swigobj,_swigarg0)  (_swigobj->SetTargetStart(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetTargetStart(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    bool  _result;
     wxStyledTextCtrl * _arg0;
+    int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self", NULL };
+    char *_kwnames[] = { "self","pos", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipActive",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetTargetStart",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipActive. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetTargetStart. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (bool )wxStyledTextCtrl_CallTipActive(_arg0);
+        wxStyledTextCtrl_SetTargetStart(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_CallTipPosAtStart(_swigobj)  (_swigobj->CallTipPosAtStart())
-static PyObject *_wrap_wxStyledTextCtrl_CallTipPosAtStart(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetTargetStart(_swigobj)  (_swigobj->GetTargetStart())
+static PyObject *_wrap_wxStyledTextCtrl_GetTargetStart(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     int  _result;
     wxStyledTextCtrl * _arg0;
@@ -5291,46 +5557,45 @@ static PyObject *_wrap_wxStyledTextCtrl_CallTipPosAtStart(PyObject *self, PyObje
     char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipPosAtStart",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetTargetStart",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipPosAtStart. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetTargetStart. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_CallTipPosAtStart(_arg0);
+        _result = (int )wxStyledTextCtrl_GetTargetStart(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_CallTipSetHighlight(_swigobj,_swigarg0,_swigarg1)  (_swigobj->CallTipSetHighlight(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_CallTipSetHighlight(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetTargetEnd(_swigobj,_swigarg0)  (_swigobj->SetTargetEnd(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetTargetEnd(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
-    int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","start","end", NULL };
+    char *_kwnames[] = { "self","pos", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_CallTipSetHighlight",_kwnames,&_argo0,&_arg1,&_arg2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetTargetEnd",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipSetHighlight. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetTargetEnd. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_CallTipSetHighlight(_arg0,_arg1,_arg2);
+        wxStyledTextCtrl_SetTargetEnd(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -5338,233 +5603,313 @@ static PyObject *_wrap_wxStyledTextCtrl_CallTipSetHighlight(PyObject *self, PyOb
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_CallTipSetBackground(_swigobj,_swigarg0)  (_swigobj->CallTipSetBackground(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_CallTipSetBackground(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetTargetEnd(_swigobj)  (_swigobj->GetTargetEnd())
+static PyObject *_wrap_wxStyledTextCtrl_GetTargetEnd(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    int  _result;
     wxStyledTextCtrl * _arg0;
-    wxColour * _arg1;
     PyObject * _argo0 = 0;
-    wxColour  temp;
-    PyObject * _obj1 = 0;
-    char *_kwnames[] = { "self","back", NULL };
+    char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_CallTipSetBackground",_kwnames,&_argo0,&_obj1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetTargetEnd",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipSetBackground. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetTargetEnd. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
-{
-    _arg1 = &temp;
-    if (! wxColour_helper(_obj1, &_arg1))
-        return NULL;
-}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_CallTipSetBackground(_arg0,*_arg1);
+        _result = (int )wxStyledTextCtrl_GetTargetEnd(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_VisibleFromDocLine(_swigobj,_swigarg0)  (_swigobj->VisibleFromDocLine(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_VisibleFromDocLine(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_ReplaceTarget(_swigobj,_swigarg0)  (_swigobj->ReplaceTarget(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_ReplaceTarget(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     int  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
+    wxString * _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","line", NULL };
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","text", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_VisibleFromDocLine",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_ReplaceTarget",_kwnames,&_argo0,&_obj1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_VisibleFromDocLine. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ReplaceTarget. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
+{
+#if PYTHON_API_VERSION >= 1009
+    char* tmpPtr; int tmpSize;
+    if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
+        return NULL;
+    _arg1 = new wxString(tmpPtr, tmpSize);
+#else
+    if (!PyString_Check(_obj1)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
+#endif
+}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_VisibleFromDocLine(_arg0,_arg1);
+        _result = (int )wxStyledTextCtrl_ReplaceTarget(_arg0,*_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
+{
+    if (_obj1)
+        delete _arg1;
+}
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_DocLineFromVisible(_swigobj,_swigarg0)  (_swigobj->DocLineFromVisible(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_DocLineFromVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_ReplaceTargetRE(_swigobj,_swigarg0)  (_swigobj->ReplaceTargetRE(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_ReplaceTargetRE(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     int  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
+    wxString * _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","lineDisplay", NULL };
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","text", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_DocLineFromVisible",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_ReplaceTargetRE",_kwnames,&_argo0,&_obj1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_DocLineFromVisible. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ReplaceTargetRE. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
+{
+#if PYTHON_API_VERSION >= 1009
+    char* tmpPtr; int tmpSize;
+    if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
+        return NULL;
+    _arg1 = new wxString(tmpPtr, tmpSize);
+#else
+    if (!PyString_Check(_obj1)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
+#endif
+}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_DocLineFromVisible(_arg0,_arg1);
+        _result = (int )wxStyledTextCtrl_ReplaceTargetRE(_arg0,*_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
+{
+    if (_obj1)
+        delete _arg1;
+}
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetFoldLevel(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetFoldLevel(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_SetFoldLevel(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SearchInTarget(_swigobj,_swigarg0)  (_swigobj->SearchInTarget(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SearchInTarget(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    int  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
-    int  _arg2;
+    wxString * _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","line","level", NULL };
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","text", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetFoldLevel",_kwnames,&_argo0,&_arg1,&_arg2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SearchInTarget",_kwnames,&_argo0,&_obj1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldLevel. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchInTarget. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
+{
+#if PYTHON_API_VERSION >= 1009
+    char* tmpPtr; int tmpSize;
+    if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
+        return NULL;
+    _arg1 = new wxString(tmpPtr, tmpSize);
+#else
+    if (!PyString_Check(_obj1)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
+#endif
+}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetFoldLevel(_arg0,_arg1,_arg2);
+        _result = (int )wxStyledTextCtrl_SearchInTarget(_arg0,*_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
+{
+    if (_obj1)
+        delete _arg1;
+}
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetFoldLevel(_swigobj,_swigarg0)  (_swigobj->GetFoldLevel(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_GetFoldLevel(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetSearchFlags(_swigobj,_swigarg0)  (_swigobj->SetSearchFlags(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetSearchFlags(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    int  _result;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","line", NULL };
+    char *_kwnames[] = { "self","flags", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldLevel",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetSearchFlags",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldLevel. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetSearchFlags. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_GetFoldLevel(_arg0,_arg1);
+        wxStyledTextCtrl_SetSearchFlags(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetLastChild(_swigobj,_swigarg0,_swigarg1)  (_swigobj->GetLastChild(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_GetLastChild(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetSearchFlags(_swigobj)  (_swigobj->GetSearchFlags())
+static PyObject *_wrap_wxStyledTextCtrl_GetSearchFlags(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     int  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
-    int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","line","level", NULL };
+    char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_GetLastChild",_kwnames,&_argo0,&_arg1,&_arg2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetSearchFlags",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLastChild. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetSearchFlags. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_GetLastChild(_arg0,_arg1,_arg2);
+        _result = (int )wxStyledTextCtrl_GetSearchFlags(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetFoldParent(_swigobj,_swigarg0)  (_swigobj->GetFoldParent(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_GetFoldParent(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_CallTipShow(_swigobj,_swigarg0,_swigarg1)  (_swigobj->CallTipShow(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_CallTipShow(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    int  _result;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
+    wxString * _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","line", NULL };
+    PyObject * _obj2 = 0;
+    char *_kwnames[] = { "self","pos","definition", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldParent",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_CallTipShow",_kwnames,&_argo0,&_arg1,&_obj2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldParent. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipShow. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
+{
+#if PYTHON_API_VERSION >= 1009
+    char* tmpPtr; int tmpSize;
+    if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
+        return NULL;
+    _arg2 = new wxString(tmpPtr, tmpSize);
+#else
+    if (!PyString_Check(_obj2)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
+#endif
+}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_GetFoldParent(_arg0,_arg1);
+        wxStyledTextCtrl_CallTipShow(_arg0,_arg1,*_arg2);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+{
+    if (_obj2)
+        delete _arg2;
+}
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_ShowLines(_swigobj,_swigarg0,_swigarg1)  (_swigobj->ShowLines(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_ShowLines(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_CallTipCancel(_swigobj)  (_swigobj->CallTipCancel())
+static PyObject *_wrap_wxStyledTextCtrl_CallTipCancel(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
-    int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","lineStart","lineEnd", NULL };
+    char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_ShowLines",_kwnames,&_argo0,&_arg1,&_arg2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipCancel",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ShowLines. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipCancel. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_ShowLines(_arg0,_arg1,_arg2);
+        wxStyledTextCtrl_CallTipCancel(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -5572,87 +5917,82 @@ static PyObject *_wrap_wxStyledTextCtrl_ShowLines(PyObject *self, PyObject *args
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_HideLines(_swigobj,_swigarg0,_swigarg1)  (_swigobj->HideLines(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_HideLines(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_CallTipActive(_swigobj)  (_swigobj->CallTipActive())
+static PyObject *_wrap_wxStyledTextCtrl_CallTipActive(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    bool  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
-    int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","lineStart","lineEnd", NULL };
+    char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_HideLines",_kwnames,&_argo0,&_arg1,&_arg2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipActive",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_HideLines. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipActive. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_HideLines(_arg0,_arg1,_arg2);
+        _result = (bool )wxStyledTextCtrl_CallTipActive(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetLineVisible(_swigobj,_swigarg0)  (_swigobj->GetLineVisible(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_GetLineVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_CallTipPosAtStart(_swigobj)  (_swigobj->CallTipPosAtStart())
+static PyObject *_wrap_wxStyledTextCtrl_CallTipPosAtStart(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    bool  _result;
+    int  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","line", NULL };
+    char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineVisible",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CallTipPosAtStart",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineVisible. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipPosAtStart. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (bool )wxStyledTextCtrl_GetLineVisible(_arg0,_arg1);
+        _result = (int )wxStyledTextCtrl_CallTipPosAtStart(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetFoldExpanded(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetFoldExpanded(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_SetFoldExpanded(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_CallTipSetHighlight(_swigobj,_swigarg0,_swigarg1)  (_swigobj->CallTipSetHighlight(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_CallTipSetHighlight(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
-    bool  _arg2;
+    int  _arg2;
     PyObject * _argo0 = 0;
-    int tempbool2;
-    char *_kwnames[] = { "self","line","expanded", NULL };
+    char *_kwnames[] = { "self","start","end", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetFoldExpanded",_kwnames,&_argo0,&_arg1,&tempbool2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_CallTipSetHighlight",_kwnames,&_argo0,&_arg1,&_arg2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldExpanded. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipSetHighlight. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
-    _arg2 = (bool ) tempbool2;
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetFoldExpanded(_arg0,_arg1,_arg2);
+        wxStyledTextCtrl_CallTipSetHighlight(_arg0,_arg1,_arg2);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -5660,111 +6000,119 @@ static PyObject *_wrap_wxStyledTextCtrl_SetFoldExpanded(PyObject *self, PyObject
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetFoldExpanded(_swigobj,_swigarg0)  (_swigobj->GetFoldExpanded(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_GetFoldExpanded(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_CallTipSetBackground(_swigobj,_swigarg0)  (_swigobj->CallTipSetBackground(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_CallTipSetBackground(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    bool  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
+    wxColour * _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","line", NULL };
+    wxColour  temp;
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","back", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldExpanded",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_CallTipSetBackground",_kwnames,&_argo0,&_obj1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldExpanded. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CallTipSetBackground. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
+{
+    _arg1 = &temp;
+    if (! wxColour_helper(_obj1, &_arg1))
+        return NULL;
+}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (bool )wxStyledTextCtrl_GetFoldExpanded(_arg0,_arg1);
+        wxStyledTextCtrl_CallTipSetBackground(_arg0,*_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_ToggleFold(_swigobj,_swigarg0)  (_swigobj->ToggleFold(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_ToggleFold(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_VisibleFromDocLine(_swigobj,_swigarg0)  (_swigobj->VisibleFromDocLine(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_VisibleFromDocLine(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    int  _result;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
     PyObject * _argo0 = 0;
     char *_kwnames[] = { "self","line", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_ToggleFold",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_VisibleFromDocLine",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ToggleFold. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_VisibleFromDocLine. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_ToggleFold(_arg0,_arg1);
+        _result = (int )wxStyledTextCtrl_VisibleFromDocLine(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_EnsureVisible(_swigobj,_swigarg0)  (_swigobj->EnsureVisible(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_EnsureVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_DocLineFromVisible(_swigobj,_swigarg0)  (_swigobj->DocLineFromVisible(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_DocLineFromVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    int  _result;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","line", NULL };
+    char *_kwnames[] = { "self","lineDisplay", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_EnsureVisible",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_DocLineFromVisible",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_EnsureVisible. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_DocLineFromVisible. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_EnsureVisible(_arg0,_arg1);
+        _result = (int )wxStyledTextCtrl_DocLineFromVisible(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetFoldFlags(_swigobj,_swigarg0)  (_swigobj->SetFoldFlags(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_SetFoldFlags(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetFoldLevel(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetFoldLevel(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetFoldLevel(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
+    int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","flags", NULL };
+    char *_kwnames[] = { "self","line","level", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetFoldFlags",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetFoldLevel",_kwnames,&_argo0,&_arg1,&_arg2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldFlags. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldLevel. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetFoldFlags(_arg0,_arg1);
+        wxStyledTextCtrl_SetFoldLevel(_arg0,_arg1,_arg2);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -5772,8 +6120,8 @@ static PyObject *_wrap_wxStyledTextCtrl_SetFoldFlags(PyObject *self, PyObject *a
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_LineLength(_swigobj,_swigarg0)  (_swigobj->LineLength(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_LineLength(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetFoldLevel(_swigobj,_swigarg0)  (_swigobj->GetFoldLevel(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_GetFoldLevel(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     int  _result;
     wxStyledTextCtrl * _arg0;
@@ -5782,312 +6130,1374 @@ static PyObject *_wrap_wxStyledTextCtrl_LineLength(PyObject *self, PyObject *arg
     char *_kwnames[] = { "self","line", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_LineLength",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldLevel",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_LineLength. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldLevel. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_LineLength(_arg0,_arg1);
+        _result = (int )wxStyledTextCtrl_GetFoldLevel(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_BraceHighlight(_swigobj,_swigarg0,_swigarg1)  (_swigobj->BraceHighlight(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_BraceHighlight(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetLastChild(_swigobj,_swigarg0,_swigarg1)  (_swigobj->GetLastChild(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_GetLastChild(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    int  _result;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
     int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","pos1","pos2", NULL };
+    char *_kwnames[] = { "self","line","level", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_BraceHighlight",_kwnames,&_argo0,&_arg1,&_arg2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_GetLastChild",_kwnames,&_argo0,&_arg1,&_arg2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceHighlight. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLastChild. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_BraceHighlight(_arg0,_arg1,_arg2);
+        _result = (int )wxStyledTextCtrl_GetLastChild(_arg0,_arg1,_arg2);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_BraceBadLight(_swigobj,_swigarg0)  (_swigobj->BraceBadLight(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_BraceBadLight(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetFoldParent(_swigobj,_swigarg0)  (_swigobj->GetFoldParent(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_GetFoldParent(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    int  _result;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","pos", NULL };
+    char *_kwnames[] = { "self","line", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_BraceBadLight",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldParent",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceBadLight. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldParent. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_BraceBadLight(_arg0,_arg1);
+        _result = (int )wxStyledTextCtrl_GetFoldParent(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_BraceMatch(_swigobj,_swigarg0)  (_swigobj->BraceMatch(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_BraceMatch(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_ShowLines(_swigobj,_swigarg0,_swigarg1)  (_swigobj->ShowLines(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_ShowLines(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    int  _result;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
+    int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","pos", NULL };
+    char *_kwnames[] = { "self","lineStart","lineEnd", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_BraceMatch",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_ShowLines",_kwnames,&_argo0,&_arg1,&_arg2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceMatch. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ShowLines. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_BraceMatch(_arg0,_arg1);
+        wxStyledTextCtrl_ShowLines(_arg0,_arg1,_arg2);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetViewEOL(_swigobj)  (_swigobj->GetViewEOL())
-static PyObject *_wrap_wxStyledTextCtrl_GetViewEOL(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_HideLines(_swigobj,_swigarg0,_swigarg1)  (_swigobj->HideLines(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_HideLines(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    bool  _result;
     wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self", NULL };
+    char *_kwnames[] = { "self","lineStart","lineEnd", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetViewEOL",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_HideLines",_kwnames,&_argo0,&_arg1,&_arg2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetViewEOL. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_HideLines. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (bool )wxStyledTextCtrl_GetViewEOL(_arg0);
+        wxStyledTextCtrl_HideLines(_arg0,_arg1,_arg2);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetViewEOL(_swigobj,_swigarg0)  (_swigobj->SetViewEOL(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_SetViewEOL(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetLineVisible(_swigobj,_swigarg0)  (_swigobj->GetLineVisible(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_GetLineVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    bool  _result;
     wxStyledTextCtrl * _arg0;
-    bool  _arg1;
+    int  _arg1;
     PyObject * _argo0 = 0;
-    int tempbool1;
-    char *_kwnames[] = { "self","visible", NULL };
+    char *_kwnames[] = { "self","line", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetViewEOL",_kwnames,&_argo0,&tempbool1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetLineVisible",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetViewEOL. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetLineVisible. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
-    _arg1 = (bool ) tempbool1;
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetViewEOL(_arg0,_arg1);
+        _result = (bool )wxStyledTextCtrl_GetLineVisible(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetDocPointer(_swigobj)  (_swigobj->GetDocPointer())
-static PyObject *_wrap_wxStyledTextCtrl_GetDocPointer(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetFoldExpanded(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetFoldExpanded(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetFoldExpanded(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    void * _result;
     wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    bool  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self", NULL };
-    char _ptemp[128];
+    int tempbool2;
+    char *_kwnames[] = { "self","line","expanded", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetDocPointer",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetFoldExpanded",_kwnames,&_argo0,&_arg1,&tempbool2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetDocPointer. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldExpanded. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
+    _arg2 = (bool ) tempbool2;
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (void *)wxStyledTextCtrl_GetDocPointer(_arg0);
+        wxStyledTextCtrl_SetFoldExpanded(_arg0,_arg1,_arg2);
 
     wxPy_END_ALLOW_THREADS;
-}    if (_result) {
-        SWIG_MakePtr(_ptemp, (char *) _result,"_void_p");
-        _resultobj = Py_BuildValue("s",_ptemp);
-    } else {
-        Py_INCREF(Py_None);
-        _resultobj = Py_None;
-    }
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetDocPointer(_swigobj,_swigarg0)  (_swigobj->SetDocPointer(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_SetDocPointer(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetFoldExpanded(_swigobj,_swigarg0)  (_swigobj->GetFoldExpanded(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_GetFoldExpanded(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    bool  _result;
     wxStyledTextCtrl * _arg0;
-    void * _arg1;
+    int  _arg1;
     PyObject * _argo0 = 0;
-    PyObject * _argo1 = 0;
-    char *_kwnames[] = { "self","docPointer", NULL };
+    char *_kwnames[] = { "self","line", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetDocPointer",_kwnames,&_argo0,&_argo1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_GetFoldExpanded",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetDocPointer. Expected _wxStyledTextCtrl_p.");
-        return NULL;
-        }
-    }
-    if (_argo1) {
-        if (_argo1 == Py_None) { _arg1 = NULL; }
-        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxStyledTextCtrl_SetDocPointer. Expected _void_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFoldExpanded. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetDocPointer(_arg0,_arg1);
+        _result = (bool )wxStyledTextCtrl_GetFoldExpanded(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetModEventMask(_swigobj,_swigarg0)  (_swigobj->SetModEventMask(_swigarg0))
+#define wxStyledTextCtrl_ToggleFold(_swigobj,_swigarg0)  (_swigobj->ToggleFold(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_ToggleFold(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","line", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_ToggleFold",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ToggleFold. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_ToggleFold(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_EnsureVisible(_swigobj,_swigarg0)  (_swigobj->EnsureVisible(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_EnsureVisible(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","line", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_EnsureVisible",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_EnsureVisible. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_EnsureVisible(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetFoldFlags(_swigobj,_swigarg0)  (_swigobj->SetFoldFlags(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetFoldFlags(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","flags", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetFoldFlags",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFoldFlags. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetFoldFlags(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_EnsureVisibleEnforcePolicy(_swigobj,_swigarg0)  (_swigobj->EnsureVisibleEnforcePolicy(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_EnsureVisibleEnforcePolicy(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","line", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_EnsureVisibleEnforcePolicy",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_EnsureVisibleEnforcePolicy. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_EnsureVisibleEnforcePolicy(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetTabIndents(_swigobj,_swigarg0)  (_swigobj->SetTabIndents(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetTabIndents(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    bool  _arg1;
+    PyObject * _argo0 = 0;
+    int tempbool1;
+    char *_kwnames[] = { "self","tabIndents", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetTabIndents",_kwnames,&_argo0,&tempbool1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetTabIndents. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    _arg1 = (bool ) tempbool1;
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetTabIndents(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetTabIndents(_swigobj)  (_swigobj->GetTabIndents())
+static PyObject *_wrap_wxStyledTextCtrl_GetTabIndents(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetTabIndents",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetTabIndents. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (bool )wxStyledTextCtrl_GetTabIndents(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetBackSpaceUnIndents(_swigobj,_swigarg0)  (_swigobj->SetBackSpaceUnIndents(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetBackSpaceUnIndents(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    bool  _arg1;
+    PyObject * _argo0 = 0;
+    int tempbool1;
+    char *_kwnames[] = { "self","bsUnIndents", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetBackSpaceUnIndents",_kwnames,&_argo0,&tempbool1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetBackSpaceUnIndents. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    _arg1 = (bool ) tempbool1;
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetBackSpaceUnIndents(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetBackSpaceUnIndents(_swigobj)  (_swigobj->GetBackSpaceUnIndents())
+static PyObject *_wrap_wxStyledTextCtrl_GetBackSpaceUnIndents(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetBackSpaceUnIndents",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetBackSpaceUnIndents. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (bool )wxStyledTextCtrl_GetBackSpaceUnIndents(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetMouseDwellTime(_swigobj,_swigarg0)  (_swigobj->SetMouseDwellTime(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetMouseDwellTime(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","periodMilliseconds", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetMouseDwellTime",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetMouseDwellTime. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetMouseDwellTime(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetMouseDwellTime(_swigobj)  (_swigobj->GetMouseDwellTime())
+static PyObject *_wrap_wxStyledTextCtrl_GetMouseDwellTime(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetMouseDwellTime",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetMouseDwellTime. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_GetMouseDwellTime(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_MoveCaretInsideView(_swigobj)  (_swigobj->MoveCaretInsideView())
+static PyObject *_wrap_wxStyledTextCtrl_MoveCaretInsideView(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_MoveCaretInsideView",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_MoveCaretInsideView. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_MoveCaretInsideView(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_LineLength(_swigobj,_swigarg0)  (_swigobj->LineLength(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_LineLength(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","line", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_LineLength",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_LineLength. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_LineLength(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_BraceHighlight(_swigobj,_swigarg0,_swigarg1)  (_swigobj->BraceHighlight(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_BraceHighlight(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    int  _arg2;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","pos1","pos2", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_BraceHighlight",_kwnames,&_argo0,&_arg1,&_arg2)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceHighlight. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_BraceHighlight(_arg0,_arg1,_arg2);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_BraceBadLight(_swigobj,_swigarg0)  (_swigobj->BraceBadLight(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_BraceBadLight(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","pos", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_BraceBadLight",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceBadLight. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_BraceBadLight(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_BraceMatch(_swigobj,_swigarg0)  (_swigobj->BraceMatch(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_BraceMatch(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","pos", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_BraceMatch",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_BraceMatch. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_BraceMatch(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetViewEOL(_swigobj)  (_swigobj->GetViewEOL())
+static PyObject *_wrap_wxStyledTextCtrl_GetViewEOL(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetViewEOL",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetViewEOL. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (bool )wxStyledTextCtrl_GetViewEOL(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetViewEOL(_swigobj,_swigarg0)  (_swigobj->SetViewEOL(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetViewEOL(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    bool  _arg1;
+    PyObject * _argo0 = 0;
+    int tempbool1;
+    char *_kwnames[] = { "self","visible", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetViewEOL",_kwnames,&_argo0,&tempbool1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetViewEOL. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    _arg1 = (bool ) tempbool1;
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetViewEOL(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetDocPointer(_swigobj)  (_swigobj->GetDocPointer())
+static PyObject *_wrap_wxStyledTextCtrl_GetDocPointer(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    void * _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+    char _ptemp[128];
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetDocPointer",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetDocPointer. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (void *)wxStyledTextCtrl_GetDocPointer(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    if (_result) {
+        SWIG_MakePtr(_ptemp, (char *) _result,"_void_p");
+        _resultobj = Py_BuildValue("s",_ptemp);
+    } else {
+        Py_INCREF(Py_None);
+        _resultobj = Py_None;
+    }
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetDocPointer(_swigobj,_swigarg0)  (_swigobj->SetDocPointer(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetDocPointer(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    void * _arg1;
+    PyObject * _argo0 = 0;
+    PyObject * _argo1 = 0;
+    char *_kwnames[] = { "self","docPointer", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetDocPointer",_kwnames,&_argo0,&_argo1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetDocPointer. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    if (_argo1) {
+        if (_argo1 == Py_None) { _arg1 = NULL; }
+        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxStyledTextCtrl_SetDocPointer. Expected _void_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetDocPointer(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetModEventMask(_swigobj,_swigarg0)  (_swigobj->SetModEventMask(_swigarg0))
 static PyObject *_wrap_wxStyledTextCtrl_SetModEventMask(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","mask", NULL };
+    char *_kwnames[] = { "self","mask", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetModEventMask",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetModEventMask. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetModEventMask(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetEdgeColumn(_swigobj)  (_swigobj->GetEdgeColumn())
+static PyObject *_wrap_wxStyledTextCtrl_GetEdgeColumn(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeColumn",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeColumn. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_GetEdgeColumn(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetEdgeColumn(_swigobj,_swigarg0)  (_swigobj->SetEdgeColumn(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetEdgeColumn(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","column", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEdgeColumn",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeColumn. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetEdgeColumn(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetEdgeMode(_swigobj)  (_swigobj->GetEdgeMode())
+static PyObject *_wrap_wxStyledTextCtrl_GetEdgeMode(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeMode",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeMode. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_GetEdgeMode(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetEdgeMode(_swigobj,_swigarg0)  (_swigobj->SetEdgeMode(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetEdgeMode(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","mode", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEdgeMode",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeMode. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetEdgeMode(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetEdgeColour(_swigobj)  (_swigobj->GetEdgeColour())
+static PyObject *_wrap_wxStyledTextCtrl_GetEdgeColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxColour * _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+    char _ptemp[128];
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeColour",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeColour. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = new wxColour (wxStyledTextCtrl_GetEdgeColour(_arg0));
+
+    wxPy_END_ALLOW_THREADS;
+}    SWIG_MakePtr(_ptemp, (void *) _result,"_wxColour_p");
+    _resultobj = Py_BuildValue("s",_ptemp);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetEdgeColour(_swigobj,_swigarg0)  (_swigobj->SetEdgeColour(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetEdgeColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    wxColour * _arg1;
+    PyObject * _argo0 = 0;
+    wxColour  temp;
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","edgeColour", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetEdgeColour",_kwnames,&_argo0,&_obj1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeColour. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    _arg1 = &temp;
+    if (! wxColour_helper(_obj1, &_arg1))
+        return NULL;
+}
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetEdgeColour(_arg0,*_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SearchAnchor(_swigobj)  (_swigobj->SearchAnchor())
+static PyObject *_wrap_wxStyledTextCtrl_SearchAnchor(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_SearchAnchor",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchAnchor. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SearchAnchor(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SearchNext(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SearchNext(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SearchNext(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    wxString * _arg2;
+    PyObject * _argo0 = 0;
+    PyObject * _obj2 = 0;
+    char *_kwnames[] = { "self","flags","text", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_SearchNext",_kwnames,&_argo0,&_arg1,&_obj2)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchNext. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+#if PYTHON_API_VERSION >= 1009
+    char* tmpPtr; int tmpSize;
+    if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
+        return NULL;
+    _arg2 = new wxString(tmpPtr, tmpSize);
+#else
+    if (!PyString_Check(_obj2)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
+#endif
+}
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_SearchNext(_arg0,_arg1,*_arg2);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+{
+    if (_obj2)
+        delete _arg2;
+}
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SearchPrev(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SearchPrev(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SearchPrev(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    wxString * _arg2;
+    PyObject * _argo0 = 0;
+    PyObject * _obj2 = 0;
+    char *_kwnames[] = { "self","flags","text", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetModEventMask",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_SearchPrev",_kwnames,&_argo0,&_arg1,&_obj2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetModEventMask. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchPrev. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+#if PYTHON_API_VERSION >= 1009
+    char* tmpPtr; int tmpSize;
+    if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
+        return NULL;
+    _arg2 = new wxString(tmpPtr, tmpSize);
+#else
+    if (!PyString_Check(_obj2)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
+#endif
+}
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_SearchPrev(_arg0,_arg1,*_arg2);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+{
+    if (_obj2)
+        delete _arg2;
+}
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetCaretPolicy(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetCaretPolicy(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetCaretPolicy(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    int  _arg2;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","caretPolicy","caretSlop", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetCaretPolicy",_kwnames,&_argo0,&_arg1,&_arg2)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretPolicy. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetCaretPolicy(_arg0,_arg1,_arg2);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_LinesOnScreen(_swigobj)  (_swigobj->LinesOnScreen())
+static PyObject *_wrap_wxStyledTextCtrl_LinesOnScreen(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_LinesOnScreen",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_LinesOnScreen. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_LinesOnScreen(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_UsePopUp(_swigobj,_swigarg0)  (_swigobj->UsePopUp(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_UsePopUp(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    bool  _arg1;
+    PyObject * _argo0 = 0;
+    int tempbool1;
+    char *_kwnames[] = { "self","allowPopUp", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_UsePopUp",_kwnames,&_argo0,&tempbool1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_UsePopUp. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    _arg1 = (bool ) tempbool1;
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_UsePopUp(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SelectionIsRectangle(_swigobj)  (_swigobj->SelectionIsRectangle())
+static PyObject *_wrap_wxStyledTextCtrl_SelectionIsRectangle(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    bool  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_SelectionIsRectangle",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SelectionIsRectangle. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (bool )wxStyledTextCtrl_SelectionIsRectangle(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetZoom(_swigobj,_swigarg0)  (_swigobj->SetZoom(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetZoom(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","zoom", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetZoom",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetZoom. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetZoom(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetZoom(_swigobj)  (_swigobj->GetZoom())
+static PyObject *_wrap_wxStyledTextCtrl_GetZoom(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetZoom",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetZoom. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextCtrl_GetZoom(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_CreateDocument(_swigobj)  (_swigobj->CreateDocument())
+static PyObject *_wrap_wxStyledTextCtrl_CreateDocument(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    void * _result;
+    wxStyledTextCtrl * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+    char _ptemp[128];
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CreateDocument",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CreateDocument. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetModEventMask(_arg0,_arg1);
+        _result = (void *)wxStyledTextCtrl_CreateDocument(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    if (_result) {
+        SWIG_MakePtr(_ptemp, (char *) _result,"_void_p");
+        _resultobj = Py_BuildValue("s",_ptemp);
+    } else {
+        Py_INCREF(Py_None);
+        _resultobj = Py_None;
+    }
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetEdgeColumn(_swigobj)  (_swigobj->GetEdgeColumn())
-static PyObject *_wrap_wxStyledTextCtrl_GetEdgeColumn(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_AddRefDocument(_swigobj,_swigarg0)  (_swigobj->AddRefDocument(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_AddRefDocument(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    int  _result;
     wxStyledTextCtrl * _arg0;
+    void * _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self", NULL };
+    PyObject * _argo1 = 0;
+    char *_kwnames[] = { "self","docPointer", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeColumn",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_AddRefDocument",_kwnames,&_argo0,&_argo1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeColumn. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AddRefDocument. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    if (_argo1) {
+        if (_argo1 == Py_None) { _arg1 = NULL; }
+        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxStyledTextCtrl_AddRefDocument. Expected _void_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_GetEdgeColumn(_arg0);
+        wxStyledTextCtrl_AddRefDocument(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetEdgeColumn(_swigobj,_swigarg0)  (_swigobj->SetEdgeColumn(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_SetEdgeColumn(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_ReleaseDocument(_swigobj,_swigarg0)  (_swigobj->ReleaseDocument(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_ReleaseDocument(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
+    void * _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","column", NULL };
+    PyObject * _argo1 = 0;
+    char *_kwnames[] = { "self","docPointer", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEdgeColumn",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_ReleaseDocument",_kwnames,&_argo0,&_argo1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeColumn. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ReleaseDocument. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    if (_argo1) {
+        if (_argo1 == Py_None) { _arg1 = NULL; }
+        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxStyledTextCtrl_ReleaseDocument. Expected _void_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetEdgeColumn(_arg0,_arg1);
+        wxStyledTextCtrl_ReleaseDocument(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -6095,8 +7505,8 @@ static PyObject *_wrap_wxStyledTextCtrl_SetEdgeColumn(PyObject *self, PyObject *
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetEdgeMode(_swigobj)  (_swigobj->GetEdgeMode())
-static PyObject *_wrap_wxStyledTextCtrl_GetEdgeMode(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetModEventMask(_swigobj)  (_swigobj->GetModEventMask())
+static PyObject *_wrap_wxStyledTextCtrl_GetModEventMask(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     int  _result;
     wxStyledTextCtrl * _arg0;
@@ -6104,45 +7514,47 @@ static PyObject *_wrap_wxStyledTextCtrl_GetEdgeMode(PyObject *self, PyObject *ar
     char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeMode",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetModEventMask",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeMode. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetModEventMask. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_GetEdgeMode(_arg0);
+        _result = (int )wxStyledTextCtrl_GetModEventMask(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetEdgeMode(_swigobj,_swigarg0)  (_swigobj->SetEdgeMode(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_SetEdgeMode(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetFocus(_swigobj,_swigarg0)  (_swigobj->SetFocus(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetFocus(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
+    bool  _arg1;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","mode", NULL };
+    int tempbool1;
+    char *_kwnames[] = { "self","focus", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEdgeMode",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetFocus",_kwnames,&_argo0,&tempbool1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeMode. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetFocus. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
+    _arg1 = (bool ) tempbool1;
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetEdgeMode(_arg0,_arg1);
+        wxStyledTextCtrl_SetFocus(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -6150,63 +7562,54 @@ static PyObject *_wrap_wxStyledTextCtrl_SetEdgeMode(PyObject *self, PyObject *ar
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetEdgeColour(_swigobj)  (_swigobj->GetEdgeColour())
-static PyObject *_wrap_wxStyledTextCtrl_GetEdgeColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetFocus(_swigobj)  (_swigobj->GetFocus())
+static PyObject *_wrap_wxStyledTextCtrl_GetFocus(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    wxColour * _result;
+    bool  _result;
     wxStyledTextCtrl * _arg0;
     PyObject * _argo0 = 0;
     char *_kwnames[] = { "self", NULL };
-    char _ptemp[128];
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetEdgeColour",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetFocus",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetEdgeColour. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetFocus. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = new wxColour (wxStyledTextCtrl_GetEdgeColour(_arg0));
+        _result = (bool )wxStyledTextCtrl_GetFocus(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    SWIG_MakePtr(_ptemp, (void *) _result,"_wxColour_p");
-    _resultobj = Py_BuildValue("s",_ptemp);
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetEdgeColour(_swigobj,_swigarg0)  (_swigobj->SetEdgeColour(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_SetEdgeColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetStatus(_swigobj,_swigarg0)  (_swigobj->SetStatus(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetStatus(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
-    wxColour * _arg1;
+    int  _arg1;
     PyObject * _argo0 = 0;
-    wxColour  temp;
-    PyObject * _obj1 = 0;
-    char *_kwnames[] = { "self","edgeColour", NULL };
+    char *_kwnames[] = { "self","statusCode", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetEdgeColour",_kwnames,&_argo0,&_obj1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetStatus",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetEdgeColour. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetStatus. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
-{
-    _arg1 = &temp;
-    if (! wxColour_helper(_obj1, &_arg1))
-        return NULL;
-}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetEdgeColour(_arg0,*_arg1);
+        wxStyledTextCtrl_SetStatus(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -6214,159 +7617,111 @@ static PyObject *_wrap_wxStyledTextCtrl_SetEdgeColour(PyObject *self, PyObject *
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SearchAnchor(_swigobj)  (_swigobj->SearchAnchor())
-static PyObject *_wrap_wxStyledTextCtrl_SearchAnchor(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetStatus(_swigobj)  (_swigobj->GetStatus())
+static PyObject *_wrap_wxStyledTextCtrl_GetStatus(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
+    int  _result;
     wxStyledTextCtrl * _arg0;
     PyObject * _argo0 = 0;
     char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_SearchAnchor",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetStatus",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchAnchor. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetStatus. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SearchAnchor(_arg0);
+        _result = (int )wxStyledTextCtrl_GetStatus(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    Py_INCREF(Py_None);
-    _resultobj = Py_None;
+}    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SearchNext(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SearchNext(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_SearchNext(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetMouseDownCaptures(_swigobj,_swigarg0)  (_swigobj->SetMouseDownCaptures(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetMouseDownCaptures(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    int  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
-    wxString * _arg2;
+    bool  _arg1;
     PyObject * _argo0 = 0;
-    PyObject * _obj2 = 0;
-    char *_kwnames[] = { "self","flags","text", NULL };
+    int tempbool1;
+    char *_kwnames[] = { "self","captures", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_SearchNext",_kwnames,&_argo0,&_arg1,&_obj2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetMouseDownCaptures",_kwnames,&_argo0,&tempbool1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchNext. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetMouseDownCaptures. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
-{
-#if PYTHON_API_VERSION >= 1009
-    char* tmpPtr; int tmpSize;
-    if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
-        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
-        return NULL;
-    }
-    if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
-        return NULL;
-    _arg2 = new wxString(tmpPtr, tmpSize);
-#else
-    if (!PyString_Check(_obj2)) {
-        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
-        return NULL;
-    }
-    _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
-#endif
-}
+    _arg1 = (bool ) tempbool1;
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_SearchNext(_arg0,_arg1,*_arg2);
+        wxStyledTextCtrl_SetMouseDownCaptures(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
-{
-    if (_obj2)
-        delete _arg2;
-}
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SearchPrev(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SearchPrev(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_SearchPrev(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetMouseDownCaptures(_swigobj)  (_swigobj->GetMouseDownCaptures())
+static PyObject *_wrap_wxStyledTextCtrl_GetMouseDownCaptures(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    int  _result;
+    bool  _result;
     wxStyledTextCtrl * _arg0;
-    int  _arg1;
-    wxString * _arg2;
     PyObject * _argo0 = 0;
-    PyObject * _obj2 = 0;
-    char *_kwnames[] = { "self","flags","text", NULL };
+    char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_SearchPrev",_kwnames,&_argo0,&_arg1,&_obj2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetMouseDownCaptures",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SearchPrev. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetMouseDownCaptures. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
-{
-#if PYTHON_API_VERSION >= 1009
-    char* tmpPtr; int tmpSize;
-    if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
-        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
-        return NULL;
-    }
-    if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
-        return NULL;
-    _arg2 = new wxString(tmpPtr, tmpSize);
-#else
-    if (!PyString_Check(_obj2)) {
-        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
-        return NULL;
-    }
-    _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
-#endif
-}
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_SearchPrev(_arg0,_arg1,*_arg2);
+        _result = (bool )wxStyledTextCtrl_GetMouseDownCaptures(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
-{
-    if (_obj2)
-        delete _arg2;
-}
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SetCaretPolicy(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetCaretPolicy(_swigarg0,_swigarg1))
-static PyObject *_wrap_wxStyledTextCtrl_SetCaretPolicy(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetCursor(_swigobj,_swigarg0)  (_swigobj->SetCursor(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetCursor(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
     int  _arg1;
-    int  _arg2;
     PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","caretPolicy","caretSlop", NULL };
+    char *_kwnames[] = { "self","cursorType", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetCaretPolicy",_kwnames,&_argo0,&_arg1,&_arg2)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetCursor",_kwnames,&_argo0,&_arg1)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCaretPolicy. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetCursor. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetCaretPolicy(_arg0,_arg1,_arg2);
+        wxStyledTextCtrl_SetCursor(_arg0,_arg1);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -6374,8 +7729,8 @@ static PyObject *_wrap_wxStyledTextCtrl_SetCaretPolicy(PyObject *self, PyObject
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_LinesOnScreen(_swigobj)  (_swigobj->LinesOnScreen())
-static PyObject *_wrap_wxStyledTextCtrl_LinesOnScreen(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_GetCursor(_swigobj)  (_swigobj->GetCursor())
+static PyObject *_wrap_wxStyledTextCtrl_GetCursor(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     int  _result;
     wxStyledTextCtrl * _arg0;
@@ -6383,47 +7738,44 @@ static PyObject *_wrap_wxStyledTextCtrl_LinesOnScreen(PyObject *self, PyObject *
     char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_LinesOnScreen",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetCursor",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_LinesOnScreen. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetCursor. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_LinesOnScreen(_arg0);
+        _result = (int )wxStyledTextCtrl_GetCursor(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    _resultobj = Py_BuildValue("i",_result);
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_UsePopUp(_swigobj,_swigarg0)  (_swigobj->UsePopUp(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_UsePopUp(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_WordPartLeft(_swigobj)  (_swigobj->WordPartLeft())
+static PyObject *_wrap_wxStyledTextCtrl_WordPartLeft(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
-    bool  _arg1;
     PyObject * _argo0 = 0;
-    int tempbool1;
-    char *_kwnames[] = { "self","allowPopUp", NULL };
+    char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_UsePopUp",_kwnames,&_argo0,&tempbool1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_WordPartLeft",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_UsePopUp. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_WordPartLeft. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
-    _arg1 = (bool ) tempbool1;
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_UsePopUp(_arg0,_arg1);
+        wxStyledTextCtrl_WordPartLeft(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -6431,54 +7783,26 @@ static PyObject *_wrap_wxStyledTextCtrl_UsePopUp(PyObject *self, PyObject *args,
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_SelectionIsRectangle(_swigobj)  (_swigobj->SelectionIsRectangle())
-static PyObject *_wrap_wxStyledTextCtrl_SelectionIsRectangle(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_WordPartLeftExtend(_swigobj)  (_swigobj->WordPartLeftExtend())
+static PyObject *_wrap_wxStyledTextCtrl_WordPartLeftExtend(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    bool  _result;
     wxStyledTextCtrl * _arg0;
     PyObject * _argo0 = 0;
     char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_SelectionIsRectangle",_kwnames,&_argo0)) 
-        return NULL;
-    if (_argo0) {
-        if (_argo0 == Py_None) { _arg0 = NULL; }
-        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SelectionIsRectangle. Expected _wxStyledTextCtrl_p.");
-        return NULL;
-        }
-    }
-{
-    wxPy_BEGIN_ALLOW_THREADS;
-        _result = (bool )wxStyledTextCtrl_SelectionIsRectangle(_arg0);
-
-    wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
-    return _resultobj;
-}
-
-#define wxStyledTextCtrl_SetZoom(_swigobj,_swigarg0)  (_swigobj->SetZoom(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_SetZoom(PyObject *self, PyObject *args, PyObject *kwargs) {
-    PyObject * _resultobj;
-    wxStyledTextCtrl * _arg0;
-    int  _arg1;
-    PyObject * _argo0 = 0;
-    char *_kwnames[] = { "self","zoom", NULL };
-
-    self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetZoom",_kwnames,&_argo0,&_arg1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_WordPartLeftExtend",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetZoom. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_WordPartLeftExtend. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_SetZoom(_arg0,_arg1);
+        wxStyledTextCtrl_WordPartLeftExtend(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -6486,96 +7810,82 @@ static PyObject *_wrap_wxStyledTextCtrl_SetZoom(PyObject *self, PyObject *args,
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetZoom(_swigobj)  (_swigobj->GetZoom())
-static PyObject *_wrap_wxStyledTextCtrl_GetZoom(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_WordPartRight(_swigobj)  (_swigobj->WordPartRight())
+static PyObject *_wrap_wxStyledTextCtrl_WordPartRight(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    int  _result;
     wxStyledTextCtrl * _arg0;
     PyObject * _argo0 = 0;
     char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetZoom",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_WordPartRight",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetZoom. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_WordPartRight. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_GetZoom(_arg0);
+        wxStyledTextCtrl_WordPartRight(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_CreateDocument(_swigobj)  (_swigobj->CreateDocument())
-static PyObject *_wrap_wxStyledTextCtrl_CreateDocument(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_WordPartRightExtend(_swigobj)  (_swigobj->WordPartRightExtend())
+static PyObject *_wrap_wxStyledTextCtrl_WordPartRightExtend(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    void * _result;
     wxStyledTextCtrl * _arg0;
     PyObject * _argo0 = 0;
     char *_kwnames[] = { "self", NULL };
-    char _ptemp[128];
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_CreateDocument",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_WordPartRightExtend",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_CreateDocument. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_WordPartRightExtend. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (void *)wxStyledTextCtrl_CreateDocument(_arg0);
+        wxStyledTextCtrl_WordPartRightExtend(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    if (_result) {
-        SWIG_MakePtr(_ptemp, (char *) _result,"_void_p");
-        _resultobj = Py_BuildValue("s",_ptemp);
-    } else {
-        Py_INCREF(Py_None);
-        _resultobj = Py_None;
-    }
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_AddRefDocument(_swigobj,_swigarg0)  (_swigobj->AddRefDocument(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_AddRefDocument(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_SetVisiblePolicy(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetVisiblePolicy(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetVisiblePolicy(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
-    void * _arg1;
+    int  _arg1;
+    int  _arg2;
     PyObject * _argo0 = 0;
-    PyObject * _argo1 = 0;
-    char *_kwnames[] = { "self","docPointer", NULL };
+    char *_kwnames[] = { "self","visiblePolicy","visibleSlop", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_AddRefDocument",_kwnames,&_argo0,&_argo1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxStyledTextCtrl_SetVisiblePolicy",_kwnames,&_argo0,&_arg1,&_arg2)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_AddRefDocument. Expected _wxStyledTextCtrl_p.");
-        return NULL;
-        }
-    }
-    if (_argo1) {
-        if (_argo1 == Py_None) { _arg1 = NULL; }
-        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxStyledTextCtrl_AddRefDocument. Expected _void_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetVisiblePolicy. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_AddRefDocument(_arg0,_arg1);
+        wxStyledTextCtrl_SetVisiblePolicy(_arg0,_arg1,_arg2);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -6583,35 +7893,26 @@ static PyObject *_wrap_wxStyledTextCtrl_AddRefDocument(PyObject *self, PyObject
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_ReleaseDocument(_swigobj,_swigarg0)  (_swigobj->ReleaseDocument(_swigarg0))
-static PyObject *_wrap_wxStyledTextCtrl_ReleaseDocument(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_DelLineLeft(_swigobj)  (_swigobj->DelLineLeft())
+static PyObject *_wrap_wxStyledTextCtrl_DelLineLeft(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxStyledTextCtrl * _arg0;
-    void * _arg1;
     PyObject * _argo0 = 0;
-    PyObject * _argo1 = 0;
-    char *_kwnames[] = { "self","docPointer", NULL };
+    char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_ReleaseDocument",_kwnames,&_argo0,&_argo1)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_DelLineLeft",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_ReleaseDocument. Expected _wxStyledTextCtrl_p.");
-        return NULL;
-        }
-    }
-    if (_argo1) {
-        if (_argo1 == Py_None) { _arg1 = NULL; }
-        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxStyledTextCtrl_ReleaseDocument. Expected _void_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_DelLineLeft. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        wxStyledTextCtrl_ReleaseDocument(_arg0,_arg1);
+        wxStyledTextCtrl_DelLineLeft(_arg0);
 
     wxPy_END_ALLOW_THREADS;
 }    Py_INCREF(Py_None);
@@ -6619,30 +7920,30 @@ static PyObject *_wrap_wxStyledTextCtrl_ReleaseDocument(PyObject *self, PyObject
     return _resultobj;
 }
 
-#define wxStyledTextCtrl_GetModEventMask(_swigobj)  (_swigobj->GetModEventMask())
-static PyObject *_wrap_wxStyledTextCtrl_GetModEventMask(PyObject *self, PyObject *args, PyObject *kwargs) {
+#define wxStyledTextCtrl_DelLineRight(_swigobj)  (_swigobj->DelLineRight())
+static PyObject *_wrap_wxStyledTextCtrl_DelLineRight(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
-    int  _result;
     wxStyledTextCtrl * _arg0;
     PyObject * _argo0 = 0;
     char *_kwnames[] = { "self", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_GetModEventMask",_kwnames,&_argo0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextCtrl_DelLineRight",_kwnames,&_argo0)) 
         return NULL;
     if (_argo0) {
         if (_argo0 == Py_None) { _arg0 = NULL; }
         else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
-            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_GetModEventMask. Expected _wxStyledTextCtrl_p.");
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_DelLineRight. Expected _wxStyledTextCtrl_p.");
         return NULL;
         }
     }
 {
     wxPy_BEGIN_ALLOW_THREADS;
-        _result = (int )wxStyledTextCtrl_GetModEventMask(_arg0);
+        wxStyledTextCtrl_DelLineRight(_arg0);
 
     wxPy_END_ALLOW_THREADS;
-}    _resultobj = Py_BuildValue("i",_result);
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
     return _resultobj;
 }
 
@@ -6911,6 +8212,57 @@ static PyObject *_wrap_wxStyledTextCtrl_SetKeyWords(PyObject *self, PyObject *ar
     return _resultobj;
 }
 
+#define wxStyledTextCtrl_SetLexerLanguage(_swigobj,_swigarg0)  (_swigobj->SetLexerLanguage(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetLexerLanguage(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    wxString * _arg1;
+    PyObject * _argo0 = 0;
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","language", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextCtrl_SetLexerLanguage",_kwnames,&_argo0,&_obj1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SetLexerLanguage. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+#if PYTHON_API_VERSION >= 1009
+    char* tmpPtr; int tmpSize;
+    if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
+        return NULL;
+    _arg1 = new wxString(tmpPtr, tmpSize);
+#else
+    if (!PyString_Check(_obj1)) {
+        PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+        return NULL;
+    }
+    _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
+#endif
+}
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextCtrl_SetLexerLanguage(_arg0,*_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+{
+    if (_obj1)
+        delete _arg1;
+}
+    return _resultobj;
+}
+
 #define wxStyledTextCtrl_GetCurrentLine(_swigobj)  (_swigobj->GetCurrentLine())
 static PyObject *_wrap_wxStyledTextCtrl_GetCurrentLine(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -7279,6 +8631,36 @@ static PyObject *_wrap_wxStyledTextCtrl_ScrollToColumn(PyObject *self, PyObject
     return _resultobj;
 }
 
+#define wxStyledTextCtrl_SendMsg(_swigobj,_swigarg0,_swigarg1,_swigarg2)  (_swigobj->SendMsg(_swigarg0,_swigarg1,_swigarg2))
+static PyObject *_wrap_wxStyledTextCtrl_SendMsg(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    long  _result;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    long  _arg2 = (long ) 0;
+    long  _arg3 = (long ) 0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","msg","wp","lp", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|ll:wxStyledTextCtrl_SendMsg",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextCtrl_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextCtrl_SendMsg. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (long )wxStyledTextCtrl_SendMsg(_arg0,_arg1,_arg2,_arg3);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("l",_result);
+    return _resultobj;
+}
+
 static void *SwigwxStyledTextEventTowxCommandEvent(void *ptr) {
     wxStyledTextEvent *src;
     wxCommandEvent *dest;
@@ -7749,6 +9131,90 @@ static PyObject *_wrap_wxStyledTextEvent_SetLParam(PyObject *self, PyObject *arg
     return _resultobj;
 }
 
+#define wxStyledTextEvent_SetListType(_swigobj,_swigarg0)  (_swigobj->SetListType(_swigarg0))
+static PyObject *_wrap_wxStyledTextEvent_SetListType(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextEvent * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","val", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetListType",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetListType. Expected _wxStyledTextEvent_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextEvent_SetListType(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextEvent_SetX(_swigobj,_swigarg0)  (_swigobj->SetX(_swigarg0))
+static PyObject *_wrap_wxStyledTextEvent_SetX(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextEvent * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","val", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetX",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetX. Expected _wxStyledTextEvent_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextEvent_SetX(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextEvent_SetY(_swigobj,_swigarg0)  (_swigobj->SetY(_swigarg0))
+static PyObject *_wrap_wxStyledTextEvent_SetY(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextEvent * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","val", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetY",_kwnames,&_argo0,&_arg1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetY. Expected _wxStyledTextEvent_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        wxStyledTextEvent_SetY(_arg0,_arg1);
+
+    wxPy_END_ALLOW_THREADS;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 #define wxStyledTextEvent_GetPosition(_swigobj)  (_swigobj->GetPosition())
 static PyObject *_wrap_wxStyledTextEvent_GetPosition(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -8132,6 +9598,87 @@ static PyObject *_wrap_wxStyledTextEvent_GetLParam(PyObject *self, PyObject *arg
     return _resultobj;
 }
 
+#define wxStyledTextEvent_GetListType(_swigobj)  (_swigobj->GetListType())
+static PyObject *_wrap_wxStyledTextEvent_GetListType(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextEvent * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetListType",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetListType. Expected _wxStyledTextEvent_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextEvent_GetListType(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextEvent_GetX(_swigobj)  (_swigobj->GetX())
+static PyObject *_wrap_wxStyledTextEvent_GetX(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextEvent * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetX",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetX. Expected _wxStyledTextEvent_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextEvent_GetX(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextEvent_GetY(_swigobj)  (_swigobj->GetY())
+static PyObject *_wrap_wxStyledTextEvent_GetY(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    int  _result;
+    wxStyledTextEvent * _arg0;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetY",_kwnames,&_argo0)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetY. Expected _wxStyledTextEvent_p.");
+        return NULL;
+        }
+    }
+{
+    wxPy_BEGIN_ALLOW_THREADS;
+        _result = (int )wxStyledTextEvent_GetY(_arg0);
+
+    wxPy_END_ALLOW_THREADS;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
 #define wxStyledTextEvent_GetShift(_swigobj)  (_swigobj->GetShift())
 static PyObject *_wrap_wxStyledTextEvent_GetShift(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -8254,6 +9801,9 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextEvent_GetAlt", (PyCFunction) _wrap_wxStyledTextEvent_GetAlt, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_GetControl", (PyCFunction) _wrap_wxStyledTextEvent_GetControl, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_GetShift", (PyCFunction) _wrap_wxStyledTextEvent_GetShift, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextEvent_GetY", (PyCFunction) _wrap_wxStyledTextEvent_GetY, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextEvent_GetX", (PyCFunction) _wrap_wxStyledTextEvent_GetX, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextEvent_GetListType", (PyCFunction) _wrap_wxStyledTextEvent_GetListType, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_GetLParam", (PyCFunction) _wrap_wxStyledTextEvent_GetLParam, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_GetWParam", (PyCFunction) _wrap_wxStyledTextEvent_GetWParam, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_GetMessage", (PyCFunction) _wrap_wxStyledTextEvent_GetMessage, METH_VARARGS | METH_KEYWORDS },
@@ -8268,6 +9818,9 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextEvent_GetModifiers", (PyCFunction) _wrap_wxStyledTextEvent_GetModifiers, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_GetKey", (PyCFunction) _wrap_wxStyledTextEvent_GetKey, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_GetPosition", (PyCFunction) _wrap_wxStyledTextEvent_GetPosition, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextEvent_SetY", (PyCFunction) _wrap_wxStyledTextEvent_SetY, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextEvent_SetX", (PyCFunction) _wrap_wxStyledTextEvent_SetX, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextEvent_SetListType", (PyCFunction) _wrap_wxStyledTextEvent_SetListType, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_SetLParam", (PyCFunction) _wrap_wxStyledTextEvent_SetLParam, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_SetWParam", (PyCFunction) _wrap_wxStyledTextEvent_SetWParam, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextEvent_SetMessage", (PyCFunction) _wrap_wxStyledTextEvent_SetMessage, METH_VARARGS | METH_KEYWORDS },
@@ -8284,6 +9837,7 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextEvent_SetPosition", (PyCFunction) _wrap_wxStyledTextEvent_SetPosition, METH_VARARGS | METH_KEYWORDS },
         { "delete_wxStyledTextEvent", (PyCFunction) _wrap_delete_wxStyledTextEvent, METH_VARARGS | METH_KEYWORDS },
         { "new_wxStyledTextEvent", (PyCFunction) _wrap_new_wxStyledTextEvent, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SendMsg", (PyCFunction) _wrap_wxStyledTextCtrl_SendMsg, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_ScrollToColumn", (PyCFunction) _wrap_wxStyledTextCtrl_ScrollToColumn, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_ScrollToLine", (PyCFunction) _wrap_wxStyledTextCtrl_ScrollToLine, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_PointFromPosition", (PyCFunction) _wrap_wxStyledTextCtrl_PointFromPosition, METH_VARARGS | METH_KEYWORDS },
@@ -8294,6 +9848,7 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_StyleSetFont", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetFont, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_StyleSetSpec", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetSpec, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetCurrentLine", (PyCFunction) _wrap_wxStyledTextCtrl_GetCurrentLine, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetLexerLanguage", (PyCFunction) _wrap_wxStyledTextCtrl_SetLexerLanguage, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetKeyWords", (PyCFunction) _wrap_wxStyledTextCtrl_SetKeyWords, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetProperty", (PyCFunction) _wrap_wxStyledTextCtrl_SetProperty, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_Colourise", (PyCFunction) _wrap_wxStyledTextCtrl_Colourise, METH_VARARGS | METH_KEYWORDS },
@@ -8301,6 +9856,21 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_SetLexer", (PyCFunction) _wrap_wxStyledTextCtrl_SetLexer, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_StopRecord", (PyCFunction) _wrap_wxStyledTextCtrl_StopRecord, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_StartRecord", (PyCFunction) _wrap_wxStyledTextCtrl_StartRecord, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_DelLineRight", (PyCFunction) _wrap_wxStyledTextCtrl_DelLineRight, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_DelLineLeft", (PyCFunction) _wrap_wxStyledTextCtrl_DelLineLeft, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetVisiblePolicy", (PyCFunction) _wrap_wxStyledTextCtrl_SetVisiblePolicy, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_WordPartRightExtend", (PyCFunction) _wrap_wxStyledTextCtrl_WordPartRightExtend, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_WordPartRight", (PyCFunction) _wrap_wxStyledTextCtrl_WordPartRight, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_WordPartLeftExtend", (PyCFunction) _wrap_wxStyledTextCtrl_WordPartLeftExtend, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_WordPartLeft", (PyCFunction) _wrap_wxStyledTextCtrl_WordPartLeft, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetCursor", (PyCFunction) _wrap_wxStyledTextCtrl_GetCursor, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetCursor", (PyCFunction) _wrap_wxStyledTextCtrl_SetCursor, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetMouseDownCaptures", (PyCFunction) _wrap_wxStyledTextCtrl_GetMouseDownCaptures, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetMouseDownCaptures", (PyCFunction) _wrap_wxStyledTextCtrl_SetMouseDownCaptures, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetStatus", (PyCFunction) _wrap_wxStyledTextCtrl_GetStatus, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetStatus", (PyCFunction) _wrap_wxStyledTextCtrl_SetStatus, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetFocus", (PyCFunction) _wrap_wxStyledTextCtrl_GetFocus, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetFocus", (PyCFunction) _wrap_wxStyledTextCtrl_SetFocus, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetModEventMask", (PyCFunction) _wrap_wxStyledTextCtrl_GetModEventMask, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_ReleaseDocument", (PyCFunction) _wrap_wxStyledTextCtrl_ReleaseDocument, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_AddRefDocument", (PyCFunction) _wrap_wxStyledTextCtrl_AddRefDocument, METH_VARARGS | METH_KEYWORDS },
@@ -8329,6 +9899,14 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_BraceBadLight", (PyCFunction) _wrap_wxStyledTextCtrl_BraceBadLight, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_BraceHighlight", (PyCFunction) _wrap_wxStyledTextCtrl_BraceHighlight, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_LineLength", (PyCFunction) _wrap_wxStyledTextCtrl_LineLength, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_MoveCaretInsideView", (PyCFunction) _wrap_wxStyledTextCtrl_MoveCaretInsideView, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetMouseDwellTime", (PyCFunction) _wrap_wxStyledTextCtrl_GetMouseDwellTime, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetMouseDwellTime", (PyCFunction) _wrap_wxStyledTextCtrl_SetMouseDwellTime, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetBackSpaceUnIndents", (PyCFunction) _wrap_wxStyledTextCtrl_GetBackSpaceUnIndents, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetBackSpaceUnIndents", (PyCFunction) _wrap_wxStyledTextCtrl_SetBackSpaceUnIndents, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetTabIndents", (PyCFunction) _wrap_wxStyledTextCtrl_GetTabIndents, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetTabIndents", (PyCFunction) _wrap_wxStyledTextCtrl_SetTabIndents, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_EnsureVisibleEnforcePolicy", (PyCFunction) _wrap_wxStyledTextCtrl_EnsureVisibleEnforcePolicy, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetFoldFlags", (PyCFunction) _wrap_wxStyledTextCtrl_SetFoldFlags, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_EnsureVisible", (PyCFunction) _wrap_wxStyledTextCtrl_EnsureVisible, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_ToggleFold", (PyCFunction) _wrap_wxStyledTextCtrl_ToggleFold, METH_VARARGS | METH_KEYWORDS },
@@ -8349,6 +9927,17 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_CallTipActive", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipActive, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_CallTipCancel", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipCancel, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_CallTipShow", (PyCFunction) _wrap_wxStyledTextCtrl_CallTipShow, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetSearchFlags", (PyCFunction) _wrap_wxStyledTextCtrl_GetSearchFlags, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetSearchFlags", (PyCFunction) _wrap_wxStyledTextCtrl_SetSearchFlags, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SearchInTarget", (PyCFunction) _wrap_wxStyledTextCtrl_SearchInTarget, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_ReplaceTargetRE", (PyCFunction) _wrap_wxStyledTextCtrl_ReplaceTargetRE, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_ReplaceTarget", (PyCFunction) _wrap_wxStyledTextCtrl_ReplaceTarget, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetTargetEnd", (PyCFunction) _wrap_wxStyledTextCtrl_GetTargetEnd, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetTargetEnd", (PyCFunction) _wrap_wxStyledTextCtrl_SetTargetEnd, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetTargetStart", (PyCFunction) _wrap_wxStyledTextCtrl_GetTargetStart, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetTargetStart", (PyCFunction) _wrap_wxStyledTextCtrl_SetTargetStart, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetCaretWidth", (PyCFunction) _wrap_wxStyledTextCtrl_GetCaretWidth, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetCaretWidth", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretWidth, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetOvertype", (PyCFunction) _wrap_wxStyledTextCtrl_GetOvertype, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetOvertype", (PyCFunction) _wrap_wxStyledTextCtrl_SetOvertype, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetTextLength", (PyCFunction) _wrap_wxStyledTextCtrl_GetTextLength, METH_VARARGS | METH_KEYWORDS },
@@ -8409,6 +9998,9 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_SetUseTabs", (PyCFunction) _wrap_wxStyledTextCtrl_SetUseTabs, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetIndent", (PyCFunction) _wrap_wxStyledTextCtrl_GetIndent, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetIndent", (PyCFunction) _wrap_wxStyledTextCtrl_SetIndent, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_AutoCompGetAutoHide", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompGetAutoHide, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_AutoCompSetAutoHide", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompSetAutoHide, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_UserListShow", (PyCFunction) _wrap_wxStyledTextCtrl_UserListShow, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_AutoCompGetIgnoreCase", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompGetIgnoreCase, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_AutoCompSetIgnoreCase", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompSetIgnoreCase, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_AutoCompGetChooseSingle", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompGetChooseSingle, METH_VARARGS | METH_KEYWORDS },
@@ -8425,6 +10017,10 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_AutoCompActive", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompActive, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_AutoCompCancel", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompCancel, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_AutoCompShow", (PyCFunction) _wrap_wxStyledTextCtrl_AutoCompShow, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetCaretLineBack", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretLineBack, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetCaretLineBack", (PyCFunction) _wrap_wxStyledTextCtrl_GetCaretLineBack, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetCaretLineVisible", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretLineVisible, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetCaretLineVisible", (PyCFunction) _wrap_wxStyledTextCtrl_GetCaretLineVisible, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetMaxLineState", (PyCFunction) _wrap_wxStyledTextCtrl_GetMaxLineState, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetLineState", (PyCFunction) _wrap_wxStyledTextCtrl_GetLineState, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetLineState", (PyCFunction) _wrap_wxStyledTextCtrl_SetLineState, METH_VARARGS | METH_KEYWORDS },
@@ -8447,6 +10043,7 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_SetCaretForeground", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretForeground, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetSelBackground", (PyCFunction) _wrap_wxStyledTextCtrl_SetSelBackground, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetSelForeground", (PyCFunction) _wrap_wxStyledTextCtrl_SetSelForeground, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_StyleSetCase", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetCase, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_StyleSetUnderline", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetUnderline, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_StyleResetDefault", (PyCFunction) _wrap_wxStyledTextCtrl_StyleResetDefault, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_StyleSetEOLFilled", (PyCFunction) _wrap_wxStyledTextCtrl_StyleSetEOLFilled, METH_VARARGS | METH_KEYWORDS },
@@ -8489,6 +10086,7 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_SetAnchor", (PyCFunction) _wrap_wxStyledTextCtrl_SetAnchor, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GotoPos", (PyCFunction) _wrap_wxStyledTextCtrl_GotoPos, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GotoLine", (PyCFunction) _wrap_wxStyledTextCtrl_GotoLine, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_PositionFromPointClose", (PyCFunction) _wrap_wxStyledTextCtrl_PositionFromPointClose, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_PositionFromPoint", (PyCFunction) _wrap_wxStyledTextCtrl_PositionFromPoint, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetViewWhiteSpace", (PyCFunction) _wrap_wxStyledTextCtrl_SetViewWhiteSpace, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetViewWhiteSpace", (PyCFunction) _wrap_wxStyledTextCtrl_GetViewWhiteSpace, METH_VARARGS | METH_KEYWORDS },
@@ -8660,6 +10258,24 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_MARK_ARROWDOWN", PyInt_FromLong((long) 6));
         PyDict_SetItemString(d,"wxSTC_MARK_MINUS", PyInt_FromLong((long) 7));
         PyDict_SetItemString(d,"wxSTC_MARK_PLUS", PyInt_FromLong((long) 8));
+        PyDict_SetItemString(d,"wxSTC_MARK_VLINE", PyInt_FromLong((long) 9));
+        PyDict_SetItemString(d,"wxSTC_MARK_LCORNER", PyInt_FromLong((long) 10));
+        PyDict_SetItemString(d,"wxSTC_MARK_TCORNER", PyInt_FromLong((long) 11));
+        PyDict_SetItemString(d,"wxSTC_MARK_BOXPLUS", PyInt_FromLong((long) 12));
+        PyDict_SetItemString(d,"wxSTC_MARK_BOXPLUSCONNECTED", PyInt_FromLong((long) 13));
+        PyDict_SetItemString(d,"wxSTC_MARK_BOXMINUS", PyInt_FromLong((long) 14));
+        PyDict_SetItemString(d,"wxSTC_MARK_BOXMINUSCONNECTED", PyInt_FromLong((long) 15));
+        PyDict_SetItemString(d,"wxSTC_MARK_LCORNERCURVE", PyInt_FromLong((long) 16));
+        PyDict_SetItemString(d,"wxSTC_MARK_TCORNERCURVE", PyInt_FromLong((long) 17));
+        PyDict_SetItemString(d,"wxSTC_MARK_CIRCLEPLUS", PyInt_FromLong((long) 18));
+        PyDict_SetItemString(d,"wxSTC_MARK_CIRCLEPLUSCONNECTED", PyInt_FromLong((long) 19));
+        PyDict_SetItemString(d,"wxSTC_MARK_CIRCLEMINUS", PyInt_FromLong((long) 20));
+        PyDict_SetItemString(d,"wxSTC_MARK_CIRCLEMINUSCONNECTED", PyInt_FromLong((long) 21));
+        PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDEREND", PyInt_FromLong((long) 25));
+        PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDEROPENMID", PyInt_FromLong((long) 26));
+        PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDERMIDTAIL", PyInt_FromLong((long) 27));
+        PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDERTAIL", PyInt_FromLong((long) 28));
+        PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDERSUB", PyInt_FromLong((long) 29));
         PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDER", PyInt_FromLong((long) 30));
         PyDict_SetItemString(d,"wxSTC_MARKNUM_FOLDEROPEN", PyInt_FromLong((long) 31));
         PyDict_SetItemString(d,"wxSTC_MARGIN_SYMBOL", PyInt_FromLong((long) 0));
@@ -8690,6 +10306,9 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_CHARSET_ARABIC", PyInt_FromLong((long) 178));
         PyDict_SetItemString(d,"wxSTC_CHARSET_VIETNAMESE", PyInt_FromLong((long) 163));
         PyDict_SetItemString(d,"wxSTC_CHARSET_THAI", PyInt_FromLong((long) 222));
+        PyDict_SetItemString(d,"wxSTC_CASE_MIXED", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_CASE_UPPER", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_CASE_LOWER", PyInt_FromLong((long) 2));
         PyDict_SetItemString(d,"wxSTC_INDIC_MAX", PyInt_FromLong((long) 7));
         PyDict_SetItemString(d,"wxSTC_INDIC_PLAIN", PyInt_FromLong((long) 0));
         PyDict_SetItemString(d,"wxSTC_INDIC_SQUIGGLE", PyInt_FromLong((long) 1));
@@ -8703,7 +10322,8 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_PRINT_NORMAL", PyInt_FromLong((long) 0));
         PyDict_SetItemString(d,"wxSTC_PRINT_INVERTLIGHT", PyInt_FromLong((long) 1));
         PyDict_SetItemString(d,"wxSTC_PRINT_BLACKONWHITE", PyInt_FromLong((long) 2));
-        PyDict_SetItemString(d,"wxSTC_FIND_DOWN", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_PRINT_COLOURONWHITE", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_PRINT_COLOURONWHITEDEFAULTBG", PyInt_FromLong((long) 4));
         PyDict_SetItemString(d,"wxSTC_FIND_WHOLEWORD", PyInt_FromLong((long) 2));
         PyDict_SetItemString(d,"wxSTC_FIND_MATCHCASE", PyInt_FromLong((long) 4));
         PyDict_SetItemString(d,"wxSTC_FIND_WORDSTART", PyInt_FromLong((long) 0x00100000));
@@ -8716,6 +10336,7 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_FOLDLEVELWHITEFLAG", PyInt_FromLong((long) 0x1000));
         PyDict_SetItemString(d,"wxSTC_FOLDLEVELHEADERFLAG", PyInt_FromLong((long) 0x2000));
         PyDict_SetItemString(d,"wxSTC_FOLDLEVELNUMBERMASK", PyInt_FromLong((long) 0x0FFF));
+        PyDict_SetItemString(d,"wxSTC_TIME_FOREVER", PyInt_FromLong((long) 10000000));
         PyDict_SetItemString(d,"wxSTC_CMD_LINEDOWN", PyInt_FromLong((long) 2300));
         PyDict_SetItemString(d,"wxSTC_CMD_LINEDOWNEXTEND", PyInt_FromLong((long) 2301));
         PyDict_SetItemString(d,"wxSTC_CMD_LINEUP", PyInt_FromLong((long) 2302));
@@ -8766,6 +10387,12 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_CARET_SLOP", PyInt_FromLong((long) 0x01));
         PyDict_SetItemString(d,"wxSTC_CARET_CENTER", PyInt_FromLong((long) 0x02));
         PyDict_SetItemString(d,"wxSTC_CARET_STRICT", PyInt_FromLong((long) 0x04));
+        PyDict_SetItemString(d,"wxSTC_CARET_XEVEN", PyInt_FromLong((long) 0x08));
+        PyDict_SetItemString(d,"wxSTC_CARET_XJUMPS", PyInt_FromLong((long) 0x10));
+        PyDict_SetItemString(d,"wxSTC_CURSORNORMAL", PyInt_FromLong((long) -1));
+        PyDict_SetItemString(d,"wxSTC_CURSORWAIT", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_VISIBLE_SLOP", PyInt_FromLong((long) 0x01));
+        PyDict_SetItemString(d,"wxSTC_VISIBLE_STRICT", PyInt_FromLong((long) 0x04));
         PyDict_SetItemString(d,"wxSTC_MOD_INSERTTEXT", PyInt_FromLong((long) 0x1));
         PyDict_SetItemString(d,"wxSTC_MOD_DELETETEXT", PyInt_FromLong((long) 0x2));
         PyDict_SetItemString(d,"wxSTC_MOD_CHANGESTYLE", PyInt_FromLong((long) 0x4));
@@ -8815,6 +10442,16 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_LEX_LATEX", PyInt_FromLong((long) 14));
         PyDict_SetItemString(d,"wxSTC_LEX_LUA", PyInt_FromLong((long) 15));
         PyDict_SetItemString(d,"wxSTC_LEX_DIFF", PyInt_FromLong((long) 16));
+        PyDict_SetItemString(d,"wxSTC_LEX_CONF", PyInt_FromLong((long) 17));
+        PyDict_SetItemString(d,"wxSTC_LEX_PASCAL", PyInt_FromLong((long) 18));
+        PyDict_SetItemString(d,"wxSTC_LEX_AVE", PyInt_FromLong((long) 19));
+        PyDict_SetItemString(d,"wxSTC_LEX_ADA", PyInt_FromLong((long) 20));
+        PyDict_SetItemString(d,"wxSTC_LEX_LISP", PyInt_FromLong((long) 21));
+        PyDict_SetItemString(d,"wxSTC_LEX_RUBY", PyInt_FromLong((long) 22));
+        PyDict_SetItemString(d,"wxSTC_LEX_EIFFEL", PyInt_FromLong((long) 23));
+        PyDict_SetItemString(d,"wxSTC_LEX_EIFFELKW", PyInt_FromLong((long) 24));
+        PyDict_SetItemString(d,"wxSTC_LEX_TCL", PyInt_FromLong((long) 25));
+        PyDict_SetItemString(d,"wxSTC_LEX_AUTOMATIC", PyInt_FromLong((long) 1000));
         PyDict_SetItemString(d,"wxSTC_P_DEFAULT", PyInt_FromLong((long) 0));
         PyDict_SetItemString(d,"wxSTC_P_COMMENTLINE", PyInt_FromLong((long) 1));
         PyDict_SetItemString(d,"wxSTC_P_NUMBER", PyInt_FromLong((long) 2));
@@ -8843,6 +10480,9 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_C_IDENTIFIER", PyInt_FromLong((long) 11));
         PyDict_SetItemString(d,"wxSTC_C_STRINGEOL", PyInt_FromLong((long) 12));
         PyDict_SetItemString(d,"wxSTC_C_VERBATIM", PyInt_FromLong((long) 13));
+        PyDict_SetItemString(d,"wxSTC_C_REGEX", PyInt_FromLong((long) 14));
+        PyDict_SetItemString(d,"wxSTC_C_COMMENTLINEDOC", PyInt_FromLong((long) 15));
+        PyDict_SetItemString(d,"wxSTC_C_WORD2", PyInt_FromLong((long) 16));
         PyDict_SetItemString(d,"wxSTC_H_DEFAULT", PyInt_FromLong((long) 0));
         PyDict_SetItemString(d,"wxSTC_H_TAG", PyInt_FromLong((long) 1));
         PyDict_SetItemString(d,"wxSTC_H_TAGUNKNOWN", PyInt_FromLong((long) 2));
@@ -8863,6 +10503,8 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_H_CDATA", PyInt_FromLong((long) 17));
         PyDict_SetItemString(d,"wxSTC_H_QUESTION", PyInt_FromLong((long) 18));
         PyDict_SetItemString(d,"wxSTC_H_VALUE", PyInt_FromLong((long) 19));
+        PyDict_SetItemString(d,"wxSTC_H_XCCOMMENT", PyInt_FromLong((long) 20));
+        PyDict_SetItemString(d,"wxSTC_H_SGML", PyInt_FromLong((long) 21));
         PyDict_SetItemString(d,"wxSTC_HJ_START", PyInt_FromLong((long) 40));
         PyDict_SetItemString(d,"wxSTC_HJ_DEFAULT", PyInt_FromLong((long) 41));
         PyDict_SetItemString(d,"wxSTC_HJ_COMMENT", PyInt_FromLong((long) 42));
@@ -8875,6 +10517,7 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_HJ_SINGLESTRING", PyInt_FromLong((long) 49));
         PyDict_SetItemString(d,"wxSTC_HJ_SYMBOLS", PyInt_FromLong((long) 50));
         PyDict_SetItemString(d,"wxSTC_HJ_STRINGEOL", PyInt_FromLong((long) 51));
+        PyDict_SetItemString(d,"wxSTC_HJ_REGEX", PyInt_FromLong((long) 52));
         PyDict_SetItemString(d,"wxSTC_HJA_START", PyInt_FromLong((long) 55));
         PyDict_SetItemString(d,"wxSTC_HJA_DEFAULT", PyInt_FromLong((long) 56));
         PyDict_SetItemString(d,"wxSTC_HJA_COMMENT", PyInt_FromLong((long) 57));
@@ -8887,6 +10530,7 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_HJA_SINGLESTRING", PyInt_FromLong((long) 64));
         PyDict_SetItemString(d,"wxSTC_HJA_SYMBOLS", PyInt_FromLong((long) 65));
         PyDict_SetItemString(d,"wxSTC_HJA_STRINGEOL", PyInt_FromLong((long) 66));
+        PyDict_SetItemString(d,"wxSTC_HJA_REGEX", PyInt_FromLong((long) 67));
         PyDict_SetItemString(d,"wxSTC_HB_START", PyInt_FromLong((long) 70));
         PyDict_SetItemString(d,"wxSTC_HB_DEFAULT", PyInt_FromLong((long) 71));
         PyDict_SetItemString(d,"wxSTC_HB_COMMENTLINE", PyInt_FromLong((long) 72));
@@ -8937,9 +10581,10 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_HPHP_VARIABLE", PyInt_FromLong((long) 123));
         PyDict_SetItemString(d,"wxSTC_HPHP_COMMENT", PyInt_FromLong((long) 124));
         PyDict_SetItemString(d,"wxSTC_HPHP_COMMENTLINE", PyInt_FromLong((long) 125));
-        PyDict_SetItemString(d,"wxSTC_HPHP_STRINGEOL", PyInt_FromLong((long) 126));
+        PyDict_SetItemString(d,"wxSTC_HPHP_HSTRING_VARIABLE", PyInt_FromLong((long) 126));
+        PyDict_SetItemString(d,"wxSTC_HPHP_OPERATOR", PyInt_FromLong((long) 127));
         PyDict_SetItemString(d,"wxSTC_PL_DEFAULT", PyInt_FromLong((long) 0));
-        PyDict_SetItemString(d,"wxSTC_PL_HERE", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_PL_ERROR", PyInt_FromLong((long) 1));
         PyDict_SetItemString(d,"wxSTC_PL_COMMENTLINE", PyInt_FromLong((long) 2));
         PyDict_SetItemString(d,"wxSTC_PL_POD", PyInt_FromLong((long) 3));
         PyDict_SetItemString(d,"wxSTC_PL_NUMBER", PyInt_FromLong((long) 4));
@@ -8954,12 +10599,20 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_PL_ARRAY", PyInt_FromLong((long) 13));
         PyDict_SetItemString(d,"wxSTC_PL_HASH", PyInt_FromLong((long) 14));
         PyDict_SetItemString(d,"wxSTC_PL_SYMBOLTABLE", PyInt_FromLong((long) 15));
-        PyDict_SetItemString(d,"wxSTC_PL_REF", PyInt_FromLong((long) 16));
         PyDict_SetItemString(d,"wxSTC_PL_REGEX", PyInt_FromLong((long) 17));
         PyDict_SetItemString(d,"wxSTC_PL_REGSUBST", PyInt_FromLong((long) 18));
         PyDict_SetItemString(d,"wxSTC_PL_LONGQUOTE", PyInt_FromLong((long) 19));
         PyDict_SetItemString(d,"wxSTC_PL_BACKTICKS", PyInt_FromLong((long) 20));
         PyDict_SetItemString(d,"wxSTC_PL_DATASECTION", PyInt_FromLong((long) 21));
+        PyDict_SetItemString(d,"wxSTC_PL_HERE_DELIM", PyInt_FromLong((long) 22));
+        PyDict_SetItemString(d,"wxSTC_PL_HERE_Q", PyInt_FromLong((long) 23));
+        PyDict_SetItemString(d,"wxSTC_PL_HERE_QQ", PyInt_FromLong((long) 24));
+        PyDict_SetItemString(d,"wxSTC_PL_HERE_QX", PyInt_FromLong((long) 25));
+        PyDict_SetItemString(d,"wxSTC_PL_STRING_Q", PyInt_FromLong((long) 26));
+        PyDict_SetItemString(d,"wxSTC_PL_STRING_QQ", PyInt_FromLong((long) 27));
+        PyDict_SetItemString(d,"wxSTC_PL_STRING_QX", PyInt_FromLong((long) 28));
+        PyDict_SetItemString(d,"wxSTC_PL_STRING_QR", PyInt_FromLong((long) 29));
+        PyDict_SetItemString(d,"wxSTC_PL_STRING_QW", PyInt_FromLong((long) 30));
         PyDict_SetItemString(d,"wxSTC_L_DEFAULT", PyInt_FromLong((long) 0));
         PyDict_SetItemString(d,"wxSTC_L_COMMAND", PyInt_FromLong((long) 1));
         PyDict_SetItemString(d,"wxSTC_L_TAG", PyInt_FromLong((long) 2));
@@ -8985,22 +10638,95 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_ERR_CMD", PyInt_FromLong((long) 4));
         PyDict_SetItemString(d,"wxSTC_ERR_BORLAND", PyInt_FromLong((long) 5));
         PyDict_SetItemString(d,"wxSTC_ERR_PERL", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_ERR_NET", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_ERR_LUA", PyInt_FromLong((long) 8));
+        PyDict_SetItemString(d,"wxSTC_ERR_DIFF_CHANGED", PyInt_FromLong((long) 10));
+        PyDict_SetItemString(d,"wxSTC_ERR_DIFF_ADDITION", PyInt_FromLong((long) 11));
+        PyDict_SetItemString(d,"wxSTC_ERR_DIFF_DELETION", PyInt_FromLong((long) 12));
+        PyDict_SetItemString(d,"wxSTC_ERR_DIFF_MESSAGE", PyInt_FromLong((long) 13));
+        PyDict_SetItemString(d,"wxSTC_BAT_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_BAT_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_BAT_WORD", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_BAT_LABEL", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_BAT_HIDE", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_BAT_COMMAND", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_BAT_IDENTIFIER", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_BAT_OPERATOR", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_MAKE_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_MAKE_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_MAKE_PREPROCESSOR", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_MAKE_IDENTIFIER", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_MAKE_OPERATOR", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_MAKE_TARGET", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_MAKE_IDEOL", PyInt_FromLong((long) 9));
+        PyDict_SetItemString(d,"wxSTC_CONF_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_CONF_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_CONF_NUMBER", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_CONF_IDENTIFIER", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_CONF_EXTENSION", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_CONF_PARAMETER", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_CONF_STRING", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_CONF_OPERATOR", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_CONF_IP", PyInt_FromLong((long) 8));
+        PyDict_SetItemString(d,"wxSTC_CONF_DIRECTIVE", PyInt_FromLong((long) 9));
+        PyDict_SetItemString(d,"wxSTC_AVE_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_AVE_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_AVE_NUMBER", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_AVE_WORD", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_AVE_KEYWORD", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_AVE_STATEMENT", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_AVE_STRING", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_AVE_ENUM", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_AVE_STRINGEOL", PyInt_FromLong((long) 8));
+        PyDict_SetItemString(d,"wxSTC_AVE_IDENTIFIER", PyInt_FromLong((long) 9));
+        PyDict_SetItemString(d,"wxSTC_AVE_OPERATOR", PyInt_FromLong((long) 10));
+        PyDict_SetItemString(d,"wxSTC_ADA_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_ADA_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_ADA_NUMBER", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_ADA_WORD", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_ADA_STRING", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_ADA_CHARACTER", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_ADA_OPERATOR", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_ADA_IDENTIFIER", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_ADA_STRINGEOL", PyInt_FromLong((long) 8));
+        PyDict_SetItemString(d,"wxSTC_LISP_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_LISP_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_LISP_NUMBER", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_LISP_KEYWORD", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_LISP_STRING", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_LISP_STRINGEOL", PyInt_FromLong((long) 8));
+        PyDict_SetItemString(d,"wxSTC_LISP_IDENTIFIER", PyInt_FromLong((long) 9));
+        PyDict_SetItemString(d,"wxSTC_LISP_OPERATOR", PyInt_FromLong((long) 10));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_COMMENTLINE", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_NUMBER", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_WORD", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_STRING", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_CHARACTER", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_OPERATOR", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_IDENTIFIER", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_EIFFEL_STRINGEOL", PyInt_FromLong((long) 8));
         PyDict_SetItemString(d,"wxSTC_MASK_FOLDERS", PyInt_FromLong((long) ((1<<(30))|(1<<(31)))));
         PyDict_SetItemString(d,"wxSTCNameStr", PyString_FromString("wxSTCNameStr"));
         PyDict_SetItemString(d,"wxEVT_STC_CHANGE", PyInt_FromLong((long) wxEVT_STC_CHANGE));
         PyDict_SetItemString(d,"wxEVT_STC_STYLENEEDED", PyInt_FromLong((long) wxEVT_STC_STYLENEEDED));
         PyDict_SetItemString(d,"wxEVT_STC_CHARADDED", PyInt_FromLong((long) wxEVT_STC_CHARADDED));
-        PyDict_SetItemString(d,"wxEVT_STC_UPDATEUI", PyInt_FromLong((long) wxEVT_STC_UPDATEUI));
         PyDict_SetItemString(d,"wxEVT_STC_SAVEPOINTREACHED", PyInt_FromLong((long) wxEVT_STC_SAVEPOINTREACHED));
         PyDict_SetItemString(d,"wxEVT_STC_SAVEPOINTLEFT", PyInt_FromLong((long) wxEVT_STC_SAVEPOINTLEFT));
         PyDict_SetItemString(d,"wxEVT_STC_ROMODIFYATTEMPT", PyInt_FromLong((long) wxEVT_STC_ROMODIFYATTEMPT));
+        PyDict_SetItemString(d,"wxEVT_STC_KEY", PyInt_FromLong((long) wxEVT_STC_KEY));
         PyDict_SetItemString(d,"wxEVT_STC_DOUBLECLICK", PyInt_FromLong((long) wxEVT_STC_DOUBLECLICK));
+        PyDict_SetItemString(d,"wxEVT_STC_UPDATEUI", PyInt_FromLong((long) wxEVT_STC_UPDATEUI));
         PyDict_SetItemString(d,"wxEVT_STC_MODIFIED", PyInt_FromLong((long) wxEVT_STC_MODIFIED));
-        PyDict_SetItemString(d,"wxEVT_STC_KEY", PyInt_FromLong((long) wxEVT_STC_KEY));
         PyDict_SetItemString(d,"wxEVT_STC_MACRORECORD", PyInt_FromLong((long) wxEVT_STC_MACRORECORD));
         PyDict_SetItemString(d,"wxEVT_STC_MARGINCLICK", PyInt_FromLong((long) wxEVT_STC_MARGINCLICK));
         PyDict_SetItemString(d,"wxEVT_STC_NEEDSHOWN", PyInt_FromLong((long) wxEVT_STC_NEEDSHOWN));
         PyDict_SetItemString(d,"wxEVT_STC_POSCHANGED", PyInt_FromLong((long) wxEVT_STC_POSCHANGED));
+        PyDict_SetItemString(d,"wxEVT_STC_PAINTED", PyInt_FromLong((long) wxEVT_STC_PAINTED));
+        PyDict_SetItemString(d,"wxEVT_STC_USERLISTSELECTION", PyInt_FromLong((long) wxEVT_STC_USERLISTSELECTION));
+        PyDict_SetItemString(d,"wxEVT_STC_URIDROPPED", PyInt_FromLong((long) wxEVT_STC_URIDROPPED));
+        PyDict_SetItemString(d,"wxEVT_STC_DWELLSTART", PyInt_FromLong((long) wxEVT_STC_DWELLSTART));
+        PyDict_SetItemString(d,"wxEVT_STC_DWELLEND", PyInt_FromLong((long) wxEVT_STC_DWELLEND));
 
 
     wxClassInfo::CleanUpClasses();
index f3e877f24a79a7d3b005f7161d8f9d2ac75262bf..74a4694c5801a15c6386c24f135259ace6ceccfb 100644 (file)
 // Python functions to act like the event macros
 
 %pragma(python) code = "
-def EVT_STC_CHANGE(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_CHANGE, fn)
+def EVT_STC_CHANGE(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_CHANGE, func)
 
-def EVT_STC_STYLENEEDED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_STYLENEEDED, fn)
+def EVT_STC_STYLENEEDED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_STYLENEEDED, func)
 
-def EVT_STC_CHARADDED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_CHARADDED, fn)
+def EVT_STC_CHARADDED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_CHARADDED, func)
 
-def EVT_STC_UPDATEUI(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_UPDATEUI, fn)
+def EVT_STC_SAVEPOINTREACHED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_SAVEPOINTREACHED, func)
 
-def EVT_STC_SAVEPOINTREACHED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_SAVEPOINTREACHED, fn)
+def EVT_STC_SAVEPOINTLEFT(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_SAVEPOINTLEFT, func)
 
-def EVT_STC_SAVEPOINTLEFT(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_SAVEPOINTLEFT, fn)
+def EVT_STC_ROMODIFYATTEMPT(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_ROMODIFYATTEMPT, func)
 
-def EVT_STC_ROMODIFYATTEMPT(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_ROMODIFYATTEMPT, fn)
+def EVT_STC_KEY(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_KEY, func)
 
-def EVT_STC_DOUBLECLICK(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_DOUBLECLICK, fn)
+def EVT_STC_DOUBLECLICK(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_DOUBLECLICK, func)
 
-def EVT_STC_MODIFIED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_MODIFIED, fn)
+def EVT_STC_UPDATEUI(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_UPDATEUI, func)
 
-def EVT_STC_KEY(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_KEY, fn)
+def EVT_STC_MODIFIED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_MODIFIED, func)
 
-def EVT_STC_MACRORECORD(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_MACRORECORD, fn)
+def EVT_STC_MACRORECORD(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_MACRORECORD, func)
 
-def EVT_STC_MARGINCLICK(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_MARGINCLICK, fn)
+def EVT_STC_MARGINCLICK(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_MARGINCLICK, func)
 
-def EVT_STC_NEEDSHOWN(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_NEEDSHOWN, fn)
+def EVT_STC_NEEDSHOWN(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_NEEDSHOWN, func)
 
-def EVT_STC_POSCHANGED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_POSCHANGED, fn)
+def EVT_STC_POSCHANGED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_POSCHANGED, func)
+
+def EVT_STC_PAINTED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_PAINTED, func)
+
+def EVT_STC_USERLISTSELECTION(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_USERLISTSELECTION, func)
+
+def EVT_STC_URIDROPPED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_URIDROPPED, func)
+
+def EVT_STC_DWELLSTART(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_DWELLSTART, func)
+
+def EVT_STC_DWELLEND(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_DWELLEND, func)
 
 
 "
index b77cd7e8d0433361beef04d45e3891dee0392632..079b8cc4fd97f3ef6d503c55b6540152ed04bb8f 100644 (file)
@@ -41,47 +41,62 @@ from filesys import *
 
 from utils import *
 
-def EVT_STC_CHANGE(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_CHANGE, fn)
+def EVT_STC_CHANGE(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_CHANGE, func)
 
-def EVT_STC_STYLENEEDED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_STYLENEEDED, fn)
+def EVT_STC_STYLENEEDED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_STYLENEEDED, func)
 
-def EVT_STC_CHARADDED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_CHARADDED, fn)
+def EVT_STC_CHARADDED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_CHARADDED, func)
 
-def EVT_STC_UPDATEUI(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_UPDATEUI, fn)
+def EVT_STC_SAVEPOINTREACHED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_SAVEPOINTREACHED, func)
 
-def EVT_STC_SAVEPOINTREACHED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_SAVEPOINTREACHED, fn)
+def EVT_STC_SAVEPOINTLEFT(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_SAVEPOINTLEFT, func)
 
-def EVT_STC_SAVEPOINTLEFT(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_SAVEPOINTLEFT, fn)
+def EVT_STC_ROMODIFYATTEMPT(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_ROMODIFYATTEMPT, func)
 
-def EVT_STC_ROMODIFYATTEMPT(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_ROMODIFYATTEMPT, fn)
+def EVT_STC_KEY(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_KEY, func)
 
-def EVT_STC_DOUBLECLICK(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_DOUBLECLICK, fn)
+def EVT_STC_DOUBLECLICK(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_DOUBLECLICK, func)
 
-def EVT_STC_MODIFIED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_MODIFIED, fn)
+def EVT_STC_UPDATEUI(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_UPDATEUI, func)
 
-def EVT_STC_KEY(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_KEY, fn)
+def EVT_STC_MODIFIED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_MODIFIED, func)
 
-def EVT_STC_MACRORECORD(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_MACRORECORD, fn)
+def EVT_STC_MACRORECORD(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_MACRORECORD, func)
 
-def EVT_STC_MARGINCLICK(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_MARGINCLICK, fn)
+def EVT_STC_MARGINCLICK(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_MARGINCLICK, func)
 
-def EVT_STC_NEEDSHOWN(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_NEEDSHOWN, fn)
+def EVT_STC_NEEDSHOWN(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_NEEDSHOWN, func)
 
-def EVT_STC_POSCHANGED(win, id, fn):
-    win.Connect(id, -1, wxEVT_STC_POSCHANGED, fn)
+def EVT_STC_POSCHANGED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_POSCHANGED, func)
+
+def EVT_STC_PAINTED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_PAINTED, func)
+
+def EVT_STC_USERLISTSELECTION(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_USERLISTSELECTION, func)
+
+def EVT_STC_URIDROPPED(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_URIDROPPED, func)
+
+def EVT_STC_DWELLSTART(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_DWELLSTART, func)
+
+def EVT_STC_DWELLEND(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_DWELLEND, func)
 
 
 
@@ -155,6 +170,9 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def PositionFromPoint(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_PositionFromPoint,(self,) + _args, _kwargs)
         return val
+    def PositionFromPointClose(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_PositionFromPointClose,(self,) + _args, _kwargs)
+        return val
     def GotoLine(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_GotoLine,(self,) + _args, _kwargs)
         return val
@@ -281,6 +299,9 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def StyleSetUnderline(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_StyleSetUnderline,(self,) + _args, _kwargs)
         return val
+    def StyleSetCase(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_StyleSetCase,(self,) + _args, _kwargs)
+        return val
     def SetSelForeground(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_SetSelForeground,(self,) + _args, _kwargs)
         return val
@@ -348,6 +369,19 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def GetMaxLineState(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_GetMaxLineState,(self,) + _args, _kwargs)
         return val
+    def GetCaretLineVisible(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetCaretLineVisible,(self,) + _args, _kwargs)
+        return val
+    def SetCaretLineVisible(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetCaretLineVisible,(self,) + _args, _kwargs)
+        return val
+    def GetCaretLineBack(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetCaretLineBack,(self,) + _args, _kwargs)
+        if val: val = wxColourPtr(val) ; val.thisown = 1
+        return val
+    def SetCaretLineBack(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetCaretLineBack,(self,) + _args, _kwargs)
+        return val
     def AutoCompShow(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_AutoCompShow,(self,) + _args, _kwargs)
         return val
@@ -396,6 +430,15 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def AutoCompGetIgnoreCase(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_AutoCompGetIgnoreCase,(self,) + _args, _kwargs)
         return val
+    def UserListShow(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_UserListShow,(self,) + _args, _kwargs)
+        return val
+    def AutoCompSetAutoHide(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_AutoCompSetAutoHide,(self,) + _args, _kwargs)
+        return val
+    def AutoCompGetAutoHide(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_AutoCompGetAutoHide,(self,) + _args, _kwargs)
+        return val
     def SetIndent(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_SetIndent,(self,) + _args, _kwargs)
         return val
@@ -577,6 +620,39 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def GetOvertype(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_GetOvertype,(self,) + _args, _kwargs)
         return val
+    def SetCaretWidth(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetCaretWidth,(self,) + _args, _kwargs)
+        return val
+    def GetCaretWidth(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetCaretWidth,(self,) + _args, _kwargs)
+        return val
+    def SetTargetStart(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetTargetStart,(self,) + _args, _kwargs)
+        return val
+    def GetTargetStart(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetTargetStart,(self,) + _args, _kwargs)
+        return val
+    def SetTargetEnd(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetTargetEnd,(self,) + _args, _kwargs)
+        return val
+    def GetTargetEnd(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetTargetEnd,(self,) + _args, _kwargs)
+        return val
+    def ReplaceTarget(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_ReplaceTarget,(self,) + _args, _kwargs)
+        return val
+    def ReplaceTargetRE(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_ReplaceTargetRE,(self,) + _args, _kwargs)
+        return val
+    def SearchInTarget(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SearchInTarget,(self,) + _args, _kwargs)
+        return val
+    def SetSearchFlags(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetSearchFlags,(self,) + _args, _kwargs)
+        return val
+    def GetSearchFlags(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetSearchFlags,(self,) + _args, _kwargs)
+        return val
     def CallTipShow(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_CallTipShow,(self,) + _args, _kwargs)
         return val
@@ -637,6 +713,30 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def SetFoldFlags(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_SetFoldFlags,(self,) + _args, _kwargs)
         return val
+    def EnsureVisibleEnforcePolicy(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_EnsureVisibleEnforcePolicy,(self,) + _args, _kwargs)
+        return val
+    def SetTabIndents(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetTabIndents,(self,) + _args, _kwargs)
+        return val
+    def GetTabIndents(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetTabIndents,(self,) + _args, _kwargs)
+        return val
+    def SetBackSpaceUnIndents(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetBackSpaceUnIndents,(self,) + _args, _kwargs)
+        return val
+    def GetBackSpaceUnIndents(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetBackSpaceUnIndents,(self,) + _args, _kwargs)
+        return val
+    def SetMouseDwellTime(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetMouseDwellTime,(self,) + _args, _kwargs)
+        return val
+    def GetMouseDwellTime(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetMouseDwellTime,(self,) + _args, _kwargs)
+        return val
+    def MoveCaretInsideView(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_MoveCaretInsideView,(self,) + _args, _kwargs)
+        return val
     def LineLength(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_LineLength,(self,) + _args, _kwargs)
         return val
@@ -722,6 +822,51 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def GetModEventMask(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_GetModEventMask,(self,) + _args, _kwargs)
         return val
+    def SetFocus(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetFocus,(self,) + _args, _kwargs)
+        return val
+    def GetFocus(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetFocus,(self,) + _args, _kwargs)
+        return val
+    def SetStatus(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetStatus,(self,) + _args, _kwargs)
+        return val
+    def GetStatus(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetStatus,(self,) + _args, _kwargs)
+        return val
+    def SetMouseDownCaptures(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetMouseDownCaptures,(self,) + _args, _kwargs)
+        return val
+    def GetMouseDownCaptures(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetMouseDownCaptures,(self,) + _args, _kwargs)
+        return val
+    def SetCursor(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetCursor,(self,) + _args, _kwargs)
+        return val
+    def GetCursor(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetCursor,(self,) + _args, _kwargs)
+        return val
+    def WordPartLeft(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_WordPartLeft,(self,) + _args, _kwargs)
+        return val
+    def WordPartLeftExtend(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_WordPartLeftExtend,(self,) + _args, _kwargs)
+        return val
+    def WordPartRight(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_WordPartRight,(self,) + _args, _kwargs)
+        return val
+    def WordPartRightExtend(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_WordPartRightExtend,(self,) + _args, _kwargs)
+        return val
+    def SetVisiblePolicy(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetVisiblePolicy,(self,) + _args, _kwargs)
+        return val
+    def DelLineLeft(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_DelLineLeft,(self,) + _args, _kwargs)
+        return val
+    def DelLineRight(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_DelLineRight,(self,) + _args, _kwargs)
+        return val
     def StartRecord(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_StartRecord,(self,) + _args, _kwargs)
         return val
@@ -743,6 +888,9 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def SetKeyWords(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_SetKeyWords,(self,) + _args, _kwargs)
         return val
+    def SetLexerLanguage(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetLexerLanguage,(self,) + _args, _kwargs)
+        return val
     def GetCurrentLine(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_GetCurrentLine,(self,) + _args, _kwargs)
         return val
@@ -774,6 +922,9 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def ScrollToColumn(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_ScrollToColumn,(self,) + _args, _kwargs)
         return val
+    def SendMsg(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SendMsg,(self,) + _args, _kwargs)
+        return val
     def __repr__(self):
         return "<C wxStyledTextCtrl instance at %s>" % (self.this,)
 class wxStyledTextCtrl(wxStyledTextCtrlPtr):
@@ -833,6 +984,15 @@ class wxStyledTextEventPtr(wxCommandEventPtr):
     def SetLParam(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextEvent_SetLParam,(self,) + _args, _kwargs)
         return val
+    def SetListType(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextEvent_SetListType,(self,) + _args, _kwargs)
+        return val
+    def SetX(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextEvent_SetX,(self,) + _args, _kwargs)
+        return val
+    def SetY(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextEvent_SetY,(self,) + _args, _kwargs)
+        return val
     def GetPosition(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextEvent_GetPosition,(self,) + _args, _kwargs)
         return val
@@ -875,6 +1035,15 @@ class wxStyledTextEventPtr(wxCommandEventPtr):
     def GetLParam(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextEvent_GetLParam,(self,) + _args, _kwargs)
         return val
+    def GetListType(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextEvent_GetListType,(self,) + _args, _kwargs)
+        return val
+    def GetX(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextEvent_GetX,(self,) + _args, _kwargs)
+        return val
+    def GetY(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextEvent_GetY,(self,) + _args, _kwargs)
+        return val
     def GetShift(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextEvent_GetShift,(self,) + _args, _kwargs)
         return val
@@ -928,6 +1097,24 @@ wxSTC_MARK_EMPTY = stc_c.wxSTC_MARK_EMPTY
 wxSTC_MARK_ARROWDOWN = stc_c.wxSTC_MARK_ARROWDOWN
 wxSTC_MARK_MINUS = stc_c.wxSTC_MARK_MINUS
 wxSTC_MARK_PLUS = stc_c.wxSTC_MARK_PLUS
+wxSTC_MARK_VLINE = stc_c.wxSTC_MARK_VLINE
+wxSTC_MARK_LCORNER = stc_c.wxSTC_MARK_LCORNER
+wxSTC_MARK_TCORNER = stc_c.wxSTC_MARK_TCORNER
+wxSTC_MARK_BOXPLUS = stc_c.wxSTC_MARK_BOXPLUS
+wxSTC_MARK_BOXPLUSCONNECTED = stc_c.wxSTC_MARK_BOXPLUSCONNECTED
+wxSTC_MARK_BOXMINUS = stc_c.wxSTC_MARK_BOXMINUS
+wxSTC_MARK_BOXMINUSCONNECTED = stc_c.wxSTC_MARK_BOXMINUSCONNECTED
+wxSTC_MARK_LCORNERCURVE = stc_c.wxSTC_MARK_LCORNERCURVE
+wxSTC_MARK_TCORNERCURVE = stc_c.wxSTC_MARK_TCORNERCURVE
+wxSTC_MARK_CIRCLEPLUS = stc_c.wxSTC_MARK_CIRCLEPLUS
+wxSTC_MARK_CIRCLEPLUSCONNECTED = stc_c.wxSTC_MARK_CIRCLEPLUSCONNECTED
+wxSTC_MARK_CIRCLEMINUS = stc_c.wxSTC_MARK_CIRCLEMINUS
+wxSTC_MARK_CIRCLEMINUSCONNECTED = stc_c.wxSTC_MARK_CIRCLEMINUSCONNECTED
+wxSTC_MARKNUM_FOLDEREND = stc_c.wxSTC_MARKNUM_FOLDEREND
+wxSTC_MARKNUM_FOLDEROPENMID = stc_c.wxSTC_MARKNUM_FOLDEROPENMID
+wxSTC_MARKNUM_FOLDERMIDTAIL = stc_c.wxSTC_MARKNUM_FOLDERMIDTAIL
+wxSTC_MARKNUM_FOLDERTAIL = stc_c.wxSTC_MARKNUM_FOLDERTAIL
+wxSTC_MARKNUM_FOLDERSUB = stc_c.wxSTC_MARKNUM_FOLDERSUB
 wxSTC_MARKNUM_FOLDER = stc_c.wxSTC_MARKNUM_FOLDER
 wxSTC_MARKNUM_FOLDEROPEN = stc_c.wxSTC_MARKNUM_FOLDEROPEN
 wxSTC_MARGIN_SYMBOL = stc_c.wxSTC_MARGIN_SYMBOL
@@ -958,6 +1145,9 @@ wxSTC_CHARSET_HEBREW = stc_c.wxSTC_CHARSET_HEBREW
 wxSTC_CHARSET_ARABIC = stc_c.wxSTC_CHARSET_ARABIC
 wxSTC_CHARSET_VIETNAMESE = stc_c.wxSTC_CHARSET_VIETNAMESE
 wxSTC_CHARSET_THAI = stc_c.wxSTC_CHARSET_THAI
+wxSTC_CASE_MIXED = stc_c.wxSTC_CASE_MIXED
+wxSTC_CASE_UPPER = stc_c.wxSTC_CASE_UPPER
+wxSTC_CASE_LOWER = stc_c.wxSTC_CASE_LOWER
 wxSTC_INDIC_MAX = stc_c.wxSTC_INDIC_MAX
 wxSTC_INDIC_PLAIN = stc_c.wxSTC_INDIC_PLAIN
 wxSTC_INDIC_SQUIGGLE = stc_c.wxSTC_INDIC_SQUIGGLE
@@ -971,7 +1161,8 @@ wxSTC_INDICS_MASK = stc_c.wxSTC_INDICS_MASK
 wxSTC_PRINT_NORMAL = stc_c.wxSTC_PRINT_NORMAL
 wxSTC_PRINT_INVERTLIGHT = stc_c.wxSTC_PRINT_INVERTLIGHT
 wxSTC_PRINT_BLACKONWHITE = stc_c.wxSTC_PRINT_BLACKONWHITE
-wxSTC_FIND_DOWN = stc_c.wxSTC_FIND_DOWN
+wxSTC_PRINT_COLOURONWHITE = stc_c.wxSTC_PRINT_COLOURONWHITE
+wxSTC_PRINT_COLOURONWHITEDEFAULTBG = stc_c.wxSTC_PRINT_COLOURONWHITEDEFAULTBG
 wxSTC_FIND_WHOLEWORD = stc_c.wxSTC_FIND_WHOLEWORD
 wxSTC_FIND_MATCHCASE = stc_c.wxSTC_FIND_MATCHCASE
 wxSTC_FIND_WORDSTART = stc_c.wxSTC_FIND_WORDSTART
@@ -984,6 +1175,7 @@ wxSTC_FOLDLEVELBASE = stc_c.wxSTC_FOLDLEVELBASE
 wxSTC_FOLDLEVELWHITEFLAG = stc_c.wxSTC_FOLDLEVELWHITEFLAG
 wxSTC_FOLDLEVELHEADERFLAG = stc_c.wxSTC_FOLDLEVELHEADERFLAG
 wxSTC_FOLDLEVELNUMBERMASK = stc_c.wxSTC_FOLDLEVELNUMBERMASK
+wxSTC_TIME_FOREVER = stc_c.wxSTC_TIME_FOREVER
 wxSTC_CMD_LINEDOWN = stc_c.wxSTC_CMD_LINEDOWN
 wxSTC_CMD_LINEDOWNEXTEND = stc_c.wxSTC_CMD_LINEDOWNEXTEND
 wxSTC_CMD_LINEUP = stc_c.wxSTC_CMD_LINEUP
@@ -1034,6 +1226,12 @@ wxSTC_EDGE_BACKGROUND = stc_c.wxSTC_EDGE_BACKGROUND
 wxSTC_CARET_SLOP = stc_c.wxSTC_CARET_SLOP
 wxSTC_CARET_CENTER = stc_c.wxSTC_CARET_CENTER
 wxSTC_CARET_STRICT = stc_c.wxSTC_CARET_STRICT
+wxSTC_CARET_XEVEN = stc_c.wxSTC_CARET_XEVEN
+wxSTC_CARET_XJUMPS = stc_c.wxSTC_CARET_XJUMPS
+wxSTC_CURSORNORMAL = stc_c.wxSTC_CURSORNORMAL
+wxSTC_CURSORWAIT = stc_c.wxSTC_CURSORWAIT
+wxSTC_VISIBLE_SLOP = stc_c.wxSTC_VISIBLE_SLOP
+wxSTC_VISIBLE_STRICT = stc_c.wxSTC_VISIBLE_STRICT
 wxSTC_MOD_INSERTTEXT = stc_c.wxSTC_MOD_INSERTTEXT
 wxSTC_MOD_DELETETEXT = stc_c.wxSTC_MOD_DELETETEXT
 wxSTC_MOD_CHANGESTYLE = stc_c.wxSTC_MOD_CHANGESTYLE
@@ -1083,6 +1281,16 @@ wxSTC_LEX_XCODE = stc_c.wxSTC_LEX_XCODE
 wxSTC_LEX_LATEX = stc_c.wxSTC_LEX_LATEX
 wxSTC_LEX_LUA = stc_c.wxSTC_LEX_LUA
 wxSTC_LEX_DIFF = stc_c.wxSTC_LEX_DIFF
+wxSTC_LEX_CONF = stc_c.wxSTC_LEX_CONF
+wxSTC_LEX_PASCAL = stc_c.wxSTC_LEX_PASCAL
+wxSTC_LEX_AVE = stc_c.wxSTC_LEX_AVE
+wxSTC_LEX_ADA = stc_c.wxSTC_LEX_ADA
+wxSTC_LEX_LISP = stc_c.wxSTC_LEX_LISP
+wxSTC_LEX_RUBY = stc_c.wxSTC_LEX_RUBY
+wxSTC_LEX_EIFFEL = stc_c.wxSTC_LEX_EIFFEL
+wxSTC_LEX_EIFFELKW = stc_c.wxSTC_LEX_EIFFELKW
+wxSTC_LEX_TCL = stc_c.wxSTC_LEX_TCL
+wxSTC_LEX_AUTOMATIC = stc_c.wxSTC_LEX_AUTOMATIC
 wxSTC_P_DEFAULT = stc_c.wxSTC_P_DEFAULT
 wxSTC_P_COMMENTLINE = stc_c.wxSTC_P_COMMENTLINE
 wxSTC_P_NUMBER = stc_c.wxSTC_P_NUMBER
@@ -1111,6 +1319,9 @@ wxSTC_C_OPERATOR = stc_c.wxSTC_C_OPERATOR
 wxSTC_C_IDENTIFIER = stc_c.wxSTC_C_IDENTIFIER
 wxSTC_C_STRINGEOL = stc_c.wxSTC_C_STRINGEOL
 wxSTC_C_VERBATIM = stc_c.wxSTC_C_VERBATIM
+wxSTC_C_REGEX = stc_c.wxSTC_C_REGEX
+wxSTC_C_COMMENTLINEDOC = stc_c.wxSTC_C_COMMENTLINEDOC
+wxSTC_C_WORD2 = stc_c.wxSTC_C_WORD2
 wxSTC_H_DEFAULT = stc_c.wxSTC_H_DEFAULT
 wxSTC_H_TAG = stc_c.wxSTC_H_TAG
 wxSTC_H_TAGUNKNOWN = stc_c.wxSTC_H_TAGUNKNOWN
@@ -1131,6 +1342,8 @@ wxSTC_H_ASPAT = stc_c.wxSTC_H_ASPAT
 wxSTC_H_CDATA = stc_c.wxSTC_H_CDATA
 wxSTC_H_QUESTION = stc_c.wxSTC_H_QUESTION
 wxSTC_H_VALUE = stc_c.wxSTC_H_VALUE
+wxSTC_H_XCCOMMENT = stc_c.wxSTC_H_XCCOMMENT
+wxSTC_H_SGML = stc_c.wxSTC_H_SGML
 wxSTC_HJ_START = stc_c.wxSTC_HJ_START
 wxSTC_HJ_DEFAULT = stc_c.wxSTC_HJ_DEFAULT
 wxSTC_HJ_COMMENT = stc_c.wxSTC_HJ_COMMENT
@@ -1143,6 +1356,7 @@ wxSTC_HJ_DOUBLESTRING = stc_c.wxSTC_HJ_DOUBLESTRING
 wxSTC_HJ_SINGLESTRING = stc_c.wxSTC_HJ_SINGLESTRING
 wxSTC_HJ_SYMBOLS = stc_c.wxSTC_HJ_SYMBOLS
 wxSTC_HJ_STRINGEOL = stc_c.wxSTC_HJ_STRINGEOL
+wxSTC_HJ_REGEX = stc_c.wxSTC_HJ_REGEX
 wxSTC_HJA_START = stc_c.wxSTC_HJA_START
 wxSTC_HJA_DEFAULT = stc_c.wxSTC_HJA_DEFAULT
 wxSTC_HJA_COMMENT = stc_c.wxSTC_HJA_COMMENT
@@ -1155,6 +1369,7 @@ wxSTC_HJA_DOUBLESTRING = stc_c.wxSTC_HJA_DOUBLESTRING
 wxSTC_HJA_SINGLESTRING = stc_c.wxSTC_HJA_SINGLESTRING
 wxSTC_HJA_SYMBOLS = stc_c.wxSTC_HJA_SYMBOLS
 wxSTC_HJA_STRINGEOL = stc_c.wxSTC_HJA_STRINGEOL
+wxSTC_HJA_REGEX = stc_c.wxSTC_HJA_REGEX
 wxSTC_HB_START = stc_c.wxSTC_HB_START
 wxSTC_HB_DEFAULT = stc_c.wxSTC_HB_DEFAULT
 wxSTC_HB_COMMENTLINE = stc_c.wxSTC_HB_COMMENTLINE
@@ -1205,9 +1420,10 @@ wxSTC_HPHP_NUMBER = stc_c.wxSTC_HPHP_NUMBER
 wxSTC_HPHP_VARIABLE = stc_c.wxSTC_HPHP_VARIABLE
 wxSTC_HPHP_COMMENT = stc_c.wxSTC_HPHP_COMMENT
 wxSTC_HPHP_COMMENTLINE = stc_c.wxSTC_HPHP_COMMENTLINE
-wxSTC_HPHP_STRINGEOL = stc_c.wxSTC_HPHP_STRINGEOL
+wxSTC_HPHP_HSTRING_VARIABLE = stc_c.wxSTC_HPHP_HSTRING_VARIABLE
+wxSTC_HPHP_OPERATOR = stc_c.wxSTC_HPHP_OPERATOR
 wxSTC_PL_DEFAULT = stc_c.wxSTC_PL_DEFAULT
-wxSTC_PL_HERE = stc_c.wxSTC_PL_HERE
+wxSTC_PL_ERROR = stc_c.wxSTC_PL_ERROR
 wxSTC_PL_COMMENTLINE = stc_c.wxSTC_PL_COMMENTLINE
 wxSTC_PL_POD = stc_c.wxSTC_PL_POD
 wxSTC_PL_NUMBER = stc_c.wxSTC_PL_NUMBER
@@ -1222,12 +1438,20 @@ wxSTC_PL_SCALAR = stc_c.wxSTC_PL_SCALAR
 wxSTC_PL_ARRAY = stc_c.wxSTC_PL_ARRAY
 wxSTC_PL_HASH = stc_c.wxSTC_PL_HASH
 wxSTC_PL_SYMBOLTABLE = stc_c.wxSTC_PL_SYMBOLTABLE
-wxSTC_PL_REF = stc_c.wxSTC_PL_REF
 wxSTC_PL_REGEX = stc_c.wxSTC_PL_REGEX
 wxSTC_PL_REGSUBST = stc_c.wxSTC_PL_REGSUBST
 wxSTC_PL_LONGQUOTE = stc_c.wxSTC_PL_LONGQUOTE
 wxSTC_PL_BACKTICKS = stc_c.wxSTC_PL_BACKTICKS
 wxSTC_PL_DATASECTION = stc_c.wxSTC_PL_DATASECTION
+wxSTC_PL_HERE_DELIM = stc_c.wxSTC_PL_HERE_DELIM
+wxSTC_PL_HERE_Q = stc_c.wxSTC_PL_HERE_Q
+wxSTC_PL_HERE_QQ = stc_c.wxSTC_PL_HERE_QQ
+wxSTC_PL_HERE_QX = stc_c.wxSTC_PL_HERE_QX
+wxSTC_PL_STRING_Q = stc_c.wxSTC_PL_STRING_Q
+wxSTC_PL_STRING_QQ = stc_c.wxSTC_PL_STRING_QQ
+wxSTC_PL_STRING_QX = stc_c.wxSTC_PL_STRING_QX
+wxSTC_PL_STRING_QR = stc_c.wxSTC_PL_STRING_QR
+wxSTC_PL_STRING_QW = stc_c.wxSTC_PL_STRING_QW
 wxSTC_L_DEFAULT = stc_c.wxSTC_L_DEFAULT
 wxSTC_L_COMMAND = stc_c.wxSTC_L_COMMAND
 wxSTC_L_TAG = stc_c.wxSTC_L_TAG
@@ -1253,22 +1477,95 @@ wxSTC_ERR_MS = stc_c.wxSTC_ERR_MS
 wxSTC_ERR_CMD = stc_c.wxSTC_ERR_CMD
 wxSTC_ERR_BORLAND = stc_c.wxSTC_ERR_BORLAND
 wxSTC_ERR_PERL = stc_c.wxSTC_ERR_PERL
+wxSTC_ERR_NET = stc_c.wxSTC_ERR_NET
+wxSTC_ERR_LUA = stc_c.wxSTC_ERR_LUA
+wxSTC_ERR_DIFF_CHANGED = stc_c.wxSTC_ERR_DIFF_CHANGED
+wxSTC_ERR_DIFF_ADDITION = stc_c.wxSTC_ERR_DIFF_ADDITION
+wxSTC_ERR_DIFF_DELETION = stc_c.wxSTC_ERR_DIFF_DELETION
+wxSTC_ERR_DIFF_MESSAGE = stc_c.wxSTC_ERR_DIFF_MESSAGE
+wxSTC_BAT_DEFAULT = stc_c.wxSTC_BAT_DEFAULT
+wxSTC_BAT_COMMENT = stc_c.wxSTC_BAT_COMMENT
+wxSTC_BAT_WORD = stc_c.wxSTC_BAT_WORD
+wxSTC_BAT_LABEL = stc_c.wxSTC_BAT_LABEL
+wxSTC_BAT_HIDE = stc_c.wxSTC_BAT_HIDE
+wxSTC_BAT_COMMAND = stc_c.wxSTC_BAT_COMMAND
+wxSTC_BAT_IDENTIFIER = stc_c.wxSTC_BAT_IDENTIFIER
+wxSTC_BAT_OPERATOR = stc_c.wxSTC_BAT_OPERATOR
+wxSTC_MAKE_DEFAULT = stc_c.wxSTC_MAKE_DEFAULT
+wxSTC_MAKE_COMMENT = stc_c.wxSTC_MAKE_COMMENT
+wxSTC_MAKE_PREPROCESSOR = stc_c.wxSTC_MAKE_PREPROCESSOR
+wxSTC_MAKE_IDENTIFIER = stc_c.wxSTC_MAKE_IDENTIFIER
+wxSTC_MAKE_OPERATOR = stc_c.wxSTC_MAKE_OPERATOR
+wxSTC_MAKE_TARGET = stc_c.wxSTC_MAKE_TARGET
+wxSTC_MAKE_IDEOL = stc_c.wxSTC_MAKE_IDEOL
+wxSTC_CONF_DEFAULT = stc_c.wxSTC_CONF_DEFAULT
+wxSTC_CONF_COMMENT = stc_c.wxSTC_CONF_COMMENT
+wxSTC_CONF_NUMBER = stc_c.wxSTC_CONF_NUMBER
+wxSTC_CONF_IDENTIFIER = stc_c.wxSTC_CONF_IDENTIFIER
+wxSTC_CONF_EXTENSION = stc_c.wxSTC_CONF_EXTENSION
+wxSTC_CONF_PARAMETER = stc_c.wxSTC_CONF_PARAMETER
+wxSTC_CONF_STRING = stc_c.wxSTC_CONF_STRING
+wxSTC_CONF_OPERATOR = stc_c.wxSTC_CONF_OPERATOR
+wxSTC_CONF_IP = stc_c.wxSTC_CONF_IP
+wxSTC_CONF_DIRECTIVE = stc_c.wxSTC_CONF_DIRECTIVE
+wxSTC_AVE_DEFAULT = stc_c.wxSTC_AVE_DEFAULT
+wxSTC_AVE_COMMENT = stc_c.wxSTC_AVE_COMMENT
+wxSTC_AVE_NUMBER = stc_c.wxSTC_AVE_NUMBER
+wxSTC_AVE_WORD = stc_c.wxSTC_AVE_WORD
+wxSTC_AVE_KEYWORD = stc_c.wxSTC_AVE_KEYWORD
+wxSTC_AVE_STATEMENT = stc_c.wxSTC_AVE_STATEMENT
+wxSTC_AVE_STRING = stc_c.wxSTC_AVE_STRING
+wxSTC_AVE_ENUM = stc_c.wxSTC_AVE_ENUM
+wxSTC_AVE_STRINGEOL = stc_c.wxSTC_AVE_STRINGEOL
+wxSTC_AVE_IDENTIFIER = stc_c.wxSTC_AVE_IDENTIFIER
+wxSTC_AVE_OPERATOR = stc_c.wxSTC_AVE_OPERATOR
+wxSTC_ADA_DEFAULT = stc_c.wxSTC_ADA_DEFAULT
+wxSTC_ADA_COMMENT = stc_c.wxSTC_ADA_COMMENT
+wxSTC_ADA_NUMBER = stc_c.wxSTC_ADA_NUMBER
+wxSTC_ADA_WORD = stc_c.wxSTC_ADA_WORD
+wxSTC_ADA_STRING = stc_c.wxSTC_ADA_STRING
+wxSTC_ADA_CHARACTER = stc_c.wxSTC_ADA_CHARACTER
+wxSTC_ADA_OPERATOR = stc_c.wxSTC_ADA_OPERATOR
+wxSTC_ADA_IDENTIFIER = stc_c.wxSTC_ADA_IDENTIFIER
+wxSTC_ADA_STRINGEOL = stc_c.wxSTC_ADA_STRINGEOL
+wxSTC_LISP_DEFAULT = stc_c.wxSTC_LISP_DEFAULT
+wxSTC_LISP_COMMENT = stc_c.wxSTC_LISP_COMMENT
+wxSTC_LISP_NUMBER = stc_c.wxSTC_LISP_NUMBER
+wxSTC_LISP_KEYWORD = stc_c.wxSTC_LISP_KEYWORD
+wxSTC_LISP_STRING = stc_c.wxSTC_LISP_STRING
+wxSTC_LISP_STRINGEOL = stc_c.wxSTC_LISP_STRINGEOL
+wxSTC_LISP_IDENTIFIER = stc_c.wxSTC_LISP_IDENTIFIER
+wxSTC_LISP_OPERATOR = stc_c.wxSTC_LISP_OPERATOR
+wxSTC_EIFFEL_DEFAULT = stc_c.wxSTC_EIFFEL_DEFAULT
+wxSTC_EIFFEL_COMMENTLINE = stc_c.wxSTC_EIFFEL_COMMENTLINE
+wxSTC_EIFFEL_NUMBER = stc_c.wxSTC_EIFFEL_NUMBER
+wxSTC_EIFFEL_WORD = stc_c.wxSTC_EIFFEL_WORD
+wxSTC_EIFFEL_STRING = stc_c.wxSTC_EIFFEL_STRING
+wxSTC_EIFFEL_CHARACTER = stc_c.wxSTC_EIFFEL_CHARACTER
+wxSTC_EIFFEL_OPERATOR = stc_c.wxSTC_EIFFEL_OPERATOR
+wxSTC_EIFFEL_IDENTIFIER = stc_c.wxSTC_EIFFEL_IDENTIFIER
+wxSTC_EIFFEL_STRINGEOL = stc_c.wxSTC_EIFFEL_STRINGEOL
 wxSTC_MASK_FOLDERS = stc_c.wxSTC_MASK_FOLDERS
 wxSTCNameStr = stc_c.wxSTCNameStr
 wxEVT_STC_CHANGE = stc_c.wxEVT_STC_CHANGE
 wxEVT_STC_STYLENEEDED = stc_c.wxEVT_STC_STYLENEEDED
 wxEVT_STC_CHARADDED = stc_c.wxEVT_STC_CHARADDED
-wxEVT_STC_UPDATEUI = stc_c.wxEVT_STC_UPDATEUI
 wxEVT_STC_SAVEPOINTREACHED = stc_c.wxEVT_STC_SAVEPOINTREACHED
 wxEVT_STC_SAVEPOINTLEFT = stc_c.wxEVT_STC_SAVEPOINTLEFT
 wxEVT_STC_ROMODIFYATTEMPT = stc_c.wxEVT_STC_ROMODIFYATTEMPT
+wxEVT_STC_KEY = stc_c.wxEVT_STC_KEY
 wxEVT_STC_DOUBLECLICK = stc_c.wxEVT_STC_DOUBLECLICK
+wxEVT_STC_UPDATEUI = stc_c.wxEVT_STC_UPDATEUI
 wxEVT_STC_MODIFIED = stc_c.wxEVT_STC_MODIFIED
-wxEVT_STC_KEY = stc_c.wxEVT_STC_KEY
 wxEVT_STC_MACRORECORD = stc_c.wxEVT_STC_MACRORECORD
 wxEVT_STC_MARGINCLICK = stc_c.wxEVT_STC_MARGINCLICK
 wxEVT_STC_NEEDSHOWN = stc_c.wxEVT_STC_NEEDSHOWN
 wxEVT_STC_POSCHANGED = stc_c.wxEVT_STC_POSCHANGED
+wxEVT_STC_PAINTED = stc_c.wxEVT_STC_PAINTED
+wxEVT_STC_USERLISTSELECTION = stc_c.wxEVT_STC_USERLISTSELECTION
+wxEVT_STC_URIDROPPED = stc_c.wxEVT_STC_URIDROPPED
+wxEVT_STC_DWELLSTART = stc_c.wxEVT_STC_DWELLSTART
+wxEVT_STC_DWELLEND = stc_c.wxEVT_STC_DWELLEND
 
 
 #-------------- USER INCLUDE -----------------------
diff --git a/wxPython/demo/data/stc.h b/wxPython/demo/data/stc.h
deleted file mode 100644 (file)
index fc07f2f..0000000
+++ /dev/null
@@ -1,1396 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-// Name:        stc.h
-// Purpose:     A wxWindows implementation of Scintilla.  This class is the
-//              one meant to be used directly by wx applications.  It does not
-//              derive directly from the Scintilla classes, and in fact there
-//              is no mention of Scintilla classes at all in this header.
-//              This class delegates all method calls and events to the
-//              Scintilla objects and so forth.  This allows the use of
-//              Scintilla without polluting the namespace with all the
-//              classes and itentifiers from Scintilla.
-//
-// Author:      Robin Dunn
-//
-// Created:     13-Jan-2000
-// RCS-ID:      $Id$
-// Copyright:   (c) 2000 by Total Control Software
-// Licence:     wxWindows license
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef __stc_h__
-#define __stc_h__
-
-
-#include <wx/wx.h>
-
-//----------------------------------------------------------------------
-// BEGIN generated section.  The following code is automatically generated
-//       by gen_iface.py.  Do not edit this file.  Edit stc.h.in instead
-//       and regenerate
-
-#define wxSTC_INVALID_POSITION -1
-#define wxSTC_START 2000
-#define wxSTC_OPTIONAL_START 3000
-#define wxSTC_LEXER_START 4000
-#define wxSTC_CMD_REDO 2011
-#define wxSTC_CMD_SELECTALL 2013
-#define wxSTC_WS_INVISIBLE 0
-#define wxSTC_WS_VISIBLEALWAYS 1
-#define wxSTC_WS_VISIBLEAFTERINDENT 2
-#define wxSTC_EOL_CRLF 0
-#define wxSTC_EOL_CR 1
-#define wxSTC_EOL_LF 2
-
-// The SC_CP_UTF8 value can be used to enter Unicode mode.
-// This is the same value as CP_UTF8 in Windows
-#define wxSTC_CP_UTF8 65001
-#define wxSTC_MARKER_MAX 31
-#define wxSTC_MARK_CIRCLE 0
-#define wxSTC_MARK_ROUNDRECT 1
-#define wxSTC_MARK_ARROW 2
-#define wxSTC_MARK_SMALLRECT 3
-#define wxSTC_MARK_SHORTARROW 4
-#define wxSTC_MARK_EMPTY 5
-#define wxSTC_MARK_ARROWDOWN 6
-#define wxSTC_MARK_MINUS 7
-#define wxSTC_MARK_PLUS 8
-#define wxSTC_MARKNUM_FOLDER 30
-#define wxSTC_MARKNUM_FOLDEROPEN 31
-#define wxSTC_MARGIN_SYMBOL 0
-#define wxSTC_MARGIN_NUMBER 1
-#define wxSTC_STYLE_DEFAULT 32
-#define wxSTC_STYLE_LINENUMBER 33
-#define wxSTC_STYLE_BRACELIGHT 34
-#define wxSTC_STYLE_BRACEBAD 35
-#define wxSTC_STYLE_CONTROLCHAR 36
-#define wxSTC_STYLE_INDENTGUIDE 37
-#define wxSTC_STYLE_MAX 127
-
-// Character set identifiers are used in StyleSetCharacterSet.
-// The values are the same as the Windows *_CHARSET values.
-#define wxSTC_CHARSET_ANSI 0
-#define wxSTC_CHARSET_DEFAULT 1
-#define wxSTC_CHARSET_BALTIC 186
-#define wxSTC_CHARSET_CHINESEBIG5 136
-#define wxSTC_CHARSET_EASTEUROPE 238
-#define wxSTC_CHARSET_GB2312 134
-#define wxSTC_CHARSET_GREEK 161
-#define wxSTC_CHARSET_HANGUL 129
-#define wxSTC_CHARSET_MAC 77
-#define wxSTC_CHARSET_OEM 255
-#define wxSTC_CHARSET_RUSSIAN 204
-#define wxSTC_CHARSET_SHIFTJIS 128
-#define wxSTC_CHARSET_SYMBOL 2
-#define wxSTC_CHARSET_TURKISH 162
-#define wxSTC_CHARSET_JOHAB 130
-#define wxSTC_CHARSET_HEBREW 177
-#define wxSTC_CHARSET_ARABIC 178
-#define wxSTC_CHARSET_VIETNAMESE 163
-#define wxSTC_CHARSET_THAI 222
-#define wxSTC_INDIC_MAX 7
-#define wxSTC_INDIC_PLAIN 0
-#define wxSTC_INDIC_SQUIGGLE 1
-#define wxSTC_INDIC_TT 2
-#define wxSTC_INDIC_DIAGONAL 3
-#define wxSTC_INDIC_STRIKE 4
-#define wxSTC_INDIC0_MASK 32
-#define wxSTC_INDIC1_MASK 64
-#define wxSTC_INDIC2_MASK 128
-#define wxSTC_INDICS_MASK 32 | 64 | 128
-
-// PrintColourMode - use same colours as screen.
-#define wxSTC_PRINT_NORMAL 0
-
-// PrintColourMode - invert the light value of each style for printing.
-#define wxSTC_PRINT_INVERTLIGHT 1
-
-// PrintColourMode - force black text on white background for printing.
-#define wxSTC_PRINT_BLACKONWHITE 2
-#define wxSTC_FIND_DOWN 1
-#define wxSTC_FIND_WHOLEWORD 2
-#define wxSTC_FIND_MATCHCASE 4
-#define wxSTC_FIND_WORDSTART 0x00100000
-
-// SCFIND_REGEXP is not yet implemented.
-#define wxSTC_FIND_REGEXP 0x00200000
-#define wxSTC_CMD_UNDO 2176
-#define wxSTC_CMD_CUT 2177
-#define wxSTC_CMD_COPY 2178
-#define wxSTC_CMD_PASTE 2179
-#define wxSTC_FOLDLEVELBASE 0x400
-#define wxSTC_FOLDLEVELWHITEFLAG 0x1000
-#define wxSTC_FOLDLEVELHEADERFLAG 0x2000
-#define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF
-#define wxSTC_CMD_LINEDOWN 2300
-#define wxSTC_CMD_LINEDOWNEXTEND 2301
-#define wxSTC_CMD_LINEUP 2302
-#define wxSTC_CMD_LINEUPEXTEND 2303
-#define wxSTC_CMD_CHARLEFT 2304
-#define wxSTC_CMD_CHARLEFTEXTEND 2305
-#define wxSTC_CMD_CHARRIGHT 2306
-#define wxSTC_CMD_CHARRIGHTEXTEND 2307
-#define wxSTC_CMD_WORDLEFT 2308
-#define wxSTC_CMD_WORDLEFTEXTEND 2309
-#define wxSTC_CMD_WORDRIGHT 2310
-#define wxSTC_CMD_WORDRIGHTEXTEND 2311
-#define wxSTC_CMD_HOME 2312
-#define wxSTC_CMD_HOMEEXTEND 2313
-#define wxSTC_CMD_LINEEND 2314
-#define wxSTC_CMD_LINEENDEXTEND 2315
-#define wxSTC_CMD_DOCUMENTSTART 2316
-#define wxSTC_CMD_DOCUMENTSTARTEXTEND 2317
-#define wxSTC_CMD_DOCUMENTEND 2318
-#define wxSTC_CMD_DOCUMENTENDEXTEND 2319
-#define wxSTC_CMD_PAGEUP 2320
-#define wxSTC_CMD_PAGEUPEXTEND 2321
-#define wxSTC_CMD_PAGEDOWN 2322
-#define wxSTC_CMD_PAGEDOWNEXTEND 2323
-#define wxSTC_CMD_EDITTOGGLEOVERTYPE 2324
-#define wxSTC_CMD_CANCEL 2325
-#define wxSTC_CMD_DELETEBACK 2326
-#define wxSTC_CMD_TAB 2327
-#define wxSTC_CMD_BACKTAB 2328
-#define wxSTC_CMD_NEWLINE 2329
-#define wxSTC_CMD_FORMFEED 2330
-#define wxSTC_CMD_VCHOME 2331
-#define wxSTC_CMD_VCHOMEEXTEND 2332
-#define wxSTC_CMD_ZOOMIN 2333
-#define wxSTC_CMD_ZOOMOUT 2334
-#define wxSTC_CMD_DELWORDLEFT 2335
-#define wxSTC_CMD_DELWORDRIGHT 2336
-#define wxSTC_CMD_LINECUT 2337
-#define wxSTC_CMD_LINEDELETE 2338
-#define wxSTC_CMD_LINETRANSPOSE 2339
-#define wxSTC_CMD_LOWERCASE 2340
-#define wxSTC_CMD_UPPERCASE 2341
-#define wxSTC_CMD_LINESCROLLDOWN 2342
-#define wxSTC_CMD_LINESCROLLUP 2343
-#define wxSTC_EDGE_NONE 0
-#define wxSTC_EDGE_LINE 1
-#define wxSTC_EDGE_BACKGROUND 2
-
-// Show caret within N lines of edge when it's scrolled to view
-#define wxSTC_CARET_SLOP 0x01
-
-// Center caret on screen when it's scrolled to view
-#define wxSTC_CARET_CENTER 0x02
-
-// OR this with CARET_CENTER to reposition even when visible, or
-// OR this with CARET_SLOP to reposition whenever outside slop border
-#define wxSTC_CARET_STRICT 0x04
-
-// Notifications
-// Type of modification and the action which caused the modification
-// These are defined as a bit mask to make it easy to specify which notifications are wanted.
-// One bit is set from each of SC_MOD_* and SC_PERFORMED_*.
-#define wxSTC_MOD_INSERTTEXT 0x1
-#define wxSTC_MOD_DELETETEXT 0x2
-#define wxSTC_MOD_CHANGESTYLE 0x4
-#define wxSTC_MOD_CHANGEFOLD 0x8
-#define wxSTC_PERFORMED_USER 0x10
-#define wxSTC_PERFORMED_UNDO 0x20
-#define wxSTC_PERFORMED_REDO 0x40
-#define wxSTC_LASTSTEPINUNDOREDO 0x100
-#define wxSTC_MOD_CHANGEMARKER 0x200
-#define wxSTC_MOD_BEFOREINSERT 0x400
-#define wxSTC_MOD_BEFOREDELETE 0x800
-#define wxSTC_MODEVENTMASKALL 0xF77
-
-// Symbolic key codes and modifier flags
-// ASCII and other printable characters below 256
-// Extended keys above 300
-#define wxSTC_KEY_DOWN 300
-#define wxSTC_KEY_UP 301
-#define wxSTC_KEY_LEFT 302
-#define wxSTC_KEY_RIGHT 303
-#define wxSTC_KEY_HOME 304
-#define wxSTC_KEY_END 305
-#define wxSTC_KEY_PRIOR 306
-#define wxSTC_KEY_NEXT 307
-#define wxSTC_KEY_DELETE 308
-#define wxSTC_KEY_INSERT 309
-#define wxSTC_KEY_ESCAPE 7
-#define wxSTC_KEY_BACK 8
-#define wxSTC_KEY_TAB 9
-#define wxSTC_KEY_RETURN 13
-#define wxSTC_KEY_ADD 310
-#define wxSTC_KEY_SUBTRACT 311
-#define wxSTC_KEY_DIVIDE 312
-#define wxSTC_SCMOD_SHIFT 1
-#define wxSTC_SCMOD_CTRL 2
-#define wxSTC_SCMOD_ALT 4
-
-// For SciLexer.h
-#define wxSTC_LEX_CONTAINER 0
-#define wxSTC_LEX_NULL 1
-#define wxSTC_LEX_PYTHON 2
-#define wxSTC_LEX_CPP 3
-#define wxSTC_LEX_HTML 4
-#define wxSTC_LEX_XML 5
-#define wxSTC_LEX_PERL 6
-#define wxSTC_LEX_SQL 7
-#define wxSTC_LEX_VB 8
-#define wxSTC_LEX_PROPERTIES 9
-#define wxSTC_LEX_ERRORLIST 10
-#define wxSTC_LEX_MAKEFILE 11
-#define wxSTC_LEX_BATCH 12
-#define wxSTC_LEX_XCODE 13
-#define wxSTC_LEX_LATEX 14
-#define wxSTC_LEX_LUA 15
-#define wxSTC_LEX_DIFF 16
-
-// Lexical states for SCLEX_PYTHON
-#define wxSTC_P_DEFAULT 0
-#define wxSTC_P_COMMENTLINE 1
-#define wxSTC_P_NUMBER 2
-#define wxSTC_P_STRING 3
-#define wxSTC_P_CHARACTER 4
-#define wxSTC_P_WORD 5
-#define wxSTC_P_TRIPLE 6
-#define wxSTC_P_TRIPLEDOUBLE 7
-#define wxSTC_P_CLASSNAME 8
-#define wxSTC_P_DEFNAME 9
-#define wxSTC_P_OPERATOR 10
-#define wxSTC_P_IDENTIFIER 11
-#define wxSTC_P_COMMENTBLOCK 12
-#define wxSTC_P_STRINGEOL 13
-
-// Lexical states for SCLEX_CPP, SCLEX_VB
-#define wxSTC_C_DEFAULT 0
-#define wxSTC_C_COMMENT 1
-#define wxSTC_C_COMMENTLINE 2
-#define wxSTC_C_COMMENTDOC 3
-#define wxSTC_C_NUMBER 4
-#define wxSTC_C_WORD 5
-#define wxSTC_C_STRING 6
-#define wxSTC_C_CHARACTER 7
-#define wxSTC_C_UUID 8
-#define wxSTC_C_PREPROCESSOR 9
-#define wxSTC_C_OPERATOR 10
-#define wxSTC_C_IDENTIFIER 11
-#define wxSTC_C_STRINGEOL 12
-#define wxSTC_C_VERBATIM 13
-
-// Lexical states for SCLEX_HTML, SCLEX_XML
-#define wxSTC_H_DEFAULT 0
-#define wxSTC_H_TAG 1
-#define wxSTC_H_TAGUNKNOWN 2
-#define wxSTC_H_ATTRIBUTE 3
-#define wxSTC_H_ATTRIBUTEUNKNOWN 4
-#define wxSTC_H_NUMBER 5
-#define wxSTC_H_DOUBLESTRING 6
-#define wxSTC_H_SINGLESTRING 7
-#define wxSTC_H_OTHER 8
-#define wxSTC_H_COMMENT 9
-#define wxSTC_H_ENTITY 10
-
-// XML and ASP
-#define wxSTC_H_TAGEND 11
-#define wxSTC_H_XMLSTART 12
-#define wxSTC_H_XMLEND 13
-#define wxSTC_H_SCRIPT 14
-#define wxSTC_H_ASP 15
-#define wxSTC_H_ASPAT 16
-#define wxSTC_H_CDATA 17
-#define wxSTC_H_QUESTION 18
-
-// More HTML
-#define wxSTC_H_VALUE 19
-
-// Embedded Javascript
-#define wxSTC_HJ_START 40
-#define wxSTC_HJ_DEFAULT 41
-#define wxSTC_HJ_COMMENT 42
-#define wxSTC_HJ_COMMENTLINE 43
-#define wxSTC_HJ_COMMENTDOC 44
-#define wxSTC_HJ_NUMBER 45
-#define wxSTC_HJ_WORD 46
-#define wxSTC_HJ_KEYWORD 47
-#define wxSTC_HJ_DOUBLESTRING 48
-#define wxSTC_HJ_SINGLESTRING 49
-#define wxSTC_HJ_SYMBOLS 50
-#define wxSTC_HJ_STRINGEOL 51
-
-// ASP Javascript
-#define wxSTC_HJA_START 55
-#define wxSTC_HJA_DEFAULT 56
-#define wxSTC_HJA_COMMENT 57
-#define wxSTC_HJA_COMMENTLINE 58
-#define wxSTC_HJA_COMMENTDOC 59
-#define wxSTC_HJA_NUMBER 60
-#define wxSTC_HJA_WORD 61
-#define wxSTC_HJA_KEYWORD 62
-#define wxSTC_HJA_DOUBLESTRING 63
-#define wxSTC_HJA_SINGLESTRING 64
-#define wxSTC_HJA_SYMBOLS 65
-#define wxSTC_HJA_STRINGEOL 66
-
-// Embedded VBScript
-#define wxSTC_HB_START 70
-#define wxSTC_HB_DEFAULT 71
-#define wxSTC_HB_COMMENTLINE 72
-#define wxSTC_HB_NUMBER 73
-#define wxSTC_HB_WORD 74
-#define wxSTC_HB_STRING 75
-#define wxSTC_HB_IDENTIFIER 76
-#define wxSTC_HB_STRINGEOL 77
-
-// ASP VBScript
-#define wxSTC_HBA_START 80
-#define wxSTC_HBA_DEFAULT 81
-#define wxSTC_HBA_COMMENTLINE 82
-#define wxSTC_HBA_NUMBER 83
-#define wxSTC_HBA_WORD 84
-#define wxSTC_HBA_STRING 85
-#define wxSTC_HBA_IDENTIFIER 86
-#define wxSTC_HBA_STRINGEOL 87
-
-// Embedded Python
-#define wxSTC_HP_START 90
-#define wxSTC_HP_DEFAULT 91
-#define wxSTC_HP_COMMENTLINE 92
-#define wxSTC_HP_NUMBER 93
-#define wxSTC_HP_STRING 94
-#define wxSTC_HP_CHARACTER 95
-#define wxSTC_HP_WORD 96
-#define wxSTC_HP_TRIPLE 97
-#define wxSTC_HP_TRIPLEDOUBLE 98
-#define wxSTC_HP_CLASSNAME 99
-#define wxSTC_HP_DEFNAME 100
-#define wxSTC_HP_OPERATOR 101
-#define wxSTC_HP_IDENTIFIER 102
-
-// ASP Python
-#define wxSTC_HPA_START 105
-#define wxSTC_HPA_DEFAULT 106
-#define wxSTC_HPA_COMMENTLINE 107
-#define wxSTC_HPA_NUMBER 108
-#define wxSTC_HPA_STRING 109
-#define wxSTC_HPA_CHARACTER 110
-#define wxSTC_HPA_WORD 111
-#define wxSTC_HPA_TRIPLE 112
-#define wxSTC_HPA_TRIPLEDOUBLE 113
-#define wxSTC_HPA_CLASSNAME 114
-#define wxSTC_HPA_DEFNAME 115
-#define wxSTC_HPA_OPERATOR 116
-#define wxSTC_HPA_IDENTIFIER 117
-
-// PHP
-#define wxSTC_HPHP_DEFAULT 118
-#define wxSTC_HPHP_HSTRING 119
-#define wxSTC_HPHP_SIMPLESTRING 120
-#define wxSTC_HPHP_WORD 121
-#define wxSTC_HPHP_NUMBER 122
-#define wxSTC_HPHP_VARIABLE 123
-#define wxSTC_HPHP_COMMENT 124
-#define wxSTC_HPHP_COMMENTLINE 125
-#define wxSTC_HPHP_STRINGEOL 126
-
-// Lexical states for SCLEX_PERL
-#define wxSTC_PL_DEFAULT 0
-#define wxSTC_PL_HERE 1
-#define wxSTC_PL_COMMENTLINE 2
-#define wxSTC_PL_POD 3
-#define wxSTC_PL_NUMBER 4
-#define wxSTC_PL_WORD 5
-#define wxSTC_PL_STRING 6
-#define wxSTC_PL_CHARACTER 7
-#define wxSTC_PL_PUNCTUATION 8
-#define wxSTC_PL_PREPROCESSOR 9
-#define wxSTC_PL_OPERATOR 10
-#define wxSTC_PL_IDENTIFIER 11
-#define wxSTC_PL_SCALAR 12
-#define wxSTC_PL_ARRAY 13
-#define wxSTC_PL_HASH 14
-#define wxSTC_PL_SYMBOLTABLE 15
-#define wxSTC_PL_REF 16
-#define wxSTC_PL_REGEX 17
-#define wxSTC_PL_REGSUBST 18
-#define wxSTC_PL_LONGQUOTE 19
-#define wxSTC_PL_BACKTICKS 20
-#define wxSTC_PL_DATASECTION 21
-
-// Lexical states for SCLEX_LATEX
-#define wxSTC_L_DEFAULT 0
-#define wxSTC_L_COMMAND 1
-#define wxSTC_L_TAG 2
-#define wxSTC_L_MATH 3
-#define wxSTC_L_COMMENT 4
-
-// Lexical states for SCLEX_LUA
-#define wxSTC_LUA_DEFAULT 0
-#define wxSTC_LUA_COMMENT 1
-#define wxSTC_LUA_COMMENTLINE 2
-#define wxSTC_LUA_COMMENTDOC 3
-#define wxSTC_LUA_NUMBER 4
-#define wxSTC_LUA_WORD 5
-#define wxSTC_LUA_STRING 6
-#define wxSTC_LUA_CHARACTER 7
-#define wxSTC_LUA_LITERALSTRING 8
-#define wxSTC_LUA_PREPROCESSOR 9
-#define wxSTC_LUA_OPERATOR 10
-#define wxSTC_LUA_IDENTIFIER 11
-#define wxSTC_LUA_STRINGEOL 12
-#define wxSTC_ERR_DEFAULT 0
-#define wxSTC_ERR_PYTHON 1
-#define wxSTC_ERR_GCC 2
-#define wxSTC_ERR_MS 3
-#define wxSTC_ERR_CMD 4
-#define wxSTC_ERR_BORLAND 5
-#define wxSTC_ERR_PERL 6
-
-// END of generated section
-//----------------------------------------------------------------------
-// Others
-
-#define wxSTC_MASK_FOLDERS ((1 << wxSTC_MARKNUM_FOLDER) | (1 << wxSTC_MARKNUM_FOLDEROPEN))
-
-
-
-//----------------------------------------------------------------------
-
-class  ScintillaWX;                      // forward declare
-class  WordList;
-struct SCNotification;
-
-
-extern const wxChar* wxSTCNameStr;
-
-//----------------------------------------------------------------------
-
-class wxStyledTextCtrl : public wxControl {
-public:
-
-#ifdef SWIG
-    wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
-                     const wxPoint& pos = wxDefaultPosition,
-                     const wxSize& size = wxDefaultSize, long style = 0,
-                     const char* name = "styledtext");
-#else
-    wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
-                     const wxPoint& pos = wxDefaultPosition,
-                     const wxSize& size = wxDefaultSize, long style = 0,
-                     const wxString& name = wxSTCNameStr);
-#endif
-
-
-#ifndef SWIG
-    ~wxStyledTextCtrl();
-#endif
-
-//----------------------------------------------------------------------
-// BEGIN generated section.  The following code is automatically generated
-//       by gen_iface.py.  Do not edit this file.  Edit stc.h.in instead
-//       and regenerate
-
-
-    // Add text to the document
-    void AddText(const wxString& text);
-
-    // Add array of cells to document
-    void AddStyledText(const wxString& text);
-
-    // Insert string at a position
-    void InsertText(int pos, const wxString& text);
-
-    // Delete all text in the document
-    void ClearAll();
-
-    // Set all style bytes to 0, remove all folding information
-    void ClearDocumentStyle();
-
-    // The number of characters in the document
-    int GetLength();
-
-    // Returns the character byte at the position
-    int GetCharAt(int pos);
-
-    // Returns the position of the caret
-    int GetCurrentPos();
-
-    // Returns the position of the opposite end of the selection to the caret
-    int GetAnchor();
-
-    // Returns the style byte at the position
-    int GetStyleAt(int pos);
-
-    // Redoes the next action on the undo history
-    void Redo();
-
-    // Choose between collecting actions into the undo
-    // history and discarding them.
-    void SetUndoCollection(bool collectUndo);
-
-    // Select all the text in the document.
-    void SelectAll();
-
-    // Remember the current position in the undo history as the position
-    // at which the document was saved.
-    void SetSavePoint();
-
-    // Retrieve a buffer of cells.
-    wxString GetStyledText(int startPos, int endPos);
-
-    // Are there any redoable actions in the undo history.
-    bool CanRedo();
-
-    // Retrieve the line number at which a particular marker is located
-    int MarkerLineFromHandle(int handle);
-
-    // Delete a marker.
-    void MarkerDeleteHandle(int handle);
-
-    // Is undo history being collected?
-    bool GetUndoCollection();
-
-    // Are white space characters currently visible?
-    // Returns one of SCWS_* constants.
-    int GetViewWhiteSpace();
-
-    // Make white space characters invisible, always visible or visible outside indentation.
-    void SetViewWhiteSpace(int viewWS);
-
-    // Find the position from a point within the window.
-    int PositionFromPoint(wxPoint pt);
-
-    // Set caret to start of a line and ensure it is visible.
-    void GotoLine(int line);
-
-    // Set caret to a position and ensure it is visible.
-    void GotoPos(int pos);
-
-    // Set the selection anchor to a position. The anchor is the opposite
-    // end of the selection from the caret.
-    void SetAnchor(int posAnchor);
-
-    // Retrieve the text of the line containing the caret.
-    // Returns the index of the caret on the line.
-    wxString GetCurLine(int* OUTPUT=NULL);
-
-    // Retrieve the position of the last correctly styled character.
-    int GetEndStyled();
-
-    // Convert all line endings in the document to use the current mode.
-    void ConvertEOLs();
-
-    // Retrieve the current end of line mode - one of CRLF, CR, or LF.
-    int GetEOLMode();
-
-    // Set the current end of line mode.
-    void SetEOLMode(int eolMode);
-
-    // Set the current styling position to pos and the styling mask to mask.
-    // The styling mask can be used to protect some bits in each styling byte from
-    // modification.
-    void StartStyling(int pos, int mask);
-
-    // Change style from current styling position for length characters to a style
-    // and move the current styling position to after this newly styled segment.
-    void SetStyling(int length, int style);
-
-    // Is drawing done first into a buffer or direct to the screen.
-    bool GetBufferedDraw();
-
-    // If drawing is buffered then each line of text is drawn into a bitmap buffer
-    // before drawing it to the screen to avoid flicker.
-    void SetBufferedDraw(bool buffered);
-
-    // Change the visible size of a tab to be a multiple of the width of a space
-    // character.
-    void SetTabWidth(int tabWidth);
-
-    // Retrieve the visible size of a tab.
-    int GetTabWidth();
-
-    // Set the code page used to interpret the bytes of the document as characters.
-    // The SC_CP_UTF8 value can be used to enter Unicode mode.
-    void SetCodePage(int codePage);
-
-    // Set the symbol used for a particular marker number,
-    // and optionally the for and background colours.
-    void MarkerDefine(int markerNumber, int markerSymbol,
-                         const wxColour& foreground = wxNullColour,
-                         const wxColour& background = wxNullColour);
-
-    // Set the foreground colour used for a particular marker number.
-    void MarkerSetForeground(int markerNumber, const wxColour& fore);
-
-    // Set the background colour used for a particular marker number.
-    void MarkerSetBackground(int markerNumber, const wxColour& back);
-
-    // Add a marker to a line.
-    void MarkerAdd(int line, int markerNumber);
-
-    // Delete a marker from a line
-    void MarkerDelete(int line, int markerNumber);
-
-    // Delete all markers with a particular number from all lines
-    void MarkerDeleteAll(int markerNumber);
-
-    // Get a bit mask of all the markers set on a line.
-    int MarkerGet(int line);
-
-    // Find the next line after lineStart that includes a marker in mask.
-    int MarkerNext(int lineStart, int markerMask);
-
-    // Find the previous line before lineStart that includes a marker in mask.
-    int MarkerPrevious(int lineStart, int markerMask);
-
-    // Set a margin to be either numeric or symbolic.
-    void SetMarginType(int margin, int marginType);
-
-    // Retrieve the type of a margin.
-    int GetMarginType(int margin);
-
-    // Set the width of a margin to a width expressed in pixels.
-    void SetMarginWidth(int margin, int pixelWidth);
-
-    // Retrieve the width of a margin in pixels.
-    int GetMarginWidth(int margin);
-
-    // Set a mask that determines which markers are displayed in a margin.
-    void SetMarginMask(int margin, int mask);
-
-    // Retrieve the marker mask of a margin.
-    int GetMarginMask(int margin);
-
-    // Make a margin sensitive or insensitive to mouse clicks.
-    void SetMarginSensitive(int margin, bool sensitive);
-
-    // Retrieve the mouse click sensitivity of a margin.
-    bool GetMarginSensitive(int margin);
-
-    // Clear all the styles and make equivalent to the global default style.
-    void StyleClearAll();
-
-    // Set the foreground colour of a style.
-    void StyleSetForeground(int style, const wxColour& fore);
-
-    // Set the background colour of a style.
-    void StyleSetBackground(int style, const wxColour& back);
-
-    // Set a style to be bold or not.
-    void StyleSetBold(int style, bool bold);
-
-    // Set a style to be italic or not.
-    void StyleSetItalic(int style, bool italic);
-
-    // Set the size of characters of a style.
-    void StyleSetSize(int style, int sizePoints);
-
-    // Set the font of a style.
-    void StyleSetFaceName(int style, const wxString& fontName);
-
-    // Set a style to have its end of line filled or not.
-    void StyleSetEOLFilled(int style, bool filled);
-
-    // Reset the default style to its state at startup
-    void StyleResetDefault();
-
-    // Set a style to be underlined or not.
-    void StyleSetUnderline(int style, bool underline);
-
-    // Set the foreground colour of the selection and whether to use this setting.
-    void SetSelForeground(bool useSetting, const wxColour& fore);
-
-    // Set the background colour of the selection and whether to use this setting.
-    void SetSelBackground(bool useSetting, const wxColour& back);
-
-    // Set the foreground colour of the caret.
-    void SetCaretForeground(const wxColour& fore);
-
-    // When key+modifier combination km is pressed perform msg.
-    void CmdKeyAssign(int key, int modifiers, int cmd);
-
-    // When key+modifier combination km do nothing.
-    void CmdKeyClear(int key, int modifiers);
-
-    // Drop all key mappings.
-    void CmdKeyClearAll();
-
-    // Set the styles for a segment of the document.
-    void SetStyleBytes(int length, char* styleBytes);
-
-    // Set a style to be visible or not.
-    void StyleSetVisible(int style, bool visible);
-
-    // Get the time in milliseconds that the caret is on and off.
-    int GetCaretPeriod();
-
-    // Get the time in milliseconds that the caret is on and off. 0 = steady on.
-    void SetCaretPeriod(int periodMilliseconds);
-
-    // Set the set of characters making up words for when moving or selecting
-    // by word.
-    void SetWordChars(const wxString& characters);
-
-    // Start a sequence of actions that is undone and redone as a unit.
-    // May be nested.
-    void BeginUndoAction();
-
-    // End a sequence of actions that is undone and redone as a unit.
-    void EndUndoAction();
-
-    // Set an indicator to plain, squiggle or TT.
-    void IndicatorSetStyle(int indic, int style);
-
-    // Retrieve the style of an indicator.
-    int IndicatorGetStyle(int indic);
-
-    // Set the foreground colour of an indicator.
-    void IndicatorSetForeground(int indic, const wxColour& fore);
-
-    // Retrieve the foreground colour of an indicator.
-    wxColour IndicatorGetForeground(int indic);
-
-    // Divide each styling byte into lexical class bits (default:5) and indicator
-    // bits (default:3). If a lexer requires more than 32 lexical states, then this
-    // is used to expand the possible states.
-    void SetStyleBits(int bits);
-
-    // Retrieve number of bits in style bytes used to hold the lexical state.
-    int GetStyleBits();
-
-    // Used to hold extra styling information for each line.
-    void SetLineState(int line, int state);
-
-    // Retrieve the extra styling information for a line.
-    int GetLineState(int line);
-
-    // Retrieve the last line number that has line state.
-    int GetMaxLineState();
-
-    // Display a auto-completion list.
-    // The lenEntered parameter indicates how many characters before
-    // the caret should be used to provide context.
-    void AutoCompShow(int lenEntered, const wxString& itemList);
-
-    // Remove the auto-completion list from the screen.
-    void AutoCompCancel();
-
-    // Is there an auto-completion list visible?
-    bool AutoCompActive();
-
-    // Retrieve the position of the caret when the auto-completion list was
-    // displayed.
-    int AutoCompPosStart();
-
-    // User has selected an item so remove the list and insert the selection.
-    void AutoCompComplete();
-
-    // Define a set of character that when typed cancel the auto-completion list.
-    void AutoCompStops(const wxString& characterSet);
-
-    // Change the separator character in the string setting up an auto-completion
-    // list. Default is space but can be changed if items contain space.
-    void AutoCompSetSeparator(int separatorCharacter);
-
-    // Retrieve the auto-completion list separator character.
-    int AutoCompGetSeparator();
-
-    // Select the item in the auto-completion list that starts with a string.
-    void AutoCompSelect(const wxString& text);
-
-    // Should the auto-completion list be cancelled if the user backspaces to a
-    // position before where the box was created.
-    void AutoCompSetCancelAtStart(bool cancel);
-
-    // Retrieve whether auto-completion cancelled by backspacing before start.
-    bool AutoCompGetCancelAtStart();
-
-    // Define a set of character that when typed fills up the selected word.
-    void AutoCompSetFillUps(const wxString& characterSet);
-
-    // Should a single item auto-completion list automatically choose the item.
-    void AutoCompSetChooseSingle(bool chooseSingle);
-
-    // Retrieve whether a single item auto-completion list automatically choose the item.
-    bool AutoCompGetChooseSingle();
-
-    // Set whether case is significant when performing auto-completion searches.
-    void AutoCompSetIgnoreCase(bool ignoreCase);
-
-    // Retrieve state of ignore case flag.
-    bool AutoCompGetIgnoreCase();
-
-    // Set the number of spaces used for one level of indentation.
-    void SetIndent(int indentSize);
-
-    // Retrieve indentation size.
-    int GetIndent();
-
-    // Indentation will only use space characters if useTabs is false, otherwise
-    // it will use a combination of tabs and spaces.
-    void SetUseTabs(bool useTabs);
-
-    // Retrieve whether tabs will be used in indentation.
-    bool GetUseTabs();
-
-    // Change the indentation of a line to a number of columns.
-    void SetLineIndentation(int line, int indentSize);
-
-    // Retrieve the number of columns that a line is indented.
-    int GetLineIndentation(int line);
-
-    // Retrieve the position before the first non indentation character on a line.
-    int GetLineIndentPosition(int line);
-
-    // Retrieve the column number of a position, taking tab width into account.
-    int GetColumn(int pos);
-
-    // Show or hide the horizontal scroll bar.
-    void SetUseHorizontalScrollBar(bool show);
-
-    // Is the horizontal scroll bar visible?
-    bool GetUseHorizontalScrollBar();
-
-    // Show or hide indentation guides.
-    void SetIndentationGuides(bool show);
-
-    // Are the indentation guides visible?
-    bool GetIndentationGuides();
-
-    // Set the highlighted indentation guide column.
-    // 0 = no highlighted guide.
-    void SetHighlightGuide(int column);
-
-    // Get the highlighted indentation guide column.
-    int GetHighlightGuide();
-
-    // Get the position after the last visible characters on a line.
-    int GetLineEndPosition(int line);
-
-    // Get the code page used to interpret the bytes of the document as characters.
-    int GetCodePage();
-
-    // Get the foreground colour of the caret.
-    wxColour GetCaretForeground();
-
-    // In read-only mode?
-    bool GetReadOnly();
-
-    // Sets the position of the caret.
-    void SetCurrentPos(int pos);
-
-    // Sets the position that starts the selection - this becomes the anchor.
-    void SetSelectionStart(int pos);
-
-    // Returns the position at the start of the selection.
-    int GetSelectionStart();
-
-    // Sets the position that ends the selection - this becomes the currentPosition.
-    void SetSelectionEnd(int pos);
-
-    // Returns the position at the end of the selection.
-    int GetSelectionEnd();
-
-    // Sets the print magnification added to the point size of each style for printing.
-    void SetPrintMagnification(int magnification);
-
-    // Returns the print magnification.
-    int GetPrintMagnification();
-
-    // Modify colours when printing for clearer printed text.
-    void SetPrintColourMode(int mode);
-
-    // Returns the print colour mode.
-    int GetPrintColourMode();
-
-    // Find some text in the document.
-    int FindText(int minPos, int maxPos,
-                               const wxString& text,
-                               bool caseSensitive, bool wholeWord);
-
-    // On Windows will draw the document into a display context such as a printer.
-    int FormatRange(bool   doDraw,
-                               int    startPos,
-                               int    endPos,
-                               wxDC*  draw,
-                               wxDC*  target,  // Why does it use two? Can they be the same?
-                               wxRect renderRect,
-                               wxRect pageRect);
-
-    // Retrieve the line at the top of the display.
-    int GetFirstVisibleLine();
-
-    // Retrieve the contents of a line.
-    wxString GetLine(int line);
-
-    // Returns the number of lines in the document. There is always at least one.
-    int GetLineCount();
-
-    // Sets the size in pixels of the left margin.
-    void SetMarginLeft(int width);
-
-    // Returns the size in pixels of the left margin.
-    int GetMarginLeft();
-
-    // Sets the size in pixels of the right margin.
-    void SetMarginRight(int width);
-
-    // Returns the size in pixels of the right margin.
-    int GetMarginRight();
-
-    // Is the document different from when it was last saved?
-    bool GetModify();
-
-    // Select a range of text.
-    void SetSelection(int start, int end);
-
-    // Retrieve the selected text.
-    wxString GetSelectedText();
-
-    // Retrieve a range of text.
-    wxString GetTextRange(int startPos, int endPos);
-
-    // Draw the selection in normal style or with selection highlighted.
-    void HideSelection(bool normal);
-
-    // Retrieve the line containing a position.
-    int LineFromPosition(int pos);
-
-    // Retrieve the position at the start of a line.
-    int PositionFromLine(int line);
-
-    // Scroll horizontally and vertically.
-    void LineScroll(int columns, int lines);
-
-    // Ensure the caret is visible.
-    void EnsureCaretVisible();
-
-    // Replace the selected text with the argument text.
-    void ReplaceSelection(const wxString& text);
-
-    // Set to read only or read write.
-    void SetReadOnly(bool readOnly);
-
-    // Will a paste succeed?
-    bool CanPaste();
-
-    // Are there any undoable actions in the undo history.
-    bool CanUndo();
-
-    // Delete the undo history.
-    void EmptyUndoBuffer();
-
-    // Undo one action in the undo history.
-    void Undo();
-
-    // Cut the selection to the clipboard.
-    void Cut();
-
-    // Copy the selection to the clipboard.
-    void Copy();
-
-    // Paste the contents of the clipboard into the document replacing the selection.
-    void Paste();
-
-    // Clear the selection.
-    void Clear();
-
-    // Replace the contents of the document with the argument text.
-    void SetText(const wxString& text);
-
-    // Retrieve all the text in the document.
-    wxString GetText();
-
-    // Retrieve the number of characters in the document.
-    int GetTextLength();
-
-    // Set to overtype (true) or insert mode
-    void SetOvertype(bool overtype);
-
-    // Returns true if overtype mode is active otherwise false is returned.
-    bool GetOvertype();
-
-    // Show a call tip containing a definition near position pos.
-    void CallTipShow(int pos, const wxString& definition);
-
-    // Remove the call tip from the screen.
-    void CallTipCancel();
-
-    // Is there an active call tip?
-    bool CallTipActive();
-
-    // Retrieve the position where the caret was before displaying the call tip.
-    int CallTipPosAtStart();
-
-    // Highlight a segment of the definition.
-    void CallTipSetHighlight(int start, int end);
-
-    // Set the background colour for the call tip.
-    void CallTipSetBackground(const wxColour& back);
-
-    // Find the display line of a document line taking hidden lines into account.
-    int VisibleFromDocLine(int line);
-
-    // Find the document line of a display line taking hidden lines into account.
-    int DocLineFromVisible(int lineDisplay);
-
-    // Set the fold level of a line.
-    // This encodes an integer level along with flags indicating whether the
-    // line is a header and whether it is effectively white space.
-    void SetFoldLevel(int line, int level);
-
-    // Retrieve the fold level of a line.
-    int GetFoldLevel(int line);
-
-    // Find the last child line of a header line.
-    int GetLastChild(int line, int level);
-
-    // Find the parent line of a child line.
-    int GetFoldParent(int line);
-
-    // Make a range of lines visible.
-    void ShowLines(int lineStart, int lineEnd);
-
-    // Make a range of lines invisible.
-    void HideLines(int lineStart, int lineEnd);
-
-    // Is a line visible?
-    bool GetLineVisible(int line);
-
-    // Show the children of a header line.
-    void SetFoldExpanded(int line, bool expanded);
-
-    // Is a header line expanded?
-    bool GetFoldExpanded(int line);
-
-    // Switch a header line between expanded and contracted.
-    void ToggleFold(int line);
-
-    // Ensure a particular line is visible by expanding any header line hiding it.
-    void EnsureVisible(int line);
-
-    // Set some debugging options for folding
-    void SetFoldFlags(int flags);
-
-    // How many characters are on a line, not including end of line characters.
-    int LineLength(int line);
-
-    // Highlight the characters at two positions.
-    void BraceHighlight(int pos1, int pos2);
-
-    // Highlight the character at a position indicating there is no matching brace.
-    void BraceBadLight(int pos);
-
-    // Find the position of a matching brace or INVALID_POSITION if no match.
-    int BraceMatch(int pos);
-
-    // Are the end of line characters visible.
-    bool GetViewEOL();
-
-    // Make the end of line characters visible or invisible
-    void SetViewEOL(bool visible);
-
-    // Retrieve a pointer to the document object.
-    void* GetDocPointer();
-
-    // Change the document object used.
-    void SetDocPointer(void* docPointer);
-
-    // Set which document modification events are sent to the container.
-    void SetModEventMask(int mask);
-
-    // Retrieve the column number which text should be kept within.
-    int GetEdgeColumn();
-
-    // Set the column number of the edge.
-    // If text goes past the edge then it is highlighted.
-    void SetEdgeColumn(int column);
-
-    // Retrieve the edge highlight mode.
-    int GetEdgeMode();
-
-    // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
-    // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
-    void SetEdgeMode(int mode);
-
-    // Retrieve the colour used in edge indication.
-    wxColour GetEdgeColour();
-
-    // Change the colour used in edge indication.
-    void SetEdgeColour(const wxColour& edgeColour);
-
-    // Sets the current caret position to be the search anchor.
-    void SearchAnchor();
-
-    // Find some text starting at the search anchor.
-    int SearchNext(int flags, const wxString& text);
-
-    // Find some text starting at the search anchor and moving backwards.
-    int SearchPrev(int flags, const wxString& text);
-
-    // Set the way the line the caret is on is kept visible.
-    void SetCaretPolicy(int caretPolicy, int caretSlop);
-
-    // Retrieves the number of lines completely visible.
-    int LinesOnScreen();
-
-    // Set whether a pop up menu is displayed automatically when the user presses
-    // the wrong mouse button.
-    void UsePopUp(bool allowPopUp);
-
-    // Is the selection a rectangular. The alternative is the more common stream selection.
-    bool SelectionIsRectangle();
-
-    // Set the zoom level. This number of points is added to the size of all fonts.
-    // It may be positive to magnify or negative to reduce.
-    void SetZoom(int zoom);
-
-    // Retrieve the zoom level.
-    int GetZoom();
-
-    // Create a new document object.
-    // Starts with reference count of 1 and not selected into editor.
-    void* CreateDocument();
-
-    // Extend life of document.
-    void AddRefDocument(void* docPointer);
-
-    // Release a reference to the document, deleting document if it fades to black.
-    void ReleaseDocument(void* docPointer);
-
-    // Get which document modification events are sent to the container.
-    int GetModEventMask();
-
-    // Start notifying the container of all key presses and commands.
-    void StartRecord();
-
-    // Stop notifying the container of all key presses and commands.
-    void StopRecord();
-
-    // Set the lexing language of the document.
-    void SetLexer(int lexer);
-
-    // Retrieve the lexing language of the document.
-    int GetLexer();
-
-    // Colourise a segment of the document using the current lexing language.
-    void Colourise(int start, int end);
-
-    // Set up a value that may be used by a lexer for some optional feature.
-    void SetProperty(const wxString& key, const wxString& value);
-
-    // Set up the key words used by the lexer.
-    void SetKeyWords(int keywordSet, const wxString& keyWords);
-
-// END of generated section
-//----------------------------------------------------------------------
-// Others...
-
-
-    // Returns the line number of the line with the caret.
-    int GetCurrentLine();
-
-    // Extract style settings from a spec-string which is composed of one or
-    // more of the following comma separated elements:
-    //
-    //      bold                    turns on bold
-    //      italic                  turns on italics
-    //      fore:#RRGGBB            sets the foreground colour
-    //      back:#RRGGBB            sets the background colour
-    //      face:[facename]         sets the font face name to use
-    //      size:[num]              sets the font size in points
-    //      eol                     turns on eol filling
-    //      underline               turns on underlining
-    //
-    void StyleSetSpec(int styleNum, const wxString& spec);
-
-
-
-    // Set style size, face, bold, italic, and underline attributes from
-    // a wxFont's attributes.
-    void StyleSetFont(int styleNum, wxFont& font);
-
-
-
-    // Set all font style attributes at once.
-    void StyleSetFontAttr(int styleNum, int size,
-                          const wxString& faceName,
-                          bool bold, bool italic,
-                          bool underline);
-
-
-
-    // Perform one of the operations defined by the wxSTC_CMD_* constants.
-    void CmdKeyExecute(int cmd);
-
-
-
-    // Set the left and right margin in the edit area, measured in pixels.
-    void SetMargins(int left, int right);
-
-
-    // Retrieve the start and end positions of the current selection.
-#ifdef SWIG
-    void GetSelection(int* OUTPUT, int* OUTPUT);
-#else
-    void GetSelection(int* startPos, int* endPos);
-#endif
-
-    // Retrieve the point in the window where a position is displayed.
-    wxPoint PointFromPosition(int pos);
-
-
-    // Scroll enough to make the given line visible
-    void ScrollToLine(int line);
-
-
-    // Scroll enough to make the given column visible
-    void ScrollToColumn(int column);
-
-//----------------------------------------------------------------------
-
-
-#ifndef SWIG
-private:
-    // Event handlers
-    void OnPaint(wxPaintEvent& evt);
-    void OnScrollWin(wxScrollWinEvent& evt);
-    void OnSize(wxSizeEvent& evt);
-    void OnMouseLeftDown(wxMouseEvent& evt);
-    void OnMouseMove(wxMouseEvent& evt);
-    void OnMouseLeftUp(wxMouseEvent& evt);
-    void OnMouseRightUp(wxMouseEvent& evt);
-    void OnChar(wxKeyEvent& evt);
-    void OnKeyDown(wxKeyEvent& evt);
-    void OnLoseFocus(wxFocusEvent& evt);
-    void OnGainFocus(wxFocusEvent& evt);
-    void OnSysColourChanged(wxSysColourChangedEvent& evt);
-    void OnEraseBackground(wxEraseEvent& evt);
-    void OnMenu(wxCommandEvent& evt);
-    void OnListBox(wxCommandEvent& evt);
-
-
-    // Turn notifications from Scintilla into events
-    void NotifyChange();
-    void NotifyParent(SCNotification* scn);
-
-    long SendMsg(int msg, long wp=0, long lp=0);
-
-private:
-    DECLARE_EVENT_TABLE()
-    DECLARE_CLASS(wxStyledTextCtrl)
-
-    ScintillaWX*        m_swx;
-    wxStopWatch         m_stopWatch;
-
-
-    friend class ScintillaWX;
-    friend class Platform;
-#endif
-};
-
-//----------------------------------------------------------------------
-
-class wxStyledTextEvent : public wxCommandEvent {
-public:
-    wxStyledTextEvent(wxEventType commandType=0, int id=0);
-    ~wxStyledTextEvent() {}
-
-    void SetPosition(int pos)        { m_position = pos; }
-    void SetKey(int k)               { m_key = k; }
-    void SetModifiers(int m)         { m_modifiers = m; }
-    void SetModificationType(int t)  { m_modificationType = t; }
-    void SetText(const char* t)      { m_text = t; }
-    void SetLength(int len)          { m_length = len; }
-    void SetLinesAdded(int num)      { m_linesAdded = num; }
-    void SetLine(int val)            { m_line = val; }
-    void SetFoldLevelNow(int val)    { m_foldLevelNow = val; }
-    void SetFoldLevelPrev(int val)   { m_foldLevelPrev = val; }
-    void SetMargin(int val)          { m_margin = val; }
-    void SetMessage(int val)         { m_message = val; }
-    void SetWParam(int val)          { m_wParam = val; }
-    void SetLParam(int val)          { m_lParam = val; }
-
-    int  GetPosition() const         { return m_position; }
-    int  GetKey()  const             { return m_key; }
-    int  GetModifiers() const        { return m_modifiers; }
-    int  GetModificationType() const { return m_modificationType; }
-    wxString GetText() const         { return m_text; }
-    int  GetLength() const           { return m_length; }
-    int  GetLinesAdded() const       { return m_linesAdded; }
-    int  GetLine() const             { return m_line; }
-    int  GetFoldLevelNow() const     { return m_foldLevelNow; }
-    int  GetFoldLevelPrev() const    { return m_foldLevelPrev; }
-    int  GetMargin() const           { return m_margin; }
-    int  GetMessage() const          { return m_message; }
-    int  GetWParam() const           { return m_wParam; }
-    int  GetLParam() const           { return m_lParam; }
-
-    bool GetShift() const;
-    bool GetControl() const;
-    bool GetAlt() const;
-
-    void CopyObject(wxObject& obj) const;
-
-#ifndef SWIG
-private:
-    DECLARE_DYNAMIC_CLASS(wxStyledTextEvent)
-
-    int  m_position;
-    int  m_key;
-    int  m_modifiers;
-
-    int  m_modificationType;    // wxEVT_STC_MODIFIED
-    wxString m_text;
-    int  m_length;
-    int  m_linesAdded;
-    int  m_line;
-    int  m_foldLevelNow;
-    int  m_foldLevelPrev;
-
-    int  m_margin;              // wxEVT_STC_MARGINCLICK
-
-    int  m_message;             // wxEVT_STC_MACRORECORD
-    int  m_wParam;
-    int  m_lParam;
-#endif
-};
-
-
-// Event types
-enum {
-    wxEVT_STC_CHANGE = 1650,
-    wxEVT_STC_STYLENEEDED,
-    wxEVT_STC_CHARADDED,
-    wxEVT_STC_UPDATEUI,
-    wxEVT_STC_SAVEPOINTREACHED,
-    wxEVT_STC_SAVEPOINTLEFT,
-    wxEVT_STC_ROMODIFYATTEMPT,
-    wxEVT_STC_DOUBLECLICK,
-    wxEVT_STC_MODIFIED,
-    wxEVT_STC_KEY,
-    wxEVT_STC_MACRORECORD,
-    wxEVT_STC_MARGINCLICK,
-    wxEVT_STC_NEEDSHOWN,
-    wxEVT_STC_POSCHANGED
-};
-
-
-#ifndef SWIG
-typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
-
-#define EVT_STC_CHANGE(id, fn) { wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_STYLENEEDED(id, fn) { wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_CHARADDED(id, fn) { wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_UPDATEUI(id, fn) { wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_SAVEPOINTREACHED(id, fn) { wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_SAVEPOINTLEFT(id, fn) { wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_ROMODIFYATTEMPT(id, fn) { wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_DOUBLECLICK(id, fn) { wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_MODIFIED(id, fn) { wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_KEY(id, fn) { wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_MACRORECORD(id, fn) { wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_MARGINCLICK(id, fn) { wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_NEEDSHOWN(id, fn) { wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-#define EVT_STC_POSCHANGED(id, fn) { wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL },
-
-#endif
-
-//----------------------------------------------------------------------
-//----------------------------------------------------------------------
-#endif
-
-
index 38aa8c439154bc99f9727e3a6c4e4fbd9e57ee18..81c8e330532dc89911867da8b19b4144ac62b45b 100644 (file)
 <HEAD>
 <TITLE>stc.h.html</TITLE>
 </HEAD>
-<BODY BGCOLOR=#FFFFFF TEXT=#000000>
+<BODY BGcolor=#FFFFFF TEXT=#000000>
 <PRE>
-<FONT COLOR=#0000ff>////////////////////////////////////////////////////////////////////////////</FONT>
-<FONT COLOR=#0000ff>// Name:        stc.h</FONT>
-<FONT COLOR=#0000ff>// Purpose:     A wxWindows implementation of Scintilla.  This class is the</FONT>
-<FONT COLOR=#0000ff>//              one meant to be used directly by wx applications.  It does not</FONT>
-<FONT COLOR=#0000ff>//              derive directly from the Scintilla classes, and in fact there</FONT>
-<FONT COLOR=#0000ff>//              is no mention of Scintilla classes at all in this header.</FONT>
-<FONT COLOR=#0000ff>//              This class delegates all method calls and events to the</FONT>
-<FONT COLOR=#0000ff>//              Scintilla objects and so forth.  This allows the use of</FONT>
-<FONT COLOR=#0000ff>//              Scintilla without polluting the namespace with all the</FONT>
-<FONT COLOR=#0000ff>//              classes and itentifiers from Scintilla.</FONT>
-<FONT COLOR=#0000ff>//</FONT>
-<FONT COLOR=#0000ff>// Author:      Robin Dunn</FONT>
-<FONT COLOR=#0000ff>//</FONT>
-<FONT COLOR=#0000ff>// Created:     13-Jan-2000</FONT>
-<FONT COLOR=#0000ff>// RCS-ID:      $Id$</FONT>
-<FONT COLOR=#0000ff>// Copyright:   (c) 2000 by Total Control Software</FONT>
-<FONT COLOR=#0000ff>// Licence:     wxWindows license</FONT>
-<FONT COLOR=#0000ff>/////////////////////////////////////////////////////////////////////////////</FONT>
-
-<FONT COLOR=#a020f0>#ifndef __stc_h__</FONT>
-<FONT COLOR=#a020f0>#define __stc_h__</FONT>
-
-
-<FONT COLOR=#a020f0>#include </FONT><FONT COLOR=#ff00ff>&lt;wx/wx.h&gt;</FONT>
-
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
-<FONT COLOR=#0000ff>// BEGIN generated section.  The following code is automatically generated</FONT>
-<FONT COLOR=#0000ff>//       by gen_iface.py.  Do not edit this file.  Edit stc.h.in instead</FONT>
-<FONT COLOR=#0000ff>//       and regenerate</FONT>
-
-<FONT COLOR=#a020f0>#define wxSTC_INVALID_POSITION -</FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_START </FONT><FONT COLOR=#ff00ff>2000</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_OPTIONAL_START </FONT><FONT COLOR=#ff00ff>3000</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEXER_START </FONT><FONT COLOR=#ff00ff>4000</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_REDO </FONT><FONT COLOR=#ff00ff>2011</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_SELECTALL </FONT><FONT COLOR=#ff00ff>2013</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_WS_INVISIBLE </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_WS_VISIBLEALWAYS </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_WS_VISIBLEAFTERINDENT </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_EOL_CRLF </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_EOL_CR </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_EOL_LF </FONT><FONT COLOR=#ff00ff>2</FONT>
-
-<FONT COLOR=#0000ff>// The SC_CP_UTF8 value can be used to enter Unicode mode.</FONT>
-<FONT COLOR=#0000ff>// This is the same value as CP_UTF8 in Windows</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CP_UTF8 </FONT><FONT COLOR=#ff00ff>65001</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARKER_MAX </FONT><FONT COLOR=#ff00ff>31</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_CIRCLE </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_ROUNDRECT </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_ARROW </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_SMALLRECT </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_SHORTARROW </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_EMPTY </FONT><FONT COLOR=#ff00ff>5</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_ARROWDOWN </FONT><FONT COLOR=#ff00ff>6</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_MINUS </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARK_PLUS </FONT><FONT COLOR=#ff00ff>8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARKNUM_FOLDER </FONT><FONT COLOR=#ff00ff>30</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARKNUM_FOLDEROPEN </FONT><FONT COLOR=#ff00ff>31</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARGIN_SYMBOL </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MARGIN_NUMBER </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_STYLE_DEFAULT </FONT><FONT COLOR=#ff00ff>32</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_STYLE_LINENUMBER </FONT><FONT COLOR=#ff00ff>33</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_STYLE_BRACELIGHT </FONT><FONT COLOR=#ff00ff>34</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_STYLE_BRACEBAD </FONT><FONT COLOR=#ff00ff>35</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_STYLE_CONTROLCHAR </FONT><FONT COLOR=#ff00ff>36</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_STYLE_INDENTGUIDE </FONT><FONT COLOR=#ff00ff>37</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_STYLE_MAX </FONT><FONT COLOR=#ff00ff>127</FONT>
-
-<FONT COLOR=#0000ff>// Character set identifiers are used in StyleSetCharacterSet.</FONT>
-<FONT COLOR=#0000ff>// The values are the same as the Windows *_CHARSET values.</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_ANSI </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_DEFAULT </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_BALTIC </FONT><FONT COLOR=#ff00ff>186</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_CHINESEBIG5 </FONT><FONT COLOR=#ff00ff>136</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_EASTEUROPE </FONT><FONT COLOR=#ff00ff>238</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_GB2312 </FONT><FONT COLOR=#ff00ff>134</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_GREEK </FONT><FONT COLOR=#ff00ff>161</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_HANGUL </FONT><FONT COLOR=#ff00ff>129</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_MAC </FONT><FONT COLOR=#ff00ff>77</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_OEM </FONT><FONT COLOR=#ff00ff>255</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_RUSSIAN </FONT><FONT COLOR=#ff00ff>204</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_SHIFTJIS </FONT><FONT COLOR=#ff00ff>128</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_SYMBOL </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_TURKISH </FONT><FONT COLOR=#ff00ff>162</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_JOHAB </FONT><FONT COLOR=#ff00ff>130</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_HEBREW </FONT><FONT COLOR=#ff00ff>177</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_ARABIC </FONT><FONT COLOR=#ff00ff>178</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_VIETNAMESE </FONT><FONT COLOR=#ff00ff>163</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CHARSET_THAI </FONT><FONT COLOR=#ff00ff>222</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC_MAX </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC_PLAIN </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC_SQUIGGLE </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC_TT </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC_DIAGONAL </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC_STRIKE </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC0_MASK </FONT><FONT COLOR=#ff00ff>32</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC1_MASK </FONT><FONT COLOR=#ff00ff>64</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDIC2_MASK </FONT><FONT COLOR=#ff00ff>128</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_INDICS_MASK </FONT><FONT COLOR=#ff00ff>32</FONT><FONT COLOR=#a020f0> | </FONT><FONT COLOR=#ff00ff>64</FONT><FONT COLOR=#a020f0> | </FONT><FONT COLOR=#ff00ff>128</FONT>
-
-<FONT COLOR=#0000ff>// PrintColourMode - use same colours as screen.</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PRINT_NORMAL </FONT><FONT COLOR=#ff00ff>0</FONT>
-
-<FONT COLOR=#0000ff>// PrintColourMode - invert the light value of each style for printing.</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PRINT_INVERTLIGHT </FONT><FONT COLOR=#ff00ff>1</FONT>
-
-<FONT COLOR=#0000ff>// PrintColourMode - force black text on white background for printing.</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PRINT_BLACKONWHITE </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FIND_DOWN </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FIND_WHOLEWORD </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FIND_MATCHCASE </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FIND_WORDSTART </FONT><FONT COLOR=#ff00ff>0x00100000</FONT>
-
-<FONT COLOR=#0000ff>// SCFIND_REGEXP is not yet implemented.</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FIND_REGEXP </FONT><FONT COLOR=#ff00ff>0x00200000</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_UNDO </FONT><FONT COLOR=#ff00ff>2176</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_CUT </FONT><FONT COLOR=#ff00ff>2177</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_COPY </FONT><FONT COLOR=#ff00ff>2178</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_PASTE </FONT><FONT COLOR=#ff00ff>2179</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FOLDLEVELBASE </FONT><FONT COLOR=#ff00ff>0x400</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FOLDLEVELWHITEFLAG </FONT><FONT COLOR=#ff00ff>0x1000</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FOLDLEVELHEADERFLAG </FONT><FONT COLOR=#ff00ff>0x2000</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_FOLDLEVELNUMBERMASK </FONT><FONT COLOR=#ff00ff>0x0FFF</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINEDOWN </FONT><FONT COLOR=#ff00ff>2300</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINEDOWNEXTEND </FONT><FONT COLOR=#ff00ff>2301</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINEUP </FONT><FONT COLOR=#ff00ff>2302</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINEUPEXTEND </FONT><FONT COLOR=#ff00ff>2303</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_CHARLEFT </FONT><FONT COLOR=#ff00ff>2304</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_CHARLEFTEXTEND </FONT><FONT COLOR=#ff00ff>2305</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_CHARRIGHT </FONT><FONT COLOR=#ff00ff>2306</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_CHARRIGHTEXTEND </FONT><FONT COLOR=#ff00ff>2307</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_WORDLEFT </FONT><FONT COLOR=#ff00ff>2308</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_WORDLEFTEXTEND </FONT><FONT COLOR=#ff00ff>2309</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_WORDRIGHT </FONT><FONT COLOR=#ff00ff>2310</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_WORDRIGHTEXTEND </FONT><FONT COLOR=#ff00ff>2311</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_HOME </FONT><FONT COLOR=#ff00ff>2312</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_HOMEEXTEND </FONT><FONT COLOR=#ff00ff>2313</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINEEND </FONT><FONT COLOR=#ff00ff>2314</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINEENDEXTEND </FONT><FONT COLOR=#ff00ff>2315</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_DOCUMENTSTART </FONT><FONT COLOR=#ff00ff>2316</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_DOCUMENTSTARTEXTEND </FONT><FONT COLOR=#ff00ff>2317</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_DOCUMENTEND </FONT><FONT COLOR=#ff00ff>2318</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_DOCUMENTENDEXTEND </FONT><FONT COLOR=#ff00ff>2319</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_PAGEUP </FONT><FONT COLOR=#ff00ff>2320</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_PAGEUPEXTEND </FONT><FONT COLOR=#ff00ff>2321</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_PAGEDOWN </FONT><FONT COLOR=#ff00ff>2322</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_PAGEDOWNEXTEND </FONT><FONT COLOR=#ff00ff>2323</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_EDITTOGGLEOVERTYPE </FONT><FONT COLOR=#ff00ff>2324</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_CANCEL </FONT><FONT COLOR=#ff00ff>2325</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_DELETEBACK </FONT><FONT COLOR=#ff00ff>2326</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_TAB </FONT><FONT COLOR=#ff00ff>2327</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_BACKTAB </FONT><FONT COLOR=#ff00ff>2328</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_NEWLINE </FONT><FONT COLOR=#ff00ff>2329</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_FORMFEED </FONT><FONT COLOR=#ff00ff>2330</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_VCHOME </FONT><FONT COLOR=#ff00ff>2331</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_VCHOMEEXTEND </FONT><FONT COLOR=#ff00ff>2332</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_ZOOMIN </FONT><FONT COLOR=#ff00ff>2333</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_ZOOMOUT </FONT><FONT COLOR=#ff00ff>2334</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_DELWORDLEFT </FONT><FONT COLOR=#ff00ff>2335</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_DELWORDRIGHT </FONT><FONT COLOR=#ff00ff>2336</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINECUT </FONT><FONT COLOR=#ff00ff>2337</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINEDELETE </FONT><FONT COLOR=#ff00ff>2338</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINETRANSPOSE </FONT><FONT COLOR=#ff00ff>2339</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LOWERCASE </FONT><FONT COLOR=#ff00ff>2340</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_UPPERCASE </FONT><FONT COLOR=#ff00ff>2341</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINESCROLLDOWN </FONT><FONT COLOR=#ff00ff>2342</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CMD_LINESCROLLUP </FONT><FONT COLOR=#ff00ff>2343</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_EDGE_NONE </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_EDGE_LINE </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_EDGE_BACKGROUND </FONT><FONT COLOR=#ff00ff>2</FONT>
-
-<FONT COLOR=#0000ff>// Show caret within N lines of edge when it's scrolled to view</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CARET_SLOP </FONT><FONT COLOR=#ff00ff>0x01</FONT>
-
-<FONT COLOR=#0000ff>// Center caret on screen when it's scrolled to view</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CARET_CENTER </FONT><FONT COLOR=#ff00ff>0x02</FONT>
-
-<FONT COLOR=#0000ff>// OR this with CARET_CENTER to reposition even when visible, or</FONT>
-<FONT COLOR=#0000ff>// OR this with CARET_SLOP to reposition whenever outside slop border</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_CARET_STRICT </FONT><FONT COLOR=#ff00ff>0x04</FONT>
-
-<FONT COLOR=#0000ff>// Notifications</FONT>
-<FONT COLOR=#0000ff>// Type of modification and the action which caused the modification</FONT>
-<FONT COLOR=#0000ff>// These are defined as a bit mask to make it easy to specify which notifications are wanted.</FONT>
-<FONT COLOR=#0000ff>// One bit is set from each of SC_MOD_* and SC_PERFORMED_*.</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MOD_INSERTTEXT </FONT><FONT COLOR=#ff00ff>0x1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MOD_DELETETEXT </FONT><FONT COLOR=#ff00ff>0x2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MOD_CHANGESTYLE </FONT><FONT COLOR=#ff00ff>0x4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MOD_CHANGEFOLD </FONT><FONT COLOR=#ff00ff>0x8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PERFORMED_USER </FONT><FONT COLOR=#ff00ff>0x10</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PERFORMED_UNDO </FONT><FONT COLOR=#ff00ff>0x20</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PERFORMED_REDO </FONT><FONT COLOR=#ff00ff>0x40</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LASTSTEPINUNDOREDO </FONT><FONT COLOR=#ff00ff>0x100</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MOD_CHANGEMARKER </FONT><FONT COLOR=#ff00ff>0x200</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MOD_BEFOREINSERT </FONT><FONT COLOR=#ff00ff>0x400</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MOD_BEFOREDELETE </FONT><FONT COLOR=#ff00ff>0x800</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_MODEVENTMASKALL </FONT><FONT COLOR=#ff00ff>0xF77</FONT>
-
-<FONT COLOR=#0000ff>// Symbolic key codes and modifier flags</FONT>
-<FONT COLOR=#0000ff>// ASCII and other printable characters below 256</FONT>
-<FONT COLOR=#0000ff>// Extended keys above 300</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_DOWN </FONT><FONT COLOR=#ff00ff>300</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_UP </FONT><FONT COLOR=#ff00ff>301</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_LEFT </FONT><FONT COLOR=#ff00ff>302</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_RIGHT </FONT><FONT COLOR=#ff00ff>303</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_HOME </FONT><FONT COLOR=#ff00ff>304</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_END </FONT><FONT COLOR=#ff00ff>305</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_PRIOR </FONT><FONT COLOR=#ff00ff>306</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_NEXT </FONT><FONT COLOR=#ff00ff>307</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_DELETE </FONT><FONT COLOR=#ff00ff>308</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_INSERT </FONT><FONT COLOR=#ff00ff>309</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_ESCAPE </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_BACK </FONT><FONT COLOR=#ff00ff>8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_TAB </FONT><FONT COLOR=#ff00ff>9</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_RETURN </FONT><FONT COLOR=#ff00ff>13</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_ADD </FONT><FONT COLOR=#ff00ff>310</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_SUBTRACT </FONT><FONT COLOR=#ff00ff>311</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_KEY_DIVIDE </FONT><FONT COLOR=#ff00ff>312</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_SCMOD_SHIFT </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_SCMOD_CTRL </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_SCMOD_ALT </FONT><FONT COLOR=#ff00ff>4</FONT>
-
-<FONT COLOR=#0000ff>// For SciLexer.h</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_CONTAINER </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_NULL </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_PYTHON </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_CPP </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_HTML </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_XML </FONT><FONT COLOR=#ff00ff>5</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_PERL </FONT><FONT COLOR=#ff00ff>6</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_SQL </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_VB </FONT><FONT COLOR=#ff00ff>8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_PROPERTIES </FONT><FONT COLOR=#ff00ff>9</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_ERRORLIST </FONT><FONT COLOR=#ff00ff>10</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_MAKEFILE </FONT><FONT COLOR=#ff00ff>11</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_BATCH </FONT><FONT COLOR=#ff00ff>12</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_XCODE </FONT><FONT COLOR=#ff00ff>13</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_LATEX </FONT><FONT COLOR=#ff00ff>14</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_LUA </FONT><FONT COLOR=#ff00ff>15</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LEX_DIFF </FONT><FONT COLOR=#ff00ff>16</FONT>
-
-<FONT COLOR=#0000ff>// Lexical states for SCLEX_PYTHON</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_DEFAULT </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_COMMENTLINE </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_NUMBER </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_STRING </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_CHARACTER </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_WORD </FONT><FONT COLOR=#ff00ff>5</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_TRIPLE </FONT><FONT COLOR=#ff00ff>6</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_TRIPLEDOUBLE </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_CLASSNAME </FONT><FONT COLOR=#ff00ff>8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_DEFNAME </FONT><FONT COLOR=#ff00ff>9</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_OPERATOR </FONT><FONT COLOR=#ff00ff>10</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_IDENTIFIER </FONT><FONT COLOR=#ff00ff>11</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_COMMENTBLOCK </FONT><FONT COLOR=#ff00ff>12</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_P_STRINGEOL </FONT><FONT COLOR=#ff00ff>13</FONT>
-
-<FONT COLOR=#0000ff>// Lexical states for SCLEX_CPP, SCLEX_VB</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_DEFAULT </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_COMMENT </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_COMMENTLINE </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_COMMENTDOC </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_NUMBER </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_WORD </FONT><FONT COLOR=#ff00ff>5</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_STRING </FONT><FONT COLOR=#ff00ff>6</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_CHARACTER </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_UUID </FONT><FONT COLOR=#ff00ff>8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_PREPROCESSOR </FONT><FONT COLOR=#ff00ff>9</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_OPERATOR </FONT><FONT COLOR=#ff00ff>10</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_IDENTIFIER </FONT><FONT COLOR=#ff00ff>11</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_STRINGEOL </FONT><FONT COLOR=#ff00ff>12</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_C_VERBATIM </FONT><FONT COLOR=#ff00ff>13</FONT>
-
-<FONT COLOR=#0000ff>// Lexical states for SCLEX_HTML, SCLEX_XML</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_DEFAULT </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_TAG </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_TAGUNKNOWN </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_ATTRIBUTE </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_ATTRIBUTEUNKNOWN </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_NUMBER </FONT><FONT COLOR=#ff00ff>5</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_DOUBLESTRING </FONT><FONT COLOR=#ff00ff>6</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_SINGLESTRING </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_OTHER </FONT><FONT COLOR=#ff00ff>8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_COMMENT </FONT><FONT COLOR=#ff00ff>9</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_ENTITY </FONT><FONT COLOR=#ff00ff>10</FONT>
-
-<FONT COLOR=#0000ff>// XML and ASP</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_TAGEND </FONT><FONT COLOR=#ff00ff>11</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_XMLSTART </FONT><FONT COLOR=#ff00ff>12</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_XMLEND </FONT><FONT COLOR=#ff00ff>13</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_SCRIPT </FONT><FONT COLOR=#ff00ff>14</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_ASP </FONT><FONT COLOR=#ff00ff>15</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_ASPAT </FONT><FONT COLOR=#ff00ff>16</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_CDATA </FONT><FONT COLOR=#ff00ff>17</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_QUESTION </FONT><FONT COLOR=#ff00ff>18</FONT>
-
-<FONT COLOR=#0000ff>// More HTML</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_H_VALUE </FONT><FONT COLOR=#ff00ff>19</FONT>
-
-<FONT COLOR=#0000ff>// Embedded Javascript</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_START </FONT><FONT COLOR=#ff00ff>40</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_DEFAULT </FONT><FONT COLOR=#ff00ff>41</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_COMMENT </FONT><FONT COLOR=#ff00ff>42</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_COMMENTLINE </FONT><FONT COLOR=#ff00ff>43</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_COMMENTDOC </FONT><FONT COLOR=#ff00ff>44</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_NUMBER </FONT><FONT COLOR=#ff00ff>45</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_WORD </FONT><FONT COLOR=#ff00ff>46</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_KEYWORD </FONT><FONT COLOR=#ff00ff>47</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_DOUBLESTRING </FONT><FONT COLOR=#ff00ff>48</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_SINGLESTRING </FONT><FONT COLOR=#ff00ff>49</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_SYMBOLS </FONT><FONT COLOR=#ff00ff>50</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJ_STRINGEOL </FONT><FONT COLOR=#ff00ff>51</FONT>
-
-<FONT COLOR=#0000ff>// ASP Javascript</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_START </FONT><FONT COLOR=#ff00ff>55</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_DEFAULT </FONT><FONT COLOR=#ff00ff>56</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_COMMENT </FONT><FONT COLOR=#ff00ff>57</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_COMMENTLINE </FONT><FONT COLOR=#ff00ff>58</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_COMMENTDOC </FONT><FONT COLOR=#ff00ff>59</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_NUMBER </FONT><FONT COLOR=#ff00ff>60</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_WORD </FONT><FONT COLOR=#ff00ff>61</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_KEYWORD </FONT><FONT COLOR=#ff00ff>62</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_DOUBLESTRING </FONT><FONT COLOR=#ff00ff>63</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_SINGLESTRING </FONT><FONT COLOR=#ff00ff>64</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_SYMBOLS </FONT><FONT COLOR=#ff00ff>65</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HJA_STRINGEOL </FONT><FONT COLOR=#ff00ff>66</FONT>
-
-<FONT COLOR=#0000ff>// Embedded VBScript</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HB_START </FONT><FONT COLOR=#ff00ff>70</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HB_DEFAULT </FONT><FONT COLOR=#ff00ff>71</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HB_COMMENTLINE </FONT><FONT COLOR=#ff00ff>72</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HB_NUMBER </FONT><FONT COLOR=#ff00ff>73</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HB_WORD </FONT><FONT COLOR=#ff00ff>74</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HB_STRING </FONT><FONT COLOR=#ff00ff>75</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HB_IDENTIFIER </FONT><FONT COLOR=#ff00ff>76</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HB_STRINGEOL </FONT><FONT COLOR=#ff00ff>77</FONT>
-
-<FONT COLOR=#0000ff>// ASP VBScript</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HBA_START </FONT><FONT COLOR=#ff00ff>80</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HBA_DEFAULT </FONT><FONT COLOR=#ff00ff>81</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HBA_COMMENTLINE </FONT><FONT COLOR=#ff00ff>82</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HBA_NUMBER </FONT><FONT COLOR=#ff00ff>83</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HBA_WORD </FONT><FONT COLOR=#ff00ff>84</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HBA_STRING </FONT><FONT COLOR=#ff00ff>85</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HBA_IDENTIFIER </FONT><FONT COLOR=#ff00ff>86</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HBA_STRINGEOL </FONT><FONT COLOR=#ff00ff>87</FONT>
-
-<FONT COLOR=#0000ff>// Embedded Python</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_START </FONT><FONT COLOR=#ff00ff>90</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_DEFAULT </FONT><FONT COLOR=#ff00ff>91</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_COMMENTLINE </FONT><FONT COLOR=#ff00ff>92</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_NUMBER </FONT><FONT COLOR=#ff00ff>93</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_STRING </FONT><FONT COLOR=#ff00ff>94</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_CHARACTER </FONT><FONT COLOR=#ff00ff>95</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_WORD </FONT><FONT COLOR=#ff00ff>96</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_TRIPLE </FONT><FONT COLOR=#ff00ff>97</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_TRIPLEDOUBLE </FONT><FONT COLOR=#ff00ff>98</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_CLASSNAME </FONT><FONT COLOR=#ff00ff>99</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_DEFNAME </FONT><FONT COLOR=#ff00ff>100</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_OPERATOR </FONT><FONT COLOR=#ff00ff>101</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HP_IDENTIFIER </FONT><FONT COLOR=#ff00ff>102</FONT>
-
-<FONT COLOR=#0000ff>// ASP Python</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_START </FONT><FONT COLOR=#ff00ff>105</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_DEFAULT </FONT><FONT COLOR=#ff00ff>106</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_COMMENTLINE </FONT><FONT COLOR=#ff00ff>107</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_NUMBER </FONT><FONT COLOR=#ff00ff>108</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_STRING </FONT><FONT COLOR=#ff00ff>109</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_CHARACTER </FONT><FONT COLOR=#ff00ff>110</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_WORD </FONT><FONT COLOR=#ff00ff>111</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_TRIPLE </FONT><FONT COLOR=#ff00ff>112</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_TRIPLEDOUBLE </FONT><FONT COLOR=#ff00ff>113</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_CLASSNAME </FONT><FONT COLOR=#ff00ff>114</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_DEFNAME </FONT><FONT COLOR=#ff00ff>115</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_OPERATOR </FONT><FONT COLOR=#ff00ff>116</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPA_IDENTIFIER </FONT><FONT COLOR=#ff00ff>117</FONT>
-
-<FONT COLOR=#0000ff>// PHP</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_DEFAULT </FONT><FONT COLOR=#ff00ff>118</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_HSTRING </FONT><FONT COLOR=#ff00ff>119</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_SIMPLESTRING </FONT><FONT COLOR=#ff00ff>120</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_WORD </FONT><FONT COLOR=#ff00ff>121</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_NUMBER </FONT><FONT COLOR=#ff00ff>122</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_VARIABLE </FONT><FONT COLOR=#ff00ff>123</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_COMMENT </FONT><FONT COLOR=#ff00ff>124</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_COMMENTLINE </FONT><FONT COLOR=#ff00ff>125</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_HPHP_STRINGEOL </FONT><FONT COLOR=#ff00ff>126</FONT>
-
-<FONT COLOR=#0000ff>// Lexical states for SCLEX_PERL</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_DEFAULT </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_HERE </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_COMMENTLINE </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_POD </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_NUMBER </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_WORD </FONT><FONT COLOR=#ff00ff>5</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_STRING </FONT><FONT COLOR=#ff00ff>6</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_CHARACTER </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_PUNCTUATION </FONT><FONT COLOR=#ff00ff>8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_PREPROCESSOR </FONT><FONT COLOR=#ff00ff>9</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_OPERATOR </FONT><FONT COLOR=#ff00ff>10</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_IDENTIFIER </FONT><FONT COLOR=#ff00ff>11</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_SCALAR </FONT><FONT COLOR=#ff00ff>12</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_ARRAY </FONT><FONT COLOR=#ff00ff>13</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_HASH </FONT><FONT COLOR=#ff00ff>14</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_SYMBOLTABLE </FONT><FONT COLOR=#ff00ff>15</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_REF </FONT><FONT COLOR=#ff00ff>16</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_REGEX </FONT><FONT COLOR=#ff00ff>17</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_REGSUBST </FONT><FONT COLOR=#ff00ff>18</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_LONGQUOTE </FONT><FONT COLOR=#ff00ff>19</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_BACKTICKS </FONT><FONT COLOR=#ff00ff>20</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_PL_DATASECTION </FONT><FONT COLOR=#ff00ff>21</FONT>
-
-<FONT COLOR=#0000ff>// Lexical states for SCLEX_LATEX</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_L_DEFAULT </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_L_COMMAND </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_L_TAG </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_L_MATH </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_L_COMMENT </FONT><FONT COLOR=#ff00ff>4</FONT>
-
-<FONT COLOR=#0000ff>// Lexical states for SCLEX_LUA</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_DEFAULT </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_COMMENT </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_COMMENTLINE </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_COMMENTDOC </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_NUMBER </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_WORD </FONT><FONT COLOR=#ff00ff>5</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_STRING </FONT><FONT COLOR=#ff00ff>6</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_CHARACTER </FONT><FONT COLOR=#ff00ff>7</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_LITERALSTRING </FONT><FONT COLOR=#ff00ff>8</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_PREPROCESSOR </FONT><FONT COLOR=#ff00ff>9</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_OPERATOR </FONT><FONT COLOR=#ff00ff>10</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_IDENTIFIER </FONT><FONT COLOR=#ff00ff>11</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_LUA_STRINGEOL </FONT><FONT COLOR=#ff00ff>12</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_ERR_DEFAULT </FONT><FONT COLOR=#ff00ff>0</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_ERR_PYTHON </FONT><FONT COLOR=#ff00ff>1</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_ERR_GCC </FONT><FONT COLOR=#ff00ff>2</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_ERR_MS </FONT><FONT COLOR=#ff00ff>3</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_ERR_CMD </FONT><FONT COLOR=#ff00ff>4</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_ERR_BORLAND </FONT><FONT COLOR=#ff00ff>5</FONT>
-<FONT COLOR=#a020f0>#define wxSTC_ERR_PERL </FONT><FONT COLOR=#ff00ff>6</FONT>
-
-<FONT COLOR=#0000ff>// END of generated section</FONT>
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
-<FONT COLOR=#0000ff>// Others</FONT>
-
-<FONT COLOR=#a020f0>#define wxSTC_MASK_FOLDERS ((</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0> &lt;&lt; wxSTC_MARKNUM_FOLDER) | (</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0> &lt;&lt; wxSTC_MARKNUM_FOLDEROPEN))</FONT>
-
-
-
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
-
-<B><FONT COLOR=#2e8b57>class  ScintillaWX</FONT></B>;                      <FONT COLOR=#0000ff>// forward declare</FONT>
-<B><FONT COLOR=#2e8b57>class  WordList</FONT></B>;
-<B><FONT COLOR=#2e8b57>struct</FONT></B> SCNotification;
-
-
-<B><FONT COLOR=#2e8b57>extern</FONT></B> <B><FONT COLOR=#2e8b57>const</FONT></B> wxChar* wxSTCNameStr;
-
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
-
-<B><FONT COLOR=#2e8b57>class wxStyledTextCtrl</FONT></B> : <B><FONT COLOR=#804040>public</FONT></B> wxControl {
-<B><FONT COLOR=#804040>public</FONT></B>:
-
-<FONT COLOR=#a020f0>#ifdef SWIG</FONT>
+<FONT color=#0000ff>////////////////////////////////////////////////////////////////////////////</FONT>
+<FONT color=#0000ff>// Name:        stc.h</FONT>
+<FONT color=#0000ff>// Purpose:     A wxWindows implementation of Scintilla.  This class is the</FONT>
+<FONT color=#0000ff>//              one meant to be used directly by wx applications.  It does not</FONT>
+<FONT color=#0000ff>//              derive directly from the Scintilla classes, and in fact there</FONT>
+<FONT color=#0000ff>//              is no mention of Scintilla classes at all in this header.</FONT>
+<FONT color=#0000ff>//              This class delegates all method calls and events to the</FONT>
+<FONT color=#0000ff>//              Scintilla objects and so forth.  This allows the use of</FONT>
+<FONT color=#0000ff>//              Scintilla without polluting the namespace with all the</FONT>
+<FONT color=#0000ff>//              classes and itentifiers from Scintilla.</FONT>
+<FONT color=#0000ff>//</FONT>
+<FONT color=#0000ff>// Author:      Robin Dunn</FONT>
+<FONT color=#0000ff>//</FONT>
+<FONT color=#0000ff>// Created:     13-Jan-2000</FONT>
+<FONT color=#0000ff>// RCS-ID:      $Id$</FONT>
+<FONT color=#0000ff>// Copyright:   (c) 2000 by Total Control Software</FONT>
+<FONT color=#0000ff>// Licence:     wxWindows license</FONT>
+<FONT color=#0000ff>/////////////////////////////////////////////////////////////////////////////</FONT>
+
+<FONT color=#a020f0>#ifndef __stc_h__</FONT>
+<FONT color=#a020f0>#define __stc_h__</FONT>
+
+
+<FONT color=#a020f0>#include </FONT><FONT color=#ff00ff>&lt;wx/wx.h&gt;</FONT>
+
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+<FONT color=#0000ff>// BEGIN generated section.  The following code is automatically generated</FONT>
+<FONT color=#0000ff>//       by gen_iface.py.  Do not edit this file.  Edit stc.h.in instead</FONT>
+<FONT color=#0000ff>//       and regenerate</FONT>
+
+<FONT color=#a020f0>#define wxSTC_INVALID_POSITION -</FONT><FONT color=#ff00ff>1</FONT>
+
+<FONT color=#0000ff>// Define start of Scintilla messages to be greater than all edit (EM_*) messages</FONT>
+<FONT color=#0000ff>// as many EM_ messages can be used although that use is deprecated.</FONT>
+<FONT color=#a020f0>#define wxSTC_START </FONT><FONT color=#ff00ff>2000</FONT>
+<FONT color=#a020f0>#define wxSTC_OPTIONAL_START </FONT><FONT color=#ff00ff>3000</FONT>
+<FONT color=#a020f0>#define wxSTC_LEXER_START </FONT><FONT color=#ff00ff>4000</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_REDO </FONT><FONT color=#ff00ff>2011</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_SELECTALL </FONT><FONT color=#ff00ff>2013</FONT>
+<FONT color=#a020f0>#define wxSTC_WS_INVISIBLE </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_WS_VISIBLEALWAYS </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_WS_VISIBLEAFTERINDENT </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_EOL_CRLF </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_EOL_CR </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_EOL_LF </FONT><FONT color=#ff00ff>2</FONT>
+
+<FONT color=#0000ff>// The SC_CP_UTF8 value can be used to enter Unicode mode.</FONT>
+<FONT color=#0000ff>// This is the same value as CP_UTF8 in Windows</FONT>
+<FONT color=#a020f0>#define wxSTC_CP_UTF8 </FONT><FONT color=#ff00ff>65001</FONT>
+<FONT color=#a020f0>#define wxSTC_MARKER_MAX </FONT><FONT color=#ff00ff>31</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_CIRCLE </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_ROUNDRECT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_ARROW </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_SMALLRECT </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_SHORTARROW </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_EMPTY </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_ARROWDOWN </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_MINUS </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_PLUS </FONT><FONT color=#ff00ff>8</FONT>
+
+<FONT color=#0000ff>// Shapes used for outlining column</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_VLINE </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_LCORNER </FONT><FONT color=#ff00ff>10</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_TCORNER </FONT><FONT color=#ff00ff>11</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_BOXPLUS </FONT><FONT color=#ff00ff>12</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_BOXPLUSCONNECTED </FONT><FONT color=#ff00ff>13</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_BOXMINUS </FONT><FONT color=#ff00ff>14</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_BOXMINUSCONNECTED </FONT><FONT color=#ff00ff>15</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_LCORNERCURVE </FONT><FONT color=#ff00ff>16</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_TCORNERCURVE </FONT><FONT color=#ff00ff>17</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEPLUS </FONT><FONT color=#ff00ff>18</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEPLUSCONNECTED </FONT><FONT color=#ff00ff>19</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEMINUS </FONT><FONT color=#ff00ff>20</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEMINUSCONNECTED </FONT><FONT color=#ff00ff>21</FONT>
+
+<FONT color=#0000ff>// Markers used for outlining column</FONT>
+<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDEREND </FONT><FONT color=#ff00ff>25</FONT>
+<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDEROPENMID </FONT><FONT color=#ff00ff>26</FONT>
+<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDERMIDTAIL </FONT><FONT color=#ff00ff>27</FONT>
+<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDERTAIL </FONT><FONT color=#ff00ff>28</FONT>
+<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDERSUB </FONT><FONT color=#ff00ff>29</FONT>
+<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDER </FONT><FONT color=#ff00ff>30</FONT>
+<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDEROPEN </FONT><FONT color=#ff00ff>31</FONT>
+<FONT color=#a020f0>#define wxSTC_MARGIN_SYMBOL </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_MARGIN_NUMBER </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_STYLE_DEFAULT </FONT><FONT color=#ff00ff>32</FONT>
+<FONT color=#a020f0>#define wxSTC_STYLE_LINENUMBER </FONT><FONT color=#ff00ff>33</FONT>
+<FONT color=#a020f0>#define wxSTC_STYLE_BRACELIGHT </FONT><FONT color=#ff00ff>34</FONT>
+<FONT color=#a020f0>#define wxSTC_STYLE_BRACEBAD </FONT><FONT color=#ff00ff>35</FONT>
+<FONT color=#a020f0>#define wxSTC_STYLE_CONTROLCHAR </FONT><FONT color=#ff00ff>36</FONT>
+<FONT color=#a020f0>#define wxSTC_STYLE_INDENTGUIDE </FONT><FONT color=#ff00ff>37</FONT>
+<FONT color=#a020f0>#define wxSTC_STYLE_MAX </FONT><FONT color=#ff00ff>127</FONT>
+
+<FONT color=#0000ff>// Character set identifiers are used in StyleSetCharacterSet.</FONT>
+<FONT color=#0000ff>// The values are the same as the Windows *_CHARSET values.</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_ANSI </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_DEFAULT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_BALTIC </FONT><FONT color=#ff00ff>186</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_CHINESEBIG5 </FONT><FONT color=#ff00ff>136</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_EASTEUROPE </FONT><FONT color=#ff00ff>238</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_GB2312 </FONT><FONT color=#ff00ff>134</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_GREEK </FONT><FONT color=#ff00ff>161</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_HANGUL </FONT><FONT color=#ff00ff>129</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_MAC </FONT><FONT color=#ff00ff>77</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_OEM </FONT><FONT color=#ff00ff>255</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_RUSSIAN </FONT><FONT color=#ff00ff>204</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_SHIFTJIS </FONT><FONT color=#ff00ff>128</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_SYMBOL </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_TURKISH </FONT><FONT color=#ff00ff>162</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_JOHAB </FONT><FONT color=#ff00ff>130</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_HEBREW </FONT><FONT color=#ff00ff>177</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_ARABIC </FONT><FONT color=#ff00ff>178</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_VIETNAMESE </FONT><FONT color=#ff00ff>163</FONT>
+<FONT color=#a020f0>#define wxSTC_CHARSET_THAI </FONT><FONT color=#ff00ff>222</FONT>
+<FONT color=#a020f0>#define wxSTC_CASE_MIXED </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_CASE_UPPER </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_CASE_LOWER </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC_MAX </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC_PLAIN </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC_SQUIGGLE </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC_TT </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC_DIAGONAL </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC_STRIKE </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC0_MASK </FONT><FONT color=#ff00ff>32</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC1_MASK </FONT><FONT color=#ff00ff>64</FONT>
+<FONT color=#a020f0>#define wxSTC_INDIC2_MASK </FONT><FONT color=#ff00ff>128</FONT>
+<FONT color=#a020f0>#define wxSTC_INDICS_MASK </FONT><FONT color=#ff00ff>224</FONT>
+
+<FONT color=#0000ff>// PrintColourMode - use same colours as screen.</FONT>
+<FONT color=#a020f0>#define wxSTC_PRINT_NORMAL </FONT><FONT color=#ff00ff>0</FONT>
+
+<FONT color=#0000ff>// PrintColourMode - invert the light value of each style for printing.</FONT>
+<FONT color=#a020f0>#define wxSTC_PRINT_INVERTLIGHT </FONT><FONT color=#ff00ff>1</FONT>
+
+<FONT color=#0000ff>// PrintColourMode - force black text on white background for printing.</FONT>
+<FONT color=#a020f0>#define wxSTC_PRINT_BLACKONWHITE </FONT><FONT color=#ff00ff>2</FONT>
+
+<FONT color=#0000ff>// PrintColourMode - text stays coloured, but all background is forced to be white for printing.</FONT>
+<FONT color=#a020f0>#define wxSTC_PRINT_COLOURONWHITE </FONT><FONT color=#ff00ff>3</FONT>
+
+<FONT color=#0000ff>// PrintColourMode - only the default-background is forced to be white for printing.</FONT>
+<FONT color=#a020f0>#define wxSTC_PRINT_COLOURONWHITEDEFAULTBG </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_FIND_WHOLEWORD </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_FIND_MATCHCASE </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_FIND_WORDSTART </FONT><FONT color=#ff00ff>0x00100000</FONT>
+<FONT color=#a020f0>#define wxSTC_FIND_REGEXP </FONT><FONT color=#ff00ff>0x00200000</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_UNDO </FONT><FONT color=#ff00ff>2176</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_CUT </FONT><FONT color=#ff00ff>2177</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_COPY </FONT><FONT color=#ff00ff>2178</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_PASTE </FONT><FONT color=#ff00ff>2179</FONT>
+<FONT color=#a020f0>#define wxSTC_FOLDLEVELBASE </FONT><FONT color=#ff00ff>0x400</FONT>
+<FONT color=#a020f0>#define wxSTC_FOLDLEVELWHITEFLAG </FONT><FONT color=#ff00ff>0x1000</FONT>
+<FONT color=#a020f0>#define wxSTC_FOLDLEVELHEADERFLAG </FONT><FONT color=#ff00ff>0x2000</FONT>
+<FONT color=#a020f0>#define wxSTC_FOLDLEVELNUMBERMASK </FONT><FONT color=#ff00ff>0x0FFF</FONT>
+<FONT color=#a020f0>#define wxSTC_TIME_FOREVER </FONT><FONT color=#ff00ff>10000000</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINEDOWN </FONT><FONT color=#ff00ff>2300</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINEDOWNEXTEND </FONT><FONT color=#ff00ff>2301</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINEUP </FONT><FONT color=#ff00ff>2302</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINEUPEXTEND </FONT><FONT color=#ff00ff>2303</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_CHARLEFT </FONT><FONT color=#ff00ff>2304</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_CHARLEFTEXTEND </FONT><FONT color=#ff00ff>2305</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_CHARRIGHT </FONT><FONT color=#ff00ff>2306</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_CHARRIGHTEXTEND </FONT><FONT color=#ff00ff>2307</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_WORDLEFT </FONT><FONT color=#ff00ff>2308</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_WORDLEFTEXTEND </FONT><FONT color=#ff00ff>2309</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_WORDRIGHT </FONT><FONT color=#ff00ff>2310</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_WORDRIGHTEXTEND </FONT><FONT color=#ff00ff>2311</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_HOME </FONT><FONT color=#ff00ff>2312</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_HOMEEXTEND </FONT><FONT color=#ff00ff>2313</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINEEND </FONT><FONT color=#ff00ff>2314</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINEENDEXTEND </FONT><FONT color=#ff00ff>2315</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_DOCUMENTSTART </FONT><FONT color=#ff00ff>2316</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_DOCUMENTSTARTEXTEND </FONT><FONT color=#ff00ff>2317</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_DOCUMENTEND </FONT><FONT color=#ff00ff>2318</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_DOCUMENTENDEXTEND </FONT><FONT color=#ff00ff>2319</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_PAGEUP </FONT><FONT color=#ff00ff>2320</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_PAGEUPEXTEND </FONT><FONT color=#ff00ff>2321</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_PAGEDOWN </FONT><FONT color=#ff00ff>2322</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_PAGEDOWNEXTEND </FONT><FONT color=#ff00ff>2323</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_EDITTOGGLEOVERTYPE </FONT><FONT color=#ff00ff>2324</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_CANCEL </FONT><FONT color=#ff00ff>2325</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_DELETEBACK </FONT><FONT color=#ff00ff>2326</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_TAB </FONT><FONT color=#ff00ff>2327</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_BACKTAB </FONT><FONT color=#ff00ff>2328</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_NEWLINE </FONT><FONT color=#ff00ff>2329</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_FORMFEED </FONT><FONT color=#ff00ff>2330</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_VCHOME </FONT><FONT color=#ff00ff>2331</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_VCHOMEEXTEND </FONT><FONT color=#ff00ff>2332</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_ZOOMIN </FONT><FONT color=#ff00ff>2333</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_ZOOMOUT </FONT><FONT color=#ff00ff>2334</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_DELWORDLEFT </FONT><FONT color=#ff00ff>2335</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_DELWORDRIGHT </FONT><FONT color=#ff00ff>2336</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINECUT </FONT><FONT color=#ff00ff>2337</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINEDELETE </FONT><FONT color=#ff00ff>2338</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINETRANSPOSE </FONT><FONT color=#ff00ff>2339</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LOWERCASE </FONT><FONT color=#ff00ff>2340</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_UPPERCASE </FONT><FONT color=#ff00ff>2341</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINESCROLLDOWN </FONT><FONT color=#ff00ff>2342</FONT>
+<FONT color=#a020f0>#define wxSTC_CMD_LINESCROLLUP </FONT><FONT color=#ff00ff>2343</FONT>
+<FONT color=#a020f0>#define wxSTC_EDGE_NONE </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_EDGE_LINE </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_EDGE_BACKGROUND </FONT><FONT color=#ff00ff>2</FONT>
+
+<FONT color=#0000ff>// Show caret within N lines of edge when it's scrolled to view</FONT>
+<FONT color=#0000ff>// If CARET_SLOP not set then centre caret on screen when it's</FONT>
+<FONT color=#0000ff>// scrolled to view</FONT>
+<FONT color=#a020f0>#define wxSTC_CARET_SLOP </FONT><FONT color=#ff00ff>0x01</FONT>
+
+<FONT color=#0000ff>// Value not used</FONT>
+<FONT color=#a020f0>#define wxSTC_CARET_CENTER </FONT><FONT color=#ff00ff>0x02</FONT>
+
+<FONT color=#0000ff>// If CARET_SLOP also set then reposition whenever outside slop border</FONT>
+<FONT color=#0000ff>// If CARET_SLOP not set then recentre even when visible</FONT>
+<FONT color=#a020f0>#define wxSTC_CARET_STRICT </FONT><FONT color=#ff00ff>0x04</FONT>
+
+<FONT color=#0000ff>// If CARET_XEVEN set then both left and right margins are given equal weight</FONT>
+<FONT color=#0000ff>// rather than favouring left following behaviour.</FONT>
+<FONT color=#a020f0>#define wxSTC_CARET_XEVEN </FONT><FONT color=#ff00ff>0x08</FONT>
+
+<FONT color=#0000ff>// If CARET_XJUMPS set then when caret reaches the margin the display jumps</FONT>
+<FONT color=#0000ff>// enough to leave the caret solidly within the display.</FONT>
+<FONT color=#a020f0>#define wxSTC_CARET_XJUMPS </FONT><FONT color=#ff00ff>0x10</FONT>
+<FONT color=#a020f0>#define wxSTC_CURSORNORMAL -</FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_CURSORWAIT </FONT><FONT color=#ff00ff>3</FONT>
+
+<FONT color=#0000ff>// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy</FONT>
+<FONT color=#a020f0>#define wxSTC_VISIBLE_SLOP </FONT><FONT color=#ff00ff>0x01</FONT>
+<FONT color=#a020f0>#define wxSTC_VISIBLE_STRICT </FONT><FONT color=#ff00ff>0x04</FONT>
+
+<FONT color=#0000ff>// Notifications</FONT>
+<FONT color=#0000ff>// Type of modification and the action which caused the modification</FONT>
+<FONT color=#0000ff>// These are defined as a bit mask to make it easy to specify which notifications are wanted.</FONT>
+<FONT color=#0000ff>// One bit is set from each of SC_MOD_* and SC_PERFORMED_*.</FONT>
+<FONT color=#a020f0>#define wxSTC_MOD_INSERTTEXT </FONT><FONT color=#ff00ff>0x1</FONT>
+<FONT color=#a020f0>#define wxSTC_MOD_DELETETEXT </FONT><FONT color=#ff00ff>0x2</FONT>
+<FONT color=#a020f0>#define wxSTC_MOD_CHANGESTYLE </FONT><FONT color=#ff00ff>0x4</FONT>
+<FONT color=#a020f0>#define wxSTC_MOD_CHANGEFOLD </FONT><FONT color=#ff00ff>0x8</FONT>
+<FONT color=#a020f0>#define wxSTC_PERFORMED_USER </FONT><FONT color=#ff00ff>0x10</FONT>
+<FONT color=#a020f0>#define wxSTC_PERFORMED_UNDO </FONT><FONT color=#ff00ff>0x20</FONT>
+<FONT color=#a020f0>#define wxSTC_PERFORMED_REDO </FONT><FONT color=#ff00ff>0x40</FONT>
+<FONT color=#a020f0>#define wxSTC_LASTSTEPINUNDOREDO </FONT><FONT color=#ff00ff>0x100</FONT>
+<FONT color=#a020f0>#define wxSTC_MOD_CHANGEMARKER </FONT><FONT color=#ff00ff>0x200</FONT>
+<FONT color=#a020f0>#define wxSTC_MOD_BEFOREINSERT </FONT><FONT color=#ff00ff>0x400</FONT>
+<FONT color=#a020f0>#define wxSTC_MOD_BEFOREDELETE </FONT><FONT color=#ff00ff>0x800</FONT>
+<FONT color=#a020f0>#define wxSTC_MODEVENTMASKALL </FONT><FONT color=#ff00ff>0xF77</FONT>
+
+<FONT color=#0000ff>// Symbolic key codes and modifier flags</FONT>
+<FONT color=#0000ff>// ASCII and other printable characters below 256</FONT>
+<FONT color=#0000ff>// Extended keys above 300</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_DOWN </FONT><FONT color=#ff00ff>300</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_UP </FONT><FONT color=#ff00ff>301</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_LEFT </FONT><FONT color=#ff00ff>302</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_RIGHT </FONT><FONT color=#ff00ff>303</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_HOME </FONT><FONT color=#ff00ff>304</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_END </FONT><FONT color=#ff00ff>305</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_PRIOR </FONT><FONT color=#ff00ff>306</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_NEXT </FONT><FONT color=#ff00ff>307</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_DELETE </FONT><FONT color=#ff00ff>308</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_INSERT </FONT><FONT color=#ff00ff>309</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_ESCAPE </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_BACK </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_TAB </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_RETURN </FONT><FONT color=#ff00ff>13</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_ADD </FONT><FONT color=#ff00ff>310</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_SUBTRACT </FONT><FONT color=#ff00ff>311</FONT>
+<FONT color=#a020f0>#define wxSTC_KEY_DIVIDE </FONT><FONT color=#ff00ff>312</FONT>
+<FONT color=#a020f0>#define wxSTC_SCMOD_SHIFT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_SCMOD_CTRL </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_SCMOD_ALT </FONT><FONT color=#ff00ff>4</FONT>
+
+<FONT color=#0000ff>// For SciLexer.h</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_CONTAINER </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_NULL </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_PYTHON </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_CPP </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_HTML </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_XML </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_PERL </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_SQL </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_VB </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_PROPERTIES </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_ERRORLIST </FONT><FONT color=#ff00ff>10</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_MAKEFILE </FONT><FONT color=#ff00ff>11</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_BATCH </FONT><FONT color=#ff00ff>12</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_XCODE </FONT><FONT color=#ff00ff>13</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_LATEX </FONT><FONT color=#ff00ff>14</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_LUA </FONT><FONT color=#ff00ff>15</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_DIFF </FONT><FONT color=#ff00ff>16</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_CONF </FONT><FONT color=#ff00ff>17</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_PASCAL </FONT><FONT color=#ff00ff>18</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_AVE </FONT><FONT color=#ff00ff>19</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_ADA </FONT><FONT color=#ff00ff>20</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_LISP </FONT><FONT color=#ff00ff>21</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_RUBY </FONT><FONT color=#ff00ff>22</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_EIFFEL </FONT><FONT color=#ff00ff>23</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_EIFFELKW </FONT><FONT color=#ff00ff>24</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_TCL </FONT><FONT color=#ff00ff>25</FONT>
+
+<FONT color=#0000ff>// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a</FONT>
+<FONT color=#0000ff>// value assigned in sequence from SCLEX_AUTOMATIC+1.</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_AUTOMATIC </FONT><FONT color=#ff00ff>1000</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_PYTHON</FONT>
+<FONT color=#a020f0>#define wxSTC_P_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_P_COMMENTLINE </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_P_NUMBER </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_P_STRING </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_P_CHARACTER </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_P_WORD </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_P_TRIPLE </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_P_TRIPLEDOUBLE </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_P_CLASSNAME </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_P_DEFNAME </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_P_OPERATOR </FONT><FONT color=#ff00ff>10</FONT>
+<FONT color=#a020f0>#define wxSTC_P_IDENTIFIER </FONT><FONT color=#ff00ff>11</FONT>
+<FONT color=#a020f0>#define wxSTC_P_COMMENTBLOCK </FONT><FONT color=#ff00ff>12</FONT>
+<FONT color=#a020f0>#define wxSTC_P_STRINGEOL </FONT><FONT color=#ff00ff>13</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_CPP, SCLEX_VB</FONT>
+<FONT color=#a020f0>#define wxSTC_C_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_C_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_C_COMMENTLINE </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_C_COMMENTDOC </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_C_NUMBER </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_C_WORD </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_C_STRING </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_C_CHARACTER </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_C_UUID </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_C_PREPROCESSOR </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_C_OPERATOR </FONT><FONT color=#ff00ff>10</FONT>
+<FONT color=#a020f0>#define wxSTC_C_IDENTIFIER </FONT><FONT color=#ff00ff>11</FONT>
+<FONT color=#a020f0>#define wxSTC_C_STRINGEOL </FONT><FONT color=#ff00ff>12</FONT>
+<FONT color=#a020f0>#define wxSTC_C_VERBATIM </FONT><FONT color=#ff00ff>13</FONT>
+<FONT color=#a020f0>#define wxSTC_C_REGEX </FONT><FONT color=#ff00ff>14</FONT>
+<FONT color=#a020f0>#define wxSTC_C_COMMENTLINEDOC </FONT><FONT color=#ff00ff>15</FONT>
+<FONT color=#a020f0>#define wxSTC_C_WORD2 </FONT><FONT color=#ff00ff>16</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_HTML, SCLEX_XML</FONT>
+<FONT color=#a020f0>#define wxSTC_H_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_H_TAG </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_H_TAGUNKNOWN </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_H_ATTRIBUTE </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_H_ATTRIBUTEUNKNOWN </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_H_NUMBER </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_H_DOUBLESTRING </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SINGLESTRING </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_H_OTHER </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_H_COMMENT </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_H_ENTITY </FONT><FONT color=#ff00ff>10</FONT>
+
+<FONT color=#0000ff>// XML and ASP</FONT>
+<FONT color=#a020f0>#define wxSTC_H_TAGEND </FONT><FONT color=#ff00ff>11</FONT>
+<FONT color=#a020f0>#define wxSTC_H_XMLSTART </FONT><FONT color=#ff00ff>12</FONT>
+<FONT color=#a020f0>#define wxSTC_H_XMLEND </FONT><FONT color=#ff00ff>13</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SCRIPT </FONT><FONT color=#ff00ff>14</FONT>
+<FONT color=#a020f0>#define wxSTC_H_ASP </FONT><FONT color=#ff00ff>15</FONT>
+<FONT color=#a020f0>#define wxSTC_H_ASPAT </FONT><FONT color=#ff00ff>16</FONT>
+<FONT color=#a020f0>#define wxSTC_H_CDATA </FONT><FONT color=#ff00ff>17</FONT>
+<FONT color=#a020f0>#define wxSTC_H_QUESTION </FONT><FONT color=#ff00ff>18</FONT>
+
+<FONT color=#0000ff>// More HTML</FONT>
+<FONT color=#a020f0>#define wxSTC_H_VALUE </FONT><FONT color=#ff00ff>19</FONT>
+
+<FONT color=#0000ff>// X-Code</FONT>
+<FONT color=#a020f0>#define wxSTC_H_XCCOMMENT </FONT><FONT color=#ff00ff>20</FONT>
+
+<FONT color=#0000ff>// SGML</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML </FONT><FONT color=#ff00ff>21</FONT>
+
+<FONT color=#0000ff>// Embedded Javascript</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_START </FONT><FONT color=#ff00ff>40</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_DEFAULT </FONT><FONT color=#ff00ff>41</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_COMMENT </FONT><FONT color=#ff00ff>42</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_COMMENTLINE </FONT><FONT color=#ff00ff>43</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_COMMENTDOC </FONT><FONT color=#ff00ff>44</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_NUMBER </FONT><FONT color=#ff00ff>45</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_WORD </FONT><FONT color=#ff00ff>46</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_KEYWORD </FONT><FONT color=#ff00ff>47</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_DOUBLESTRING </FONT><FONT color=#ff00ff>48</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_SINGLESTRING </FONT><FONT color=#ff00ff>49</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_SYMBOLS </FONT><FONT color=#ff00ff>50</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_STRINGEOL </FONT><FONT color=#ff00ff>51</FONT>
+<FONT color=#a020f0>#define wxSTC_HJ_REGEX </FONT><FONT color=#ff00ff>52</FONT>
+
+<FONT color=#0000ff>// ASP Javascript</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_START </FONT><FONT color=#ff00ff>55</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_DEFAULT </FONT><FONT color=#ff00ff>56</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_COMMENT </FONT><FONT color=#ff00ff>57</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_COMMENTLINE </FONT><FONT color=#ff00ff>58</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_COMMENTDOC </FONT><FONT color=#ff00ff>59</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_NUMBER </FONT><FONT color=#ff00ff>60</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_WORD </FONT><FONT color=#ff00ff>61</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_KEYWORD </FONT><FONT color=#ff00ff>62</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_DOUBLESTRING </FONT><FONT color=#ff00ff>63</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_SINGLESTRING </FONT><FONT color=#ff00ff>64</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_SYMBOLS </FONT><FONT color=#ff00ff>65</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_STRINGEOL </FONT><FONT color=#ff00ff>66</FONT>
+<FONT color=#a020f0>#define wxSTC_HJA_REGEX </FONT><FONT color=#ff00ff>67</FONT>
+
+<FONT color=#0000ff>// Embedded VBScript</FONT>
+<FONT color=#a020f0>#define wxSTC_HB_START </FONT><FONT color=#ff00ff>70</FONT>
+<FONT color=#a020f0>#define wxSTC_HB_DEFAULT </FONT><FONT color=#ff00ff>71</FONT>
+<FONT color=#a020f0>#define wxSTC_HB_COMMENTLINE </FONT><FONT color=#ff00ff>72</FONT>
+<FONT color=#a020f0>#define wxSTC_HB_NUMBER </FONT><FONT color=#ff00ff>73</FONT>
+<FONT color=#a020f0>#define wxSTC_HB_WORD </FONT><FONT color=#ff00ff>74</FONT>
+<FONT color=#a020f0>#define wxSTC_HB_STRING </FONT><FONT color=#ff00ff>75</FONT>
+<FONT color=#a020f0>#define wxSTC_HB_IDENTIFIER </FONT><FONT color=#ff00ff>76</FONT>
+<FONT color=#a020f0>#define wxSTC_HB_STRINGEOL </FONT><FONT color=#ff00ff>77</FONT>
+
+<FONT color=#0000ff>// ASP VBScript</FONT>
+<FONT color=#a020f0>#define wxSTC_HBA_START </FONT><FONT color=#ff00ff>80</FONT>
+<FONT color=#a020f0>#define wxSTC_HBA_DEFAULT </FONT><FONT color=#ff00ff>81</FONT>
+<FONT color=#a020f0>#define wxSTC_HBA_COMMENTLINE </FONT><FONT color=#ff00ff>82</FONT>
+<FONT color=#a020f0>#define wxSTC_HBA_NUMBER </FONT><FONT color=#ff00ff>83</FONT>
+<FONT color=#a020f0>#define wxSTC_HBA_WORD </FONT><FONT color=#ff00ff>84</FONT>
+<FONT color=#a020f0>#define wxSTC_HBA_STRING </FONT><FONT color=#ff00ff>85</FONT>
+<FONT color=#a020f0>#define wxSTC_HBA_IDENTIFIER </FONT><FONT color=#ff00ff>86</FONT>
+<FONT color=#a020f0>#define wxSTC_HBA_STRINGEOL </FONT><FONT color=#ff00ff>87</FONT>
+
+<FONT color=#0000ff>// Embedded Python</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_START </FONT><FONT color=#ff00ff>90</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_DEFAULT </FONT><FONT color=#ff00ff>91</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_COMMENTLINE </FONT><FONT color=#ff00ff>92</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_NUMBER </FONT><FONT color=#ff00ff>93</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_STRING </FONT><FONT color=#ff00ff>94</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_CHARACTER </FONT><FONT color=#ff00ff>95</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_WORD </FONT><FONT color=#ff00ff>96</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_TRIPLE </FONT><FONT color=#ff00ff>97</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_TRIPLEDOUBLE </FONT><FONT color=#ff00ff>98</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_CLASSNAME </FONT><FONT color=#ff00ff>99</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_DEFNAME </FONT><FONT color=#ff00ff>100</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_OPERATOR </FONT><FONT color=#ff00ff>101</FONT>
+<FONT color=#a020f0>#define wxSTC_HP_IDENTIFIER </FONT><FONT color=#ff00ff>102</FONT>
+
+<FONT color=#0000ff>// ASP Python</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_START </FONT><FONT color=#ff00ff>105</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_DEFAULT </FONT><FONT color=#ff00ff>106</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_COMMENTLINE </FONT><FONT color=#ff00ff>107</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_NUMBER </FONT><FONT color=#ff00ff>108</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_STRING </FONT><FONT color=#ff00ff>109</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_CHARACTER </FONT><FONT color=#ff00ff>110</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_WORD </FONT><FONT color=#ff00ff>111</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_TRIPLE </FONT><FONT color=#ff00ff>112</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_TRIPLEDOUBLE </FONT><FONT color=#ff00ff>113</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_CLASSNAME </FONT><FONT color=#ff00ff>114</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_DEFNAME </FONT><FONT color=#ff00ff>115</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_OPERATOR </FONT><FONT color=#ff00ff>116</FONT>
+<FONT color=#a020f0>#define wxSTC_HPA_IDENTIFIER </FONT><FONT color=#ff00ff>117</FONT>
+
+<FONT color=#0000ff>// PHP</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_DEFAULT </FONT><FONT color=#ff00ff>118</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_HSTRING </FONT><FONT color=#ff00ff>119</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_SIMPLESTRING </FONT><FONT color=#ff00ff>120</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_WORD </FONT><FONT color=#ff00ff>121</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_NUMBER </FONT><FONT color=#ff00ff>122</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_VARIABLE </FONT><FONT color=#ff00ff>123</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_COMMENT </FONT><FONT color=#ff00ff>124</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_COMMENTLINE </FONT><FONT color=#ff00ff>125</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_HSTRING_VARIABLE </FONT><FONT color=#ff00ff>126</FONT>
+<FONT color=#a020f0>#define wxSTC_HPHP_OPERATOR </FONT><FONT color=#ff00ff>127</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_PERL</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_ERROR </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_COMMENTLINE </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_POD </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_NUMBER </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_WORD </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_STRING </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_CHARACTER </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_PUNCTUATION </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_PREPROCESSOR </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_OPERATOR </FONT><FONT color=#ff00ff>10</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_IDENTIFIER </FONT><FONT color=#ff00ff>11</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_SCALAR </FONT><FONT color=#ff00ff>12</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_ARRAY </FONT><FONT color=#ff00ff>13</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_HASH </FONT><FONT color=#ff00ff>14</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_SYMBOLTABLE </FONT><FONT color=#ff00ff>15</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_REGEX </FONT><FONT color=#ff00ff>17</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_REGSUBST </FONT><FONT color=#ff00ff>18</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_LONGQUOTE </FONT><FONT color=#ff00ff>19</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_BACKTICKS </FONT><FONT color=#ff00ff>20</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_DATASECTION </FONT><FONT color=#ff00ff>21</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_HERE_DELIM </FONT><FONT color=#ff00ff>22</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_HERE_Q </FONT><FONT color=#ff00ff>23</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_HERE_QQ </FONT><FONT color=#ff00ff>24</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_HERE_QX </FONT><FONT color=#ff00ff>25</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_STRING_Q </FONT><FONT color=#ff00ff>26</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_STRING_QQ </FONT><FONT color=#ff00ff>27</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_STRING_QX </FONT><FONT color=#ff00ff>28</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_STRING_QR </FONT><FONT color=#ff00ff>29</FONT>
+<FONT color=#a020f0>#define wxSTC_PL_STRING_QW </FONT><FONT color=#ff00ff>30</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_LATEX</FONT>
+<FONT color=#a020f0>#define wxSTC_L_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_L_COMMAND </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_L_TAG </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_L_MATH </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_L_COMMENT </FONT><FONT color=#ff00ff>4</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_LUA</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_COMMENTLINE </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_COMMENTDOC </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_NUMBER </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_WORD </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_STRING </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_CHARACTER </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_LITERALSTRING </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_PREPROCESSOR </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_OPERATOR </FONT><FONT color=#ff00ff>10</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_IDENTIFIER </FONT><FONT color=#ff00ff>11</FONT>
+<FONT color=#a020f0>#define wxSTC_LUA_STRINGEOL </FONT><FONT color=#ff00ff>12</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_ERRORLIST</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_PYTHON </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_GCC </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_MS </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_CMD </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_BORLAND </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_PERL </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_NET </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_LUA </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_DIFF_CHANGED </FONT><FONT color=#ff00ff>10</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_DIFF_ADDITION </FONT><FONT color=#ff00ff>11</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_DIFF_DELETION </FONT><FONT color=#ff00ff>12</FONT>
+<FONT color=#a020f0>#define wxSTC_ERR_DIFF_MESSAGE </FONT><FONT color=#ff00ff>13</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_BATCH</FONT>
+<FONT color=#a020f0>#define wxSTC_BAT_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_BAT_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_BAT_WORD </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_BAT_LABEL </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_BAT_HIDE </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_BAT_COMMAND </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_BAT_IDENTIFIER </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_BAT_OPERATOR </FONT><FONT color=#ff00ff>7</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_MAKEFILE</FONT>
+<FONT color=#a020f0>#define wxSTC_MAKE_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_MAKE_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_MAKE_PREPROCESSOR </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_MAKE_IDENTIFIER </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_MAKE_OPERATOR </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_MAKE_TARGET </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_MAKE_IDEOL </FONT><FONT color=#ff00ff>9</FONT>
+
+<FONT color=#0000ff>// Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_NUMBER </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_IDENTIFIER </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_EXTENSION </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_PARAMETER </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_STRING </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_OPERATOR </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_IP </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_CONF_DIRECTIVE </FONT><FONT color=#ff00ff>9</FONT>
+
+<FONT color=#0000ff>// Avenue</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_NUMBER </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_WORD </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_KEYWORD </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_STATEMENT </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_STRING </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_ENUM </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_STRINGEOL </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_IDENTIFIER </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_AVE_OPERATOR </FONT><FONT color=#ff00ff>10</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_ADA</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_NUMBER </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_WORD </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_STRING </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_CHARACTER </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_OPERATOR </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_IDENTIFIER </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_ADA_STRINGEOL </FONT><FONT color=#ff00ff>8</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_LISP</FONT>
+<FONT color=#a020f0>#define wxSTC_LISP_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_LISP_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_LISP_NUMBER </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_LISP_KEYWORD </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_LISP_STRING </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_LISP_STRINGEOL </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_LISP_IDENTIFIER </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_LISP_OPERATOR </FONT><FONT color=#ff00ff>10</FONT>
+
+<FONT color=#0000ff>// Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_COMMENTLINE </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_NUMBER </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_WORD </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_STRING </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_CHARACTER </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_OPERATOR </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_IDENTIFIER </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_EIFFEL_STRINGEOL </FONT><FONT color=#ff00ff>8</FONT>
+
+<FONT color=#0000ff>// END of generated section</FONT>
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+<FONT color=#0000ff>// Others</FONT>
+
+<FONT color=#a020f0>#define wxSTC_MASK_FOLDERS ((</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0> &lt;&lt; wxSTC_MARKNUM_FOLDER) | (</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0> &lt;&lt; wxSTC_MARKNUM_FOLDEROPEN))</FONT>
+
+
+
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+
+<B><FONT color=#2e8b57>class</FONT></B>  ScintillaWX;                      <FONT color=#0000ff>// forward declare</FONT>
+<B><FONT color=#2e8b57>class</FONT></B>  WordList;
+<B><FONT color=#2e8b57>struct</FONT></B> SCNotification;
+
+
+<B><FONT color=#2e8b57>extern</FONT></B> <B><FONT color=#2e8b57>const</FONT></B> wxChar* wxSTCNameStr;
+
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+
+<B><FONT color=#2e8b57>class</FONT></B> wxStyledTextCtrl : <B><FONT color=#804040>public</FONT></B> wxControl {
+<B><FONT color=#804040>public</FONT></B>:
+
+<FONT color=#a020f0>#ifdef SWIG</FONT>
     wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
-                     <B><FONT COLOR=#2e8b57>const</FONT></B> wxPoint&amp; pos = wxDefaultPosition,
-                     <B><FONT COLOR=#2e8b57>const</FONT></B> wxSize&amp; size = wxDefaultSize, <B><FONT COLOR=#2e8b57>long</FONT></B> style = <FONT COLOR=#ff00ff>0</FONT>,
-                     <B><FONT COLOR=#2e8b57>const</FONT></B> <B><FONT COLOR=#2e8b57>char</FONT></B>* name = <FONT COLOR=#ff00ff>&quot;styledtext&quot;</FONT>);
-<FONT COLOR=#a020f0>#else</FONT>
+                     <B><FONT color=#2e8b57>const</FONT></B> wxPoint&amp; pos = wxDefaultPosition,
+                     <B><FONT color=#2e8b57>const</FONT></B> wxSize&amp; size = wxDefaultSize, <B><FONT color=#2e8b57>long</FONT></B> style = <FONT color=#ff00ff>0</FONT>,
+                     <B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* name = <FONT color=#ff00ff>&quot;styledtext&quot;</FONT>);
+<FONT color=#a020f0>#else</FONT>
     wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
-                     <B><FONT COLOR=#2e8b57>const</FONT></B> wxPoint&amp; pos = wxDefaultPosition,
-                     <B><FONT COLOR=#2e8b57>const</FONT></B> wxSize&amp; size = wxDefaultSize, <B><FONT COLOR=#2e8b57>long</FONT></B> style = <FONT COLOR=#ff00ff>0</FONT>,
-                     <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; name = wxSTCNameStr);
-<FONT COLOR=#a020f0>#endif</FONT>
+                     <B><FONT color=#2e8b57>const</FONT></B> wxPoint&amp; pos = wxDefaultPosition,
+                     <B><FONT color=#2e8b57>const</FONT></B> wxSize&amp; size = wxDefaultSize, <B><FONT color=#2e8b57>long</FONT></B> style = <FONT color=#ff00ff>0</FONT>,
+                     <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; name = wxSTCNameStr);
+<FONT color=#a020f0>#endif</FONT>
 
 
-<FONT COLOR=#a020f0>#ifndef SWIG</FONT>
+<FONT color=#a020f0>#ifndef SWIG</FONT>
     ~wxStyledTextCtrl();
-<FONT COLOR=#a020f0>#endif</FONT>
+<FONT color=#a020f0>#endif</FONT>
 
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
-<FONT COLOR=#0000ff>// BEGIN generated section.  The following code is automatically generated</FONT>
-<FONT COLOR=#0000ff>//       by gen_iface.py.  Do not edit this file.  Edit stc.h.in instead</FONT>
-<FONT COLOR=#0000ff>//       and regenerate</FONT>
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+<FONT color=#0000ff>// BEGIN generated section.  The following code is automatically generated</FONT>
+<FONT color=#0000ff>//       by gen_iface.py.  Do not edit this file.  Edit stc.h.in instead</FONT>
+<FONT color=#0000ff>//       and regenerate</FONT>
 
 
-    <FONT COLOR=#0000ff>// Add text to the document</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AddText(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text);
+    <FONT color=#0000ff>// Add text to the document</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AddText(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
 
-    <FONT COLOR=#0000ff>// Add array of cells to document</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AddStyledText(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text);
+    <FONT color=#0000ff>// Add array of cells to document</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AddStyledText(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
 
-    <FONT COLOR=#0000ff>// Insert string at a position</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> InsertText(<B><FONT COLOR=#2e8b57>int</FONT></B> pos, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text);
+    <FONT color=#0000ff>// Insert string at a position</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> InsertText(<B><FONT color=#2e8b57>int</FONT></B> pos, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
 
-    <FONT COLOR=#0000ff>// Delete all text in the document</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ClearAll();
+    <FONT color=#0000ff>// Delete all text in the document</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ClearAll();
 
-    <FONT COLOR=#0000ff>// Set all style bytes to 0, remove all folding information</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ClearDocumentStyle();
+    <FONT color=#0000ff>// Set all style bytes to 0, remove all folding information</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ClearDocumentStyle();
 
-    <FONT COLOR=#0000ff>// The number of characters in the document</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetLength();
+    <FONT color=#0000ff>// The number of characters in the document</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetLength();
 
-    <FONT COLOR=#0000ff>// Returns the character byte at the position</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetCharAt(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Returns the character byte at the position</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetCharAt(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Returns the position of the caret</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetCurrentPos();
+    <FONT color=#0000ff>// Returns the position of the caret</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetCurrentPos();
 
-    <FONT COLOR=#0000ff>// Returns the position of the opposite end of the selection to the caret</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetAnchor();
+    <FONT color=#0000ff>// Returns the position of the opposite end of the selection to the caret</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetAnchor();
 
-    <FONT COLOR=#0000ff>// Returns the style byte at the position</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetStyleAt(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Returns the style byte at the position</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetStyleAt(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Redoes the next action on the undo history</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> Redo();
+    <FONT color=#0000ff>// Redoes the next action on the undo history</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> Redo();
 
-    <FONT COLOR=#0000ff>// Choose between collecting actions into the undo</FONT>
-    <FONT COLOR=#0000ff>// history and discarding them.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetUndoCollection(<B><FONT COLOR=#2e8b57>bool</FONT></B> collectUndo);
+    <FONT color=#0000ff>// Choose between collecting actions into the undo</FONT>
+    <FONT color=#0000ff>// history and discarding them.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetUndoCollection(<B><FONT color=#2e8b57>bool</FONT></B> collectUndo);
 
-    <FONT COLOR=#0000ff>// Select all the text in the document.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SelectAll();
+    <FONT color=#0000ff>// Select all the text in the document.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SelectAll();
 
-    <FONT COLOR=#0000ff>// Remember the current position in the undo history as the position</FONT>
-    <FONT COLOR=#0000ff>// at which the document was saved.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetSavePoint();
+    <FONT color=#0000ff>// Remember the current position in the undo history as the position</FONT>
+    <FONT color=#0000ff>// at which the document was saved.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetSavePoint();
 
-    <FONT COLOR=#0000ff>// Retrieve a buffer of cells.</FONT>
-    wxString GetStyledText(<B><FONT COLOR=#2e8b57>int</FONT></B> startPos, <B><FONT COLOR=#2e8b57>int</FONT></B> endPos);
+    <FONT color=#0000ff>// Retrieve a buffer of cells.</FONT>
+    wxString GetStyledText(<B><FONT color=#2e8b57>int</FONT></B> startPos, <B><FONT color=#2e8b57>int</FONT></B> endPos);
 
-    <FONT COLOR=#0000ff>// Are there any redoable actions in the undo history.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> CanRedo();
+    <FONT color=#0000ff>// Are there any redoable actions in the undo history.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> CanRedo();
 
-    <FONT COLOR=#0000ff>// Retrieve the line number at which a particular marker is located</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> MarkerLineFromHandle(<B><FONT COLOR=#2e8b57>int</FONT></B> handle);
+    <FONT color=#0000ff>// Retrieve the line number at which a particular marker is located</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> MarkerLineFromHandle(<B><FONT color=#2e8b57>int</FONT></B> handle);
 
-    <FONT COLOR=#0000ff>// Delete a marker.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> MarkerDeleteHandle(<B><FONT COLOR=#2e8b57>int</FONT></B> handle);
+    <FONT color=#0000ff>// Delete a marker.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> MarkerDeleteHandle(<B><FONT color=#2e8b57>int</FONT></B> handle);
 
-    <FONT COLOR=#0000ff>// Is undo history being collected?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetUndoCollection();
+    <FONT color=#0000ff>// Is undo history being collected?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetUndoCollection();
 
-    <FONT COLOR=#0000ff>// Are white space characters currently visible?</FONT>
-    <FONT COLOR=#0000ff>// Returns one of SCWS_* constants.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetViewWhiteSpace();
+    <FONT color=#0000ff>// Are white space characters currently visible?</FONT>
+    <FONT color=#0000ff>// Returns one of SCWS_* constants.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetViewWhiteSpace();
 
-    <FONT COLOR=#0000ff>// Make white space characters invisible, always visible or visible outside indentation.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetViewWhiteSpace(<B><FONT COLOR=#2e8b57>int</FONT></B> viewWS);
+    <FONT color=#0000ff>// Make white space characters invisible, always visible or visible outside indentation.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetViewWhiteSpace(<B><FONT color=#2e8b57>int</FONT></B> viewWS);
 
-    <FONT COLOR=#0000ff>// Find the position from a point within the window.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> PositionFromPoint(wxPoint pt);
+    <FONT color=#0000ff>// Find the position from a point within the window.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> PositionFromPoint(wxPoint pt);
 
-    <FONT COLOR=#0000ff>// Set caret to start of a line and ensure it is visible.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> GotoLine(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Find the position from a point within the window but return</FONT>
+    <FONT color=#0000ff>// INVALID_POSITION if not close to text.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> PositionFromPointClose(<B><FONT color=#2e8b57>int</FONT></B> x, <B><FONT color=#2e8b57>int</FONT></B> y);
 
-    <FONT COLOR=#0000ff>// Set caret to a position and ensure it is visible.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> GotoPos(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Set caret to start of a line and ensure it is visible.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> GotoLine(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Set the selection anchor to a position. The anchor is the opposite</FONT>
-    <FONT COLOR=#0000ff>// end of the selection from the caret.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetAnchor(<B><FONT COLOR=#2e8b57>int</FONT></B> posAnchor);
+    <FONT color=#0000ff>// Set caret to a position and ensure it is visible.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> GotoPos(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Retrieve the text of the line containing the caret.</FONT>
-    <FONT COLOR=#0000ff>// Returns the index of the caret on the line.</FONT>
-    wxString GetCurLine(<B><FONT COLOR=#2e8b57>int</FONT></B>* OUTPUT=NULL);
+    <FONT color=#0000ff>// Set the selection anchor to a position. The anchor is the opposite</FONT>
+    <FONT color=#0000ff>// end of the selection from the caret.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetAnchor(<B><FONT color=#2e8b57>int</FONT></B> posAnchor);
 
-    <FONT COLOR=#0000ff>// Retrieve the position of the last correctly styled character.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetEndStyled();
+    <FONT color=#0000ff>// Retrieve the text of the line containing the caret.</FONT>
+    <FONT color=#0000ff>// Returns the index of the caret on the line.</FONT>
+    wxString GetCurLine(<B><FONT color=#2e8b57>int</FONT></B>* OUTPUT=<FONT color=#ff00ff>NULL</FONT>);
 
-    <FONT COLOR=#0000ff>// Convert all line endings in the document to use the current mode.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ConvertEOLs();
+    <FONT color=#0000ff>// Retrieve the position of the last correctly styled character.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetEndStyled();
 
-    <FONT COLOR=#0000ff>// Retrieve the current end of line mode - one of CRLF, CR, or LF.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetEOLMode();
+    <FONT color=#0000ff>// Convert all line endings in the document to one mode.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ConvertEOLs(<B><FONT color=#2e8b57>int</FONT></B> eolMode);
 
-    <FONT COLOR=#0000ff>// Set the current end of line mode.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetEOLMode(<B><FONT COLOR=#2e8b57>int</FONT></B> eolMode);
+    <FONT color=#0000ff>// Retrieve the current end of line mode - one of CRLF, CR, or LF.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetEOLMode();
 
-    <FONT COLOR=#0000ff>// Set the current styling position to pos and the styling mask to mask.</FONT>
-    <FONT COLOR=#0000ff>// The styling mask can be used to protect some bits in each styling byte from</FONT>
-    <FONT COLOR=#0000ff>// modification.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StartStyling(<B><FONT COLOR=#2e8b57>int</FONT></B> pos, <B><FONT COLOR=#2e8b57>int</FONT></B> mask);
+    <FONT color=#0000ff>// Set the current end of line mode.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetEOLMode(<B><FONT color=#2e8b57>int</FONT></B> eolMode);
 
-    <FONT COLOR=#0000ff>// Change style from current styling position for length characters to a style</FONT>
-    <FONT COLOR=#0000ff>// and move the current styling position to after this newly styled segment.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetStyling(<B><FONT COLOR=#2e8b57>int</FONT></B> length, <B><FONT COLOR=#2e8b57>int</FONT></B> style);
+    <FONT color=#0000ff>// Set the current styling position to pos and the styling mask to mask.</FONT>
+    <FONT color=#0000ff>// The styling mask can be used to protect some bits in each styling byte from</FONT>
+    <FONT color=#0000ff>// modification.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StartStyling(<B><FONT color=#2e8b57>int</FONT></B> pos, <B><FONT color=#2e8b57>int</FONT></B> mask);
 
-    <FONT COLOR=#0000ff>// Is drawing done first into a buffer or direct to the screen.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetBufferedDraw();
+    <FONT color=#0000ff>// Change style from current styling position for length characters to a style</FONT>
+    <FONT color=#0000ff>// and move the current styling position to after this newly styled segment.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetStyling(<B><FONT color=#2e8b57>int</FONT></B> length, <B><FONT color=#2e8b57>int</FONT></B> style);
 
-    <FONT COLOR=#0000ff>// If drawing is buffered then each line of text is drawn into a bitmap buffer</FONT>
-    <FONT COLOR=#0000ff>// before drawing it to the screen to avoid flicker.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetBufferedDraw(<B><FONT COLOR=#2e8b57>bool</FONT></B> buffered);
+    <FONT color=#0000ff>// Is drawing done first into a buffer or direct to the screen.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetBufferedDraw();
 
-    <FONT COLOR=#0000ff>// Change the visible size of a tab to be a multiple of the width of a space</FONT>
-    <FONT COLOR=#0000ff>// character.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetTabWidth(<B><FONT COLOR=#2e8b57>int</FONT></B> tabWidth);
+    <FONT color=#0000ff>// If drawing is buffered then each line of text is drawn into a bitmap buffer</FONT>
+    <FONT color=#0000ff>// before drawing it to the screen to avoid flicker.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetBufferedDraw(<B><FONT color=#2e8b57>bool</FONT></B> buffered);
 
-    <FONT COLOR=#0000ff>// Retrieve the visible size of a tab.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetTabWidth();
+    <FONT color=#0000ff>// Change the visible size of a tab to be a multiple of the width of a space</FONT>
+    <FONT color=#0000ff>// character.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetTabWidth(<B><FONT color=#2e8b57>int</FONT></B> tabWidth);
 
-    <FONT COLOR=#0000ff>// Set the code page used to interpret the bytes of the document as characters.</FONT>
-    <FONT COLOR=#0000ff>// The SC_CP_UTF8 value can be used to enter Unicode mode.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetCodePage(<B><FONT COLOR=#2e8b57>int</FONT></B> codePage);
+    <FONT color=#0000ff>// Retrieve the visible size of a tab.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetTabWidth();
 
-    <FONT COLOR=#0000ff>// Set the symbol used for a particular marker number,</FONT>
-    <FONT COLOR=#0000ff>// and optionally the for and background colours.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> MarkerDefine(<B><FONT COLOR=#2e8b57>int</FONT></B> markerNumber, <B><FONT COLOR=#2e8b57>int</FONT></B> markerSymbol,
-                         <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; foreground = wxNullColour,
-                         <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; background = wxNullColour);
+    <FONT color=#0000ff>// Set the code page used to interpret the bytes of the document as characters.</FONT>
+    <FONT color=#0000ff>// The SC_CP_UTF8 value can be used to enter Unicode mode.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCodePage(<B><FONT color=#2e8b57>int</FONT></B> codePage);
 
-    <FONT COLOR=#0000ff>// Set the foreground colour used for a particular marker number.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> MarkerSetForeground(<B><FONT COLOR=#2e8b57>int</FONT></B> markerNumber, <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; fore);
+    <FONT color=#0000ff>// Set the symbol used for a particular marker number,</FONT>
+    <FONT color=#0000ff>// and optionally the for and background colours.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> MarkerDefine(<B><FONT color=#2e8b57>int</FONT></B> markerNumber, <B><FONT color=#2e8b57>int</FONT></B> markerSymbol,
+                         <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; foreground = wxNullColour,
+                         <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; background = wxNullColour);
 
-    <FONT COLOR=#0000ff>// Set the background colour used for a particular marker number.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> MarkerSetBackground(<B><FONT COLOR=#2e8b57>int</FONT></B> markerNumber, <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; back);
+    <FONT color=#0000ff>// Set the foreground colour used for a particular marker number.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> MarkerSetForeground(<B><FONT color=#2e8b57>int</FONT></B> markerNumber, <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; fore);
 
-    <FONT COLOR=#0000ff>// Add a marker to a line.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> MarkerAdd(<B><FONT COLOR=#2e8b57>int</FONT></B> line, <B><FONT COLOR=#2e8b57>int</FONT></B> markerNumber);
+    <FONT color=#0000ff>// Set the background colour used for a particular marker number.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> MarkerSetBackground(<B><FONT color=#2e8b57>int</FONT></B> markerNumber, <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; back);
 
-    <FONT COLOR=#0000ff>// Delete a marker from a line</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> MarkerDelete(<B><FONT COLOR=#2e8b57>int</FONT></B> line, <B><FONT COLOR=#2e8b57>int</FONT></B> markerNumber);
+    <FONT color=#0000ff>// Add a marker to a line.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> MarkerAdd(<B><FONT color=#2e8b57>int</FONT></B> line, <B><FONT color=#2e8b57>int</FONT></B> markerNumber);
 
-    <FONT COLOR=#0000ff>// Delete all markers with a particular number from all lines</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> MarkerDeleteAll(<B><FONT COLOR=#2e8b57>int</FONT></B> markerNumber);
+    <FONT color=#0000ff>// Delete a marker from a line</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> MarkerDelete(<B><FONT color=#2e8b57>int</FONT></B> line, <B><FONT color=#2e8b57>int</FONT></B> markerNumber);
 
-    <FONT COLOR=#0000ff>// Get a bit mask of all the markers set on a line.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> MarkerGet(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Delete all markers with a particular number from all lines</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> MarkerDeleteAll(<B><FONT color=#2e8b57>int</FONT></B> markerNumber);
 
-    <FONT COLOR=#0000ff>// Find the next line after lineStart that includes a marker in mask.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> MarkerNext(<B><FONT COLOR=#2e8b57>int</FONT></B> lineStart, <B><FONT COLOR=#2e8b57>int</FONT></B> markerMask);
+    <FONT color=#0000ff>// Get a bit mask of all the markers set on a line.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> MarkerGet(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Find the previous line before lineStart that includes a marker in mask.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> MarkerPrevious(<B><FONT COLOR=#2e8b57>int</FONT></B> lineStart, <B><FONT COLOR=#2e8b57>int</FONT></B> markerMask);
+    <FONT color=#0000ff>// Find the next line after lineStart that includes a marker in mask.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> MarkerNext(<B><FONT color=#2e8b57>int</FONT></B> lineStart, <B><FONT color=#2e8b57>int</FONT></B> markerMask);
 
-    <FONT COLOR=#0000ff>// Set a margin to be either numeric or symbolic.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMarginType(<B><FONT COLOR=#2e8b57>int</FONT></B> margin, <B><FONT COLOR=#2e8b57>int</FONT></B> marginType);
+    <FONT color=#0000ff>// Find the previous line before lineStart that includes a marker in mask.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> MarkerPrevious(<B><FONT color=#2e8b57>int</FONT></B> lineStart, <B><FONT color=#2e8b57>int</FONT></B> markerMask);
 
-    <FONT COLOR=#0000ff>// Retrieve the type of a margin.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetMarginType(<B><FONT COLOR=#2e8b57>int</FONT></B> margin);
+    <FONT color=#0000ff>// Set a margin to be either numeric or symbolic.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMarginType(<B><FONT color=#2e8b57>int</FONT></B> margin, <B><FONT color=#2e8b57>int</FONT></B> marginType);
 
-    <FONT COLOR=#0000ff>// Set the width of a margin to a width expressed in pixels.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMarginWidth(<B><FONT COLOR=#2e8b57>int</FONT></B> margin, <B><FONT COLOR=#2e8b57>int</FONT></B> pixelWidth);
+    <FONT color=#0000ff>// Retrieve the type of a margin.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetMarginType(<B><FONT color=#2e8b57>int</FONT></B> margin);
 
-    <FONT COLOR=#0000ff>// Retrieve the width of a margin in pixels.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetMarginWidth(<B><FONT COLOR=#2e8b57>int</FONT></B> margin);
+    <FONT color=#0000ff>// Set the width of a margin to a width expressed in pixels.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMarginWidth(<B><FONT color=#2e8b57>int</FONT></B> margin, <B><FONT color=#2e8b57>int</FONT></B> pixelWidth);
 
-    <FONT COLOR=#0000ff>// Set a mask that determines which markers are displayed in a margin.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMarginMask(<B><FONT COLOR=#2e8b57>int</FONT></B> margin, <B><FONT COLOR=#2e8b57>int</FONT></B> mask);
+    <FONT color=#0000ff>// Retrieve the width of a margin in pixels.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetMarginWidth(<B><FONT color=#2e8b57>int</FONT></B> margin);
 
-    <FONT COLOR=#0000ff>// Retrieve the marker mask of a margin.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetMarginMask(<B><FONT COLOR=#2e8b57>int</FONT></B> margin);
+    <FONT color=#0000ff>// Set a mask that determines which markers are displayed in a margin.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMarginMask(<B><FONT color=#2e8b57>int</FONT></B> margin, <B><FONT color=#2e8b57>int</FONT></B> mask);
 
-    <FONT COLOR=#0000ff>// Make a margin sensitive or insensitive to mouse clicks.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMarginSensitive(<B><FONT COLOR=#2e8b57>int</FONT></B> margin, <B><FONT COLOR=#2e8b57>bool</FONT></B> sensitive);
+    <FONT color=#0000ff>// Retrieve the marker mask of a margin.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetMarginMask(<B><FONT color=#2e8b57>int</FONT></B> margin);
 
-    <FONT COLOR=#0000ff>// Retrieve the mouse click sensitivity of a margin.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetMarginSensitive(<B><FONT COLOR=#2e8b57>int</FONT></B> margin);
+    <FONT color=#0000ff>// Make a margin sensitive or insensitive to mouse clicks.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMarginSensitive(<B><FONT color=#2e8b57>int</FONT></B> margin, <B><FONT color=#2e8b57>bool</FONT></B> sensitive);
 
-    <FONT COLOR=#0000ff>// Clear all the styles and make equivalent to the global default style.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleClearAll();
+    <FONT color=#0000ff>// Retrieve the mouse click sensitivity of a margin.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetMarginSensitive(<B><FONT color=#2e8b57>int</FONT></B> margin);
 
-    <FONT COLOR=#0000ff>// Set the foreground colour of a style.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetForeground(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; fore);
+    <FONT color=#0000ff>// Clear all the styles and make equivalent to the global default style.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleClearAll();
 
-    <FONT COLOR=#0000ff>// Set the background colour of a style.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetBackground(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; back);
+    <FONT color=#0000ff>// Set the foreground colour of a style.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetForeground(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; fore);
 
-    <FONT COLOR=#0000ff>// Set a style to be bold or not.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetBold(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>bool</FONT></B> bold);
+    <FONT color=#0000ff>// Set the background colour of a style.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetBackground(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; back);
 
-    <FONT COLOR=#0000ff>// Set a style to be italic or not.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetItalic(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>bool</FONT></B> italic);
+    <FONT color=#0000ff>// Set a style to be bold or not.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetBold(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>bool</FONT></B> bold);
 
-    <FONT COLOR=#0000ff>// Set the size of characters of a style.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetSize(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>int</FONT></B> sizePoints);
+    <FONT color=#0000ff>// Set a style to be italic or not.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetItalic(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>bool</FONT></B> italic);
 
-    <FONT COLOR=#0000ff>// Set the font of a style.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetFaceName(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; fontName);
+    <FONT color=#0000ff>// Set the size of characters of a style.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetSize(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>int</FONT></B> sizePoints);
 
-    <FONT COLOR=#0000ff>// Set a style to have its end of line filled or not.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetEOLFilled(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>bool</FONT></B> filled);
+    <FONT color=#0000ff>// Set the font of a style.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetFaceName(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; fontName);
 
-    <FONT COLOR=#0000ff>// Reset the default style to its state at startup</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleResetDefault();
+    <FONT color=#0000ff>// Set a style to have its end of line filled or not.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetEOLFilled(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>bool</FONT></B> filled);
 
-    <FONT COLOR=#0000ff>// Set a style to be underlined or not.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetUnderline(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>bool</FONT></B> underline);
+    <FONT color=#0000ff>// Reset the default style to its state at startup</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleResetDefault();
 
-    <FONT COLOR=#0000ff>// Set the foreground colour of the selection and whether to use this setting.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetSelForeground(<B><FONT COLOR=#2e8b57>bool</FONT></B> useSetting, <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; fore);
+    <FONT color=#0000ff>// Set a style to be underlined or not.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetUnderline(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>bool</FONT></B> underline);
 
-    <FONT COLOR=#0000ff>// Set the background colour of the selection and whether to use this setting.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetSelBackground(<B><FONT COLOR=#2e8b57>bool</FONT></B> useSetting, <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; back);
+    <FONT color=#0000ff>// Set a style to be mixed case, or to force upper or lower case.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetCase(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>int</FONT></B> caseForce);
 
-    <FONT COLOR=#0000ff>// Set the foreground colour of the caret.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetCaretForeground(<B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; fore);
+    <FONT color=#0000ff>// Set the foreground colour of the selection and whether to use this setting.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetSelForeground(<B><FONT color=#2e8b57>bool</FONT></B> useSetting, <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; fore);
 
-    <FONT COLOR=#0000ff>// When key+modifier combination km is pressed perform msg.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CmdKeyAssign(<B><FONT COLOR=#2e8b57>int</FONT></B> key, <B><FONT COLOR=#2e8b57>int</FONT></B> modifiers, <B><FONT COLOR=#2e8b57>int</FONT></B> cmd);
+    <FONT color=#0000ff>// Set the background colour of the selection and whether to use this setting.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetSelBackground(<B><FONT color=#2e8b57>bool</FONT></B> useSetting, <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; back);
 
-    <FONT COLOR=#0000ff>// When key+modifier combination km do nothing.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CmdKeyClear(<B><FONT COLOR=#2e8b57>int</FONT></B> key, <B><FONT COLOR=#2e8b57>int</FONT></B> modifiers);
+    <FONT color=#0000ff>// Set the foreground colour of the caret.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCaretForeground(<B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; fore);
 
-    <FONT COLOR=#0000ff>// Drop all key mappings.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CmdKeyClearAll();
+    <FONT color=#0000ff>// When key+modifier combination km is pressed perform msg.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> CmdKeyAssign(<B><FONT color=#2e8b57>int</FONT></B> key, <B><FONT color=#2e8b57>int</FONT></B> modifiers, <B><FONT color=#2e8b57>int</FONT></B> cmd);
 
-    <FONT COLOR=#0000ff>// Set the styles for a segment of the document.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetStyleBytes(<B><FONT COLOR=#2e8b57>int</FONT></B> length, <B><FONT COLOR=#2e8b57>char</FONT></B>* styleBytes);
+    <FONT color=#0000ff>// When key+modifier combination km do nothing.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> CmdKeyClear(<B><FONT color=#2e8b57>int</FONT></B> key, <B><FONT color=#2e8b57>int</FONT></B> modifiers);
 
-    <FONT COLOR=#0000ff>// Set a style to be visible or not.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetVisible(<B><FONT COLOR=#2e8b57>int</FONT></B> style, <B><FONT COLOR=#2e8b57>bool</FONT></B> visible);
+    <FONT color=#0000ff>// Drop all key mappings.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> CmdKeyClearAll();
 
-    <FONT COLOR=#0000ff>// Get the time in milliseconds that the caret is on and off.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetCaretPeriod();
+    <FONT color=#0000ff>// Set the styles for a segment of the document.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetStyleBytes(<B><FONT color=#2e8b57>int</FONT></B> length, <B><FONT color=#2e8b57>char</FONT></B>* styleBytes);
 
-    <FONT COLOR=#0000ff>// Get the time in milliseconds that the caret is on and off. 0 = steady on.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetCaretPeriod(<B><FONT COLOR=#2e8b57>int</FONT></B> periodMilliseconds);
+    <FONT color=#0000ff>// Set a style to be visible or not.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetVisible(<B><FONT color=#2e8b57>int</FONT></B> style, <B><FONT color=#2e8b57>bool</FONT></B> visible);
 
-    <FONT COLOR=#0000ff>// Set the set of characters making up words for when moving or selecting</FONT>
-    <FONT COLOR=#0000ff>// by word.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetWordChars(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; characters);
+    <FONT color=#0000ff>// Get the time in milliseconds that the caret is on and off.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetCaretPeriod();
 
-    <FONT COLOR=#0000ff>// Start a sequence of actions that is undone and redone as a unit.</FONT>
-    <FONT COLOR=#0000ff>// May be nested.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> BeginUndoAction();
+    <FONT color=#0000ff>// Get the time in milliseconds that the caret is on and off. 0 = steady on.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCaretPeriod(<B><FONT color=#2e8b57>int</FONT></B> periodMilliseconds);
 
-    <FONT COLOR=#0000ff>// End a sequence of actions that is undone and redone as a unit.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> EndUndoAction();
+    <FONT color=#0000ff>// Set the set of characters making up words for when moving or selecting</FONT>
+    <FONT color=#0000ff>// by word.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetWordChars(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; characters);
 
-    <FONT COLOR=#0000ff>// Set an indicator to plain, squiggle or TT.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> IndicatorSetStyle(<B><FONT COLOR=#2e8b57>int</FONT></B> indic, <B><FONT COLOR=#2e8b57>int</FONT></B> style);
+    <FONT color=#0000ff>// Start a sequence of actions that is undone and redone as a unit.</FONT>
+    <FONT color=#0000ff>// May be nested.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> BeginUndoAction();
 
-    <FONT COLOR=#0000ff>// Retrieve the style of an indicator.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> IndicatorGetStyle(<B><FONT COLOR=#2e8b57>int</FONT></B> indic);
+    <FONT color=#0000ff>// End a sequence of actions that is undone and redone as a unit.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> EndUndoAction();
 
-    <FONT COLOR=#0000ff>// Set the foreground colour of an indicator.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> IndicatorSetForeground(<B><FONT COLOR=#2e8b57>int</FONT></B> indic, <B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; fore);
+    <FONT color=#0000ff>// Set an indicator to plain, squiggle or TT.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> IndicatorSetStyle(<B><FONT color=#2e8b57>int</FONT></B> indic, <B><FONT color=#2e8b57>int</FONT></B> style);
 
-    <FONT COLOR=#0000ff>// Retrieve the foreground colour of an indicator.</FONT>
-    wxColour IndicatorGetForeground(<B><FONT COLOR=#2e8b57>int</FONT></B> indic);
+    <FONT color=#0000ff>// Retrieve the style of an indicator.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> IndicatorGetStyle(<B><FONT color=#2e8b57>int</FONT></B> indic);
 
-    <FONT COLOR=#0000ff>// Divide each styling byte into lexical class bits (default:5) and indicator</FONT>
-    <FONT COLOR=#0000ff>// bits (default:3). If a lexer requires more than 32 lexical states, then this</FONT>
-    <FONT COLOR=#0000ff>// is used to expand the possible states.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetStyleBits(<B><FONT COLOR=#2e8b57>int</FONT></B> bits);
+    <FONT color=#0000ff>// Set the foreground colour of an indicator.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> IndicatorSetForeground(<B><FONT color=#2e8b57>int</FONT></B> indic, <B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; fore);
 
-    <FONT COLOR=#0000ff>// Retrieve number of bits in style bytes used to hold the lexical state.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetStyleBits();
+    <FONT color=#0000ff>// Retrieve the foreground colour of an indicator.</FONT>
+    wxColour IndicatorGetForeground(<B><FONT color=#2e8b57>int</FONT></B> indic);
 
-    <FONT COLOR=#0000ff>// Used to hold extra styling information for each line.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetLineState(<B><FONT COLOR=#2e8b57>int</FONT></B> line, <B><FONT COLOR=#2e8b57>int</FONT></B> state);
+    <FONT color=#0000ff>// Divide each styling byte into lexical class bits (default:5) and indicator</FONT>
+    <FONT color=#0000ff>// bits (default:3). If a lexer requires more than 32 lexical states, then this</FONT>
+    <FONT color=#0000ff>// is used to expand the possible states.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetStyleBits(<B><FONT color=#2e8b57>int</FONT></B> bits);
 
-    <FONT COLOR=#0000ff>// Retrieve the extra styling information for a line.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetLineState(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Retrieve number of bits in style bytes used to hold the lexical state.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetStyleBits();
 
-    <FONT COLOR=#0000ff>// Retrieve the last line number that has line state.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetMaxLineState();
+    <FONT color=#0000ff>// Used to hold extra styling information for each line.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetLineState(<B><FONT color=#2e8b57>int</FONT></B> line, <B><FONT color=#2e8b57>int</FONT></B> state);
 
-    <FONT COLOR=#0000ff>// Display a auto-completion list.</FONT>
-    <FONT COLOR=#0000ff>// The lenEntered parameter indicates how many characters before</FONT>
-    <FONT COLOR=#0000ff>// the caret should be used to provide context.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompShow(<B><FONT COLOR=#2e8b57>int</FONT></B> lenEntered, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; itemList);
+    <FONT color=#0000ff>// Retrieve the extra styling information for a line.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetLineState(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Remove the auto-completion list from the screen.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompCancel();
+    <FONT color=#0000ff>// Retrieve the last line number that has line state.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetMaxLineState();
 
-    <FONT COLOR=#0000ff>// Is there an auto-completion list visible?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> AutoCompActive();
+    <FONT color=#0000ff>// Is the background of the line containing the caret in a different colour?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetCaretLineVisible();
 
-    <FONT COLOR=#0000ff>// Retrieve the position of the caret when the auto-completion list was</FONT>
-    <FONT COLOR=#0000ff>// displayed.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> AutoCompPosStart();
+    <FONT color=#0000ff>// Display the background of the line containing the caret in a different colour.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCaretLineVisible(<B><FONT color=#2e8b57>bool</FONT></B> show);
 
-    <FONT COLOR=#0000ff>// User has selected an item so remove the list and insert the selection.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompComplete();
+    <FONT color=#0000ff>// Get the colour of the background of the line containing the caret.</FONT>
+    wxColour GetCaretLineBack();
 
-    <FONT COLOR=#0000ff>// Define a set of character that when typed cancel the auto-completion list.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompStops(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; characterSet);
+    <FONT color=#0000ff>// Set the colour of the background of the line containing the caret.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCaretLineBack(<B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; back);
 
-    <FONT COLOR=#0000ff>// Change the separator character in the string setting up an auto-completion</FONT>
-    <FONT COLOR=#0000ff>// list. Default is space but can be changed if items contain space.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompSetSeparator(<B><FONT COLOR=#2e8b57>int</FONT></B> separatorCharacter);
+    <FONT color=#0000ff>// Display a auto-completion list.</FONT>
+    <FONT color=#0000ff>// The lenEntered parameter indicates how many characters before</FONT>
+    <FONT color=#0000ff>// the caret should be used to provide context.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompShow(<B><FONT color=#2e8b57>int</FONT></B> lenEntered, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; itemList);
 
-    <FONT COLOR=#0000ff>// Retrieve the auto-completion list separator character.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> AutoCompGetSeparator();
+    <FONT color=#0000ff>// Remove the auto-completion list from the screen.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompCancel();
 
-    <FONT COLOR=#0000ff>// Select the item in the auto-completion list that starts with a string.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompSelect(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text);
+    <FONT color=#0000ff>// Is there an auto-completion list visible?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> AutoCompActive();
 
-    <FONT COLOR=#0000ff>// Should the auto-completion list be cancelled if the user backspaces to a</FONT>
-    <FONT COLOR=#0000ff>// position before where the box was created.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompSetCancelAtStart(<B><FONT COLOR=#2e8b57>bool</FONT></B> cancel);
+    <FONT color=#0000ff>// Retrieve the position of the caret when the auto-completion list was</FONT>
+    <FONT color=#0000ff>// displayed.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> AutoCompPosStart();
 
-    <FONT COLOR=#0000ff>// Retrieve whether auto-completion cancelled by backspacing before start.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> AutoCompGetCancelAtStart();
+    <FONT color=#0000ff>// User has selected an item so remove the list and insert the selection.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompComplete();
 
-    <FONT COLOR=#0000ff>// Define a set of character that when typed fills up the selected word.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompSetFillUps(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; characterSet);
+    <FONT color=#0000ff>// Define a set of character that when typed cancel the auto-completion list.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompStops(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; characterSet);
 
-    <FONT COLOR=#0000ff>// Should a single item auto-completion list automatically choose the item.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompSetChooseSingle(<B><FONT COLOR=#2e8b57>bool</FONT></B> chooseSingle);
+    <FONT color=#0000ff>// Change the separator character in the string setting up an auto-completion</FONT>
+    <FONT color=#0000ff>// list. Default is space but can be changed if items contain space.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompSetSeparator(<B><FONT color=#2e8b57>int</FONT></B> separatorCharacter);
 
-    <FONT COLOR=#0000ff>// Retrieve whether a single item auto-completion list automatically choose the item.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> AutoCompGetChooseSingle();
+    <FONT color=#0000ff>// Retrieve the auto-completion list separator character.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> AutoCompGetSeparator();
 
-    <FONT COLOR=#0000ff>// Set whether case is significant when performing auto-completion searches.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AutoCompSetIgnoreCase(<B><FONT COLOR=#2e8b57>bool</FONT></B> ignoreCase);
+    <FONT color=#0000ff>// Select the item in the auto-completion list that starts with a string.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompSelect(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
 
-    <FONT COLOR=#0000ff>// Retrieve state of ignore case flag.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> AutoCompGetIgnoreCase();
+    <FONT color=#0000ff>// Should the auto-completion list be cancelled if the user backspaces to a</FONT>
+    <FONT color=#0000ff>// position before where the box was created.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompSetCancelAtStart(<B><FONT color=#2e8b57>bool</FONT></B> cancel);
 
-    <FONT COLOR=#0000ff>// Set the number of spaces used for one level of indentation.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetIndent(<B><FONT COLOR=#2e8b57>int</FONT></B> indentSize);
+    <FONT color=#0000ff>// Retrieve whether auto-completion cancelled by backspacing before start.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> AutoCompGetCancelAtStart();
 
-    <FONT COLOR=#0000ff>// Retrieve indentation size.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetIndent();
+    <FONT color=#0000ff>// Define a set of character that when typed fills up the selected word.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompSetFillUps(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; characterSet);
 
-    <FONT COLOR=#0000ff>// Indentation will only use space characters if useTabs is false, otherwise</FONT>
-    <FONT COLOR=#0000ff>// it will use a combination of tabs and spaces.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetUseTabs(<B><FONT COLOR=#2e8b57>bool</FONT></B> useTabs);
+    <FONT color=#0000ff>// Should a single item auto-completion list automatically choose the item.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompSetChooseSingle(<B><FONT color=#2e8b57>bool</FONT></B> chooseSingle);
 
-    <FONT COLOR=#0000ff>// Retrieve whether tabs will be used in indentation.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetUseTabs();
+    <FONT color=#0000ff>// Retrieve whether a single item auto-completion list automatically choose the item.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> AutoCompGetChooseSingle();
 
-    <FONT COLOR=#0000ff>// Change the indentation of a line to a number of columns.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetLineIndentation(<B><FONT COLOR=#2e8b57>int</FONT></B> line, <B><FONT COLOR=#2e8b57>int</FONT></B> indentSize);
+    <FONT color=#0000ff>// Set whether case is significant when performing auto-completion searches.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompSetIgnoreCase(<B><FONT color=#2e8b57>bool</FONT></B> ignoreCase);
 
-    <FONT COLOR=#0000ff>// Retrieve the number of columns that a line is indented.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetLineIndentation(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Retrieve state of ignore case flag.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> AutoCompGetIgnoreCase();
 
-    <FONT COLOR=#0000ff>// Retrieve the position before the first non indentation character on a line.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetLineIndentPosition(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Display a list of strings and send notification when user chooses one.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> UserListShow(<B><FONT color=#2e8b57>int</FONT></B> listType, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; itemList);
 
-    <FONT COLOR=#0000ff>// Retrieve the column number of a position, taking tab width into account.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetColumn(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Set whether or not autocompletion is hidden automatically when nothing matches</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AutoCompSetAutoHide(<B><FONT color=#2e8b57>bool</FONT></B> autoHide);
 
-    <FONT COLOR=#0000ff>// Show or hide the horizontal scroll bar.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetUseHorizontalScrollBar(<B><FONT COLOR=#2e8b57>bool</FONT></B> show);
+    <FONT color=#0000ff>// Retrieve whether or not autocompletion is hidden automatically when nothing matches</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> AutoCompGetAutoHide();
 
-    <FONT COLOR=#0000ff>// Is the horizontal scroll bar visible?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetUseHorizontalScrollBar();
+    <FONT color=#0000ff>// Set the number of spaces used for one level of indentation.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetIndent(<B><FONT color=#2e8b57>int</FONT></B> indentSize);
 
-    <FONT COLOR=#0000ff>// Show or hide indentation guides.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetIndentationGuides(<B><FONT COLOR=#2e8b57>bool</FONT></B> show);
+    <FONT color=#0000ff>// Retrieve indentation size.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetIndent();
 
-    <FONT COLOR=#0000ff>// Are the indentation guides visible?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetIndentationGuides();
+    <FONT color=#0000ff>// Indentation will only use space characters if useTabs is false, otherwise</FONT>
+    <FONT color=#0000ff>// it will use a combination of tabs and spaces.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetUseTabs(<B><FONT color=#2e8b57>bool</FONT></B> useTabs);
 
-    <FONT COLOR=#0000ff>// Set the highlighted indentation guide column.</FONT>
-    <FONT COLOR=#0000ff>// 0 = no highlighted guide.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetHighlightGuide(<B><FONT COLOR=#2e8b57>int</FONT></B> column);
+    <FONT color=#0000ff>// Retrieve whether tabs will be used in indentation.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetUseTabs();
 
-    <FONT COLOR=#0000ff>// Get the highlighted indentation guide column.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetHighlightGuide();
+    <FONT color=#0000ff>// Change the indentation of a line to a number of columns.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetLineIndentation(<B><FONT color=#2e8b57>int</FONT></B> line, <B><FONT color=#2e8b57>int</FONT></B> indentSize);
 
-    <FONT COLOR=#0000ff>// Get the position after the last visible characters on a line.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetLineEndPosition(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Retrieve the number of columns that a line is indented.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetLineIndentation(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Get the code page used to interpret the bytes of the document as characters.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetCodePage();
+    <FONT color=#0000ff>// Retrieve the position before the first non indentation character on a line.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetLineIndentPosition(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Get the foreground colour of the caret.</FONT>
+    <FONT color=#0000ff>// Retrieve the column number of a position, taking tab width into account.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetColumn(<B><FONT color=#2e8b57>int</FONT></B> pos);
+
+    <FONT color=#0000ff>// Show or hide the horizontal scroll bar.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetUseHorizontalScrollBar(<B><FONT color=#2e8b57>bool</FONT></B> show);
+
+    <FONT color=#0000ff>// Is the horizontal scroll bar visible?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetUseHorizontalScrollBar();
+
+    <FONT color=#0000ff>// Show or hide indentation guides.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetIndentationGuides(<B><FONT color=#2e8b57>bool</FONT></B> show);
+
+    <FONT color=#0000ff>// Are the indentation guides visible?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetIndentationGuides();
+
+    <FONT color=#0000ff>// Set the highlighted indentation guide column.</FONT>
+    <FONT color=#0000ff>// 0 = no highlighted guide.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetHighlightGuide(<B><FONT color=#2e8b57>int</FONT></B> column);
+
+    <FONT color=#0000ff>// Get the highlighted indentation guide column.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetHighlightGuide();
+
+    <FONT color=#0000ff>// Get the position after the last visible characters on a line.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetLineEndPosition(<B><FONT color=#2e8b57>int</FONT></B> line);
+
+    <FONT color=#0000ff>// Get the code page used to interpret the bytes of the document as characters.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetCodePage();
+
+    <FONT color=#0000ff>// Get the foreground colour of the caret.</FONT>
     wxColour GetCaretForeground();
 
-    <FONT COLOR=#0000ff>// In read-only mode?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetReadOnly();
+    <FONT color=#0000ff>// In read-only mode?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetReadOnly();
 
-    <FONT COLOR=#0000ff>// Sets the position of the caret.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetCurrentPos(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Sets the position of the caret.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCurrentPos(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Sets the position that starts the selection - this becomes the anchor.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetSelectionStart(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Sets the position that starts the selection - this becomes the anchor.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetSelectionStart(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Returns the position at the start of the selection.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetSelectionStart();
+    <FONT color=#0000ff>// Returns the position at the start of the selection.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetSelectionStart();
 
-    <FONT COLOR=#0000ff>// Sets the position that ends the selection - this becomes the currentPosition.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetSelectionEnd(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Sets the position that ends the selection - this becomes the currentPosition.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetSelectionEnd(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Returns the position at the end of the selection.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetSelectionEnd();
+    <FONT color=#0000ff>// Returns the position at the end of the selection.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetSelectionEnd();
 
-    <FONT COLOR=#0000ff>// Sets the print magnification added to the point size of each style for printing.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetPrintMagnification(<B><FONT COLOR=#2e8b57>int</FONT></B> magnification);
+    <FONT color=#0000ff>// Sets the print magnification added to the point size of each style for printing.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetPrintMagnification(<B><FONT color=#2e8b57>int</FONT></B> magnification);
 
-    <FONT COLOR=#0000ff>// Returns the print magnification.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetPrintMagnification();
+    <FONT color=#0000ff>// Returns the print magnification.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetPrintMagnification();
 
-    <FONT COLOR=#0000ff>// Modify colours when printing for clearer printed text.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetPrintColourMode(<B><FONT COLOR=#2e8b57>int</FONT></B> mode);
+    <FONT color=#0000ff>// Modify colours when printing for clearer printed text.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetPrintColourMode(<B><FONT color=#2e8b57>int</FONT></B> mode);
 
-    <FONT COLOR=#0000ff>// Returns the print colour mode.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetPrintColourMode();
+    <FONT color=#0000ff>// Returns the print colour mode.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetPrintColourMode();
 
-    <FONT COLOR=#0000ff>// Find some text in the document.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> FindText(<B><FONT COLOR=#2e8b57>int</FONT></B> minPos, <B><FONT COLOR=#2e8b57>int</FONT></B> maxPos,
-                               <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text,
-                               <B><FONT COLOR=#2e8b57>bool</FONT></B> caseSensitive, <B><FONT COLOR=#2e8b57>bool</FONT></B> wholeWord);
+    <FONT color=#0000ff>// Find some text in the document.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> FindText(<B><FONT color=#2e8b57>int</FONT></B> minPos, <B><FONT color=#2e8b57>int</FONT></B> maxPos,
+                               <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text,
+                               <B><FONT color=#2e8b57>bool</FONT></B> caseSensitive, <B><FONT color=#2e8b57>bool</FONT></B> wholeWord);
 
-    <FONT COLOR=#0000ff>// On Windows will draw the document into a display context such as a printer.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> FormatRange(<B><FONT COLOR=#2e8b57>bool</FONT></B>   doDraw,
-                               <B><FONT COLOR=#2e8b57>int</FONT></B>    startPos,
-                               <B><FONT COLOR=#2e8b57>int</FONT></B>    endPos,
+    <FONT color=#0000ff>// On Windows will draw the document into a display context such as a printer.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> FormatRange(<B><FONT color=#2e8b57>bool</FONT></B>   doDraw,
+                               <B><FONT color=#2e8b57>int</FONT></B>    startPos,
+                               <B><FONT color=#2e8b57>int</FONT></B>    endPos,
                                wxDC*  draw,
-                               wxDC*  target,  <FONT COLOR=#0000ff>// Why does it use two? Can they be the same?</FONT>
+                               wxDC*  target,  <FONT color=#0000ff>// Why does it use two? Can they be the same?</FONT>
                                wxRect renderRect,
                                wxRect pageRect);
 
-    <FONT COLOR=#0000ff>// Retrieve the line at the top of the display.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetFirstVisibleLine();
+    <FONT color=#0000ff>// Retrieve the line at the top of the display.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetFirstVisibleLine();
 
-    <FONT COLOR=#0000ff>// Retrieve the contents of a line.</FONT>
-    wxString GetLine(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Retrieve the contents of a line.</FONT>
+    wxString GetLine(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Returns the number of lines in the document. There is always at least one.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetLineCount();
+    <FONT color=#0000ff>// Returns the number of lines in the document. There is always at least one.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetLineCount();
 
-    <FONT COLOR=#0000ff>// Sets the size in pixels of the left margin.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMarginLeft(<B><FONT COLOR=#2e8b57>int</FONT></B> width);
+    <FONT color=#0000ff>// Sets the size in pixels of the left margin.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMarginLeft(<B><FONT color=#2e8b57>int</FONT></B> pixelWidth);
 
-    <FONT COLOR=#0000ff>// Returns the size in pixels of the left margin.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetMarginLeft();
+    <FONT color=#0000ff>// Returns the size in pixels of the left margin.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetMarginLeft();
 
-    <FONT COLOR=#0000ff>// Sets the size in pixels of the right margin.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMarginRight(<B><FONT COLOR=#2e8b57>int</FONT></B> width);
+    <FONT color=#0000ff>// Sets the size in pixels of the right margin.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMarginRight(<B><FONT color=#2e8b57>int</FONT></B> pixelWidth);
 
-    <FONT COLOR=#0000ff>// Returns the size in pixels of the right margin.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetMarginRight();
+    <FONT color=#0000ff>// Returns the size in pixels of the right margin.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetMarginRight();
 
-    <FONT COLOR=#0000ff>// Is the document different from when it was last saved?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetModify();
+    <FONT color=#0000ff>// Is the document different from when it was last saved?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetModify();
 
-    <FONT COLOR=#0000ff>// Select a range of text.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetSelection(<B><FONT COLOR=#2e8b57>int</FONT></B> start, <B><FONT COLOR=#2e8b57>int</FONT></B> end);
+    <FONT color=#0000ff>// Select a range of text.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetSelection(<B><FONT color=#2e8b57>int</FONT></B> start, <B><FONT color=#2e8b57>int</FONT></B> end);
 
-    <FONT COLOR=#0000ff>// Retrieve the selected text.</FONT>
+    <FONT color=#0000ff>// Retrieve the selected text.</FONT>
     wxString GetSelectedText();
 
-    <FONT COLOR=#0000ff>// Retrieve a range of text.</FONT>
-    wxString GetTextRange(<B><FONT COLOR=#2e8b57>int</FONT></B> startPos, <B><FONT COLOR=#2e8b57>int</FONT></B> endPos);
+    <FONT color=#0000ff>// Retrieve a range of text.</FONT>
+    wxString GetTextRange(<B><FONT color=#2e8b57>int</FONT></B> startPos, <B><FONT color=#2e8b57>int</FONT></B> endPos);
 
-    <FONT COLOR=#0000ff>// Draw the selection in normal style or with selection highlighted.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> HideSelection(<B><FONT COLOR=#2e8b57>bool</FONT></B> normal);
+    <FONT color=#0000ff>// Draw the selection in normal style or with selection highlighted.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> HideSelection(<B><FONT color=#2e8b57>bool</FONT></B> normal);
 
-    <FONT COLOR=#0000ff>// Retrieve the line containing a position.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> LineFromPosition(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Retrieve the line containing a position.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> LineFromPosition(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Retrieve the position at the start of a line.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> PositionFromLine(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Retrieve the position at the start of a line.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> PositionFromLine(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Scroll horizontally and vertically.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> LineScroll(<B><FONT COLOR=#2e8b57>int</FONT></B> columns, <B><FONT COLOR=#2e8b57>int</FONT></B> lines);
+    <FONT color=#0000ff>// Scroll horizontally and vertically.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> LineScroll(<B><FONT color=#2e8b57>int</FONT></B> columns, <B><FONT color=#2e8b57>int</FONT></B> lines);
 
-    <FONT COLOR=#0000ff>// Ensure the caret is visible.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> EnsureCaretVisible();
+    <FONT color=#0000ff>// Ensure the caret is visible.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> EnsureCaretVisible();
 
-    <FONT COLOR=#0000ff>// Replace the selected text with the argument text.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ReplaceSelection(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text);
+    <FONT color=#0000ff>// Replace the selected text with the argument text.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ReplaceSelection(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
 
-    <FONT COLOR=#0000ff>// Set to read only or read write.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetReadOnly(<B><FONT COLOR=#2e8b57>bool</FONT></B> readOnly);
+    <FONT color=#0000ff>// Set to read only or read write.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetReadOnly(<B><FONT color=#2e8b57>bool</FONT></B> readOnly);
 
-    <FONT COLOR=#0000ff>// Will a paste succeed?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> CanPaste();
+    <FONT color=#0000ff>// Will a paste succeed?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> CanPaste();
 
-    <FONT COLOR=#0000ff>// Are there any undoable actions in the undo history.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> CanUndo();
+    <FONT color=#0000ff>// Are there any undoable actions in the undo history.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> CanUndo();
 
-    <FONT COLOR=#0000ff>// Delete the undo history.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> EmptyUndoBuffer();
+    <FONT color=#0000ff>// Delete the undo history.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> EmptyUndoBuffer();
 
-    <FONT COLOR=#0000ff>// Undo one action in the undo history.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> Undo();
+    <FONT color=#0000ff>// Undo one action in the undo history.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> Undo();
 
-    <FONT COLOR=#0000ff>// Cut the selection to the clipboard.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> Cut();
+    <FONT color=#0000ff>// Cut the selection to the clipboard.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> Cut();
 
-    <FONT COLOR=#0000ff>// Copy the selection to the clipboard.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> Copy();
+    <FONT color=#0000ff>// Copy the selection to the clipboard.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> Copy();
 
-    <FONT COLOR=#0000ff>// Paste the contents of the clipboard into the document replacing the selection.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> Paste();
+    <FONT color=#0000ff>// Paste the contents of the clipboard into the document replacing the selection.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> Paste();
 
-    <FONT COLOR=#0000ff>// Clear the selection.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> Clear();
+    <FONT color=#0000ff>// Clear the selection.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> Clear();
 
-    <FONT COLOR=#0000ff>// Replace the contents of the document with the argument text.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetText(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text);
+    <FONT color=#0000ff>// Replace the contents of the document with the argument text.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetText(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
 
-    <FONT COLOR=#0000ff>// Retrieve all the text in the document.</FONT>
+    <FONT color=#0000ff>// Retrieve all the text in the document.</FONT>
     wxString GetText();
 
-    <FONT COLOR=#0000ff>// Retrieve the number of characters in the document.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetTextLength();
+    <FONT color=#0000ff>// Retrieve the number of characters in the document.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetTextLength();
+
+    <FONT color=#0000ff>// Set to overtype (true) or insert mode</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetOvertype(<B><FONT color=#2e8b57>bool</FONT></B> overtype);
+
+    <FONT color=#0000ff>// Returns true if overtype mode is active otherwise false is returned.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetOvertype();
+
+    <FONT color=#0000ff>// Set the width of the insert mode caret</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCaretWidth(<B><FONT color=#2e8b57>int</FONT></B> pixelWidth);
+
+    <FONT color=#0000ff>// Returns the width of the insert mode caret</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetCaretWidth();
+
+    <FONT color=#0000ff>// Sets the position that starts the target which is used for updating the</FONT>
+    <FONT color=#0000ff>// document without affecting the scroll position.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetTargetStart(<B><FONT color=#2e8b57>int</FONT></B> pos);
+
+    <FONT color=#0000ff>// Get the position that starts the target.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetTargetStart();
+
+    <FONT color=#0000ff>// Sets the position that ends the target which is used for updating the</FONT>
+    <FONT color=#0000ff>// document without affecting the scroll position.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetTargetEnd(<B><FONT color=#2e8b57>int</FONT></B> pos);
+
+    <FONT color=#0000ff>// Get the position that ends the target.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetTargetEnd();
+
+    <FONT color=#0000ff>// Replace the target text with the argument text.</FONT>
+    <FONT color=#0000ff>// Returns the length of the replacement text.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> ReplaceTarget(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
+
+    <FONT color=#0000ff>// Replace the target text with the argument text after \d processing.</FONT>
+    <FONT color=#0000ff>// Looks for \d where d is between 1 and 9 and replaces these with the strings</FONT>
+    <FONT color=#0000ff>// matched in the last search operation which were surrounded by \( and \).</FONT>
+    <FONT color=#0000ff>// Returns the length of the replacement text including any change</FONT>
+    <FONT color=#0000ff>// caused by processing the \d patterns.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> ReplaceTargetRE(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
+
+    <FONT color=#0000ff>// Search for a counted string in the target and set the target to the found</FONT>
+    <FONT color=#0000ff>// range.</FONT>
+    <FONT color=#0000ff>// Returns length of range or -1 for failure in which case target is not moved.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> SearchInTarget(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
+
+    <FONT color=#0000ff>// Set the search flags used by SearchInTarget</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetSearchFlags(<B><FONT color=#2e8b57>int</FONT></B> flags);
+
+    <FONT color=#0000ff>// Get the search flags used by SearchInTarget</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetSearchFlags();
+
+    <FONT color=#0000ff>// Show a call tip containing a definition near position pos.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> CallTipShow(<B><FONT color=#2e8b57>int</FONT></B> pos, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; definition);
+
+    <FONT color=#0000ff>// Remove the call tip from the screen.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> CallTipCancel();
+
+    <FONT color=#0000ff>// Is there an active call tip?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> CallTipActive();
 
-    <FONT COLOR=#0000ff>// Set to overtype (true) or insert mode</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetOvertype(<B><FONT COLOR=#2e8b57>bool</FONT></B> overtype);
+    <FONT color=#0000ff>// Retrieve the position where the caret was before displaying the call tip.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> CallTipPosAtStart();
 
-    <FONT COLOR=#0000ff>// Returns true if overtype mode is active otherwise false is returned.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetOvertype();
+    <FONT color=#0000ff>// Highlight a segment of the definition.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> CallTipSetHighlight(<B><FONT color=#2e8b57>int</FONT></B> start, <B><FONT color=#2e8b57>int</FONT></B> end);
 
-    <FONT COLOR=#0000ff>// Show a call tip containing a definition near position pos.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CallTipShow(<B><FONT COLOR=#2e8b57>int</FONT></B> pos, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; definition);
+    <FONT color=#0000ff>// Set the background colour for the call tip.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> CallTipSetBackground(<B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; back);
 
-    <FONT COLOR=#0000ff>// Remove the call tip from the screen.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CallTipCancel();
+    <FONT color=#0000ff>// Find the display line of a document line taking hidden lines into account.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> VisibleFromDocLine(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Is there an active call tip?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> CallTipActive();
+    <FONT color=#0000ff>// Find the document line of a display line taking hidden lines into account.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> DocLineFromVisible(<B><FONT color=#2e8b57>int</FONT></B> lineDisplay);
 
-    <FONT COLOR=#0000ff>// Retrieve the position where the caret was before displaying the call tip.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> CallTipPosAtStart();
+    <FONT color=#0000ff>// Set the fold level of a line.</FONT>
+    <FONT color=#0000ff>// This encodes an integer level along with flags indicating whether the</FONT>
+    <FONT color=#0000ff>// line is a header and whether it is effectively white space.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetFoldLevel(<B><FONT color=#2e8b57>int</FONT></B> line, <B><FONT color=#2e8b57>int</FONT></B> level);
 
-    <FONT COLOR=#0000ff>// Highlight a segment of the definition.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CallTipSetHighlight(<B><FONT COLOR=#2e8b57>int</FONT></B> start, <B><FONT COLOR=#2e8b57>int</FONT></B> end);
+    <FONT color=#0000ff>// Retrieve the fold level of a line.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetFoldLevel(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Set the background colour for the call tip.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CallTipSetBackground(<B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; back);
+    <FONT color=#0000ff>// Find the last child line of a header line.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetLastChild(<B><FONT color=#2e8b57>int</FONT></B> line, <B><FONT color=#2e8b57>int</FONT></B> level);
 
-    <FONT COLOR=#0000ff>// Find the display line of a document line taking hidden lines into account.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> VisibleFromDocLine(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Find the parent line of a child line.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetFoldParent(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Find the document line of a display line taking hidden lines into account.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> DocLineFromVisible(<B><FONT COLOR=#2e8b57>int</FONT></B> lineDisplay);
+    <FONT color=#0000ff>// Make a range of lines visible.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ShowLines(<B><FONT color=#2e8b57>int</FONT></B> lineStart, <B><FONT color=#2e8b57>int</FONT></B> lineEnd);
 
-    <FONT COLOR=#0000ff>// Set the fold level of a line.</FONT>
-    <FONT COLOR=#0000ff>// This encodes an integer level along with flags indicating whether the</FONT>
-    <FONT COLOR=#0000ff>// line is a header and whether it is effectively white space.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetFoldLevel(<B><FONT COLOR=#2e8b57>int</FONT></B> line, <B><FONT COLOR=#2e8b57>int</FONT></B> level);
+    <FONT color=#0000ff>// Make a range of lines invisible.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> HideLines(<B><FONT color=#2e8b57>int</FONT></B> lineStart, <B><FONT color=#2e8b57>int</FONT></B> lineEnd);
 
-    <FONT COLOR=#0000ff>// Retrieve the fold level of a line.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetFoldLevel(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Is a line visible?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetLineVisible(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Find the last child line of a header line.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetLastChild(<B><FONT COLOR=#2e8b57>int</FONT></B> line, <B><FONT COLOR=#2e8b57>int</FONT></B> level);
+    <FONT color=#0000ff>// Show the children of a header line.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetFoldExpanded(<B><FONT color=#2e8b57>int</FONT></B> line, <B><FONT color=#2e8b57>bool</FONT></B> expanded);
 
-    <FONT COLOR=#0000ff>// Find the parent line of a child line.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetFoldParent(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Is a header line expanded?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetFoldExpanded(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Make a range of lines visible.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ShowLines(<B><FONT COLOR=#2e8b57>int</FONT></B> lineStart, <B><FONT COLOR=#2e8b57>int</FONT></B> lineEnd);
+    <FONT color=#0000ff>// Switch a header line between expanded and contracted.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ToggleFold(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Make a range of lines invisible.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> HideLines(<B><FONT COLOR=#2e8b57>int</FONT></B> lineStart, <B><FONT COLOR=#2e8b57>int</FONT></B> lineEnd);
+    <FONT color=#0000ff>// Ensure a particular line is visible by expanding any header line hiding it.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> EnsureVisible(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Is a line visible?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetLineVisible(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Set some debugging options for folding</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetFoldFlags(<B><FONT color=#2e8b57>int</FONT></B> flags);
 
-    <FONT COLOR=#0000ff>// Show the children of a header line.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetFoldExpanded(<B><FONT COLOR=#2e8b57>int</FONT></B> line, <B><FONT COLOR=#2e8b57>bool</FONT></B> expanded);
+    <FONT color=#0000ff>// Ensure a particular line is visible by expanding any header line hiding it.</FONT>
+    <FONT color=#0000ff>// Use the currently set visibility policy to determine which range to display.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> EnsureVisibleEnforcePolicy(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Is a header line expanded?</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetFoldExpanded(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Sets whether a tab pressed when caret is within indentation indents</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetTabIndents(<B><FONT color=#2e8b57>bool</FONT></B> tabIndents);
 
-    <FONT COLOR=#0000ff>// Switch a header line between expanded and contracted.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ToggleFold(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Does a tab pressed when caret is within indentation indent?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetTabIndents();
 
-    <FONT COLOR=#0000ff>// Ensure a particular line is visible by expanding any header line hiding it.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> EnsureVisible(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Sets whether a backspace pressed when caret is within indentation unindents</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetBackSpaceUnIndents(<B><FONT color=#2e8b57>bool</FONT></B> bsUnIndents);
 
-    <FONT COLOR=#0000ff>// Set some debugging options for folding</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetFoldFlags(<B><FONT COLOR=#2e8b57>int</FONT></B> flags);
+    <FONT color=#0000ff>// Does a backspace pressed when caret is within indentation unindent?</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetBackSpaceUnIndents();
 
-    <FONT COLOR=#0000ff>// How many characters are on a line, not including end of line characters.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> LineLength(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
+    <FONT color=#0000ff>// Sets the time the mouse must sit still to generate a mouse dwell event</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMouseDwellTime(<B><FONT color=#2e8b57>int</FONT></B> periodMilliseconds);
 
-    <FONT COLOR=#0000ff>// Highlight the characters at two positions.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> BraceHighlight(<B><FONT COLOR=#2e8b57>int</FONT></B> pos1, <B><FONT COLOR=#2e8b57>int</FONT></B> pos2);
+    <FONT color=#0000ff>// Retrieve the time the mouse must sit still to generate a mouse dwell event</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetMouseDwellTime();
 
-    <FONT COLOR=#0000ff>// Highlight the character at a position indicating there is no matching brace.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> BraceBadLight(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// Move the caret inside current view if it's not there already</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> MoveCaretInsideView();
 
-    <FONT COLOR=#0000ff>// Find the position of a matching brace or INVALID_POSITION if no match.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> BraceMatch(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
+    <FONT color=#0000ff>// How many characters are on a line, not including end of line characters.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> LineLength(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <FONT COLOR=#0000ff>// Are the end of line characters visible.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetViewEOL();
+    <FONT color=#0000ff>// Highlight the characters at two positions.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> BraceHighlight(<B><FONT color=#2e8b57>int</FONT></B> pos1, <B><FONT color=#2e8b57>int</FONT></B> pos2);
 
-    <FONT COLOR=#0000ff>// Make the end of line characters visible or invisible</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetViewEOL(<B><FONT COLOR=#2e8b57>bool</FONT></B> visible);
+    <FONT color=#0000ff>// Highlight the character at a position indicating there is no matching brace.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> BraceBadLight(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Retrieve a pointer to the document object.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B>* GetDocPointer();
+    <FONT color=#0000ff>// Find the position of a matching brace or INVALID_POSITION if no match.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> BraceMatch(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
-    <FONT COLOR=#0000ff>// Change the document object used.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetDocPointer(<B><FONT COLOR=#2e8b57>void</FONT></B>* docPointer);
+    <FONT color=#0000ff>// Are the end of line characters visible.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetViewEOL();
 
-    <FONT COLOR=#0000ff>// Set which document modification events are sent to the container.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetModEventMask(<B><FONT COLOR=#2e8b57>int</FONT></B> mask);
+    <FONT color=#0000ff>// Make the end of line characters visible or invisible</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetViewEOL(<B><FONT color=#2e8b57>bool</FONT></B> visible);
 
-    <FONT COLOR=#0000ff>// Retrieve the column number which text should be kept within.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetEdgeColumn();
+    <FONT color=#0000ff>// Retrieve a pointer to the document object.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B>* GetDocPointer();
 
-    <FONT COLOR=#0000ff>// Set the column number of the edge.</FONT>
-    <FONT COLOR=#0000ff>// If text goes past the edge then it is highlighted.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetEdgeColumn(<B><FONT COLOR=#2e8b57>int</FONT></B> column);
+    <FONT color=#0000ff>// Change the document object used.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetDocPointer(<B><FONT color=#2e8b57>void</FONT></B>* docPointer);
 
-    <FONT COLOR=#0000ff>// Retrieve the edge highlight mode.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetEdgeMode();
+    <FONT color=#0000ff>// Set which document modification events are sent to the container.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetModEventMask(<B><FONT color=#2e8b57>int</FONT></B> mask);
 
-    <FONT COLOR=#0000ff>// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that</FONT>
-    <FONT COLOR=#0000ff>// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetEdgeMode(<B><FONT COLOR=#2e8b57>int</FONT></B> mode);
+    <FONT color=#0000ff>// Retrieve the column number which text should be kept within.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetEdgeColumn();
 
-    <FONT COLOR=#0000ff>// Retrieve the colour used in edge indication.</FONT>
+    <FONT color=#0000ff>// Set the column number of the edge.</FONT>
+    <FONT color=#0000ff>// If text goes past the edge then it is highlighted.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetEdgeColumn(<B><FONT color=#2e8b57>int</FONT></B> column);
+
+    <FONT color=#0000ff>// Retrieve the edge highlight mode.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetEdgeMode();
+
+    <FONT color=#0000ff>// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that</FONT>
+    <FONT color=#0000ff>// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetEdgeMode(<B><FONT color=#2e8b57>int</FONT></B> mode);
+
+    <FONT color=#0000ff>// Retrieve the colour used in edge indication.</FONT>
     wxColour GetEdgeColour();
 
-    <FONT COLOR=#0000ff>// Change the colour used in edge indication.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetEdgeColour(<B><FONT COLOR=#2e8b57>const</FONT></B> wxColour&amp; edgeColour);
+    <FONT color=#0000ff>// Change the colour used in edge indication.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetEdgeColour(<B><FONT color=#2e8b57>const</FONT></B> wxColour&amp; edgeColour);
+
+    <FONT color=#0000ff>// Sets the current caret position to be the search anchor.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SearchAnchor();
+
+    <FONT color=#0000ff>// Find some text starting at the search anchor.</FONT>
+    <FONT color=#0000ff>// Does not ensure the selection is visible.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> SearchNext(<B><FONT color=#2e8b57>int</FONT></B> flags, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
+
+    <FONT color=#0000ff>// Find some text starting at the search anchor and moving backwards.</FONT>
+    <FONT color=#0000ff>// Does not ensure the selection is visible.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> SearchPrev(<B><FONT color=#2e8b57>int</FONT></B> flags, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
+
+    <FONT color=#0000ff>// Set the way the line the caret is on is kept visible.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCaretPolicy(<B><FONT color=#2e8b57>int</FONT></B> caretPolicy, <B><FONT color=#2e8b57>int</FONT></B> caretSlop);
+
+    <FONT color=#0000ff>// Retrieves the number of lines completely visible.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> LinesOnScreen();
+
+    <FONT color=#0000ff>// Set whether a pop up menu is displayed automatically when the user presses</FONT>
+    <FONT color=#0000ff>// the wrong mouse button.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> UsePopUp(<B><FONT color=#2e8b57>bool</FONT></B> allowPopUp);
+
+    <FONT color=#0000ff>// Is the selection a rectangular. The alternative is the more common stream selection.</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> SelectionIsRectangle();
+
+    <FONT color=#0000ff>// Set the zoom level. This number of points is added to the size of all fonts.</FONT>
+    <FONT color=#0000ff>// It may be positive to magnify or negative to reduce.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetZoom(<B><FONT color=#2e8b57>int</FONT></B> zoom);
+
+    <FONT color=#0000ff>// Retrieve the zoom level.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetZoom();
 
-    <FONT COLOR=#0000ff>// Sets the current caret position to be the search anchor.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SearchAnchor();
+    <FONT color=#0000ff>// Create a new document object.</FONT>
+    <FONT color=#0000ff>// Starts with reference count of 1 and not selected into editor.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B>* CreateDocument();
 
-    <FONT COLOR=#0000ff>// Find some text starting at the search anchor.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> SearchNext(<B><FONT COLOR=#2e8b57>int</FONT></B> flags, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text);
+    <FONT color=#0000ff>// Extend life of document.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> AddRefDocument(<B><FONT color=#2e8b57>void</FONT></B>* docPointer);
 
-    <FONT COLOR=#0000ff>// Find some text starting at the search anchor and moving backwards.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> SearchPrev(<B><FONT COLOR=#2e8b57>int</FONT></B> flags, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; text);
+    <FONT color=#0000ff>// Release a reference to the document, deleting document if it fades to black.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ReleaseDocument(<B><FONT color=#2e8b57>void</FONT></B>* docPointer);
 
-    <FONT COLOR=#0000ff>// Set the way the line the caret is on is kept visible.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetCaretPolicy(<B><FONT COLOR=#2e8b57>int</FONT></B> caretPolicy, <B><FONT COLOR=#2e8b57>int</FONT></B> caretSlop);
+    <FONT color=#0000ff>// Get which document modification events are sent to the container.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetModEventMask();
 
-    <FONT COLOR=#0000ff>// Retrieves the number of lines completely visible.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> LinesOnScreen();
+    <FONT color=#0000ff>// Change internal focus flag</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetFocus(<B><FONT color=#2e8b57>bool</FONT></B> focus);
 
-    <FONT COLOR=#0000ff>// Set whether a pop up menu is displayed automatically when the user presses</FONT>
-    <FONT COLOR=#0000ff>// the wrong mouse button.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> UsePopUp(<B><FONT COLOR=#2e8b57>bool</FONT></B> allowPopUp);
+    <FONT color=#0000ff>// Get internal focus flag</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetFocus();
 
-    <FONT COLOR=#0000ff>// Is the selection a rectangular. The alternative is the more common stream selection.</FONT>
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> SelectionIsRectangle();
+    <FONT color=#0000ff>// Change error status - 0 = OK</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetStatus(<B><FONT color=#2e8b57>int</FONT></B> statusCode);
 
-    <FONT COLOR=#0000ff>// Set the zoom level. This number of points is added to the size of all fonts.</FONT>
-    <FONT COLOR=#0000ff>// It may be positive to magnify or negative to reduce.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetZoom(<B><FONT COLOR=#2e8b57>int</FONT></B> zoom);
+    <FONT color=#0000ff>// Get error status</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetStatus();
 
-    <FONT COLOR=#0000ff>// Retrieve the zoom level.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetZoom();
+    <FONT color=#0000ff>// Set whether the mouse is captured when its button is pressed</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMouseDownCaptures(<B><FONT color=#2e8b57>bool</FONT></B> captures);
 
-    <FONT COLOR=#0000ff>// Create a new document object.</FONT>
-    <FONT COLOR=#0000ff>// Starts with reference count of 1 and not selected into editor.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B>* CreateDocument();
+    <FONT color=#0000ff>// Get whether mouse gets captured</FONT>
+    <B><FONT color=#2e8b57>bool</FONT></B> GetMouseDownCaptures();
 
-    <FONT COLOR=#0000ff>// Extend life of document.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> AddRefDocument(<B><FONT COLOR=#2e8b57>void</FONT></B>* docPointer);
+    <FONT color=#0000ff>// Sets the cursor to one of the SC_CURSOR* values</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetCursor(<B><FONT color=#2e8b57>int</FONT></B> cursorType);
 
-    <FONT COLOR=#0000ff>// Release a reference to the document, deleting document if it fades to black.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ReleaseDocument(<B><FONT COLOR=#2e8b57>void</FONT></B>* docPointer);
+    <FONT color=#0000ff>// Get cursor type</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetCursor();
 
-    <FONT COLOR=#0000ff>// Get which document modification events are sent to the container.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetModEventMask();
+    <FONT color=#0000ff>// Move to the previous change in capitalistion</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> WordPartLeft();
 
-    <FONT COLOR=#0000ff>// Start notifying the container of all key presses and commands.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StartRecord();
+    <FONT color=#0000ff>// Move to the previous change in capitalistion extending selection to new caret position.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> WordPartLeftExtend();
 
-    <FONT COLOR=#0000ff>// Stop notifying the container of all key presses and commands.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StopRecord();
+    <FONT color=#0000ff>// Move to the change next in capitalistion</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> WordPartRight();
 
-    <FONT COLOR=#0000ff>// Set the lexing language of the document.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetLexer(<B><FONT COLOR=#2e8b57>int</FONT></B> lexer);
+    <FONT color=#0000ff>// Move to the next change in capitalistion extending selection to new caret position.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> WordPartRightExtend();
 
-    <FONT COLOR=#0000ff>// Retrieve the lexing language of the document.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetLexer();
+    <FONT color=#0000ff>// Set the way the display area is determined when a particular line is to be moved to.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetVisiblePolicy(<B><FONT color=#2e8b57>int</FONT></B> visiblePolicy, <B><FONT color=#2e8b57>int</FONT></B> visibleSlop);
 
-    <FONT COLOR=#0000ff>// Colourise a segment of the document using the current lexing language.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> Colourise(<B><FONT COLOR=#2e8b57>int</FONT></B> start, <B><FONT COLOR=#2e8b57>int</FONT></B> end);
+    <FONT color=#0000ff>// Delete back from the current position to the start of the line</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> DelLineLeft();
 
-    <FONT COLOR=#0000ff>// Set up a value that may be used by a lexer for some optional feature.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetProperty(<B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; key, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; value);
+    <FONT color=#0000ff>// Delete forwards from the current position to the end of the line</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> DelLineRight();
 
-    <FONT COLOR=#0000ff>// Set up the key words used by the lexer.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetKeyWords(<B><FONT COLOR=#2e8b57>int</FONT></B> keywordSet, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; keyWords);
+    <FONT color=#0000ff>// Start notifying the container of all key presses and commands.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StartRecord();
 
-<FONT COLOR=#0000ff>// END of generated section</FONT>
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
-<FONT COLOR=#0000ff>// Others...</FONT>
+    <FONT color=#0000ff>// Stop notifying the container of all key presses and commands.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StopRecord();
 
+    <FONT color=#0000ff>// Set the lexing language of the document.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetLexer(<B><FONT color=#2e8b57>int</FONT></B> lexer);
 
-    <FONT COLOR=#0000ff>// Returns the line number of the line with the caret.</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B> GetCurrentLine();
+    <FONT color=#0000ff>// Retrieve the lexing language of the document.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetLexer();
 
-    <FONT COLOR=#0000ff>// Extract style settings from a spec-string which is composed of one or</FONT>
-    <FONT COLOR=#0000ff>// more of the following comma separated elements:</FONT>
-    <FONT COLOR=#0000ff>//</FONT>
-    <FONT COLOR=#0000ff>//      bold                    turns on bold</FONT>
-    <FONT COLOR=#0000ff>//      italic                  turns on italics</FONT>
-    <FONT COLOR=#0000ff>//      fore:#RRGGBB            sets the foreground colour</FONT>
-    <FONT COLOR=#0000ff>//      back:#RRGGBB            sets the background colour</FONT>
-    <FONT COLOR=#0000ff>//      face:[facename]         sets the font face name to use</FONT>
-    <FONT COLOR=#0000ff>//      size:[num]              sets the font size in points</FONT>
-    <FONT COLOR=#0000ff>//      eol                     turns on eol filling</FONT>
-    <FONT COLOR=#0000ff>//      underline               turns on underlining</FONT>
-    <FONT COLOR=#0000ff>//</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetSpec(<B><FONT COLOR=#2e8b57>int</FONT></B> styleNum, <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; spec);
+    <FONT color=#0000ff>// Colourise a segment of the document using the current lexing language.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> Colourise(<B><FONT color=#2e8b57>int</FONT></B> start, <B><FONT color=#2e8b57>int</FONT></B> end);
 
+    <FONT color=#0000ff>// Set up a value that may be used by a lexer for some optional feature.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetProperty(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; key, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; value);
 
+    <FONT color=#0000ff>// Set up the key words used by the lexer.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetKeyWords(<B><FONT color=#2e8b57>int</FONT></B> keywordSet, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; keyWords);
 
-    <FONT COLOR=#0000ff>// Set style size, face, bold, italic, and underline attributes from</FONT>
-    <FONT COLOR=#0000ff>// a wxFont's attributes.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetFont(<B><FONT COLOR=#2e8b57>int</FONT></B> styleNum, wxFont&amp; font);
+    <FONT color=#0000ff>// Set the lexing language of the document based on string name.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetLexerLanguage(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; language);
 
+<FONT color=#0000ff>// END of generated section</FONT>
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+<FONT color=#0000ff>// Others...</FONT>
 
 
-    <FONT COLOR=#0000ff>// Set all font style attributes at once.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> StyleSetFontAttr(<B><FONT COLOR=#2e8b57>int</FONT></B> styleNum, <B><FONT COLOR=#2e8b57>int</FONT></B> size,
-                          <B><FONT COLOR=#2e8b57>const</FONT></B> wxString&amp; faceName,
-                          <B><FONT COLOR=#2e8b57>bool</FONT></B> bold, <B><FONT COLOR=#2e8b57>bool</FONT></B> italic,
-                          <B><FONT COLOR=#2e8b57>bool</FONT></B> underline);
+    <FONT color=#0000ff>// Returns the line number of the line with the caret.</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B> GetCurrentLine();
 
+    <FONT color=#0000ff>// Extract style settings from a spec-string which is composed of one or</FONT>
+    <FONT color=#0000ff>// more of the following comma separated elements:</FONT>
+    <FONT color=#0000ff>//</FONT>
+    <FONT color=#0000ff>//      bold                    turns on bold</FONT>
+    <FONT color=#0000ff>//      italic                  turns on italics</FONT>
+    <FONT color=#0000ff>//      fore:#RRGGBB            sets the foreground colour</FONT>
+    <FONT color=#0000ff>//      back:#RRGGBB            sets the background colour</FONT>
+    <FONT color=#0000ff>//      face:[facename]         sets the font face name to use</FONT>
+    <FONT color=#0000ff>//      size:[num]              sets the font size in points</FONT>
+    <FONT color=#0000ff>//      eol                     turns on eol filling</FONT>
+    <FONT color=#0000ff>//      underline               turns on underlining</FONT>
+    <FONT color=#0000ff>//</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetSpec(<B><FONT color=#2e8b57>int</FONT></B> styleNum, <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; spec);
 
 
-    <FONT COLOR=#0000ff>// Perform one of the operations defined by the wxSTC_CMD_* constants.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CmdKeyExecute(<B><FONT COLOR=#2e8b57>int</FONT></B> cmd);
 
+    <FONT color=#0000ff>// Set style size, face, bold, italic, and underline attributes from</FONT>
+    <FONT color=#0000ff>// a wxFont's attributes.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetFont(<B><FONT color=#2e8b57>int</FONT></B> styleNum, wxFont&amp; font);
 
 
-    <FONT COLOR=#0000ff>// Set the left and right margin in the edit area, measured in pixels.</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMargins(<B><FONT COLOR=#2e8b57>int</FONT></B> left, <B><FONT COLOR=#2e8b57>int</FONT></B> right);
 
+    <FONT color=#0000ff>// Set all font style attributes at once.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> StyleSetFontAttr(<B><FONT color=#2e8b57>int</FONT></B> styleNum, <B><FONT color=#2e8b57>int</FONT></B> size,
+                          <B><FONT color=#2e8b57>const</FONT></B> wxString&amp; faceName,
+                          <B><FONT color=#2e8b57>bool</FONT></B> bold, <B><FONT color=#2e8b57>bool</FONT></B> italic,
+                          <B><FONT color=#2e8b57>bool</FONT></B> underline);
 
-    <FONT COLOR=#0000ff>// Retrieve the start and end positions of the current selection.</FONT>
-<FONT COLOR=#a020f0>#ifdef SWIG</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> GetSelection(<B><FONT COLOR=#2e8b57>int</FONT></B>* OUTPUT, <B><FONT COLOR=#2e8b57>int</FONT></B>* OUTPUT);
-<FONT COLOR=#a020f0>#else</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> GetSelection(<B><FONT COLOR=#2e8b57>int</FONT></B>* startPos, <B><FONT COLOR=#2e8b57>int</FONT></B>* endPos);
-<FONT COLOR=#a020f0>#endif</FONT>
 
-    <FONT COLOR=#0000ff>// Retrieve the point in the window where a position is displayed.</FONT>
-    wxPoint PointFromPosition(<B><FONT COLOR=#2e8b57>int</FONT></B> pos);
 
+    <FONT color=#0000ff>// Perform one of the operations defined by the wxSTC_CMD_* constants.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> CmdKeyExecute(<B><FONT color=#2e8b57>int</FONT></B> cmd);
 
-    <FONT COLOR=#0000ff>// Scroll enough to make the given line visible</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ScrollToLine(<B><FONT COLOR=#2e8b57>int</FONT></B> line);
 
 
-    <FONT COLOR=#0000ff>// Scroll enough to make the given column visible</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> ScrollToColumn(<B><FONT COLOR=#2e8b57>int</FONT></B> column);
+    <FONT color=#0000ff>// Set the left and right margin in the edit area, measured in pixels.</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> SetMargins(<B><FONT color=#2e8b57>int</FONT></B> left, <B><FONT color=#2e8b57>int</FONT></B> right);
 
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
 
+    <FONT color=#0000ff>// Retrieve the start and end positions of the current selection.</FONT>
+<FONT color=#a020f0>#ifdef SWIG</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> GetSelection(<B><FONT color=#2e8b57>int</FONT></B>* OUTPUT, <B><FONT color=#2e8b57>int</FONT></B>* OUTPUT);
+<FONT color=#a020f0>#else</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> GetSelection(<B><FONT color=#2e8b57>int</FONT></B>* startPos, <B><FONT color=#2e8b57>int</FONT></B>* endPos);
+<FONT color=#a020f0>#endif</FONT>
 
-<FONT COLOR=#a020f0>#ifndef SWIG</FONT>
-<B><FONT COLOR=#804040>private</FONT></B>:
-    <FONT COLOR=#0000ff>// Event handlers</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnPaint(wxPaintEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnScrollWin(wxScrollWinEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnSize(wxSizeEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnMouseLeftDown(wxMouseEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnMouseMove(wxMouseEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnMouseLeftUp(wxMouseEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnMouseRightUp(wxMouseEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnChar(wxKeyEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnKeyDown(wxKeyEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnLoseFocus(wxFocusEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnGainFocus(wxFocusEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnSysColourChanged(wxSysColourChangedEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnEraseBackground(wxEraseEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnMenu(wxCommandEvent&amp; evt);
-    <B><FONT COLOR=#2e8b57>void</FONT></B> OnListBox(wxCommandEvent&amp; evt);
+    <FONT color=#0000ff>// Retrieve the point in the window where a position is displayed.</FONT>
+    wxPoint PointFromPosition(<B><FONT color=#2e8b57>int</FONT></B> pos);
 
 
-    <FONT COLOR=#0000ff>// Turn notifications from Scintilla into events</FONT>
-    <B><FONT COLOR=#2e8b57>void</FONT></B> NotifyChange();
-    <B><FONT COLOR=#2e8b57>void</FONT></B> NotifyParent(SCNotification* scn);
+    <FONT color=#0000ff>// Scroll enough to make the given line visible</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ScrollToLine(<B><FONT color=#2e8b57>int</FONT></B> line);
 
-    <B><FONT COLOR=#2e8b57>long</FONT></B> SendMsg(<B><FONT COLOR=#2e8b57>int</FONT></B> msg, <B><FONT COLOR=#2e8b57>long</FONT></B> wp=<FONT COLOR=#ff00ff>0</FONT>, <B><FONT COLOR=#2e8b57>long</FONT></B> lp=<FONT COLOR=#ff00ff>0</FONT>);
 
-<B><FONT COLOR=#804040>private</FONT></B>:
+    <FONT color=#0000ff>// Scroll enough to make the given column visible</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> ScrollToColumn(<B><FONT color=#2e8b57>int</FONT></B> column);
+
+
+    <FONT color=#0000ff>// Send a message to Scintilla</FONT>
+    <B><FONT color=#2e8b57>long</FONT></B> SendMsg(<B><FONT color=#2e8b57>int</FONT></B> msg, <B><FONT color=#2e8b57>long</FONT></B> wp=<FONT color=#ff00ff>0</FONT>, <B><FONT color=#2e8b57>long</FONT></B> lp=<FONT color=#ff00ff>0</FONT>);
+
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+
+
+<FONT color=#a020f0>#ifndef SWIG</FONT>
+<B><FONT color=#804040>private</FONT></B>:
+    <FONT color=#0000ff>// Event handlers</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> OnPaint(wxPaintEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnScrollWin(wxScrollWinEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnSize(wxSizeEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnMouseLeftDown(wxMouseEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnMouseMove(wxMouseEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnMouseLeftUp(wxMouseEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnContextMenu(wxContextMenuEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnMouseWheel(wxMouseEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnChar(wxKeyEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnKeyDown(wxKeyEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnLoseFocus(wxFocusEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnGainFocus(wxFocusEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnSysColourChanged(wxSysColourChangedEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnEraseBackground(wxEraseEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnMenu(wxCommandEvent&amp; evt);
+    <B><FONT color=#2e8b57>void</FONT></B> OnListBox(wxCommandEvent&amp; evt);
+
+
+    <FONT color=#0000ff>// Turn notifications from Scintilla into events</FONT>
+    <B><FONT color=#2e8b57>void</FONT></B> NotifyChange();
+    <B><FONT color=#2e8b57>void</FONT></B> NotifyParent(SCNotification* scn);
+
+<B><FONT color=#804040>private</FONT></B>:
     DECLARE_EVENT_TABLE()
     DECLARE_CLASS(wxStyledTextCtrl)
 
     wxStopWatch         m_stopWatch;
 
 
-    <B><FONT COLOR=#804040>friend</FONT></B> class ScintillaWX;
-    <B><FONT COLOR=#804040>friend</FONT></B> class Platform;
-<FONT COLOR=#a020f0>#endif</FONT>
+    <B><FONT color=#804040>friend</FONT></B> <B><FONT color=#2e8b57>class</FONT></B> ScintillaWX;
+    <B><FONT color=#804040>friend</FONT></B> <B><FONT color=#2e8b57>class</FONT></B> Platform;
+<FONT color=#a020f0>#endif</FONT>
 };
 
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
 
-<B><FONT COLOR=#2e8b57>class wxStyledTextEvent</FONT></B> : <B><FONT COLOR=#804040>public</FONT></B> wxCommandEvent {
-<B><FONT COLOR=#804040>public</FONT></B>:
-    wxStyledTextEvent(wxEventType commandType=<FONT COLOR=#ff00ff>0</FONT>, <B><FONT COLOR=#2e8b57>int</FONT></B> id=<FONT COLOR=#ff00ff>0</FONT>);
+<B><FONT color=#2e8b57>class</FONT></B> wxStyledTextEvent : <B><FONT color=#804040>public</FONT></B> wxCommandEvent {
+<B><FONT color=#804040>public</FONT></B>:
+    wxStyledTextEvent(wxEventType commandType=<FONT color=#ff00ff>0</FONT>, <B><FONT color=#2e8b57>int</FONT></B> id=<FONT color=#ff00ff>0</FONT>);
     ~wxStyledTextEvent() {}
 
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetPosition(<B><FONT COLOR=#2e8b57>int</FONT></B> pos)        { m_position = pos; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetKey(<B><FONT COLOR=#2e8b57>int</FONT></B> k)               { m_key = k; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetModifiers(<B><FONT COLOR=#2e8b57>int</FONT></B> m)         { m_modifiers = m; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetModificationType(<B><FONT COLOR=#2e8b57>int</FONT></B> t)  { m_modificationType = t; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetText(<B><FONT COLOR=#2e8b57>const</FONT></B> <B><FONT COLOR=#2e8b57>char</FONT></B>* t)      { m_text = t; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetLength(<B><FONT COLOR=#2e8b57>int</FONT></B> len)          { m_length = len; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetLinesAdded(<B><FONT COLOR=#2e8b57>int</FONT></B> num)      { m_linesAdded = num; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetLine(<B><FONT COLOR=#2e8b57>int</FONT></B> val)            { m_line = val; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetFoldLevelNow(<B><FONT COLOR=#2e8b57>int</FONT></B> val)    { m_foldLevelNow = val; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetFoldLevelPrev(<B><FONT COLOR=#2e8b57>int</FONT></B> val)   { m_foldLevelPrev = val; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMargin(<B><FONT COLOR=#2e8b57>int</FONT></B> val)          { m_margin = val; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetMessage(<B><FONT COLOR=#2e8b57>int</FONT></B> val)         { m_message = val; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetWParam(<B><FONT COLOR=#2e8b57>int</FONT></B> val)          { m_wParam = val; }
-    <B><FONT COLOR=#2e8b57>void</FONT></B> SetLParam(<B><FONT COLOR=#2e8b57>int</FONT></B> val)          { m_lParam = val; }
-
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetPosition() <B><FONT COLOR=#2e8b57>const</FONT></B>         { <B><FONT COLOR=#804040>return</FONT></B> m_position; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetKey()  <B><FONT COLOR=#2e8b57>const</FONT></B>             { <B><FONT COLOR=#804040>return</FONT></B> m_key; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetModifiers() <B><FONT COLOR=#2e8b57>const</FONT></B>        { <B><FONT COLOR=#804040>return</FONT></B> m_modifiers; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetModificationType() <B><FONT COLOR=#2e8b57>const</FONT></B> { <B><FONT COLOR=#804040>return</FONT></B> m_modificationType; }
-    wxString GetText() <B><FONT COLOR=#2e8b57>const</FONT></B>         { <B><FONT COLOR=#804040>return</FONT></B> m_text; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetLength() <B><FONT COLOR=#2e8b57>const</FONT></B>           { <B><FONT COLOR=#804040>return</FONT></B> m_length; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetLinesAdded() <B><FONT COLOR=#2e8b57>const</FONT></B>       { <B><FONT COLOR=#804040>return</FONT></B> m_linesAdded; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetLine() <B><FONT COLOR=#2e8b57>const</FONT></B>             { <B><FONT COLOR=#804040>return</FONT></B> m_line; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetFoldLevelNow() <B><FONT COLOR=#2e8b57>const</FONT></B>     { <B><FONT COLOR=#804040>return</FONT></B> m_foldLevelNow; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetFoldLevelPrev() <B><FONT COLOR=#2e8b57>const</FONT></B>    { <B><FONT COLOR=#804040>return</FONT></B> m_foldLevelPrev; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetMargin() <B><FONT COLOR=#2e8b57>const</FONT></B>           { <B><FONT COLOR=#804040>return</FONT></B> m_margin; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetMessage() <B><FONT COLOR=#2e8b57>const</FONT></B>          { <B><FONT COLOR=#804040>return</FONT></B> m_message; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetWParam() <B><FONT COLOR=#2e8b57>const</FONT></B>           { <B><FONT COLOR=#804040>return</FONT></B> m_wParam; }
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  GetLParam() <B><FONT COLOR=#2e8b57>const</FONT></B>           { <B><FONT COLOR=#804040>return</FONT></B> m_lParam; }
-
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetShift() <B><FONT COLOR=#2e8b57>const</FONT></B>;
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetControl() <B><FONT COLOR=#2e8b57>const</FONT></B>;
-    <B><FONT COLOR=#2e8b57>bool</FONT></B> GetAlt() <B><FONT COLOR=#2e8b57>const</FONT></B>;
-
-    <B><FONT COLOR=#2e8b57>void</FONT></B> CopyObject(wxObject&amp; obj) <B><FONT COLOR=#2e8b57>const</FONT></B>;
-
-<FONT COLOR=#a020f0>#ifndef SWIG</FONT>
-<B><FONT COLOR=#804040>private</FONT></B>:
+    <B><FONT color=#2e8b57>void</FONT></B> SetPosition(<B><FONT color=#2e8b57>int</FONT></B> pos)        { m_position = pos; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetKey(<B><FONT color=#2e8b57>int</FONT></B> k)               { m_key = k; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetModifiers(<B><FONT color=#2e8b57>int</FONT></B> m)         { m_modifiers = m; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetModificationType(<B><FONT color=#2e8b57>int</FONT></B> t)  { m_modificationType = t; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetText(<B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* t)      { m_text = t; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetLength(<B><FONT color=#2e8b57>int</FONT></B> len)          { m_length = len; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetLinesAdded(<B><FONT color=#2e8b57>int</FONT></B> num)      { m_linesAdded = num; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetLine(<B><FONT color=#2e8b57>int</FONT></B> val)            { m_line = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelNow(<B><FONT color=#2e8b57>int</FONT></B> val)    { m_foldLevelNow = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelPrev(<B><FONT color=#2e8b57>int</FONT></B> val)   { m_foldLevelPrev = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetMargin(<B><FONT color=#2e8b57>int</FONT></B> val)          { m_margin = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetMessage(<B><FONT color=#2e8b57>int</FONT></B> val)         { m_message = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetWParam(<B><FONT color=#2e8b57>int</FONT></B> val)          { m_wParam = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetLParam(<B><FONT color=#2e8b57>int</FONT></B> val)          { m_lParam = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetListType(<B><FONT color=#2e8b57>int</FONT></B> val)        { m_listType = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetX(<B><FONT color=#2e8b57>int</FONT></B> val)               { m_x = val; }
+    <B><FONT color=#2e8b57>void</FONT></B> SetY(<B><FONT color=#2e8b57>int</FONT></B> val)               { m_y = val; }
+
+    <B><FONT color=#2e8b57>int</FONT></B>  GetPosition() <B><FONT color=#2e8b57>const</FONT></B>         { <B><FONT color=#804040>return</FONT></B> m_position; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetKey()  <B><FONT color=#2e8b57>const</FONT></B>             { <B><FONT color=#804040>return</FONT></B> m_key; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetModifiers() <B><FONT color=#2e8b57>const</FONT></B>        { <B><FONT color=#804040>return</FONT></B> m_modifiers; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetModificationType() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_modificationType; }
+    wxString GetText() <B><FONT color=#2e8b57>const</FONT></B>         { <B><FONT color=#804040>return</FONT></B> m_text; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetLength() <B><FONT color=#2e8b57>const</FONT></B>           { <B><FONT color=#804040>return</FONT></B> m_length; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetLinesAdded() <B><FONT color=#2e8b57>const</FONT></B>       { <B><FONT color=#804040>return</FONT></B> m_linesAdded; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetLine() <B><FONT color=#2e8b57>const</FONT></B>             { <B><FONT color=#804040>return</FONT></B> m_line; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetFoldLevelNow() <B><FONT color=#2e8b57>const</FONT></B>     { <B><FONT color=#804040>return</FONT></B> m_foldLevelNow; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetFoldLevelPrev() <B><FONT color=#2e8b57>const</FONT></B>    { <B><FONT color=#804040>return</FONT></B> m_foldLevelPrev; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetMargin() <B><FONT color=#2e8b57>const</FONT></B>           { <B><FONT color=#804040>return</FONT></B> m_margin; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetMessage() <B><FONT color=#2e8b57>const</FONT></B>          { <B><FONT color=#804040>return</FONT></B> m_message; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetWParam() <B><FONT color=#2e8b57>const</FONT></B>           { <B><FONT color=#804040>return</FONT></B> m_wParam; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetLParam() <B><FONT color=#2e8b57>const</FONT></B>           { <B><FONT color=#804040>return</FONT></B> m_lParam; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetListType() <B><FONT color=#2e8b57>const</FONT></B>         { <B><FONT color=#804040>return</FONT></B> m_listType; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetX() <B><FONT color=#2e8b57>const</FONT></B>                { <B><FONT color=#804040>return</FONT></B> m_x; }
+    <B><FONT color=#2e8b57>int</FONT></B>  GetY() <B><FONT color=#2e8b57>const</FONT></B>                { <B><FONT color=#804040>return</FONT></B> m_y; }
+
+    <B><FONT color=#2e8b57>bool</FONT></B> GetShift() <B><FONT color=#2e8b57>const</FONT></B>;
+    <B><FONT color=#2e8b57>bool</FONT></B> GetControl() <B><FONT color=#2e8b57>const</FONT></B>;
+    <B><FONT color=#2e8b57>bool</FONT></B> GetAlt() <B><FONT color=#2e8b57>const</FONT></B>;
+
+    <B><FONT color=#2e8b57>void</FONT></B> CopyObject(wxObject&amp; obj) <B><FONT color=#2e8b57>const</FONT></B>;
+
+<FONT color=#a020f0>#ifndef SWIG</FONT>
+<B><FONT color=#804040>private</FONT></B>:
     DECLARE_DYNAMIC_CLASS(wxStyledTextEvent)
 
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_position;
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_key;
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_modifiers;
+    <B><FONT color=#2e8b57>int</FONT></B>  m_position;
+    <B><FONT color=#2e8b57>int</FONT></B>  m_key;
+    <B><FONT color=#2e8b57>int</FONT></B>  m_modifiers;
 
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_modificationType;    <FONT COLOR=#0000ff>// wxEVT_STC_MODIFIED</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B>  m_modificationType;    <FONT color=#0000ff>// wxEVT_STC_MODIFIED</FONT>
     wxString m_text;
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_length;
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_linesAdded;
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_line;
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_foldLevelNow;
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_foldLevelPrev;
-
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_margin;              <FONT COLOR=#0000ff>// wxEVT_STC_MARGINCLICK</FONT>
-
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_message;             <FONT COLOR=#0000ff>// wxEVT_STC_MACRORECORD</FONT>
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_wParam;
-    <B><FONT COLOR=#2e8b57>int</FONT></B>  m_lParam;
-<FONT COLOR=#a020f0>#endif</FONT>
-};
-
-
-<FONT COLOR=#0000ff>// Event types</FONT>
-<B><FONT COLOR=#2e8b57>enum</FONT></B> {
-    wxEVT_STC_CHANGE = <FONT COLOR=#ff00ff>1650</FONT>,
-    wxEVT_STC_STYLENEEDED,
-    wxEVT_STC_CHARADDED,
-    wxEVT_STC_UPDATEUI,
-    wxEVT_STC_SAVEPOINTREACHED,
-    wxEVT_STC_SAVEPOINTLEFT,
-    wxEVT_STC_ROMODIFYATTEMPT,
-    wxEVT_STC_DOUBLECLICK,
-    wxEVT_STC_MODIFIED,
-    wxEVT_STC_KEY,
-    wxEVT_STC_MACRORECORD,
-    wxEVT_STC_MARGINCLICK,
-    wxEVT_STC_NEEDSHOWN,
-    wxEVT_STC_POSCHANGED
+    <B><FONT color=#2e8b57>int</FONT></B>  m_length;
+    <B><FONT color=#2e8b57>int</FONT></B>  m_linesAdded;
+    <B><FONT color=#2e8b57>int</FONT></B>  m_line;
+    <B><FONT color=#2e8b57>int</FONT></B>  m_foldLevelNow;
+    <B><FONT color=#2e8b57>int</FONT></B>  m_foldLevelPrev;
+
+    <B><FONT color=#2e8b57>int</FONT></B>  m_margin;              <FONT color=#0000ff>// wxEVT_STC_MARGINCLICK</FONT>
+
+    <B><FONT color=#2e8b57>int</FONT></B>  m_message;             <FONT color=#0000ff>// wxEVT_STC_MACRORECORD</FONT>
+    <B><FONT color=#2e8b57>int</FONT></B>  m_wParam;
+    <B><FONT color=#2e8b57>int</FONT></B>  m_lParam;
+
+    <B><FONT color=#2e8b57>int</FONT></B> m_listType;
+    <B><FONT color=#2e8b57>int</FONT></B> m_x;
+    <B><FONT color=#2e8b57>int</FONT></B> m_y;
+<FONT color=#a020f0>#endif</FONT>
 };
 
-
-<FONT COLOR=#a020f0>#ifndef SWIG</FONT>
-<B><FONT COLOR=#2e8b57>typedef</FONT></B> <B><FONT COLOR=#2e8b57>void</FONT></B> (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&amp;);
-
-<FONT COLOR=#a020f0>#define EVT_STC_CHANGE(id, fn) { wxEVT_STC_CHANGE, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_STYLENEEDED(id, fn) { wxEVT_STC_STYLENEEDED, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_CHARADDED(id, fn) { wxEVT_STC_CHARADDED, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_UPDATEUI(id, fn) { wxEVT_STC_UPDATEUI, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_SAVEPOINTREACHED(id, fn) { wxEVT_STC_SAVEPOINTREACHED, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_SAVEPOINTLEFT(id, fn) { wxEVT_STC_SAVEPOINTLEFT, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_ROMODIFYATTEMPT(id, fn) { wxEVT_STC_ROMODIFYATTEMPT, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_DOUBLECLICK(id, fn) { wxEVT_STC_DOUBLECLICK, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_MODIFIED(id, fn) { wxEVT_STC_MODIFIED, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_KEY(id, fn) { wxEVT_STC_KEY, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_MACRORECORD(id, fn) { wxEVT_STC_MACRORECORD, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_MARGINCLICK(id, fn) { wxEVT_STC_MARGINCLICK, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_NEEDSHOWN(id, fn) { wxEVT_STC_NEEDSHOWN, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-<FONT COLOR=#a020f0>#define EVT_STC_POSCHANGED(id, fn) { wxEVT_STC_POSCHANGED, id, -</FONT><FONT COLOR=#ff00ff>1</FONT><FONT COLOR=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) NULL },</FONT>
-
-<FONT COLOR=#a020f0>#endif</FONT>
-
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
-<FONT COLOR=#0000ff>//----------------------------------------------------------------------</FONT>
-<FONT COLOR=#a020f0>#endif</FONT>
+<FONT color=#a020f0>#ifndef SWIG</FONT>
+BEGIN_DECLARE_EVENT_TYPES()
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE,                  <FONT color=#ff00ff>1650</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED,             <FONT color=#ff00ff>1651</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED,               <FONT color=#ff00ff>1652</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED,        <FONT color=#ff00ff>1653</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT,           <FONT color=#ff00ff>1654</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT,         <FONT color=#ff00ff>1655</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY,                     <FONT color=#ff00ff>1656</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK,             <FONT color=#ff00ff>1657</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI,                <FONT color=#ff00ff>1658</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED,                <FONT color=#ff00ff>1659</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD,             <FONT color=#ff00ff>1660</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK,             <FONT color=#ff00ff>1661</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN,               <FONT color=#ff00ff>1662</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED,              <FONT color=#ff00ff>1663</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_PAINTED,                 <FONT color=#ff00ff>1664</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_USERLISTSELECTION,       <FONT color=#ff00ff>1665</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED,              <FONT color=#ff00ff>1666</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART,              <FONT color=#ff00ff>1667</FONT>)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND,                <FONT color=#ff00ff>1668</FONT>)
+END_DECLARE_EVENT_TYPES()
+<FONT color=#a020f0>#else</FONT>
+    <B><FONT color=#2e8b57>enum</FONT></B> {
+        wxEVT_STC_CHANGE,
+        wxEVT_STC_STYLENEEDED,
+        wxEVT_STC_CHARADDED,
+        wxEVT_STC_SAVEPOINTREACHED,
+        wxEVT_STC_SAVEPOINTLEFT,
+        wxEVT_STC_ROMODIFYATTEMPT,
+        wxEVT_STC_KEY,
+        wxEVT_STC_DOUBLECLICK,
+        wxEVT_STC_UPDATEUI,
+        wxEVT_STC_MODIFIED,
+        wxEVT_STC_MACRORECORD,
+        wxEVT_STC_MARGINCLICK,
+        wxEVT_STC_NEEDSHOWN,
+        wxEVT_STC_POSCHANGED,
+        wxEVT_STC_PAINTED,
+        wxEVT_STC_USERLISTSELECTION,
+        wxEVT_STC_URIDROPPED,
+        wxEVT_STC_DWELLSTART,
+        wxEVT_STC_DWELLEND,
+    };
+<FONT color=#a020f0>#endif</FONT>
+
+
+
+<FONT color=#a020f0>#ifndef SWIG</FONT>
+<B><FONT color=#2e8b57>typedef</FONT></B> <B><FONT color=#2e8b57>void</FONT></B> (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&amp;);
+
+<FONT color=#a020f0>#define EVT_STC_CHANGE(id, fn)                  DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE,                id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_STYLENEEDED(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED,           id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_CHARADDED(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED,             id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_SAVEPOINTREACHED(id, fn)        DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED,      id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_SAVEPOINTLEFT(id, fn)           DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT,         id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_ROMODIFYATTEMPT(id, fn)         DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT,       id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_KEY(id, fn)                     DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY,                   id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_DOUBLECLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK,           id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_UPDATEUI(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI,              id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_MODIFIED(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED,              id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_MACRORECORD(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD,           id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_MARGINCLICK(id, fn)             DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK,           id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_NEEDSHOWN(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN,             id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_POSCHANGED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED,            id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_PAINTED(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED,               id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_USERLISTSELECTION(id, fn)       DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION,     id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_URIDROPPED(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED,            id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_DWELLSTART(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART,            id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_DWELLEND(id, fn)                DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND,              id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+
+
+<FONT color=#a020f0>#endif</FONT>
+
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
+<FONT color=#a020f0>#endif</FONT>
 
 
 </PRE>
index eb55ea356c44625914f45efaa0e88114ac2f812a..cf589e92f337f2eae5a1a61c9ea37e8025c53b98 100644 (file)
@@ -182,6 +182,7 @@ def runTest(frame, nb, log):
         print "GetSelectedText(): ", repr(ed.GetSelectedText())
         print "GetTextRange(25, 35): ", repr(ed.GetTextRange(25, 35))
 
+
         ed.GotoPos(0)
 
     return p
@@ -193,7 +194,7 @@ def runTest(frame, nb, log):
 
 overview = """\
 <html><body>
-Once again, no docs yet.  <b>Sorry.</b>  But <a href="data/stc.h">this</a>
+Once again, no docs yet.  <b>Sorry.</b>  But <a href="data/stc.h.html">this</a>
 and <a href="http://www.scintilla.org/ScintillaDoc.html">this</a> should
 be helpful.
 </body><html>
index a6f80f6623bb006af3feefe039ee458139ba9b8f..52597a671ebc0c38263ded7532fd578bee90f240 100644 (file)
@@ -296,7 +296,7 @@ def runTest(frame, nb, log):
 
 overview = """\
 <html><body>
-Once again, no docs yet.  <b>Sorry.</b>  But <a href="data/stc.h">this</a>
+Once again, no docs yet.  <b>Sorry.</b>  But <a href="data/stc.h.html">this</a>
 and <a href="http://www.scintilla.org/ScintillaDoc.html">this</a> should
 be helpful.
 </body><html>