]> git.saurik.com Git - wxWidgets.git/commitdiff
Updated to Scintilla from 1.45 to 1.47
authorRobin Dunn <robin@alldunn.com>
Fri, 6 Sep 2002 16:59:31 +0000 (16:59 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 6 Sep 2002 16:59:31 +0000 (16:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

88 files changed:
contrib/include/wx/stc/stc.h
contrib/src/stc/PlatWX.cpp
contrib/src/stc/ScintillaWX.cpp
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/PropSet.h
contrib/src/stc/scintilla/include/SString.h
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/WindowAccessor.h
contrib/src/stc/scintilla/src/AutoComplete.cxx
contrib/src/stc/scintilla/src/CallTip.cxx
contrib/src/stc/scintilla/src/CellBuffer.cxx
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/KeyWords.cxx
contrib/src/stc/scintilla/src/LexCPP.cxx
contrib/src/stc/scintilla/src/LexCrontab.cxx
contrib/src/stc/scintilla/src/LexHTML.cxx
contrib/src/stc/scintilla/src/LexLua.cxx
contrib/src/stc/scintilla/src/LexOthers.cxx
contrib/src/stc/scintilla/src/LexPerl.cxx
contrib/src/stc/scintilla/src/LexPython.cxx
contrib/src/stc/scintilla/src/PropSet.cxx
contrib/src/stc/scintilla/src/RESearch.cxx
contrib/src/stc/scintilla/src/ScintillaBase.cxx
contrib/src/stc/scintilla/src/ScintillaBase.h
contrib/src/stc/scintilla/src/StyleContext.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/gen_iface.py
src/stc/scintilla/README.txt
src/stc/scintilla/include/Accessor.h
src/stc/scintilla/include/KeyWords.h
src/stc/scintilla/include/Platform.h
src/stc/scintilla/include/PropSet.h
src/stc/scintilla/include/SString.h
src/stc/scintilla/include/SciLexer.h
src/stc/scintilla/include/Scintilla.h
src/stc/scintilla/include/Scintilla.iface
src/stc/scintilla/include/ScintillaWidget.h
src/stc/scintilla/include/WindowAccessor.h
src/stc/scintilla/src/AutoComplete.cxx
src/stc/scintilla/src/CallTip.cxx
src/stc/scintilla/src/CellBuffer.cxx
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/KeyWords.cxx
src/stc/scintilla/src/LexCPP.cxx
src/stc/scintilla/src/LexCrontab.cxx
src/stc/scintilla/src/LexHTML.cxx
src/stc/scintilla/src/LexLua.cxx
src/stc/scintilla/src/LexOthers.cxx
src/stc/scintilla/src/LexPerl.cxx
src/stc/scintilla/src/LexPython.cxx
src/stc/scintilla/src/PropSet.cxx
src/stc/scintilla/src/RESearch.cxx
src/stc/scintilla/src/ScintillaBase.cxx
src/stc/scintilla/src/ScintillaBase.h
src/stc/scintilla/src/StyleContext.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/msw/stc_.cpp
wxPython/contrib/stc/msw/stc_.py
wxPython/contrib/stc/stc_.i
wxPython/demo/wxDynamicSashWindow.py
wxPython/demo/wxStyledTextCtrl_1.py

index 64061f23fcaab7049df9bde5fb60d0d8c5a41501..92f4484c5b3027272ab6c205f053dfc65fafbe65 100644 (file)
@@ -44,7 +44,7 @@
 #define wxSTC_OPTIONAL_START 3000
 #define wxSTC_LEXER_START 4000
 
-// Redoes the next action on the undo history
+// Redoes the next action on the undo history.
 #define wxSTC_CMD_REDO 2011
 
 // Select all the text in the document.
@@ -70,7 +70,7 @@
 #define wxSTC_MARK_MINUS 7
 #define wxSTC_MARK_PLUS 8
 
-// Shapes used for outlining column
+// Shapes used for outlining column.
 #define wxSTC_MARK_VLINE 9
 #define wxSTC_MARK_LCORNER 10
 #define wxSTC_MARK_TCORNER 11
 #define wxSTC_MARK_CIRCLEMINUS 20
 #define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
 
-// Invisible mark that only sets the line background color
+// Invisible mark that only sets the line background color.
 #define wxSTC_MARK_BACKGROUND 22
 #define wxSTC_MARK_CHARACTER 10000
 
-// Markers used for outlining column
+// Markers used for outlining column.
 #define wxSTC_MARKNUM_FOLDEREND 25
 #define wxSTC_MARKNUM_FOLDEROPENMID 26
 #define wxSTC_MARKNUM_FOLDERMIDTAIL 27
 // Delete the selection or if no selection, the character before the caret.
 #define wxSTC_CMD_DELETEBACK 2326
 
-// If selection is empty or all on one line replace the selection with a tab
-// character.
+// If selection is empty or all on one line replace the selection with a tab character.
 // If more than one line selected, indent the lines.
 #define wxSTC_CMD_TAB 2327
 
 #define wxSTC_CMD_LINESCROLLUP 2343
 
 // Delete the selection or if no selection, the character before the caret.
-// Will not delete the chraacter before at the start of a line.
+// Will not delete the character before at the start of a line.
 #define wxSTC_CMD_DELETEBACKNOTLINE 2344
 #define wxSTC_EDGE_NONE 0
 #define wxSTC_EDGE_LINE 1
 #define wxSTC_EDGE_BACKGROUND 2
+#define wxSTC_CURSORNORMAL -1
+#define wxSTC_CURSORWAIT 3
 
-// 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
+// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
+#define wxSTC_VISIBLE_SLOP 0x01
+#define wxSTC_VISIBLE_STRICT 0x04
 
-// Value not used
-#define wxSTC_CARET_CENTER 0x02
+// Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+// If CARET_SLOP is set, we can define a slop value: caretSlop.
+// This value defines an unwanted zone (UZ) where the caret is... unwanted.
+// This zone is defined as a number of pixels near the vertical margins,
+// and as a number of lines near the horizontal margins.
+// By keeping the caret away from the edges, it is seen within its context,
+// so it is likely that the identifier that the caret is on can be completely seen,
+// and that the current line is seen with some of the lines following it which are
+// often dependent on that line.
+#define wxSTC_CARET_SLOP 0x01
 
-// If CARET_SLOP also set then reposition whenever outside slop border
-// If CARET_SLOP not set then recentre even when visible
+// If CARET_STRICT is set, the policy is enforced... strictly.
+// The caret is centred on the display if slop is not set,
+// and cannot go in the UZ if slop is set.
 #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_JUMPS is set, the display is moved more energetically
+// so the caret can move in the same direction longer before the policy is applied again.
+#define wxSTC_CARET_JUMPS 0x10
 
-// 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
+// If CARET_EVEN is not set, instead of having symmetrical UZs,
+// the left and bottom UZs are extended up to right and top UZs respectively.
+// This way, we favour the displaying of useful information: the begining of lines,
+// where most code reside, and the lines after the caret, eg. the body of a function.
+#define wxSTC_CARET_EVEN 0x08
 
 // Notifications
-// Type of modification and the action which caused the modification
+// 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_BEFOREDELETE 0x800
 #define wxSTC_MODEVENTMASKALL 0xF77
 
-// Symbolic key codes and modifier flags
-// ASCII and other printable characters below 256
-// Extended keys above 300
+// 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_LEX_PHP 30
 #define wxSTC_LEX_BAAN 31
 #define wxSTC_LEX_MATLAB 32
+#define wxSTC_LEX_SCRIPTOL 33
 
 // When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
 // value assigned in sequence from SCLEX_AUTOMATIC+1.
 #define wxSTC_C_COMMENTDOCKEYWORD 17
 #define wxSTC_C_COMMENTDOCKEYWORDERROR 18
 
-// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
-#define wxSTC_B_DEFAULT 0
-#define wxSTC_B_COMMENT 1
-#define wxSTC_B_NUMBER 2
-#define wxSTC_B_KEYWORD 3
-#define wxSTC_B_STRING 4
-#define wxSTC_B_PREPROCESSOR 5
-#define wxSTC_B_OPERATOR 6
-#define wxSTC_B_IDENTIFIER 7
-#define wxSTC_B_DATE 8
-
 // Lexical states for SCLEX_HTML, SCLEX_XML
 #define wxSTC_H_DEFAULT 0
 #define wxSTC_H_TAG 1
 #define wxSTC_PL_STRING_QR 29
 #define wxSTC_PL_STRING_QW 30
 
+// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
+#define wxSTC_B_DEFAULT 0
+#define wxSTC_B_COMMENT 1
+#define wxSTC_B_NUMBER 2
+#define wxSTC_B_KEYWORD 3
+#define wxSTC_B_STRING 4
+#define wxSTC_B_PREPROCESSOR 5
+#define wxSTC_B_OPERATOR 6
+#define wxSTC_B_IDENTIFIER 7
+#define wxSTC_B_DATE 8
+
+// Lexical states for SCLEX_PROPERTIES
+#define wxSTC_PROPS_DEFAULT 0
+#define wxSTC_PROPS_COMMENT 1
+#define wxSTC_PROPS_SECTION 2
+#define wxSTC_PROPS_ASSIGNMENT 3
+#define wxSTC_PROPS_DEFVAL 4
+
 // Lexical states for SCLEX_LATEX
 #define wxSTC_L_DEFAULT 0
 #define wxSTC_L_COMMAND 1
 #define wxSTC_ERR_PERL 6
 #define wxSTC_ERR_NET 7
 #define wxSTC_ERR_LUA 8
+#define wxSTC_ERR_CTAG 9
 #define wxSTC_ERR_DIFF_CHANGED 10
 #define wxSTC_ERR_DIFF_ADDITION 11
 #define wxSTC_ERR_DIFF_DELETION 12
 #define wxSTC_MAKE_TARGET 5
 #define wxSTC_MAKE_IDEOL 9
 
-// Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+// Lexical states for SCLEX_DIFF
+#define wxSTC_DIFF_DEFAULT 0
+#define wxSTC_DIFF_COMMENT 1
+#define wxSTC_DIFF_COMMAND 2
+#define wxSTC_DIFF_HEADER 3
+#define wxSTC_DIFF_POSITION 4
+#define wxSTC_DIFF_DELETED 5
+#define wxSTC_DIFF_ADDED 6
+
+// Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
 #define wxSTC_CONF_DEFAULT 0
 #define wxSTC_CONF_COMMENT 1
 #define wxSTC_CONF_NUMBER 2
 #define wxSTC_CONF_IP 8
 #define wxSTC_CONF_DIRECTIVE 9
 
-// Avenue
+// Lexical states for SCLEX_AVE, Avenue
 #define wxSTC_AVE_DEFAULT 0
 #define wxSTC_AVE_COMMENT 1
 #define wxSTC_AVE_NUMBER 2
 #define wxSTC_EIFFEL_IDENTIFIER 7
 #define wxSTC_EIFFEL_STRINGEOL 8
 
-// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
+// Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
 #define wxSTC_NNCRONTAB_DEFAULT 0
 #define wxSTC_NNCRONTAB_COMMENT 1
 #define wxSTC_NNCRONTAB_TASK 2
 #define wxSTC_MATLAB_OPERATOR 6
 #define wxSTC_MATLAB_IDENTIFIER 7
 
+// Lexical states for SCLEX_SCRIPTOL
+#define wxSTC_SCRIPTOL_DEFAULT 0
+#define wxSTC_SCRIPTOL_COMMENT 1
+#define wxSTC_SCRIPTOL_COMMENTLINE 2
+#define wxSTC_SCRIPTOL_COMMENTDOC 3
+#define wxSTC_SCRIPTOL_NUMBER 4
+#define wxSTC_SCRIPTOL_WORD 5
+#define wxSTC_SCRIPTOL_STRING 6
+#define wxSTC_SCRIPTOL_CHARACTER 7
+#define wxSTC_SCRIPTOL_UUID 8
+#define wxSTC_SCRIPTOL_PREPROCESSOR 9
+#define wxSTC_SCRIPTOL_OPERATOR 10
+#define wxSTC_SCRIPTOL_IDENTIFIER 11
+#define wxSTC_SCRIPTOL_STRINGEOL 12
+#define wxSTC_SCRIPTOL_VERBATIM 13
+#define wxSTC_SCRIPTOL_REGEX 14
+#define wxSTC_SCRIPTOL_COMMENTLINEDOC 15
+#define wxSTC_SCRIPTOL_WORD2 16
+#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORD 17
+#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
+#define wxSTC_SCRIPTOL_COMMENTBASIC 19
+
 // END of generated section
 //----------------------------------------------------------------------
 
@@ -845,37 +890,37 @@ public:
 //       and regenerate
 
 
-    // Add text to the document
+    // Add text to the document.
     void AddText(const wxString& text);
 
-    // Add array of cells to document
+    // Add array of cells to document.
     void AddStyledText(const wxMemoryBuffer& data);
 
-    // Insert string at a position
+    // Insert string at a position.
     void InsertText(int pos, const wxString& text);
 
-    // Delete all text in the document
+    // Delete all text in the document.
     void ClearAll();
 
-    // Set all style bytes to 0, remove all folding information
+    // Set all style bytes to 0, remove all folding information.
     void ClearDocumentStyle();
 
-    // The number of characters in the document
+    // The number of characters in the document.
     int GetLength();
 
-    // Returns the character byte at the position
+    // Returns the character byte at the position.
     int GetCharAt(int pos);
 
-    // Returns the position of the caret
+    // Returns the position of the caret.
     int GetCurrentPos();
 
-    // Returns the position of the opposite end of the selection to the caret
+    // Returns the position of the opposite end of the selection to the caret.
     int GetAnchor();
 
-    // Returns the style byte at the position
+    // Returns the style byte at the position.
     int GetStyleAt(int pos);
 
-    // Redoes the next action on the undo history
+    // Redoes the next action on the undo history.
     void Redo();
 
     // Choose between collecting actions into the undo
@@ -892,10 +937,10 @@ public:
     // Retrieve a buffer of cells.
     wxMemoryBuffer GetStyledText(int startPos, int endPos);
 
-    // Are there any redoable actions in the undo history.
+    // Are there any redoable actions in the undo history?
     bool CanRedo();
 
-    // Retrieve the line number at which a particular marker is located
+    // Retrieve the line number at which a particular marker is located.
     int MarkerLineFromHandle(int handle);
 
     // Delete a marker.
@@ -949,23 +994,21 @@ public:
     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.
+    // 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.
+    // 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.
+    // 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.
@@ -989,10 +1032,10 @@ public:
     // Add a marker to a line, returning an ID which can be used to find or delete the marker.
     int MarkerAdd(int line, int markerNumber);
 
-    // Delete a marker from a line
+    // Delete a marker from a line.
     void MarkerDelete(int line, int markerNumber);
 
-    // Delete all markers with a particular number from all lines
+    // 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.
@@ -1094,8 +1137,7 @@ public:
     // 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.
+    // 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.
@@ -1117,8 +1159,8 @@ public:
     // 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
+    // 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);
 
@@ -1137,7 +1179,7 @@ public:
     // Is the background of the line containing the caret in a different colour?
     bool GetCaretLineVisible();
 
-    // Dsplay the background of the line containing the caret in a different colour.
+    // 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.
@@ -1161,8 +1203,7 @@ public:
     // Is there an auto-completion list visible?
     bool AutoCompActive();
 
-    // Retrieve the position of the caret when the auto-completion list was
-    // displayed.
+    // 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.
@@ -1171,8 +1212,8 @@ public:
     // 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.
+    // 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.
@@ -1207,16 +1248,18 @@ public:
     // 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
+    // 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
+    // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
     bool AutoCompGetAutoHide();
 
-    // Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+    // Set whether or not autocompletion deletes any word characters
+    // after the inserted text upon completion.
     void AutoCompSetDropRestOfWord(bool dropRestOfWord);
 
-    // Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+    // Retrieve whether or not autocompletion deletes any word characters
+    // after the inserted text upon completion.
     bool AutoCompGetDropRestOfWord();
 
     // Set the number of spaces used for one level of indentation.
@@ -1305,7 +1348,7 @@ public:
     // Find some text in the document.
     int FindText(int minPos, int maxPos, const wxString& text, int flags=0);
 
-    // On Windows will draw the document into a display context such as a printer.
+    // On Windows, will draw the document into a display context such as a printer.
     int FormatRange(bool   doDraw,
                                int    startPos,
                                int    endPos,
@@ -1371,7 +1414,7 @@ public:
     // Will a paste succeed?
     bool CanPaste();
 
-    // Are there any undoable actions in the undo history.
+    // Are there any undoable actions in the undo history?
     bool CanUndo();
 
     // Delete the undo history.
@@ -1401,16 +1444,16 @@ public:
     // Retrieve the number of characters in the document.
     int GetTextLength();
 
-    // Set to overtype (true) or insert mode
+    // Set to overtype (true) or insert mode.
     void SetOvertype(bool overtype);
 
     // Returns true if overtype mode is active otherwise false is returned.
     bool GetOvertype();
 
-    // Set the width of the insert mode caret
+    // Set the width of the insert mode caret.
     void SetCaretWidth(int pixelWidth);
 
-    // Returns the width of the insert mode caret
+    // Returns the width of the insert mode caret.
     int GetCaretWidth();
 
     // Sets the position that starts the target which is used for updating the
@@ -1445,10 +1488,10 @@ public:
     // 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
+    // Set the search flags used by SearchInTarget.
     void SetSearchFlags(int flags);
 
-    // Get the search flags used by SearchInTarget
+    // Get the search flags used by SearchInTarget.
     int GetSearchFlags();
 
     // Show a call tip containing a definition near position pos.
@@ -1510,53 +1553,76 @@ public:
     // Ensure a particular line is visible by expanding any header line hiding it.
     void EnsureVisible(int line);
 
-    // Set some debugging options for folding
+    // 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
+    // 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
+    // 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
+    // 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
+    // Retrieve the time the mouse must sit still to generate a mouse dwell event.
     int GetMouseDwellTime();
 
-    // Get position of start of word
+    // Get position of start of word.
     int WordStartPosition(int pos, bool onlyWordCharacters);
 
-    // Get position of end of word
+    // Get position of end of word.
     int WordEndPosition(int pos, bool onlyWordCharacters);
 
-    // Sets whether text is word wrapped
+    // Sets whether text is word wrapped.
     void SetWrapMode(int mode);
 
-    // Retrieve whether text is word wrapped
+    // Retrieve whether text is word wrapped.
     int GetWrapMode();
 
-    // Sets the degree of caching of layout information
+    // Sets the degree of caching of layout information.
     void SetLayoutCache(int mode);
 
-    // Retrieve the degree of caching of layout information
+    // Retrieve the degree of caching of layout information.
     int GetLayoutCache();
 
-    // Move the caret inside current view if it's not there already
+    // Sets the document width assumed for scrolling.
+    void SetScrollWidth(int pixelWidth);
+
+    // Retrieve the document width assumed for scrolling.
+    int GetScrollWidth();
+
+    // Measure the pixel width of some text in a particular style.
+    // Nul terminated text argument.
+    // Does not handle tab or control characters.
+    int TextWidth(int style, const wxString& text);
+
+    // Sets the scroll range so that maximum scroll position has
+    // the last line at the bottom of the view (default).
+    // Setting this to false allows scrolling one page below the last line.
+    void SetEndAtLastLine(bool endAtLastLine);
+
+    // Retrieve whether the maximum scroll position has the last
+    // line at the bottom of the view.
+    int GetEndAtLastLine();
+
+    // Retrieve the height of a particular line of text in pixels.
+    int TextHeight(int line);
+
+    // 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.
+    // How many characters are on a line, not including end of line characters?
     int LineLength(int line);
 
     // Highlight the characters at two positions.
@@ -1568,10 +1634,10 @@ public:
     // Find the position of a matching brace or INVALID_POSITION if no match.
     int BraceMatch(int pos);
 
-    // Are the end of line characters visible.
+    // Are the end of line characters visible?
     bool GetViewEOL();
 
-    // Make the end of line characters visible or invisible
+    // Make the end of line characters visible or invisible.
     void SetViewEOL(bool visible);
 
     // Retrieve a pointer to the document object.
@@ -1614,9 +1680,6 @@ public:
     // 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.
-    void SetCaretPolicy(int caretPolicy, int caretSlop);
-
     // Retrieves the number of lines completely visible.
     int LinesOnScreen();
 
@@ -1624,7 +1687,7 @@ public:
     // the wrong mouse button.
     void UsePopUp(bool allowPopUp);
 
-    // Is the selection a rectangular. The alternative is the more common stream selection.
+    // Is the selection 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.
@@ -1647,62 +1710,73 @@ public:
     // Get which document modification events are sent to the container.
     int GetModEventMask();
 
-    // Change internal focus flag
+    // Change internal focus flag.
     void SetSTCFocus(bool focus);
 
-    // Get internal focus flag
+    // Get internal focus flag.
     bool GetSTCFocus();
 
-    // Change error status - 0 = OK
+    // Change error status - 0 = OK.
     void SetStatus(int statusCode);
 
-    // Get error status
+    // Get error status.
     int GetStatus();
 
-    // Set whether the mouse is captured when its button is pressed
+    // Set whether the mouse is captured when its button is pressed.
     void SetMouseDownCaptures(bool captures);
 
-    // Get whether mouse gets captured
+    // Get whether mouse gets captured.
     bool GetMouseDownCaptures();
 
-    // Sets the cursor to one of the SC_CURSOR* values
+    // Sets the cursor to one of the SC_CURSOR* values.
     void SetCursor(int cursorType);
 
-    // Get cursor type
+    // Get cursor type.
     int GetCursor();
 
     // Change the way control characters are displayed:
-    // If symbol is < 32, keep the drawn way, else, use the given character
+    // If symbol is < 32, keep the drawn way, else, use the given character.
     void SetControlCharSymbol(int symbol);
 
-    // Get the way control characters are displayed
+    // Get the way control characters are displayed.
     int GetControlCharSymbol();
 
-    // Move to the previous change in capitalistion
+    // Move to the previous change in capitalisation.
     void WordPartLeft();
 
-    // Move to the previous change in capitalistion extending selection to new caret position.
+    // Move to the previous change in capitalisation extending selection
+    // to new caret position.
     void WordPartLeftExtend();
 
-    // Move to the change next in capitalistion
+    // Move to the change next in capitalisation.
     void WordPartRight();
 
-    // Move to the next change in capitalistion extending selection to new caret position.
+    // Move to the next change in capitalisation 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.
+    // Set the way the display area is determined when a particular line
+    // is to be moved to by Find, FindNext, GotoLine, etc.
     void SetVisiblePolicy(int visiblePolicy, int visibleSlop);
 
-    // Delete back from the current position to the start of the line
+    // 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
+    // Delete forwards from the current position to the end of the line.
     void DelLineRight();
 
-    // Get and Set the xOffset (ie, horizonal scroll position)
+    // Get and Set the xOffset (ie, horizonal scroll position).
     void SetXOffset(int newOffset);
     int GetXOffset();
 
+    // Set the way the caret is kept visible when going sideway.
+    // The exclusion zone is given in pixels.
+    void SetXCaretPolicy(int caretPolicy, int caretSlop);
+
+    // Set the way the line the caret is on is kept visible.
+    // The exclusion zone is given in lines.
+    void SetYCaretPolicy(int caretPolicy, int caretSlop);
+
     // Start notifying the container of all key presses and commands.
     void StartRecord();
 
@@ -1986,6 +2060,7 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG,              1669)
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER,               1670)
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP,                 1671)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM,                    1672)
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
@@ -2011,6 +2086,7 @@ END_DECLARE_EVENT_TYPES()
         wxEVT_STC_START_DRAG,
         wxEVT_STC_DRAG_OVER,
         wxEVT_STC_DO_DROP,
+        wxEVT_STC_ZOOM,
     };
 #endif
 
@@ -2041,6 +2117,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 #define EVT_STC_START_DRAG(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #define EVT_STC_DRAG_OVER(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #define EVT_STC_DO_DROP(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP,               id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn)                    DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM,                  id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #endif
 
 //----------------------------------------------------------------------
index 8edc3bf5e762385dc47ec701af4e0c0f7a7e51e2..8abff4b97dbfccbb0d3c20cbb4ac135c8cd99127 100644 (file)
@@ -906,6 +906,15 @@ long Platform::SendScintilla(WindowID w,
     return stc->SendMsg(msg, wParam, lParam);
 }
 
+long Platform::SendScintillaPointer(WindowID w,
+                                    unsigned int msg,
+                                    unsigned long wParam,
+                                    void *lParam) {
+
+    wxStyledTextCtrl* stc = (wxStyledTextCtrl*)w;
+    return stc->SendMsg(msg, wParam, (long)lParam);
+}
+
 
 // These are utility functions not really tied to a platform
 
index 5a256340edffe8d62a9b5b6474e5bb6a445fee7c..506d56ffc20d55fa8584a30c291118e9a530e46a 100644 (file)
 #include "wx/stc/stc.h"
 #include "PlatWX.h"
 
-
-//----------------------------------------------------------------------
-
-const int H_SCROLL_MAX  = 4000;
-const int H_SCROLL_STEP = 20;
-const int H_SCROLL_PAGE = 200;
-
 //----------------------------------------------------------------------
 // Helper classes
 
@@ -265,10 +258,12 @@ void ScintillaWX::SetHorizontalScrollPos() {
     }
 }
 
+const int H_SCROLL_STEP = 20;
 
 bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
     bool modified = false;
 
+    // Check the vertical scrollbar
     if (stc->m_vScrollBar == NULL) {  // Use built-in scrollbar
         int  sbMax    = stc->GetScrollRange(wxVERTICAL);
         int  sbThumb  = stc->GetScrollThumb(wxVERTICAL);
@@ -289,24 +284,40 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
     }
 
 
-    if (horizontalScrollBarVisible) {
-        if (stc->m_hScrollBar == NULL) {  // Use built-in scrollbar
-            int sbMax    = stc->GetScrollRange(wxHORIZONTAL);
-            int sbThumb  = stc->GetScrollThumb(wxHORIZONTAL);
-            if ((sbMax != H_SCROLL_MAX) || (sbThumb != H_SCROLL_STEP)) {
-                stc->SetScrollbar(wxHORIZONTAL, 0, H_SCROLL_STEP, H_SCROLL_MAX);
-                modified = true;
+    // Check the horizontal scrollbar
+    PRectangle rcText = GetTextRectangle();
+    int horizEnd = scrollWidth;
+    if (horizEnd < 0)
+        horizEnd = 0;
+    if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
+        horizEnd = 0;
+    int pageWidth = rcText.Width();
+
+    if (stc->m_hScrollBar == NULL) {  // Use built-in scrollbar
+        int sbMax    = stc->GetScrollRange(wxHORIZONTAL);
+        int sbThumb  = stc->GetScrollThumb(wxHORIZONTAL);
+        int sbPos    = stc->GetScrollPos(wxHORIZONTAL);
+        if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
+            stc->SetScrollbar(wxHORIZONTAL, 0, pageWidth, horizEnd);
+            modified = true;
+            if (scrollWidth < pageWidth) {
+                HorizontalScrollTo(0);
             }
         }
-        else { // otherwise use the one that's been given to us
-            int  sbMax    = stc->m_hScrollBar->GetRange();
-            int  sbPage   = stc->m_hScrollBar->GetPageSize();
-            if ((sbMax != H_SCROLL_MAX) || (sbPage != H_SCROLL_STEP)) {
-                stc->m_hScrollBar->SetScrollbar(0, H_SCROLL_STEP, H_SCROLL_MAX, H_SCROLL_STEP);
-                modified = true;
+    }
+    else { // otherwise use the one that's been given to us
+        int sbMax    = stc->m_hScrollBar->GetRange();
+        int sbThumb  = stc->m_hScrollBar->GetPageSize();
+        int sbPos    = stc->m_hScrollBar->GetThumbPosition();
+        if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
+            stc->m_hScrollBar->SetScrollbar(0, pageWidth, horizEnd, pageWidth);
+            modified = true;
+            if (scrollWidth < pageWidth) {
+                HorizontalScrollTo(0);
             }
         }
     }
+
     return modified;
 }
 
@@ -443,18 +454,24 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
 
 void ScintillaWX::DoHScroll(int type, int pos) {
     int xPos = xOffset;
+    PRectangle rcText = GetTextRectangle();
+    int pageWidth = rcText.Width() * 2 / 3;
     if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
         xPos -= H_SCROLL_STEP;
     else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
         xPos += H_SCROLL_STEP;
     else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
-        xPos -= H_SCROLL_PAGE;
-    else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN)
-        xPos += H_SCROLL_PAGE;
+        xPos -= pageWidth;
+    else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN) {
+        xPos += pageWidth;
+        if (xPos > scrollWidth - rcText.Width()) {
+            xPos = scrollWidth - rcText.Width();
+        }
+    }
     else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
         xPos = 0;
     else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
-        xPos = H_SCROLL_MAX;
+        xPos = scrollWidth;
     else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
         xPos = pos;
 
index 3da52f8420ddf9b87657e49f3f37db9ab3d32fb4..8c30ad99e6840c900bcc43a2c3b81385d6c49360 100644 (file)
@@ -553,6 +553,12 @@ def processIface(iface, h_tmplt, cpp_tmplt, h_dest, cpp_dest):
         elif op == 'evt ':
             pass
 
+        elif op == 'enu ':
+            pass
+
+        elif op == 'lex ':
+            pass
+
         else:
             print '***** Unknown line type: ', line
 
index 32a294845c63af6b6164e5bb459784a3bdffeda7..3534249c036d54939102db4c83d8eca313c001f9 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.45
+The current version of the Scintilla code is 1.47
 
index 17c951067221fa0b246dab36e7ee9194da39d462..0b2c4baee25cb8a8bc1768adf22a05c9a5fe2358 100644 (file)
@@ -55,6 +55,7 @@ public:
        }
        void SetCodePage(int codePage_) { codePage = codePage_; }
 
+       virtual bool Match(int pos, const char *s)=0;
        virtual char StyleAt(int position)=0;
        virtual int GetLine(int position)=0;
        virtual int LineStart(int line)=0;
index fa427ff2eb0694ed3304bb47cc41ea05d4ec1606..df4e870c580f507203f57f61f2cc58a7af04a2fe 100644 (file)
@@ -19,15 +19,22 @@ protected:
        int language;
        LexerFunction fnLexer;
        LexerFunction fnFolder;
-       
+       const char * const * wordListDescriptions;
+
        static const LexerModule *base;
        static int nextLanguage;
 
 public:
        const char *languageName;
        LexerModule(int language_, LexerFunction fnLexer_, 
-               const char *languageName_=0, LexerFunction fnFolder_=0);
+               const char *languageName_=0, LexerFunction fnFolder_=0,
+               const char * const wordListDescriptions_[] = NULL);
        int GetLanguage() const { return language; }
+
+       // -1 is returned if no WordList information is available
+       int GetNumWordLists() const;
+       const char *GetWordListDescription(int index) const;
+
        virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
                   WordList *keywordlists[], Accessor &styler) const;
        virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
index 0984ea66c7cf4ec59b29ee63254d5a5ae84aa131..1a8dfaa96e0cad7e1e2e6d66fb1cf81684b1ece7 100644 (file)
@@ -106,8 +106,8 @@ public:
                        (rc.top >= top) && (rc.bottom <= bottom);
        }
        bool Intersects(PRectangle other) {
-               return (right >= other.left) && (left <= other.right) &&
-                       (bottom >= other.top) && (top <= other.bottom);
+               return (right > other.left) && (left < other.right) &&
+                       (bottom > other.top) && (top < other.bottom);
        }
        int Width() { return right - left; }
        int Height() { return bottom - top; }
@@ -430,6 +430,8 @@ public:
        static bool IsKeyDown(int key);
        static long SendScintilla(
                WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
+       static long SendScintillaPointer(
+               WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0);
        static bool IsDBCSLeadByte(int codePage, char ch);
 
        // These are utility functions not really tied to a platform
index 2596349818b6293819d7ca2fe5e6264bbbb8decd..59588c62edc08fca5cfa351765eff3c5a1c258da 100644 (file)
@@ -76,10 +76,6 @@ public:
                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'));
 }
index df7fd43b5bfd5ecba4622b644f365b2709ea3895..6bfe50fccd1cc58cac58a500fccf4017cd964e48 100644 (file)
@@ -10,7 +10,7 @@
 
 // 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);
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
 bool EqualCaseInsensitive(const char *a, const char *b);
 
 // Define another string class.
@@ -22,13 +22,13 @@ bool EqualCaseInsensitive(const char *a, const char *b);
  *
  * 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.
+ * May have embedded zeroes as a result of @a substitute, but relies too heavily on C string
+ * functions to allow reliable manipulations of these strings, other than simple appends, etc.
  **/
 class SString {
 public:
        /** Type of string lengths (sizes) and positions (indexes). */
-       typedef unsigned int lenpos_t;
+       typedef size_t lenpos_t;
        /** Out of bounds value indicating that the string argument should be measured. */
        enum { measure_length=0xffffffffU};
 
@@ -63,7 +63,7 @@ private:
                }
                if (sSize > 0 && sSize_ <= sSize) {     // Does not allocate new buffer if the current is big enough
                        if (s && sSize_) {
-                               strncpy(s, sOther, sSize_);
+                               memcpy(s, sOther, sSize_);
                        }
                        s[sSize_] = '\0';
                        sLen = sSize_;
@@ -92,6 +92,7 @@ public:
                sSize = sLen = (s) ? strlen(s) : 0;
        }
        SString(const char *s_, lenpos_t first, lenpos_t last) : sizeGrowth(sizeGrowthDefault) {
+               // note: expects the "last" argument to point one beyond the range end (a la STL iterators)
                s = StringAllocate(s_ + first, last - first);
                sSize = sLen = (s) ? strlen(s) : 0;
        }
@@ -188,6 +189,27 @@ public:
                else
                        return '\0';
        }
+       SString substr(lenpos_t subPos, lenpos_t subLen=measure_length) const {
+               if (subPos >= sLen) {
+                       return SString();                                       // return a null string if start index is out of bounds
+               }
+               if ((subLen == measure_length) || (subPos + subLen > sLen)) {
+                       subLen = sLen - subPos;         // can't substr past end of source string
+               }
+               return SString(s, subPos, subPos + subLen);
+       }
+       SString &lowercase(lenpos_t subPos = 0, lenpos_t subLen=measure_length) {
+               if ((subLen == measure_length) || (subPos + subLen > sLen)) {
+                       subLen = sLen - subPos;         // don't apply past end of string
+               }
+               for (lenpos_t i = subPos; i < subPos + subLen; i++) {
+                       if (s[i] < 'A' || s[i] > 'Z')
+                               continue;
+                       else
+                               s[i] = static_cast<char>(s[i] - 'A' + 'a');
+               }
+               return *this;
+       }
        SString &append(const char *sOther, lenpos_t sLenOther=measure_length, char sep = '\0') {
                if (!sOther) {
                        return *this;
@@ -206,7 +228,7 @@ public:
                                s[sLen] = sep;
                                sLen++;
                        }
-                       strncpy(&s[sLen], sOther, sLenOther);
+                       memcpy(&s[sLen], sOther, sLenOther);
                        sLen += sLenOther;
                        s[sLen] = '\0';
                }
@@ -259,6 +281,13 @@ public:
                        sLen -= len;
                }
        }
+       SString &change(lenpos_t pos, char ch) {
+               if (pos >= sLen) {                                      // character changed must be in string bounds
+                       return *this;
+               }
+               *(s + pos) = ch;
+               return *this;
+       }
        /** Read an integral numeric value from the string. */
        int value() const {
                if (s)
@@ -266,7 +295,7 @@ public:
                else
                        return 0;
        }
-       int search(const char *sFind, lenpos_t start=0) {
+       int search(const char *sFind, lenpos_t start=0) const {
                if (start < sLen) {
                        const char *sFound = strstr(s + start, sFind);
                        if (sFound) {
@@ -325,7 +354,7 @@ public:
                }
                char *sNew = new char[len + 1];
                if (sNew) {
-                       strncpy(sNew, s, len);
+                       memcpy(sNew, s, len);
                        sNew[len] = '\0';
                }
                return sNew;
index fb77a702e0c4d75f381eab388d54500940d85298..a6066cd58519563197cee2a2054a67baa3e38d0e 100644 (file)
@@ -47,6 +47,7 @@
 #define SCLEX_PHP 30
 #define SCLEX_BAAN 31
 #define SCLEX_MATLAB 32
+#define SCLEX_SCRIPTOL 33
 #define SCLEX_AUTOMATIC 1000
 #define SCE_P_DEFAULT 0
 #define SCE_P_COMMENTLINE 1
 #define SCE_C_WORD2 16
 #define SCE_C_COMMENTDOCKEYWORD 17
 #define SCE_C_COMMENTDOCKEYWORDERROR 18
-#define SCE_B_DEFAULT 0
-#define SCE_B_COMMENT 1
-#define SCE_B_NUMBER 2
-#define SCE_B_KEYWORD 3
-#define SCE_B_STRING 4
-#define SCE_B_PREPROCESSOR 5
-#define SCE_B_OPERATOR 6
-#define SCE_B_IDENTIFIER 7
-#define SCE_B_DATE 8
 #define SCE_H_DEFAULT 0
 #define SCE_H_TAG 1
 #define SCE_H_TAGUNKNOWN 2
 #define SCE_PL_STRING_QX 28
 #define SCE_PL_STRING_QR 29
 #define SCE_PL_STRING_QW 30
+#define SCE_B_DEFAULT 0
+#define SCE_B_COMMENT 1
+#define SCE_B_NUMBER 2
+#define SCE_B_KEYWORD 3
+#define SCE_B_STRING 4
+#define SCE_B_PREPROCESSOR 5
+#define SCE_B_OPERATOR 6
+#define SCE_B_IDENTIFIER 7
+#define SCE_B_DATE 8
+#define SCE_PROPS_DEFAULT 0
+#define SCE_PROPS_COMMENT 1
+#define SCE_PROPS_SECTION 2
+#define SCE_PROPS_ASSIGNMENT 3
+#define SCE_PROPS_DEFVAL 4
 #define SCE_L_DEFAULT 0
 #define SCE_L_COMMAND 1
 #define SCE_L_TAG 2
 #define SCE_ERR_PERL 6
 #define SCE_ERR_NET 7
 #define SCE_ERR_LUA 8
+#define SCE_ERR_CTAG 9
 #define SCE_ERR_DIFF_CHANGED 10
 #define SCE_ERR_DIFF_ADDITION 11
 #define SCE_ERR_DIFF_DELETION 12
 #define SCE_MAKE_OPERATOR 4
 #define SCE_MAKE_TARGET 5
 #define SCE_MAKE_IDEOL 9
+#define SCE_DIFF_DEFAULT 0
+#define SCE_DIFF_COMMENT 1
+#define SCE_DIFF_COMMAND 2
+#define SCE_DIFF_HEADER 3
+#define SCE_DIFF_POSITION 4
+#define SCE_DIFF_DELETED 5
+#define SCE_DIFF_ADDED 6
 #define SCE_CONF_DEFAULT 0
 #define SCE_CONF_COMMENT 1
 #define SCE_CONF_NUMBER 2
 #define SCE_MATLAB_STRING 5
 #define SCE_MATLAB_OPERATOR 6
 #define SCE_MATLAB_IDENTIFIER 7
+#define SCE_SCRIPTOL_DEFAULT 0
+#define SCE_SCRIPTOL_COMMENT 1
+#define SCE_SCRIPTOL_COMMENTLINE 2
+#define SCE_SCRIPTOL_COMMENTDOC 3
+#define SCE_SCRIPTOL_NUMBER 4
+#define SCE_SCRIPTOL_WORD 5
+#define SCE_SCRIPTOL_STRING 6
+#define SCE_SCRIPTOL_CHARACTER 7
+#define SCE_SCRIPTOL_UUID 8
+#define SCE_SCRIPTOL_PREPROCESSOR 9
+#define SCE_SCRIPTOL_OPERATOR 10
+#define SCE_SCRIPTOL_IDENTIFIER 11
+#define SCE_SCRIPTOL_STRINGEOL 12
+#define SCE_SCRIPTOL_VERBATIM 13
+#define SCE_SCRIPTOL_REGEX 14
+#define SCE_SCRIPTOL_COMMENTLINEDOC 15
+#define SCE_SCRIPTOL_WORD2 16
+#define SCE_SCRIPTOL_COMMENTDOCKEYWORD 17
+#define SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
+#define SCE_SCRIPTOL_COMMENTBASIC 19
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
 
 #endif
index 99b3ee0b1a433b9ab2cfc1cd8ebdb2e1e1467fbf..4b8ccd23f458ea4a85ee4d349fa740035601781a 100644 (file)
@@ -21,8 +21,16 @@ int Scintilla_LinkLexers();
 // 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.
+#if _MSC_VER >= 1300
+#include <BaseTsd.h>
+#endif
+#ifdef MAXULONG_PTR
+typedef ULONG_PTR uptr_t;
+typedef LONG_PTR sptr_t;
+#else
 typedef unsigned long uptr_t;
 typedef long sptr_t;
+#endif
 
 typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
@@ -359,6 +367,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SC_CACHE_DOCUMENT 3
 #define SCI_SETLAYOUTCACHE 2272
 #define SCI_GETLAYOUTCACHE 2273
+#define SCI_SETSCROLLWIDTH 2274
+#define SCI_GETSCROLLWIDTH 2275
+#define SCI_TEXTWIDTH 2276
+#define SCI_SETENDATLASTLINE 2277
+#define SCI_GETENDATLASTLINE 2278
+#define SCI_TEXTHEIGHT 2279
 #define SCI_LINEDOWN 2300
 #define SCI_LINEDOWNEXTEND 2301
 #define SCI_LINEUP 2302
@@ -426,12 +440,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCI_SEARCHANCHOR 2366
 #define SCI_SEARCHNEXT 2367
 #define SCI_SEARCHPREV 2368
-#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
 #define SCI_SELECTIONISRECTANGLE 2372
@@ -465,6 +473,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCI_SETXOFFSET 2397
 #define SCI_GETXOFFSET 2398
 #define SCI_GRABFOCUS 2400
+#define CARET_SLOP 0x01
+#define CARET_STRICT 0x04
+#define CARET_JUMPS 0x10
+#define CARET_EVEN 0x08
+#define SCI_SETXCARETPOLICY 2402
+#define SCI_SETYCARETPOLICY 2403
 #define SCI_STARTRECORD 3001
 #define SCI_STOPRECORD 3002
 #define SCI_SETLEXER 4001
@@ -525,6 +539,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCN_URIDROPPED 2015
 #define SCN_DWELLSTART 2016
 #define SCN_DWELLEND 2017
+#define SCN_ZOOM 2018
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
 
 // These structures are defined to be exactly the same shape as the Win32
@@ -598,6 +613,11 @@ struct SCNotification {
 
 #ifdef INCLUDE_DEPRECATED_FEATURES
 
+#define SCI_SETCARETPOLICY 2369
+#define CARET_CENTER 0x02
+#define CARET_XEVEN 0x08
+#define CARET_XJUMPS 0x10
+
 #define SCN_POSCHANGED 2012
 #define SCN_CHECKBRACE 2007
 
index c912cfd47ba804bc9169d66b89b0738ccefd13aa..f6e259efc661c6a64a0e7b15d496e1c306222fb1 100644 (file)
@@ -17,6 +17,9 @@
 ##     set -> a property set function
 ##     val -> definition of a constant
 ##     evt -> an event
+##     enu -> associate an enumeration with a set of vals with a prefix
+##     lex -> associate a lexer with the lexical classes it produces
+##
 ## All other feature names should be ignored. They may be defined in the future.
 ## A property may have a set function, a get function or both. Each will have
 ## "Get" or "Set" in their names and the corresponding name will have the obvious switch.
 ## The feature numbers are stable so features will not be renumbered.
 ## Features may be removed but they will go through a period of deprecation
 ## before removal which is signalled by moving them into the Deprecated category.
+##
+## enu has the syntax enu<ws><enumeration>=<prefix>[<ws><prefix>]* where all the val
+## features in this file starting with a given <prefix> are considered part of the
+## enumeration.
+##
+## lex has the syntax lex<ws><name>=<lexerVal><ws><prefix>[<ws><prefix>]*
+## where name is a reasonably capitalised (Python, XML) identifier or UI name,
+## lexerVal is the val used to specify the lexer, and the list of prefixes is similar
+## to enu. The name may not be the same as that used within the lexer so the lexerVal
+## should be used to tie these entities together.
 
 ## Types:
 ##     void
@@ -73,37 +86,37 @@ val SCI_START=2000
 val SCI_OPTIONAL_START=3000
 val SCI_LEXER_START=4000
 
-# Add text to the document
+# Add text to the document.
 fun void AddText=2001(int length, string text)
 
-# Add array of cells to document
+# Add array of cells to document.
 fun void AddStyledText=2002(int length, cells c)
 
-# Insert string at a position
+# Insert string at a position.
 fun void InsertText=2003(position pos, string text)
 
-# Delete all text in the document
+# Delete all text in the document.
 fun void ClearAll=2004(,)
 
-# Set all style bytes to 0, remove all folding information
+# Set all style bytes to 0, remove all folding information.
 fun void ClearDocumentStyle=2005(,)
 
-# The number of characters in the document
+# The number of characters in the document.
 get int GetLength=2006(,)
 
-# Returns the character byte at the position
+# Returns the character byte at the position.
 get int GetCharAt=2007(position pos,)
 
-# Returns the position of the caret
+# Returns the position of the caret.
 get position GetCurrentPos=2008(,)
 
-# Returns the position of the opposite end of the selection to the caret
+# Returns the position of the opposite end of the selection to the caret.
 get position GetAnchor=2009(,)
 
-# Returns the style byte at the position
+# Returns the style byte at the position.
 get int GetStyleAt=2010(position pos,)
 
-# Redoes the next action on the undo history
+# Redoes the next action on the undo history.
 fun void Redo=2011(,)
 
 # Choose between collecting actions into the undo
@@ -121,10 +134,10 @@ fun void SetSavePoint=2014(,)
 # Returns the number of bytes in the buffer not including terminating nulls.
 fun int GetStyledText=2015(, textrange tr)
 
-# Are there any redoable actions in the undo history.
+# Are there any redoable actions in the undo history?
 fun bool CanRedo=2016(,)
 
-# Retrieve the line number at which a particular marker is located
+# Retrieve the line number at which a particular marker is located.
 fun int MarkerLineFromHandle=2017(int handle,)
 
 # Delete a marker.
@@ -133,6 +146,7 @@ fun void MarkerDeleteHandle=2018(int handle,)
 # Is undo history being collected?
 get bool GetUndoCollection=2019(,)
 
+enu WhiteSpace=SCWS_
 val SCWS_INVISIBLE=0
 val SCWS_VISIBLEALWAYS=1
 val SCWS_VISIBLEAFTERINDENT=2
@@ -168,6 +182,7 @@ fun int GetCurLine=2027(int length, stringresult text)
 # Retrieve the position of the last correctly styled character.
 get position GetEndStyled=2028(,)
 
+enu EndOfLine=SC_EOL_
 val SC_EOL_CRLF=0
 val SC_EOL_CR=1
 val SC_EOL_LF=2
@@ -182,23 +197,21 @@ get int GetEOLMode=2030(,)
 set void SetEOLMode=2031(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.
+# The styling mask can be used to protect some bits in each styling byte from modification.
 fun void StartStyling=2032(position 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.
 fun void SetStyling=2033(int length, int style)
 
-# Is drawing done first into a buffer or direct to the screen.
+# Is drawing done first into a buffer or direct to the screen?
 get bool GetBufferedDraw=2034(,)
 
 # If drawing is buffered then each line of text is drawn into a bitmap buffer
 # before drawing it to the screen to avoid flicker.
 set void SetBufferedDraw=2035(bool buffered,)
 
-# Change the visible size of a tab to be a multiple of the width of a space
-# character.
+# Change the visible size of a tab to be a multiple of the width of a space character.
 set void SetTabWidth=2036(int tabWidth,)
 
 # Retrieve the visible size of a tab.
@@ -212,10 +225,11 @@ val SC_CP_UTF8=65001
 # The SC_CP_UTF8 value can be used to enter Unicode mode.
 set void SetCodePage=2037(int codePage,)
 
-# In palette mode, Scintilla uses the environments palette calls to display
+# In palette mode, Scintilla uses the environment's palette calls to display
 # more colours. This may lead to ugly displays.
 set void SetUsePalette=2039(bool usePalette,)
 
+enu MarkerSymbol=SC_MARK_
 val MARKER_MAX=31
 val SC_MARK_CIRCLE=0
 val SC_MARK_ROUNDRECT=1
@@ -227,7 +241,7 @@ val SC_MARK_ARROWDOWN=6
 val SC_MARK_MINUS=7
 val SC_MARK_PLUS=8
 
-# Shapes used for outlining column
+# Shapes used for outlining column.
 val SC_MARK_VLINE=9
 val SC_MARK_LCORNER=10
 val SC_MARK_TCORNER=11
@@ -242,12 +256,13 @@ val SC_MARK_CIRCLEPLUSCONNECTED=19
 val SC_MARK_CIRCLEMINUS=20
 val SC_MARK_CIRCLEMINUSCONNECTED=21
 
-# Invisible mark that only sets the line background color
+# Invisible mark that only sets the line background color.
 val SC_MARK_BACKGROUND=22
 
 val SC_MARK_CHARACTER=10000
 
-# Markers used for outlining column
+enu MarkerOutline=SC_MARKNUM_
+# Markers used for outlining column.
 val SC_MARKNUM_FOLDEREND=25
 val SC_MARKNUM_FOLDEROPENMID=26
 val SC_MARKNUM_FOLDERMIDTAIL=27
@@ -270,10 +285,10 @@ fun void MarkerSetBack=2042(int markerNumber, colour back)
 # Add a marker to a line, returning an ID which can be used to find or delete the marker.
 fun int MarkerAdd=2043(int line, int markerNumber)
 
-# Delete a marker from a line
+# Delete a marker from a line.
 fun void MarkerDelete=2044(int line, int markerNumber)
 
-# Delete all markers with a particular number from all lines
+# Delete all markers with a particular number from all lines.
 fun void MarkerDeleteAll=2045(int markerNumber,)
 
 # Get a bit mask of all the markers set on a line.
@@ -285,6 +300,7 @@ fun int MarkerNext=2047(int lineStart, int markerMask)
 # Find the previous line before lineStart that includes a marker in mask.
 fun int MarkerPrevious=2048(int lineStart, int markerMask)
 
+enu MarginType=SC_MARGIN_
 val SC_MARGIN_SYMBOL=0
 val SC_MARGIN_NUMBER=1
 
@@ -314,6 +330,7 @@ get bool GetMarginSensitiveN=2247(int margin,)
 
 # Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
 # Styles 38 and 39 are for future use.
+enu StylesCommon=STYLE_
 val STYLE_DEFAULT=32
 val STYLE_LINENUMBER=33
 val STYLE_BRACELIGHT=34
@@ -325,6 +342,7 @@ val STYLE_MAX=127
 
 # Character set identifiers are used in StyleSetCharacterSet.
 # The values are the same as the Windows *_CHARSET values.
+enu CharacterSet=SC_CHARSET_
 val SC_CHARSET_ANSI=0
 val SC_CHARSET_DEFAULT=1
 val SC_CHARSET_BALTIC=186
@@ -375,6 +393,7 @@ fun void StyleResetDefault=2058(,)
 # Set a style to be underlined or not.
 set void StyleSetUnderline=2059(int style, bool underline)
 
+enu CaseVisible=SC_CASE_
 val SC_CASE_MIXED=0
 val SC_CASE_UPPER=1
 val SC_CASE_LOWER=2
@@ -414,8 +433,7 @@ get int GetCaretPeriod=2075(,)
 # Get the time in milliseconds that the caret is on and off. 0 = steady on.
 set void SetCaretPeriod=2076(int periodMilliseconds,)
 
-# Set the set of characters making up words for when moving or selecting
-# by word.
+# Set the set of characters making up words for when moving or selecting by word.
 set void SetWordChars=2077(, string characters)
 
 # Start a sequence of actions that is undone and redone as a unit.
@@ -425,6 +443,7 @@ fun void BeginUndoAction=2078(,)
 # End a sequence of actions that is undone and redone as a unit.
 fun void EndUndoAction=2079(,)
 
+enu IndicatorStyle=INDIC_
 val INDIC_MAX=7
 val INDIC_PLAIN=0
 val INDIC_SQUIGGLE=1
@@ -448,8 +467,8 @@ set void IndicSetFore=2082(int indic, colour fore)
 # Retrieve the foreground colour of an indicator.
 get colour IndicGetFore=2083(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
+# 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.
 set void SetStyleBits=2090(int bits,)
 
@@ -468,7 +487,7 @@ get int GetMaxLineState=2094(,)
 # Is the background of the line containing the caret in a different colour?
 get bool GetCaretLineVisible=2095(,)
 
-# Dsplay the background of the line containing the caret in a different colour.
+# 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.
@@ -492,8 +511,7 @@ fun void AutoCCancel=2101(,)
 # Is there an auto-completion list visible?
 fun bool AutoCActive=2102(,)
 
-# Retrieve the position of the caret when the auto-completion list was
-# displayed.
+# Retrieve the position of the caret when the auto-completion list was displayed.
 fun position AutoCPosStart=2103(,)
 
 # User has selected an item so remove the list and insert the selection.
@@ -502,8 +520,8 @@ fun void AutoCComplete=2104(,)
 # Define a set of character that when typed cancel the auto-completion list.
 fun void AutoCStops=2105(, string 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.
+# Change the separator character in the string setting up an auto-completion list.
+# Default is space but can be changed if items contain space.
 set void AutoCSetSeparator=2106(int separatorCharacter,)
 
 # Retrieve the auto-completion list separator character.
@@ -538,16 +556,18 @@ 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 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
+# Retrieve whether or not autocompletion is hidden automatically when nothing matches.
 get bool AutoCGetAutoHide=2119(,)
 
-# Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+# Set whether or not autocompletion deletes any word characters
+# after the inserted text upon completion.
 set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,)
 
-# Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+# Retrieve whether or not autocompletion deletes any word characters
+# after the inserted text upon completion.
 get bool AutoCGetDropRestOfWord=2271(,)
 
 # Set the number of spaces used for one level of indentation.
@@ -630,6 +650,7 @@ set void SetPrintMagnification=2146(int magnification,)
 # Returns the print magnification.
 get int GetPrintMagnification=2147(,)
 
+enu PrintOption=SC_PRINT_
 # PrintColourMode - use same colours as screen.
 val SC_PRINT_NORMAL=0
 # PrintColourMode - invert the light value of each style for printing.
@@ -647,6 +668,7 @@ set void SetPrintColourMode=2148(int mode,)
 # Returns the print colour mode.
 get int GetPrintColourMode=2149(,)
 
+enu FindOption=SCFIND_
 val SCFIND_WHOLEWORD=2
 val SCFIND_MATCHCASE=4
 val SCFIND_WORDSTART=0x00100000
@@ -655,7 +677,7 @@ val SCFIND_REGEXP=0x00200000
 # Find some text in the document.
 fun position FindText=2150(int flags, findtext ft)
 
-# On Windows will draw the document into a display context such as a printer.
+# On Windows, will draw the document into a display context such as a printer.
 fun void FormatRange=2151(bool draw, formatrange fr)
 
 # Retrieve the line at the top of the display.
@@ -727,7 +749,7 @@ fun void Null=2172(,)
 # Will a paste succeed?
 fun bool CanPaste=2173(,)
 
-# Are there any undoable actions in the undo history.
+# Are there any undoable actions in the undo history?
 fun bool CanUndo=2174(,)
 
 # Delete the undo history.
@@ -765,16 +787,16 @@ get int GetDirectFunction=2184(,)
 # the function returned by GetDirectFunction.
 get int GetDirectPointer=2185(,)
 
-# Set to overtype (true) or insert mode
+# Set to overtype (true) or insert mode.
 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 the width of the insert mode caret.
 set void SetCaretWidth=2188(int pixelWidth,)
 
-# Returns the width of the insert mode caret
+# 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
@@ -809,10 +831,10 @@ fun int ReplaceTargetRE=2195(int length, string text)
 # 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 the search flags used by SearchInTarget.
 set void SetSearchFlags=2198(int flags,)
 
-# Get the search flags used by SearchInTarget
+# Get the search flags used by SearchInTarget.
 get int GetSearchFlags=2199(,)
 
 # Show a call tip containing a definition near position pos.
@@ -839,6 +861,7 @@ fun int VisibleFromDocLine=2220(int line,)
 # Find the document line of a display line taking hidden lines into account.
 fun int DocLineFromVisible=2221(int lineDisplay,)
 
+enu FoldLevel=SC_FOLDLEVEL
 val SC_FOLDLEVELBASE=0x400
 val SC_FOLDLEVELWHITEFLAG=0x1000
 val SC_FOLDLEVELHEADERFLAG=0x2000
@@ -879,20 +902,20 @@ fun void ToggleFold=2231(int line,)
 # Ensure a particular line is visible by expanding any header line hiding it.
 fun void EnsureVisible=2232(int line,)
 
-# Set some debugging options for folding
+# 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
+# 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
+# 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?
@@ -900,38 +923,63 @@ get bool GetBackSpaceUnIndents=2263(,)
 
 val SC_TIME_FOREVER=10000000
 
-# Sets the time the mouse must sit still to generate a mouse dwell event
+# 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
+# Retrieve the time the mouse must sit still to generate a mouse dwell event.
 get int GetMouseDwellTime=2265(,)
 
-# Get position of start of word
+# Get position of start of word.
 fun int WordStartPosition=2266(position pos, bool onlyWordCharacters)
 
-# Get position of end of word
+# Get position of end of word.
 fun int WordEndPosition=2267(position pos, bool onlyWordCharacters)
 
+enu Wrap=SC_WRAP_
 val SC_WRAP_NONE=0
 val SC_WRAP_WORD=1
 
-# Sets whether text is word wrapped
+# Sets whether text is word wrapped.
 set void SetWrapMode=2268(int mode,)
 
-# Retrieve whether text is word wrapped
+# Retrieve whether text is word wrapped.
 get int GetWrapMode=2269(,)
 
+enu LineCache=SC_CACHE_
 val SC_CACHE_NONE=0
 val SC_CACHE_CARET=1
 val SC_CACHE_PAGE=2
 val SC_CACHE_DOCUMENT=3
 
-# Sets the degree of caching of layout information
+# Sets the degree of caching of layout information.
 set void SetLayoutCache=2272(int mode,)
 
-# Retrieve the degree of caching of layout information
+# Retrieve the degree of caching of layout information.
 get int GetLayoutCache=2273(,)
 
+# Sets the document width assumed for scrolling.
+set void SetScrollWidth=2274(int pixelWidth,)
+
+# Retrieve the document width assumed for scrolling.
+get int GetScrollWidth=2275(,)
+
+# Measure the pixel width of some text in a particular style.
+# Nul terminated text argument.
+# Does not handle tab or control characters.
+fun int TextWidth=2276(int style, string text)
+
+# Sets the scroll range so that maximum scroll position has
+# the last line at the bottom of the view (default).
+# Setting this to false allows scrolling one page below the last line.
+set void SetEndAtLastLine=2277(bool endAtLastLine,)
+
+# Retrieve whether the maximum scroll position has the last
+# line at the bottom of the view.
+get int GetEndAtLastLine=2278(,)
+
+# Retrieve the height of a particular line of text in pixels.
+fun int TextHeight=2279(int line,)
+
 ## Start of key messages
 # Move caret down one line.
 fun void LineDown=2300(,)
@@ -1014,8 +1062,7 @@ fun void Cancel=2325(,)
 # Delete the selection or if no selection, the character before the caret.
 fun void DeleteBack=2326(,)
 
-# If selection is empty or all on one line replace the selection with a tab
-# character.
+# If selection is empty or all on one line replace the selection with a tab character.
 # If more than one line selected, indent the lines.
 fun void Tab=2327(,)
 
@@ -1069,17 +1116,17 @@ fun void LineScrollDown=2342(,)
 fun void LineScrollUp=2343(,)
 
 # Delete the selection or if no selection, the character before the caret.
-# Will not delete the chraacter before at the start of a line.
+# Will not delete the character before at the start of a line.
 fun void DeleteBackNotLine=2344(,)
 
-# Move the caret inside current view if it's not there already
+# 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.
+# How many characters are on a line, not including end of line characters?
 fun int LineLength=2350(int line,)
 
 # Highlight the characters at two positions.
-fun void BraceHighlight=2351(position pos1,position pos2)
+fun void BraceHighlight=2351(position pos1, position pos2)
 
 # Highlight the character at a position indicating there is no matching brace.
 fun void BraceBadLight=2352(position pos,)
@@ -1087,10 +1134,10 @@ fun void BraceBadLight=2352(position pos,)
 # Find the position of a matching brace or INVALID_POSITION if no match.
 fun position BraceMatch=2353(position pos,)
 
-# Are the end of line characters visible.
+# Are the end of line characters visible?
 get bool GetViewEOL=2355(,)
 
-# Make the end of line characters visible or invisible
+# Make the end of line characters visible or invisible.
 set void SetViewEOL=2356(bool visible,)
 
 # Retrieve a pointer to the document object.
@@ -1102,6 +1149,7 @@ set void SetDocPointer=2358(,int pointer)
 # Set which document modification events are sent to the container.
 set void SetModEventMask=2359(int mask,)
 
+enu EdgeVisualStyle=EDGE_
 val EDGE_NONE=0
 val EDGE_LINE=1
 val EDGE_BACKGROUND=2
@@ -1137,24 +1185,6 @@ fun int SearchNext=2367(int flags, string text)
 # 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
-# Value not used
-val CARET_CENTER=0x02
-# 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)
-
 # Retrieves the number of lines completely visible.
 get int LinesOnScreen=2370(,)
 
@@ -1162,7 +1192,7 @@ get int LinesOnScreen=2370(,)
 # the wrong mouse button.
 fun void UsePopUp=2371(bool allowPopUp,)
 
-# Is the selection a rectangular. The alternative is the more common stream selection.
+# Is the selection rectangular? The alternative is the more common stream selection.
 get bool SelectionIsRectangle=2372(,)
 
 # Set the zoom level. This number of points is added to the size of all fonts.
@@ -1182,63 +1212,99 @@ fun void ReleaseDocument=2377(, int doc)
 # Get which document modification events are sent to the container.
 get int GetModEventMask=2378(,)
 
-# Change internal focus flag
+# Change internal focus flag.
 set void SetFocus=2380(bool focus,)
-# Get internal focus flag
+# Get internal focus flag.
 get bool GetFocus=2381(,)
 
-# Change error status - 0 = OK
+# Change error status - 0 = OK.
 set void SetStatus=2382(int statusCode,)
-# Get error status
+# Get error status.
 get int GetStatus=2383(,)
 
-# Set whether the mouse is captured when its button is pressed
+# Set whether the mouse is captured when its button is pressed.
 set void SetMouseDownCaptures=2384(bool captures,)
-# Get whether mouse gets captured
+# Get whether mouse gets captured.
 get bool GetMouseDownCaptures=2385(,)
 
+enu CursorShape=SC_CURSOR
 val SC_CURSORNORMAL=-1
 val SC_CURSORWAIT=3
-# Sets the cursor to one of the SC_CURSOR* values
+# Sets the cursor to one of the SC_CURSOR* values.
 set void SetCursor=2386(int cursorType,)
-# Get cursor type
+# Get cursor type.
 get int GetCursor=2387(,)
 
 # Change the way control characters are displayed:
-# If symbol is < 32, keep the drawn way, else, use the given character
+# If symbol is < 32, keep the drawn way, else, use the given character.
 set void SetControlCharSymbol=2388(int symbol,)
-# Get the way control characters are displayed
+# Get the way control characters are displayed.
 get int GetControlCharSymbol=2389(,)
 
-# Move to the previous change in capitalistion
+# Move to the previous change in capitalisation.
 fun void WordPartLeft=2390(,)
-# Move to the previous change in capitalistion extending selection to new caret position.
+# Move to the previous change in capitalisation extending selection
+# to new caret position.
 fun void WordPartLeftExtend=2391(,)
-# Move to the change next in capitalistion
+# Move to the change next in capitalisation.
 fun void WordPartRight=2392(,)
-# Move to the next change in capitalistion extending selection to new caret position.
+# Move to the next change in capitalisation extending selection
+# to new caret position.
 fun void WordPartRightExtend=2393(,)
 
-# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
+# 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.
+# Set the way the display area is determined when a particular line
+# is to be moved to by Find, FindNext, GotoLine, etc.
 fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop)
 
-# Delete back from the current position to the start of the line
+# 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
+# Delete forwards from the current position to the end of the line.
 fun void DelLineRight=2396(,)
 
-# Get and Set the xOffset (ie, horizonal scroll position)
+# Get and Set the xOffset (ie, horizonal scroll position).
 set void SetXOffset=2397(int newOffset,)
 get int GetXOffset=2398(,)
 
 # Set the focus to this Scintilla widget.
-# GTK+ Specific
+# GTK+ Specific.
 fun void GrabFocus=2400(,)
 
+enu CaretPolicy = CARET_
+# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+# If CARET_SLOP is set, we can define a slop value: caretSlop.
+# This value defines an unwanted zone (UZ) where the caret is... unwanted.
+# This zone is defined as a number of pixels near the vertical margins,
+# and as a number of lines near the horizontal margins.
+# By keeping the caret away from the edges, it is seen within its context,
+# so it is likely that the identifier that the caret is on can be completely seen,
+# and that the current line is seen with some of the lines following it which are
+# often dependent on that line.
+val CARET_SLOP=0x01
+# If CARET_STRICT is set, the policy is enforced... strictly.
+# The caret is centred on the display if slop is not set,
+# and cannot go in the UZ if slop is set.
+val CARET_STRICT=0x04
+# If CARET_JUMPS is set, the display is moved more energetically
+# so the caret can move in the same direction longer before the policy is applied again.
+val CARET_JUMPS=0x10
+# If CARET_EVEN is not set, instead of having symmetrical UZs,
+# the left and bottom UZs are extended up to right and top UZs respectively.
+# This way, we favour the displaying of useful information: the begining of lines,
+# where most code reside, and the lines after the caret, eg. the body of a function.
+val CARET_EVEN=0x08
+
+# Set the way the caret is kept visible when going sideway.
+# The exclusion zone is given in pixels.
+fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop)
+
+# Set the way the line the caret is on is kept visible.
+# The exclusion zone is given in lines.
+fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop)
+
 # Start notifying the container of all key presses and commands.
 fun void StartRecord=3001(,)
 
@@ -1264,9 +1330,10 @@ set void SetKeyWords=4005(int keywordSet, string keyWords)
 set void SetLexerLanguage=4006(, string language)
 
 # Notifications
-# Type of modification and the action which caused the modification
+# 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_*.
+enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_LAST
 val SC_MOD_INSERTTEXT=0x1
 val SC_MOD_DELETETEXT=0x2
 val SC_MOD_CHANGESTYLE=0x4
@@ -1281,15 +1348,18 @@ val SC_MOD_BEFOREDELETE=0x800
 val SC_MODEVENTMASKALL=0xF77
 
 # For compatibility, these go through the COMMAND notification rather than NOTIFY
-# and have exactly the same values as the EN_* constants.
+# and should have had exactly the same values as the EN_* constants.
+# Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_*
+# As clients depend on these constants, this will not be changed.
 val SCEN_CHANGE=768
 val SCEN_SETFOCUS=512
 val SCEN_KILLFOCUS=256
 
-# Symbolic key codes and modifier flags
-# ASCII and other printable characters below 256
-# Extended keys above 300
+# Symbolic key codes and modifier flags.
+# ASCII and other printable characters below 256.
+# Extended keys above 300.
 
+enu Keys=SCK_
 val SCK_DOWN=300
 val SCK_UP=301
 val SCK_LEFT=302
@@ -1308,12 +1378,14 @@ val SCK_ADD=310
 val SCK_SUBTRACT=311
 val SCK_DIVIDE=312
 
+enu KeyMod=SCMOD_
 val SCMOD_SHIFT=1
 val SCMOD_CTRL=2
 val SCMOD_ALT=4
 
 ################################################
 # For SciLexer.h
+enu Lexer=SCLEX_
 val SCLEX_CONTAINER=0
 val SCLEX_NULL=1
 val SCLEX_PYTHON=2
@@ -1347,11 +1419,14 @@ val SCLEX_ASP=29
 val SCLEX_PHP=30
 val SCLEX_BAAN=31
 val SCLEX_MATLAB=32
+val SCLEX_SCRIPTOL=33
 
 # 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
+lex Python=SCLEX_PYTHON SCE_P_
+lex Ruby=SCLEX_RUBY SCE_P_
 val SCE_P_DEFAULT=0
 val SCE_P_COMMENTLINE=1
 val SCE_P_NUMBER=2
@@ -1367,6 +1442,11 @@ val SCE_P_IDENTIFIER=11
 val SCE_P_COMMENTBLOCK=12
 val SCE_P_STRINGEOL=13
 # Lexical states for SCLEX_CPP
+lex Cpp=SCLEX_CPP SCE_C_
+lex SQL=SCLEX_SQL SCE_C_
+lex Pascal=SCLEX_PASCAL SCE_C_
+lex TCL=SCLEX_TCL SCE_C_
+lex BullAnt=SCLEX_BULLANT SCE_C_
 val SCE_C_DEFAULT=0
 val SCE_C_COMMENT=1
 val SCE_C_COMMENTLINE=2
@@ -1386,17 +1466,11 @@ val SCE_C_COMMENTLINEDOC=15
 val SCE_C_WORD2=16
 val SCE_C_COMMENTDOCKEYWORD=17
 val SCE_C_COMMENTDOCKEYWORDERROR=18
-# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
-val SCE_B_DEFAULT=0
-val SCE_B_COMMENT=1
-val SCE_B_NUMBER=2
-val SCE_B_KEYWORD=3
-val SCE_B_STRING=4
-val SCE_B_PREPROCESSOR=5
-val SCE_B_OPERATOR=6
-val SCE_B_IDENTIFIER=7
-val SCE_B_DATE=8
 # Lexical states for SCLEX_HTML, SCLEX_XML
+lex HTML=SCLEX_HTML SCE_H
+lex XML=SCLEX_XML SCE_H
+lex ASP=SCLEX_ASP SCE_H
+lex PHP=SCLEX_PHP SCE_H
 val SCE_H_DEFAULT=0
 val SCE_H_TAG=1
 val SCE_H_TAGUNKNOWN=2
@@ -1519,6 +1593,7 @@ val SCE_HPHP_COMMENTLINE=125
 val SCE_HPHP_HSTRING_VARIABLE=126
 val SCE_HPHP_OPERATOR=127
 # Lexical states for SCLEX_PERL
+lex Perl=SCLEX_PERL SCE_PL_
 val SCE_PL_DEFAULT=0
 val SCE_PL_ERROR=1
 val SCE_PL_COMMENTLINE=2
@@ -1549,13 +1624,34 @@ 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_VB, SCLEX_VBSCRIPT
+lex VB=SCLEX_VB SCE_B_
+lex VBScript=SCLEX_VBSCRIPT SCE_B_
+val SCE_B_DEFAULT=0
+val SCE_B_COMMENT=1
+val SCE_B_NUMBER=2
+val SCE_B_KEYWORD=3
+val SCE_B_STRING=4
+val SCE_B_PREPROCESSOR=5
+val SCE_B_OPERATOR=6
+val SCE_B_IDENTIFIER=7
+val SCE_B_DATE=8
+# Lexical states for SCLEX_PROPERTIES
+lex Properties=SCLEX_PROPERTIES SCE_PROPS_
+val SCE_PROPS_DEFAULT=0
+val SCE_PROPS_COMMENT=1
+val SCE_PROPS_SECTION=2
+val SCE_PROPS_ASSIGNMENT=3
+val SCE_PROPS_DEFVAL=4
 # Lexical states for SCLEX_LATEX
+lex LaTeX=SCLEX_LATEX SCE_L_
 val SCE_L_DEFAULT=0
 val SCE_L_COMMAND=1
 val SCE_L_TAG=2
 val SCE_L_MATH=3
 val SCE_L_COMMENT=4
 # Lexical states for SCLEX_LUA
+lex Lua=SCLEX_LUA SCE_LUA_
 val SCE_LUA_DEFAULT=0
 val SCE_LUA_COMMENT=1
 val SCE_LUA_COMMENTLINE=2
@@ -1575,6 +1671,7 @@ val SCE_LUA_WORD4=15
 val SCE_LUA_WORD5=16
 val SCE_LUA_WORD6=17
 # Lexical states for SCLEX_ERRORLIST
+lex ErrorList=SCLEX_ERRORLIST SCE_ERR_
 val SCE_ERR_DEFAULT=0
 val SCE_ERR_PYTHON=1
 val SCE_ERR_GCC=2
@@ -1584,11 +1681,13 @@ val SCE_ERR_BORLAND=5
 val SCE_ERR_PERL=6
 val SCE_ERR_NET=7
 val SCE_ERR_LUA=8
+val SCE_ERR_CTAG=9
 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
+lex Batch=SCLEX_BATCH SCE_BAT_
 val SCE_BAT_DEFAULT=0
 val SCE_BAT_COMMENT=1
 val SCE_BAT_WORD=2
@@ -1598,6 +1697,7 @@ val SCE_BAT_COMMAND=5
 val SCE_BAT_IDENTIFIER=6
 val SCE_BAT_OPERATOR=7
 # Lexical states for SCLEX_MAKEFILE
+lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_
 val SCE_MAKE_DEFAULT=0
 val SCE_MAKE_COMMENT=1
 val SCE_MAKE_PREPROCESSOR=2
@@ -1605,7 +1705,17 @@ 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)
+# Lexical states for SCLEX_DIFF
+lex Diff=SCLEX_DIFF SCE_DIFF_
+val SCE_DIFF_DEFAULT=0
+val SCE_DIFF_COMMENT=1
+val SCE_DIFF_COMMAND=2
+val SCE_DIFF_HEADER=3
+val SCE_DIFF_POSITION=4
+val SCE_DIFF_DELETED=5
+val SCE_DIFF_ADDED=6
+# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
+lex Conf=SCLEX_CONF SCE_CONF_
 val SCE_CONF_DEFAULT=0
 val SCE_CONF_COMMENT=1
 val SCE_CONF_NUMBER=2
@@ -1616,7 +1726,8 @@ val SCE_CONF_STRING=6
 val SCE_CONF_OPERATOR=7
 val SCE_CONF_IP=8
 val SCE_CONF_DIRECTIVE=9
-# Avenue
+# Lexical states for SCLEX_AVE, Avenue
+lex Avenue=SCLEX_AVE SCE_AVE_
 val SCE_AVE_DEFAULT=0
 val SCE_AVE_COMMENT=1
 val SCE_AVE_NUMBER=2
@@ -1629,6 +1740,7 @@ val SCE_AVE_STRINGEOL=8
 val SCE_AVE_IDENTIFIER=9
 val SCE_AVE_OPERATOR=10
 # Lexical states for SCLEX_ADA
+lex Ada=SCLEX_ADA SCE_ADA_
 val SCE_ADA_DEFAULT=0
 val SCE_ADA_COMMENT=1
 val SCE_ADA_NUMBER=2
@@ -1639,6 +1751,7 @@ val SCE_ADA_OPERATOR=6
 val SCE_ADA_IDENTIFIER=7
 val SCE_ADA_STRINGEOL=8
 # Lexical states for SCLEX_BAAN
+lex Baan=SCLEX_BAAN SCE_BAAN_
 val SCE_BAAN_DEFAULT=0
 val SCE_BAAN_COMMENT=1
 val SCE_BAAN_COMMENTDOC=2
@@ -1651,6 +1764,7 @@ val SCE_BAAN_IDENTIFIER=8
 val SCE_BAAN_STRINGEOL=9
 val SCE_BAAN_WORD2=10
 # Lexical states for SCLEX_LISP
+lex Lisp=SCLEX_LISP SCE_LISP_
 val SCE_LISP_DEFAULT=0
 val SCE_LISP_COMMENT=1
 val SCE_LISP_NUMBER=2
@@ -1660,6 +1774,8 @@ val SCE_LISP_STRINGEOL=8
 val SCE_LISP_IDENTIFIER=9
 val SCE_LISP_OPERATOR=10
 # Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_
+lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_
 val SCE_EIFFEL_DEFAULT=0
 val SCE_EIFFEL_COMMENTLINE=1
 val SCE_EIFFEL_NUMBER=2
@@ -1669,7 +1785,8 @@ val SCE_EIFFEL_CHARACTER=5
 val SCE_EIFFEL_OPERATOR=6
 val SCE_EIFFEL_IDENTIFIER=7
 val SCE_EIFFEL_STRINGEOL=8
-# Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
+# Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
+lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_
 val SCE_NNCRONTAB_DEFAULT=0
 val SCE_NNCRONTAB_COMMENT=1
 val SCE_NNCRONTAB_TASK=2
@@ -1682,6 +1799,7 @@ val SCE_NNCRONTAB_STRING=8
 val SCE_NNCRONTAB_ENVIRONMENT=9
 val SCE_NNCRONTAB_IDENTIFIER=10
 # Lexical states for SCLEX_MATLAB
+lex MatLab=SCLEX_MATLAB SCE_MATLAB_
 val SCE_MATLAB_DEFAULT=0
 val SCE_MATLAB_COMMENT=1
 val SCE_MATLAB_COMMAND=2
@@ -1690,6 +1808,28 @@ val SCE_MATLAB_KEYWORD=4
 val SCE_MATLAB_STRING=5
 val SCE_MATLAB_OPERATOR=6
 val SCE_MATLAB_IDENTIFIER=7
+# Lexical states for SCLEX_SCRIPTOL
+lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_
+val SCE_SCRIPTOL_DEFAULT=0
+val SCE_SCRIPTOL_COMMENT=1
+val SCE_SCRIPTOL_COMMENTLINE=2
+val SCE_SCRIPTOL_COMMENTDOC=3
+val SCE_SCRIPTOL_NUMBER=4
+val SCE_SCRIPTOL_WORD=5
+val SCE_SCRIPTOL_STRING=6
+val SCE_SCRIPTOL_CHARACTER=7
+val SCE_SCRIPTOL_UUID=8
+val SCE_SCRIPTOL_PREPROCESSOR=9
+val SCE_SCRIPTOL_OPERATOR=10
+val SCE_SCRIPTOL_IDENTIFIER=11
+val SCE_SCRIPTOL_STRINGEOL=12
+val SCE_SCRIPTOL_VERBATIM=13
+val SCE_SCRIPTOL_REGEX=14
+val SCE_SCRIPTOL_COMMENTLINEDOC=15
+val SCE_SCRIPTOL_WORD2=16
+val SCE_SCRIPTOL_COMMENTDOCKEYWORD=17
+val SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR=18
+val SCE_SCRIPTOL_COMMENTBASIC=19
 
 # Events
 
@@ -1711,9 +1851,17 @@ 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)
+evt void Zoom=2018(void)
 
 cat Deprecated
 
+# CARET_POLICY changed in 1.47
+fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
+val CARET_CENTER=0x02
+val CARET_XEVEN=0x08
+val CARET_XJUMPS=0x10
+
 # The old name for SCN_UPDATEUI
 val SCN_CHECKBRACE=2007
 evt void PosChanged=2012(int position)
+
index 6e22f58f8b6b3b19427950d43a7bd2a2cf036582..203f35733923a00babbf6d846cb1c1e5b4a67b63 100644 (file)
@@ -28,7 +28,7 @@ struct _ScintillaObject {
 };
 
 struct _ScintillaClass {
-       GtkFixedClass parent_class;
+       GtkContainerClass parent_class;
 
        void (* command) (ScintillaObject *ttt);
        void (* notify) (ScintillaObject *ttt);
@@ -39,6 +39,12 @@ GtkWidget*   scintilla_new           (void);
 void           scintilla_set_id        (ScintillaObject *sci,int id);
 sptr_t scintilla_send_message  (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
+#if GTK_MAJOR_VERSION < 2
+#define SCINTILLA_NOTIFY "notify"
+#else
+#define SCINTILLA_NOTIFY "sci-notify"
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index 7fd8e30fd7db980e0adeca21d8c49b53b3ec07e1..6c16b150f267751c1cc38f2e2213b9d934a64da8 100644 (file)
@@ -31,6 +31,7 @@ public:
                lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
        }
        ~WindowAccessor();
+       bool Match(int pos, const char *s);
        char StyleAt(int position);
        int GetLine(int position);
        int LineStart(int line);
index 48aaee38ae75cbb7d598f24184a076db443aec76..d971fa12a09da6b943ee2ac0735a9a0a43427a55 100644 (file)
@@ -118,7 +118,7 @@ void AutoComplete::Move(int delta) {
 }
 
 void AutoComplete::Select(const char *word) {
-       int lenWord = strlen(word);
+       size_t lenWord = strlen(word);
        int location = -1;
        const int maxItemLen=1000;
        char item[maxItemLen];
index 4b4ae0c7ce17f197c125dc5154421836e67e1ba0..d67173b084a5c52ed3116d26c0a7e4585b8c1d25 100644 (file)
@@ -148,7 +148,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
                look = newline + 1;
                numLines++;
        }
-       int lastWidth = surfaceMeasure->WidthText(font, look, strlen(look));
+       int lastWidth = surfaceMeasure->WidthText(font, look, static_cast<int>(strlen(look)));
        width = Platform::Maximum(width, lastWidth) + 10;
        int lineHeight = surfaceMeasure->Height(font);
        // Extra line for border and an empty line at top and bottom
index ecb5bc1801554749e8146743a134125639ffea2a..b67da81c937132af33d8b1fdb1dc0679b63a6b05 100644 (file)
@@ -958,10 +958,13 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
                                        //Platform::DebugPrintf("Removing cr end of line\n");
                                        lv.Remove(lineRemove);
                                }
-                       } else if ((ch == '\n') && !ignoreNL) {
-                               //Platform::DebugPrintf("Removing lf end of line\n");
-                               lv.Remove(lineRemove);
-                               ignoreNL = false;       // Further \n are not real deletions
+                       } else if (ch == '\n') {
+                               if (ignoreNL) {
+                                       ignoreNL = false;       // Further \n are real deletions
+                               } else {
+                                       //Platform::DebugPrintf("Removing lf end of line\n");
+                                       lv.Remove(lineRemove);
+                               }
                        }
 
                        ch = chNext;
index 3d3e5a51dd90ff0947026e149b3395d34a589e8a..7458120442ab5afc9c0814dedd02ecd376d2efe4 100644 (file)
@@ -344,17 +344,19 @@ void Document::ModifiedAt(int pos) {
 // SetStyleAt does not change the persistent state of a document
 
 // Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
-void Document::DeleteChars(int pos, int len) {
+bool Document::DeleteChars(int pos, int len) {
        if (len == 0)
-               return;
+               return false;
        if ((pos + len) > Length())
-               return;
+               return false;
        if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
                enteredReadOnlyCount++;
                NotifyModifyAttempt();
                enteredReadOnlyCount--;
        }
-       if (enteredCount == 0) {
+       if (enteredCount != 0) {
+               return false;
+       } else {
                enteredCount++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
@@ -379,15 +381,18 @@ void Document::DeleteChars(int pos, int len) {
                }
                enteredCount--;
        }
+       return !cb.IsReadOnly();
 }
 
-void Document::InsertStyledString(int position, char *s, int insertLength) {
+bool Document::InsertStyledString(int position, char *s, int insertLength) {
        if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
                enteredReadOnlyCount++;
                NotifyModifyAttempt();
                enteredReadOnlyCount--;
        }
-       if (enteredCount == 0) {
+       if (enteredCount != 0) {
+               return false;
+       } else {
                enteredCount++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
@@ -409,6 +414,7 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
                }
                enteredCount--;
        }
+       return !cb.IsReadOnly();
 }
 
 int Document::Undo() {
@@ -497,29 +503,32 @@ int Document::Redo() {
        return newPos;
 }
 
-void Document::InsertChar(int pos, char ch) {
+bool Document::InsertChar(int pos, char ch) {
        char chs[2];
        chs[0] = ch;
        chs[1] = 0;
-       InsertStyledString(pos*2, chs, 2);
+       return InsertStyledString(pos*2, chs, 2);
 }
 
 // Insert a null terminated string
-void Document::InsertString(int position, const char *s) {
-       InsertString(position, s, strlen(s));
+bool Document::InsertString(int position, const char *s) {
+       return InsertString(position, s, strlen(s));
 }
 
 // Insert a string with a length
-void Document::InsertString(int position, const char *s, int insertLength) {
+bool Document::InsertString(int position, const char *s, size_t insertLength) {
+       bool changed = false;
        char *sWithStyle = new char[insertLength * 2];
        if (sWithStyle) {
-               for (int i = 0; i < insertLength; i++) {
+               for (size_t i = 0; i < insertLength; i++) {
                        sWithStyle[i*2] = s[i];
                        sWithStyle[i*2 + 1] = 0;
                }
-               InsertStyledString(position*2, sWithStyle, insertLength*2);
+               changed = InsertStyledString(position*2, sWithStyle, 
+                       static_cast<int>(insertLength*2));
                delete []sWithStyle;
        }
+       return changed;
 }
 
 void Document::ChangeChar(int pos, char ch) {
@@ -531,22 +540,18 @@ void Document::DelChar(int pos) {
        DeleteChars(pos, LenChar(pos));
 }
 
-int Document::DelCharBack(int pos) {
+void Document::DelCharBack(int pos) {
        if (pos <= 0) {
-               return pos;
+               return;
        } else if (IsCrLf(pos - 2)) {
                DeleteChars(pos - 2, 2);
-               return pos - 2;
        } else if (SC_CP_UTF8 == dbcsCodePage) {
                int startChar = MovePositionOutsideChar(pos - 1, -1, false);
                DeleteChars(startChar, pos - startChar);
-               return startChar;
        } else if (IsDBCS(pos - 1)) {
                DeleteChars(pos - 2, 2);
-               return pos - 2;
        } else {
                DeleteChars(pos - 1, 1);
-               return pos - 1;
        }
 }
 
@@ -822,8 +827,9 @@ class DocumentIndexer : public CharacterIndexer {
        Document *pdoc;
        int end;
 public:
-DocumentIndexer(Document *pdoc_, int end_) :
-       pdoc(pdoc_), end(end_) {}
+       DocumentIndexer(Document *pdoc_, int end_) :
+               pdoc(pdoc_), end(end_) {
+       }
 
        virtual char CharAt(int index) {
                if (index < 0 || index >= end)
@@ -928,7 +934,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
                // Compute actual search ranges needed
                int lengthFind = *length;
                if (lengthFind == -1)
-                       lengthFind = strlen(s);
+                       lengthFind = static_cast<int>(strlen(s));
                int endSearch = endPos;
                if (startPos <= endPos) {
                        endSearch = endPos - lengthFind + 1;
@@ -1081,8 +1087,10 @@ void Document::StartStyling(int position, char mask) {
        endStyled = position;
 }
 
-void Document::SetStyleFor(int length, char style) {
-       if (enteredCount == 0) {
+bool Document::SetStyleFor(int length, char style) {
+       if (enteredCount != 0) {
+               return false;
+       } else {
                enteredCount++;
                int prevEndStyled = endStyled;
                if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
@@ -1092,26 +1100,32 @@ void Document::SetStyleFor(int length, char style) {
                }
                endStyled += length;
                enteredCount--;
+               return true;
        }
 }
 
-void Document::SetStyles(int length, char *styles) {
-       if (enteredCount == 0) {
+bool Document::SetStyles(int length, char *styles) {
+       if (enteredCount != 0) {
+               return false;
+       } else {
                enteredCount++;
                int prevEndStyled = endStyled;
                bool didChange = false;
+               int lastChange = 0;
                for (int iPos = 0; iPos < length; iPos++, endStyled++) {
                        PLATFORM_ASSERT(endStyled < Length());
                        if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
                                didChange = true;
+                               lastChange = iPos;
                        }
                }
                if (didChange) {
                        DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
-                                          prevEndStyled, endStyled - prevEndStyled);
+                                          prevEndStyled, lastChange);
                        NotifyModified(mh);
                }
                enteredCount--;
+               return true;
        }
 }
 
@@ -1121,10 +1135,11 @@ bool Document::EnsureStyledTo(int pos) {
                if (styleClock > 0x100000) {
                        styleClock = 0;
                }
+               // Ask the watchers to style, and stop as soon as one responds.
+               for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) {
+                       watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
+               }
        }
-       // Ask the watchers to style, and stop as soon as one responds.
-       for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++)
-               watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
        return pos <= GetEndStyled();
 }
 
index 941ad79ccfde2c02e9d2650c6885831316426018..82931207cfcbe8cb7662f9ea07cb1e72a079936e 100644 (file)
@@ -132,8 +132,8 @@ public:
        int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
 
        // Gateways to modifying document
-       void DeleteChars(int pos, int len);
-       void InsertStyledString(int position, char *s, int insertLength);
+       bool DeleteChars(int pos, int len);
+       bool InsertStyledString(int position, char *s, int insertLength);
        int Undo();
        int Redo();
        bool CanUndo() { return cb.CanUndo(); }
@@ -158,12 +158,12 @@ public:
        void SetReadOnly(bool set) { cb.SetReadOnly(set); }
        bool IsReadOnly() { return cb.IsReadOnly(); }
 
-       void InsertChar(int pos, char ch);
-       void InsertString(int position, const char *s);
-       void InsertString(int position, const char *s, int insertLength);
+       bool InsertChar(int pos, char ch);
+       bool InsertString(int position, const char *s);
+       bool InsertString(int position, const char *s, size_t insertLength);
        void ChangeChar(int pos, char ch);
        void DelChar(int pos);
-       int DelCharBack(int pos);
+       void DelCharBack(int pos);
 
        char CharAt(int position) { return cb.CharAt(position); }
        void GetCharRange(char *buffer, int position, int lengthRetrieve) {
@@ -202,8 +202,8 @@ public:
        void SetWordChars(unsigned char *chars);
        void SetStylingBits(int bits);
        void StartStyling(int position, char mask);
-       void SetStyleFor(int length, char style);
-       void SetStyles(int length, char *styles);
+       bool SetStyleFor(int length, char style);
+       bool SetStyles(int length, char *styles);
        int GetEndStyled() { return endStyled; }
        bool EnsureStyledTo(int pos);
        int GetStyleClock() { return styleClock; }
index f115f193045d89f16f2d478bf73b22fefc11a796..595edf8ba21a276b98a7bd4d8276c8e5b53c730d 100644 (file)
@@ -48,6 +48,15 @@ void DocumentAccessor::Fill(int position) {
        buf[endPos-startPos] = '\0';
 }
 
+bool DocumentAccessor::Match(int pos, const char *s) {
+       for (int i=0; *s; i++) {
+               if (*s != SafeGetCharAt(pos+i))
+                       return false;
+               s++;
+       }
+       return true;
+}
+
 char DocumentAccessor::StyleAt(int position) {
        return pdoc->StyleAt(position);
 }
index 5b68dd15c5168856423b8dee410eb1d9f0c87ac2..dc591d13ec3142c08216f5451b18e752db0fb6e1 100644 (file)
@@ -38,6 +38,7 @@ public:
                startSeg(0), startPosStyling(0) {
        }
        ~DocumentAccessor();
+       bool Match(int pos, const char *s);
        char StyleAt(int position);
        int GetLine(int position);
        int LineStart(int line);
index 554751123dad967167a4490137aafc4f9e91adfd..faba66ef55bac5231ad94c1c501a40ecdffcec0e 100644 (file)
@@ -65,7 +65,9 @@ void LineLayout::Resize(int maxLineLength_) {
                chars = new char[maxLineLength_ + 1];
                styles = new char[maxLineLength_ + 1];
                indicators = new char[maxLineLength_ + 1];
-               positions = new int[maxLineLength_ + 1];
+               // Extra position allocated as sometimes the Windows
+               // GetTextExtentExPoint API writes an extra element.
+               positions = new int[maxLineLength_ + 1 + 1];
                maxLineLength = maxLineLength_;
        }
 }
@@ -84,7 +86,8 @@ void LineLayout::Free() {
 }
 
 void LineLayout::Invalidate(validLevel validity_) {
-       validity = validity_;
+       if (validity > validity_)
+               validity = validity_;
 }
 
 void LineLayout::SetLineStart(int line, int start) {
@@ -179,14 +182,11 @@ void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
        }
        if (lengthForLevel > size) {
                Deallocate();
-       } else {
-               if (lengthForLevel < length) {
-                       for (int i=lengthForLevel; i<length; i++) {
-                               delete cache[i];
-                               cache[i] = 0;
-                       }
+       } else if (lengthForLevel < length) {
+               for (int i=lengthForLevel; i<length; i++) {
+                       delete cache[i];
+                       cache[i] = 0;
                }
-               Invalidate(LineLayout::llInvalid);
        }
        if (!cache) {
                Allocate(lengthForLevel);
@@ -226,7 +226,7 @@ LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChar
        int linesOnScreen, int linesInDoc) {
        AllocateForLevel(linesOnScreen, linesInDoc);
        if (styleClock != styleClock_) {
-               Invalidate(LineLayout::llInvalid);
+               Invalidate(LineLayout::llCheckTextAndStyle);
                styleClock = styleClock_;
        }
        allInvalidated = false;
@@ -315,17 +315,19 @@ Editor::Editor() {
        xEndSelect = 0;
        primarySelection = true;
 
-       caretPolicy = CARET_SLOP;
-       caretSlop = 0;
+       caretXPolicy = CARET_SLOP | CARET_EVEN;
+       caretXSlop = 50;
 
-       visiblePolicy = VISIBLE_SLOP;
-       visibleSlop = 0;
+       caretYPolicy = CARET_EVEN;
+       caretYSlop = 0;
 
        searchAnchor = 0;
 
        xOffset = 0;
        xCaretMargin = 50;
        horizontalScrollBarVisible = true;
+       scrollWidth = 2000;
+       endAtLastLine = true;
 
        pixmapLine = Surface::Allocate();
        pixmapSelMargin = Surface::Allocate();
@@ -451,11 +453,17 @@ int Editor::LinesToScroll() {
 int Editor::MaxScrollPos() {
        //Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n",
        //LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1);
-       int retVal = cs.LinesDisplayed() - LinesOnScreen();
-       if (retVal < 0)
+       int retVal = cs.LinesDisplayed();
+       if (endAtLastLine) {
+               retVal -= LinesOnScreen();
+       } else {
+               retVal--;
+       }
+       if (retVal < 0) {
                return 0;
-       else
+       } else {
                return retVal;
+       }
 }
 
 static inline bool IsControlCharacter(char ch) {
@@ -611,8 +619,10 @@ int Editor::PositionFromLocationClose(Point pt) {
        return INVALID_POSITION;
 }
 
-// Find the document position corresponding to an x coordinate on a particular document line.
-// Ensure is between whole characters when document is in multi-byte or UTF-8 mode.
+/**
+ * Find the document position corresponding to an x coordinate on a particular document line.
+ * Ensure is between whole characters when document is in multi-byte or UTF-8 mode.
+ */
 int Editor::PositionFromLineX(int lineDoc, int x) {
        RefreshStyleData();
        if (lineDoc >= pdoc->LinesTotal())
@@ -641,6 +651,15 @@ int Editor::PositionFromLineX(int lineDoc, int x) {
        return retVal;
 }
 
+// If painting then abandon the painting because a wider redraw is needed.
+// Return true if calling code should stop drawing
+bool Editor::AbandonPaint() {
+       if ((paintState == painting) && !paintingAllText) {
+               paintState = paintAbandoned;
+       }
+       return paintState == paintAbandoned;
+}
+
 void Editor::RedrawRect(PRectangle rc) {
        //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom);
 
@@ -666,12 +685,14 @@ void Editor::Redraw() {
 }
 
 void Editor::RedrawSelMargin() {
-       if (vs.maskInLine) {
-               Redraw();
-       } else {
-               PRectangle rcSelMargin = GetClientRectangle();
-               rcSelMargin.right = vs.fixedColumnWidth;
-               wMain.InvalidateRectangle(rcSelMargin);
+       if (!AbandonPaint()) {
+               if (vs.maskInLine) {
+                       Redraw();
+               } else {
+                       PRectangle rcSelMargin = GetClientRectangle();
+                       rcSelMargin.right = vs.fixedColumnWidth;
+                       wMain.InvalidateRectangle(rcSelMargin);
+               }
        }
 }
 
@@ -920,76 +941,260 @@ int Editor::DisplayFromPosition(int pos) {
        return lineDisplay;
 }
 
+/**
+ * Ensure the caret is reasonably visible in context.
+ *
+Caret policy in SciTE
+
+If slop is set, we can define a slop value.
+This value defines an unwanted zone (UZ) where the caret is... unwanted.
+This zone is defined as a number of pixels near the vertical margins,
+and as a number of lines near the horizontal margins.
+By keeping the caret away from the edges, it is seen within its context,
+so it is likely that the identifier that the caret is on can be completely seen,
+and that the current line is seen with some of the lines following it which are
+often dependent on that line.
+
+If strict is set, the policy is enforced... strictly.
+The caret is centred on the display if slop is not set,
+and cannot go in the UZ if slop is set.
+
+If jumps is set, the display is moved more energetically
+so the caret can move in the same direction longer before the policy is applied again.
+'3UZ' notation is used to indicate three time the size of the UZ as a distance to the margin.
+
+If even is not set, instead of having symmetrical UZs,
+the left and bottom UZs are extended up to right and top UZs respectively.
+This way, we favour the displaying of useful information: the begining of lines,
+where most code reside, and the lines after the caret, eg. the body of a function.
+
+     |        |       |      |                                            |
+slop | strict | jumps | even | Caret can go to the margin                 | When reaching limit (caret going out of
+     |        |       |      |                                            | visibility or going into the UZ) display is...
+-----+--------+-------+------+--------------------------------------------+--------------------------------------------------------------
+  0  |   0    |   0   |   0  | Yes                                        | moved to put caret on top/on right
+  0  |   0    |   0   |   1  | Yes                                        | moved by one position
+  0  |   0    |   1   |   0  | Yes                                        | moved to put caret on top/on right
+  0  |   0    |   1   |   1  | Yes                                        | centred on the caret
+  0  |   1    |   -   |   0  | Caret is always on top/on right of display | -
+  0  |   1    |   -   |   1  | No, caret is always centred                | -
+  1  |   0    |   0   |   0  | Yes                                        | moved to put caret out of the asymmetrical UZ
+  1  |   0    |   0   |   1  | Yes                                        | moved to put caret out of the UZ
+  1  |   0    |   1   |   0  | Yes                                        | moved to put caret at 3UZ of the top or right margin
+  1  |   0    |   1   |   1  | Yes                                        | moved to put caret at 3UZ of the margin
+  1  |   1    |   -   |   0  | Caret is always at UZ of top/right margin  | -
+  1  |   1    |   0   |   1  | No, kept out of UZ                         | moved by one position
+  1  |   1    |   1   |   1  | No, kept out of UZ                         | moved to put caret at 3UZ of the margin
+*/
 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)
+       if (posDrag >= 0) {
                posCaret = posDrag;
+       }
        Point pt = LocationFromPosition(posCaret);
-       Point ptEOL = LocationFromPosition(pdoc->LineEndPosition(posCaret));
        Point ptBottomCaret = pt;
-       int lineCaret = DisplayFromPosition(posCaret);
        ptBottomCaret.y += vs.lineHeight - 1;
-
-       // 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;
-
-       // 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;
-       }
+       int lineCaret = DisplayFromPosition(posCaret);
+       bool bSlop, bStrict, bJump, bEven;
 
        // 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);
+       if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) {
+               int linesOnScreen = LinesOnScreen();
+               int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2;
+               int newTopLine = topLine;
+               bSlop = (caretYPolicy & CARET_SLOP) != 0;
+               bStrict = (caretYPolicy & CARET_STRICT) != 0;
+               bJump = (caretYPolicy & CARET_JUMPS) != 0;
+               bEven = (caretYPolicy & CARET_EVEN) != 0;
+
                // 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) {
-                       if ((topLine > lineCaret) || ((caretPolicy & CARET_STRICT) && (topLine + caretSlop > lineCaret))) {
-                               SetTopLine(Platform::Clamp(lineCaret - caretSlop, 0, MaxScrollPos()));
-                               SetVerticalScrollPos();
-                               Redraw();
-                       } else if ((lineCaret > topLine + LinesOnScreen() - 1) ||
-                                  ((caretPolicy & CARET_STRICT) && (lineCaret > topLine + LinesOnScreen() - 1 - caretSlop))) {
-                               SetTopLine(Platform::Clamp(lineCaret - LinesOnScreen() + 1 + caretSlop, 0, MaxScrollPos()));
-                               SetVerticalScrollPos();
-                               Redraw();
+               if (bSlop) {    // A margin is defined
+                       int yMoveT, yMoveB;
+                       if (bStrict) {
+                               int yMarginT, yMarginB;
+                               if (!useMargin) {
+                                       // In drag mode, avoid moves
+                                       // otherwise, a double click will select several lines.
+                                       yMarginT = yMarginB = 0;
+                               } else {
+                                       // yMarginT must equal to caretYSlop, with a minimum of 1 and
+                                       // a maximum of slightly less than half the heigth of the text area.
+                                       yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen);
+                                       if (bEven) {
+                                               yMarginB = yMarginT;
+                                       } else {
+                                               yMarginB = linesOnScreen - yMarginT - 1;
+                                       }
+                               }
+                               yMoveT = yMarginT;
+                               if (bEven) {
+                                       if (bJump) {
+                                               yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen);
+                                       }
+                                       yMoveB = yMoveT;
+                               } else {
+                                       yMoveB = linesOnScreen - yMoveT - 1;
+                               }
+                               if (lineCaret < topLine + yMarginT) {
+                                       // Caret goes too high
+                                       newTopLine = lineCaret - yMoveT;
+                               } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) {
+                                       // Caret goes too low
+                                       newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+                               }
+                       } else {        // Not strict
+                               yMoveT = bJump ? caretYSlop * 3 : caretYSlop;
+                               yMoveT = Platform::Clamp(yMoveT, 1, halfScreen);
+                               if (bEven) {
+                                       yMoveB = yMoveT;
+                               } else {
+                                       yMoveB = linesOnScreen - yMoveT - 1;
+                               }
+                               if (lineCaret < topLine) {
+                                       // Caret goes too high
+                                       newTopLine = lineCaret - yMoveT;
+                               } else if (lineCaret > topLine + linesOnScreen - 1) {
+                                       // Caret goes too low
+                                       newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+                               }
                        }
-               } else {
-                       if ((topLine > lineCaret) || (lineCaret > topLine + LinesOnScreen() - 1) || (caretPolicy & CARET_STRICT)) {
-                               SetTopLine(Platform::Clamp(lineCaret - LinesOnScreen() / 2 + 1, 0, MaxScrollPos()));
-                               SetVerticalScrollPos();
-                               Redraw();
+               } else {        // No slop
+                       if (!bStrict && !bJump) {
+                               // Minimal move
+                               if (lineCaret < topLine) {
+                                       // Caret goes too high
+                                       newTopLine = lineCaret;
+                               } else if (lineCaret > topLine + linesOnScreen - 1) {
+                                       // Caret goes too low
+                                       if (bEven) {
+                                               newTopLine = lineCaret - linesOnScreen + 1;
+                                       } else {
+                                               newTopLine = lineCaret;
+                                       }
+                               }
+                       } else {        // Strict or going out of display
+                               if (bEven) {
+                                       // Always center caret
+                                       newTopLine = lineCaret - halfScreen;
+                               } else {
+                                       // Always put caret on top of display
+                                       newTopLine = lineCaret;
+                               }
                        }
                }
+               newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos());
+               if (newTopLine != topLine) {
+                       SetTopLine(newTopLine);
+                       SetVerticalScrollPos();
+                       Redraw();
+               }
        }
 
        // Horizontal positioning
        if (horiz && (wrapState == eWrapNone)) {
+               int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2;
                int xOffsetNew = xOffset;
-               if (pt.x < rcClient.left) {
-                       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)
-                               xOffsetNew = xOffsetEOL;
-               }
-               if (xOffsetNew < 0)
+               bSlop = (caretXPolicy & CARET_SLOP) != 0;
+               bStrict = (caretXPolicy & CARET_STRICT) != 0;
+               bJump = (caretXPolicy & CARET_JUMPS) != 0;
+               bEven = (caretXPolicy & CARET_EVEN) != 0;
+
+               if (bSlop) {    // A margin is defined
+                       int xMoveL, xMoveR;
+                       if (bStrict) {
+                               int xMarginL, xMarginR;
+                               if (!useMargin) {
+                                       // In drag mode, avoid moves unless very near of the margin
+                                       // otherwise, a simple click will select text.
+                                       xMarginL = xMarginR = 2;
+                               } else {
+                                       // xMargin must equal to caretXSlop, with a minimum of 2 and
+                                       // a maximum of slightly less than half the width of the text area.
+                                       xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen);
+                                       if (bEven) {
+                                               xMarginL = xMarginR;
+                                       } else {
+                                               xMarginL = rcClient.Width() - xMarginR - 4;
+                                       }
+                               }
+                               if (bJump && bEven) {
+                                       // Jump is used only in even mode
+                                       xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen);
+                               } else {
+                                       xMoveL = xMoveR = 0;    // Not used, avoid a warning
+                               }
+                               if (pt.x < rcClient.left + xMarginL) {
+                                       // Caret is on the left of the display
+                                       if (bJump && bEven) {
+                                               xOffsetNew -= xMoveL;
+                                       } else {
+                                               // Move just enough to allow to display the caret
+                                               xOffsetNew -= (rcClient.left + xMarginL) - pt.x;
+                                       }
+                               } else if (pt.x >= rcClient.right - xMarginR) {
+                                       // Caret is on the right of the display
+                                       if (bJump && bEven) {
+                                               xOffsetNew += xMoveR;
+                                       } else {
+                                               // Move just enough to allow to display the caret
+                                               xOffsetNew += pt.x - (rcClient.right - xMarginR) + 1;
+                                       }
+                               }
+                       } else {        // Not strict
+                               xMoveR = bJump ? caretXSlop * 3 : caretXSlop;
+                               xMoveR = Platform::Clamp(xMoveR, 1, halfScreen);
+                               if (bEven) {
+                                       xMoveL = xMoveR;
+                               } else {
+                                       xMoveL = rcClient.Width() - xMoveR - 4;
+                               }
+                               if (pt.x < rcClient.left) {
+                                       // Caret is on the left of the display
+                                       xOffsetNew -= xMoveL;
+                               } else if (pt.x >= rcClient.right) {
+                                       // Caret is on the right of the display
+                                       xOffsetNew += xMoveR;
+                               }
+                       }
+               } else {        // No slop
+                       if (bStrict ||
+                               (bJump && (pt.x < rcClient.left || pt.x >= rcClient.right))) {
+                               // Strict or going out of display
+                               if (bEven) {
+                                       // Center caret
+                                       xOffsetNew += pt.x - rcClient.left - halfScreen;
+                               } else {
+                                       // Put caret on right
+                                       xOffsetNew += pt.x - rcClient.right + 1;
+                               }
+                       } else {
+                               // Move just enough to allow to display the caret
+                               if (pt.x < rcClient.left) {
+                                       // Caret is on the left of the display
+                                       if (bEven) {
+                                               xOffsetNew -= rcClient.left - pt.x;
+                                       } else {
+                                               xOffsetNew += pt.x - rcClient.right + 1;
+                                       }
+                               } else if (pt.x >= rcClient.right) {
+                                       // Caret is on the right of the display
+                                       xOffsetNew += pt.x - rcClient.right + 1;
+                               }
+                       }
+               }
+               // In case of a jump (find result) largely out of display, adjust the offset to display the caret
+               if (pt.x + xOffset < rcClient.left + xOffsetNew) {
+                       xOffsetNew = pt.x + xOffset - rcClient.left;
+               } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) {
+                       xOffsetNew = pt.x + xOffset - rcClient.right + 1;
+               }
+               if (xOffsetNew < 0) {
                        xOffsetNew = 0;
+               }
                if (xOffset != xOffsetNew) {
                        xOffset = xOffsetNew;
                        SetHorizontalScrollPos();
@@ -1023,10 +1228,12 @@ void Editor::InvalidateCaret() {
 }
 
 void Editor::NeedWrapping(int docLineStartWrapping) {
-       docLineLastWrapped = docLineStartWrapping - 1;
-       if (docLineLastWrapped < -1)
-               docLineLastWrapped = -1;
-       llc.Invalidate(LineLayout::llPositions);
+       if (docLineLastWrapped > (docLineStartWrapping - 1)) {
+               docLineLastWrapped = docLineStartWrapping - 1;
+               if (docLineLastWrapped < -1)
+                       docLineLastWrapped = -1;
+               llc.Invalidate(LineLayout::llPositions);
+       }
 }
 
 // Check if wrapping needed and perform any needed wrapping.
@@ -1045,7 +1252,7 @@ bool Editor::WrapLines() {
                        }
                        docLineLastWrapped = 0x7ffffff;
                } else {
-                       ElapsedTime et;
+                       //ElapsedTime et;
                        int lineDocTop = cs.DocFromDisplay(topLine);
                        int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
                        PRectangle rcTextArea = GetClientRectangle();
@@ -1076,7 +1283,7 @@ bool Editor::WrapLines() {
                                goodTopLine += subLineTop;
                        else
                                goodTopLine += cs.GetHeight(lineDocTop);
-                       double durWrap = et.Duration(true);
+                       //double durWrap = et.Duration(true);
                        //Platform::DebugPrintf("Wrap:%9.6g \n", durWrap);
                }
        }
@@ -1320,6 +1527,55 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
        if (!ll)
                return;
        int posLineStart = pdoc->LineStart(line);
+       int posLineEnd = pdoc->LineStart(line + 1);
+       // If the line is very long, limit the treatment to a length that should fit in the viewport
+       if (posLineEnd > (posLineStart + ll->maxLineLength)) {
+               posLineEnd = posLineStart + ll->maxLineLength;
+       }
+       if (ll->validity == LineLayout::llCheckTextAndStyle) {
+               int lineLength = 0;
+               for (int cid = posLineStart; cid < posLineEnd; cid++) {
+                       char chDoc = pdoc->CharAt(cid);
+                       if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) {
+                               lineLength++;
+                       }
+               }
+               if (lineLength == ll->numCharsInLine) {
+                       int numCharsInLine = 0;
+                       // See if chars, styles, indicators, are all the same
+                       bool allSame = true;
+                       char styleByte;
+                       int styleMask = pdoc->stylingBitsMask;
+                       // Check base line layout
+                       for (int charInDoc = posLineStart; allSame && (charInDoc < posLineEnd); charInDoc++) {
+                               char chDoc = pdoc->CharAt(charInDoc);
+                               styleByte = pdoc->StyleAt(charInDoc);
+                               if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) {
+                                       allSame = allSame && 
+                                               (ll->styles[numCharsInLine] == static_cast<char>(styleByte & styleMask));
+                                       allSame = allSame && 
+                                               (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
+                                       if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper)
+                                               allSame = allSame && 
+                                                       (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
+                                       else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
+                                               allSame = allSame && 
+                                                       (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
+                                       else
+                                               allSame = allSame &&
+                                                       (ll->chars[numCharsInLine] == chDoc);
+                                       numCharsInLine++;
+                               }
+                       }
+                       if (allSame) {
+                               ll->validity = LineLayout::llPositions;
+                       } else {
+                               ll->validity = LineLayout::llInvalid;
+                       }
+               } else {
+                       ll->validity = LineLayout::llInvalid;
+               }
+       }
        if (ll->validity == LineLayout::llInvalid) {
                ll->widthLine = LineLayout::wrapWidthInfinite;
                ll->lines = 1;
@@ -1333,15 +1589,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                        ll->edgeColumn = -1;
                }
 
-               int posLineEnd = pdoc->LineStart(line + 1);
-               Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
                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 + ll->maxLineLength)) {
-                       posLineEnd = posLineStart + ll->maxLineLength;
-               }
                // Fill base line layout
                for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) {
                        char chDoc = pdoc->CharAt(charInDoc);
@@ -1357,6 +1606,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                                numCharsInLine++;
                        }
                }
+               ll->xHighlightGuide = 0;
                // Extra element at the end of the line to hold end x position and act as
                ll->chars[numCharsInLine] = 0;   // Also triggers processing in the loops as this is a control character
                ll->styles[numCharsInLine] = styleByte; // For eolFilled
@@ -1369,6 +1619,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                ll->positions[0] = 0;
                unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars;
                bool lastSegItalics = false;
+               Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
 
                for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
                        if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) ||
@@ -1427,6 +1678,9 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                ll->widthLine = width;
                if (width == LineLayout::wrapWidthInfinite) {
                        ll->lines = 1;
+               } else if (width > ll->positions[ll->numCharsInLine]) {
+                       // Simple common case where line does not need wrapping.
+                       ll->lines = 1;
                } else {
                        ll->lines = 0;
                        // Calculate line start positions based upon width.
@@ -1728,7 +1982,9 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
 }
 
 void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
-       //Platform::DebugPrintf("Paint %d %d - %d %d\n", rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+       //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n",
+       //      paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+
        RefreshStyleData();
 
        PRectangle rcClient = GetClientRectangle();
@@ -1738,8 +1994,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
        if (WrapLines()) {
                // The wrapping process has changed the height of some lines so abandon this
                // paint for a complete repaint.
-               paintState = paintAbandoned;
-               return;
+               if (AbandonPaint()) {
+                       return;
+               }
        }
 
        if (!pixmapSelPattern->Initialised()) {
@@ -1790,9 +2047,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
        surfaceWindow->SetPalette(&palette, true);
        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 starting a comment flows on to other lines.
@@ -1872,7 +2126,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                while (visibleLine < cs.LinesDisplayed() && yposScreen < rcArea.bottom) {
 
                        int lineDoc = cs.DocFromDisplay(visibleLine);
-                       //Platform::DebugPrintf("Painting line %d\n", line);
                        // Only visible lines should be handled by the code within the loop
                        PLATFORM_ASSERT(cs.GetVisible(lineDoc));
                        int lineStartSet = cs.DisplayFromDoc(lineDoc);
@@ -2167,15 +2420,26 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
        return endPosPrint;
 }
 
+int Editor::TextWidth(int style, const char *text) {
+       RefreshStyleData();
+       AutoSurface surface(IsUnicodeMode());
+       if (surface) {
+               return surface->WidthText(vs.styles[style].font, text, strlen(text));
+       } else {
+               return 1;
+       }
+}
+
 // Empty method is overridden on GTK+ to show / hide scrollbars
-void Editor::ReconfigureScrollBars() {}
+void Editor::ReconfigureScrollBars() {
+}
 
 void Editor::SetScrollBars() {
        RefreshStyleData();
 
-       int nMax = cs.LinesDisplayed();
-       int nPage = nMax - MaxScrollPos() + 1;
-       bool modified = ModifyScrollBars(nMax, nPage);
+       int nMax = MaxScrollPos();
+       int nPage = LinesOnScreen();
+       bool modified = ModifyScrollBars(nMax + nPage - 1, nPage);
 
        // TODO: ensure always showing as many lines as possible
        // May not be, if, for example, window made larger
@@ -2184,8 +2448,10 @@ void Editor::SetScrollBars() {
                SetVerticalScrollPos();
                Redraw();
        }
-       if (modified)
-               Redraw();
+       if (modified) {
+               if (!AbandonPaint())
+                       Redraw();
+       }
        //Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage);
 }
 
@@ -2220,8 +2486,9 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
                        }
                }
        }
-       pdoc->InsertString(currentPos, s, len);
-       SetEmptySelection(currentPos + len);
+       if (pdoc->InsertString(currentPos, s, len)) {
+               SetEmptySelection(currentPos + len);
+       }
        EnsureCaretVisible();
        // Avoid blinking during rapid typing:
        ShowCaretAtCurrentPosition();
@@ -2298,7 +2565,9 @@ void Editor::ClearAll() {
        if (0 != pdoc->Length()) {
                pdoc->DeleteChars(0, pdoc->Length());
        }
-       cs.Clear();
+       if (!pdoc->IsReadOnly()) {
+               cs.Clear();
+       }
        pdoc->EndUndoAction();
        anchor = 0;
        currentPos = 0;
@@ -2416,8 +2685,7 @@ void Editor::DelCharBack(bool allowLineStartDeletion) {
                                SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
                                pdoc->EndUndoAction();
                        } else {
-                               int newPos = pdoc->DelCharBack(currentPos);
-                               SetEmptySelection(newPos);
+                               pdoc->DelCharBack(currentPos);
                        }
                }
        } else {
@@ -2450,7 +2718,7 @@ void Editor::NotifyChar(int ch) {
                char txt[2];
                txt[0] = static_cast<char>(ch);
                txt[1] = '\0';
-               NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
+               NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<sptr_t>(txt));
        }
 }
 
@@ -2527,6 +2795,12 @@ void Editor::NotifyDwelling(Point pt, bool state) {
        NotifyParent(scn);
 }
 
+void Editor::NotifyZoom() {
+       SCNotification scn;
+       scn.nmhdr.code = SCN_ZOOM;
+       NotifyParent(scn);
+}
+
 // Notifications from document
 void Editor::NotifyModifyAttempt(Document*, void *) {
        //Platform::DebugPrintf("** Modify Attempt\n");
@@ -2548,7 +2822,7 @@ void Editor::NotifySavePoint(Document*, void *, bool atSavePoint) {
 void Editor::CheckModificationForWrap(DocModification mh) {
        if ((mh.modificationType & SC_MOD_INSERTTEXT) ||
                (mh.modificationType & SC_MOD_DELETETEXT)) {
-               llc.Invalidate(LineLayout::llInvalid);
+               llc.Invalidate(LineLayout::llCheckTextAndStyle);
                if (wrapState != eWrapNone) {
                        int lineDoc = pdoc->LineFromPosition(mh.position);
                        if (mh.linesAdded == 0) {
@@ -2598,73 +2872,80 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
        needUpdateUI = true;
        if (paintState == painting) {
                CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length));
-       } else if (paintState == notPainting) {
-               CheckModificationForWrap(mh);
-               if (mh.modificationType & SC_MOD_CHANGESTYLE) {
+       }
+       CheckModificationForWrap(mh);
+       if (mh.modificationType & SC_MOD_CHANGESTYLE) {
+               if (paintState == notPainting) {
                        if (mh.position < pdoc->LineStart(topLine)) {
                                // Styling performed before this view
                                Redraw();
                        } else {
                                InvalidateRange(mh.position, mh.position + mh.length);
                        }
-               } else {
-                       // Move selection and brace highlights
-                       if (mh.modificationType & SC_MOD_INSERTTEXT) {
-                               currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length);
-                               anchor = MovePositionForInsertion(anchor, mh.position, mh.length);
-                               braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length);
-                               braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length);
-                       } else if (mh.modificationType & SC_MOD_DELETETEXT) {
-                               currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length);
-                               anchor = MovePositionForDeletion(anchor, mh.position, mh.length);
-                               braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
-                               braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
+               }
+       } else {
+               // Move selection and brace highlights
+               if (mh.modificationType & SC_MOD_INSERTTEXT) {
+                       currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length);
+                       anchor = MovePositionForInsertion(anchor, mh.position, mh.length);
+                       braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length);
+                       braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length);
+               } else if (mh.modificationType & SC_MOD_DELETETEXT) {
+                       currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length);
+                       anchor = MovePositionForDeletion(anchor, mh.position, mh.length);
+                       braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
+                       braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
+               }
+               if (cs.LinesDisplayed() < cs.LinesInDoc()) {
+                       // 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, mh.length);
+                       } else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
+                               NotifyNeedShown(mh.position, mh.length);
                        }
-                       if (cs.LinesDisplayed() < cs.LinesInDoc()) {
-                               // 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, 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);
+                       if (mh.linesAdded > 0) {
+                               cs.InsertLines(lineOfPos, mh.linesAdded);
+                       } else {
+                               cs.DeleteLines(lineOfPos, -mh.linesAdded);
                        }
-                       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);
-                               if (mh.linesAdded > 0) {
-                                       cs.InsertLines(lineOfPos, mh.linesAdded);
-                               } else {
-                                       cs.DeleteLines(lineOfPos, -mh.linesAdded);
-                               }
-                               // Avoid scrolling of display if change before current display
-                               if (mh.position < posTopLine) {
-                                       int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
-                                       if (newTop != topLine) {
-                                               SetTopLine(newTop);
-                                               SetVerticalScrollPos();
-                                       }
+                       // Avoid scrolling of display if change before current display
+                       if (mh.position < posTopLine) {
+                               int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
+                               if (newTop != topLine) {
+                                       SetTopLine(newTop);
+                                       SetVerticalScrollPos();
                                }
+                       }
 
-                               //Platform::DebugPrintf("** %x Doc Changed\n", this);
-                               // TODO: could invalidate from mh.startModification to end of screen
-                               //InvalidateRange(mh.position, mh.position + mh.length);
+                       //Platform::DebugPrintf("** %x Doc Changed\n", this);
+                       // TODO: could invalidate from mh.startModification to end of screen
+                       //InvalidateRange(mh.position, mh.position + mh.length);
+                       if (paintState == notPainting) {
                                Redraw();
-                       } else {
-                               //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
-                               //      mh.position, mh.position + mh.length);
+                       }
+               } else {
+                       //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
+                       //      mh.position, mh.position + mh.length);
+                       if (paintState == notPainting) {
                                InvalidateRange(mh.position, mh.position + mh.length);
                        }
                }
-       } // else paintState == paintAbandoned so no need to do anything
+       }
 
        if (mh.linesAdded != 0) {
                SetScrollBars();
        }
 
        if (mh.modificationType & SC_MOD_CHANGEMARKER) {
-               RedrawSelMargin();
+               if (paintState == notPainting) {
+                       RedrawSelMargin();
+               }
        }
 
        // If client wants to see this modification
@@ -2829,8 +3110,9 @@ void Editor::LineTranspose() {
                        end = startNext;
                        char *thisLine = CopyRange(start, end);
                        pdoc->DeleteChars(start, end - start);
-                       pdoc->InsertString(startPrev, thisLine, end - start);
-                       MovePositionTo(startPrev + end - start);
+                       if (pdoc->InsertString(startPrev, thisLine, end - start)) {
+                               MovePositionTo(startPrev + end - start);
+                       }
                        delete []thisLine;
                } else {
                        // Last line so line has no line end
@@ -2838,8 +3120,9 @@ void Editor::LineTranspose() {
                        char *prevEnd = CopyRange(endPrev, start);
                        pdoc->DeleteChars(endPrev, end - endPrev);
                        pdoc->InsertString(startPrev, thisLine, end - start);
-                       pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev);
-                       MovePositionTo(startPrev + end - endPrev);
+                       if (pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev)) {
+                               MovePositionTo(startPrev + end - endPrev);
+                       }
                        delete []thisLine;
                        delete []prevEnd;
                }
@@ -2849,29 +3132,60 @@ void Editor::LineTranspose() {
 
 void Editor::CancelModes() {}
 
-int Editor::KeyCommand(unsigned int iMessage) {
+void Editor::NewLine() {
+       ClearSelection();
+       const char *eol = "\n";
+       if (pdoc->eolMode == SC_EOL_CRLF) {
+               eol = "\r\n";
+       } else if (pdoc->eolMode == SC_EOL_CR) {
+               eol = "\r";
+       } // else SC_EOL_LF -> "\n" already set
+       if (pdoc->InsertString(currentPos, eol)) {
+               SetEmptySelection(currentPos + strlen(eol));
+               while (*eol) {
+                       NotifyChar(*eol);
+                       eol++;
+               }
+       }
+       SetLastXChosen();
+       EnsureCaretVisible();
+}
+
+void Editor::CursorUpOrDown(int direction, bool extend) {
        Point pt = LocationFromPosition(currentPos);
+       int posNew = PositionFromLocation(
+               Point(lastXChosen, pt.y + direction * vs.lineHeight));
+       if (direction < 0) {
+               // Line wrapping may lead to a location on the same line, so
+               // seek back if that is the case.
+               // There is an equivalent case when moving down which skips
+               // over a line but as that does not trap the user it is fine.
+               Point ptNew = LocationFromPosition(posNew);
+               while ((posNew > 0) && (pt.y == ptNew.y)) {
+                       posNew--;
+                       ptNew = LocationFromPosition(posNew);
+               }
+       }
+       MovePositionTo(posNew, extend);
+}
 
+int Editor::KeyCommand(unsigned int iMessage) {
        switch (iMessage) {
        case SCI_LINEDOWN:
-               MovePositionTo(PositionFromLocation(
-                                  Point(lastXChosen, pt.y + vs.lineHeight)));
+               CursorUpOrDown(1);
                break;
        case SCI_LINEDOWNEXTEND:
-               MovePositionTo(PositionFromLocation(
-                                  Point(lastXChosen, pt.y + vs.lineHeight)), true);
+               CursorUpOrDown(1, true);
                break;
        case SCI_LINESCROLLDOWN:
                ScrollTo(topLine + 1);
                MoveCaretInsideView();
                break;
        case SCI_LINEUP:
-               MovePositionTo(PositionFromLocation(
-                                  Point(lastXChosen, pt.y - vs.lineHeight)));
+               CursorUpOrDown(-1);
                break;
        case SCI_LINEUPEXTEND:
-               MovePositionTo(PositionFromLocation(
-                                  Point(lastXChosen, pt.y - vs.lineHeight)), true);
+               CursorUpOrDown(-1, true);
                break;
        case SCI_LINESCROLLUP:
                ScrollTo(topLine - 1);
@@ -2992,23 +3306,7 @@ int Editor::KeyCommand(unsigned int iMessage) {
                EnsureCaretVisible();
                break;
        case SCI_NEWLINE:
-               ClearSelection();
-               if (pdoc->eolMode == SC_EOL_CRLF) {
-                       pdoc->InsertString(currentPos, "\r\n");
-                       SetEmptySelection(currentPos + 2);
-                       NotifyChar('\r');
-                       NotifyChar('\n');
-               } else if (pdoc->eolMode == SC_EOL_CR) {
-                       pdoc->InsertChar(currentPos, '\r');
-                       SetEmptySelection(currentPos + 1);
-                       NotifyChar('\r');
-               } else if (pdoc->eolMode == SC_EOL_LF) {
-                       pdoc->InsertChar(currentPos, '\n');
-                       SetEmptySelection(currentPos + 1);
-                       NotifyChar('\n');
-               }
-               SetLastXChosen();
-               EnsureCaretVisible();
+               NewLine();
                break;
        case SCI_FORMFEED:
                AddChar('\f');
@@ -3022,35 +3320,36 @@ int Editor::KeyCommand(unsigned int iMessage) {
                SetLastXChosen();
                break;
        case SCI_ZOOMIN:
-               if (vs.zoomLevel < 20)
+               if (vs.zoomLevel < 20) {
                        vs.zoomLevel++;
-               NeedWrapping();
-               InvalidateStyleRedraw();
+                       NeedWrapping();
+                       InvalidateStyleRedraw();
+                       NotifyZoom();
+               }
                break;
        case SCI_ZOOMOUT:
-               if (vs.zoomLevel > -10)
+               if (vs.zoomLevel > -10) {
                        vs.zoomLevel--;
-               NeedWrapping();
-               InvalidateStyleRedraw();
+                       NeedWrapping();
+                       InvalidateStyleRedraw();
+                       NotifyZoom();
+               }
                break;
        case SCI_DELWORDLEFT: {
                        int startWord = pdoc->NextWordStart(currentPos, -1);
                        pdoc->DeleteChars(startWord, currentPos - startWord);
-                       MovePositionTo(startWord);
                        SetLastXChosen();
                }
                break;
        case SCI_DELWORDRIGHT: {
                        int endWord = pdoc->NextWordStart(currentPos, 1);
                        pdoc->DeleteChars(currentPos, endWord - currentPos);
-                       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;
@@ -3058,7 +3357,6 @@ int Editor::KeyCommand(unsigned int iMessage) {
                        int line = pdoc->LineFromPosition(currentPos);
                        int end = pdoc->LineEnd(line);
                        pdoc->DeleteChars(currentPos, end - currentPos);
-                       MovePositionTo(currentPos);
                }
                break;
        case SCI_LINECUT: {
@@ -3080,7 +3378,6 @@ int Editor::KeyCommand(unsigned int iMessage) {
                        int start = pdoc->LineStart(line);
                        int end = pdoc->LineStart(line + 1);
                        pdoc->DeleteChars(start, end - start);
-                       MovePositionTo(start);
                }
                break;
        case SCI_LINETRANSPOSE:
@@ -3146,15 +3443,14 @@ void Editor::Indent(bool forwards) {
        int lineCurrentPos = pdoc->LineFromPosition(currentPos);
        if (lineOfAnchor == lineCurrentPos) {
                if (forwards) {
+                       pdoc->BeginUndoAction();
                        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');
@@ -3165,11 +3461,12 @@ void Editor::Indent(bool forwards) {
                                        if (numSpaces < 1)
                                                numSpaces = pdoc->tabInChars;
                                        for (int i = 0; i < numSpaces; i++) {
-                                               pdoc->InsertChar(currentPos, ' ');
+                                               pdoc->InsertChar(currentPos + i, ' ');
                                        }
                                        SetEmptySelection(currentPos + numSpaces);
                                }
                        }
+                       pdoc->EndUndoAction();
                } else {
                        if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) &&
                                pdoc->tabIndents) {
@@ -3220,9 +3517,9 @@ void Editor::Indent(bool forwards) {
  * @return The position of the found text, -1 if not found.
  */
 long Editor::FindText(
-    unsigned long wParam,      ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+    uptr_t 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.
+    sptr_t lParam) {                   ///< @c TextToFind structure: The text to search for in the given range.
 
        TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
        int lengthFound = strlen(ft->lpstrText);
@@ -3261,9 +3558,9 @@ void Editor::SearchAnchor() {
  */
 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,
+    uptr_t wParam,     ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
     ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
-    long lParam) {                     ///< The text to search for.
+    sptr_t lParam) {                   ///< The text to search for.
 
        const char *txt = reinterpret_cast<char *>(lParam);
        int pos;
@@ -3456,9 +3753,10 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul
                        SetSelection(position, position);
                } else {
                        position = MovePositionOutsideChar(position, currentPos - position);
-                       pdoc->InsertString(position, value);
+                       if (pdoc->InsertString(position, value)) {
+                               SetSelection(position + strlen(value), position);
+                       }
                        pdoc->EndUndoAction();
-                       SetSelection(position + strlen(value), position);
                }
        } else if (inDragDrop) {
                SetSelection(position, position);
@@ -3743,17 +4041,20 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
                        if (selStart < selEnd) {
                                if (drag.len) {
                                        if (ctrl) {
-                                               pdoc->InsertString(newPos, drag.s, drag.len);
+                                               if (pdoc->InsertString(newPos, drag.s, drag.len)) {
                                                SetSelection(newPos, newPos + drag.len);
+                                               }
                                        } else if (newPos < selStart) {
                                                pdoc->DeleteChars(selStart, drag.len);
-                                               pdoc->InsertString(newPos, drag.s, drag.len);
-                                               SetSelection(newPos, newPos + drag.len);
+                                               if (pdoc->InsertString(newPos, drag.s, drag.len)) {
+                                                       SetSelection(newPos, newPos + drag.len);
+                                               }
                                        } else if (newPos > selEnd) {
                                                pdoc->DeleteChars(selStart, drag.len);
                                                newPos -= drag.len;
-                                               pdoc->InsertString(newPos, drag.s, drag.len);
-                                               SetSelection(newPos, newPos + drag.len);
+                                               if (pdoc->InsertString(newPos, drag.s, drag.len)) {
+                                                       SetSelection(newPos, newPos + drag.len);
+                                               }
                                        } else {
                                                SetEmptySelection(newPos);
                                        }
@@ -3852,7 +4153,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                        if (IsOverlap(topLine, paintTopLine, lineRangeStart, lineRangeEnd)) {
                                //Platform::DebugPrintf("Change (%d-%d) in top npv(%d-%d)\n",
                                //      lineRangeStart, lineRangeEnd, topLine, paintTopLine);
-                               paintState = paintAbandoned;
+                               AbandonPaint();
                                return;
                        }
                }
@@ -3863,7 +4164,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                        if (IsOverlap(paintBottomLine, bottomLine, lineRangeStart, lineRangeEnd)) {
                                //Platform::DebugPrintf("Change (%d-%d) in bottom npv(%d-%d)\n",
                                //      lineRangeStart, lineRangeEnd, paintBottomLine, bottomLine);
-                               paintState = paintAbandoned;
+                               AbandonPaint();
                                return;
                        }
                }
@@ -4072,6 +4373,10 @@ static bool ValidMargin(unsigned long wParam) {
        return wParam < ViewStyle::margins;
 }
 
+static char *CharPtrFromSPtr(sptr_t lParam) {
+       return reinterpret_cast<char *>(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);
 
@@ -4085,7 +4390,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                {
                        if (lParam == 0)
                                return 0;
-                       char *ptr = reinterpret_cast<char *>(lParam);
+                       if (wParam == 0)
+                               return 0;
+                       char *ptr = CharPtrFromSPtr(lParam);
                        unsigned int iChar = 0;
                        for (; iChar < wParam - 1; iChar++)
                                ptr[iChar] = pdoc->CharAt(iChar);
@@ -4099,7 +4406,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                                return 0;
                        pdoc->DeleteChars(0, pdoc->Length());
                        SetEmptySelection(0);
-                       pdoc->InsertString(0, reinterpret_cast<char *>(lParam));
+                       pdoc->InsertString(0, CharPtrFromSPtr(lParam));
                        return 1;
                }
 
@@ -4124,6 +4431,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_CLEAR:
                Clear();
                SetLastXChosen();
+               EnsureCaretVisible();
                break;
 
        case SCI_UNDO:
@@ -4147,7 +4455,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                        }
                        int lineStart = pdoc->LineStart(wParam);
                        int lineEnd = pdoc->LineStart(wParam + 1);
-                       char *ptr = reinterpret_cast<char *>(lParam);
+                       char *ptr = CharPtrFromSPtr(lParam);
                        int iPlace = 0;
                        for (int iChar = lineStart; iChar < lineEnd; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
@@ -4182,7 +4490,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                                return 0;
                        SelectionText selectedText;
                        CopySelectionRange(&selectedText);
-                       char *ptr = reinterpret_cast<char *>(lParam);
+                       char *ptr = CharPtrFromSPtr(lParam);
                        int iChar = 0;
                        if (selectedText.len) {
                                for (; iChar < selectedText.len; iChar++)
@@ -4222,7 +4530,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                                return 0;
                        pdoc->BeginUndoAction();
                        ClearSelection();
-                       char *replacement = reinterpret_cast<char *>(lParam);
+                       char *replacement = CharPtrFromSPtr(lParam);
                        pdoc->InsertString(currentPos, replacement);
                        pdoc->EndUndoAction();
                        SetEmptySelection(currentPos + strlen(replacement));
@@ -4246,15 +4554,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
 
        case SCI_REPLACETARGET:
                PLATFORM_ASSERT(lParam);
-               return ReplaceTarget(false, reinterpret_cast<char *>(lParam), wParam);
+               return ReplaceTarget(false, CharPtrFromSPtr(lParam), wParam);
 
        case SCI_REPLACETARGETRE:
                PLATFORM_ASSERT(lParam);
-               return ReplaceTarget(true, reinterpret_cast<char *>(lParam), wParam);
+               return ReplaceTarget(true, CharPtrFromSPtr(lParam), wParam);
 
        case SCI_SEARCHINTARGET:
                PLATFORM_ASSERT(lParam);
-               return SearchInTarget(reinterpret_cast<char *>(lParam), wParam);
+               return SearchInTarget(CharPtrFromSPtr(lParam), wParam);
 
        case SCI_SETSEARCHFLAGS:
                searchFlags = wParam;
@@ -4354,7 +4662,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_ADDTEXT: {
                        if (lParam == 0)
                                return 0;
-                       pdoc->InsertString(CurrentPosition(), reinterpret_cast<char *>(lParam), wParam);
+                       pdoc->InsertString(CurrentPosition(), CharPtrFromSPtr(lParam), wParam);
                        SetEmptySelection(currentPos + wParam);
                        return 0;
                }
@@ -4362,7 +4670,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_ADDSTYLEDTEXT: {
                        if (lParam == 0)
                                return 0;
-                       pdoc->InsertStyledString(CurrentPosition() * 2, reinterpret_cast<char *>(lParam), wParam);
+                       pdoc->InsertStyledString(CurrentPosition() * 2, CharPtrFromSPtr(lParam), wParam);
                        SetEmptySelection(currentPos + wParam / 2);
                        return 0;
                }
@@ -4374,13 +4682,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                        if (static_cast<short>(wParam) == -1)
                                insertPos = CurrentPosition();
                        int newCurrent = CurrentPosition();
-                       int newAnchor = anchor;
-                       char *sz = reinterpret_cast<char *>(lParam);
+                       char *sz = CharPtrFromSPtr(lParam);
                        pdoc->InsertString(insertPos, sz);
                        if (newCurrent > insertPos)
                                newCurrent += strlen(sz);
-                       if (newAnchor > insertPos)
-                               newAnchor += strlen(sz);
                        SetEmptySelection(newCurrent);
                        return 0;
                }
@@ -4543,7 +4848,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                        int lineCurrentPos = pdoc->LineFromPosition(currentPos);
                        int lineStart = pdoc->LineStart(lineCurrentPos);
                        unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1);
-                       char *ptr = reinterpret_cast<char *>(lParam);
+                       char *ptr = CharPtrFromSPtr(lParam);
                        unsigned int iPlace = 0;
                        for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
@@ -4573,7 +4878,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_SETSTYLINGEX:           // Specify a complete styling buffer
                if (lParam == 0)
                        return 0;
-               pdoc->SetStyles(wParam, reinterpret_cast<char *>(lParam));
+               pdoc->SetStyles(wParam, CharPtrFromSPtr(lParam));
                break;
 
        case SCI_SETBUFFEREDDRAW:
@@ -4664,6 +4969,36 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_GETLAYOUTCACHE:
                return llc.GetLevel();
 
+       case SCI_SETSCROLLWIDTH:
+               PLATFORM_ASSERT(wParam > 0);
+               if ((wParam > 0) && (wParam != static_cast<unsigned int >(scrollWidth))) {
+                       scrollWidth = wParam;
+                       SetScrollBars();
+               }
+               break;
+
+       case SCI_GETSCROLLWIDTH:
+               return scrollWidth;
+
+       case SCI_TEXTWIDTH:
+               PLATFORM_ASSERT((wParam >= 0) && (wParam <= STYLE_MAX));
+               PLATFORM_ASSERT(lParam);
+               return TextWidth(wParam, CharPtrFromSPtr(lParam));
+
+       case SCI_TEXTHEIGHT:
+               return vs.lineHeight;
+
+       case SCI_SETENDATLASTLINE:
+               PLATFORM_ASSERT((wParam == 0) || (wParam ==1));
+               if (endAtLastLine != (wParam != 0)) {
+                       endAtLastLine = wParam != 0;
+                       SetScrollBars();
+               }
+               break;
+
+       case SCI_GETENDATLASTLINE:
+               return endAtLastLine;
+
        case SCI_GETCOLUMN:
                return pdoc->GetColumn(wParam);
 
@@ -4864,7 +5199,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                if (lParam == 0)
                        return 0;
                if (wParam <= STYLE_MAX) {
-                       vs.SetStyleFontName(wParam, reinterpret_cast<const char *>(lParam));
+                       vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam));
                        InvalidateStyleRedraw();
                }
                break;
@@ -5005,9 +5340,19 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_SEARCHPREV:
                return SearchText(iMessage, wParam, lParam);
 
-       case SCI_SETCARETPOLICY:
-               caretPolicy = wParam;
-               caretSlop = lParam;
+       case SCI_SETCARETPOLICY:        // Deprecated
+               caretXPolicy = caretYPolicy = wParam;
+               caretXSlop = caretYSlop = lParam;
+               break;
+
+       case SCI_SETXCARETPOLICY:
+               caretXPolicy = wParam;
+               caretXSlop = lParam;
+               break;
+
+       case SCI_SETYCARETPOLICY:
+               caretYPolicy = wParam;
+               caretYSlop = lParam;
                break;
 
        case SCI_SETVISIBLEPOLICY:
@@ -5156,13 +5501,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
 
        case SCI_SETVIEWEOL:
                vs.viewEOL = wParam != 0;
-               Redraw();
+               InvalidateStyleRedraw();
                break;
 
        case SCI_SETZOOM:
                vs.zoomLevel = wParam;
                NeedWrapping();
                InvalidateStyleRedraw();
+               NotifyZoom();
                break;
 
        case SCI_GETZOOM:
index d9719dc534e7fb1ebafb12a75ceeb0dd33d84608..451f123411e6d44138924706398e2cbe17123441 100644 (file)
@@ -45,7 +45,7 @@ public:
        enum { wrapWidthInfinite = 0x7ffffff };
        int maxLineLength;
        int numCharsInLine;
-       enum validLevel { llInvalid, llPositions, llLines } validity;
+       enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
        int xHighlightGuide;
        bool highlightColumn;
        int selStart;
@@ -77,7 +77,7 @@ public:
                }
        }
        void SetLineStart(int line, int start);
-       void SetBracesHighlight(Range rangeLine, Position braces[], 
+       void SetBracesHighlight(Range rangeLine, Position braces[],
                char bracesMatchStyle, int xHighlight);
        void RestoreBracesHighlight(Range rangeLine, Position braces[]);
 };
@@ -97,16 +97,16 @@ public:
        LineLayoutCache();
        virtual ~LineLayoutCache();
        void Deallocate();
-       enum { 
-               llcNone=SC_CACHE_NONE, 
-               llcCaret=SC_CACHE_CARET, 
-               llcPage=SC_CACHE_PAGE, 
+       enum {
+               llcNone=SC_CACHE_NONE,
+               llcCaret=SC_CACHE_CARET,
+               llcPage=SC_CACHE_PAGE,
                llcDocument=SC_CACHE_DOCUMENT
        };
        void Invalidate(LineLayout::validLevel validity_);
        void SetLevel(int level_);
        int GetLevel() { return level; }
-       LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, 
+       LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
                int linesOnScreen, int linesInDoc);
        void Dispose(LineLayout *ll);
 };
@@ -200,6 +200,8 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        int xOffset;            ///< Horizontal scrolled amount in pixels
        int xCaretMargin;       ///< Ensure this many pixels visible on both sides of caret
        bool horizontalScrollBarVisible;
+       int scrollWidth;
+       bool endAtLastLine;
 
        Surface *pixmapLine;
        Surface *pixmapSelMargin;
@@ -257,8 +259,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
        int xEndSelect;
        bool primarySelection;
 
-       int caretPolicy;
-       int caretSlop;
+       int caretXPolicy;
+       int caretXSlop; ///< Ensure this many pixels visible on both sides of caret
+
+       int caretYPolicy;
+       int caretYSlop; ///< Ensure this many lines visible on both sides of caret
 
        int visiblePolicy;
        int visibleSlop;
@@ -302,6 +307,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        int LineFromLocation(Point pt);
        void SetTopLine(int topLineNew);
 
+       bool AbandonPaint();
        void RedrawRect(PRectangle rc);
        void Redraw();
        void RedrawSelMargin();
@@ -336,12 +342,13 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
        void PaintSelMargin(Surface *surface, PRectangle &rc);
        LineLayout *RetrieveLineLayout(int lineNumber);
-       void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, 
+       void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
                int width=LineLayout::wrapWidthInfinite);
        void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
                PRectangle rcLine, LineLayout *ll, int subLine=0);
        void Paint(Surface *surfaceWindow, PRectangle rcArea);
        long FormatRange(bool draw, RangeToFormat *pfr);
+       int TextWidth(int style, const char *text);
 
        virtual void SetVerticalScrollPos() = 0;
        virtual void SetHorizontalScrollPos() = 0;
@@ -383,6 +390,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
        void NotifyNeedShown(int pos, int len);
        void NotifyDwelling(Point pt, bool state);
+       void NotifyZoom();
 
        void NotifyModifyAttempt(Document *document, void *userData);
        void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
@@ -390,12 +398,14 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        void NotifyModified(Document *document, DocModification mh, void *userData);
        void NotifyDeleted(Document *document, void *userData);
        void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
-       void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
+       void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
        void PageMove(int direction, bool extend=false);
        void ChangeCaseOfSelection(bool makeUpperCase);
        void LineTranspose();
        virtual void CancelModes();
+       void NewLine();
+       void CursorUpOrDown(int direction, bool extend=false);
        virtual int KeyCommand(unsigned int iMessage);
        virtual int KeyDefault(int /* key */, int /*modifiers*/);
        int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
@@ -405,9 +415,9 @@ protected:  // ScintillaBase subclass needs access to much of Editor
 
        void Indent(bool forwards);
 
-       long FindText(unsigned long wParam, long lParam);
+       long FindText(uptr_t wParam, sptr_t lParam);
        void SearchAnchor();
-       long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
+       long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
        long SearchInTarget(const char *text, int length);
        void GoToLine(int lineNo);
 
index d1eddef5ff814bf16e1fb96cbe9ec8e8ab1f1532..8a03aa8ac4fbb42e7eb46b1793bfabccb2912682 100644 (file)
@@ -23,10 +23,12 @@ const LexerModule *LexerModule::base = 0;
 int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
 
 LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
-       const char *languageName_, LexerFunction fnFolder_) :
+       const char *languageName_, LexerFunction fnFolder_,
+       const char * const wordListDescriptions_[]) :
        language(language_), 
        fnLexer(fnLexer_), 
        fnFolder(fnFolder_), 
+       wordListDescriptions(wordListDescriptions_), 
        languageName(languageName_) {
        next = base;
        base = this;
@@ -36,6 +38,31 @@ LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
        }
 }
 
+int LexerModule::GetNumWordLists() const {
+       if (wordListDescriptions == NULL) {
+               return -1;
+       } else {
+               int numWordLists = 0;
+
+               while (wordListDescriptions[numWordLists]) {
+                       ++numWordLists;
+               }
+
+               return numWordLists;
+       }
+}
+
+const char * LexerModule::GetWordListDescription(int index) const {
+       static const char *emptyStr = "";
+
+       PLATFORM_ASSERT(index < GetNumWordLists());
+       if (index >= GetNumWordLists()) {
+               return emptyStr;
+       } else {
+               return wordListDescriptions[index];
+       }
+}
 const LexerModule *LexerModule::Find(int language) {
        const LexerModule *lm = base;
        while (lm) {
@@ -97,83 +124,55 @@ static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[
 
 LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
 
-#ifdef __vms
-#define LINK_LEXERS
-#endif
-
-#ifdef LINK_LEXERS
-
-// 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.
-
+// Alternative historical name for Scintilla_LinkLexers
 int wxForceScintillaLexers(void) {
        return Scintilla_LinkLexers();
 }
 
+// To add or remove a lexer, add or remove its file and run LexGen.py.
+
+// Force a reference to all of the Scintilla lexers so that the linker will
+// not remove the code of the lexers.
 int Scintilla_LinkLexers() {
-  extern LexerModule lmAda;
-  extern LexerModule lmAVE;
-  extern LexerModule lmBaan;
-  extern LexerModule lmBatch;
-  extern LexerModule lmConf;
-  extern LexerModule lmCPP;
-  extern LexerModule lmDiff;
-  extern LexerModule lmEiffel;
-  extern LexerModule lmEiffelkw;
-  extern LexerModule lmErrorList;
-  extern LexerModule lmHTML;
-  extern LexerModule lmLatex;
-  extern LexerModule lmLISP;
-  extern LexerModule lmLua;
-  extern LexerModule lmMake;
-  extern LexerModule lmMatlab;
-  extern LexerModule lmPascal;
-  extern LexerModule lmPerl;
-  extern LexerModule lmProps;  
-  extern LexerModule lmPython;
-  extern LexerModule lmRuby;
-  extern LexerModule lmSQL;
-  extern LexerModule lmVB;
-  extern LexerModule lmXML;
-  extern LexerModule lmBullant;
-
-  if (
-      &lmAda
-      && &lmAVE
-      && &lmBaan
-      && &lmConf
-      && &lmDiff
-      && &lmLatex
-      && &lmPascal
-      && &lmCPP
-      && &lmHTML
-      && &lmXML
-      && &lmProps
-      && &lmErrorList
-      && &lmMake
-      && &lmMatlab
-      && &lmBatch
-      && &lmPerl
-      && &lmPython
-      && &lmSQL
-      && &lmVB
-      && &lmRuby
-      && &lmEiffel
-      && &lmEiffelkw
-      && &lmLISP
-      && &lmLua
-      && &lmNull
-      && &lmBullant
-      )
-    {
-      return 1;
-    }
-  else
-    {
-      return 0;
-    }
+       static int forcer = 0;
+
+// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
+#define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage();
+
+//++Autogenerated -- run src/LexGen.py to regenerate
+//**\(\tLINK_LEXER(\*);\n\)
+       LINK_LEXER(lmAda);
+       LINK_LEXER(lmAVE);
+       LINK_LEXER(lmBaan);
+       LINK_LEXER(lmBullant);
+       LINK_LEXER(lmConf);
+       LINK_LEXER(lmCPP);
+       LINK_LEXER(lmTCL);
+       LINK_LEXER(lmNncrontab);
+       LINK_LEXER(lmEiffel);
+       LINK_LEXER(lmEiffelkw);
+       LINK_LEXER(lmHTML);
+       LINK_LEXER(lmXML);
+       LINK_LEXER(lmASP);
+       LINK_LEXER(lmPHP);
+       LINK_LEXER(lmLISP);
+       LINK_LEXER(lmLua);
+       LINK_LEXER(lmMatlab);
+       LINK_LEXER(lmBatch);
+       LINK_LEXER(lmDiff);
+       LINK_LEXER(lmProps);
+       LINK_LEXER(lmMake);
+       LINK_LEXER(lmErrorList);
+       LINK_LEXER(lmLatex);
+       LINK_LEXER(lmPascal);
+       LINK_LEXER(lmPerl);
+       LINK_LEXER(lmPython);
+       LINK_LEXER(lmRuby);
+       LINK_LEXER(lmSQL);
+       LINK_LEXER(lmVB);
+       LINK_LEXER(lmVBScript);
+
+//--Autogenerated -- end of automatically generated section
+
+       return 1;
 }
-#endif
index c85664fd5b04e8bc8b2aa687a9c9dbbabe10296d..c1bb1ff9a30bace3c31ef25db5c558d9bee2b370 100644 (file)
@@ -72,17 +72,18 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
 
        for (; sc.More(); sc.Forward()) {
        
+               if (sc.atLineStart && (sc.state == SCE_C_STRING)) {
+                       // Prevent SCE_C_STRINGEOL from leaking back to previous line
+                       sc.SetState(SCE_C_STRING);
+               }
+
                // Handle line continuation generically.
                if (sc.ch == '\\') {
-                       if (sc.Match("\\\n")) {
-                               sc.Forward();
-                               sc.Forward();
-                               continue;
-                       }
-                       if (sc.Match("\\\r\n")) {
-                               sc.Forward();
-                               sc.Forward();
+                       if (sc.chNext == '\n' || sc.chNext == '\r') {
                                sc.Forward();
+                               if (sc.ch == '\r' && sc.chNext == '\n') {
+                                       sc.Forward();
+                               }
                                continue;
                        }
                }
@@ -260,9 +261,17 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
        sc.Complete();
 }
 
+static bool IsStreamCommentStyle(int style) {
+       return style == SCE_C_COMMENT || 
+               style == SCE_C_COMMENTDOC ||
+               style == SCE_C_COMMENTDOCKEYWORD ||
+               style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
 static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
                             Accessor &styler) {
        bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+       bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
        bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
        unsigned int endPos = startPos + length;
        int visibleChars = 0;
@@ -279,15 +288,37 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis
                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) {
+               if (foldComment && IsStreamCommentStyle(style)) {
+                       if (!IsStreamCommentStyle(stylePrev)) {
                                levelCurrent++;
-                       } else if ((style != styleNext) && !atEOL) {
+                       } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
                                // Comments don't end at end of line and the next character may be unstyled.
                                levelCurrent--;
                        }
                }
+               if (foldComment && (style == SCE_C_COMMENTLINE)) {
+                       if ((ch == '/') && (chNext == '/')) {
+                               char chNext2 = styler.SafeGetCharAt(i + 2);
+                               if (chNext2 == '{') {
+                                       levelCurrent++;
+                               } else if (chNext2 == '}') {
+                                       levelCurrent--;
+                               }
+                       }
+               }
+               if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
+                       if (ch == '#') {
+                               unsigned int j=i+1;
+                               while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+                                       j++;
+                               }
+                               if (styler.Match(j, "region") || styler.Match(j, "if")) {
+                                       levelCurrent++;
+                               } else if (styler.Match(j, "end")) {
+                                       levelCurrent--;
+                               }
+                       }
+               }
                if (style == SCE_C_OPERATOR) {
                        if (ch == '{') {
                                levelCurrent++;
@@ -316,5 +347,12 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis
        styler.SetLevel(lineCurrent, levelPrev | flagsNext);
 }
 
-LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc);
-LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc);
+static const char * const cppWordLists[] = {
+       "Primary keywords and identifiers",
+       "Secondary keywords and identifiers",
+       "Documentation comment keywords",
+       0,
+};
+
+LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc, cppWordLists);
+LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc, cppWordLists);
index ce35fedec5026be87881e5dced762a5bd6932429..37729cbfdd73c682a055420854dc65b1731a89c9 100644 (file)
@@ -2,7 +2,7 @@
 /** @file LexCrontab.cxx
  ** Lexer to use with extended crontab files used by a powerful
  ** Windows scheduler/event monitor/automation manager nnCron.
- ** (http://nemtsev.virtualave.net/)
+ ** (http://nemtsev.eserv.ru/)
  **/
 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
@@ -62,7 +62,8 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
                                        state = SCE_NNCRONTAB_TASK;
                                        styler.ColourTo(i,SCE_NNCRONTAB_TASK);
                                }
-                                 else if( ch == '\\' && styler.SafeGetCharAt(i+1) == ' ') {
+                                 else if( ch == '\\' && (styler.SafeGetCharAt(i+1) == ' ' || 
+                                                                                styler.SafeGetCharAt(i+1) == '\t')) {
                                        // signals the start of an extended comment...
                                        state = SCE_NNCRONTAB_COMMENT;
                                        styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
@@ -81,6 +82,10 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
                                        // signals environment variables
                                        state = SCE_NNCRONTAB_ENVIRONMENT;
                                        styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
+                               } else if( ch == '<' && styler.SafeGetCharAt(i+1) == '%') {
+                                       // signals environment variables
+                                       state = SCE_NNCRONTAB_ENVIRONMENT;
+                                       styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
                                } else if( ch == '*' ) {
                                        // signals an asterisk
                                        // no state jump necessary for this simple case...
@@ -148,7 +153,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
                                        break;
                                }
                                if( (ch == '%' && styler.SafeGetCharAt(i-1)!='\\')
-                                       || (ch == '\n') || (ch == '\r') ) {
+                                       || (ch == '\n') || (ch == '\r') || (ch == '>') ) {
                                        state = SCE_NNCRONTAB_DEFAULT;
                                        styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
                                        break;
@@ -159,7 +164,8 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
                        case SCE_NNCRONTAB_IDENTIFIER:
                                // stay  in CONF_IDENTIFIER state until we find a non-alphanumeric
                                if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') ||
-                                       (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ) {
+                                       (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ||
+                                       (ch == '@') ) {
                                        buffer[bufferCount++] = ch;
                                } else {
                                        state = SCE_NNCRONTAB_DEFAULT;
index 67ee29c5e7c8b5a414a1cfd5d6225c7477db869c..545bbfd553317abf95674c83caf0fe4e1bd4de0f 100644 (file)
@@ -220,9 +220,11 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
                        isScript = 0 == strcmp(s, "script");
                }
        }
-       if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords)
+       if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords) {
                // No keywords -> all are known
                chAttr = SCE_H_TAG;
+               isScript = 0 == strcmp(s, "script");
+       }
        styler.ColourTo(end, chAttr);
        return isScript ? SCE_H_SCRIPT : chAttr;
 }
@@ -555,6 +557,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                //case SCE_HJ_COMMENTLINE:
                        case SCE_HJ_DOUBLESTRING:
                        case SCE_HJ_SINGLESTRING:
+                       case SCE_HJ_REGEX:
                        case SCE_HB_STRING:
                        case SCE_HP_STRING:
                        case SCE_HP_TRIPLE:
@@ -1851,7 +1854,17 @@ static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, Wo
        sc.Complete();
 }
 
-LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
-LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
-LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp");
-LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php");
+static const char * const htmlWordListDesc[] = {
+       "HTML elements and attributes",
+       "JavaScript keywords",
+       "VBScript keywords",
+       "Python keywords",
+       "PHP keywords",
+       "SGML and DTD keywords",
+       0,
+};
+
+LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc);
+LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc);
+LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc);
+LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc);
index 338a04e327f0661683fbed476cf9c0f10bfee388..fc9607e25d24300256ea201cd1bf598f47151378 100644 (file)
@@ -4,7 +4,7 @@
  **
  ** Written by Paul Winwood.
  ** Folder by Alexey Yutkin.
- ** Modified by Marcos E. Wurzius
+ ** Modified by Marcos E. Wurzius & Philippe Lhoste
  **/
 
 #include <stdlib.h>
@@ -23,6 +23,7 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#define SCE_LUA_LAST_STYLE     SCE_LUA_WORD6
 
 static inline bool IsAWordChar(const int ch) {
        return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
@@ -32,7 +33,6 @@ inline bool IsAWordStart(const int ch) {
        return (ch < 0x80) && (isalnum(ch) || ch == '_');
 }
 
-
 inline bool isLuaOperator(char ch) {
        if (isalnum(ch))
                return false;
@@ -47,9 +47,12 @@ inline bool isLuaOperator(char ch) {
        return false;
 }
 
-
-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 &keywords2 = *keywordlists[1];
@@ -57,28 +60,40 @@ static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, Wo
        WordList &keywords4 = *keywordlists[3];
        WordList &keywords5 = *keywordlists[4];
        WordList &keywords6 = *keywordlists[5];
-       int literalString = 0;
-       int literalStringFlag =0;
+
+       // Must initialize the literal string nesting level, if we are inside such a string.
+       int literalStringLevel = 0;
+       if (initStyle == SCE_LUA_LITERALSTRING) {
+               literalStringLevel = 1;
+       }
+       // We use states above the last one to indicate nesting level of literal strings
+       if (initStyle > SCE_LUA_LAST_STYLE) {
+               literalStringLevel = initStyle - SCE_LUA_LAST_STYLE + 1;
+       }
 
        // Do not leak onto next line
-       if (initStyle == SCE_LUA_STRINGEOL)
+       if (initStyle == SCE_LUA_STRINGEOL) {
                initStyle = SCE_LUA_DEFAULT;
+       }
 
        StyleContext sc(startPos, length, initStyle, styler);
-       if(startPos == 0 && sc.ch == '#') sc.SetState(SCE_LUA_COMMENTLINE);
+       if (startPos == 0 && sc.ch == '#') {
+               sc.SetState(SCE_LUA_COMMENTLINE);
+       }
        for (; sc.More(); sc.Forward()) {
-       
-               // Handle line continuation generically.
-               if (sc.ch == '\\') {
-                       if (sc.Match("\\\n")) {
-                               sc.Forward();
-                               sc.Forward();
-                               continue;
-                       }
-                       if (sc.Match("\\\r\n")) {
-                               sc.Forward();
-                               sc.Forward();
+               if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) {
+                       // Prevent SCE_LUA_STRINGEOL from leaking back to previous line
+                       sc.SetState(SCE_LUA_STRING);
+               }
+
+               // Handle string line continuation
+               if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) &&
+                               sc.ch == '\\') {
+                       if (sc.chNext == '\n' || sc.chNext == '\r') {
                                sc.Forward();
+                               if (sc.ch == '\r' && sc.chNext == '\n') {
+                                       sc.Forward();
+                               }
                                continue;
                        }
                }
@@ -109,12 +124,14 @@ static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, Wo
                                }
                                sc.SetState(SCE_LUA_DEFAULT);
                        }
-
                } else if (sc.state == SCE_LUA_COMMENTLINE ) {
                        if (sc.atLineEnd) {
                                sc.SetState(SCE_LUA_DEFAULT);
                        }
+               } else if (sc.state == SCE_LUA_PREPROCESSOR ) {
+                       if (sc.atLineEnd) {
+                               sc.SetState(SCE_LUA_DEFAULT);
+                       }
                } else if (sc.state == SCE_LUA_STRING) {
                        if (sc.ch == '\\') {
                                if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
@@ -126,7 +143,6 @@ static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, Wo
                                sc.ChangeState(SCE_LUA_STRINGEOL);
                                sc.ForwardSetState(SCE_LUA_DEFAULT);
                        }
-                       
                } else if (sc.state == SCE_LUA_CHARACTER) {
                        if (sc.ch == '\\') {
                                if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
@@ -138,33 +154,41 @@ static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, Wo
                                sc.ChangeState(SCE_LUA_STRINGEOL);
                                sc.ForwardSetState(SCE_LUA_DEFAULT);
                        }
-               } else if (sc.state == SCE_LUA_LITERALSTRING) {
-                       if (sc.chPrev == '[' && sc.ch == '[' && literalStringFlag != 1)         {
-                               literalString++;
-                               literalStringFlag = 1;
-                       }
-                       else if (sc.chPrev == ']' && sc.ch == ']' && literalStringFlag != 2 ) {
-                               if((--literalString == 1))
+               } else if (sc.state == SCE_LUA_LITERALSTRING || sc.state > SCE_LUA_LAST_STYLE) {
+                       if (sc.Match('[', '[')) {
+                               literalStringLevel++;
+                               sc.SetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
+                       } else if (sc.Match(']', ']') && literalStringLevel > 0) {
+                               literalStringLevel--;
+                               sc.Forward();
+                               if (literalStringLevel == 0) {
                                        sc.ForwardSetState(SCE_LUA_DEFAULT);
-                               literalStringFlag = 2;
+                               } else if (literalStringLevel == 1) {
+                                       sc.ForwardSetState(SCE_LUA_LITERALSTRING);
+                               } else {
+                                       sc.ForwardSetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
+                               }
                        }
-                       else literalStringFlag = 0;
-               }               
+               }
                // Determine if a new state should be entered.
                if (sc.state == SCE_LUA_DEFAULT) {
                        if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
-                                       sc.SetState(SCE_LUA_NUMBER);
-                       } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
-                                       sc.SetState(SCE_LUA_IDENTIFIER);
-                       } else if (sc.ch == '\"') {
+                               sc.SetState(SCE_LUA_NUMBER);
+                       } else if (IsAWordStart(sc.ch)) {
+                               sc.SetState(SCE_LUA_IDENTIFIER);
+                       } else if (sc.Match('\"')) {
                                sc.SetState(SCE_LUA_STRING);
-                       } else if (sc.ch == '\'') {
+                       } else if (sc.Match('\'')) {
                                sc.SetState(SCE_LUA_CHARACTER);
-                       } else if (sc.ch == '[' && sc.chNext == '[') {
+                       } else if (sc.Match('[', '[')) {
+                               literalStringLevel = 1;
                                sc.SetState(SCE_LUA_LITERALSTRING);
-                               literalString = 1;
-                       } else if (sc.ch == '-' && sc.chNext == '-') {
+                               sc.Forward();
+                       } else if (sc.Match('-', '-')) {
                                sc.SetState(SCE_LUA_COMMENTLINE);
+                               sc.Forward();
+                       } else if (sc.Match('$') && sc.atLineStart) {
+                               sc.SetState(SCE_LUA_PREPROCESSOR);      // Obsolete since Lua 4.0, but still in old code
                        }  else if (isLuaOperator(static_cast<char>(sc.ch))) {
                                sc.SetState(SCE_LUA_OPERATOR);
                        }
@@ -185,6 +209,7 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
        bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
        int styleNext = styler.StyleAt(startPos);
        char s[10];
+
        for (unsigned int i = startPos; i < lengthDoc; i++) {
                char ch = chNext;
                chNext = styler.SafeGetCharAt(i + 1);
@@ -192,36 +217,38 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
                styleNext = styler.StyleAt(i + 1);
                bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
                if (style == SCE_LUA_WORD) {
-                       if ( ch == 'i' || ch == 'e' || ch == 't' || ch == 'd' || ch == 'f') {
+                       if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e') {
                                for (unsigned int j = 0; j < 8; j++) {
-                                       if (!iswordchar(styler[i + j]))
+                                       if (!iswordchar(styler[i + j])) {
                                                break;
+                                       }
                                        s[j] = styler[i + j];
                                        s[j + 1] = '\0';
                                }
-                               
-                               if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0)
-                                       || (strcmp(s, "function") == 0))
+
+                               if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0)) {
                                        levelCurrent++;
-                               if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0))
+                               }
+                               if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) {
                                        levelCurrent--;
-                               
+                               }
                        }
-               }
-               else if (style == SCE_LUA_OPERATOR)
-               {
-                       if(ch == '{' || ch == '(')
+               } else if (style == SCE_LUA_OPERATOR) {
+                       if (ch == '{' || ch == '(') {
                                levelCurrent++;
-                       else if(ch == '}' || ch == ')')
+                       } else if (ch == '}' || ch == ')') {
                                levelCurrent--;
+                       }
                }
-                       
+
                if (atEOL) {
                        int lev = levelPrev;
-                       if (visibleChars == 0 && foldCompact)
+                       if (visibleChars == 0 && foldCompact) {
                                lev |= SC_FOLDLEVELWHITEFLAG;
-                       if ((levelCurrent > levelPrev) && (visibleChars > 0))
+                       }
+                       if ((levelCurrent > levelPrev) && (visibleChars > 0)) {
                                lev |= SC_FOLDLEVELHEADERFLAG;
+                       }
                        if (lev != styler.LevelAt(lineCurrent)) {
                                styler.SetLevel(lineCurrent, lev);
                        }
@@ -229,8 +256,9 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
                        levelPrev = levelCurrent;
                        visibleChars = 0;
                }
-               if (!isspacechar(ch))
+               if (!isspacechar(ch)) {
                        visibleChars++;
+               }
        }
        // Fill in the real level of the next line, keeping the current flags as they will be filled in later
 
index f188722ff208fb7396934517a686dbbf71188970..7010591430fff612b4c3c718115287f638cdf89d 100644 (file)
@@ -159,21 +159,23 @@ static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
        // difference starts then each line starting with ' ' is a whitespace
        // otherwise it is considered a comment (Only in..., Binary file...)
        if (0 == strncmp(lineBuffer, "diff ", 3)) {
-               styler.ColourTo(endLine, 2);
+               styler.ColourTo(endLine, SCE_DIFF_COMMAND);
        } else if (0 == strncmp(lineBuffer, "--- ", 3)) {
-               styler.ColourTo(endLine, 3);
+               styler.ColourTo(endLine, SCE_DIFF_HEADER);
        } else if (0 == strncmp(lineBuffer, "+++ ", 3)) {
-               styler.ColourTo(endLine, 3);
+               styler.ColourTo(endLine, SCE_DIFF_HEADER);
+       } else if (0 == strncmp(lineBuffer, "***", 3)) {
+               styler.ColourTo(endLine, SCE_DIFF_HEADER);
        } else if (lineBuffer[0] == '@') {
-               styler.ColourTo(endLine, 4);
+               styler.ColourTo(endLine, SCE_DIFF_POSITION);
        } else if (lineBuffer[0] == '-') {
-               styler.ColourTo(endLine, 5);
+               styler.ColourTo(endLine, SCE_DIFF_DELETED);
        } else if (lineBuffer[0] == '+') {
-               styler.ColourTo(endLine, 6);
+               styler.ColourTo(endLine, SCE_DIFF_ADDED);
        } else if (lineBuffer[0] != ' ') {
-               styler.ColourTo(endLine, 1);
+               styler.ColourTo(endLine, SCE_DIFF_COMMENT);
        } else {
-               styler.ColourTo(endLine, 0);
+               styler.ColourTo(endLine, SCE_DIFF_DEFAULT);
        }
 }
 
@@ -208,28 +210,28 @@ static void ColourisePropsLine(
                i++;
        if (i < lengthLine) {
                if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
-                       styler.ColourTo(endPos, 1);
+                       styler.ColourTo(endPos, SCE_PROPS_COMMENT);
                } else if (lineBuffer[i] == '[') {
-                       styler.ColourTo(endPos, 2);
+                       styler.ColourTo(endPos, SCE_PROPS_SECTION);
                } else if (lineBuffer[i] == '@') {
-                       styler.ColourTo(startLine + i, 4);
+                       styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
                        if (lineBuffer[++i] == '=')
-                               styler.ColourTo(startLine + i, 3);
-                       styler.ColourTo(endPos, 0);
+                               styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
+                       styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
                } else {
                        // Search for the '=' character
                        while ((i < lengthLine) && (lineBuffer[i] != '='))
                                i++;
                        if ((i < lengthLine) && (lineBuffer[i] == '=')) {
-                               styler.ColourTo(startLine + i - 1, 0);
+                               styler.ColourTo(startLine + i - 1, SCE_PROPS_DEFAULT);
                                styler.ColourTo(startLine + i, 3);
-                               styler.ColourTo(endPos, 0);
+                               styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
                        } else {
-                               styler.ColourTo(endPos, 0);
+                               styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
                        }
                }
        } else {
-               styler.ColourTo(endPos, 0);
+               styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
        }
 }
 
@@ -386,6 +388,8 @@ static void ColouriseErrorListLine(
                                state = 1;
                        } else if ((state == 0) && (lineBuffer[i] == '(')) {
                                state = 10;
+                       } else if ((state == 0) && (lineBuffer[i] == '\t')) {
+                               state = 20;
                        } else if ((state == 1) && isdigit(lineBuffer[i])) {
                                state = 2;
                        } else if ((state == 2) && (lineBuffer[i] == ':')) {
@@ -406,12 +410,22 @@ static void ColouriseErrorListLine(
                                break;
                        } else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
                                state = 99;
+                       } else if ((state == 20) && isdigit(lineBuffer[i])) {
+                               state = 24;
+                               break;
+                       } else if ((state == 20) && ((lineBuffer[i] == '/') && (lineBuffer[i+1] == '^'))) {
+                               state = 21;
+                       } else if ((state == 21) && ((lineBuffer[i] == '$') && (lineBuffer[i+1] == '/'))) {
+                               state = 22;
+                               break;          
                        }
                }
                if (state == 3) {
                        styler.ColourTo(endPos, SCE_ERR_GCC);
                } else if ((state == 13) || (state == 14) || (state == 15)) {
                        styler.ColourTo(endPos, SCE_ERR_MS);
+               } else if (((state == 22) || (state == 24)) && (lineBuffer[0] != '\t')) {
+                       styler.ColourTo(endPos, SCE_ERR_CTAG);  
                } else {
                        styler.ColourTo(endPos, SCE_ERR_DEFAULT);
                }
index 76dc48de6887be95f1a3a4884064429c7ff4331b..1715009c9d0d064a08f2bbd095e614d8e86902e5 100644 (file)
@@ -659,4 +659,9 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
        styler.ColourTo(lengthDoc - 1, state);
 }
 
-LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl");
+static const char * const perlWordListDesc[] = {
+       "Perl keywords",
+       0
+};
+
+LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", 0, perlWordListDesc);
index 6675c1f0376d00bc9ceba566312a91cb07037bad..01365c1901a2eb0c99f336c133c3a2ae1c5ad62b 100644 (file)
@@ -408,4 +408,10 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
        //styler.SetLevel(lineCurrent, indentCurrent);
 }
 
-LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
+static const char * const pythonWordListDesc[] = {
+       "Python keywords",
+       0
+};
+
+LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc, 
+                                        pythonWordListDesc);
index ba938947f59db0d9751214375126fc4a4af13da0..29679969132f0f3eeabcf9da2c084875303df0a0 100644 (file)
@@ -45,7 +45,7 @@ int CompareCaseInsensitive(const char *a, const char *b) {
        return *a - *b;
 }
 
-int CompareNCaseInsensitive(const char *a, const char *b, int len) {
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
        while (*a && *b && len) {
                if (*a != *b) {
                        char upperA = MakeUpperCase(*a);
@@ -68,7 +68,7 @@ bool EqualCaseInsensitive(const char *a, const char *b) {
        return 0 == CompareCaseInsensitive(a, b);
 }
 
-inline unsigned int HashString(const char *s, int len) {
+inline unsigned int HashString(const char *s, size_t len) {
        unsigned int ret = 0;
        while (len--) {
                ret <<= 4;
@@ -93,9 +93,9 @@ 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);
+               lenKey = static_cast<int>(strlen(key));
        if (lenVal == -1)
-               lenVal = strlen(val);
+               lenVal = static_cast<int>(strlen(val));
        unsigned int hash = HashString(key, lenKey);
        for (Property *p = props[hash % hashRoots]; p; p = p->next) {
                if ((hash == p->hash) && 
@@ -187,7 +187,7 @@ SString PropSet::Expand(const char *withVars) {
                        int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
                        char *var = StringDup(cpvar + 2, lenvar);
                        SString val = GetExpanded(var);
-                       int newlenbase = strlen(base) + val.length() - lenvar;
+                       size_t newlenbase = strlen(base) + val.length() - lenvar;
                        char *newbase = new char[newlenbase];
                        strncpy(newbase, base, cpvar - base);
                        strcpy(newbase + (cpvar - base), val.c_str());
@@ -224,11 +224,11 @@ bool isprefix(const char *target, const char *prefix) {
 }
 
 static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) {
-       int lentarget = strlen(target);
-       int lensuffix = strlen(suffix);
+       size_t lentarget = strlen(target);
+       size_t lensuffix = strlen(suffix);
        if (lensuffix > lentarget)
                return false;
-       for (int i = lensuffix - 1; i >= 0; i--) {
+       for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) {
                if (MakeUpperCase(target[i + lentarget - lensuffix]) !=
                        MakeUpperCase(suffix[i]))
                        return false;
@@ -306,7 +306,7 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
                        int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
                        char *var = StringDup(cpvar + 2, lenvar);
                        SString val = GetWild(var, filename);
-                       int newlenbase = strlen(base) + val.length() - lenvar;
+                       size_t newlenbase = strlen(base) + val.length() - lenvar;
                        char *newbase = new char[newlenbase];
                        strncpy(newbase, base, cpvar - base);
                        strcpy(newbase + (cpvar - base), val.c_str());
@@ -340,7 +340,7 @@ void PropSet::Clear() {
 }
 
 char *PropSet::ToString() {
-       unsigned int len=0;
+       size_t len=0;
        for (int r = 0; r < hashRoots; r++) {
                for (Property *p = props[r]; p; p = p->next) {
                        len += strlen(p->key) + 1;
@@ -435,8 +435,8 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
        if (keywords) {
                words = 0;
                prev = '\0';
-               int slen = strlen(wordlist);
-               for (int k = 0; k < slen; k++) {
+               size_t slen = strlen(wordlist);
+               for (size_t k = 0; k < slen; k++) {
                        if (!iswordsep(wordlist[k], onlyLineEnds)) {
                                if (!prev) {
                                        keywords[words] = &wordlist[k];
index 9296657f80fef0840256fbad831b5792c37f0793..2c63bb95906c369200e6d8190c1702a5487cb520 100644 (file)
@@ -30,8 +30,8 @@
  * Modification history:
  *
  * $Log$
- * Revision 1.3  2002/03/18 22:31:00  RD
- * Updated wxSTC from Scintilla 1.40 to Scintilla 1.45
+ * Revision 1.4  2002/09/06 16:58:12  RD
+ * Updated to Scintilla from 1.45 to 1.47
  *
  * Revision 1.6  2001/04/29 13:32:10  nyamatongwe
  * Addition of new target methods - versions of ReplaceTarget that take counted
index 0dabb5393c99a170d3de5f88558ee069ec2837f6..1238e2ecb20b0f485cd23fd6fbaf8d132444c78c 100644 (file)
@@ -64,11 +64,18 @@ void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) {
 }
 
 void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
-       bool acActiveBeforeCharAdded = ac.Active();
-       if (!acActiveBeforeCharAdded || !ac.IsFillUpChar(*s))
+       bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
+       if (!isFillUp) {
                Editor::AddCharUTF(s, len, treatAsDBCS);
-       if (acActiveBeforeCharAdded)
+       }
+       if (ac.Active()) {
                AutoCompleteChanged(s[0]);
+               // For fill ups add the character after the autocompletion has 
+               // triggered so containers see the key so can display a calltip.
+               if (isFillUp) {
+                       Editor::AddCharUTF(s, len, treatAsDBCS);
+               }
+       }
 }
 
 void ScintillaBase::Command(int cmdId) {
@@ -278,7 +285,7 @@ void ScintillaBase::AutoCompleteMoveToCurrentWord() {
 
 void ScintillaBase::AutoCompleteChanged(char ch) {
        if (ac.IsFillUpChar(ch)) {
-               AutoCompleteCompleted(ch);
+               AutoCompleteCompleted();
        } else if (currentPos <= ac.posStart - ac.startLen) {
                ac.Cancel();
        } else if (ac.cancelAtStartPos && currentPos <= ac.posStart) {
@@ -290,7 +297,7 @@ void ScintillaBase::AutoCompleteChanged(char ch) {
        }
 }
 
-void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
+void ScintillaBase::AutoCompleteCompleted() {
        int item = ac.lb.GetSelection();
        char selected[1000];
        if (item != -1) {
@@ -323,8 +330,6 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
        SetEmptySelection(ac.posStart);
        if (item != -1) {
                SString piece = selected;
-               if (fillUp)
-                       piece += fillUp;
                pdoc->InsertString(firstPos, piece.c_str());
                SetEmptySelection(firstPos + piece.length());
        }
@@ -332,18 +337,20 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
 }
 
 void ScintillaBase::ContextMenu(Point pt) {
-       bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
-       popup.CreatePopUp();
-       AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
-       AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
-       AddToPopUp("");
-       AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
-       AddToPopUp("Copy", idcmdCopy, 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);
+       if (displayPopupMenu) {
+               bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
+               popup.CreatePopUp();
+               AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
+               AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
+               AddToPopUp("");
+               AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
+               AddToPopUp("Copy", idcmdCopy, 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);
+       }
 }
 
 void ScintillaBase::CancelModes() {
index 7e3887c1599064a9008928e27154362bb8cff04c..28c089edd2563e9a36cd4dcaf97d66ead96d41b5 100644 (file)
@@ -66,7 +66,7 @@ protected:
        void AutoCompleteCancel();
        void AutoCompleteMove(int delta);
        void AutoCompleteChanged(char ch=0);
-       void AutoCompleteCompleted(char fillUp='\0');
+       void AutoCompleteCompleted();
        void AutoCompleteMoveToCurrentWord();
        static void AutoCompleteDoubleClick(void* p);
 
index 9e803c4a7131b420d431c0bef003bc84c0c0316b..4c9352916da7925aa4f3c7f4c968576cbeefdd4c 100644 (file)
@@ -144,6 +144,10 @@ inline bool IsASpace(unsigned int ch) {
     return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
 }
 
+inline bool IsASpaceOrTab(unsigned int ch) {
+       return (ch == ' ') || (ch == '\t');
+}
+
 inline bool IsADigit(unsigned int ch) {
        return (ch >= '0') && (ch <= '9');
 }
index e02bf90e487d9024e2375951644ed80fdb91c0b9..ce42534e7bffa52b588207e0dcd4ef38854102eb 100644 (file)
@@ -42,7 +42,16 @@ void WindowAccessor::Fill(int position) {
                endPos = lenDoc;
 
        TextRange tr = {{startPos, endPos}, buf};
-       Platform::SendScintilla(id, SCI_GETTEXTRANGE, 0, reinterpret_cast<long>(&tr));
+       Platform::SendScintillaPointer(id, SCI_GETTEXTRANGE, 0, &tr);
+}
+
+bool WindowAccessor::Match(int pos, const char *s) {
+       for (int i=0; *s; i++) {
+               if (*s != SafeGetCharAt(pos+i))
+                       return false;
+               s++;
+       }
+       return true;
 }
 
 char WindowAccessor::StyleAt(int position) {
@@ -116,8 +125,8 @@ void WindowAccessor::Flush() {
        startPos = extremePosition;
        lenDoc = -1;
        if (validLen > 0) {
-               Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen, 
-                       reinterpret_cast<long>(styleBuf));
+               Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, 
+                       styleBuf);
                validLen = 0;
        }
 }
index 7ab2c32a0b46c4bda849946a99c4d6e4bbfbdead..b44aec5667c5bfd8ee807de1f39969dc8e2b3c22 100644 (file)
@@ -81,6 +81,7 @@ DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
+DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
 
 
 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -117,7 +118,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
 
 #ifdef LINK_LEXERS
 // forces the linking of the lexer modules
-int wxForceScintillaLexers();
+int Scintilla_LinkLexers();
 #endif
 
 //----------------------------------------------------------------------
@@ -134,7 +135,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
               wxDefaultValidator, name)
 {
 #ifdef LINK_LEXERS
-    wxForceScintillaLexers();
+    Scintilla_LinkLexers();
 #endif
     m_swx = new ScintillaWX(this);
     m_stopWatch.Start();
@@ -168,58 +169,58 @@ long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
 //       this file.  Edit stc.cpp.in or gen_iface.py instead and regenerate.
 
 
-// Add text to the document
+// Add text to the document.
 void wxStyledTextCtrl::AddText(const wxString& text) {
                     wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
                     SendMsg(2001, strlen(buf), (long)(const char*)buf);
 }
 
-// Add array of cells to document
+// Add array of cells to document.
 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
                           SendMsg(2002, data.GetDataLen(), (long)data.GetData());
 }
 
-// Insert string at a position
+// Insert string at a position.
 void wxStyledTextCtrl::InsertText(int pos, const wxString& text) {
     SendMsg(2003, pos, (long)(const char*)wx2stc(text));
 }
 
-// Delete all text in the document
+// Delete all text in the document.
 void wxStyledTextCtrl::ClearAll() {
     SendMsg(2004, 0, 0);
 }
 
-// Set all style bytes to 0, remove all folding information
+// Set all style bytes to 0, remove all folding information.
 void wxStyledTextCtrl::ClearDocumentStyle() {
     SendMsg(2005, 0, 0);
 }
 
-// The number of characters in the document
+// The number of characters in the document.
 int wxStyledTextCtrl::GetLength() {
     return SendMsg(2006, 0, 0);
 }
 
-// Returns the character byte at the position
+// Returns the character byte at the position.
 int wxStyledTextCtrl::GetCharAt(int pos) {
                        return (unsigned char)SendMsg(2007, pos, 0);
 }
 
-// Returns the position of the caret
+// Returns the position of the caret.
 int wxStyledTextCtrl::GetCurrentPos() {
     return SendMsg(2008, 0, 0);
 }
 
-// Returns the position of the opposite end of the selection to the caret
+// Returns the position of the opposite end of the selection to the caret.
 int wxStyledTextCtrl::GetAnchor() {
     return SendMsg(2009, 0, 0);
 }
 
-// Returns the style byte at the position
+// Returns the style byte at the position.
 int wxStyledTextCtrl::GetStyleAt(int pos) {
                        return (unsigned char)SendMsg(2010, pos, 0);
 }
 
-// Redoes the next action on the undo history
+// Redoes the next action on the undo history.
 void wxStyledTextCtrl::Redo() {
     SendMsg(2011, 0, 0);
 }
@@ -260,12 +261,12 @@ wxMemoryBuffer wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
                           return buf;
 }
 
-// Are there any redoable actions in the undo history.
+// Are there any redoable actions in the undo history?
 bool wxStyledTextCtrl::CanRedo() {
     return SendMsg(2016, 0, 0) != 0;
 }
 
-// Retrieve the line number at which a particular marker is located
+// Retrieve the line number at which a particular marker is located.
 int wxStyledTextCtrl::MarkerLineFromHandle(int handle) {
     return SendMsg(2017, handle, 0);
 }
@@ -358,8 +359,7 @@ void wxStyledTextCtrl::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.
+// The styling mask can be used to protect some bits in each styling byte from modification.
 void wxStyledTextCtrl::StartStyling(int pos, int mask) {
     SendMsg(2032, pos, mask);
 }
@@ -370,7 +370,7 @@ void wxStyledTextCtrl::SetStyling(int length, int style) {
     SendMsg(2033, length, style);
 }
 
-// Is drawing done first into a buffer or direct to the screen.
+// Is drawing done first into a buffer or direct to the screen?
 bool wxStyledTextCtrl::GetBufferedDraw() {
     return SendMsg(2034, 0, 0) != 0;
 }
@@ -381,8 +381,7 @@ void wxStyledTextCtrl::SetBufferedDraw(bool buffered) {
     SendMsg(2035, buffered, 0);
 }
 
-// Change the visible size of a tab to be a multiple of the width of a space
-// character.
+// Change the visible size of a tab to be a multiple of the width of a space character.
 void wxStyledTextCtrl::SetTabWidth(int tabWidth) {
     SendMsg(2036, tabWidth, 0);
 }
@@ -432,12 +431,12 @@ int wxStyledTextCtrl::MarkerAdd(int line, int markerNumber) {
     return SendMsg(2043, line, markerNumber);
 }
 
-// Delete a marker from a line
+// Delete a marker from a line.
 void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber) {
     SendMsg(2044, line, markerNumber);
 }
 
-// Delete all markers with a particular number from all lines
+// Delete all markers with a particular number from all lines.
 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber) {
     SendMsg(2045, markerNumber, 0);
 }
@@ -607,8 +606,7 @@ void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds) {
     SendMsg(2076, periodMilliseconds, 0);
 }
 
-// Set the set of characters making up words for when moving or selecting
-// by word.
+// Set the set of characters making up words for when moving or selecting by word.
 void wxStyledTextCtrl::SetWordChars(const wxString& characters) {
     SendMsg(2077, 0, (long)(const char*)wx2stc(characters));
 }
@@ -645,8 +643,8 @@ wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) {
     return wxColourFromLong(c);
 }
 
-// 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
+// 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 wxStyledTextCtrl::SetStyleBits(int bits) {
     SendMsg(2090, bits, 0);
@@ -677,7 +675,7 @@ bool wxStyledTextCtrl::GetCaretLineVisible() {
     return SendMsg(2095, 0, 0) != 0;
 }
 
-// Dsplay the background of the line containing the caret in a different colour.
+// Display the background of the line containing the caret in a different colour.
 void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
     SendMsg(2096, show, 0);
 }
@@ -716,8 +714,7 @@ bool wxStyledTextCtrl::AutoCompActive() {
     return SendMsg(2102, 0, 0) != 0;
 }
 
-// Retrieve the position of the caret when the auto-completion list was
-// displayed.
+// Retrieve the position of the caret when the auto-completion list was displayed.
 int wxStyledTextCtrl::AutoCompPosStart() {
     return SendMsg(2103, 0, 0);
 }
@@ -732,8 +729,8 @@ void wxStyledTextCtrl::AutoCompStops(const wxString& characterSet) {
     SendMsg(2105, 0, (long)(const char*)wx2stc(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.
+// 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 wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter) {
     SendMsg(2106, separatorCharacter, 0);
 }
@@ -790,22 +787,24 @@ void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList) {
     SendMsg(2117, listType, (long)(const char*)wx2stc(itemList));
 }
 
-// Set whether or not autocompletion is hidden automatically when nothing matches
+// 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
+// Retrieve whether or not autocompletion is hidden automatically when nothing matches.
 bool wxStyledTextCtrl::AutoCompGetAutoHide() {
     return SendMsg(2119, 0, 0) != 0;
 }
 
-// Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+// Set whether or not autocompletion deletes any word characters
+// after the inserted text upon completion.
 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord) {
     SendMsg(2270, dropRestOfWord, 0);
 }
 
-// Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+// Retrieve whether or not autocompletion deletes any word characters
+// after the inserted text upon completion.
 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
     return SendMsg(2271, 0, 0) != 0;
 }
@@ -961,7 +960,7 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos,
                      return SendMsg(2150, flags, (long)&ft);
 }
 
-// On Windows will draw the document into a display context such as a printer.
+// On Windows, will draw the document into a display context such as a printer.
  int wxStyledTextCtrl::FormatRange(bool   doDraw,
                                 int    startPos,
                                 int    endPos,
@@ -1123,7 +1122,7 @@ bool wxStyledTextCtrl::CanPaste() {
     return SendMsg(2173, 0, 0) != 0;
 }
 
-// Are there any undoable actions in the undo history.
+// Are there any undoable actions in the undo history?
 bool wxStyledTextCtrl::CanUndo() {
     return SendMsg(2174, 0, 0) != 0;
 }
@@ -1179,7 +1178,7 @@ int wxStyledTextCtrl::GetTextLength() {
     return SendMsg(2183, 0, 0);
 }
 
-// Set to overtype (true) or insert mode
+// Set to overtype (true) or insert mode.
 void wxStyledTextCtrl::SetOvertype(bool overtype) {
     SendMsg(2186, overtype, 0);
 }
@@ -1189,12 +1188,12 @@ bool wxStyledTextCtrl::GetOvertype() {
     return SendMsg(2187, 0, 0) != 0;
 }
 
-// Set the width of the insert mode caret
+// 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
+// Returns the width of the insert mode caret.
 int wxStyledTextCtrl::GetCaretWidth() {
     return SendMsg(2189, 0, 0);
 }
@@ -1251,12 +1250,12 @@ int wxStyledTextCtrl::GetTargetEnd() {
                            return SendMsg(2197, strlen(buf), (long)(const char*)buf);
 }
 
-// Set the search flags used by SearchInTarget
+// Set the search flags used by SearchInTarget.
 void wxStyledTextCtrl::SetSearchFlags(int flags) {
     SendMsg(2198, flags, 0);
 }
 
-// Get the search flags used by SearchInTarget
+// Get the search flags used by SearchInTarget.
 int wxStyledTextCtrl::GetSearchFlags() {
     return SendMsg(2199, 0, 0);
 }
@@ -1358,7 +1357,7 @@ void wxStyledTextCtrl::EnsureVisible(int line) {
     SendMsg(2232, line, 0);
 }
 
-// Set some debugging options for folding
+// Set some debugging options for folding.
 void wxStyledTextCtrl::SetFoldFlags(int flags) {
     SendMsg(2233, flags, 0);
 }
@@ -1369,7 +1368,7 @@ void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line) {
     SendMsg(2234, line, 0);
 }
 
-// Sets whether a tab pressed when caret is within indentation indents
+// Sets whether a tab pressed when caret is within indentation indents.
 void wxStyledTextCtrl::SetTabIndents(bool tabIndents) {
     SendMsg(2260, tabIndents, 0);
 }
@@ -1379,7 +1378,7 @@ bool wxStyledTextCtrl::GetTabIndents() {
     return SendMsg(2261, 0, 0) != 0;
 }
 
-// Sets whether a backspace pressed when caret is within indentation unindents
+// Sets whether a backspace pressed when caret is within indentation unindents.
 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents) {
     SendMsg(2262, bsUnIndents, 0);
 }
@@ -1389,52 +1388,87 @@ bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
     return SendMsg(2263, 0, 0) != 0;
 }
 
-// Sets the time the mouse must sit still to generate a mouse dwell event
+// 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
+// Retrieve the time the mouse must sit still to generate a mouse dwell event.
 int wxStyledTextCtrl::GetMouseDwellTime() {
     return SendMsg(2265, 0, 0);
 }
 
-// Get position of start of word
+// Get position of start of word.
 int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters) {
     return SendMsg(2266, pos, onlyWordCharacters);
 }
 
-// Get position of end of word
+// Get position of end of word.
 int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters) {
     return SendMsg(2267, pos, onlyWordCharacters);
 }
 
-// Sets whether text is word wrapped
+// Sets whether text is word wrapped.
 void wxStyledTextCtrl::SetWrapMode(int mode) {
     SendMsg(2268, mode, 0);
 }
 
-// Retrieve whether text is word wrapped
+// Retrieve whether text is word wrapped.
 int wxStyledTextCtrl::GetWrapMode() {
     return SendMsg(2269, 0, 0);
 }
 
-// Sets the degree of caching of layout information
+// Sets the degree of caching of layout information.
 void wxStyledTextCtrl::SetLayoutCache(int mode) {
     SendMsg(2272, mode, 0);
 }
 
-// Retrieve the degree of caching of layout information
+// Retrieve the degree of caching of layout information.
 int wxStyledTextCtrl::GetLayoutCache() {
     return SendMsg(2273, 0, 0);
 }
 
-// Move the caret inside current view if it's not there already
+// Sets the document width assumed for scrolling.
+void wxStyledTextCtrl::SetScrollWidth(int pixelWidth) {
+    SendMsg(2274, pixelWidth, 0);
+}
+
+// Retrieve the document width assumed for scrolling.
+int wxStyledTextCtrl::GetScrollWidth() {
+    return SendMsg(2275, 0, 0);
+}
+
+// Measure the pixel width of some text in a particular style.
+// Nul terminated text argument.
+// Does not handle tab or control characters.
+int wxStyledTextCtrl::TextWidth(int style, const wxString& text) {
+    return SendMsg(2276, style, (long)(const char*)wx2stc(text));
+}
+
+// Sets the scroll range so that maximum scroll position has
+// the last line at the bottom of the view (default).
+// Setting this to false allows scrolling one page below the last line.
+void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine) {
+    SendMsg(2277, endAtLastLine, 0);
+}
+
+// Retrieve whether the maximum scroll position has the last
+// line at the bottom of the view.
+int wxStyledTextCtrl::GetEndAtLastLine() {
+    return SendMsg(2278, 0, 0);
+}
+
+// Retrieve the height of a particular line of text in pixels.
+int wxStyledTextCtrl::TextHeight(int line) {
+    return SendMsg(2279, line, 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.
+// How many characters are on a line, not including end of line characters?
 int wxStyledTextCtrl::LineLength(int line) {
     return SendMsg(2350, line, 0);
 }
@@ -1454,12 +1488,12 @@ int wxStyledTextCtrl::BraceMatch(int pos) {
     return SendMsg(2353, pos, 0);
 }
 
-// Are the end of line characters visible.
+// Are the end of line characters visible?
 bool wxStyledTextCtrl::GetViewEOL() {
     return SendMsg(2355, 0, 0) != 0;
 }
 
-// Make the end of line characters visible or invisible
+// Make the end of line characters visible or invisible.
 void wxStyledTextCtrl::SetViewEOL(bool visible) {
     SendMsg(2356, visible, 0);
 }
@@ -1529,11 +1563,6 @@ int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text) {
     return SendMsg(2368, flags, (long)(const char*)wx2stc(text));
 }
 
-// Set the way the line the caret is on is kept visible.
-void wxStyledTextCtrl::SetCaretPolicy(int caretPolicy, int caretSlop) {
-    SendMsg(2369, caretPolicy, caretSlop);
-}
-
 // Retrieves the number of lines completely visible.
 int wxStyledTextCtrl::LinesOnScreen() {
     return SendMsg(2370, 0, 0);
@@ -1545,7 +1574,7 @@ void wxStyledTextCtrl::UsePopUp(bool allowPopUp) {
     SendMsg(2371, allowPopUp, 0);
 }
 
-// Is the selection a rectangular. The alternative is the more common stream selection.
+// Is the selection rectangular? The alternative is the more common stream selection.
 bool wxStyledTextCtrl::SelectionIsRectangle() {
     return SendMsg(2372, 0, 0) != 0;
 }
@@ -1582,93 +1611,96 @@ int wxStyledTextCtrl::GetModEventMask() {
     return SendMsg(2378, 0, 0);
 }
 
-// Change internal focus flag
+// Change internal focus flag.
 void wxStyledTextCtrl::SetSTCFocus(bool focus) {
     SendMsg(2380, focus, 0);
 }
 
-// Get internal focus flag
+// Get internal focus flag.
 bool wxStyledTextCtrl::GetSTCFocus() {
     return SendMsg(2381, 0, 0) != 0;
 }
 
-// Change error status - 0 = OK
+// Change error status - 0 = OK.
 void wxStyledTextCtrl::SetStatus(int statusCode) {
     SendMsg(2382, statusCode, 0);
 }
 
-// Get error status
+// Get error status.
 int wxStyledTextCtrl::GetStatus() {
     return SendMsg(2383, 0, 0);
 }
 
-// Set whether the mouse is captured when its button is pressed
+// 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
+// Get whether mouse gets captured.
 bool wxStyledTextCtrl::GetMouseDownCaptures() {
     return SendMsg(2385, 0, 0) != 0;
 }
 
-// Sets the cursor to one of the SC_CURSOR* values
+// Sets the cursor to one of the SC_CURSOR* values.
 void wxStyledTextCtrl::SetCursor(int cursorType) {
     SendMsg(2386, cursorType, 0);
 }
 
-// Get cursor type
+// Get cursor type.
 int wxStyledTextCtrl::GetCursor() {
     return SendMsg(2387, 0, 0);
 }
 
 // Change the way control characters are displayed:
-// If symbol is < 32, keep the drawn way, else, use the given character
+// If symbol is < 32, keep the drawn way, else, use the given character.
 void wxStyledTextCtrl::SetControlCharSymbol(int symbol) {
     SendMsg(2388, symbol, 0);
 }
 
-// Get the way control characters are displayed
+// Get the way control characters are displayed.
 int wxStyledTextCtrl::GetControlCharSymbol() {
     return SendMsg(2389, 0, 0);
 }
 
-// Move to the previous change in capitalistion
+// Move to the previous change in capitalisation.
 void wxStyledTextCtrl::WordPartLeft() {
     SendMsg(2390, 0, 0);
 }
 
-// Move to the previous change in capitalistion extending selection to new caret position.
+// Move to the previous change in capitalisation extending selection
+// to new caret position.
 void wxStyledTextCtrl::WordPartLeftExtend() {
     SendMsg(2391, 0, 0);
 }
 
-// Move to the change next in capitalistion
+// Move to the change next in capitalisation.
 void wxStyledTextCtrl::WordPartRight() {
     SendMsg(2392, 0, 0);
 }
 
-// Move to the next change in capitalistion extending selection to new caret position.
+// Move to the next change in capitalisation 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.
+// Set the way the display area is determined when a particular line
+// is to be moved to by Find, FindNext, GotoLine, etc.
 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop) {
     SendMsg(2394, visiblePolicy, visibleSlop);
 }
 
-// Delete back from the current position to the start of the line
+// 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
+// Delete forwards from the current position to the end of the line.
 void wxStyledTextCtrl::DelLineRight() {
     SendMsg(2396, 0, 0);
 }
 
-// Get and Set the xOffset (ie, horizonal scroll position)
+// Get and Set the xOffset (ie, horizonal scroll position).
 void wxStyledTextCtrl::SetXOffset(int newOffset) {
     SendMsg(2397, newOffset, 0);
 }
@@ -1676,6 +1708,18 @@ int wxStyledTextCtrl::GetXOffset() {
     return SendMsg(2398, 0, 0);
 }
 
+// Set the way the caret is kept visible when going sideway.
+// The exclusion zone is given in pixels.
+void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop) {
+    SendMsg(2402, caretPolicy, caretSlop);
+}
+
+// Set the way the line the caret is on is kept visible.
+// The exclusion zone is given in lines.
+void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop) {
+    SendMsg(2403, caretPolicy, caretSlop);
+}
+
 // Start notifying the container of all key presses and commands.
 void wxStyledTextCtrl::StartRecord() {
     SendMsg(3001, 0, 0);
@@ -2104,6 +2148,10 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
         evt.SetY(scn.y);
         break;
 
+    case SCN_ZOOM:
+        evt.SetEventType(wxEVT_STC_ZOOM);
+        break;
+
     default:
         return;
     }
index 6d9898f2314c740c8f6665d17eb2ea4bdf993bc1..3e1b761faf97ffd7422f621e5c5683e2dbe3e401 100644 (file)
@@ -81,6 +81,7 @@ DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
+DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
 
 
 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -117,7 +118,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
 
 #ifdef LINK_LEXERS
 // forces the linking of the lexer modules
-int wxForceScintillaLexers();
+int Scintilla_LinkLexers();
 #endif
 
 //----------------------------------------------------------------------
@@ -134,7 +135,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
               wxDefaultValidator, name)
 {
 #ifdef LINK_LEXERS
-    wxForceScintillaLexers();
+    Scintilla_LinkLexers();
 #endif
     m_swx = new ScintillaWX(this);
     m_stopWatch.Start();
@@ -557,6 +558,10 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
         evt.SetY(scn.y);
         break;
 
+    case SCN_ZOOM:
+        evt.SetEventType(wxEVT_STC_ZOOM);
+        break;
+
     default:
         return;
     }
index 56c23d87d5115b2446418adaaf7f4155bacd80c4..157a7bfc236f7b9da55715f68eaaf8d829d8f5e9 100644 (file)
@@ -338,6 +338,7 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG,              1669)
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER,               1670)
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP,                 1671)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM,                    1672)
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
@@ -363,6 +364,7 @@ END_DECLARE_EVENT_TYPES()
         wxEVT_STC_START_DRAG,
         wxEVT_STC_DRAG_OVER,
         wxEVT_STC_DO_DROP,
+        wxEVT_STC_ZOOM,
     };
 #endif
 
@@ -393,6 +395,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 #define EVT_STC_START_DRAG(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #define EVT_STC_DRAG_OVER(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #define EVT_STC_DO_DROP(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP,               id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn)                    DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM,                  id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #endif
 
 //----------------------------------------------------------------------
index 64061f23fcaab7049df9bde5fb60d0d8c5a41501..92f4484c5b3027272ab6c205f053dfc65fafbe65 100644 (file)
@@ -44,7 +44,7 @@
 #define wxSTC_OPTIONAL_START 3000
 #define wxSTC_LEXER_START 4000
 
-// Redoes the next action on the undo history
+// Redoes the next action on the undo history.
 #define wxSTC_CMD_REDO 2011
 
 // Select all the text in the document.
@@ -70,7 +70,7 @@
 #define wxSTC_MARK_MINUS 7
 #define wxSTC_MARK_PLUS 8
 
-// Shapes used for outlining column
+// Shapes used for outlining column.
 #define wxSTC_MARK_VLINE 9
 #define wxSTC_MARK_LCORNER 10
 #define wxSTC_MARK_TCORNER 11
 #define wxSTC_MARK_CIRCLEMINUS 20
 #define wxSTC_MARK_CIRCLEMINUSCONNECTED 21
 
-// Invisible mark that only sets the line background color
+// Invisible mark that only sets the line background color.
 #define wxSTC_MARK_BACKGROUND 22
 #define wxSTC_MARK_CHARACTER 10000
 
-// Markers used for outlining column
+// Markers used for outlining column.
 #define wxSTC_MARKNUM_FOLDEREND 25
 #define wxSTC_MARKNUM_FOLDEROPENMID 26
 #define wxSTC_MARKNUM_FOLDERMIDTAIL 27
 // Delete the selection or if no selection, the character before the caret.
 #define wxSTC_CMD_DELETEBACK 2326
 
-// If selection is empty or all on one line replace the selection with a tab
-// character.
+// If selection is empty or all on one line replace the selection with a tab character.
 // If more than one line selected, indent the lines.
 #define wxSTC_CMD_TAB 2327
 
 #define wxSTC_CMD_LINESCROLLUP 2343
 
 // Delete the selection or if no selection, the character before the caret.
-// Will not delete the chraacter before at the start of a line.
+// Will not delete the character before at the start of a line.
 #define wxSTC_CMD_DELETEBACKNOTLINE 2344
 #define wxSTC_EDGE_NONE 0
 #define wxSTC_EDGE_LINE 1
 #define wxSTC_EDGE_BACKGROUND 2
+#define wxSTC_CURSORNORMAL -1
+#define wxSTC_CURSORWAIT 3
 
-// 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
+// Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
+#define wxSTC_VISIBLE_SLOP 0x01
+#define wxSTC_VISIBLE_STRICT 0x04
 
-// Value not used
-#define wxSTC_CARET_CENTER 0x02
+// Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+// If CARET_SLOP is set, we can define a slop value: caretSlop.
+// This value defines an unwanted zone (UZ) where the caret is... unwanted.
+// This zone is defined as a number of pixels near the vertical margins,
+// and as a number of lines near the horizontal margins.
+// By keeping the caret away from the edges, it is seen within its context,
+// so it is likely that the identifier that the caret is on can be completely seen,
+// and that the current line is seen with some of the lines following it which are
+// often dependent on that line.
+#define wxSTC_CARET_SLOP 0x01
 
-// If CARET_SLOP also set then reposition whenever outside slop border
-// If CARET_SLOP not set then recentre even when visible
+// If CARET_STRICT is set, the policy is enforced... strictly.
+// The caret is centred on the display if slop is not set,
+// and cannot go in the UZ if slop is set.
 #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_JUMPS is set, the display is moved more energetically
+// so the caret can move in the same direction longer before the policy is applied again.
+#define wxSTC_CARET_JUMPS 0x10
 
-// 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
+// If CARET_EVEN is not set, instead of having symmetrical UZs,
+// the left and bottom UZs are extended up to right and top UZs respectively.
+// This way, we favour the displaying of useful information: the begining of lines,
+// where most code reside, and the lines after the caret, eg. the body of a function.
+#define wxSTC_CARET_EVEN 0x08
 
 // Notifications
-// Type of modification and the action which caused the modification
+// 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_BEFOREDELETE 0x800
 #define wxSTC_MODEVENTMASKALL 0xF77
 
-// Symbolic key codes and modifier flags
-// ASCII and other printable characters below 256
-// Extended keys above 300
+// 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_LEX_PHP 30
 #define wxSTC_LEX_BAAN 31
 #define wxSTC_LEX_MATLAB 32
+#define wxSTC_LEX_SCRIPTOL 33
 
 // When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
 // value assigned in sequence from SCLEX_AUTOMATIC+1.
 #define wxSTC_C_COMMENTDOCKEYWORD 17
 #define wxSTC_C_COMMENTDOCKEYWORDERROR 18
 
-// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
-#define wxSTC_B_DEFAULT 0
-#define wxSTC_B_COMMENT 1
-#define wxSTC_B_NUMBER 2
-#define wxSTC_B_KEYWORD 3
-#define wxSTC_B_STRING 4
-#define wxSTC_B_PREPROCESSOR 5
-#define wxSTC_B_OPERATOR 6
-#define wxSTC_B_IDENTIFIER 7
-#define wxSTC_B_DATE 8
-
 // Lexical states for SCLEX_HTML, SCLEX_XML
 #define wxSTC_H_DEFAULT 0
 #define wxSTC_H_TAG 1
 #define wxSTC_PL_STRING_QR 29
 #define wxSTC_PL_STRING_QW 30
 
+// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
+#define wxSTC_B_DEFAULT 0
+#define wxSTC_B_COMMENT 1
+#define wxSTC_B_NUMBER 2
+#define wxSTC_B_KEYWORD 3
+#define wxSTC_B_STRING 4
+#define wxSTC_B_PREPROCESSOR 5
+#define wxSTC_B_OPERATOR 6
+#define wxSTC_B_IDENTIFIER 7
+#define wxSTC_B_DATE 8
+
+// Lexical states for SCLEX_PROPERTIES
+#define wxSTC_PROPS_DEFAULT 0
+#define wxSTC_PROPS_COMMENT 1
+#define wxSTC_PROPS_SECTION 2
+#define wxSTC_PROPS_ASSIGNMENT 3
+#define wxSTC_PROPS_DEFVAL 4
+
 // Lexical states for SCLEX_LATEX
 #define wxSTC_L_DEFAULT 0
 #define wxSTC_L_COMMAND 1
 #define wxSTC_ERR_PERL 6
 #define wxSTC_ERR_NET 7
 #define wxSTC_ERR_LUA 8
+#define wxSTC_ERR_CTAG 9
 #define wxSTC_ERR_DIFF_CHANGED 10
 #define wxSTC_ERR_DIFF_ADDITION 11
 #define wxSTC_ERR_DIFF_DELETION 12
 #define wxSTC_MAKE_TARGET 5
 #define wxSTC_MAKE_IDEOL 9
 
-// Lexical states for the SCLEX_CONF (Apache Configuration Files Lexer)
+// Lexical states for SCLEX_DIFF
+#define wxSTC_DIFF_DEFAULT 0
+#define wxSTC_DIFF_COMMENT 1
+#define wxSTC_DIFF_COMMAND 2
+#define wxSTC_DIFF_HEADER 3
+#define wxSTC_DIFF_POSITION 4
+#define wxSTC_DIFF_DELETED 5
+#define wxSTC_DIFF_ADDED 6
+
+// Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
 #define wxSTC_CONF_DEFAULT 0
 #define wxSTC_CONF_COMMENT 1
 #define wxSTC_CONF_NUMBER 2
 #define wxSTC_CONF_IP 8
 #define wxSTC_CONF_DIRECTIVE 9
 
-// Avenue
+// Lexical states for SCLEX_AVE, Avenue
 #define wxSTC_AVE_DEFAULT 0
 #define wxSTC_AVE_COMMENT 1
 #define wxSTC_AVE_NUMBER 2
 #define wxSTC_EIFFEL_IDENTIFIER 7
 #define wxSTC_EIFFEL_STRINGEOL 8
 
-// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
+// Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
 #define wxSTC_NNCRONTAB_DEFAULT 0
 #define wxSTC_NNCRONTAB_COMMENT 1
 #define wxSTC_NNCRONTAB_TASK 2
 #define wxSTC_MATLAB_OPERATOR 6
 #define wxSTC_MATLAB_IDENTIFIER 7
 
+// Lexical states for SCLEX_SCRIPTOL
+#define wxSTC_SCRIPTOL_DEFAULT 0
+#define wxSTC_SCRIPTOL_COMMENT 1
+#define wxSTC_SCRIPTOL_COMMENTLINE 2
+#define wxSTC_SCRIPTOL_COMMENTDOC 3
+#define wxSTC_SCRIPTOL_NUMBER 4
+#define wxSTC_SCRIPTOL_WORD 5
+#define wxSTC_SCRIPTOL_STRING 6
+#define wxSTC_SCRIPTOL_CHARACTER 7
+#define wxSTC_SCRIPTOL_UUID 8
+#define wxSTC_SCRIPTOL_PREPROCESSOR 9
+#define wxSTC_SCRIPTOL_OPERATOR 10
+#define wxSTC_SCRIPTOL_IDENTIFIER 11
+#define wxSTC_SCRIPTOL_STRINGEOL 12
+#define wxSTC_SCRIPTOL_VERBATIM 13
+#define wxSTC_SCRIPTOL_REGEX 14
+#define wxSTC_SCRIPTOL_COMMENTLINEDOC 15
+#define wxSTC_SCRIPTOL_WORD2 16
+#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORD 17
+#define wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
+#define wxSTC_SCRIPTOL_COMMENTBASIC 19
+
 // END of generated section
 //----------------------------------------------------------------------
 
@@ -845,37 +890,37 @@ public:
 //       and regenerate
 
 
-    // Add text to the document
+    // Add text to the document.
     void AddText(const wxString& text);
 
-    // Add array of cells to document
+    // Add array of cells to document.
     void AddStyledText(const wxMemoryBuffer& data);
 
-    // Insert string at a position
+    // Insert string at a position.
     void InsertText(int pos, const wxString& text);
 
-    // Delete all text in the document
+    // Delete all text in the document.
     void ClearAll();
 
-    // Set all style bytes to 0, remove all folding information
+    // Set all style bytes to 0, remove all folding information.
     void ClearDocumentStyle();
 
-    // The number of characters in the document
+    // The number of characters in the document.
     int GetLength();
 
-    // Returns the character byte at the position
+    // Returns the character byte at the position.
     int GetCharAt(int pos);
 
-    // Returns the position of the caret
+    // Returns the position of the caret.
     int GetCurrentPos();
 
-    // Returns the position of the opposite end of the selection to the caret
+    // Returns the position of the opposite end of the selection to the caret.
     int GetAnchor();
 
-    // Returns the style byte at the position
+    // Returns the style byte at the position.
     int GetStyleAt(int pos);
 
-    // Redoes the next action on the undo history
+    // Redoes the next action on the undo history.
     void Redo();
 
     // Choose between collecting actions into the undo
@@ -892,10 +937,10 @@ public:
     // Retrieve a buffer of cells.
     wxMemoryBuffer GetStyledText(int startPos, int endPos);
 
-    // Are there any redoable actions in the undo history.
+    // Are there any redoable actions in the undo history?
     bool CanRedo();
 
-    // Retrieve the line number at which a particular marker is located
+    // Retrieve the line number at which a particular marker is located.
     int MarkerLineFromHandle(int handle);
 
     // Delete a marker.
@@ -949,23 +994,21 @@ public:
     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.
+    // 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.
+    // 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.
+    // 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.
@@ -989,10 +1032,10 @@ public:
     // Add a marker to a line, returning an ID which can be used to find or delete the marker.
     int MarkerAdd(int line, int markerNumber);
 
-    // Delete a marker from a line
+    // Delete a marker from a line.
     void MarkerDelete(int line, int markerNumber);
 
-    // Delete all markers with a particular number from all lines
+    // 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.
@@ -1094,8 +1137,7 @@ public:
     // 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.
+    // 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.
@@ -1117,8 +1159,8 @@ public:
     // 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
+    // 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);
 
@@ -1137,7 +1179,7 @@ public:
     // Is the background of the line containing the caret in a different colour?
     bool GetCaretLineVisible();
 
-    // Dsplay the background of the line containing the caret in a different colour.
+    // 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.
@@ -1161,8 +1203,7 @@ public:
     // Is there an auto-completion list visible?
     bool AutoCompActive();
 
-    // Retrieve the position of the caret when the auto-completion list was
-    // displayed.
+    // 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.
@@ -1171,8 +1212,8 @@ public:
     // 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.
+    // 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.
@@ -1207,16 +1248,18 @@ public:
     // 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
+    // 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
+    // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
     bool AutoCompGetAutoHide();
 
-    // Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+    // Set whether or not autocompletion deletes any word characters
+    // after the inserted text upon completion.
     void AutoCompSetDropRestOfWord(bool dropRestOfWord);
 
-    // Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+    // Retrieve whether or not autocompletion deletes any word characters
+    // after the inserted text upon completion.
     bool AutoCompGetDropRestOfWord();
 
     // Set the number of spaces used for one level of indentation.
@@ -1305,7 +1348,7 @@ public:
     // Find some text in the document.
     int FindText(int minPos, int maxPos, const wxString& text, int flags=0);
 
-    // On Windows will draw the document into a display context such as a printer.
+    // On Windows, will draw the document into a display context such as a printer.
     int FormatRange(bool   doDraw,
                                int    startPos,
                                int    endPos,
@@ -1371,7 +1414,7 @@ public:
     // Will a paste succeed?
     bool CanPaste();
 
-    // Are there any undoable actions in the undo history.
+    // Are there any undoable actions in the undo history?
     bool CanUndo();
 
     // Delete the undo history.
@@ -1401,16 +1444,16 @@ public:
     // Retrieve the number of characters in the document.
     int GetTextLength();
 
-    // Set to overtype (true) or insert mode
+    // Set to overtype (true) or insert mode.
     void SetOvertype(bool overtype);
 
     // Returns true if overtype mode is active otherwise false is returned.
     bool GetOvertype();
 
-    // Set the width of the insert mode caret
+    // Set the width of the insert mode caret.
     void SetCaretWidth(int pixelWidth);
 
-    // Returns the width of the insert mode caret
+    // Returns the width of the insert mode caret.
     int GetCaretWidth();
 
     // Sets the position that starts the target which is used for updating the
@@ -1445,10 +1488,10 @@ public:
     // 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
+    // Set the search flags used by SearchInTarget.
     void SetSearchFlags(int flags);
 
-    // Get the search flags used by SearchInTarget
+    // Get the search flags used by SearchInTarget.
     int GetSearchFlags();
 
     // Show a call tip containing a definition near position pos.
@@ -1510,53 +1553,76 @@ public:
     // Ensure a particular line is visible by expanding any header line hiding it.
     void EnsureVisible(int line);
 
-    // Set some debugging options for folding
+    // 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
+    // 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
+    // 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
+    // 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
+    // Retrieve the time the mouse must sit still to generate a mouse dwell event.
     int GetMouseDwellTime();
 
-    // Get position of start of word
+    // Get position of start of word.
     int WordStartPosition(int pos, bool onlyWordCharacters);
 
-    // Get position of end of word
+    // Get position of end of word.
     int WordEndPosition(int pos, bool onlyWordCharacters);
 
-    // Sets whether text is word wrapped
+    // Sets whether text is word wrapped.
     void SetWrapMode(int mode);
 
-    // Retrieve whether text is word wrapped
+    // Retrieve whether text is word wrapped.
     int GetWrapMode();
 
-    // Sets the degree of caching of layout information
+    // Sets the degree of caching of layout information.
     void SetLayoutCache(int mode);
 
-    // Retrieve the degree of caching of layout information
+    // Retrieve the degree of caching of layout information.
     int GetLayoutCache();
 
-    // Move the caret inside current view if it's not there already
+    // Sets the document width assumed for scrolling.
+    void SetScrollWidth(int pixelWidth);
+
+    // Retrieve the document width assumed for scrolling.
+    int GetScrollWidth();
+
+    // Measure the pixel width of some text in a particular style.
+    // Nul terminated text argument.
+    // Does not handle tab or control characters.
+    int TextWidth(int style, const wxString& text);
+
+    // Sets the scroll range so that maximum scroll position has
+    // the last line at the bottom of the view (default).
+    // Setting this to false allows scrolling one page below the last line.
+    void SetEndAtLastLine(bool endAtLastLine);
+
+    // Retrieve whether the maximum scroll position has the last
+    // line at the bottom of the view.
+    int GetEndAtLastLine();
+
+    // Retrieve the height of a particular line of text in pixels.
+    int TextHeight(int line);
+
+    // 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.
+    // How many characters are on a line, not including end of line characters?
     int LineLength(int line);
 
     // Highlight the characters at two positions.
@@ -1568,10 +1634,10 @@ public:
     // Find the position of a matching brace or INVALID_POSITION if no match.
     int BraceMatch(int pos);
 
-    // Are the end of line characters visible.
+    // Are the end of line characters visible?
     bool GetViewEOL();
 
-    // Make the end of line characters visible or invisible
+    // Make the end of line characters visible or invisible.
     void SetViewEOL(bool visible);
 
     // Retrieve a pointer to the document object.
@@ -1614,9 +1680,6 @@ public:
     // 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.
-    void SetCaretPolicy(int caretPolicy, int caretSlop);
-
     // Retrieves the number of lines completely visible.
     int LinesOnScreen();
 
@@ -1624,7 +1687,7 @@ public:
     // the wrong mouse button.
     void UsePopUp(bool allowPopUp);
 
-    // Is the selection a rectangular. The alternative is the more common stream selection.
+    // Is the selection 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.
@@ -1647,62 +1710,73 @@ public:
     // Get which document modification events are sent to the container.
     int GetModEventMask();
 
-    // Change internal focus flag
+    // Change internal focus flag.
     void SetSTCFocus(bool focus);
 
-    // Get internal focus flag
+    // Get internal focus flag.
     bool GetSTCFocus();
 
-    // Change error status - 0 = OK
+    // Change error status - 0 = OK.
     void SetStatus(int statusCode);
 
-    // Get error status
+    // Get error status.
     int GetStatus();
 
-    // Set whether the mouse is captured when its button is pressed
+    // Set whether the mouse is captured when its button is pressed.
     void SetMouseDownCaptures(bool captures);
 
-    // Get whether mouse gets captured
+    // Get whether mouse gets captured.
     bool GetMouseDownCaptures();
 
-    // Sets the cursor to one of the SC_CURSOR* values
+    // Sets the cursor to one of the SC_CURSOR* values.
     void SetCursor(int cursorType);
 
-    // Get cursor type
+    // Get cursor type.
     int GetCursor();
 
     // Change the way control characters are displayed:
-    // If symbol is < 32, keep the drawn way, else, use the given character
+    // If symbol is < 32, keep the drawn way, else, use the given character.
     void SetControlCharSymbol(int symbol);
 
-    // Get the way control characters are displayed
+    // Get the way control characters are displayed.
     int GetControlCharSymbol();
 
-    // Move to the previous change in capitalistion
+    // Move to the previous change in capitalisation.
     void WordPartLeft();
 
-    // Move to the previous change in capitalistion extending selection to new caret position.
+    // Move to the previous change in capitalisation extending selection
+    // to new caret position.
     void WordPartLeftExtend();
 
-    // Move to the change next in capitalistion
+    // Move to the change next in capitalisation.
     void WordPartRight();
 
-    // Move to the next change in capitalistion extending selection to new caret position.
+    // Move to the next change in capitalisation 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.
+    // Set the way the display area is determined when a particular line
+    // is to be moved to by Find, FindNext, GotoLine, etc.
     void SetVisiblePolicy(int visiblePolicy, int visibleSlop);
 
-    // Delete back from the current position to the start of the line
+    // 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
+    // Delete forwards from the current position to the end of the line.
     void DelLineRight();
 
-    // Get and Set the xOffset (ie, horizonal scroll position)
+    // Get and Set the xOffset (ie, horizonal scroll position).
     void SetXOffset(int newOffset);
     int GetXOffset();
 
+    // Set the way the caret is kept visible when going sideway.
+    // The exclusion zone is given in pixels.
+    void SetXCaretPolicy(int caretPolicy, int caretSlop);
+
+    // Set the way the line the caret is on is kept visible.
+    // The exclusion zone is given in lines.
+    void SetYCaretPolicy(int caretPolicy, int caretSlop);
+
     // Start notifying the container of all key presses and commands.
     void StartRecord();
 
@@ -1986,6 +2060,7 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG,              1669)
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER,               1670)
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP,                 1671)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM,                    1672)
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
@@ -2011,6 +2086,7 @@ END_DECLARE_EVENT_TYPES()
         wxEVT_STC_START_DRAG,
         wxEVT_STC_DRAG_OVER,
         wxEVT_STC_DO_DROP,
+        wxEVT_STC_ZOOM,
     };
 #endif
 
@@ -2041,6 +2117,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 #define EVT_STC_START_DRAG(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #define EVT_STC_DRAG_OVER(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #define EVT_STC_DO_DROP(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP,               id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn)                    DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM,                  id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #endif
 
 //----------------------------------------------------------------------
index 8edc3bf5e762385dc47ec701af4e0c0f7a7e51e2..8abff4b97dbfccbb0d3c20cbb4ac135c8cd99127 100644 (file)
@@ -906,6 +906,15 @@ long Platform::SendScintilla(WindowID w,
     return stc->SendMsg(msg, wParam, lParam);
 }
 
+long Platform::SendScintillaPointer(WindowID w,
+                                    unsigned int msg,
+                                    unsigned long wParam,
+                                    void *lParam) {
+
+    wxStyledTextCtrl* stc = (wxStyledTextCtrl*)w;
+    return stc->SendMsg(msg, wParam, (long)lParam);
+}
+
 
 // These are utility functions not really tied to a platform
 
index 5a256340edffe8d62a9b5b6474e5bb6a445fee7c..506d56ffc20d55fa8584a30c291118e9a530e46a 100644 (file)
 #include "wx/stc/stc.h"
 #include "PlatWX.h"
 
-
-//----------------------------------------------------------------------
-
-const int H_SCROLL_MAX  = 4000;
-const int H_SCROLL_STEP = 20;
-const int H_SCROLL_PAGE = 200;
-
 //----------------------------------------------------------------------
 // Helper classes
 
@@ -265,10 +258,12 @@ void ScintillaWX::SetHorizontalScrollPos() {
     }
 }
 
+const int H_SCROLL_STEP = 20;
 
 bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
     bool modified = false;
 
+    // Check the vertical scrollbar
     if (stc->m_vScrollBar == NULL) {  // Use built-in scrollbar
         int  sbMax    = stc->GetScrollRange(wxVERTICAL);
         int  sbThumb  = stc->GetScrollThumb(wxVERTICAL);
@@ -289,24 +284,40 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
     }
 
 
-    if (horizontalScrollBarVisible) {
-        if (stc->m_hScrollBar == NULL) {  // Use built-in scrollbar
-            int sbMax    = stc->GetScrollRange(wxHORIZONTAL);
-            int sbThumb  = stc->GetScrollThumb(wxHORIZONTAL);
-            if ((sbMax != H_SCROLL_MAX) || (sbThumb != H_SCROLL_STEP)) {
-                stc->SetScrollbar(wxHORIZONTAL, 0, H_SCROLL_STEP, H_SCROLL_MAX);
-                modified = true;
+    // Check the horizontal scrollbar
+    PRectangle rcText = GetTextRectangle();
+    int horizEnd = scrollWidth;
+    if (horizEnd < 0)
+        horizEnd = 0;
+    if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
+        horizEnd = 0;
+    int pageWidth = rcText.Width();
+
+    if (stc->m_hScrollBar == NULL) {  // Use built-in scrollbar
+        int sbMax    = stc->GetScrollRange(wxHORIZONTAL);
+        int sbThumb  = stc->GetScrollThumb(wxHORIZONTAL);
+        int sbPos    = stc->GetScrollPos(wxHORIZONTAL);
+        if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
+            stc->SetScrollbar(wxHORIZONTAL, 0, pageWidth, horizEnd);
+            modified = true;
+            if (scrollWidth < pageWidth) {
+                HorizontalScrollTo(0);
             }
         }
-        else { // otherwise use the one that's been given to us
-            int  sbMax    = stc->m_hScrollBar->GetRange();
-            int  sbPage   = stc->m_hScrollBar->GetPageSize();
-            if ((sbMax != H_SCROLL_MAX) || (sbPage != H_SCROLL_STEP)) {
-                stc->m_hScrollBar->SetScrollbar(0, H_SCROLL_STEP, H_SCROLL_MAX, H_SCROLL_STEP);
-                modified = true;
+    }
+    else { // otherwise use the one that's been given to us
+        int sbMax    = stc->m_hScrollBar->GetRange();
+        int sbThumb  = stc->m_hScrollBar->GetPageSize();
+        int sbPos    = stc->m_hScrollBar->GetThumbPosition();
+        if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
+            stc->m_hScrollBar->SetScrollbar(0, pageWidth, horizEnd, pageWidth);
+            modified = true;
+            if (scrollWidth < pageWidth) {
+                HorizontalScrollTo(0);
             }
         }
     }
+
     return modified;
 }
 
@@ -443,18 +454,24 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
 
 void ScintillaWX::DoHScroll(int type, int pos) {
     int xPos = xOffset;
+    PRectangle rcText = GetTextRectangle();
+    int pageWidth = rcText.Width() * 2 / 3;
     if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
         xPos -= H_SCROLL_STEP;
     else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
         xPos += H_SCROLL_STEP;
     else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
-        xPos -= H_SCROLL_PAGE;
-    else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN)
-        xPos += H_SCROLL_PAGE;
+        xPos -= pageWidth;
+    else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN) {
+        xPos += pageWidth;
+        if (xPos > scrollWidth - rcText.Width()) {
+            xPos = scrollWidth - rcText.Width();
+        }
+    }
     else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
         xPos = 0;
     else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
-        xPos = H_SCROLL_MAX;
+        xPos = scrollWidth;
     else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
         xPos = pos;
 
index 3da52f8420ddf9b87657e49f3f37db9ab3d32fb4..8c30ad99e6840c900bcc43a2c3b81385d6c49360 100644 (file)
@@ -553,6 +553,12 @@ def processIface(iface, h_tmplt, cpp_tmplt, h_dest, cpp_dest):
         elif op == 'evt ':
             pass
 
+        elif op == 'enu ':
+            pass
+
+        elif op == 'lex ':
+            pass
+
         else:
             print '***** Unknown line type: ', line
 
index 32a294845c63af6b6164e5bb459784a3bdffeda7..3534249c036d54939102db4c83d8eca313c001f9 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.45
+The current version of the Scintilla code is 1.47
 
index 17c951067221fa0b246dab36e7ee9194da39d462..0b2c4baee25cb8a8bc1768adf22a05c9a5fe2358 100644 (file)
@@ -55,6 +55,7 @@ public:
        }
        void SetCodePage(int codePage_) { codePage = codePage_; }
 
+       virtual bool Match(int pos, const char *s)=0;
        virtual char StyleAt(int position)=0;
        virtual int GetLine(int position)=0;
        virtual int LineStart(int line)=0;
index fa427ff2eb0694ed3304bb47cc41ea05d4ec1606..df4e870c580f507203f57f61f2cc58a7af04a2fe 100644 (file)
@@ -19,15 +19,22 @@ protected:
        int language;
        LexerFunction fnLexer;
        LexerFunction fnFolder;
-       
+       const char * const * wordListDescriptions;
+
        static const LexerModule *base;
        static int nextLanguage;
 
 public:
        const char *languageName;
        LexerModule(int language_, LexerFunction fnLexer_, 
-               const char *languageName_=0, LexerFunction fnFolder_=0);
+               const char *languageName_=0, LexerFunction fnFolder_=0,
+               const char * const wordListDescriptions_[] = NULL);
        int GetLanguage() const { return language; }
+
+       // -1 is returned if no WordList information is available
+       int GetNumWordLists() const;
+       const char *GetWordListDescription(int index) const;
+
        virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
                   WordList *keywordlists[], Accessor &styler) const;
        virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,
index 0984ea66c7cf4ec59b29ee63254d5a5ae84aa131..1a8dfaa96e0cad7e1e2e6d66fb1cf81684b1ece7 100644 (file)
@@ -106,8 +106,8 @@ public:
                        (rc.top >= top) && (rc.bottom <= bottom);
        }
        bool Intersects(PRectangle other) {
-               return (right >= other.left) && (left <= other.right) &&
-                       (bottom >= other.top) && (top <= other.bottom);
+               return (right > other.left) && (left < other.right) &&
+                       (bottom > other.top) && (top < other.bottom);
        }
        int Width() { return right - left; }
        int Height() { return bottom - top; }
@@ -430,6 +430,8 @@ public:
        static bool IsKeyDown(int key);
        static long SendScintilla(
                WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
+       static long SendScintillaPointer(
+               WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0);
        static bool IsDBCSLeadByte(int codePage, char ch);
 
        // These are utility functions not really tied to a platform
index 2596349818b6293819d7ca2fe5e6264bbbb8decd..59588c62edc08fca5cfa351765eff3c5a1c258da 100644 (file)
@@ -76,10 +76,6 @@ public:
                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'));
 }
index df7fd43b5bfd5ecba4622b644f365b2709ea3895..6bfe50fccd1cc58cac58a500fccf4017cd964e48 100644 (file)
@@ -10,7 +10,7 @@
 
 // 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);
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
 bool EqualCaseInsensitive(const char *a, const char *b);
 
 // Define another string class.
@@ -22,13 +22,13 @@ bool EqualCaseInsensitive(const char *a, const char *b);
  *
  * 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.
+ * May have embedded zeroes as a result of @a substitute, but relies too heavily on C string
+ * functions to allow reliable manipulations of these strings, other than simple appends, etc.
  **/
 class SString {
 public:
        /** Type of string lengths (sizes) and positions (indexes). */
-       typedef unsigned int lenpos_t;
+       typedef size_t lenpos_t;
        /** Out of bounds value indicating that the string argument should be measured. */
        enum { measure_length=0xffffffffU};
 
@@ -63,7 +63,7 @@ private:
                }
                if (sSize > 0 && sSize_ <= sSize) {     // Does not allocate new buffer if the current is big enough
                        if (s && sSize_) {
-                               strncpy(s, sOther, sSize_);
+                               memcpy(s, sOther, sSize_);
                        }
                        s[sSize_] = '\0';
                        sLen = sSize_;
@@ -92,6 +92,7 @@ public:
                sSize = sLen = (s) ? strlen(s) : 0;
        }
        SString(const char *s_, lenpos_t first, lenpos_t last) : sizeGrowth(sizeGrowthDefault) {
+               // note: expects the "last" argument to point one beyond the range end (a la STL iterators)
                s = StringAllocate(s_ + first, last - first);
                sSize = sLen = (s) ? strlen(s) : 0;
        }
@@ -188,6 +189,27 @@ public:
                else
                        return '\0';
        }
+       SString substr(lenpos_t subPos, lenpos_t subLen=measure_length) const {
+               if (subPos >= sLen) {
+                       return SString();                                       // return a null string if start index is out of bounds
+               }
+               if ((subLen == measure_length) || (subPos + subLen > sLen)) {
+                       subLen = sLen - subPos;         // can't substr past end of source string
+               }
+               return SString(s, subPos, subPos + subLen);
+       }
+       SString &lowercase(lenpos_t subPos = 0, lenpos_t subLen=measure_length) {
+               if ((subLen == measure_length) || (subPos + subLen > sLen)) {
+                       subLen = sLen - subPos;         // don't apply past end of string
+               }
+               for (lenpos_t i = subPos; i < subPos + subLen; i++) {
+                       if (s[i] < 'A' || s[i] > 'Z')
+                               continue;
+                       else
+                               s[i] = static_cast<char>(s[i] - 'A' + 'a');
+               }
+               return *this;
+       }
        SString &append(const char *sOther, lenpos_t sLenOther=measure_length, char sep = '\0') {
                if (!sOther) {
                        return *this;
@@ -206,7 +228,7 @@ public:
                                s[sLen] = sep;
                                sLen++;
                        }
-                       strncpy(&s[sLen], sOther, sLenOther);
+                       memcpy(&s[sLen], sOther, sLenOther);
                        sLen += sLenOther;
                        s[sLen] = '\0';
                }
@@ -259,6 +281,13 @@ public:
                        sLen -= len;
                }
        }
+       SString &change(lenpos_t pos, char ch) {
+               if (pos >= sLen) {                                      // character changed must be in string bounds
+                       return *this;
+               }
+               *(s + pos) = ch;
+               return *this;
+       }
        /** Read an integral numeric value from the string. */
        int value() const {
                if (s)
@@ -266,7 +295,7 @@ public:
                else
                        return 0;
        }
-       int search(const char *sFind, lenpos_t start=0) {
+       int search(const char *sFind, lenpos_t start=0) const {
                if (start < sLen) {
                        const char *sFound = strstr(s + start, sFind);
                        if (sFound) {
@@ -325,7 +354,7 @@ public:
                }
                char *sNew = new char[len + 1];
                if (sNew) {
-                       strncpy(sNew, s, len);
+                       memcpy(sNew, s, len);
                        sNew[len] = '\0';
                }
                return sNew;
index fb77a702e0c4d75f381eab388d54500940d85298..a6066cd58519563197cee2a2054a67baa3e38d0e 100644 (file)
@@ -47,6 +47,7 @@
 #define SCLEX_PHP 30
 #define SCLEX_BAAN 31
 #define SCLEX_MATLAB 32
+#define SCLEX_SCRIPTOL 33
 #define SCLEX_AUTOMATIC 1000
 #define SCE_P_DEFAULT 0
 #define SCE_P_COMMENTLINE 1
 #define SCE_C_WORD2 16
 #define SCE_C_COMMENTDOCKEYWORD 17
 #define SCE_C_COMMENTDOCKEYWORDERROR 18
-#define SCE_B_DEFAULT 0
-#define SCE_B_COMMENT 1
-#define SCE_B_NUMBER 2
-#define SCE_B_KEYWORD 3
-#define SCE_B_STRING 4
-#define SCE_B_PREPROCESSOR 5
-#define SCE_B_OPERATOR 6
-#define SCE_B_IDENTIFIER 7
-#define SCE_B_DATE 8
 #define SCE_H_DEFAULT 0
 #define SCE_H_TAG 1
 #define SCE_H_TAGUNKNOWN 2
 #define SCE_PL_STRING_QX 28
 #define SCE_PL_STRING_QR 29
 #define SCE_PL_STRING_QW 30
+#define SCE_B_DEFAULT 0
+#define SCE_B_COMMENT 1
+#define SCE_B_NUMBER 2
+#define SCE_B_KEYWORD 3
+#define SCE_B_STRING 4
+#define SCE_B_PREPROCESSOR 5
+#define SCE_B_OPERATOR 6
+#define SCE_B_IDENTIFIER 7
+#define SCE_B_DATE 8
+#define SCE_PROPS_DEFAULT 0
+#define SCE_PROPS_COMMENT 1
+#define SCE_PROPS_SECTION 2
+#define SCE_PROPS_ASSIGNMENT 3
+#define SCE_PROPS_DEFVAL 4
 #define SCE_L_DEFAULT 0
 #define SCE_L_COMMAND 1
 #define SCE_L_TAG 2
 #define SCE_ERR_PERL 6
 #define SCE_ERR_NET 7
 #define SCE_ERR_LUA 8
+#define SCE_ERR_CTAG 9
 #define SCE_ERR_DIFF_CHANGED 10
 #define SCE_ERR_DIFF_ADDITION 11
 #define SCE_ERR_DIFF_DELETION 12
 #define SCE_MAKE_OPERATOR 4
 #define SCE_MAKE_TARGET 5
 #define SCE_MAKE_IDEOL 9
+#define SCE_DIFF_DEFAULT 0
+#define SCE_DIFF_COMMENT 1
+#define SCE_DIFF_COMMAND 2
+#define SCE_DIFF_HEADER 3
+#define SCE_DIFF_POSITION 4
+#define SCE_DIFF_DELETED 5
+#define SCE_DIFF_ADDED 6
 #define SCE_CONF_DEFAULT 0
 #define SCE_CONF_COMMENT 1
 #define SCE_CONF_NUMBER 2
 #define SCE_MATLAB_STRING 5
 #define SCE_MATLAB_OPERATOR 6
 #define SCE_MATLAB_IDENTIFIER 7
+#define SCE_SCRIPTOL_DEFAULT 0
+#define SCE_SCRIPTOL_COMMENT 1
+#define SCE_SCRIPTOL_COMMENTLINE 2
+#define SCE_SCRIPTOL_COMMENTDOC 3
+#define SCE_SCRIPTOL_NUMBER 4
+#define SCE_SCRIPTOL_WORD 5
+#define SCE_SCRIPTOL_STRING 6
+#define SCE_SCRIPTOL_CHARACTER 7
+#define SCE_SCRIPTOL_UUID 8
+#define SCE_SCRIPTOL_PREPROCESSOR 9
+#define SCE_SCRIPTOL_OPERATOR 10
+#define SCE_SCRIPTOL_IDENTIFIER 11
+#define SCE_SCRIPTOL_STRINGEOL 12
+#define SCE_SCRIPTOL_VERBATIM 13
+#define SCE_SCRIPTOL_REGEX 14
+#define SCE_SCRIPTOL_COMMENTLINEDOC 15
+#define SCE_SCRIPTOL_WORD2 16
+#define SCE_SCRIPTOL_COMMENTDOCKEYWORD 17
+#define SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
+#define SCE_SCRIPTOL_COMMENTBASIC 19
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
 
 #endif
index 99b3ee0b1a433b9ab2cfc1cd8ebdb2e1e1467fbf..4b8ccd23f458ea4a85ee4d349fa740035601781a 100644 (file)
@@ -21,8 +21,16 @@ int Scintilla_LinkLexers();
 // 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.
+#if _MSC_VER >= 1300
+#include <BaseTsd.h>
+#endif
+#ifdef MAXULONG_PTR
+typedef ULONG_PTR uptr_t;
+typedef LONG_PTR sptr_t;
+#else
 typedef unsigned long uptr_t;
 typedef long sptr_t;
+#endif
 
 typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
@@ -359,6 +367,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SC_CACHE_DOCUMENT 3
 #define SCI_SETLAYOUTCACHE 2272
 #define SCI_GETLAYOUTCACHE 2273
+#define SCI_SETSCROLLWIDTH 2274
+#define SCI_GETSCROLLWIDTH 2275
+#define SCI_TEXTWIDTH 2276
+#define SCI_SETENDATLASTLINE 2277
+#define SCI_GETENDATLASTLINE 2278
+#define SCI_TEXTHEIGHT 2279
 #define SCI_LINEDOWN 2300
 #define SCI_LINEDOWNEXTEND 2301
 #define SCI_LINEUP 2302
@@ -426,12 +440,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCI_SEARCHANCHOR 2366
 #define SCI_SEARCHNEXT 2367
 #define SCI_SEARCHPREV 2368
-#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
 #define SCI_SELECTIONISRECTANGLE 2372
@@ -465,6 +473,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCI_SETXOFFSET 2397
 #define SCI_GETXOFFSET 2398
 #define SCI_GRABFOCUS 2400
+#define CARET_SLOP 0x01
+#define CARET_STRICT 0x04
+#define CARET_JUMPS 0x10
+#define CARET_EVEN 0x08
+#define SCI_SETXCARETPOLICY 2402
+#define SCI_SETYCARETPOLICY 2403
 #define SCI_STARTRECORD 3001
 #define SCI_STOPRECORD 3002
 #define SCI_SETLEXER 4001
@@ -525,6 +539,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCN_URIDROPPED 2015
 #define SCN_DWELLSTART 2016
 #define SCN_DWELLEND 2017
+#define SCN_ZOOM 2018
 //--Autogenerated -- end of section automatically generated from Scintilla.iface
 
 // These structures are defined to be exactly the same shape as the Win32
@@ -598,6 +613,11 @@ struct SCNotification {
 
 #ifdef INCLUDE_DEPRECATED_FEATURES
 
+#define SCI_SETCARETPOLICY 2369
+#define CARET_CENTER 0x02
+#define CARET_XEVEN 0x08
+#define CARET_XJUMPS 0x10
+
 #define SCN_POSCHANGED 2012
 #define SCN_CHECKBRACE 2007
 
index c912cfd47ba804bc9169d66b89b0738ccefd13aa..f6e259efc661c6a64a0e7b15d496e1c306222fb1 100644 (file)
@@ -17,6 +17,9 @@
 ##     set -> a property set function
 ##     val -> definition of a constant
 ##     evt -> an event
+##     enu -> associate an enumeration with a set of vals with a prefix
+##     lex -> associate a lexer with the lexical classes it produces
+##
 ## All other feature names should be ignored. They may be defined in the future.
 ## A property may have a set function, a get function or both. Each will have
 ## "Get" or "Set" in their names and the corresponding name will have the obvious switch.
 ## The feature numbers are stable so features will not be renumbered.
 ## Features may be removed but they will go through a period of deprecation
 ## before removal which is signalled by moving them into the Deprecated category.
+##
+## enu has the syntax enu<ws><enumeration>=<prefix>[<ws><prefix>]* where all the val
+## features in this file starting with a given <prefix> are considered part of the
+## enumeration.
+##
+## lex has the syntax lex<ws><name>=<lexerVal><ws><prefix>[<ws><prefix>]*
+## where name is a reasonably capitalised (Python, XML) identifier or UI name,
+## lexerVal is the val used to specify the lexer, and the list of prefixes is similar
+## to enu. The name may not be the same as that used within the lexer so the lexerVal
+## should be used to tie these entities together.
 
 ## Types:
 ##     void
@@ -73,37 +86,37 @@ val SCI_START=2000
 val SCI_OPTIONAL_START=3000
 val SCI_LEXER_START=4000
 
-# Add text to the document
+# Add text to the document.
 fun void AddText=2001(int length, string text)
 
-# Add array of cells to document
+# Add array of cells to document.
 fun void AddStyledText=2002(int length, cells c)
 
-# Insert string at a position
+# Insert string at a position.
 fun void InsertText=2003(position pos, string text)
 
-# Delete all text in the document
+# Delete all text in the document.
 fun void ClearAll=2004(,)
 
-# Set all style bytes to 0, remove all folding information
+# Set all style bytes to 0, remove all folding information.
 fun void ClearDocumentStyle=2005(,)
 
-# The number of characters in the document
+# The number of characters in the document.
 get int GetLength=2006(,)
 
-# Returns the character byte at the position
+# Returns the character byte at the position.
 get int GetCharAt=2007(position pos,)
 
-# Returns the position of the caret
+# Returns the position of the caret.
 get position GetCurrentPos=2008(,)
 
-# Returns the position of the opposite end of the selection to the caret
+# Returns the position of the opposite end of the selection to the caret.
 get position GetAnchor=2009(,)
 
-# Returns the style byte at the position
+# Returns the style byte at the position.
 get int GetStyleAt=2010(position pos,)
 
-# Redoes the next action on the undo history
+# Redoes the next action on the undo history.
 fun void Redo=2011(,)
 
 # Choose between collecting actions into the undo
@@ -121,10 +134,10 @@ fun void SetSavePoint=2014(,)
 # Returns the number of bytes in the buffer not including terminating nulls.
 fun int GetStyledText=2015(, textrange tr)
 
-# Are there any redoable actions in the undo history.
+# Are there any redoable actions in the undo history?
 fun bool CanRedo=2016(,)
 
-# Retrieve the line number at which a particular marker is located
+# Retrieve the line number at which a particular marker is located.
 fun int MarkerLineFromHandle=2017(int handle,)
 
 # Delete a marker.
@@ -133,6 +146,7 @@ fun void MarkerDeleteHandle=2018(int handle,)
 # Is undo history being collected?
 get bool GetUndoCollection=2019(,)
 
+enu WhiteSpace=SCWS_
 val SCWS_INVISIBLE=0
 val SCWS_VISIBLEALWAYS=1
 val SCWS_VISIBLEAFTERINDENT=2
@@ -168,6 +182,7 @@ fun int GetCurLine=2027(int length, stringresult text)
 # Retrieve the position of the last correctly styled character.
 get position GetEndStyled=2028(,)
 
+enu EndOfLine=SC_EOL_
 val SC_EOL_CRLF=0
 val SC_EOL_CR=1
 val SC_EOL_LF=2
@@ -182,23 +197,21 @@ get int GetEOLMode=2030(,)
 set void SetEOLMode=2031(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.
+# The styling mask can be used to protect some bits in each styling byte from modification.
 fun void StartStyling=2032(position 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.
 fun void SetStyling=2033(int length, int style)
 
-# Is drawing done first into a buffer or direct to the screen.
+# Is drawing done first into a buffer or direct to the screen?
 get bool GetBufferedDraw=2034(,)
 
 # If drawing is buffered then each line of text is drawn into a bitmap buffer
 # before drawing it to the screen to avoid flicker.
 set void SetBufferedDraw=2035(bool buffered,)
 
-# Change the visible size of a tab to be a multiple of the width of a space
-# character.
+# Change the visible size of a tab to be a multiple of the width of a space character.
 set void SetTabWidth=2036(int tabWidth,)
 
 # Retrieve the visible size of a tab.
@@ -212,10 +225,11 @@ val SC_CP_UTF8=65001
 # The SC_CP_UTF8 value can be used to enter Unicode mode.
 set void SetCodePage=2037(int codePage,)
 
-# In palette mode, Scintilla uses the environments palette calls to display
+# In palette mode, Scintilla uses the environment's palette calls to display
 # more colours. This may lead to ugly displays.
 set void SetUsePalette=2039(bool usePalette,)
 
+enu MarkerSymbol=SC_MARK_
 val MARKER_MAX=31
 val SC_MARK_CIRCLE=0
 val SC_MARK_ROUNDRECT=1
@@ -227,7 +241,7 @@ val SC_MARK_ARROWDOWN=6
 val SC_MARK_MINUS=7
 val SC_MARK_PLUS=8
 
-# Shapes used for outlining column
+# Shapes used for outlining column.
 val SC_MARK_VLINE=9
 val SC_MARK_LCORNER=10
 val SC_MARK_TCORNER=11
@@ -242,12 +256,13 @@ val SC_MARK_CIRCLEPLUSCONNECTED=19
 val SC_MARK_CIRCLEMINUS=20
 val SC_MARK_CIRCLEMINUSCONNECTED=21
 
-# Invisible mark that only sets the line background color
+# Invisible mark that only sets the line background color.
 val SC_MARK_BACKGROUND=22
 
 val SC_MARK_CHARACTER=10000
 
-# Markers used for outlining column
+enu MarkerOutline=SC_MARKNUM_
+# Markers used for outlining column.
 val SC_MARKNUM_FOLDEREND=25
 val SC_MARKNUM_FOLDEROPENMID=26
 val SC_MARKNUM_FOLDERMIDTAIL=27
@@ -270,10 +285,10 @@ fun void MarkerSetBack=2042(int markerNumber, colour back)
 # Add a marker to a line, returning an ID which can be used to find or delete the marker.
 fun int MarkerAdd=2043(int line, int markerNumber)
 
-# Delete a marker from a line
+# Delete a marker from a line.
 fun void MarkerDelete=2044(int line, int markerNumber)
 
-# Delete all markers with a particular number from all lines
+# Delete all markers with a particular number from all lines.
 fun void MarkerDeleteAll=2045(int markerNumber,)
 
 # Get a bit mask of all the markers set on a line.
@@ -285,6 +300,7 @@ fun int MarkerNext=2047(int lineStart, int markerMask)
 # Find the previous line before lineStart that includes a marker in mask.
 fun int MarkerPrevious=2048(int lineStart, int markerMask)
 
+enu MarginType=SC_MARGIN_
 val SC_MARGIN_SYMBOL=0
 val SC_MARGIN_NUMBER=1
 
@@ -314,6 +330,7 @@ get bool GetMarginSensitiveN=2247(int margin,)
 
 # Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
 # Styles 38 and 39 are for future use.
+enu StylesCommon=STYLE_
 val STYLE_DEFAULT=32
 val STYLE_LINENUMBER=33
 val STYLE_BRACELIGHT=34
@@ -325,6 +342,7 @@ val STYLE_MAX=127
 
 # Character set identifiers are used in StyleSetCharacterSet.
 # The values are the same as the Windows *_CHARSET values.
+enu CharacterSet=SC_CHARSET_
 val SC_CHARSET_ANSI=0
 val SC_CHARSET_DEFAULT=1
 val SC_CHARSET_BALTIC=186
@@ -375,6 +393,7 @@ fun void StyleResetDefault=2058(,)
 # Set a style to be underlined or not.
 set void StyleSetUnderline=2059(int style, bool underline)
 
+enu CaseVisible=SC_CASE_
 val SC_CASE_MIXED=0
 val SC_CASE_UPPER=1
 val SC_CASE_LOWER=2
@@ -414,8 +433,7 @@ get int GetCaretPeriod=2075(,)
 # Get the time in milliseconds that the caret is on and off. 0 = steady on.
 set void SetCaretPeriod=2076(int periodMilliseconds,)
 
-# Set the set of characters making up words for when moving or selecting
-# by word.
+# Set the set of characters making up words for when moving or selecting by word.
 set void SetWordChars=2077(, string characters)
 
 # Start a sequence of actions that is undone and redone as a unit.
@@ -425,6 +443,7 @@ fun void BeginUndoAction=2078(,)
 # End a sequence of actions that is undone and redone as a unit.
 fun void EndUndoAction=2079(,)
 
+enu IndicatorStyle=INDIC_
 val INDIC_MAX=7
 val INDIC_PLAIN=0
 val INDIC_SQUIGGLE=1
@@ -448,8 +467,8 @@ set void IndicSetFore=2082(int indic, colour fore)
 # Retrieve the foreground colour of an indicator.
 get colour IndicGetFore=2083(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
+# 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.
 set void SetStyleBits=2090(int bits,)
 
@@ -468,7 +487,7 @@ get int GetMaxLineState=2094(,)
 # Is the background of the line containing the caret in a different colour?
 get bool GetCaretLineVisible=2095(,)
 
-# Dsplay the background of the line containing the caret in a different colour.
+# 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.
@@ -492,8 +511,7 @@ fun void AutoCCancel=2101(,)
 # Is there an auto-completion list visible?
 fun bool AutoCActive=2102(,)
 
-# Retrieve the position of the caret when the auto-completion list was
-# displayed.
+# Retrieve the position of the caret when the auto-completion list was displayed.
 fun position AutoCPosStart=2103(,)
 
 # User has selected an item so remove the list and insert the selection.
@@ -502,8 +520,8 @@ fun void AutoCComplete=2104(,)
 # Define a set of character that when typed cancel the auto-completion list.
 fun void AutoCStops=2105(, string 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.
+# Change the separator character in the string setting up an auto-completion list.
+# Default is space but can be changed if items contain space.
 set void AutoCSetSeparator=2106(int separatorCharacter,)
 
 # Retrieve the auto-completion list separator character.
@@ -538,16 +556,18 @@ 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 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
+# Retrieve whether or not autocompletion is hidden automatically when nothing matches.
 get bool AutoCGetAutoHide=2119(,)
 
-# Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+# Set whether or not autocompletion deletes any word characters
+# after the inserted text upon completion.
 set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,)
 
-# Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+# Retrieve whether or not autocompletion deletes any word characters
+# after the inserted text upon completion.
 get bool AutoCGetDropRestOfWord=2271(,)
 
 # Set the number of spaces used for one level of indentation.
@@ -630,6 +650,7 @@ set void SetPrintMagnification=2146(int magnification,)
 # Returns the print magnification.
 get int GetPrintMagnification=2147(,)
 
+enu PrintOption=SC_PRINT_
 # PrintColourMode - use same colours as screen.
 val SC_PRINT_NORMAL=0
 # PrintColourMode - invert the light value of each style for printing.
@@ -647,6 +668,7 @@ set void SetPrintColourMode=2148(int mode,)
 # Returns the print colour mode.
 get int GetPrintColourMode=2149(,)
 
+enu FindOption=SCFIND_
 val SCFIND_WHOLEWORD=2
 val SCFIND_MATCHCASE=4
 val SCFIND_WORDSTART=0x00100000
@@ -655,7 +677,7 @@ val SCFIND_REGEXP=0x00200000
 # Find some text in the document.
 fun position FindText=2150(int flags, findtext ft)
 
-# On Windows will draw the document into a display context such as a printer.
+# On Windows, will draw the document into a display context such as a printer.
 fun void FormatRange=2151(bool draw, formatrange fr)
 
 # Retrieve the line at the top of the display.
@@ -727,7 +749,7 @@ fun void Null=2172(,)
 # Will a paste succeed?
 fun bool CanPaste=2173(,)
 
-# Are there any undoable actions in the undo history.
+# Are there any undoable actions in the undo history?
 fun bool CanUndo=2174(,)
 
 # Delete the undo history.
@@ -765,16 +787,16 @@ get int GetDirectFunction=2184(,)
 # the function returned by GetDirectFunction.
 get int GetDirectPointer=2185(,)
 
-# Set to overtype (true) or insert mode
+# Set to overtype (true) or insert mode.
 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 the width of the insert mode caret.
 set void SetCaretWidth=2188(int pixelWidth,)
 
-# Returns the width of the insert mode caret
+# 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
@@ -809,10 +831,10 @@ fun int ReplaceTargetRE=2195(int length, string text)
 # 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 the search flags used by SearchInTarget.
 set void SetSearchFlags=2198(int flags,)
 
-# Get the search flags used by SearchInTarget
+# Get the search flags used by SearchInTarget.
 get int GetSearchFlags=2199(,)
 
 # Show a call tip containing a definition near position pos.
@@ -839,6 +861,7 @@ fun int VisibleFromDocLine=2220(int line,)
 # Find the document line of a display line taking hidden lines into account.
 fun int DocLineFromVisible=2221(int lineDisplay,)
 
+enu FoldLevel=SC_FOLDLEVEL
 val SC_FOLDLEVELBASE=0x400
 val SC_FOLDLEVELWHITEFLAG=0x1000
 val SC_FOLDLEVELHEADERFLAG=0x2000
@@ -879,20 +902,20 @@ fun void ToggleFold=2231(int line,)
 # Ensure a particular line is visible by expanding any header line hiding it.
 fun void EnsureVisible=2232(int line,)
 
-# Set some debugging options for folding
+# 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
+# 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
+# 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?
@@ -900,38 +923,63 @@ get bool GetBackSpaceUnIndents=2263(,)
 
 val SC_TIME_FOREVER=10000000
 
-# Sets the time the mouse must sit still to generate a mouse dwell event
+# 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
+# Retrieve the time the mouse must sit still to generate a mouse dwell event.
 get int GetMouseDwellTime=2265(,)
 
-# Get position of start of word
+# Get position of start of word.
 fun int WordStartPosition=2266(position pos, bool onlyWordCharacters)
 
-# Get position of end of word
+# Get position of end of word.
 fun int WordEndPosition=2267(position pos, bool onlyWordCharacters)
 
+enu Wrap=SC_WRAP_
 val SC_WRAP_NONE=0
 val SC_WRAP_WORD=1
 
-# Sets whether text is word wrapped
+# Sets whether text is word wrapped.
 set void SetWrapMode=2268(int mode,)
 
-# Retrieve whether text is word wrapped
+# Retrieve whether text is word wrapped.
 get int GetWrapMode=2269(,)
 
+enu LineCache=SC_CACHE_
 val SC_CACHE_NONE=0
 val SC_CACHE_CARET=1
 val SC_CACHE_PAGE=2
 val SC_CACHE_DOCUMENT=3
 
-# Sets the degree of caching of layout information
+# Sets the degree of caching of layout information.
 set void SetLayoutCache=2272(int mode,)
 
-# Retrieve the degree of caching of layout information
+# Retrieve the degree of caching of layout information.
 get int GetLayoutCache=2273(,)
 
+# Sets the document width assumed for scrolling.
+set void SetScrollWidth=2274(int pixelWidth,)
+
+# Retrieve the document width assumed for scrolling.
+get int GetScrollWidth=2275(,)
+
+# Measure the pixel width of some text in a particular style.
+# Nul terminated text argument.
+# Does not handle tab or control characters.
+fun int TextWidth=2276(int style, string text)
+
+# Sets the scroll range so that maximum scroll position has
+# the last line at the bottom of the view (default).
+# Setting this to false allows scrolling one page below the last line.
+set void SetEndAtLastLine=2277(bool endAtLastLine,)
+
+# Retrieve whether the maximum scroll position has the last
+# line at the bottom of the view.
+get int GetEndAtLastLine=2278(,)
+
+# Retrieve the height of a particular line of text in pixels.
+fun int TextHeight=2279(int line,)
+
 ## Start of key messages
 # Move caret down one line.
 fun void LineDown=2300(,)
@@ -1014,8 +1062,7 @@ fun void Cancel=2325(,)
 # Delete the selection or if no selection, the character before the caret.
 fun void DeleteBack=2326(,)
 
-# If selection is empty or all on one line replace the selection with a tab
-# character.
+# If selection is empty or all on one line replace the selection with a tab character.
 # If more than one line selected, indent the lines.
 fun void Tab=2327(,)
 
@@ -1069,17 +1116,17 @@ fun void LineScrollDown=2342(,)
 fun void LineScrollUp=2343(,)
 
 # Delete the selection or if no selection, the character before the caret.
-# Will not delete the chraacter before at the start of a line.
+# Will not delete the character before at the start of a line.
 fun void DeleteBackNotLine=2344(,)
 
-# Move the caret inside current view if it's not there already
+# 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.
+# How many characters are on a line, not including end of line characters?
 fun int LineLength=2350(int line,)
 
 # Highlight the characters at two positions.
-fun void BraceHighlight=2351(position pos1,position pos2)
+fun void BraceHighlight=2351(position pos1, position pos2)
 
 # Highlight the character at a position indicating there is no matching brace.
 fun void BraceBadLight=2352(position pos,)
@@ -1087,10 +1134,10 @@ fun void BraceBadLight=2352(position pos,)
 # Find the position of a matching brace or INVALID_POSITION if no match.
 fun position BraceMatch=2353(position pos,)
 
-# Are the end of line characters visible.
+# Are the end of line characters visible?
 get bool GetViewEOL=2355(,)
 
-# Make the end of line characters visible or invisible
+# Make the end of line characters visible or invisible.
 set void SetViewEOL=2356(bool visible,)
 
 # Retrieve a pointer to the document object.
@@ -1102,6 +1149,7 @@ set void SetDocPointer=2358(,int pointer)
 # Set which document modification events are sent to the container.
 set void SetModEventMask=2359(int mask,)
 
+enu EdgeVisualStyle=EDGE_
 val EDGE_NONE=0
 val EDGE_LINE=1
 val EDGE_BACKGROUND=2
@@ -1137,24 +1185,6 @@ fun int SearchNext=2367(int flags, string text)
 # 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
-# Value not used
-val CARET_CENTER=0x02
-# 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)
-
 # Retrieves the number of lines completely visible.
 get int LinesOnScreen=2370(,)
 
@@ -1162,7 +1192,7 @@ get int LinesOnScreen=2370(,)
 # the wrong mouse button.
 fun void UsePopUp=2371(bool allowPopUp,)
 
-# Is the selection a rectangular. The alternative is the more common stream selection.
+# Is the selection rectangular? The alternative is the more common stream selection.
 get bool SelectionIsRectangle=2372(,)
 
 # Set the zoom level. This number of points is added to the size of all fonts.
@@ -1182,63 +1212,99 @@ fun void ReleaseDocument=2377(, int doc)
 # Get which document modification events are sent to the container.
 get int GetModEventMask=2378(,)
 
-# Change internal focus flag
+# Change internal focus flag.
 set void SetFocus=2380(bool focus,)
-# Get internal focus flag
+# Get internal focus flag.
 get bool GetFocus=2381(,)
 
-# Change error status - 0 = OK
+# Change error status - 0 = OK.
 set void SetStatus=2382(int statusCode,)
-# Get error status
+# Get error status.
 get int GetStatus=2383(,)
 
-# Set whether the mouse is captured when its button is pressed
+# Set whether the mouse is captured when its button is pressed.
 set void SetMouseDownCaptures=2384(bool captures,)
-# Get whether mouse gets captured
+# Get whether mouse gets captured.
 get bool GetMouseDownCaptures=2385(,)
 
+enu CursorShape=SC_CURSOR
 val SC_CURSORNORMAL=-1
 val SC_CURSORWAIT=3
-# Sets the cursor to one of the SC_CURSOR* values
+# Sets the cursor to one of the SC_CURSOR* values.
 set void SetCursor=2386(int cursorType,)
-# Get cursor type
+# Get cursor type.
 get int GetCursor=2387(,)
 
 # Change the way control characters are displayed:
-# If symbol is < 32, keep the drawn way, else, use the given character
+# If symbol is < 32, keep the drawn way, else, use the given character.
 set void SetControlCharSymbol=2388(int symbol,)
-# Get the way control characters are displayed
+# Get the way control characters are displayed.
 get int GetControlCharSymbol=2389(,)
 
-# Move to the previous change in capitalistion
+# Move to the previous change in capitalisation.
 fun void WordPartLeft=2390(,)
-# Move to the previous change in capitalistion extending selection to new caret position.
+# Move to the previous change in capitalisation extending selection
+# to new caret position.
 fun void WordPartLeftExtend=2391(,)
-# Move to the change next in capitalistion
+# Move to the change next in capitalisation.
 fun void WordPartRight=2392(,)
-# Move to the next change in capitalistion extending selection to new caret position.
+# Move to the next change in capitalisation extending selection
+# to new caret position.
 fun void WordPartRightExtend=2393(,)
 
-# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy
+# 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.
+# Set the way the display area is determined when a particular line
+# is to be moved to by Find, FindNext, GotoLine, etc.
 fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop)
 
-# Delete back from the current position to the start of the line
+# 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
+# Delete forwards from the current position to the end of the line.
 fun void DelLineRight=2396(,)
 
-# Get and Set the xOffset (ie, horizonal scroll position)
+# Get and Set the xOffset (ie, horizonal scroll position).
 set void SetXOffset=2397(int newOffset,)
 get int GetXOffset=2398(,)
 
 # Set the focus to this Scintilla widget.
-# GTK+ Specific
+# GTK+ Specific.
 fun void GrabFocus=2400(,)
 
+enu CaretPolicy = CARET_
+# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
+# If CARET_SLOP is set, we can define a slop value: caretSlop.
+# This value defines an unwanted zone (UZ) where the caret is... unwanted.
+# This zone is defined as a number of pixels near the vertical margins,
+# and as a number of lines near the horizontal margins.
+# By keeping the caret away from the edges, it is seen within its context,
+# so it is likely that the identifier that the caret is on can be completely seen,
+# and that the current line is seen with some of the lines following it which are
+# often dependent on that line.
+val CARET_SLOP=0x01
+# If CARET_STRICT is set, the policy is enforced... strictly.
+# The caret is centred on the display if slop is not set,
+# and cannot go in the UZ if slop is set.
+val CARET_STRICT=0x04
+# If CARET_JUMPS is set, the display is moved more energetically
+# so the caret can move in the same direction longer before the policy is applied again.
+val CARET_JUMPS=0x10
+# If CARET_EVEN is not set, instead of having symmetrical UZs,
+# the left and bottom UZs are extended up to right and top UZs respectively.
+# This way, we favour the displaying of useful information: the begining of lines,
+# where most code reside, and the lines after the caret, eg. the body of a function.
+val CARET_EVEN=0x08
+
+# Set the way the caret is kept visible when going sideway.
+# The exclusion zone is given in pixels.
+fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop)
+
+# Set the way the line the caret is on is kept visible.
+# The exclusion zone is given in lines.
+fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop)
+
 # Start notifying the container of all key presses and commands.
 fun void StartRecord=3001(,)
 
@@ -1264,9 +1330,10 @@ set void SetKeyWords=4005(int keywordSet, string keyWords)
 set void SetLexerLanguage=4006(, string language)
 
 # Notifications
-# Type of modification and the action which caused the modification
+# 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_*.
+enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_LAST
 val SC_MOD_INSERTTEXT=0x1
 val SC_MOD_DELETETEXT=0x2
 val SC_MOD_CHANGESTYLE=0x4
@@ -1281,15 +1348,18 @@ val SC_MOD_BEFOREDELETE=0x800
 val SC_MODEVENTMASKALL=0xF77
 
 # For compatibility, these go through the COMMAND notification rather than NOTIFY
-# and have exactly the same values as the EN_* constants.
+# and should have had exactly the same values as the EN_* constants.
+# Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_*
+# As clients depend on these constants, this will not be changed.
 val SCEN_CHANGE=768
 val SCEN_SETFOCUS=512
 val SCEN_KILLFOCUS=256
 
-# Symbolic key codes and modifier flags
-# ASCII and other printable characters below 256
-# Extended keys above 300
+# Symbolic key codes and modifier flags.
+# ASCII and other printable characters below 256.
+# Extended keys above 300.
 
+enu Keys=SCK_
 val SCK_DOWN=300
 val SCK_UP=301
 val SCK_LEFT=302
@@ -1308,12 +1378,14 @@ val SCK_ADD=310
 val SCK_SUBTRACT=311
 val SCK_DIVIDE=312
 
+enu KeyMod=SCMOD_
 val SCMOD_SHIFT=1
 val SCMOD_CTRL=2
 val SCMOD_ALT=4
 
 ################################################
 # For SciLexer.h
+enu Lexer=SCLEX_
 val SCLEX_CONTAINER=0
 val SCLEX_NULL=1
 val SCLEX_PYTHON=2
@@ -1347,11 +1419,14 @@ val SCLEX_ASP=29
 val SCLEX_PHP=30
 val SCLEX_BAAN=31
 val SCLEX_MATLAB=32
+val SCLEX_SCRIPTOL=33
 
 # 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
+lex Python=SCLEX_PYTHON SCE_P_
+lex Ruby=SCLEX_RUBY SCE_P_
 val SCE_P_DEFAULT=0
 val SCE_P_COMMENTLINE=1
 val SCE_P_NUMBER=2
@@ -1367,6 +1442,11 @@ val SCE_P_IDENTIFIER=11
 val SCE_P_COMMENTBLOCK=12
 val SCE_P_STRINGEOL=13
 # Lexical states for SCLEX_CPP
+lex Cpp=SCLEX_CPP SCE_C_
+lex SQL=SCLEX_SQL SCE_C_
+lex Pascal=SCLEX_PASCAL SCE_C_
+lex TCL=SCLEX_TCL SCE_C_
+lex BullAnt=SCLEX_BULLANT SCE_C_
 val SCE_C_DEFAULT=0
 val SCE_C_COMMENT=1
 val SCE_C_COMMENTLINE=2
@@ -1386,17 +1466,11 @@ val SCE_C_COMMENTLINEDOC=15
 val SCE_C_WORD2=16
 val SCE_C_COMMENTDOCKEYWORD=17
 val SCE_C_COMMENTDOCKEYWORDERROR=18
-# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
-val SCE_B_DEFAULT=0
-val SCE_B_COMMENT=1
-val SCE_B_NUMBER=2
-val SCE_B_KEYWORD=3
-val SCE_B_STRING=4
-val SCE_B_PREPROCESSOR=5
-val SCE_B_OPERATOR=6
-val SCE_B_IDENTIFIER=7
-val SCE_B_DATE=8
 # Lexical states for SCLEX_HTML, SCLEX_XML
+lex HTML=SCLEX_HTML SCE_H
+lex XML=SCLEX_XML SCE_H
+lex ASP=SCLEX_ASP SCE_H
+lex PHP=SCLEX_PHP SCE_H
 val SCE_H_DEFAULT=0
 val SCE_H_TAG=1
 val SCE_H_TAGUNKNOWN=2
@@ -1519,6 +1593,7 @@ val SCE_HPHP_COMMENTLINE=125
 val SCE_HPHP_HSTRING_VARIABLE=126
 val SCE_HPHP_OPERATOR=127
 # Lexical states for SCLEX_PERL
+lex Perl=SCLEX_PERL SCE_PL_
 val SCE_PL_DEFAULT=0
 val SCE_PL_ERROR=1
 val SCE_PL_COMMENTLINE=2
@@ -1549,13 +1624,34 @@ 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_VB, SCLEX_VBSCRIPT
+lex VB=SCLEX_VB SCE_B_
+lex VBScript=SCLEX_VBSCRIPT SCE_B_
+val SCE_B_DEFAULT=0
+val SCE_B_COMMENT=1
+val SCE_B_NUMBER=2
+val SCE_B_KEYWORD=3
+val SCE_B_STRING=4
+val SCE_B_PREPROCESSOR=5
+val SCE_B_OPERATOR=6
+val SCE_B_IDENTIFIER=7
+val SCE_B_DATE=8
+# Lexical states for SCLEX_PROPERTIES
+lex Properties=SCLEX_PROPERTIES SCE_PROPS_
+val SCE_PROPS_DEFAULT=0
+val SCE_PROPS_COMMENT=1
+val SCE_PROPS_SECTION=2
+val SCE_PROPS_ASSIGNMENT=3
+val SCE_PROPS_DEFVAL=4
 # Lexical states for SCLEX_LATEX
+lex LaTeX=SCLEX_LATEX SCE_L_
 val SCE_L_DEFAULT=0
 val SCE_L_COMMAND=1
 val SCE_L_TAG=2
 val SCE_L_MATH=3
 val SCE_L_COMMENT=4
 # Lexical states for SCLEX_LUA
+lex Lua=SCLEX_LUA SCE_LUA_
 val SCE_LUA_DEFAULT=0
 val SCE_LUA_COMMENT=1
 val SCE_LUA_COMMENTLINE=2
@@ -1575,6 +1671,7 @@ val SCE_LUA_WORD4=15
 val SCE_LUA_WORD5=16
 val SCE_LUA_WORD6=17
 # Lexical states for SCLEX_ERRORLIST
+lex ErrorList=SCLEX_ERRORLIST SCE_ERR_
 val SCE_ERR_DEFAULT=0
 val SCE_ERR_PYTHON=1
 val SCE_ERR_GCC=2
@@ -1584,11 +1681,13 @@ val SCE_ERR_BORLAND=5
 val SCE_ERR_PERL=6
 val SCE_ERR_NET=7
 val SCE_ERR_LUA=8
+val SCE_ERR_CTAG=9
 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
+lex Batch=SCLEX_BATCH SCE_BAT_
 val SCE_BAT_DEFAULT=0
 val SCE_BAT_COMMENT=1
 val SCE_BAT_WORD=2
@@ -1598,6 +1697,7 @@ val SCE_BAT_COMMAND=5
 val SCE_BAT_IDENTIFIER=6
 val SCE_BAT_OPERATOR=7
 # Lexical states for SCLEX_MAKEFILE
+lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_
 val SCE_MAKE_DEFAULT=0
 val SCE_MAKE_COMMENT=1
 val SCE_MAKE_PREPROCESSOR=2
@@ -1605,7 +1705,17 @@ 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)
+# Lexical states for SCLEX_DIFF
+lex Diff=SCLEX_DIFF SCE_DIFF_
+val SCE_DIFF_DEFAULT=0
+val SCE_DIFF_COMMENT=1
+val SCE_DIFF_COMMAND=2
+val SCE_DIFF_HEADER=3
+val SCE_DIFF_POSITION=4
+val SCE_DIFF_DELETED=5
+val SCE_DIFF_ADDED=6
+# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
+lex Conf=SCLEX_CONF SCE_CONF_
 val SCE_CONF_DEFAULT=0
 val SCE_CONF_COMMENT=1
 val SCE_CONF_NUMBER=2
@@ -1616,7 +1726,8 @@ val SCE_CONF_STRING=6
 val SCE_CONF_OPERATOR=7
 val SCE_CONF_IP=8
 val SCE_CONF_DIRECTIVE=9
-# Avenue
+# Lexical states for SCLEX_AVE, Avenue
+lex Avenue=SCLEX_AVE SCE_AVE_
 val SCE_AVE_DEFAULT=0
 val SCE_AVE_COMMENT=1
 val SCE_AVE_NUMBER=2
@@ -1629,6 +1740,7 @@ val SCE_AVE_STRINGEOL=8
 val SCE_AVE_IDENTIFIER=9
 val SCE_AVE_OPERATOR=10
 # Lexical states for SCLEX_ADA
+lex Ada=SCLEX_ADA SCE_ADA_
 val SCE_ADA_DEFAULT=0
 val SCE_ADA_COMMENT=1
 val SCE_ADA_NUMBER=2
@@ -1639,6 +1751,7 @@ val SCE_ADA_OPERATOR=6
 val SCE_ADA_IDENTIFIER=7
 val SCE_ADA_STRINGEOL=8
 # Lexical states for SCLEX_BAAN
+lex Baan=SCLEX_BAAN SCE_BAAN_
 val SCE_BAAN_DEFAULT=0
 val SCE_BAAN_COMMENT=1
 val SCE_BAAN_COMMENTDOC=2
@@ -1651,6 +1764,7 @@ val SCE_BAAN_IDENTIFIER=8
 val SCE_BAAN_STRINGEOL=9
 val SCE_BAAN_WORD2=10
 # Lexical states for SCLEX_LISP
+lex Lisp=SCLEX_LISP SCE_LISP_
 val SCE_LISP_DEFAULT=0
 val SCE_LISP_COMMENT=1
 val SCE_LISP_NUMBER=2
@@ -1660,6 +1774,8 @@ val SCE_LISP_STRINGEOL=8
 val SCE_LISP_IDENTIFIER=9
 val SCE_LISP_OPERATOR=10
 # Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
+lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_
+lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_
 val SCE_EIFFEL_DEFAULT=0
 val SCE_EIFFEL_COMMENTLINE=1
 val SCE_EIFFEL_NUMBER=2
@@ -1669,7 +1785,8 @@ val SCE_EIFFEL_CHARACTER=5
 val SCE_EIFFEL_OPERATOR=6
 val SCE_EIFFEL_IDENTIFIER=7
 val SCE_EIFFEL_STRINGEOL=8
-# Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)
+# Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer)
+lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_
 val SCE_NNCRONTAB_DEFAULT=0
 val SCE_NNCRONTAB_COMMENT=1
 val SCE_NNCRONTAB_TASK=2
@@ -1682,6 +1799,7 @@ val SCE_NNCRONTAB_STRING=8
 val SCE_NNCRONTAB_ENVIRONMENT=9
 val SCE_NNCRONTAB_IDENTIFIER=10
 # Lexical states for SCLEX_MATLAB
+lex MatLab=SCLEX_MATLAB SCE_MATLAB_
 val SCE_MATLAB_DEFAULT=0
 val SCE_MATLAB_COMMENT=1
 val SCE_MATLAB_COMMAND=2
@@ -1690,6 +1808,28 @@ val SCE_MATLAB_KEYWORD=4
 val SCE_MATLAB_STRING=5
 val SCE_MATLAB_OPERATOR=6
 val SCE_MATLAB_IDENTIFIER=7
+# Lexical states for SCLEX_SCRIPTOL
+lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_
+val SCE_SCRIPTOL_DEFAULT=0
+val SCE_SCRIPTOL_COMMENT=1
+val SCE_SCRIPTOL_COMMENTLINE=2
+val SCE_SCRIPTOL_COMMENTDOC=3
+val SCE_SCRIPTOL_NUMBER=4
+val SCE_SCRIPTOL_WORD=5
+val SCE_SCRIPTOL_STRING=6
+val SCE_SCRIPTOL_CHARACTER=7
+val SCE_SCRIPTOL_UUID=8
+val SCE_SCRIPTOL_PREPROCESSOR=9
+val SCE_SCRIPTOL_OPERATOR=10
+val SCE_SCRIPTOL_IDENTIFIER=11
+val SCE_SCRIPTOL_STRINGEOL=12
+val SCE_SCRIPTOL_VERBATIM=13
+val SCE_SCRIPTOL_REGEX=14
+val SCE_SCRIPTOL_COMMENTLINEDOC=15
+val SCE_SCRIPTOL_WORD2=16
+val SCE_SCRIPTOL_COMMENTDOCKEYWORD=17
+val SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR=18
+val SCE_SCRIPTOL_COMMENTBASIC=19
 
 # Events
 
@@ -1711,9 +1851,17 @@ 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)
+evt void Zoom=2018(void)
 
 cat Deprecated
 
+# CARET_POLICY changed in 1.47
+fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
+val CARET_CENTER=0x02
+val CARET_XEVEN=0x08
+val CARET_XJUMPS=0x10
+
 # The old name for SCN_UPDATEUI
 val SCN_CHECKBRACE=2007
 evt void PosChanged=2012(int position)
+
index 6e22f58f8b6b3b19427950d43a7bd2a2cf036582..203f35733923a00babbf6d846cb1c1e5b4a67b63 100644 (file)
@@ -28,7 +28,7 @@ struct _ScintillaObject {
 };
 
 struct _ScintillaClass {
-       GtkFixedClass parent_class;
+       GtkContainerClass parent_class;
 
        void (* command) (ScintillaObject *ttt);
        void (* notify) (ScintillaObject *ttt);
@@ -39,6 +39,12 @@ GtkWidget*   scintilla_new           (void);
 void           scintilla_set_id        (ScintillaObject *sci,int id);
 sptr_t scintilla_send_message  (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
+#if GTK_MAJOR_VERSION < 2
+#define SCINTILLA_NOTIFY "notify"
+#else
+#define SCINTILLA_NOTIFY "sci-notify"
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index 7fd8e30fd7db980e0adeca21d8c49b53b3ec07e1..6c16b150f267751c1cc38f2e2213b9d934a64da8 100644 (file)
@@ -31,6 +31,7 @@ public:
                lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
        }
        ~WindowAccessor();
+       bool Match(int pos, const char *s);
        char StyleAt(int position);
        int GetLine(int position);
        int LineStart(int line);
index 48aaee38ae75cbb7d598f24184a076db443aec76..d971fa12a09da6b943ee2ac0735a9a0a43427a55 100644 (file)
@@ -118,7 +118,7 @@ void AutoComplete::Move(int delta) {
 }
 
 void AutoComplete::Select(const char *word) {
-       int lenWord = strlen(word);
+       size_t lenWord = strlen(word);
        int location = -1;
        const int maxItemLen=1000;
        char item[maxItemLen];
index 4b4ae0c7ce17f197c125dc5154421836e67e1ba0..d67173b084a5c52ed3116d26c0a7e4585b8c1d25 100644 (file)
@@ -148,7 +148,7 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
                look = newline + 1;
                numLines++;
        }
-       int lastWidth = surfaceMeasure->WidthText(font, look, strlen(look));
+       int lastWidth = surfaceMeasure->WidthText(font, look, static_cast<int>(strlen(look)));
        width = Platform::Maximum(width, lastWidth) + 10;
        int lineHeight = surfaceMeasure->Height(font);
        // Extra line for border and an empty line at top and bottom
index ecb5bc1801554749e8146743a134125639ffea2a..b67da81c937132af33d8b1fdb1dc0679b63a6b05 100644 (file)
@@ -958,10 +958,13 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {
                                        //Platform::DebugPrintf("Removing cr end of line\n");
                                        lv.Remove(lineRemove);
                                }
-                       } else if ((ch == '\n') && !ignoreNL) {
-                               //Platform::DebugPrintf("Removing lf end of line\n");
-                               lv.Remove(lineRemove);
-                               ignoreNL = false;       // Further \n are not real deletions
+                       } else if (ch == '\n') {
+                               if (ignoreNL) {
+                                       ignoreNL = false;       // Further \n are real deletions
+                               } else {
+                                       //Platform::DebugPrintf("Removing lf end of line\n");
+                                       lv.Remove(lineRemove);
+                               }
                        }
 
                        ch = chNext;
index 3d3e5a51dd90ff0947026e149b3395d34a589e8a..7458120442ab5afc9c0814dedd02ecd376d2efe4 100644 (file)
@@ -344,17 +344,19 @@ void Document::ModifiedAt(int pos) {
 // SetStyleAt does not change the persistent state of a document
 
 // Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
-void Document::DeleteChars(int pos, int len) {
+bool Document::DeleteChars(int pos, int len) {
        if (len == 0)
-               return;
+               return false;
        if ((pos + len) > Length())
-               return;
+               return false;
        if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
                enteredReadOnlyCount++;
                NotifyModifyAttempt();
                enteredReadOnlyCount--;
        }
-       if (enteredCount == 0) {
+       if (enteredCount != 0) {
+               return false;
+       } else {
                enteredCount++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
@@ -379,15 +381,18 @@ void Document::DeleteChars(int pos, int len) {
                }
                enteredCount--;
        }
+       return !cb.IsReadOnly();
 }
 
-void Document::InsertStyledString(int position, char *s, int insertLength) {
+bool Document::InsertStyledString(int position, char *s, int insertLength) {
        if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
                enteredReadOnlyCount++;
                NotifyModifyAttempt();
                enteredReadOnlyCount--;
        }
-       if (enteredCount == 0) {
+       if (enteredCount != 0) {
+               return false;
+       } else {
                enteredCount++;
                if (!cb.IsReadOnly()) {
                        NotifyModified(
@@ -409,6 +414,7 @@ void Document::InsertStyledString(int position, char *s, int insertLength) {
                }
                enteredCount--;
        }
+       return !cb.IsReadOnly();
 }
 
 int Document::Undo() {
@@ -497,29 +503,32 @@ int Document::Redo() {
        return newPos;
 }
 
-void Document::InsertChar(int pos, char ch) {
+bool Document::InsertChar(int pos, char ch) {
        char chs[2];
        chs[0] = ch;
        chs[1] = 0;
-       InsertStyledString(pos*2, chs, 2);
+       return InsertStyledString(pos*2, chs, 2);
 }
 
 // Insert a null terminated string
-void Document::InsertString(int position, const char *s) {
-       InsertString(position, s, strlen(s));
+bool Document::InsertString(int position, const char *s) {
+       return InsertString(position, s, strlen(s));
 }
 
 // Insert a string with a length
-void Document::InsertString(int position, const char *s, int insertLength) {
+bool Document::InsertString(int position, const char *s, size_t insertLength) {
+       bool changed = false;
        char *sWithStyle = new char[insertLength * 2];
        if (sWithStyle) {
-               for (int i = 0; i < insertLength; i++) {
+               for (size_t i = 0; i < insertLength; i++) {
                        sWithStyle[i*2] = s[i];
                        sWithStyle[i*2 + 1] = 0;
                }
-               InsertStyledString(position*2, sWithStyle, insertLength*2);
+               changed = InsertStyledString(position*2, sWithStyle, 
+                       static_cast<int>(insertLength*2));
                delete []sWithStyle;
        }
+       return changed;
 }
 
 void Document::ChangeChar(int pos, char ch) {
@@ -531,22 +540,18 @@ void Document::DelChar(int pos) {
        DeleteChars(pos, LenChar(pos));
 }
 
-int Document::DelCharBack(int pos) {
+void Document::DelCharBack(int pos) {
        if (pos <= 0) {
-               return pos;
+               return;
        } else if (IsCrLf(pos - 2)) {
                DeleteChars(pos - 2, 2);
-               return pos - 2;
        } else if (SC_CP_UTF8 == dbcsCodePage) {
                int startChar = MovePositionOutsideChar(pos - 1, -1, false);
                DeleteChars(startChar, pos - startChar);
-               return startChar;
        } else if (IsDBCS(pos - 1)) {
                DeleteChars(pos - 2, 2);
-               return pos - 2;
        } else {
                DeleteChars(pos - 1, 1);
-               return pos - 1;
        }
 }
 
@@ -822,8 +827,9 @@ class DocumentIndexer : public CharacterIndexer {
        Document *pdoc;
        int end;
 public:
-DocumentIndexer(Document *pdoc_, int end_) :
-       pdoc(pdoc_), end(end_) {}
+       DocumentIndexer(Document *pdoc_, int end_) :
+               pdoc(pdoc_), end(end_) {
+       }
 
        virtual char CharAt(int index) {
                if (index < 0 || index >= end)
@@ -928,7 +934,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
                // Compute actual search ranges needed
                int lengthFind = *length;
                if (lengthFind == -1)
-                       lengthFind = strlen(s);
+                       lengthFind = static_cast<int>(strlen(s));
                int endSearch = endPos;
                if (startPos <= endPos) {
                        endSearch = endPos - lengthFind + 1;
@@ -1081,8 +1087,10 @@ void Document::StartStyling(int position, char mask) {
        endStyled = position;
 }
 
-void Document::SetStyleFor(int length, char style) {
-       if (enteredCount == 0) {
+bool Document::SetStyleFor(int length, char style) {
+       if (enteredCount != 0) {
+               return false;
+       } else {
                enteredCount++;
                int prevEndStyled = endStyled;
                if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
@@ -1092,26 +1100,32 @@ void Document::SetStyleFor(int length, char style) {
                }
                endStyled += length;
                enteredCount--;
+               return true;
        }
 }
 
-void Document::SetStyles(int length, char *styles) {
-       if (enteredCount == 0) {
+bool Document::SetStyles(int length, char *styles) {
+       if (enteredCount != 0) {
+               return false;
+       } else {
                enteredCount++;
                int prevEndStyled = endStyled;
                bool didChange = false;
+               int lastChange = 0;
                for (int iPos = 0; iPos < length; iPos++, endStyled++) {
                        PLATFORM_ASSERT(endStyled < Length());
                        if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
                                didChange = true;
+                               lastChange = iPos;
                        }
                }
                if (didChange) {
                        DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
-                                          prevEndStyled, endStyled - prevEndStyled);
+                                          prevEndStyled, lastChange);
                        NotifyModified(mh);
                }
                enteredCount--;
+               return true;
        }
 }
 
@@ -1121,10 +1135,11 @@ bool Document::EnsureStyledTo(int pos) {
                if (styleClock > 0x100000) {
                        styleClock = 0;
                }
+               // Ask the watchers to style, and stop as soon as one responds.
+               for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) {
+                       watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
+               }
        }
-       // Ask the watchers to style, and stop as soon as one responds.
-       for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++)
-               watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos);
        return pos <= GetEndStyled();
 }
 
index 941ad79ccfde2c02e9d2650c6885831316426018..82931207cfcbe8cb7662f9ea07cb1e72a079936e 100644 (file)
@@ -132,8 +132,8 @@ public:
        int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
 
        // Gateways to modifying document
-       void DeleteChars(int pos, int len);
-       void InsertStyledString(int position, char *s, int insertLength);
+       bool DeleteChars(int pos, int len);
+       bool InsertStyledString(int position, char *s, int insertLength);
        int Undo();
        int Redo();
        bool CanUndo() { return cb.CanUndo(); }
@@ -158,12 +158,12 @@ public:
        void SetReadOnly(bool set) { cb.SetReadOnly(set); }
        bool IsReadOnly() { return cb.IsReadOnly(); }
 
-       void InsertChar(int pos, char ch);
-       void InsertString(int position, const char *s);
-       void InsertString(int position, const char *s, int insertLength);
+       bool InsertChar(int pos, char ch);
+       bool InsertString(int position, const char *s);
+       bool InsertString(int position, const char *s, size_t insertLength);
        void ChangeChar(int pos, char ch);
        void DelChar(int pos);
-       int DelCharBack(int pos);
+       void DelCharBack(int pos);
 
        char CharAt(int position) { return cb.CharAt(position); }
        void GetCharRange(char *buffer, int position, int lengthRetrieve) {
@@ -202,8 +202,8 @@ public:
        void SetWordChars(unsigned char *chars);
        void SetStylingBits(int bits);
        void StartStyling(int position, char mask);
-       void SetStyleFor(int length, char style);
-       void SetStyles(int length, char *styles);
+       bool SetStyleFor(int length, char style);
+       bool SetStyles(int length, char *styles);
        int GetEndStyled() { return endStyled; }
        bool EnsureStyledTo(int pos);
        int GetStyleClock() { return styleClock; }
index f115f193045d89f16f2d478bf73b22fefc11a796..595edf8ba21a276b98a7bd4d8276c8e5b53c730d 100644 (file)
@@ -48,6 +48,15 @@ void DocumentAccessor::Fill(int position) {
        buf[endPos-startPos] = '\0';
 }
 
+bool DocumentAccessor::Match(int pos, const char *s) {
+       for (int i=0; *s; i++) {
+               if (*s != SafeGetCharAt(pos+i))
+                       return false;
+               s++;
+       }
+       return true;
+}
+
 char DocumentAccessor::StyleAt(int position) {
        return pdoc->StyleAt(position);
 }
index 5b68dd15c5168856423b8dee410eb1d9f0c87ac2..dc591d13ec3142c08216f5451b18e752db0fb6e1 100644 (file)
@@ -38,6 +38,7 @@ public:
                startSeg(0), startPosStyling(0) {
        }
        ~DocumentAccessor();
+       bool Match(int pos, const char *s);
        char StyleAt(int position);
        int GetLine(int position);
        int LineStart(int line);
index 554751123dad967167a4490137aafc4f9e91adfd..faba66ef55bac5231ad94c1c501a40ecdffcec0e 100644 (file)
@@ -65,7 +65,9 @@ void LineLayout::Resize(int maxLineLength_) {
                chars = new char[maxLineLength_ + 1];
                styles = new char[maxLineLength_ + 1];
                indicators = new char[maxLineLength_ + 1];
-               positions = new int[maxLineLength_ + 1];
+               // Extra position allocated as sometimes the Windows
+               // GetTextExtentExPoint API writes an extra element.
+               positions = new int[maxLineLength_ + 1 + 1];
                maxLineLength = maxLineLength_;
        }
 }
@@ -84,7 +86,8 @@ void LineLayout::Free() {
 }
 
 void LineLayout::Invalidate(validLevel validity_) {
-       validity = validity_;
+       if (validity > validity_)
+               validity = validity_;
 }
 
 void LineLayout::SetLineStart(int line, int start) {
@@ -179,14 +182,11 @@ void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
        }
        if (lengthForLevel > size) {
                Deallocate();
-       } else {
-               if (lengthForLevel < length) {
-                       for (int i=lengthForLevel; i<length; i++) {
-                               delete cache[i];
-                               cache[i] = 0;
-                       }
+       } else if (lengthForLevel < length) {
+               for (int i=lengthForLevel; i<length; i++) {
+                       delete cache[i];
+                       cache[i] = 0;
                }
-               Invalidate(LineLayout::llInvalid);
        }
        if (!cache) {
                Allocate(lengthForLevel);
@@ -226,7 +226,7 @@ LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChar
        int linesOnScreen, int linesInDoc) {
        AllocateForLevel(linesOnScreen, linesInDoc);
        if (styleClock != styleClock_) {
-               Invalidate(LineLayout::llInvalid);
+               Invalidate(LineLayout::llCheckTextAndStyle);
                styleClock = styleClock_;
        }
        allInvalidated = false;
@@ -315,17 +315,19 @@ Editor::Editor() {
        xEndSelect = 0;
        primarySelection = true;
 
-       caretPolicy = CARET_SLOP;
-       caretSlop = 0;
+       caretXPolicy = CARET_SLOP | CARET_EVEN;
+       caretXSlop = 50;
 
-       visiblePolicy = VISIBLE_SLOP;
-       visibleSlop = 0;
+       caretYPolicy = CARET_EVEN;
+       caretYSlop = 0;
 
        searchAnchor = 0;
 
        xOffset = 0;
        xCaretMargin = 50;
        horizontalScrollBarVisible = true;
+       scrollWidth = 2000;
+       endAtLastLine = true;
 
        pixmapLine = Surface::Allocate();
        pixmapSelMargin = Surface::Allocate();
@@ -451,11 +453,17 @@ int Editor::LinesToScroll() {
 int Editor::MaxScrollPos() {
        //Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n",
        //LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1);
-       int retVal = cs.LinesDisplayed() - LinesOnScreen();
-       if (retVal < 0)
+       int retVal = cs.LinesDisplayed();
+       if (endAtLastLine) {
+               retVal -= LinesOnScreen();
+       } else {
+               retVal--;
+       }
+       if (retVal < 0) {
                return 0;
-       else
+       } else {
                return retVal;
+       }
 }
 
 static inline bool IsControlCharacter(char ch) {
@@ -611,8 +619,10 @@ int Editor::PositionFromLocationClose(Point pt) {
        return INVALID_POSITION;
 }
 
-// Find the document position corresponding to an x coordinate on a particular document line.
-// Ensure is between whole characters when document is in multi-byte or UTF-8 mode.
+/**
+ * Find the document position corresponding to an x coordinate on a particular document line.
+ * Ensure is between whole characters when document is in multi-byte or UTF-8 mode.
+ */
 int Editor::PositionFromLineX(int lineDoc, int x) {
        RefreshStyleData();
        if (lineDoc >= pdoc->LinesTotal())
@@ -641,6 +651,15 @@ int Editor::PositionFromLineX(int lineDoc, int x) {
        return retVal;
 }
 
+// If painting then abandon the painting because a wider redraw is needed.
+// Return true if calling code should stop drawing
+bool Editor::AbandonPaint() {
+       if ((paintState == painting) && !paintingAllText) {
+               paintState = paintAbandoned;
+       }
+       return paintState == paintAbandoned;
+}
+
 void Editor::RedrawRect(PRectangle rc) {
        //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom);
 
@@ -666,12 +685,14 @@ void Editor::Redraw() {
 }
 
 void Editor::RedrawSelMargin() {
-       if (vs.maskInLine) {
-               Redraw();
-       } else {
-               PRectangle rcSelMargin = GetClientRectangle();
-               rcSelMargin.right = vs.fixedColumnWidth;
-               wMain.InvalidateRectangle(rcSelMargin);
+       if (!AbandonPaint()) {
+               if (vs.maskInLine) {
+                       Redraw();
+               } else {
+                       PRectangle rcSelMargin = GetClientRectangle();
+                       rcSelMargin.right = vs.fixedColumnWidth;
+                       wMain.InvalidateRectangle(rcSelMargin);
+               }
        }
 }
 
@@ -920,76 +941,260 @@ int Editor::DisplayFromPosition(int pos) {
        return lineDisplay;
 }
 
+/**
+ * Ensure the caret is reasonably visible in context.
+ *
+Caret policy in SciTE
+
+If slop is set, we can define a slop value.
+This value defines an unwanted zone (UZ) where the caret is... unwanted.
+This zone is defined as a number of pixels near the vertical margins,
+and as a number of lines near the horizontal margins.
+By keeping the caret away from the edges, it is seen within its context,
+so it is likely that the identifier that the caret is on can be completely seen,
+and that the current line is seen with some of the lines following it which are
+often dependent on that line.
+
+If strict is set, the policy is enforced... strictly.
+The caret is centred on the display if slop is not set,
+and cannot go in the UZ if slop is set.
+
+If jumps is set, the display is moved more energetically
+so the caret can move in the same direction longer before the policy is applied again.
+'3UZ' notation is used to indicate three time the size of the UZ as a distance to the margin.
+
+If even is not set, instead of having symmetrical UZs,
+the left and bottom UZs are extended up to right and top UZs respectively.
+This way, we favour the displaying of useful information: the begining of lines,
+where most code reside, and the lines after the caret, eg. the body of a function.
+
+     |        |       |      |                                            |
+slop | strict | jumps | even | Caret can go to the margin                 | When reaching limit (caret going out of
+     |        |       |      |                                            | visibility or going into the UZ) display is...
+-----+--------+-------+------+--------------------------------------------+--------------------------------------------------------------
+  0  |   0    |   0   |   0  | Yes                                        | moved to put caret on top/on right
+  0  |   0    |   0   |   1  | Yes                                        | moved by one position
+  0  |   0    |   1   |   0  | Yes                                        | moved to put caret on top/on right
+  0  |   0    |   1   |   1  | Yes                                        | centred on the caret
+  0  |   1    |   -   |   0  | Caret is always on top/on right of display | -
+  0  |   1    |   -   |   1  | No, caret is always centred                | -
+  1  |   0    |   0   |   0  | Yes                                        | moved to put caret out of the asymmetrical UZ
+  1  |   0    |   0   |   1  | Yes                                        | moved to put caret out of the UZ
+  1  |   0    |   1   |   0  | Yes                                        | moved to put caret at 3UZ of the top or right margin
+  1  |   0    |   1   |   1  | Yes                                        | moved to put caret at 3UZ of the margin
+  1  |   1    |   -   |   0  | Caret is always at UZ of top/right margin  | -
+  1  |   1    |   0   |   1  | No, kept out of UZ                         | moved by one position
+  1  |   1    |   1   |   1  | No, kept out of UZ                         | moved to put caret at 3UZ of the margin
+*/
 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)
+       if (posDrag >= 0) {
                posCaret = posDrag;
+       }
        Point pt = LocationFromPosition(posCaret);
-       Point ptEOL = LocationFromPosition(pdoc->LineEndPosition(posCaret));
        Point ptBottomCaret = pt;
-       int lineCaret = DisplayFromPosition(posCaret);
        ptBottomCaret.y += vs.lineHeight - 1;
-
-       // 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;
-
-       // 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;
-       }
+       int lineCaret = DisplayFromPosition(posCaret);
+       bool bSlop, bStrict, bJump, bEven;
 
        // 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);
+       if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) {
+               int linesOnScreen = LinesOnScreen();
+               int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2;
+               int newTopLine = topLine;
+               bSlop = (caretYPolicy & CARET_SLOP) != 0;
+               bStrict = (caretYPolicy & CARET_STRICT) != 0;
+               bJump = (caretYPolicy & CARET_JUMPS) != 0;
+               bEven = (caretYPolicy & CARET_EVEN) != 0;
+
                // 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) {
-                       if ((topLine > lineCaret) || ((caretPolicy & CARET_STRICT) && (topLine + caretSlop > lineCaret))) {
-                               SetTopLine(Platform::Clamp(lineCaret - caretSlop, 0, MaxScrollPos()));
-                               SetVerticalScrollPos();
-                               Redraw();
-                       } else if ((lineCaret > topLine + LinesOnScreen() - 1) ||
-                                  ((caretPolicy & CARET_STRICT) && (lineCaret > topLine + LinesOnScreen() - 1 - caretSlop))) {
-                               SetTopLine(Platform::Clamp(lineCaret - LinesOnScreen() + 1 + caretSlop, 0, MaxScrollPos()));
-                               SetVerticalScrollPos();
-                               Redraw();
+               if (bSlop) {    // A margin is defined
+                       int yMoveT, yMoveB;
+                       if (bStrict) {
+                               int yMarginT, yMarginB;
+                               if (!useMargin) {
+                                       // In drag mode, avoid moves
+                                       // otherwise, a double click will select several lines.
+                                       yMarginT = yMarginB = 0;
+                               } else {
+                                       // yMarginT must equal to caretYSlop, with a minimum of 1 and
+                                       // a maximum of slightly less than half the heigth of the text area.
+                                       yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen);
+                                       if (bEven) {
+                                               yMarginB = yMarginT;
+                                       } else {
+                                               yMarginB = linesOnScreen - yMarginT - 1;
+                                       }
+                               }
+                               yMoveT = yMarginT;
+                               if (bEven) {
+                                       if (bJump) {
+                                               yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen);
+                                       }
+                                       yMoveB = yMoveT;
+                               } else {
+                                       yMoveB = linesOnScreen - yMoveT - 1;
+                               }
+                               if (lineCaret < topLine + yMarginT) {
+                                       // Caret goes too high
+                                       newTopLine = lineCaret - yMoveT;
+                               } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) {
+                                       // Caret goes too low
+                                       newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+                               }
+                       } else {        // Not strict
+                               yMoveT = bJump ? caretYSlop * 3 : caretYSlop;
+                               yMoveT = Platform::Clamp(yMoveT, 1, halfScreen);
+                               if (bEven) {
+                                       yMoveB = yMoveT;
+                               } else {
+                                       yMoveB = linesOnScreen - yMoveT - 1;
+                               }
+                               if (lineCaret < topLine) {
+                                       // Caret goes too high
+                                       newTopLine = lineCaret - yMoveT;
+                               } else if (lineCaret > topLine + linesOnScreen - 1) {
+                                       // Caret goes too low
+                                       newTopLine = lineCaret - linesOnScreen + 1 + yMoveB;
+                               }
                        }
-               } else {
-                       if ((topLine > lineCaret) || (lineCaret > topLine + LinesOnScreen() - 1) || (caretPolicy & CARET_STRICT)) {
-                               SetTopLine(Platform::Clamp(lineCaret - LinesOnScreen() / 2 + 1, 0, MaxScrollPos()));
-                               SetVerticalScrollPos();
-                               Redraw();
+               } else {        // No slop
+                       if (!bStrict && !bJump) {
+                               // Minimal move
+                               if (lineCaret < topLine) {
+                                       // Caret goes too high
+                                       newTopLine = lineCaret;
+                               } else if (lineCaret > topLine + linesOnScreen - 1) {
+                                       // Caret goes too low
+                                       if (bEven) {
+                                               newTopLine = lineCaret - linesOnScreen + 1;
+                                       } else {
+                                               newTopLine = lineCaret;
+                                       }
+                               }
+                       } else {        // Strict or going out of display
+                               if (bEven) {
+                                       // Always center caret
+                                       newTopLine = lineCaret - halfScreen;
+                               } else {
+                                       // Always put caret on top of display
+                                       newTopLine = lineCaret;
+                               }
                        }
                }
+               newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos());
+               if (newTopLine != topLine) {
+                       SetTopLine(newTopLine);
+                       SetVerticalScrollPos();
+                       Redraw();
+               }
        }
 
        // Horizontal positioning
        if (horiz && (wrapState == eWrapNone)) {
+               int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2;
                int xOffsetNew = xOffset;
-               if (pt.x < rcClient.left) {
-                       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)
-                               xOffsetNew = xOffsetEOL;
-               }
-               if (xOffsetNew < 0)
+               bSlop = (caretXPolicy & CARET_SLOP) != 0;
+               bStrict = (caretXPolicy & CARET_STRICT) != 0;
+               bJump = (caretXPolicy & CARET_JUMPS) != 0;
+               bEven = (caretXPolicy & CARET_EVEN) != 0;
+
+               if (bSlop) {    // A margin is defined
+                       int xMoveL, xMoveR;
+                       if (bStrict) {
+                               int xMarginL, xMarginR;
+                               if (!useMargin) {
+                                       // In drag mode, avoid moves unless very near of the margin
+                                       // otherwise, a simple click will select text.
+                                       xMarginL = xMarginR = 2;
+                               } else {
+                                       // xMargin must equal to caretXSlop, with a minimum of 2 and
+                                       // a maximum of slightly less than half the width of the text area.
+                                       xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen);
+                                       if (bEven) {
+                                               xMarginL = xMarginR;
+                                       } else {
+                                               xMarginL = rcClient.Width() - xMarginR - 4;
+                                       }
+                               }
+                               if (bJump && bEven) {
+                                       // Jump is used only in even mode
+                                       xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen);
+                               } else {
+                                       xMoveL = xMoveR = 0;    // Not used, avoid a warning
+                               }
+                               if (pt.x < rcClient.left + xMarginL) {
+                                       // Caret is on the left of the display
+                                       if (bJump && bEven) {
+                                               xOffsetNew -= xMoveL;
+                                       } else {
+                                               // Move just enough to allow to display the caret
+                                               xOffsetNew -= (rcClient.left + xMarginL) - pt.x;
+                                       }
+                               } else if (pt.x >= rcClient.right - xMarginR) {
+                                       // Caret is on the right of the display
+                                       if (bJump && bEven) {
+                                               xOffsetNew += xMoveR;
+                                       } else {
+                                               // Move just enough to allow to display the caret
+                                               xOffsetNew += pt.x - (rcClient.right - xMarginR) + 1;
+                                       }
+                               }
+                       } else {        // Not strict
+                               xMoveR = bJump ? caretXSlop * 3 : caretXSlop;
+                               xMoveR = Platform::Clamp(xMoveR, 1, halfScreen);
+                               if (bEven) {
+                                       xMoveL = xMoveR;
+                               } else {
+                                       xMoveL = rcClient.Width() - xMoveR - 4;
+                               }
+                               if (pt.x < rcClient.left) {
+                                       // Caret is on the left of the display
+                                       xOffsetNew -= xMoveL;
+                               } else if (pt.x >= rcClient.right) {
+                                       // Caret is on the right of the display
+                                       xOffsetNew += xMoveR;
+                               }
+                       }
+               } else {        // No slop
+                       if (bStrict ||
+                               (bJump && (pt.x < rcClient.left || pt.x >= rcClient.right))) {
+                               // Strict or going out of display
+                               if (bEven) {
+                                       // Center caret
+                                       xOffsetNew += pt.x - rcClient.left - halfScreen;
+                               } else {
+                                       // Put caret on right
+                                       xOffsetNew += pt.x - rcClient.right + 1;
+                               }
+                       } else {
+                               // Move just enough to allow to display the caret
+                               if (pt.x < rcClient.left) {
+                                       // Caret is on the left of the display
+                                       if (bEven) {
+                                               xOffsetNew -= rcClient.left - pt.x;
+                                       } else {
+                                               xOffsetNew += pt.x - rcClient.right + 1;
+                                       }
+                               } else if (pt.x >= rcClient.right) {
+                                       // Caret is on the right of the display
+                                       xOffsetNew += pt.x - rcClient.right + 1;
+                               }
+                       }
+               }
+               // In case of a jump (find result) largely out of display, adjust the offset to display the caret
+               if (pt.x + xOffset < rcClient.left + xOffsetNew) {
+                       xOffsetNew = pt.x + xOffset - rcClient.left;
+               } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) {
+                       xOffsetNew = pt.x + xOffset - rcClient.right + 1;
+               }
+               if (xOffsetNew < 0) {
                        xOffsetNew = 0;
+               }
                if (xOffset != xOffsetNew) {
                        xOffset = xOffsetNew;
                        SetHorizontalScrollPos();
@@ -1023,10 +1228,12 @@ void Editor::InvalidateCaret() {
 }
 
 void Editor::NeedWrapping(int docLineStartWrapping) {
-       docLineLastWrapped = docLineStartWrapping - 1;
-       if (docLineLastWrapped < -1)
-               docLineLastWrapped = -1;
-       llc.Invalidate(LineLayout::llPositions);
+       if (docLineLastWrapped > (docLineStartWrapping - 1)) {
+               docLineLastWrapped = docLineStartWrapping - 1;
+               if (docLineLastWrapped < -1)
+                       docLineLastWrapped = -1;
+               llc.Invalidate(LineLayout::llPositions);
+       }
 }
 
 // Check if wrapping needed and perform any needed wrapping.
@@ -1045,7 +1252,7 @@ bool Editor::WrapLines() {
                        }
                        docLineLastWrapped = 0x7ffffff;
                } else {
-                       ElapsedTime et;
+                       //ElapsedTime et;
                        int lineDocTop = cs.DocFromDisplay(topLine);
                        int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
                        PRectangle rcTextArea = GetClientRectangle();
@@ -1076,7 +1283,7 @@ bool Editor::WrapLines() {
                                goodTopLine += subLineTop;
                        else
                                goodTopLine += cs.GetHeight(lineDocTop);
-                       double durWrap = et.Duration(true);
+                       //double durWrap = et.Duration(true);
                        //Platform::DebugPrintf("Wrap:%9.6g \n", durWrap);
                }
        }
@@ -1320,6 +1527,55 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
        if (!ll)
                return;
        int posLineStart = pdoc->LineStart(line);
+       int posLineEnd = pdoc->LineStart(line + 1);
+       // If the line is very long, limit the treatment to a length that should fit in the viewport
+       if (posLineEnd > (posLineStart + ll->maxLineLength)) {
+               posLineEnd = posLineStart + ll->maxLineLength;
+       }
+       if (ll->validity == LineLayout::llCheckTextAndStyle) {
+               int lineLength = 0;
+               for (int cid = posLineStart; cid < posLineEnd; cid++) {
+                       char chDoc = pdoc->CharAt(cid);
+                       if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) {
+                               lineLength++;
+                       }
+               }
+               if (lineLength == ll->numCharsInLine) {
+                       int numCharsInLine = 0;
+                       // See if chars, styles, indicators, are all the same
+                       bool allSame = true;
+                       char styleByte;
+                       int styleMask = pdoc->stylingBitsMask;
+                       // Check base line layout
+                       for (int charInDoc = posLineStart; allSame && (charInDoc < posLineEnd); charInDoc++) {
+                               char chDoc = pdoc->CharAt(charInDoc);
+                               styleByte = pdoc->StyleAt(charInDoc);
+                               if (vstyle.viewEOL || ((chDoc != '\r') && (chDoc != '\n'))) {
+                                       allSame = allSame && 
+                                               (ll->styles[numCharsInLine] == static_cast<char>(styleByte & styleMask));
+                                       allSame = allSame && 
+                                               (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask));
+                                       if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper)
+                                               allSame = allSame && 
+                                                       (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
+                                       else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
+                                               allSame = allSame && 
+                                                       (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
+                                       else
+                                               allSame = allSame &&
+                                                       (ll->chars[numCharsInLine] == chDoc);
+                                       numCharsInLine++;
+                               }
+                       }
+                       if (allSame) {
+                               ll->validity = LineLayout::llPositions;
+                       } else {
+                               ll->validity = LineLayout::llInvalid;
+                       }
+               } else {
+                       ll->validity = LineLayout::llInvalid;
+               }
+       }
        if (ll->validity == LineLayout::llInvalid) {
                ll->widthLine = LineLayout::wrapWidthInfinite;
                ll->lines = 1;
@@ -1333,15 +1589,8 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                        ll->edgeColumn = -1;
                }
 
-               int posLineEnd = pdoc->LineStart(line + 1);
-               Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
                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 + ll->maxLineLength)) {
-                       posLineEnd = posLineStart + ll->maxLineLength;
-               }
                // Fill base line layout
                for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) {
                        char chDoc = pdoc->CharAt(charInDoc);
@@ -1357,6 +1606,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                                numCharsInLine++;
                        }
                }
+               ll->xHighlightGuide = 0;
                // Extra element at the end of the line to hold end x position and act as
                ll->chars[numCharsInLine] = 0;   // Also triggers processing in the loops as this is a control character
                ll->styles[numCharsInLine] = styleByte; // For eolFilled
@@ -1369,6 +1619,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                ll->positions[0] = 0;
                unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars;
                bool lastSegItalics = false;
+               Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font;
 
                for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) {
                        if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) ||
@@ -1427,6 +1678,9 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
                ll->widthLine = width;
                if (width == LineLayout::wrapWidthInfinite) {
                        ll->lines = 1;
+               } else if (width > ll->positions[ll->numCharsInLine]) {
+                       // Simple common case where line does not need wrapping.
+                       ll->lines = 1;
                } else {
                        ll->lines = 0;
                        // Calculate line start positions based upon width.
@@ -1728,7 +1982,9 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
 }
 
 void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
-       //Platform::DebugPrintf("Paint %d %d - %d %d\n", rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+       //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n",
+       //      paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
+
        RefreshStyleData();
 
        PRectangle rcClient = GetClientRectangle();
@@ -1738,8 +1994,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
        if (WrapLines()) {
                // The wrapping process has changed the height of some lines so abandon this
                // paint for a complete repaint.
-               paintState = paintAbandoned;
-               return;
+               if (AbandonPaint()) {
+                       return;
+               }
        }
 
        if (!pixmapSelPattern->Initialised()) {
@@ -1790,9 +2047,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
        surfaceWindow->SetPalette(&palette, true);
        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 starting a comment flows on to other lines.
@@ -1872,7 +2126,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
                while (visibleLine < cs.LinesDisplayed() && yposScreen < rcArea.bottom) {
 
                        int lineDoc = cs.DocFromDisplay(visibleLine);
-                       //Platform::DebugPrintf("Painting line %d\n", line);
                        // Only visible lines should be handled by the code within the loop
                        PLATFORM_ASSERT(cs.GetVisible(lineDoc));
                        int lineStartSet = cs.DisplayFromDoc(lineDoc);
@@ -2167,15 +2420,26 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
        return endPosPrint;
 }
 
+int Editor::TextWidth(int style, const char *text) {
+       RefreshStyleData();
+       AutoSurface surface(IsUnicodeMode());
+       if (surface) {
+               return surface->WidthText(vs.styles[style].font, text, strlen(text));
+       } else {
+               return 1;
+       }
+}
+
 // Empty method is overridden on GTK+ to show / hide scrollbars
-void Editor::ReconfigureScrollBars() {}
+void Editor::ReconfigureScrollBars() {
+}
 
 void Editor::SetScrollBars() {
        RefreshStyleData();
 
-       int nMax = cs.LinesDisplayed();
-       int nPage = nMax - MaxScrollPos() + 1;
-       bool modified = ModifyScrollBars(nMax, nPage);
+       int nMax = MaxScrollPos();
+       int nPage = LinesOnScreen();
+       bool modified = ModifyScrollBars(nMax + nPage - 1, nPage);
 
        // TODO: ensure always showing as many lines as possible
        // May not be, if, for example, window made larger
@@ -2184,8 +2448,10 @@ void Editor::SetScrollBars() {
                SetVerticalScrollPos();
                Redraw();
        }
-       if (modified)
-               Redraw();
+       if (modified) {
+               if (!AbandonPaint())
+                       Redraw();
+       }
        //Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage);
 }
 
@@ -2220,8 +2486,9 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
                        }
                }
        }
-       pdoc->InsertString(currentPos, s, len);
-       SetEmptySelection(currentPos + len);
+       if (pdoc->InsertString(currentPos, s, len)) {
+               SetEmptySelection(currentPos + len);
+       }
        EnsureCaretVisible();
        // Avoid blinking during rapid typing:
        ShowCaretAtCurrentPosition();
@@ -2298,7 +2565,9 @@ void Editor::ClearAll() {
        if (0 != pdoc->Length()) {
                pdoc->DeleteChars(0, pdoc->Length());
        }
-       cs.Clear();
+       if (!pdoc->IsReadOnly()) {
+               cs.Clear();
+       }
        pdoc->EndUndoAction();
        anchor = 0;
        currentPos = 0;
@@ -2416,8 +2685,7 @@ void Editor::DelCharBack(bool allowLineStartDeletion) {
                                SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos));
                                pdoc->EndUndoAction();
                        } else {
-                               int newPos = pdoc->DelCharBack(currentPos);
-                               SetEmptySelection(newPos);
+                               pdoc->DelCharBack(currentPos);
                        }
                }
        } else {
@@ -2450,7 +2718,7 @@ void Editor::NotifyChar(int ch) {
                char txt[2];
                txt[0] = static_cast<char>(ch);
                txt[1] = '\0';
-               NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
+               NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<sptr_t>(txt));
        }
 }
 
@@ -2527,6 +2795,12 @@ void Editor::NotifyDwelling(Point pt, bool state) {
        NotifyParent(scn);
 }
 
+void Editor::NotifyZoom() {
+       SCNotification scn;
+       scn.nmhdr.code = SCN_ZOOM;
+       NotifyParent(scn);
+}
+
 // Notifications from document
 void Editor::NotifyModifyAttempt(Document*, void *) {
        //Platform::DebugPrintf("** Modify Attempt\n");
@@ -2548,7 +2822,7 @@ void Editor::NotifySavePoint(Document*, void *, bool atSavePoint) {
 void Editor::CheckModificationForWrap(DocModification mh) {
        if ((mh.modificationType & SC_MOD_INSERTTEXT) ||
                (mh.modificationType & SC_MOD_DELETETEXT)) {
-               llc.Invalidate(LineLayout::llInvalid);
+               llc.Invalidate(LineLayout::llCheckTextAndStyle);
                if (wrapState != eWrapNone) {
                        int lineDoc = pdoc->LineFromPosition(mh.position);
                        if (mh.linesAdded == 0) {
@@ -2598,73 +2872,80 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) {
        needUpdateUI = true;
        if (paintState == painting) {
                CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length));
-       } else if (paintState == notPainting) {
-               CheckModificationForWrap(mh);
-               if (mh.modificationType & SC_MOD_CHANGESTYLE) {
+       }
+       CheckModificationForWrap(mh);
+       if (mh.modificationType & SC_MOD_CHANGESTYLE) {
+               if (paintState == notPainting) {
                        if (mh.position < pdoc->LineStart(topLine)) {
                                // Styling performed before this view
                                Redraw();
                        } else {
                                InvalidateRange(mh.position, mh.position + mh.length);
                        }
-               } else {
-                       // Move selection and brace highlights
-                       if (mh.modificationType & SC_MOD_INSERTTEXT) {
-                               currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length);
-                               anchor = MovePositionForInsertion(anchor, mh.position, mh.length);
-                               braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length);
-                               braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length);
-                       } else if (mh.modificationType & SC_MOD_DELETETEXT) {
-                               currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length);
-                               anchor = MovePositionForDeletion(anchor, mh.position, mh.length);
-                               braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
-                               braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
+               }
+       } else {
+               // Move selection and brace highlights
+               if (mh.modificationType & SC_MOD_INSERTTEXT) {
+                       currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length);
+                       anchor = MovePositionForInsertion(anchor, mh.position, mh.length);
+                       braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length);
+                       braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length);
+               } else if (mh.modificationType & SC_MOD_DELETETEXT) {
+                       currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length);
+                       anchor = MovePositionForDeletion(anchor, mh.position, mh.length);
+                       braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
+                       braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
+               }
+               if (cs.LinesDisplayed() < cs.LinesInDoc()) {
+                       // 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, mh.length);
+                       } else if (mh.modificationType & SC_MOD_BEFOREDELETE) {
+                               NotifyNeedShown(mh.position, mh.length);
                        }
-                       if (cs.LinesDisplayed() < cs.LinesInDoc()) {
-                               // 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, 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);
+                       if (mh.linesAdded > 0) {
+                               cs.InsertLines(lineOfPos, mh.linesAdded);
+                       } else {
+                               cs.DeleteLines(lineOfPos, -mh.linesAdded);
                        }
-                       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);
-                               if (mh.linesAdded > 0) {
-                                       cs.InsertLines(lineOfPos, mh.linesAdded);
-                               } else {
-                                       cs.DeleteLines(lineOfPos, -mh.linesAdded);
-                               }
-                               // Avoid scrolling of display if change before current display
-                               if (mh.position < posTopLine) {
-                                       int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
-                                       if (newTop != topLine) {
-                                               SetTopLine(newTop);
-                                               SetVerticalScrollPos();
-                                       }
+                       // Avoid scrolling of display if change before current display
+                       if (mh.position < posTopLine) {
+                               int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos());
+                               if (newTop != topLine) {
+                                       SetTopLine(newTop);
+                                       SetVerticalScrollPos();
                                }
+                       }
 
-                               //Platform::DebugPrintf("** %x Doc Changed\n", this);
-                               // TODO: could invalidate from mh.startModification to end of screen
-                               //InvalidateRange(mh.position, mh.position + mh.length);
+                       //Platform::DebugPrintf("** %x Doc Changed\n", this);
+                       // TODO: could invalidate from mh.startModification to end of screen
+                       //InvalidateRange(mh.position, mh.position + mh.length);
+                       if (paintState == notPainting) {
                                Redraw();
-                       } else {
-                               //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
-                               //      mh.position, mh.position + mh.length);
+                       }
+               } else {
+                       //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this,
+                       //      mh.position, mh.position + mh.length);
+                       if (paintState == notPainting) {
                                InvalidateRange(mh.position, mh.position + mh.length);
                        }
                }
-       } // else paintState == paintAbandoned so no need to do anything
+       }
 
        if (mh.linesAdded != 0) {
                SetScrollBars();
        }
 
        if (mh.modificationType & SC_MOD_CHANGEMARKER) {
-               RedrawSelMargin();
+               if (paintState == notPainting) {
+                       RedrawSelMargin();
+               }
        }
 
        // If client wants to see this modification
@@ -2829,8 +3110,9 @@ void Editor::LineTranspose() {
                        end = startNext;
                        char *thisLine = CopyRange(start, end);
                        pdoc->DeleteChars(start, end - start);
-                       pdoc->InsertString(startPrev, thisLine, end - start);
-                       MovePositionTo(startPrev + end - start);
+                       if (pdoc->InsertString(startPrev, thisLine, end - start)) {
+                               MovePositionTo(startPrev + end - start);
+                       }
                        delete []thisLine;
                } else {
                        // Last line so line has no line end
@@ -2838,8 +3120,9 @@ void Editor::LineTranspose() {
                        char *prevEnd = CopyRange(endPrev, start);
                        pdoc->DeleteChars(endPrev, end - endPrev);
                        pdoc->InsertString(startPrev, thisLine, end - start);
-                       pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev);
-                       MovePositionTo(startPrev + end - endPrev);
+                       if (pdoc->InsertString(startPrev + end - start, prevEnd, start - endPrev)) {
+                               MovePositionTo(startPrev + end - endPrev);
+                       }
                        delete []thisLine;
                        delete []prevEnd;
                }
@@ -2849,29 +3132,60 @@ void Editor::LineTranspose() {
 
 void Editor::CancelModes() {}
 
-int Editor::KeyCommand(unsigned int iMessage) {
+void Editor::NewLine() {
+       ClearSelection();
+       const char *eol = "\n";
+       if (pdoc->eolMode == SC_EOL_CRLF) {
+               eol = "\r\n";
+       } else if (pdoc->eolMode == SC_EOL_CR) {
+               eol = "\r";
+       } // else SC_EOL_LF -> "\n" already set
+       if (pdoc->InsertString(currentPos, eol)) {
+               SetEmptySelection(currentPos + strlen(eol));
+               while (*eol) {
+                       NotifyChar(*eol);
+                       eol++;
+               }
+       }
+       SetLastXChosen();
+       EnsureCaretVisible();
+}
+
+void Editor::CursorUpOrDown(int direction, bool extend) {
        Point pt = LocationFromPosition(currentPos);
+       int posNew = PositionFromLocation(
+               Point(lastXChosen, pt.y + direction * vs.lineHeight));
+       if (direction < 0) {
+               // Line wrapping may lead to a location on the same line, so
+               // seek back if that is the case.
+               // There is an equivalent case when moving down which skips
+               // over a line but as that does not trap the user it is fine.
+               Point ptNew = LocationFromPosition(posNew);
+               while ((posNew > 0) && (pt.y == ptNew.y)) {
+                       posNew--;
+                       ptNew = LocationFromPosition(posNew);
+               }
+       }
+       MovePositionTo(posNew, extend);
+}
 
+int Editor::KeyCommand(unsigned int iMessage) {
        switch (iMessage) {
        case SCI_LINEDOWN:
-               MovePositionTo(PositionFromLocation(
-                                  Point(lastXChosen, pt.y + vs.lineHeight)));
+               CursorUpOrDown(1);
                break;
        case SCI_LINEDOWNEXTEND:
-               MovePositionTo(PositionFromLocation(
-                                  Point(lastXChosen, pt.y + vs.lineHeight)), true);
+               CursorUpOrDown(1, true);
                break;
        case SCI_LINESCROLLDOWN:
                ScrollTo(topLine + 1);
                MoveCaretInsideView();
                break;
        case SCI_LINEUP:
-               MovePositionTo(PositionFromLocation(
-                                  Point(lastXChosen, pt.y - vs.lineHeight)));
+               CursorUpOrDown(-1);
                break;
        case SCI_LINEUPEXTEND:
-               MovePositionTo(PositionFromLocation(
-                                  Point(lastXChosen, pt.y - vs.lineHeight)), true);
+               CursorUpOrDown(-1, true);
                break;
        case SCI_LINESCROLLUP:
                ScrollTo(topLine - 1);
@@ -2992,23 +3306,7 @@ int Editor::KeyCommand(unsigned int iMessage) {
                EnsureCaretVisible();
                break;
        case SCI_NEWLINE:
-               ClearSelection();
-               if (pdoc->eolMode == SC_EOL_CRLF) {
-                       pdoc->InsertString(currentPos, "\r\n");
-                       SetEmptySelection(currentPos + 2);
-                       NotifyChar('\r');
-                       NotifyChar('\n');
-               } else if (pdoc->eolMode == SC_EOL_CR) {
-                       pdoc->InsertChar(currentPos, '\r');
-                       SetEmptySelection(currentPos + 1);
-                       NotifyChar('\r');
-               } else if (pdoc->eolMode == SC_EOL_LF) {
-                       pdoc->InsertChar(currentPos, '\n');
-                       SetEmptySelection(currentPos + 1);
-                       NotifyChar('\n');
-               }
-               SetLastXChosen();
-               EnsureCaretVisible();
+               NewLine();
                break;
        case SCI_FORMFEED:
                AddChar('\f');
@@ -3022,35 +3320,36 @@ int Editor::KeyCommand(unsigned int iMessage) {
                SetLastXChosen();
                break;
        case SCI_ZOOMIN:
-               if (vs.zoomLevel < 20)
+               if (vs.zoomLevel < 20) {
                        vs.zoomLevel++;
-               NeedWrapping();
-               InvalidateStyleRedraw();
+                       NeedWrapping();
+                       InvalidateStyleRedraw();
+                       NotifyZoom();
+               }
                break;
        case SCI_ZOOMOUT:
-               if (vs.zoomLevel > -10)
+               if (vs.zoomLevel > -10) {
                        vs.zoomLevel--;
-               NeedWrapping();
-               InvalidateStyleRedraw();
+                       NeedWrapping();
+                       InvalidateStyleRedraw();
+                       NotifyZoom();
+               }
                break;
        case SCI_DELWORDLEFT: {
                        int startWord = pdoc->NextWordStart(currentPos, -1);
                        pdoc->DeleteChars(startWord, currentPos - startWord);
-                       MovePositionTo(startWord);
                        SetLastXChosen();
                }
                break;
        case SCI_DELWORDRIGHT: {
                        int endWord = pdoc->NextWordStart(currentPos, 1);
                        pdoc->DeleteChars(currentPos, endWord - currentPos);
-                       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;
@@ -3058,7 +3357,6 @@ int Editor::KeyCommand(unsigned int iMessage) {
                        int line = pdoc->LineFromPosition(currentPos);
                        int end = pdoc->LineEnd(line);
                        pdoc->DeleteChars(currentPos, end - currentPos);
-                       MovePositionTo(currentPos);
                }
                break;
        case SCI_LINECUT: {
@@ -3080,7 +3378,6 @@ int Editor::KeyCommand(unsigned int iMessage) {
                        int start = pdoc->LineStart(line);
                        int end = pdoc->LineStart(line + 1);
                        pdoc->DeleteChars(start, end - start);
-                       MovePositionTo(start);
                }
                break;
        case SCI_LINETRANSPOSE:
@@ -3146,15 +3443,14 @@ void Editor::Indent(bool forwards) {
        int lineCurrentPos = pdoc->LineFromPosition(currentPos);
        if (lineOfAnchor == lineCurrentPos) {
                if (forwards) {
+                       pdoc->BeginUndoAction();
                        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');
@@ -3165,11 +3461,12 @@ void Editor::Indent(bool forwards) {
                                        if (numSpaces < 1)
                                                numSpaces = pdoc->tabInChars;
                                        for (int i = 0; i < numSpaces; i++) {
-                                               pdoc->InsertChar(currentPos, ' ');
+                                               pdoc->InsertChar(currentPos + i, ' ');
                                        }
                                        SetEmptySelection(currentPos + numSpaces);
                                }
                        }
+                       pdoc->EndUndoAction();
                } else {
                        if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) &&
                                pdoc->tabIndents) {
@@ -3220,9 +3517,9 @@ void Editor::Indent(bool forwards) {
  * @return The position of the found text, -1 if not found.
  */
 long Editor::FindText(
-    unsigned long wParam,      ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
+    uptr_t 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.
+    sptr_t lParam) {                   ///< @c TextToFind structure: The text to search for in the given range.
 
        TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
        int lengthFound = strlen(ft->lpstrText);
@@ -3261,9 +3558,9 @@ void Editor::SearchAnchor() {
  */
 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,
+    uptr_t wParam,     ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD,
     ///< @c SCFIND_WORDSTART or @c SCFIND_REGEXP.
-    long lParam) {                     ///< The text to search for.
+    sptr_t lParam) {                   ///< The text to search for.
 
        const char *txt = reinterpret_cast<char *>(lParam);
        int pos;
@@ -3456,9 +3753,10 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul
                        SetSelection(position, position);
                } else {
                        position = MovePositionOutsideChar(position, currentPos - position);
-                       pdoc->InsertString(position, value);
+                       if (pdoc->InsertString(position, value)) {
+                               SetSelection(position + strlen(value), position);
+                       }
                        pdoc->EndUndoAction();
-                       SetSelection(position + strlen(value), position);
                }
        } else if (inDragDrop) {
                SetSelection(position, position);
@@ -3743,17 +4041,20 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
                        if (selStart < selEnd) {
                                if (drag.len) {
                                        if (ctrl) {
-                                               pdoc->InsertString(newPos, drag.s, drag.len);
+                                               if (pdoc->InsertString(newPos, drag.s, drag.len)) {
                                                SetSelection(newPos, newPos + drag.len);
+                                               }
                                        } else if (newPos < selStart) {
                                                pdoc->DeleteChars(selStart, drag.len);
-                                               pdoc->InsertString(newPos, drag.s, drag.len);
-                                               SetSelection(newPos, newPos + drag.len);
+                                               if (pdoc->InsertString(newPos, drag.s, drag.len)) {
+                                                       SetSelection(newPos, newPos + drag.len);
+                                               }
                                        } else if (newPos > selEnd) {
                                                pdoc->DeleteChars(selStart, drag.len);
                                                newPos -= drag.len;
-                                               pdoc->InsertString(newPos, drag.s, drag.len);
-                                               SetSelection(newPos, newPos + drag.len);
+                                               if (pdoc->InsertString(newPos, drag.s, drag.len)) {
+                                                       SetSelection(newPos, newPos + drag.len);
+                                               }
                                        } else {
                                                SetEmptySelection(newPos);
                                        }
@@ -3852,7 +4153,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                        if (IsOverlap(topLine, paintTopLine, lineRangeStart, lineRangeEnd)) {
                                //Platform::DebugPrintf("Change (%d-%d) in top npv(%d-%d)\n",
                                //      lineRangeStart, lineRangeEnd, topLine, paintTopLine);
-                               paintState = paintAbandoned;
+                               AbandonPaint();
                                return;
                        }
                }
@@ -3863,7 +4164,7 @@ void Editor::CheckForChangeOutsidePaint(Range r) {
                        if (IsOverlap(paintBottomLine, bottomLine, lineRangeStart, lineRangeEnd)) {
                                //Platform::DebugPrintf("Change (%d-%d) in bottom npv(%d-%d)\n",
                                //      lineRangeStart, lineRangeEnd, paintBottomLine, bottomLine);
-                               paintState = paintAbandoned;
+                               AbandonPaint();
                                return;
                        }
                }
@@ -4072,6 +4373,10 @@ static bool ValidMargin(unsigned long wParam) {
        return wParam < ViewStyle::margins;
 }
 
+static char *CharPtrFromSPtr(sptr_t lParam) {
+       return reinterpret_cast<char *>(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);
 
@@ -4085,7 +4390,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                {
                        if (lParam == 0)
                                return 0;
-                       char *ptr = reinterpret_cast<char *>(lParam);
+                       if (wParam == 0)
+                               return 0;
+                       char *ptr = CharPtrFromSPtr(lParam);
                        unsigned int iChar = 0;
                        for (; iChar < wParam - 1; iChar++)
                                ptr[iChar] = pdoc->CharAt(iChar);
@@ -4099,7 +4406,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                                return 0;
                        pdoc->DeleteChars(0, pdoc->Length());
                        SetEmptySelection(0);
-                       pdoc->InsertString(0, reinterpret_cast<char *>(lParam));
+                       pdoc->InsertString(0, CharPtrFromSPtr(lParam));
                        return 1;
                }
 
@@ -4124,6 +4431,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_CLEAR:
                Clear();
                SetLastXChosen();
+               EnsureCaretVisible();
                break;
 
        case SCI_UNDO:
@@ -4147,7 +4455,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                        }
                        int lineStart = pdoc->LineStart(wParam);
                        int lineEnd = pdoc->LineStart(wParam + 1);
-                       char *ptr = reinterpret_cast<char *>(lParam);
+                       char *ptr = CharPtrFromSPtr(lParam);
                        int iPlace = 0;
                        for (int iChar = lineStart; iChar < lineEnd; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
@@ -4182,7 +4490,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                                return 0;
                        SelectionText selectedText;
                        CopySelectionRange(&selectedText);
-                       char *ptr = reinterpret_cast<char *>(lParam);
+                       char *ptr = CharPtrFromSPtr(lParam);
                        int iChar = 0;
                        if (selectedText.len) {
                                for (; iChar < selectedText.len; iChar++)
@@ -4222,7 +4530,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                                return 0;
                        pdoc->BeginUndoAction();
                        ClearSelection();
-                       char *replacement = reinterpret_cast<char *>(lParam);
+                       char *replacement = CharPtrFromSPtr(lParam);
                        pdoc->InsertString(currentPos, replacement);
                        pdoc->EndUndoAction();
                        SetEmptySelection(currentPos + strlen(replacement));
@@ -4246,15 +4554,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
 
        case SCI_REPLACETARGET:
                PLATFORM_ASSERT(lParam);
-               return ReplaceTarget(false, reinterpret_cast<char *>(lParam), wParam);
+               return ReplaceTarget(false, CharPtrFromSPtr(lParam), wParam);
 
        case SCI_REPLACETARGETRE:
                PLATFORM_ASSERT(lParam);
-               return ReplaceTarget(true, reinterpret_cast<char *>(lParam), wParam);
+               return ReplaceTarget(true, CharPtrFromSPtr(lParam), wParam);
 
        case SCI_SEARCHINTARGET:
                PLATFORM_ASSERT(lParam);
-               return SearchInTarget(reinterpret_cast<char *>(lParam), wParam);
+               return SearchInTarget(CharPtrFromSPtr(lParam), wParam);
 
        case SCI_SETSEARCHFLAGS:
                searchFlags = wParam;
@@ -4354,7 +4662,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_ADDTEXT: {
                        if (lParam == 0)
                                return 0;
-                       pdoc->InsertString(CurrentPosition(), reinterpret_cast<char *>(lParam), wParam);
+                       pdoc->InsertString(CurrentPosition(), CharPtrFromSPtr(lParam), wParam);
                        SetEmptySelection(currentPos + wParam);
                        return 0;
                }
@@ -4362,7 +4670,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_ADDSTYLEDTEXT: {
                        if (lParam == 0)
                                return 0;
-                       pdoc->InsertStyledString(CurrentPosition() * 2, reinterpret_cast<char *>(lParam), wParam);
+                       pdoc->InsertStyledString(CurrentPosition() * 2, CharPtrFromSPtr(lParam), wParam);
                        SetEmptySelection(currentPos + wParam / 2);
                        return 0;
                }
@@ -4374,13 +4682,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                        if (static_cast<short>(wParam) == -1)
                                insertPos = CurrentPosition();
                        int newCurrent = CurrentPosition();
-                       int newAnchor = anchor;
-                       char *sz = reinterpret_cast<char *>(lParam);
+                       char *sz = CharPtrFromSPtr(lParam);
                        pdoc->InsertString(insertPos, sz);
                        if (newCurrent > insertPos)
                                newCurrent += strlen(sz);
-                       if (newAnchor > insertPos)
-                               newAnchor += strlen(sz);
                        SetEmptySelection(newCurrent);
                        return 0;
                }
@@ -4543,7 +4848,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                        int lineCurrentPos = pdoc->LineFromPosition(currentPos);
                        int lineStart = pdoc->LineStart(lineCurrentPos);
                        unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1);
-                       char *ptr = reinterpret_cast<char *>(lParam);
+                       char *ptr = CharPtrFromSPtr(lParam);
                        unsigned int iPlace = 0;
                        for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) {
                                ptr[iPlace++] = pdoc->CharAt(iChar);
@@ -4573,7 +4878,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_SETSTYLINGEX:           // Specify a complete styling buffer
                if (lParam == 0)
                        return 0;
-               pdoc->SetStyles(wParam, reinterpret_cast<char *>(lParam));
+               pdoc->SetStyles(wParam, CharPtrFromSPtr(lParam));
                break;
 
        case SCI_SETBUFFEREDDRAW:
@@ -4664,6 +4969,36 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_GETLAYOUTCACHE:
                return llc.GetLevel();
 
+       case SCI_SETSCROLLWIDTH:
+               PLATFORM_ASSERT(wParam > 0);
+               if ((wParam > 0) && (wParam != static_cast<unsigned int >(scrollWidth))) {
+                       scrollWidth = wParam;
+                       SetScrollBars();
+               }
+               break;
+
+       case SCI_GETSCROLLWIDTH:
+               return scrollWidth;
+
+       case SCI_TEXTWIDTH:
+               PLATFORM_ASSERT((wParam >= 0) && (wParam <= STYLE_MAX));
+               PLATFORM_ASSERT(lParam);
+               return TextWidth(wParam, CharPtrFromSPtr(lParam));
+
+       case SCI_TEXTHEIGHT:
+               return vs.lineHeight;
+
+       case SCI_SETENDATLASTLINE:
+               PLATFORM_ASSERT((wParam == 0) || (wParam ==1));
+               if (endAtLastLine != (wParam != 0)) {
+                       endAtLastLine = wParam != 0;
+                       SetScrollBars();
+               }
+               break;
+
+       case SCI_GETENDATLASTLINE:
+               return endAtLastLine;
+
        case SCI_GETCOLUMN:
                return pdoc->GetColumn(wParam);
 
@@ -4864,7 +5199,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
                if (lParam == 0)
                        return 0;
                if (wParam <= STYLE_MAX) {
-                       vs.SetStyleFontName(wParam, reinterpret_cast<const char *>(lParam));
+                       vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam));
                        InvalidateStyleRedraw();
                }
                break;
@@ -5005,9 +5340,19 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
        case SCI_SEARCHPREV:
                return SearchText(iMessage, wParam, lParam);
 
-       case SCI_SETCARETPOLICY:
-               caretPolicy = wParam;
-               caretSlop = lParam;
+       case SCI_SETCARETPOLICY:        // Deprecated
+               caretXPolicy = caretYPolicy = wParam;
+               caretXSlop = caretYSlop = lParam;
+               break;
+
+       case SCI_SETXCARETPOLICY:
+               caretXPolicy = wParam;
+               caretXSlop = lParam;
+               break;
+
+       case SCI_SETYCARETPOLICY:
+               caretYPolicy = wParam;
+               caretYSlop = lParam;
                break;
 
        case SCI_SETVISIBLEPOLICY:
@@ -5156,13 +5501,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
 
        case SCI_SETVIEWEOL:
                vs.viewEOL = wParam != 0;
-               Redraw();
+               InvalidateStyleRedraw();
                break;
 
        case SCI_SETZOOM:
                vs.zoomLevel = wParam;
                NeedWrapping();
                InvalidateStyleRedraw();
+               NotifyZoom();
                break;
 
        case SCI_GETZOOM:
index d9719dc534e7fb1ebafb12a75ceeb0dd33d84608..451f123411e6d44138924706398e2cbe17123441 100644 (file)
@@ -45,7 +45,7 @@ public:
        enum { wrapWidthInfinite = 0x7ffffff };
        int maxLineLength;
        int numCharsInLine;
-       enum validLevel { llInvalid, llPositions, llLines } validity;
+       enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
        int xHighlightGuide;
        bool highlightColumn;
        int selStart;
@@ -77,7 +77,7 @@ public:
                }
        }
        void SetLineStart(int line, int start);
-       void SetBracesHighlight(Range rangeLine, Position braces[], 
+       void SetBracesHighlight(Range rangeLine, Position braces[],
                char bracesMatchStyle, int xHighlight);
        void RestoreBracesHighlight(Range rangeLine, Position braces[]);
 };
@@ -97,16 +97,16 @@ public:
        LineLayoutCache();
        virtual ~LineLayoutCache();
        void Deallocate();
-       enum { 
-               llcNone=SC_CACHE_NONE, 
-               llcCaret=SC_CACHE_CARET, 
-               llcPage=SC_CACHE_PAGE, 
+       enum {
+               llcNone=SC_CACHE_NONE,
+               llcCaret=SC_CACHE_CARET,
+               llcPage=SC_CACHE_PAGE,
                llcDocument=SC_CACHE_DOCUMENT
        };
        void Invalidate(LineLayout::validLevel validity_);
        void SetLevel(int level_);
        int GetLevel() { return level; }
-       LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, 
+       LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_,
                int linesOnScreen, int linesInDoc);
        void Dispose(LineLayout *ll);
 };
@@ -200,6 +200,8 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        int xOffset;            ///< Horizontal scrolled amount in pixels
        int xCaretMargin;       ///< Ensure this many pixels visible on both sides of caret
        bool horizontalScrollBarVisible;
+       int scrollWidth;
+       bool endAtLastLine;
 
        Surface *pixmapLine;
        Surface *pixmapSelMargin;
@@ -257,8 +259,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
        int xEndSelect;
        bool primarySelection;
 
-       int caretPolicy;
-       int caretSlop;
+       int caretXPolicy;
+       int caretXSlop; ///< Ensure this many pixels visible on both sides of caret
+
+       int caretYPolicy;
+       int caretYSlop; ///< Ensure this many lines visible on both sides of caret
 
        int visiblePolicy;
        int visibleSlop;
@@ -302,6 +307,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        int LineFromLocation(Point pt);
        void SetTopLine(int topLineNew);
 
+       bool AbandonPaint();
        void RedrawRect(PRectangle rc);
        void Redraw();
        void RedrawSelMargin();
@@ -336,12 +342,13 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault);
        void PaintSelMargin(Surface *surface, PRectangle &rc);
        LineLayout *RetrieveLineLayout(int lineNumber);
-       void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, 
+       void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
                int width=LineLayout::wrapWidthInfinite);
        void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
                PRectangle rcLine, LineLayout *ll, int subLine=0);
        void Paint(Surface *surfaceWindow, PRectangle rcArea);
        long FormatRange(bool draw, RangeToFormat *pfr);
+       int TextWidth(int style, const char *text);
 
        virtual void SetVerticalScrollPos() = 0;
        virtual void SetHorizontalScrollPos() = 0;
@@ -383,6 +390,7 @@ protected:  // ScintillaBase subclass needs access to much of Editor
        bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);
        void NotifyNeedShown(int pos, int len);
        void NotifyDwelling(Point pt, bool state);
+       void NotifyZoom();
 
        void NotifyModifyAttempt(Document *document, void *userData);
        void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
@@ -390,12 +398,14 @@ protected:        // ScintillaBase subclass needs access to much of Editor
        void NotifyModified(Document *document, DocModification mh, void *userData);
        void NotifyDeleted(Document *document, void *userData);
        void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
-       void NotifyMacroRecord(unsigned int iMessage, unsigned long wParam, long lParam);
+       void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
 
        void PageMove(int direction, bool extend=false);
        void ChangeCaseOfSelection(bool makeUpperCase);
        void LineTranspose();
        virtual void CancelModes();
+       void NewLine();
+       void CursorUpOrDown(int direction, bool extend=false);
        virtual int KeyCommand(unsigned int iMessage);
        virtual int KeyDefault(int /* key */, int /*modifiers*/);
        int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
@@ -405,9 +415,9 @@ protected:  // ScintillaBase subclass needs access to much of Editor
 
        void Indent(bool forwards);
 
-       long FindText(unsigned long wParam, long lParam);
+       long FindText(uptr_t wParam, sptr_t lParam);
        void SearchAnchor();
-       long SearchText(unsigned int iMessage, unsigned long wParam, long lParam);
+       long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
        long SearchInTarget(const char *text, int length);
        void GoToLine(int lineNo);
 
index d1eddef5ff814bf16e1fb96cbe9ec8e8ab1f1532..8a03aa8ac4fbb42e7eb46b1793bfabccb2912682 100644 (file)
@@ -23,10 +23,12 @@ const LexerModule *LexerModule::base = 0;
 int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
 
 LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
-       const char *languageName_, LexerFunction fnFolder_) :
+       const char *languageName_, LexerFunction fnFolder_,
+       const char * const wordListDescriptions_[]) :
        language(language_), 
        fnLexer(fnLexer_), 
        fnFolder(fnFolder_), 
+       wordListDescriptions(wordListDescriptions_), 
        languageName(languageName_) {
        next = base;
        base = this;
@@ -36,6 +38,31 @@ LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
        }
 }
 
+int LexerModule::GetNumWordLists() const {
+       if (wordListDescriptions == NULL) {
+               return -1;
+       } else {
+               int numWordLists = 0;
+
+               while (wordListDescriptions[numWordLists]) {
+                       ++numWordLists;
+               }
+
+               return numWordLists;
+       }
+}
+
+const char * LexerModule::GetWordListDescription(int index) const {
+       static const char *emptyStr = "";
+
+       PLATFORM_ASSERT(index < GetNumWordLists());
+       if (index >= GetNumWordLists()) {
+               return emptyStr;
+       } else {
+               return wordListDescriptions[index];
+       }
+}
 const LexerModule *LexerModule::Find(int language) {
        const LexerModule *lm = base;
        while (lm) {
@@ -97,83 +124,55 @@ static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[
 
 LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");
 
-#ifdef __vms
-#define LINK_LEXERS
-#endif
-
-#ifdef LINK_LEXERS
-
-// 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.
-
+// Alternative historical name for Scintilla_LinkLexers
 int wxForceScintillaLexers(void) {
        return Scintilla_LinkLexers();
 }
 
+// To add or remove a lexer, add or remove its file and run LexGen.py.
+
+// Force a reference to all of the Scintilla lexers so that the linker will
+// not remove the code of the lexers.
 int Scintilla_LinkLexers() {
-  extern LexerModule lmAda;
-  extern LexerModule lmAVE;
-  extern LexerModule lmBaan;
-  extern LexerModule lmBatch;
-  extern LexerModule lmConf;
-  extern LexerModule lmCPP;
-  extern LexerModule lmDiff;
-  extern LexerModule lmEiffel;
-  extern LexerModule lmEiffelkw;
-  extern LexerModule lmErrorList;
-  extern LexerModule lmHTML;
-  extern LexerModule lmLatex;
-  extern LexerModule lmLISP;
-  extern LexerModule lmLua;
-  extern LexerModule lmMake;
-  extern LexerModule lmMatlab;
-  extern LexerModule lmPascal;
-  extern LexerModule lmPerl;
-  extern LexerModule lmProps;  
-  extern LexerModule lmPython;
-  extern LexerModule lmRuby;
-  extern LexerModule lmSQL;
-  extern LexerModule lmVB;
-  extern LexerModule lmXML;
-  extern LexerModule lmBullant;
-
-  if (
-      &lmAda
-      && &lmAVE
-      && &lmBaan
-      && &lmConf
-      && &lmDiff
-      && &lmLatex
-      && &lmPascal
-      && &lmCPP
-      && &lmHTML
-      && &lmXML
-      && &lmProps
-      && &lmErrorList
-      && &lmMake
-      && &lmMatlab
-      && &lmBatch
-      && &lmPerl
-      && &lmPython
-      && &lmSQL
-      && &lmVB
-      && &lmRuby
-      && &lmEiffel
-      && &lmEiffelkw
-      && &lmLISP
-      && &lmLua
-      && &lmNull
-      && &lmBullant
-      )
-    {
-      return 1;
-    }
-  else
-    {
-      return 0;
-    }
+       static int forcer = 0;
+
+// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
+#define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage();
+
+//++Autogenerated -- run src/LexGen.py to regenerate
+//**\(\tLINK_LEXER(\*);\n\)
+       LINK_LEXER(lmAda);
+       LINK_LEXER(lmAVE);
+       LINK_LEXER(lmBaan);
+       LINK_LEXER(lmBullant);
+       LINK_LEXER(lmConf);
+       LINK_LEXER(lmCPP);
+       LINK_LEXER(lmTCL);
+       LINK_LEXER(lmNncrontab);
+       LINK_LEXER(lmEiffel);
+       LINK_LEXER(lmEiffelkw);
+       LINK_LEXER(lmHTML);
+       LINK_LEXER(lmXML);
+       LINK_LEXER(lmASP);
+       LINK_LEXER(lmPHP);
+       LINK_LEXER(lmLISP);
+       LINK_LEXER(lmLua);
+       LINK_LEXER(lmMatlab);
+       LINK_LEXER(lmBatch);
+       LINK_LEXER(lmDiff);
+       LINK_LEXER(lmProps);
+       LINK_LEXER(lmMake);
+       LINK_LEXER(lmErrorList);
+       LINK_LEXER(lmLatex);
+       LINK_LEXER(lmPascal);
+       LINK_LEXER(lmPerl);
+       LINK_LEXER(lmPython);
+       LINK_LEXER(lmRuby);
+       LINK_LEXER(lmSQL);
+       LINK_LEXER(lmVB);
+       LINK_LEXER(lmVBScript);
+
+//--Autogenerated -- end of automatically generated section
+
+       return 1;
 }
-#endif
index c85664fd5b04e8bc8b2aa687a9c9dbbabe10296d..c1bb1ff9a30bace3c31ef25db5c558d9bee2b370 100644 (file)
@@ -72,17 +72,18 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
 
        for (; sc.More(); sc.Forward()) {
        
+               if (sc.atLineStart && (sc.state == SCE_C_STRING)) {
+                       // Prevent SCE_C_STRINGEOL from leaking back to previous line
+                       sc.SetState(SCE_C_STRING);
+               }
+
                // Handle line continuation generically.
                if (sc.ch == '\\') {
-                       if (sc.Match("\\\n")) {
-                               sc.Forward();
-                               sc.Forward();
-                               continue;
-                       }
-                       if (sc.Match("\\\r\n")) {
-                               sc.Forward();
-                               sc.Forward();
+                       if (sc.chNext == '\n' || sc.chNext == '\r') {
                                sc.Forward();
+                               if (sc.ch == '\r' && sc.chNext == '\n') {
+                                       sc.Forward();
+                               }
                                continue;
                        }
                }
@@ -260,9 +261,17 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
        sc.Complete();
 }
 
+static bool IsStreamCommentStyle(int style) {
+       return style == SCE_C_COMMENT || 
+               style == SCE_C_COMMENTDOC ||
+               style == SCE_C_COMMENTDOCKEYWORD ||
+               style == SCE_C_COMMENTDOCKEYWORDERROR;
+}
+
 static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[],
                             Accessor &styler) {
        bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+       bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
        bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
        unsigned int endPos = startPos + length;
        int visibleChars = 0;
@@ -279,15 +288,37 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis
                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) {
+               if (foldComment && IsStreamCommentStyle(style)) {
+                       if (!IsStreamCommentStyle(stylePrev)) {
                                levelCurrent++;
-                       } else if ((style != styleNext) && !atEOL) {
+                       } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
                                // Comments don't end at end of line and the next character may be unstyled.
                                levelCurrent--;
                        }
                }
+               if (foldComment && (style == SCE_C_COMMENTLINE)) {
+                       if ((ch == '/') && (chNext == '/')) {
+                               char chNext2 = styler.SafeGetCharAt(i + 2);
+                               if (chNext2 == '{') {
+                                       levelCurrent++;
+                               } else if (chNext2 == '}') {
+                                       levelCurrent--;
+                               }
+                       }
+               }
+               if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
+                       if (ch == '#') {
+                               unsigned int j=i+1;
+                               while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
+                                       j++;
+                               }
+                               if (styler.Match(j, "region") || styler.Match(j, "if")) {
+                                       levelCurrent++;
+                               } else if (styler.Match(j, "end")) {
+                                       levelCurrent--;
+                               }
+                       }
+               }
                if (style == SCE_C_OPERATOR) {
                        if (ch == '{') {
                                levelCurrent++;
@@ -316,5 +347,12 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis
        styler.SetLevel(lineCurrent, levelPrev | flagsNext);
 }
 
-LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc);
-LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc);
+static const char * const cppWordLists[] = {
+       "Primary keywords and identifiers",
+       "Secondary keywords and identifiers",
+       "Documentation comment keywords",
+       0,
+};
+
+LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc, cppWordLists);
+LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc, cppWordLists);
index ce35fedec5026be87881e5dced762a5bd6932429..37729cbfdd73c682a055420854dc65b1731a89c9 100644 (file)
@@ -2,7 +2,7 @@
 /** @file LexCrontab.cxx
  ** Lexer to use with extended crontab files used by a powerful
  ** Windows scheduler/event monitor/automation manager nnCron.
- ** (http://nemtsev.virtualave.net/)
+ ** (http://nemtsev.eserv.ru/)
  **/
 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
 // The License.txt file describes the conditions under which this software may be distributed.
@@ -62,7 +62,8 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
                                        state = SCE_NNCRONTAB_TASK;
                                        styler.ColourTo(i,SCE_NNCRONTAB_TASK);
                                }
-                                 else if( ch == '\\' && styler.SafeGetCharAt(i+1) == ' ') {
+                                 else if( ch == '\\' && (styler.SafeGetCharAt(i+1) == ' ' || 
+                                                                                styler.SafeGetCharAt(i+1) == '\t')) {
                                        // signals the start of an extended comment...
                                        state = SCE_NNCRONTAB_COMMENT;
                                        styler.ColourTo(i,SCE_NNCRONTAB_COMMENT);
@@ -81,6 +82,10 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
                                        // signals environment variables
                                        state = SCE_NNCRONTAB_ENVIRONMENT;
                                        styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
+                               } else if( ch == '<' && styler.SafeGetCharAt(i+1) == '%') {
+                                       // signals environment variables
+                                       state = SCE_NNCRONTAB_ENVIRONMENT;
+                                       styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
                                } else if( ch == '*' ) {
                                        // signals an asterisk
                                        // no state jump necessary for this simple case...
@@ -148,7 +153,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
                                        break;
                                }
                                if( (ch == '%' && styler.SafeGetCharAt(i-1)!='\\')
-                                       || (ch == '\n') || (ch == '\r') ) {
+                                       || (ch == '\n') || (ch == '\r') || (ch == '>') ) {
                                        state = SCE_NNCRONTAB_DEFAULT;
                                        styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT);
                                        break;
@@ -159,7 +164,8 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
                        case SCE_NNCRONTAB_IDENTIFIER:
                                // stay  in CONF_IDENTIFIER state until we find a non-alphanumeric
                                if( isalnum(ch) || (ch == '_') || (ch == '-') || (ch == '/') ||
-                                       (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ) {
+                                       (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ||
+                                       (ch == '@') ) {
                                        buffer[bufferCount++] = ch;
                                } else {
                                        state = SCE_NNCRONTAB_DEFAULT;
index 67ee29c5e7c8b5a414a1cfd5d6225c7477db869c..545bbfd553317abf95674c83caf0fe4e1bd4de0f 100644 (file)
@@ -220,9 +220,11 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
                        isScript = 0 == strcmp(s, "script");
                }
        }
-       if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords)
+       if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords) {
                // No keywords -> all are known
                chAttr = SCE_H_TAG;
+               isScript = 0 == strcmp(s, "script");
+       }
        styler.ColourTo(end, chAttr);
        return isScript ? SCE_H_SCRIPT : chAttr;
 }
@@ -555,6 +557,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
                                //case SCE_HJ_COMMENTLINE:
                        case SCE_HJ_DOUBLESTRING:
                        case SCE_HJ_SINGLESTRING:
+                       case SCE_HJ_REGEX:
                        case SCE_HB_STRING:
                        case SCE_HP_STRING:
                        case SCE_HP_TRIPLE:
@@ -1851,7 +1854,17 @@ static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, Wo
        sc.Complete();
 }
 
-LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");
-LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml");
-LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp");
-LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php");
+static const char * const htmlWordListDesc[] = {
+       "HTML elements and attributes",
+       "JavaScript keywords",
+       "VBScript keywords",
+       "Python keywords",
+       "PHP keywords",
+       "SGML and DTD keywords",
+       0,
+};
+
+LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc);
+LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc);
+LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc);
+LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc);
index 338a04e327f0661683fbed476cf9c0f10bfee388..fc9607e25d24300256ea201cd1bf598f47151378 100644 (file)
@@ -4,7 +4,7 @@
  **
  ** Written by Paul Winwood.
  ** Folder by Alexey Yutkin.
- ** Modified by Marcos E. Wurzius
+ ** Modified by Marcos E. Wurzius & Philippe Lhoste
  **/
 
 #include <stdlib.h>
@@ -23,6 +23,7 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#define SCE_LUA_LAST_STYLE     SCE_LUA_WORD6
 
 static inline bool IsAWordChar(const int ch) {
        return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
@@ -32,7 +33,6 @@ inline bool IsAWordStart(const int ch) {
        return (ch < 0x80) && (isalnum(ch) || ch == '_');
 }
 
-
 inline bool isLuaOperator(char ch) {
        if (isalnum(ch))
                return false;
@@ -47,9 +47,12 @@ inline bool isLuaOperator(char ch) {
        return false;
 }
 
-
-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 &keywords2 = *keywordlists[1];
@@ -57,28 +60,40 @@ static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, Wo
        WordList &keywords4 = *keywordlists[3];
        WordList &keywords5 = *keywordlists[4];
        WordList &keywords6 = *keywordlists[5];
-       int literalString = 0;
-       int literalStringFlag =0;
+
+       // Must initialize the literal string nesting level, if we are inside such a string.
+       int literalStringLevel = 0;
+       if (initStyle == SCE_LUA_LITERALSTRING) {
+               literalStringLevel = 1;
+       }
+       // We use states above the last one to indicate nesting level of literal strings
+       if (initStyle > SCE_LUA_LAST_STYLE) {
+               literalStringLevel = initStyle - SCE_LUA_LAST_STYLE + 1;
+       }
 
        // Do not leak onto next line
-       if (initStyle == SCE_LUA_STRINGEOL)
+       if (initStyle == SCE_LUA_STRINGEOL) {
                initStyle = SCE_LUA_DEFAULT;
+       }
 
        StyleContext sc(startPos, length, initStyle, styler);
-       if(startPos == 0 && sc.ch == '#') sc.SetState(SCE_LUA_COMMENTLINE);
+       if (startPos == 0 && sc.ch == '#') {
+               sc.SetState(SCE_LUA_COMMENTLINE);
+       }
        for (; sc.More(); sc.Forward()) {
-       
-               // Handle line continuation generically.
-               if (sc.ch == '\\') {
-                       if (sc.Match("\\\n")) {
-                               sc.Forward();
-                               sc.Forward();
-                               continue;
-                       }
-                       if (sc.Match("\\\r\n")) {
-                               sc.Forward();
-                               sc.Forward();
+               if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) {
+                       // Prevent SCE_LUA_STRINGEOL from leaking back to previous line
+                       sc.SetState(SCE_LUA_STRING);
+               }
+
+               // Handle string line continuation
+               if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) &&
+                               sc.ch == '\\') {
+                       if (sc.chNext == '\n' || sc.chNext == '\r') {
                                sc.Forward();
+                               if (sc.ch == '\r' && sc.chNext == '\n') {
+                                       sc.Forward();
+                               }
                                continue;
                        }
                }
@@ -109,12 +124,14 @@ static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, Wo
                                }
                                sc.SetState(SCE_LUA_DEFAULT);
                        }
-
                } else if (sc.state == SCE_LUA_COMMENTLINE ) {
                        if (sc.atLineEnd) {
                                sc.SetState(SCE_LUA_DEFAULT);
                        }
+               } else if (sc.state == SCE_LUA_PREPROCESSOR ) {
+                       if (sc.atLineEnd) {
+                               sc.SetState(SCE_LUA_DEFAULT);
+                       }
                } else if (sc.state == SCE_LUA_STRING) {
                        if (sc.ch == '\\') {
                                if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
@@ -126,7 +143,6 @@ static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, Wo
                                sc.ChangeState(SCE_LUA_STRINGEOL);
                                sc.ForwardSetState(SCE_LUA_DEFAULT);
                        }
-                       
                } else if (sc.state == SCE_LUA_CHARACTER) {
                        if (sc.ch == '\\') {
                                if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
@@ -138,33 +154,41 @@ static void ColouriseLuaDoc(unsigned int startPos, int length, int initStyle, Wo
                                sc.ChangeState(SCE_LUA_STRINGEOL);
                                sc.ForwardSetState(SCE_LUA_DEFAULT);
                        }
-               } else if (sc.state == SCE_LUA_LITERALSTRING) {
-                       if (sc.chPrev == '[' && sc.ch == '[' && literalStringFlag != 1)         {
-                               literalString++;
-                               literalStringFlag = 1;
-                       }
-                       else if (sc.chPrev == ']' && sc.ch == ']' && literalStringFlag != 2 ) {
-                               if((--literalString == 1))
+               } else if (sc.state == SCE_LUA_LITERALSTRING || sc.state > SCE_LUA_LAST_STYLE) {
+                       if (sc.Match('[', '[')) {
+                               literalStringLevel++;
+                               sc.SetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
+                       } else if (sc.Match(']', ']') && literalStringLevel > 0) {
+                               literalStringLevel--;
+                               sc.Forward();
+                               if (literalStringLevel == 0) {
                                        sc.ForwardSetState(SCE_LUA_DEFAULT);
-                               literalStringFlag = 2;
+                               } else if (literalStringLevel == 1) {
+                                       sc.ForwardSetState(SCE_LUA_LITERALSTRING);
+                               } else {
+                                       sc.ForwardSetState(SCE_LUA_LAST_STYLE + literalStringLevel - 1);
+                               }
                        }
-                       else literalStringFlag = 0;
-               }               
+               }
                // Determine if a new state should be entered.
                if (sc.state == SCE_LUA_DEFAULT) {
                        if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
-                                       sc.SetState(SCE_LUA_NUMBER);
-                       } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
-                                       sc.SetState(SCE_LUA_IDENTIFIER);
-                       } else if (sc.ch == '\"') {
+                               sc.SetState(SCE_LUA_NUMBER);
+                       } else if (IsAWordStart(sc.ch)) {
+                               sc.SetState(SCE_LUA_IDENTIFIER);
+                       } else if (sc.Match('\"')) {
                                sc.SetState(SCE_LUA_STRING);
-                       } else if (sc.ch == '\'') {
+                       } else if (sc.Match('\'')) {
                                sc.SetState(SCE_LUA_CHARACTER);
-                       } else if (sc.ch == '[' && sc.chNext == '[') {
+                       } else if (sc.Match('[', '[')) {
+                               literalStringLevel = 1;
                                sc.SetState(SCE_LUA_LITERALSTRING);
-                               literalString = 1;
-                       } else if (sc.ch == '-' && sc.chNext == '-') {
+                               sc.Forward();
+                       } else if (sc.Match('-', '-')) {
                                sc.SetState(SCE_LUA_COMMENTLINE);
+                               sc.Forward();
+                       } else if (sc.Match('$') && sc.atLineStart) {
+                               sc.SetState(SCE_LUA_PREPROCESSOR);      // Obsolete since Lua 4.0, but still in old code
                        }  else if (isLuaOperator(static_cast<char>(sc.ch))) {
                                sc.SetState(SCE_LUA_OPERATOR);
                        }
@@ -185,6 +209,7 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
        bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
        int styleNext = styler.StyleAt(startPos);
        char s[10];
+
        for (unsigned int i = startPos; i < lengthDoc; i++) {
                char ch = chNext;
                chNext = styler.SafeGetCharAt(i + 1);
@@ -192,36 +217,38 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
                styleNext = styler.StyleAt(i + 1);
                bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
                if (style == SCE_LUA_WORD) {
-                       if ( ch == 'i' || ch == 'e' || ch == 't' || ch == 'd' || ch == 'f') {
+                       if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e') {
                                for (unsigned int j = 0; j < 8; j++) {
-                                       if (!iswordchar(styler[i + j]))
+                                       if (!iswordchar(styler[i + j])) {
                                                break;
+                                       }
                                        s[j] = styler[i + j];
                                        s[j + 1] = '\0';
                                }
-                               
-                               if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0)
-                                       || (strcmp(s, "function") == 0))
+
+                               if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0)) {
                                        levelCurrent++;
-                               if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0))
+                               }
+                               if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) {
                                        levelCurrent--;
-                               
+                               }
                        }
-               }
-               else if (style == SCE_LUA_OPERATOR)
-               {
-                       if(ch == '{' || ch == '(')
+               } else if (style == SCE_LUA_OPERATOR) {
+                       if (ch == '{' || ch == '(') {
                                levelCurrent++;
-                       else if(ch == '}' || ch == ')')
+                       } else if (ch == '}' || ch == ')') {
                                levelCurrent--;
+                       }
                }
-                       
+
                if (atEOL) {
                        int lev = levelPrev;
-                       if (visibleChars == 0 && foldCompact)
+                       if (visibleChars == 0 && foldCompact) {
                                lev |= SC_FOLDLEVELWHITEFLAG;
-                       if ((levelCurrent > levelPrev) && (visibleChars > 0))
+                       }
+                       if ((levelCurrent > levelPrev) && (visibleChars > 0)) {
                                lev |= SC_FOLDLEVELHEADERFLAG;
+                       }
                        if (lev != styler.LevelAt(lineCurrent)) {
                                styler.SetLevel(lineCurrent, lev);
                        }
@@ -229,8 +256,9 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
                        levelPrev = levelCurrent;
                        visibleChars = 0;
                }
-               if (!isspacechar(ch))
+               if (!isspacechar(ch)) {
                        visibleChars++;
+               }
        }
        // Fill in the real level of the next line, keeping the current flags as they will be filled in later
 
index f188722ff208fb7396934517a686dbbf71188970..7010591430fff612b4c3c718115287f638cdf89d 100644 (file)
@@ -159,21 +159,23 @@ static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
        // difference starts then each line starting with ' ' is a whitespace
        // otherwise it is considered a comment (Only in..., Binary file...)
        if (0 == strncmp(lineBuffer, "diff ", 3)) {
-               styler.ColourTo(endLine, 2);
+               styler.ColourTo(endLine, SCE_DIFF_COMMAND);
        } else if (0 == strncmp(lineBuffer, "--- ", 3)) {
-               styler.ColourTo(endLine, 3);
+               styler.ColourTo(endLine, SCE_DIFF_HEADER);
        } else if (0 == strncmp(lineBuffer, "+++ ", 3)) {
-               styler.ColourTo(endLine, 3);
+               styler.ColourTo(endLine, SCE_DIFF_HEADER);
+       } else if (0 == strncmp(lineBuffer, "***", 3)) {
+               styler.ColourTo(endLine, SCE_DIFF_HEADER);
        } else if (lineBuffer[0] == '@') {
-               styler.ColourTo(endLine, 4);
+               styler.ColourTo(endLine, SCE_DIFF_POSITION);
        } else if (lineBuffer[0] == '-') {
-               styler.ColourTo(endLine, 5);
+               styler.ColourTo(endLine, SCE_DIFF_DELETED);
        } else if (lineBuffer[0] == '+') {
-               styler.ColourTo(endLine, 6);
+               styler.ColourTo(endLine, SCE_DIFF_ADDED);
        } else if (lineBuffer[0] != ' ') {
-               styler.ColourTo(endLine, 1);
+               styler.ColourTo(endLine, SCE_DIFF_COMMENT);
        } else {
-               styler.ColourTo(endLine, 0);
+               styler.ColourTo(endLine, SCE_DIFF_DEFAULT);
        }
 }
 
@@ -208,28 +210,28 @@ static void ColourisePropsLine(
                i++;
        if (i < lengthLine) {
                if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
-                       styler.ColourTo(endPos, 1);
+                       styler.ColourTo(endPos, SCE_PROPS_COMMENT);
                } else if (lineBuffer[i] == '[') {
-                       styler.ColourTo(endPos, 2);
+                       styler.ColourTo(endPos, SCE_PROPS_SECTION);
                } else if (lineBuffer[i] == '@') {
-                       styler.ColourTo(startLine + i, 4);
+                       styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
                        if (lineBuffer[++i] == '=')
-                               styler.ColourTo(startLine + i, 3);
-                       styler.ColourTo(endPos, 0);
+                               styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
+                       styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
                } else {
                        // Search for the '=' character
                        while ((i < lengthLine) && (lineBuffer[i] != '='))
                                i++;
                        if ((i < lengthLine) && (lineBuffer[i] == '=')) {
-                               styler.ColourTo(startLine + i - 1, 0);
+                               styler.ColourTo(startLine + i - 1, SCE_PROPS_DEFAULT);
                                styler.ColourTo(startLine + i, 3);
-                               styler.ColourTo(endPos, 0);
+                               styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
                        } else {
-                               styler.ColourTo(endPos, 0);
+                               styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
                        }
                }
        } else {
-               styler.ColourTo(endPos, 0);
+               styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
        }
 }
 
@@ -386,6 +388,8 @@ static void ColouriseErrorListLine(
                                state = 1;
                        } else if ((state == 0) && (lineBuffer[i] == '(')) {
                                state = 10;
+                       } else if ((state == 0) && (lineBuffer[i] == '\t')) {
+                               state = 20;
                        } else if ((state == 1) && isdigit(lineBuffer[i])) {
                                state = 2;
                        } else if ((state == 2) && (lineBuffer[i] == ':')) {
@@ -406,12 +410,22 @@ static void ColouriseErrorListLine(
                                break;
                        } else if (((state == 11) || (state == 14)) && !((lineBuffer[i] == ' ') || isdigit(lineBuffer[i]))) {
                                state = 99;
+                       } else if ((state == 20) && isdigit(lineBuffer[i])) {
+                               state = 24;
+                               break;
+                       } else if ((state == 20) && ((lineBuffer[i] == '/') && (lineBuffer[i+1] == '^'))) {
+                               state = 21;
+                       } else if ((state == 21) && ((lineBuffer[i] == '$') && (lineBuffer[i+1] == '/'))) {
+                               state = 22;
+                               break;          
                        }
                }
                if (state == 3) {
                        styler.ColourTo(endPos, SCE_ERR_GCC);
                } else if ((state == 13) || (state == 14) || (state == 15)) {
                        styler.ColourTo(endPos, SCE_ERR_MS);
+               } else if (((state == 22) || (state == 24)) && (lineBuffer[0] != '\t')) {
+                       styler.ColourTo(endPos, SCE_ERR_CTAG);  
                } else {
                        styler.ColourTo(endPos, SCE_ERR_DEFAULT);
                }
index 76dc48de6887be95f1a3a4884064429c7ff4331b..1715009c9d0d064a08f2bbd095e614d8e86902e5 100644 (file)
@@ -659,4 +659,9 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
        styler.ColourTo(lengthDoc - 1, state);
 }
 
-LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl");
+static const char * const perlWordListDesc[] = {
+       "Perl keywords",
+       0
+};
+
+LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", 0, perlWordListDesc);
index 6675c1f0376d00bc9ceba566312a91cb07037bad..01365c1901a2eb0c99f336c133c3a2ae1c5ad62b 100644 (file)
@@ -408,4 +408,10 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
        //styler.SetLevel(lineCurrent, indentCurrent);
 }
 
-LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc);
+static const char * const pythonWordListDesc[] = {
+       "Python keywords",
+       0
+};
+
+LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc, 
+                                        pythonWordListDesc);
index ba938947f59db0d9751214375126fc4a4af13da0..29679969132f0f3eeabcf9da2c084875303df0a0 100644 (file)
@@ -45,7 +45,7 @@ int CompareCaseInsensitive(const char *a, const char *b) {
        return *a - *b;
 }
 
-int CompareNCaseInsensitive(const char *a, const char *b, int len) {
+int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
        while (*a && *b && len) {
                if (*a != *b) {
                        char upperA = MakeUpperCase(*a);
@@ -68,7 +68,7 @@ bool EqualCaseInsensitive(const char *a, const char *b) {
        return 0 == CompareCaseInsensitive(a, b);
 }
 
-inline unsigned int HashString(const char *s, int len) {
+inline unsigned int HashString(const char *s, size_t len) {
        unsigned int ret = 0;
        while (len--) {
                ret <<= 4;
@@ -93,9 +93,9 @@ 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);
+               lenKey = static_cast<int>(strlen(key));
        if (lenVal == -1)
-               lenVal = strlen(val);
+               lenVal = static_cast<int>(strlen(val));
        unsigned int hash = HashString(key, lenKey);
        for (Property *p = props[hash % hashRoots]; p; p = p->next) {
                if ((hash == p->hash) && 
@@ -187,7 +187,7 @@ SString PropSet::Expand(const char *withVars) {
                        int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
                        char *var = StringDup(cpvar + 2, lenvar);
                        SString val = GetExpanded(var);
-                       int newlenbase = strlen(base) + val.length() - lenvar;
+                       size_t newlenbase = strlen(base) + val.length() - lenvar;
                        char *newbase = new char[newlenbase];
                        strncpy(newbase, base, cpvar - base);
                        strcpy(newbase + (cpvar - base), val.c_str());
@@ -224,11 +224,11 @@ bool isprefix(const char *target, const char *prefix) {
 }
 
 static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) {
-       int lentarget = strlen(target);
-       int lensuffix = strlen(suffix);
+       size_t lentarget = strlen(target);
+       size_t lensuffix = strlen(suffix);
        if (lensuffix > lentarget)
                return false;
-       for (int i = lensuffix - 1; i >= 0; i--) {
+       for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) {
                if (MakeUpperCase(target[i + lentarget - lensuffix]) !=
                        MakeUpperCase(suffix[i]))
                        return false;
@@ -306,7 +306,7 @@ SString PropSet::GetNewExpand(const char *keybase, const char *filename) {
                        int lenvar = cpendvar - cpvar - 2;      // Subtract the $()
                        char *var = StringDup(cpvar + 2, lenvar);
                        SString val = GetWild(var, filename);
-                       int newlenbase = strlen(base) + val.length() - lenvar;
+                       size_t newlenbase = strlen(base) + val.length() - lenvar;
                        char *newbase = new char[newlenbase];
                        strncpy(newbase, base, cpvar - base);
                        strcpy(newbase + (cpvar - base), val.c_str());
@@ -340,7 +340,7 @@ void PropSet::Clear() {
 }
 
 char *PropSet::ToString() {
-       unsigned int len=0;
+       size_t len=0;
        for (int r = 0; r < hashRoots; r++) {
                for (Property *p = props[r]; p; p = p->next) {
                        len += strlen(p->key) + 1;
@@ -435,8 +435,8 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
        if (keywords) {
                words = 0;
                prev = '\0';
-               int slen = strlen(wordlist);
-               for (int k = 0; k < slen; k++) {
+               size_t slen = strlen(wordlist);
+               for (size_t k = 0; k < slen; k++) {
                        if (!iswordsep(wordlist[k], onlyLineEnds)) {
                                if (!prev) {
                                        keywords[words] = &wordlist[k];
index 9296657f80fef0840256fbad831b5792c37f0793..2c63bb95906c369200e6d8190c1702a5487cb520 100644 (file)
@@ -30,8 +30,8 @@
  * Modification history:
  *
  * $Log$
- * Revision 1.3  2002/03/18 22:31:00  RD
- * Updated wxSTC from Scintilla 1.40 to Scintilla 1.45
+ * Revision 1.4  2002/09/06 16:58:12  RD
+ * Updated to Scintilla from 1.45 to 1.47
  *
  * Revision 1.6  2001/04/29 13:32:10  nyamatongwe
  * Addition of new target methods - versions of ReplaceTarget that take counted
index 0dabb5393c99a170d3de5f88558ee069ec2837f6..1238e2ecb20b0f485cd23fd6fbaf8d132444c78c 100644 (file)
@@ -64,11 +64,18 @@ void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) {
 }
 
 void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
-       bool acActiveBeforeCharAdded = ac.Active();
-       if (!acActiveBeforeCharAdded || !ac.IsFillUpChar(*s))
+       bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);
+       if (!isFillUp) {
                Editor::AddCharUTF(s, len, treatAsDBCS);
-       if (acActiveBeforeCharAdded)
+       }
+       if (ac.Active()) {
                AutoCompleteChanged(s[0]);
+               // For fill ups add the character after the autocompletion has 
+               // triggered so containers see the key so can display a calltip.
+               if (isFillUp) {
+                       Editor::AddCharUTF(s, len, treatAsDBCS);
+               }
+       }
 }
 
 void ScintillaBase::Command(int cmdId) {
@@ -278,7 +285,7 @@ void ScintillaBase::AutoCompleteMoveToCurrentWord() {
 
 void ScintillaBase::AutoCompleteChanged(char ch) {
        if (ac.IsFillUpChar(ch)) {
-               AutoCompleteCompleted(ch);
+               AutoCompleteCompleted();
        } else if (currentPos <= ac.posStart - ac.startLen) {
                ac.Cancel();
        } else if (ac.cancelAtStartPos && currentPos <= ac.posStart) {
@@ -290,7 +297,7 @@ void ScintillaBase::AutoCompleteChanged(char ch) {
        }
 }
 
-void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
+void ScintillaBase::AutoCompleteCompleted() {
        int item = ac.lb.GetSelection();
        char selected[1000];
        if (item != -1) {
@@ -323,8 +330,6 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
        SetEmptySelection(ac.posStart);
        if (item != -1) {
                SString piece = selected;
-               if (fillUp)
-                       piece += fillUp;
                pdoc->InsertString(firstPos, piece.c_str());
                SetEmptySelection(firstPos + piece.length());
        }
@@ -332,18 +337,20 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {
 }
 
 void ScintillaBase::ContextMenu(Point pt) {
-       bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
-       popup.CreatePopUp();
-       AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
-       AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
-       AddToPopUp("");
-       AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
-       AddToPopUp("Copy", idcmdCopy, 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);
+       if (displayPopupMenu) {
+               bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
+               popup.CreatePopUp();
+               AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo());
+               AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo());
+               AddToPopUp("");
+               AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor);
+               AddToPopUp("Copy", idcmdCopy, 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);
+       }
 }
 
 void ScintillaBase::CancelModes() {
index 7e3887c1599064a9008928e27154362bb8cff04c..28c089edd2563e9a36cd4dcaf97d66ead96d41b5 100644 (file)
@@ -66,7 +66,7 @@ protected:
        void AutoCompleteCancel();
        void AutoCompleteMove(int delta);
        void AutoCompleteChanged(char ch=0);
-       void AutoCompleteCompleted(char fillUp='\0');
+       void AutoCompleteCompleted();
        void AutoCompleteMoveToCurrentWord();
        static void AutoCompleteDoubleClick(void* p);
 
index 9e803c4a7131b420d431c0bef003bc84c0c0316b..4c9352916da7925aa4f3c7f4c968576cbeefdd4c 100644 (file)
@@ -144,6 +144,10 @@ inline bool IsASpace(unsigned int ch) {
     return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d));
 }
 
+inline bool IsASpaceOrTab(unsigned int ch) {
+       return (ch == ' ') || (ch == '\t');
+}
+
 inline bool IsADigit(unsigned int ch) {
        return (ch >= '0') && (ch <= '9');
 }
index e02bf90e487d9024e2375951644ed80fdb91c0b9..ce42534e7bffa52b588207e0dcd4ef38854102eb 100644 (file)
@@ -42,7 +42,16 @@ void WindowAccessor::Fill(int position) {
                endPos = lenDoc;
 
        TextRange tr = {{startPos, endPos}, buf};
-       Platform::SendScintilla(id, SCI_GETTEXTRANGE, 0, reinterpret_cast<long>(&tr));
+       Platform::SendScintillaPointer(id, SCI_GETTEXTRANGE, 0, &tr);
+}
+
+bool WindowAccessor::Match(int pos, const char *s) {
+       for (int i=0; *s; i++) {
+               if (*s != SafeGetCharAt(pos+i))
+                       return false;
+               s++;
+       }
+       return true;
 }
 
 char WindowAccessor::StyleAt(int position) {
@@ -116,8 +125,8 @@ void WindowAccessor::Flush() {
        startPos = extremePosition;
        lenDoc = -1;
        if (validLen > 0) {
-               Platform::SendScintilla(id, SCI_SETSTYLINGEX, validLen, 
-                       reinterpret_cast<long>(styleBuf));
+               Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, 
+                       styleBuf);
                validLen = 0;
        }
 }
index 7ab2c32a0b46c4bda849946a99c4d6e4bbfbdead..b44aec5667c5bfd8ee807de1f39969dc8e2b3c22 100644 (file)
@@ -81,6 +81,7 @@ DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
+DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
 
 
 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -117,7 +118,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
 
 #ifdef LINK_LEXERS
 // forces the linking of the lexer modules
-int wxForceScintillaLexers();
+int Scintilla_LinkLexers();
 #endif
 
 //----------------------------------------------------------------------
@@ -134,7 +135,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
               wxDefaultValidator, name)
 {
 #ifdef LINK_LEXERS
-    wxForceScintillaLexers();
+    Scintilla_LinkLexers();
 #endif
     m_swx = new ScintillaWX(this);
     m_stopWatch.Start();
@@ -168,58 +169,58 @@ long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
 //       this file.  Edit stc.cpp.in or gen_iface.py instead and regenerate.
 
 
-// Add text to the document
+// Add text to the document.
 void wxStyledTextCtrl::AddText(const wxString& text) {
                     wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
                     SendMsg(2001, strlen(buf), (long)(const char*)buf);
 }
 
-// Add array of cells to document
+// Add array of cells to document.
 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
                           SendMsg(2002, data.GetDataLen(), (long)data.GetData());
 }
 
-// Insert string at a position
+// Insert string at a position.
 void wxStyledTextCtrl::InsertText(int pos, const wxString& text) {
     SendMsg(2003, pos, (long)(const char*)wx2stc(text));
 }
 
-// Delete all text in the document
+// Delete all text in the document.
 void wxStyledTextCtrl::ClearAll() {
     SendMsg(2004, 0, 0);
 }
 
-// Set all style bytes to 0, remove all folding information
+// Set all style bytes to 0, remove all folding information.
 void wxStyledTextCtrl::ClearDocumentStyle() {
     SendMsg(2005, 0, 0);
 }
 
-// The number of characters in the document
+// The number of characters in the document.
 int wxStyledTextCtrl::GetLength() {
     return SendMsg(2006, 0, 0);
 }
 
-// Returns the character byte at the position
+// Returns the character byte at the position.
 int wxStyledTextCtrl::GetCharAt(int pos) {
                        return (unsigned char)SendMsg(2007, pos, 0);
 }
 
-// Returns the position of the caret
+// Returns the position of the caret.
 int wxStyledTextCtrl::GetCurrentPos() {
     return SendMsg(2008, 0, 0);
 }
 
-// Returns the position of the opposite end of the selection to the caret
+// Returns the position of the opposite end of the selection to the caret.
 int wxStyledTextCtrl::GetAnchor() {
     return SendMsg(2009, 0, 0);
 }
 
-// Returns the style byte at the position
+// Returns the style byte at the position.
 int wxStyledTextCtrl::GetStyleAt(int pos) {
                        return (unsigned char)SendMsg(2010, pos, 0);
 }
 
-// Redoes the next action on the undo history
+// Redoes the next action on the undo history.
 void wxStyledTextCtrl::Redo() {
     SendMsg(2011, 0, 0);
 }
@@ -260,12 +261,12 @@ wxMemoryBuffer wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
                           return buf;
 }
 
-// Are there any redoable actions in the undo history.
+// Are there any redoable actions in the undo history?
 bool wxStyledTextCtrl::CanRedo() {
     return SendMsg(2016, 0, 0) != 0;
 }
 
-// Retrieve the line number at which a particular marker is located
+// Retrieve the line number at which a particular marker is located.
 int wxStyledTextCtrl::MarkerLineFromHandle(int handle) {
     return SendMsg(2017, handle, 0);
 }
@@ -358,8 +359,7 @@ void wxStyledTextCtrl::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.
+// The styling mask can be used to protect some bits in each styling byte from modification.
 void wxStyledTextCtrl::StartStyling(int pos, int mask) {
     SendMsg(2032, pos, mask);
 }
@@ -370,7 +370,7 @@ void wxStyledTextCtrl::SetStyling(int length, int style) {
     SendMsg(2033, length, style);
 }
 
-// Is drawing done first into a buffer or direct to the screen.
+// Is drawing done first into a buffer or direct to the screen?
 bool wxStyledTextCtrl::GetBufferedDraw() {
     return SendMsg(2034, 0, 0) != 0;
 }
@@ -381,8 +381,7 @@ void wxStyledTextCtrl::SetBufferedDraw(bool buffered) {
     SendMsg(2035, buffered, 0);
 }
 
-// Change the visible size of a tab to be a multiple of the width of a space
-// character.
+// Change the visible size of a tab to be a multiple of the width of a space character.
 void wxStyledTextCtrl::SetTabWidth(int tabWidth) {
     SendMsg(2036, tabWidth, 0);
 }
@@ -432,12 +431,12 @@ int wxStyledTextCtrl::MarkerAdd(int line, int markerNumber) {
     return SendMsg(2043, line, markerNumber);
 }
 
-// Delete a marker from a line
+// Delete a marker from a line.
 void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber) {
     SendMsg(2044, line, markerNumber);
 }
 
-// Delete all markers with a particular number from all lines
+// Delete all markers with a particular number from all lines.
 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber) {
     SendMsg(2045, markerNumber, 0);
 }
@@ -607,8 +606,7 @@ void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds) {
     SendMsg(2076, periodMilliseconds, 0);
 }
 
-// Set the set of characters making up words for when moving or selecting
-// by word.
+// Set the set of characters making up words for when moving or selecting by word.
 void wxStyledTextCtrl::SetWordChars(const wxString& characters) {
     SendMsg(2077, 0, (long)(const char*)wx2stc(characters));
 }
@@ -645,8 +643,8 @@ wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) {
     return wxColourFromLong(c);
 }
 
-// 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
+// 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 wxStyledTextCtrl::SetStyleBits(int bits) {
     SendMsg(2090, bits, 0);
@@ -677,7 +675,7 @@ bool wxStyledTextCtrl::GetCaretLineVisible() {
     return SendMsg(2095, 0, 0) != 0;
 }
 
-// Dsplay the background of the line containing the caret in a different colour.
+// Display the background of the line containing the caret in a different colour.
 void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
     SendMsg(2096, show, 0);
 }
@@ -716,8 +714,7 @@ bool wxStyledTextCtrl::AutoCompActive() {
     return SendMsg(2102, 0, 0) != 0;
 }
 
-// Retrieve the position of the caret when the auto-completion list was
-// displayed.
+// Retrieve the position of the caret when the auto-completion list was displayed.
 int wxStyledTextCtrl::AutoCompPosStart() {
     return SendMsg(2103, 0, 0);
 }
@@ -732,8 +729,8 @@ void wxStyledTextCtrl::AutoCompStops(const wxString& characterSet) {
     SendMsg(2105, 0, (long)(const char*)wx2stc(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.
+// 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 wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter) {
     SendMsg(2106, separatorCharacter, 0);
 }
@@ -790,22 +787,24 @@ void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList) {
     SendMsg(2117, listType, (long)(const char*)wx2stc(itemList));
 }
 
-// Set whether or not autocompletion is hidden automatically when nothing matches
+// 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
+// Retrieve whether or not autocompletion is hidden automatically when nothing matches.
 bool wxStyledTextCtrl::AutoCompGetAutoHide() {
     return SendMsg(2119, 0, 0) != 0;
 }
 
-// Set whether or not autocompletion deletes any word characters after the inserted text upon completion
+// Set whether or not autocompletion deletes any word characters
+// after the inserted text upon completion.
 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord) {
     SendMsg(2270, dropRestOfWord, 0);
 }
 
-// Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
+// Retrieve whether or not autocompletion deletes any word characters
+// after the inserted text upon completion.
 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
     return SendMsg(2271, 0, 0) != 0;
 }
@@ -961,7 +960,7 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos,
                      return SendMsg(2150, flags, (long)&ft);
 }
 
-// On Windows will draw the document into a display context such as a printer.
+// On Windows, will draw the document into a display context such as a printer.
  int wxStyledTextCtrl::FormatRange(bool   doDraw,
                                 int    startPos,
                                 int    endPos,
@@ -1123,7 +1122,7 @@ bool wxStyledTextCtrl::CanPaste() {
     return SendMsg(2173, 0, 0) != 0;
 }
 
-// Are there any undoable actions in the undo history.
+// Are there any undoable actions in the undo history?
 bool wxStyledTextCtrl::CanUndo() {
     return SendMsg(2174, 0, 0) != 0;
 }
@@ -1179,7 +1178,7 @@ int wxStyledTextCtrl::GetTextLength() {
     return SendMsg(2183, 0, 0);
 }
 
-// Set to overtype (true) or insert mode
+// Set to overtype (true) or insert mode.
 void wxStyledTextCtrl::SetOvertype(bool overtype) {
     SendMsg(2186, overtype, 0);
 }
@@ -1189,12 +1188,12 @@ bool wxStyledTextCtrl::GetOvertype() {
     return SendMsg(2187, 0, 0) != 0;
 }
 
-// Set the width of the insert mode caret
+// 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
+// Returns the width of the insert mode caret.
 int wxStyledTextCtrl::GetCaretWidth() {
     return SendMsg(2189, 0, 0);
 }
@@ -1251,12 +1250,12 @@ int wxStyledTextCtrl::GetTargetEnd() {
                            return SendMsg(2197, strlen(buf), (long)(const char*)buf);
 }
 
-// Set the search flags used by SearchInTarget
+// Set the search flags used by SearchInTarget.
 void wxStyledTextCtrl::SetSearchFlags(int flags) {
     SendMsg(2198, flags, 0);
 }
 
-// Get the search flags used by SearchInTarget
+// Get the search flags used by SearchInTarget.
 int wxStyledTextCtrl::GetSearchFlags() {
     return SendMsg(2199, 0, 0);
 }
@@ -1358,7 +1357,7 @@ void wxStyledTextCtrl::EnsureVisible(int line) {
     SendMsg(2232, line, 0);
 }
 
-// Set some debugging options for folding
+// Set some debugging options for folding.
 void wxStyledTextCtrl::SetFoldFlags(int flags) {
     SendMsg(2233, flags, 0);
 }
@@ -1369,7 +1368,7 @@ void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line) {
     SendMsg(2234, line, 0);
 }
 
-// Sets whether a tab pressed when caret is within indentation indents
+// Sets whether a tab pressed when caret is within indentation indents.
 void wxStyledTextCtrl::SetTabIndents(bool tabIndents) {
     SendMsg(2260, tabIndents, 0);
 }
@@ -1379,7 +1378,7 @@ bool wxStyledTextCtrl::GetTabIndents() {
     return SendMsg(2261, 0, 0) != 0;
 }
 
-// Sets whether a backspace pressed when caret is within indentation unindents
+// Sets whether a backspace pressed when caret is within indentation unindents.
 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents) {
     SendMsg(2262, bsUnIndents, 0);
 }
@@ -1389,52 +1388,87 @@ bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
     return SendMsg(2263, 0, 0) != 0;
 }
 
-// Sets the time the mouse must sit still to generate a mouse dwell event
+// 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
+// Retrieve the time the mouse must sit still to generate a mouse dwell event.
 int wxStyledTextCtrl::GetMouseDwellTime() {
     return SendMsg(2265, 0, 0);
 }
 
-// Get position of start of word
+// Get position of start of word.
 int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters) {
     return SendMsg(2266, pos, onlyWordCharacters);
 }
 
-// Get position of end of word
+// Get position of end of word.
 int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters) {
     return SendMsg(2267, pos, onlyWordCharacters);
 }
 
-// Sets whether text is word wrapped
+// Sets whether text is word wrapped.
 void wxStyledTextCtrl::SetWrapMode(int mode) {
     SendMsg(2268, mode, 0);
 }
 
-// Retrieve whether text is word wrapped
+// Retrieve whether text is word wrapped.
 int wxStyledTextCtrl::GetWrapMode() {
     return SendMsg(2269, 0, 0);
 }
 
-// Sets the degree of caching of layout information
+// Sets the degree of caching of layout information.
 void wxStyledTextCtrl::SetLayoutCache(int mode) {
     SendMsg(2272, mode, 0);
 }
 
-// Retrieve the degree of caching of layout information
+// Retrieve the degree of caching of layout information.
 int wxStyledTextCtrl::GetLayoutCache() {
     return SendMsg(2273, 0, 0);
 }
 
-// Move the caret inside current view if it's not there already
+// Sets the document width assumed for scrolling.
+void wxStyledTextCtrl::SetScrollWidth(int pixelWidth) {
+    SendMsg(2274, pixelWidth, 0);
+}
+
+// Retrieve the document width assumed for scrolling.
+int wxStyledTextCtrl::GetScrollWidth() {
+    return SendMsg(2275, 0, 0);
+}
+
+// Measure the pixel width of some text in a particular style.
+// Nul terminated text argument.
+// Does not handle tab or control characters.
+int wxStyledTextCtrl::TextWidth(int style, const wxString& text) {
+    return SendMsg(2276, style, (long)(const char*)wx2stc(text));
+}
+
+// Sets the scroll range so that maximum scroll position has
+// the last line at the bottom of the view (default).
+// Setting this to false allows scrolling one page below the last line.
+void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine) {
+    SendMsg(2277, endAtLastLine, 0);
+}
+
+// Retrieve whether the maximum scroll position has the last
+// line at the bottom of the view.
+int wxStyledTextCtrl::GetEndAtLastLine() {
+    return SendMsg(2278, 0, 0);
+}
+
+// Retrieve the height of a particular line of text in pixels.
+int wxStyledTextCtrl::TextHeight(int line) {
+    return SendMsg(2279, line, 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.
+// How many characters are on a line, not including end of line characters?
 int wxStyledTextCtrl::LineLength(int line) {
     return SendMsg(2350, line, 0);
 }
@@ -1454,12 +1488,12 @@ int wxStyledTextCtrl::BraceMatch(int pos) {
     return SendMsg(2353, pos, 0);
 }
 
-// Are the end of line characters visible.
+// Are the end of line characters visible?
 bool wxStyledTextCtrl::GetViewEOL() {
     return SendMsg(2355, 0, 0) != 0;
 }
 
-// Make the end of line characters visible or invisible
+// Make the end of line characters visible or invisible.
 void wxStyledTextCtrl::SetViewEOL(bool visible) {
     SendMsg(2356, visible, 0);
 }
@@ -1529,11 +1563,6 @@ int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text) {
     return SendMsg(2368, flags, (long)(const char*)wx2stc(text));
 }
 
-// Set the way the line the caret is on is kept visible.
-void wxStyledTextCtrl::SetCaretPolicy(int caretPolicy, int caretSlop) {
-    SendMsg(2369, caretPolicy, caretSlop);
-}
-
 // Retrieves the number of lines completely visible.
 int wxStyledTextCtrl::LinesOnScreen() {
     return SendMsg(2370, 0, 0);
@@ -1545,7 +1574,7 @@ void wxStyledTextCtrl::UsePopUp(bool allowPopUp) {
     SendMsg(2371, allowPopUp, 0);
 }
 
-// Is the selection a rectangular. The alternative is the more common stream selection.
+// Is the selection rectangular? The alternative is the more common stream selection.
 bool wxStyledTextCtrl::SelectionIsRectangle() {
     return SendMsg(2372, 0, 0) != 0;
 }
@@ -1582,93 +1611,96 @@ int wxStyledTextCtrl::GetModEventMask() {
     return SendMsg(2378, 0, 0);
 }
 
-// Change internal focus flag
+// Change internal focus flag.
 void wxStyledTextCtrl::SetSTCFocus(bool focus) {
     SendMsg(2380, focus, 0);
 }
 
-// Get internal focus flag
+// Get internal focus flag.
 bool wxStyledTextCtrl::GetSTCFocus() {
     return SendMsg(2381, 0, 0) != 0;
 }
 
-// Change error status - 0 = OK
+// Change error status - 0 = OK.
 void wxStyledTextCtrl::SetStatus(int statusCode) {
     SendMsg(2382, statusCode, 0);
 }
 
-// Get error status
+// Get error status.
 int wxStyledTextCtrl::GetStatus() {
     return SendMsg(2383, 0, 0);
 }
 
-// Set whether the mouse is captured when its button is pressed
+// 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
+// Get whether mouse gets captured.
 bool wxStyledTextCtrl::GetMouseDownCaptures() {
     return SendMsg(2385, 0, 0) != 0;
 }
 
-// Sets the cursor to one of the SC_CURSOR* values
+// Sets the cursor to one of the SC_CURSOR* values.
 void wxStyledTextCtrl::SetCursor(int cursorType) {
     SendMsg(2386, cursorType, 0);
 }
 
-// Get cursor type
+// Get cursor type.
 int wxStyledTextCtrl::GetCursor() {
     return SendMsg(2387, 0, 0);
 }
 
 // Change the way control characters are displayed:
-// If symbol is < 32, keep the drawn way, else, use the given character
+// If symbol is < 32, keep the drawn way, else, use the given character.
 void wxStyledTextCtrl::SetControlCharSymbol(int symbol) {
     SendMsg(2388, symbol, 0);
 }
 
-// Get the way control characters are displayed
+// Get the way control characters are displayed.
 int wxStyledTextCtrl::GetControlCharSymbol() {
     return SendMsg(2389, 0, 0);
 }
 
-// Move to the previous change in capitalistion
+// Move to the previous change in capitalisation.
 void wxStyledTextCtrl::WordPartLeft() {
     SendMsg(2390, 0, 0);
 }
 
-// Move to the previous change in capitalistion extending selection to new caret position.
+// Move to the previous change in capitalisation extending selection
+// to new caret position.
 void wxStyledTextCtrl::WordPartLeftExtend() {
     SendMsg(2391, 0, 0);
 }
 
-// Move to the change next in capitalistion
+// Move to the change next in capitalisation.
 void wxStyledTextCtrl::WordPartRight() {
     SendMsg(2392, 0, 0);
 }
 
-// Move to the next change in capitalistion extending selection to new caret position.
+// Move to the next change in capitalisation 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.
+// Set the way the display area is determined when a particular line
+// is to be moved to by Find, FindNext, GotoLine, etc.
 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop) {
     SendMsg(2394, visiblePolicy, visibleSlop);
 }
 
-// Delete back from the current position to the start of the line
+// 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
+// Delete forwards from the current position to the end of the line.
 void wxStyledTextCtrl::DelLineRight() {
     SendMsg(2396, 0, 0);
 }
 
-// Get and Set the xOffset (ie, horizonal scroll position)
+// Get and Set the xOffset (ie, horizonal scroll position).
 void wxStyledTextCtrl::SetXOffset(int newOffset) {
     SendMsg(2397, newOffset, 0);
 }
@@ -1676,6 +1708,18 @@ int wxStyledTextCtrl::GetXOffset() {
     return SendMsg(2398, 0, 0);
 }
 
+// Set the way the caret is kept visible when going sideway.
+// The exclusion zone is given in pixels.
+void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop) {
+    SendMsg(2402, caretPolicy, caretSlop);
+}
+
+// Set the way the line the caret is on is kept visible.
+// The exclusion zone is given in lines.
+void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop) {
+    SendMsg(2403, caretPolicy, caretSlop);
+}
+
 // Start notifying the container of all key presses and commands.
 void wxStyledTextCtrl::StartRecord() {
     SendMsg(3001, 0, 0);
@@ -2104,6 +2148,10 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
         evt.SetY(scn.y);
         break;
 
+    case SCN_ZOOM:
+        evt.SetEventType(wxEVT_STC_ZOOM);
+        break;
+
     default:
         return;
     }
index 6d9898f2314c740c8f6665d17eb2ea4bdf993bc1..3e1b761faf97ffd7422f621e5c5683e2dbe3e401 100644 (file)
@@ -81,6 +81,7 @@ DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
+DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
 
 
 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -117,7 +118,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
 
 #ifdef LINK_LEXERS
 // forces the linking of the lexer modules
-int wxForceScintillaLexers();
+int Scintilla_LinkLexers();
 #endif
 
 //----------------------------------------------------------------------
@@ -134,7 +135,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
               wxDefaultValidator, name)
 {
 #ifdef LINK_LEXERS
-    wxForceScintillaLexers();
+    Scintilla_LinkLexers();
 #endif
     m_swx = new ScintillaWX(this);
     m_stopWatch.Start();
@@ -557,6 +558,10 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
         evt.SetY(scn.y);
         break;
 
+    case SCN_ZOOM:
+        evt.SetEventType(wxEVT_STC_ZOOM);
+        break;
+
     default:
         return;
     }
index 56c23d87d5115b2446418adaaf7f4155bacd80c4..157a7bfc236f7b9da55715f68eaaf8d829d8f5e9 100644 (file)
@@ -338,6 +338,7 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG,              1669)
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER,               1670)
     DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP,                 1671)
+    DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM,                    1672)
 END_DECLARE_EVENT_TYPES()
 #else
     enum {
@@ -363,6 +364,7 @@ END_DECLARE_EVENT_TYPES()
         wxEVT_STC_START_DRAG,
         wxEVT_STC_DRAG_OVER,
         wxEVT_STC_DO_DROP,
+        wxEVT_STC_ZOOM,
     };
 #endif
 
@@ -393,6 +395,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 #define EVT_STC_START_DRAG(id, fn)              DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG,            id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #define EVT_STC_DRAG_OVER(id, fn)               DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER,             id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #define EVT_STC_DO_DROP(id, fn)                 DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP,               id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_ZOOM(id, fn)                    DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM,                  id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
 #endif
 
 //----------------------------------------------------------------------
index 21a2a8d1cc4863d31a4993c4eb6639b5e40cfb47..453146ea9987c8adc0eb4b43410dd8ba5ba902f6 100644 (file)
@@ -33,7 +33,8 @@ Updated XRCed from Roman Rolinsky
 
 Added wxBufferedDC.
 
-Upgraded wxSTC from Scintilla 1.40 to Scintilla 1.45
+Upgraded wxSTC from Scintilla 1.40 to Scintilla 1.45, and then again
+to version 1.47.
 
 UNICODE!
     wxWindows/wxPython can be compiled with unicode support enabled or
index 0a222b63ab95a7c485f60dcd81b87e1722d0fb28..de6110e9573245da6daf40a61a92e1aaa9764c9f 100644 (file)
@@ -6947,6 +6947,191 @@ static PyObject *_wrap_wxStyledTextCtrl_GetLayoutCache(PyObject *self, PyObject
     return _resultobj;
 }
 
+#define wxStyledTextCtrl_SetScrollWidth(_swigobj,_swigarg0)  (_swigobj->SetScrollWidth(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetScrollWidth(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    int  _arg1;
+    PyObject * _argo0 = 0;
+    char *_kwnames[] = { "self","pixelWidth", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetScrollWidth",_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_SetScrollWidth. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxStyledTextCtrl_SetScrollWidth(_arg0,_arg1);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetScrollWidth(_swigobj)  (_swigobj->GetScrollWidth())
+static PyObject *_wrap_wxStyledTextCtrl_GetScrollWidth(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_GetScrollWidth",_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_GetScrollWidth. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (int )wxStyledTextCtrl_GetScrollWidth(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_TextWidth(_swigobj,_swigarg0,_swigarg1)  (_swigobj->TextWidth(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_TextWidth(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","style","text", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO:wxStyledTextCtrl_TextWidth",_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_TextWidth. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    _arg2 = wxString_in_helper(_obj2);
+    if (_arg2 == NULL)
+        return NULL;
+}
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (int )wxStyledTextCtrl_TextWidth(_arg0,_arg1,*_arg2);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("i",_result);
+{
+    if (_obj2)
+        delete _arg2;
+}
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetEndAtLastLine(_swigobj,_swigarg0)  (_swigobj->SetEndAtLastLine(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_SetEndAtLastLine(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxStyledTextCtrl * _arg0;
+    bool  _arg1;
+    PyObject * _argo0 = 0;
+    int tempbool1;
+    char *_kwnames[] = { "self","endAtLastLine", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextCtrl_SetEndAtLastLine",_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_SetEndAtLastLine. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+    _arg1 = (bool ) tempbool1;
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxStyledTextCtrl_SetEndAtLastLine(_arg0,_arg1);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_GetEndAtLastLine(_swigobj)  (_swigobj->GetEndAtLastLine())
+static PyObject *_wrap_wxStyledTextCtrl_GetEndAtLastLine(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_GetEndAtLastLine",_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_GetEndAtLastLine. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (int )wxStyledTextCtrl_GetEndAtLastLine(_arg0);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _resultobj = Py_BuildValue("i",_result);
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_TextHeight(_swigobj,_swigarg0)  (_swigobj->TextHeight(_swigarg0))
+static PyObject *_wrap_wxStyledTextCtrl_TextHeight(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_TextHeight",_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_TextHeight. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    _result = (int )wxStyledTextCtrl_TextHeight(_arg0,_arg1);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    _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;
@@ -7540,36 +7725,6 @@ static PyObject *_wrap_wxStyledTextCtrl_SearchPrev(PyObject *self, PyObject *arg
     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;
-        }
-    }
-{
-    PyThreadState* __tstate = wxPyBeginAllowThreads();
-    wxStyledTextCtrl_SetCaretPolicy(_arg0,_arg1,_arg2);
-
-    wxPyEndAllowThreads(__tstate);
-    if (PyErr_Occurred()) return NULL;
-}    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;
@@ -8395,6 +8550,66 @@ static PyObject *_wrap_wxStyledTextCtrl_GetXOffset(PyObject *self, PyObject *arg
     return _resultobj;
 }
 
+#define wxStyledTextCtrl_SetXCaretPolicy(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetXCaretPolicy(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetXCaretPolicy(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_SetXCaretPolicy",_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_SetXCaretPolicy. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxStyledTextCtrl_SetXCaretPolicy(_arg0,_arg1,_arg2);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
+#define wxStyledTextCtrl_SetYCaretPolicy(_swigobj,_swigarg0,_swigarg1)  (_swigobj->SetYCaretPolicy(_swigarg0,_swigarg1))
+static PyObject *_wrap_wxStyledTextCtrl_SetYCaretPolicy(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_SetYCaretPolicy",_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_SetYCaretPolicy. Expected _wxStyledTextCtrl_p.");
+        return NULL;
+        }
+    }
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxStyledTextCtrl_SetYCaretPolicy(_arg0,_arg1,_arg2);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 #define wxStyledTextCtrl_StartRecord(_swigobj)  (_swigobj->StartRecord())
 static PyObject *_wrap_wxStyledTextCtrl_StartRecord(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -10632,6 +10847,8 @@ 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_SetYCaretPolicy", (PyCFunction) _wrap_wxStyledTextCtrl_SetYCaretPolicy, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetXCaretPolicy", (PyCFunction) _wrap_wxStyledTextCtrl_SetXCaretPolicy, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetXOffset", (PyCFunction) _wrap_wxStyledTextCtrl_GetXOffset, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetXOffset", (PyCFunction) _wrap_wxStyledTextCtrl_SetXOffset, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_DelLineRight", (PyCFunction) _wrap_wxStyledTextCtrl_DelLineRight, METH_VARARGS | METH_KEYWORDS },
@@ -10660,7 +10877,6 @@ static PyMethodDef stc_cMethods[] = {
         { "wxStyledTextCtrl_SelectionIsRectangle", (PyCFunction) _wrap_wxStyledTextCtrl_SelectionIsRectangle, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_UsePopUp", (PyCFunction) _wrap_wxStyledTextCtrl_UsePopUp, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_LinesOnScreen", (PyCFunction) _wrap_wxStyledTextCtrl_LinesOnScreen, METH_VARARGS | METH_KEYWORDS },
-        { "wxStyledTextCtrl_SetCaretPolicy", (PyCFunction) _wrap_wxStyledTextCtrl_SetCaretPolicy, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SearchPrev", (PyCFunction) _wrap_wxStyledTextCtrl_SearchPrev, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SearchNext", (PyCFunction) _wrap_wxStyledTextCtrl_SearchNext, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SearchAnchor", (PyCFunction) _wrap_wxStyledTextCtrl_SearchAnchor, METH_VARARGS | METH_KEYWORDS },
@@ -10680,6 +10896,12 @@ static PyMethodDef stc_cMethods[] = {
         { "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_TextHeight", (PyCFunction) _wrap_wxStyledTextCtrl_TextHeight, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetEndAtLastLine", (PyCFunction) _wrap_wxStyledTextCtrl_GetEndAtLastLine, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetEndAtLastLine", (PyCFunction) _wrap_wxStyledTextCtrl_SetEndAtLastLine, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_TextWidth", (PyCFunction) _wrap_wxStyledTextCtrl_TextWidth, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_GetScrollWidth", (PyCFunction) _wrap_wxStyledTextCtrl_GetScrollWidth, METH_VARARGS | METH_KEYWORDS },
+        { "wxStyledTextCtrl_SetScrollWidth", (PyCFunction) _wrap_wxStyledTextCtrl_SetScrollWidth, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetLayoutCache", (PyCFunction) _wrap_wxStyledTextCtrl_GetLayoutCache, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_SetLayoutCache", (PyCFunction) _wrap_wxStyledTextCtrl_SetLayoutCache, METH_VARARGS | METH_KEYWORDS },
         { "wxStyledTextCtrl_GetWrapMode", (PyCFunction) _wrap_wxStyledTextCtrl_GetWrapMode, METH_VARARGS | METH_KEYWORDS },
@@ -11188,15 +11410,14 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_EDGE_NONE", PyInt_FromLong((long) 0));
         PyDict_SetItemString(d,"wxSTC_EDGE_LINE", PyInt_FromLong((long) 1));
         PyDict_SetItemString(d,"wxSTC_EDGE_BACKGROUND", PyInt_FromLong((long) 2));
-        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_CARET_SLOP", PyInt_FromLong((long) 0x01));
+        PyDict_SetItemString(d,"wxSTC_CARET_STRICT", PyInt_FromLong((long) 0x04));
+        PyDict_SetItemString(d,"wxSTC_CARET_JUMPS", PyInt_FromLong((long) 0x10));
+        PyDict_SetItemString(d,"wxSTC_CARET_EVEN", PyInt_FromLong((long) 0x08));
         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));
@@ -11262,6 +11483,7 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_LEX_PHP", PyInt_FromLong((long) 30));
         PyDict_SetItemString(d,"wxSTC_LEX_BAAN", PyInt_FromLong((long) 31));
         PyDict_SetItemString(d,"wxSTC_LEX_MATLAB", PyInt_FromLong((long) 32));
+        PyDict_SetItemString(d,"wxSTC_LEX_SCRIPTOL", PyInt_FromLong((long) 33));
         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));
@@ -11296,15 +11518,6 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_C_WORD2", PyInt_FromLong((long) 16));
         PyDict_SetItemString(d,"wxSTC_C_COMMENTDOCKEYWORD", PyInt_FromLong((long) 17));
         PyDict_SetItemString(d,"wxSTC_C_COMMENTDOCKEYWORDERROR", PyInt_FromLong((long) 18));
-        PyDict_SetItemString(d,"wxSTC_B_DEFAULT", PyInt_FromLong((long) 0));
-        PyDict_SetItemString(d,"wxSTC_B_COMMENT", PyInt_FromLong((long) 1));
-        PyDict_SetItemString(d,"wxSTC_B_NUMBER", PyInt_FromLong((long) 2));
-        PyDict_SetItemString(d,"wxSTC_B_KEYWORD", PyInt_FromLong((long) 3));
-        PyDict_SetItemString(d,"wxSTC_B_STRING", PyInt_FromLong((long) 4));
-        PyDict_SetItemString(d,"wxSTC_B_PREPROCESSOR", PyInt_FromLong((long) 5));
-        PyDict_SetItemString(d,"wxSTC_B_OPERATOR", PyInt_FromLong((long) 6));
-        PyDict_SetItemString(d,"wxSTC_B_IDENTIFIER", PyInt_FromLong((long) 7));
-        PyDict_SetItemString(d,"wxSTC_B_DATE", PyInt_FromLong((long) 8));
         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));
@@ -11445,6 +11658,20 @@ SWIGEXPORT(void) initstc_c() {
         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_B_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_B_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_B_NUMBER", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_B_KEYWORD", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_B_STRING", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_B_PREPROCESSOR", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_B_OPERATOR", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_B_IDENTIFIER", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_B_DATE", PyInt_FromLong((long) 8));
+        PyDict_SetItemString(d,"wxSTC_PROPS_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_PROPS_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_PROPS_SECTION", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_PROPS_ASSIGNMENT", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_PROPS_DEFVAL", PyInt_FromLong((long) 4));
         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));
@@ -11477,6 +11704,7 @@ SWIGEXPORT(void) initstc_c() {
         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_CTAG", PyInt_FromLong((long) 9));
         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));
@@ -11496,6 +11724,13 @@ SWIGEXPORT(void) initstc_c() {
         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_DIFF_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_DIFF_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_DIFF_COMMAND", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_DIFF_HEADER", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_DIFF_POSITION", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_DIFF_DELETED", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_DIFF_ADDED", PyInt_FromLong((long) 6));
         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));
@@ -11573,6 +11808,26 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxSTC_MATLAB_STRING", PyInt_FromLong((long) 5));
         PyDict_SetItemString(d,"wxSTC_MATLAB_OPERATOR", PyInt_FromLong((long) 6));
         PyDict_SetItemString(d,"wxSTC_MATLAB_IDENTIFIER", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_DEFAULT", PyInt_FromLong((long) 0));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENT", PyInt_FromLong((long) 1));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTLINE", PyInt_FromLong((long) 2));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTDOC", PyInt_FromLong((long) 3));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_NUMBER", PyInt_FromLong((long) 4));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_WORD", PyInt_FromLong((long) 5));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_STRING", PyInt_FromLong((long) 6));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_CHARACTER", PyInt_FromLong((long) 7));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_UUID", PyInt_FromLong((long) 8));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_PREPROCESSOR", PyInt_FromLong((long) 9));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_OPERATOR", PyInt_FromLong((long) 10));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_IDENTIFIER", PyInt_FromLong((long) 11));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_STRINGEOL", PyInt_FromLong((long) 12));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_VERBATIM", PyInt_FromLong((long) 13));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_REGEX", PyInt_FromLong((long) 14));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTLINEDOC", PyInt_FromLong((long) 15));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_WORD2", PyInt_FromLong((long) 16));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTDOCKEYWORD", PyInt_FromLong((long) 17));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR", PyInt_FromLong((long) 18));
+        PyDict_SetItemString(d,"wxSTC_SCRIPTOL_COMMENTBASIC", PyInt_FromLong((long) 19));
         PyDict_SetItemString(d,"wxSTCNameStr", PyString_FromString("wxSTCNameStr"));
         PyDict_SetItemString(d,"STC_USE_DND", PyInt_FromLong((long) 1));
         PyDict_SetItemString(d,"wxEVT_STC_CHANGE", PyInt_FromLong((long) wxEVT_STC_CHANGE));
@@ -11597,6 +11852,7 @@ SWIGEXPORT(void) initstc_c() {
         PyDict_SetItemString(d,"wxEVT_STC_START_DRAG", PyInt_FromLong((long) wxEVT_STC_START_DRAG));
         PyDict_SetItemString(d,"wxEVT_STC_DRAG_OVER", PyInt_FromLong((long) wxEVT_STC_DRAG_OVER));
         PyDict_SetItemString(d,"wxEVT_STC_DO_DROP", PyInt_FromLong((long) wxEVT_STC_DO_DROP));
+        PyDict_SetItemString(d,"wxEVT_STC_ZOOM", PyInt_FromLong((long) wxEVT_STC_ZOOM));
 
 
     wxClassInfo::CleanUpClasses();
index 99cf32034f65fe743ba2a49cd9d548c01c78651b..b15920505cca7445effb162ecc9d79b21cf96013 100644 (file)
@@ -109,6 +109,9 @@ def EVT_STC_DRAG_OVER(win, id, func):
 def EVT_STC_DO_DROP(win, id, func):
     win.Connect(id, -1, wxEVT_STC_DO_DROP, func)
 
+def EVT_STC_ZOOM(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_ZOOM, func)
+
 
 class wxStyledTextCtrlPtr(wxControlPtr):
     def __init__(self,this):
@@ -774,6 +777,24 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def GetLayoutCache(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_GetLayoutCache,(self,) + _args, _kwargs)
         return val
+    def SetScrollWidth(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetScrollWidth,(self,) + _args, _kwargs)
+        return val
+    def GetScrollWidth(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetScrollWidth,(self,) + _args, _kwargs)
+        return val
+    def TextWidth(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_TextWidth,(self,) + _args, _kwargs)
+        return val
+    def SetEndAtLastLine(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetEndAtLastLine,(self,) + _args, _kwargs)
+        return val
+    def GetEndAtLastLine(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_GetEndAtLastLine,(self,) + _args, _kwargs)
+        return val
+    def TextHeight(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_TextHeight,(self,) + _args, _kwargs)
+        return val
     def MoveCaretInsideView(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_MoveCaretInsideView,(self,) + _args, _kwargs)
         return val
@@ -832,9 +853,6 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def SearchPrev(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_SearchPrev,(self,) + _args, _kwargs)
         return val
-    def SetCaretPolicy(self, *_args, **_kwargs):
-        val = apply(stc_c.wxStyledTextCtrl_SetCaretPolicy,(self,) + _args, _kwargs)
-        return val
     def LinesOnScreen(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_LinesOnScreen,(self,) + _args, _kwargs)
         return val
@@ -919,6 +937,12 @@ class wxStyledTextCtrlPtr(wxControlPtr):
     def GetXOffset(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_GetXOffset,(self,) + _args, _kwargs)
         return val
+    def SetXCaretPolicy(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetXCaretPolicy,(self,) + _args, _kwargs)
+        return val
+    def SetYCaretPolicy(self, *_args, **_kwargs):
+        val = apply(stc_c.wxStyledTextCtrl_SetYCaretPolicy,(self,) + _args, _kwargs)
+        return val
     def StartRecord(self, *_args, **_kwargs):
         val = apply(stc_c.wxStyledTextCtrl_StartRecord,(self,) + _args, _kwargs)
         return val
@@ -1319,15 +1343,14 @@ wxSTC_CMD_DELETEBACKNOTLINE = stc_c.wxSTC_CMD_DELETEBACKNOTLINE
 wxSTC_EDGE_NONE = stc_c.wxSTC_EDGE_NONE
 wxSTC_EDGE_LINE = stc_c.wxSTC_EDGE_LINE
 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_CARET_SLOP = stc_c.wxSTC_CARET_SLOP
+wxSTC_CARET_STRICT = stc_c.wxSTC_CARET_STRICT
+wxSTC_CARET_JUMPS = stc_c.wxSTC_CARET_JUMPS
+wxSTC_CARET_EVEN = stc_c.wxSTC_CARET_EVEN
 wxSTC_MOD_INSERTTEXT = stc_c.wxSTC_MOD_INSERTTEXT
 wxSTC_MOD_DELETETEXT = stc_c.wxSTC_MOD_DELETETEXT
 wxSTC_MOD_CHANGESTYLE = stc_c.wxSTC_MOD_CHANGESTYLE
@@ -1393,6 +1416,7 @@ wxSTC_LEX_ASP = stc_c.wxSTC_LEX_ASP
 wxSTC_LEX_PHP = stc_c.wxSTC_LEX_PHP
 wxSTC_LEX_BAAN = stc_c.wxSTC_LEX_BAAN
 wxSTC_LEX_MATLAB = stc_c.wxSTC_LEX_MATLAB
+wxSTC_LEX_SCRIPTOL = stc_c.wxSTC_LEX_SCRIPTOL
 wxSTC_LEX_AUTOMATIC = stc_c.wxSTC_LEX_AUTOMATIC
 wxSTC_P_DEFAULT = stc_c.wxSTC_P_DEFAULT
 wxSTC_P_COMMENTLINE = stc_c.wxSTC_P_COMMENTLINE
@@ -1427,15 +1451,6 @@ wxSTC_C_COMMENTLINEDOC = stc_c.wxSTC_C_COMMENTLINEDOC
 wxSTC_C_WORD2 = stc_c.wxSTC_C_WORD2
 wxSTC_C_COMMENTDOCKEYWORD = stc_c.wxSTC_C_COMMENTDOCKEYWORD
 wxSTC_C_COMMENTDOCKEYWORDERROR = stc_c.wxSTC_C_COMMENTDOCKEYWORDERROR
-wxSTC_B_DEFAULT = stc_c.wxSTC_B_DEFAULT
-wxSTC_B_COMMENT = stc_c.wxSTC_B_COMMENT
-wxSTC_B_NUMBER = stc_c.wxSTC_B_NUMBER
-wxSTC_B_KEYWORD = stc_c.wxSTC_B_KEYWORD
-wxSTC_B_STRING = stc_c.wxSTC_B_STRING
-wxSTC_B_PREPROCESSOR = stc_c.wxSTC_B_PREPROCESSOR
-wxSTC_B_OPERATOR = stc_c.wxSTC_B_OPERATOR
-wxSTC_B_IDENTIFIER = stc_c.wxSTC_B_IDENTIFIER
-wxSTC_B_DATE = stc_c.wxSTC_B_DATE
 wxSTC_H_DEFAULT = stc_c.wxSTC_H_DEFAULT
 wxSTC_H_TAG = stc_c.wxSTC_H_TAG
 wxSTC_H_TAGUNKNOWN = stc_c.wxSTC_H_TAGUNKNOWN
@@ -1576,6 +1591,20 @@ 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_B_DEFAULT = stc_c.wxSTC_B_DEFAULT
+wxSTC_B_COMMENT = stc_c.wxSTC_B_COMMENT
+wxSTC_B_NUMBER = stc_c.wxSTC_B_NUMBER
+wxSTC_B_KEYWORD = stc_c.wxSTC_B_KEYWORD
+wxSTC_B_STRING = stc_c.wxSTC_B_STRING
+wxSTC_B_PREPROCESSOR = stc_c.wxSTC_B_PREPROCESSOR
+wxSTC_B_OPERATOR = stc_c.wxSTC_B_OPERATOR
+wxSTC_B_IDENTIFIER = stc_c.wxSTC_B_IDENTIFIER
+wxSTC_B_DATE = stc_c.wxSTC_B_DATE
+wxSTC_PROPS_DEFAULT = stc_c.wxSTC_PROPS_DEFAULT
+wxSTC_PROPS_COMMENT = stc_c.wxSTC_PROPS_COMMENT
+wxSTC_PROPS_SECTION = stc_c.wxSTC_PROPS_SECTION
+wxSTC_PROPS_ASSIGNMENT = stc_c.wxSTC_PROPS_ASSIGNMENT
+wxSTC_PROPS_DEFVAL = stc_c.wxSTC_PROPS_DEFVAL
 wxSTC_L_DEFAULT = stc_c.wxSTC_L_DEFAULT
 wxSTC_L_COMMAND = stc_c.wxSTC_L_COMMAND
 wxSTC_L_TAG = stc_c.wxSTC_L_TAG
@@ -1608,6 +1637,7 @@ 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_CTAG = stc_c.wxSTC_ERR_CTAG
 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
@@ -1627,6 +1657,13 @@ 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_DIFF_DEFAULT = stc_c.wxSTC_DIFF_DEFAULT
+wxSTC_DIFF_COMMENT = stc_c.wxSTC_DIFF_COMMENT
+wxSTC_DIFF_COMMAND = stc_c.wxSTC_DIFF_COMMAND
+wxSTC_DIFF_HEADER = stc_c.wxSTC_DIFF_HEADER
+wxSTC_DIFF_POSITION = stc_c.wxSTC_DIFF_POSITION
+wxSTC_DIFF_DELETED = stc_c.wxSTC_DIFF_DELETED
+wxSTC_DIFF_ADDED = stc_c.wxSTC_DIFF_ADDED
 wxSTC_CONF_DEFAULT = stc_c.wxSTC_CONF_DEFAULT
 wxSTC_CONF_COMMENT = stc_c.wxSTC_CONF_COMMENT
 wxSTC_CONF_NUMBER = stc_c.wxSTC_CONF_NUMBER
@@ -1704,6 +1741,26 @@ wxSTC_MATLAB_KEYWORD = stc_c.wxSTC_MATLAB_KEYWORD
 wxSTC_MATLAB_STRING = stc_c.wxSTC_MATLAB_STRING
 wxSTC_MATLAB_OPERATOR = stc_c.wxSTC_MATLAB_OPERATOR
 wxSTC_MATLAB_IDENTIFIER = stc_c.wxSTC_MATLAB_IDENTIFIER
+wxSTC_SCRIPTOL_DEFAULT = stc_c.wxSTC_SCRIPTOL_DEFAULT
+wxSTC_SCRIPTOL_COMMENT = stc_c.wxSTC_SCRIPTOL_COMMENT
+wxSTC_SCRIPTOL_COMMENTLINE = stc_c.wxSTC_SCRIPTOL_COMMENTLINE
+wxSTC_SCRIPTOL_COMMENTDOC = stc_c.wxSTC_SCRIPTOL_COMMENTDOC
+wxSTC_SCRIPTOL_NUMBER = stc_c.wxSTC_SCRIPTOL_NUMBER
+wxSTC_SCRIPTOL_WORD = stc_c.wxSTC_SCRIPTOL_WORD
+wxSTC_SCRIPTOL_STRING = stc_c.wxSTC_SCRIPTOL_STRING
+wxSTC_SCRIPTOL_CHARACTER = stc_c.wxSTC_SCRIPTOL_CHARACTER
+wxSTC_SCRIPTOL_UUID = stc_c.wxSTC_SCRIPTOL_UUID
+wxSTC_SCRIPTOL_PREPROCESSOR = stc_c.wxSTC_SCRIPTOL_PREPROCESSOR
+wxSTC_SCRIPTOL_OPERATOR = stc_c.wxSTC_SCRIPTOL_OPERATOR
+wxSTC_SCRIPTOL_IDENTIFIER = stc_c.wxSTC_SCRIPTOL_IDENTIFIER
+wxSTC_SCRIPTOL_STRINGEOL = stc_c.wxSTC_SCRIPTOL_STRINGEOL
+wxSTC_SCRIPTOL_VERBATIM = stc_c.wxSTC_SCRIPTOL_VERBATIM
+wxSTC_SCRIPTOL_REGEX = stc_c.wxSTC_SCRIPTOL_REGEX
+wxSTC_SCRIPTOL_COMMENTLINEDOC = stc_c.wxSTC_SCRIPTOL_COMMENTLINEDOC
+wxSTC_SCRIPTOL_WORD2 = stc_c.wxSTC_SCRIPTOL_WORD2
+wxSTC_SCRIPTOL_COMMENTDOCKEYWORD = stc_c.wxSTC_SCRIPTOL_COMMENTDOCKEYWORD
+wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR = stc_c.wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR
+wxSTC_SCRIPTOL_COMMENTBASIC = stc_c.wxSTC_SCRIPTOL_COMMENTBASIC
 wxSTCNameStr = stc_c.wxSTCNameStr
 STC_USE_DND = stc_c.STC_USE_DND
 wxEVT_STC_CHANGE = stc_c.wxEVT_STC_CHANGE
@@ -1728,6 +1785,7 @@ wxEVT_STC_DWELLEND = stc_c.wxEVT_STC_DWELLEND
 wxEVT_STC_START_DRAG = stc_c.wxEVT_STC_START_DRAG
 wxEVT_STC_DRAG_OVER = stc_c.wxEVT_STC_DRAG_OVER
 wxEVT_STC_DO_DROP = stc_c.wxEVT_STC_DO_DROP
+wxEVT_STC_ZOOM = stc_c.wxEVT_STC_ZOOM
 
 
 #-------------- USER INCLUDE -----------------------
index 32f05e9e72fbd0284de6c77845ca32feebcb1326..2f0ef5416a729f6b6f931352c8cc42d7b195ac43 100644 (file)
@@ -111,6 +111,9 @@ def EVT_STC_DRAG_OVER(win, id, func):
 def EVT_STC_DO_DROP(win, id, func):
     win.Connect(id, -1, wxEVT_STC_DO_DROP, func)
 
+def EVT_STC_ZOOM(win, id, func):
+    win.Connect(id, -1, wxEVT_STC_ZOOM, func)
+
 "
 
 //----------------------------------------------------------------------
index b508a85007f31edf393328cd827b4685b5971be1..dd9652791dc34d6d39644a6691df01143d2e0767 100644 (file)
@@ -18,7 +18,7 @@ class TestView(wxStyledTextCtrl):
                           wxFont(10, wxMODERN, wxNORMAL, wxNORMAL))
         EVT_DYNAMIC_SASH_SPLIT(self, -1, self.OnSplit)
         EVT_DYNAMIC_SASH_UNIFY(self, -1, self.OnUnify)
-
+        #self.SetScrollWidth(500)
 
     def SetupScrollBars(self):
         # hook the scrollbars provided by the wxDynamicSashWindow
index e0964cf78a367a2f9a071c65cfcb237ddab87e56..83530d2ece08d8c3efa808bd094eaae350afc342 100644 (file)
@@ -162,8 +162,11 @@ def runTest(frame, nb, log):
         p.SetAutoLayout(true)
 
 
-##     ed.SetBufferedDraw(false)
-##     ed.StyleClearAll()
+    #ed.SetBufferedDraw(false)
+    #ed.StyleClearAll()
+    #ed.SetScrollWidth(800)
+    #ed.SetWrapMode(true)
+
     ed.SetText(demoText)
     if wxUSE_UNICODE:
         import codecs