Update Scintilla to version 3.7.0

This commit is contained in:
Colomban Wendling 2016-10-16 22:37:40 +02:00
parent 87111f268f
commit f5c4b1b6e5
22 changed files with 918 additions and 397 deletions

View File

@ -599,6 +599,20 @@
#define SCE_BAAN_IDENTIFIER 8 #define SCE_BAAN_IDENTIFIER 8
#define SCE_BAAN_STRINGEOL 9 #define SCE_BAAN_STRINGEOL 9
#define SCE_BAAN_WORD2 10 #define SCE_BAAN_WORD2 10
#define SCE_BAAN_WORD3 11
#define SCE_BAAN_WORD4 12
#define SCE_BAAN_WORD5 13
#define SCE_BAAN_WORD6 14
#define SCE_BAAN_WORD7 15
#define SCE_BAAN_WORD8 16
#define SCE_BAAN_WORD9 17
#define SCE_BAAN_TABLEDEF 18
#define SCE_BAAN_TABLESQL 19
#define SCE_BAAN_FUNCTION 20
#define SCE_BAAN_DOMDEF 21
#define SCE_BAAN_FUNCDEF 22
#define SCE_BAAN_OBJECTDEF 23
#define SCE_BAAN_DEFINEDEF 24
#define SCE_LISP_DEFAULT 0 #define SCE_LISP_DEFAULT 0
#define SCE_LISP_COMMENT 1 #define SCE_LISP_COMMENT 1
#define SCE_LISP_NUMBER 2 #define SCE_LISP_NUMBER 2
@ -1277,38 +1291,19 @@
#define SCE_PLM_OPERATOR 5 #define SCE_PLM_OPERATOR 5
#define SCE_PLM_CONTROL 6 #define SCE_PLM_CONTROL 6
#define SCE_PLM_KEYWORD 7 #define SCE_PLM_KEYWORD 7
#define SCE_4GL_DEFAULT 0 #define SCE_ABL_DEFAULT 0
#define SCE_4GL_NUMBER 1 #define SCE_ABL_NUMBER 1
#define SCE_4GL_WORD 2 #define SCE_ABL_WORD 2
#define SCE_4GL_STRING 3 #define SCE_ABL_STRING 3
#define SCE_4GL_CHARACTER 4 #define SCE_ABL_CHARACTER 4
#define SCE_4GL_PREPROCESSOR 5 #define SCE_ABL_PREPROCESSOR 5
#define SCE_4GL_OPERATOR 6 #define SCE_ABL_OPERATOR 6
#define SCE_4GL_IDENTIFIER 7 #define SCE_ABL_IDENTIFIER 7
#define SCE_4GL_BLOCK 8 #define SCE_ABL_BLOCK 8
#define SCE_4GL_END 9 #define SCE_ABL_END 9
#define SCE_4GL_COMMENT1 10 #define SCE_ABL_COMMENT 10
#define SCE_4GL_COMMENT2 11 #define SCE_ABL_TASKMARKER 11
#define SCE_4GL_COMMENT3 12 #define SCE_ABL_LINECOMMENT 12
#define SCE_4GL_COMMENT4 13
#define SCE_4GL_COMMENT5 14
#define SCE_4GL_COMMENT6 15
#define SCE_4GL_DEFAULT_ 16
#define SCE_4GL_NUMBER_ 17
#define SCE_4GL_WORD_ 18
#define SCE_4GL_STRING_ 19
#define SCE_4GL_CHARACTER_ 20
#define SCE_4GL_PREPROCESSOR_ 21
#define SCE_4GL_OPERATOR_ 22
#define SCE_4GL_IDENTIFIER_ 23
#define SCE_4GL_BLOCK_ 24
#define SCE_4GL_END_ 25
#define SCE_4GL_COMMENT1_ 26
#define SCE_4GL_COMMENT2_ 27
#define SCE_4GL_COMMENT3_ 28
#define SCE_4GL_COMMENT4_ 29
#define SCE_4GL_COMMENT5_ 30
#define SCE_4GL_COMMENT6_ 31
#define SCE_ABAQUS_DEFAULT 0 #define SCE_ABAQUS_DEFAULT 0
#define SCE_ABAQUS_COMMENT 1 #define SCE_ABAQUS_COMMENT 1
#define SCE_ABAQUS_COMMENTBLOCK 2 #define SCE_ABAQUS_COMMENTBLOCK 2

View File

@ -167,6 +167,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARGIN_FORE 3 #define SC_MARGIN_FORE 3
#define SC_MARGIN_TEXT 4 #define SC_MARGIN_TEXT 4
#define SC_MARGIN_RTEXT 5 #define SC_MARGIN_RTEXT 5
#define SC_MARGIN_COLOUR 6
#define SCI_SETMARGINTYPEN 2240 #define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241 #define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242 #define SCI_SETMARGINWIDTHN 2242
@ -177,6 +178,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETMARGINSENSITIVEN 2247 #define SCI_GETMARGINSENSITIVEN 2247
#define SCI_SETMARGINCURSORN 2248 #define SCI_SETMARGINCURSORN 2248
#define SCI_GETMARGINCURSORN 2249 #define SCI_GETMARGINCURSORN 2249
#define SCI_SETMARGINBACKN 2250
#define SCI_GETMARGINBACKN 2251
#define SCI_SETMARGINS 2252
#define SCI_GETMARGINS 2253
#define STYLE_DEFAULT 32 #define STYLE_DEFAULT 32
#define STYLE_LINENUMBER 33 #define STYLE_LINENUMBER 33
#define STYLE_BRACELIGHT 34 #define STYLE_BRACELIGHT 34
@ -650,12 +655,15 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define EDGE_NONE 0 #define EDGE_NONE 0
#define EDGE_LINE 1 #define EDGE_LINE 1
#define EDGE_BACKGROUND 2 #define EDGE_BACKGROUND 2
#define EDGE_MULTILINE 3
#define SCI_GETEDGECOLUMN 2360 #define SCI_GETEDGECOLUMN 2360
#define SCI_SETEDGECOLUMN 2361 #define SCI_SETEDGECOLUMN 2361
#define SCI_GETEDGEMODE 2362 #define SCI_GETEDGEMODE 2362
#define SCI_SETEDGEMODE 2363 #define SCI_SETEDGEMODE 2363
#define SCI_GETEDGECOLOUR 2364 #define SCI_GETEDGECOLOUR 2364
#define SCI_SETEDGECOLOUR 2365 #define SCI_SETEDGECOLOUR 2365
#define SCI_MULTIEDGEADDLINE 2694
#define SCI_MULTIEDGECLEARALL 2695
#define SCI_SEARCHANCHOR 2366 #define SCI_SEARCHANCHOR 2366
#define SCI_SEARCHNEXT 2367 #define SCI_SEARCHNEXT 2367
#define SCI_SEARCHPREV 2368 #define SCI_SEARCHPREV 2368
@ -679,6 +687,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETSTATUS 2383 #define SCI_GETSTATUS 2383
#define SCI_SETMOUSEDOWNCAPTURES 2384 #define SCI_SETMOUSEDOWNCAPTURES 2384
#define SCI_GETMOUSEDOWNCAPTURES 2385 #define SCI_GETMOUSEDOWNCAPTURES 2385
#define SCI_SETMOUSEWHEELCAPTURES 2696
#define SCI_GETMOUSEWHEELCAPTURES 2697
#define SC_CURSORNORMAL -1 #define SC_CURSORNORMAL -1
#define SC_CURSORARROW 2 #define SC_CURSORARROW 2
#define SC_CURSORWAIT 4 #define SC_CURSORWAIT 4

View File

@ -105,7 +105,7 @@ fun void ChangeInsertion=2672(int length, string text)
fun void ClearAll=2004(,) fun void ClearAll=2004(,)
# Delete a range of text in the document. # Delete a range of text in the document.
fun void DeleteRange=2645(position pos, int deleteLength) fun void DeleteRange=2645(position start, int lengthDelete)
# Set all style bytes to 0, remove all folding information. # Set all style bytes to 0, remove all folding information.
fun void ClearDocumentStyle=2005(,) fun void ClearDocumentStyle=2005(,)
@ -147,10 +147,10 @@ fun int GetStyledText=2015(, textrange tr)
fun bool CanRedo=2016(,) 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,) fun int MarkerLineFromHandle=2017(int markerHandle,)
# Delete a marker. # Delete a marker.
fun void MarkerDeleteHandle=2018(int handle,) fun void MarkerDeleteHandle=2018(int markerHandle,)
# Is undo history being collected? # Is undo history being collected?
get bool GetUndoCollection=2019(,) get bool GetUndoCollection=2019(,)
@ -179,11 +179,11 @@ fun position PositionFromPointClose=2023(int x, int y)
fun void GotoLine=2024(int line,) fun void GotoLine=2024(int line,)
# Set caret to a position and ensure it is visible. # Set caret to a position and ensure it is visible.
fun void GotoPos=2025(position pos,) fun void GotoPos=2025(position caret,)
# Set the selection anchor to a position. The anchor is the opposite # Set the selection anchor to a position. The anchor is the opposite
# end of the selection from the caret. # end of the selection from the caret.
set void SetAnchor=2026(position posAnchor,) set void SetAnchor=2026(position anchor,)
# Retrieve the text of the line containing the caret. # Retrieve the text of the line containing the caret.
# Returns the index of the caret on the line. # Returns the index of the caret on the line.
@ -207,9 +207,9 @@ get int GetEOLMode=2030(,)
# Set the current end of line mode. # Set the current end of line mode.
set void SetEOLMode=2031(int eolMode,) set void SetEOLMode=2031(int eolMode,)
# Set the current styling position to pos and the styling mask to mask. # Set the current styling position to start.
# The styling mask can be used to protect some bits in each styling byte from modification. # The unused parameter is no longer used and should be set to 0.
fun void StartStyling=2032(position pos, int mask) fun void StartStyling=2032(position start, int unused)
# Change style from current styling position for length characters to a style # Change style from current styling position for length characters to a style
# and move the current styling position to after this newly styled segment. # and move the current styling position to after this newly styled segment.
@ -346,7 +346,7 @@ fun int MarkerPrevious=2048(int lineStart, int markerMask)
fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap) fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap)
# Add a set of markers to a line. # Add a set of markers to a line.
fun void MarkerAddSet=2466(int line, int set) fun void MarkerAddSet=2466(int line, int markerSet)
# Set the alpha used for a marker that is drawn in the text area, not the margin. # Set the alpha used for a marker that is drawn in the text area, not the margin.
set void MarkerSetAlpha=2476(int markerNumber, int alpha) set void MarkerSetAlpha=2476(int markerNumber, int alpha)
@ -360,6 +360,7 @@ val SC_MARGIN_BACK=2
val SC_MARGIN_FORE=3 val SC_MARGIN_FORE=3
val SC_MARGIN_TEXT=4 val SC_MARGIN_TEXT=4
val SC_MARGIN_RTEXT=5 val SC_MARGIN_RTEXT=5
val SC_MARGIN_COLOUR=6
# Set a margin to be either numeric or symbolic. # Set a margin to be either numeric or symbolic.
set void SetMarginTypeN=2240(int margin, int marginType) set void SetMarginTypeN=2240(int margin, int marginType)
@ -391,6 +392,18 @@ set void SetMarginCursorN=2248(int margin, int cursor)
# Retrieve the cursor shown in a margin. # Retrieve the cursor shown in a margin.
get int GetMarginCursorN=2249(int margin,) get int GetMarginCursorN=2249(int margin,)
# Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR.
set void SetMarginBackN=2250(int margin, colour back)
# Retrieve the background colour of a margin
get colour GetMarginBackN=2251(int margin,)
# Allocate a non-standard number of margins.
set void SetMargins=2252(int margins,)
# How many margins are there?.
get int GetMargins=2253(,)
# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. # Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
# Style 39 is for future use. # Style 39 is for future use.
enu StylesCommon=STYLE_ enu StylesCommon=STYLE_
@ -452,7 +465,7 @@ set void StyleSetSize=2055(int style, int sizePoints)
set void StyleSetFont=2056(int style, string fontName) set void StyleSetFont=2056(int style, string fontName)
# Set a style to have its end of line filled or not. # Set a style to have its end of line filled or not.
set void StyleSetEOLFilled=2057(int style, bool filled) set void StyleSetEOLFilled=2057(int style, bool eolFilled)
# Reset the default style to its state at startup # Reset the default style to its state at startup
fun void StyleResetDefault=2058(,) fun void StyleResetDefault=2058(,)
@ -509,12 +522,12 @@ get bool StyleGetChangeable=2492(int style,)
get bool StyleGetHotSpot=2493(int style,) get bool StyleGetHotSpot=2493(int style,)
# Set a style to be mixed case, or to force upper or lower case. # Set a style to be mixed case, or to force upper or lower case.
set void StyleSetCase=2060(int style, int caseForce) set void StyleSetCase=2060(int style, int caseVisible)
val SC_FONT_SIZE_MULTIPLIER=100 val SC_FONT_SIZE_MULTIPLIER=100
# Set the size of characters of a style. Size is in points multiplied by 100. # Set the size of characters of a style. Size is in points multiplied by 100.
set void StyleSetSizeFractional=2061(int style, int caseForce) set void StyleSetSizeFractional=2061(int style, int sizeHundredthPoints)
# Get the size of characters of a style in points multiplied by 100 # Get the size of characters of a style in points multiplied by 100
get int StyleGetSizeFractional=2062(int style,) get int StyleGetSizeFractional=2062(int style,)
@ -557,11 +570,11 @@ set void SetSelEOLFilled=2480(bool filled,)
# Set the foreground colour of the caret. # Set the foreground colour of the caret.
set void SetCaretFore=2069(colour fore,) set void SetCaretFore=2069(colour fore,)
# When key+modifier combination km is pressed perform msg. # When key+modifier combination keyDefinition is pressed perform sciCommand.
fun void AssignCmdKey=2070(keymod km, int msg) fun void AssignCmdKey=2070(keymod keyDefinition, int sciCommand)
# When key+modifier combination km is pressed do nothing. # When key+modifier combination keyDefinition is pressed do nothing.
fun void ClearCmdKey=2071(keymod km,) fun void ClearCmdKey=2071(keymod keyDefinition,)
# Drop all key mappings. # Drop all key mappings.
fun void ClearAllCmdKeys=2072(,) fun void ClearAllCmdKeys=2072(,)
@ -623,34 +636,34 @@ val INDIC2_MASK=0x80
val INDICS_MASK=0xE0 val INDICS_MASK=0xE0
# Set an indicator to plain, squiggle or TT. # Set an indicator to plain, squiggle or TT.
set void IndicSetStyle=2080(int indic, int style) set void IndicSetStyle=2080(int indicator, int indicatorStyle)
# Retrieve the style of an indicator. # Retrieve the style of an indicator.
get int IndicGetStyle=2081(int indic,) get int IndicGetStyle=2081(int indicator,)
# Set the foreground colour of an indicator. # Set the foreground colour of an indicator.
set void IndicSetFore=2082(int indic, colour fore) set void IndicSetFore=2082(int indicator, colour fore)
# Retrieve the foreground colour of an indicator. # Retrieve the foreground colour of an indicator.
get colour IndicGetFore=2083(int indic,) get colour IndicGetFore=2083(int indicator,)
# Set an indicator to draw under text or over(default). # Set an indicator to draw under text or over(default).
set void IndicSetUnder=2510(int indic, bool under) set void IndicSetUnder=2510(int indicator, bool under)
# Retrieve whether indicator drawn under or over text. # Retrieve whether indicator drawn under or over text.
get bool IndicGetUnder=2511(int indic,) get bool IndicGetUnder=2511(int indicator,)
# Set a hover indicator to plain, squiggle or TT. # Set a hover indicator to plain, squiggle or TT.
set void IndicSetHoverStyle=2680(int indic, int style) set void IndicSetHoverStyle=2680(int indicator, int indicatorStyle)
# Retrieve the hover style of an indicator. # Retrieve the hover style of an indicator.
get int IndicGetHoverStyle=2681(int indic,) get int IndicGetHoverStyle=2681(int indicator,)
# Set the foreground hover colour of an indicator. # Set the foreground hover colour of an indicator.
set void IndicSetHoverFore=2682(int indic, colour fore) set void IndicSetHoverFore=2682(int indicator, colour fore)
# Retrieve the foreground hover colour of an indicator. # Retrieve the foreground hover colour of an indicator.
get colour IndicGetHoverFore=2683(int indic,) get colour IndicGetHoverFore=2683(int indicator,)
val SC_INDICVALUEBIT=0x1000000 val SC_INDICVALUEBIT=0x1000000
val SC_INDICVALUEMASK=0xFFFFFF val SC_INDICVALUEMASK=0xFFFFFF
@ -659,10 +672,10 @@ enu IndicFlag=SC_INDICFLAG_
val SC_INDICFLAG_VALUEFORE=1 val SC_INDICFLAG_VALUEFORE=1
# Set the attributes of an indicator. # Set the attributes of an indicator.
set void IndicSetFlags=2684(int indic, int flags) set void IndicSetFlags=2684(int indicator, int flags)
# Retrieve the attributes of an indicator. # Retrieve the attributes of an indicator.
get int IndicGetFlags=2685(int indic,) get int IndicGetFlags=2685(int indicator,)
# Set the foreground colour of all whitespace and whether to use this setting. # Set the foreground colour of all whitespace and whether to use this setting.
fun void SetWhitespaceFore=2084(bool useSetting, colour fore) fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
@ -710,9 +723,9 @@ set void SetCaretLineBack=2098(colour back,)
set void StyleSetChangeable=2099(int style, bool changeable) set void StyleSetChangeable=2099(int style, bool changeable)
# Display a auto-completion list. # Display a auto-completion list.
# The lenEntered parameter indicates how many characters before # The lengthEntered parameter indicates how many characters before
# the caret should be used to provide context. # the caret should be used to provide context.
fun void AutoCShow=2100(int lenEntered, string itemList) fun void AutoCShow=2100(int lengthEntered, string itemList)
# Remove the auto-completion list from the screen. # Remove the auto-completion list from the screen.
fun void AutoCCancel=2101(,) fun void AutoCCancel=2101(,)
@ -737,7 +750,7 @@ set void AutoCSetSeparator=2106(int separatorCharacter,)
get int AutoCGetSeparator=2107(,) get int AutoCGetSeparator=2107(,)
# Select the item in the auto-completion list that starts with a string. # Select the item in the auto-completion list that starts with a string.
fun void AutoCSelect=2108(, string text) fun void AutoCSelect=2108(, string select)
# Should the auto-completion list be cancelled if the user backspaces to a # Should the auto-completion list be cancelled if the user backspaces to a
# position before where the box was created. # position before where the box was created.
@ -820,7 +833,7 @@ set void SetUseTabs=2124(bool useTabs,)
get bool GetUseTabs=2125(,) get bool GetUseTabs=2125(,)
# Change the indentation of a line to a number of columns. # Change the indentation of a line to a number of columns.
set void SetLineIndentation=2126(int line, int indentSize) set void SetLineIndentation=2126(int line, int indentation)
# Retrieve the number of columns that a line is indented. # Retrieve the number of columns that a line is indented.
get int GetLineIndentation=2127(int line,) get int GetLineIndentation=2127(int line,)
@ -832,10 +845,10 @@ get position GetLineIndentPosition=2128(int line,)
get int GetColumn=2129(position pos,) get int GetColumn=2129(position pos,)
# Count characters between two positions. # Count characters between two positions.
fun int CountCharacters=2633(int startPos, int endPos) fun int CountCharacters=2633(position start, position end)
# Show or hide the horizontal scroll bar. # Show or hide the horizontal scroll bar.
set void SetHScrollBar=2130(bool show,) set void SetHScrollBar=2130(bool visible,)
# Is the horizontal scroll bar visible? # Is the horizontal scroll bar visible?
get bool GetHScrollBar=2131(,) get bool GetHScrollBar=2131(,)
@ -871,22 +884,22 @@ get colour GetCaretFore=2138(,)
get bool GetReadOnly=2140(,) get bool GetReadOnly=2140(,)
# Sets the position of the caret. # Sets the position of the caret.
set void SetCurrentPos=2141(position pos,) set void SetCurrentPos=2141(position caret,)
# Sets the position that starts the selection - this becomes the anchor. # Sets the position that starts the selection - this becomes the anchor.
set void SetSelectionStart=2142(position pos,) set void SetSelectionStart=2142(position anchor,)
# Returns the position at the start of the selection. # Returns the position at the start of the selection.
get position GetSelectionStart=2143(,) get position GetSelectionStart=2143(,)
# Sets the position that ends the selection - this becomes the currentPosition. # Sets the position that ends the selection - this becomes the caret.
set void SetSelectionEnd=2144(position pos,) set void SetSelectionEnd=2144(position caret,)
# Returns the position at the end of the selection. # Returns the position at the end of the selection.
get position GetSelectionEnd=2145(,) get position GetSelectionEnd=2145(,)
# Set caret to a position, while removing any existing selection. # Set caret to a position, while removing any existing selection.
fun void SetEmptySelection=2556(position pos,) fun void SetEmptySelection=2556(position caret,)
# Sets the print magnification added to the point size of each style for printing. # Sets the print magnification added to the point size of each style for printing.
set void SetPrintMagnification=2146(int magnification,) set void SetPrintMagnification=2146(int magnification,)
@ -921,7 +934,7 @@ val SCFIND_POSIX=0x00400000
val SCFIND_CXX11REGEX=0x00800000 val SCFIND_CXX11REGEX=0x00800000
# Find some text in the document. # Find some text in the document.
fun position FindText=2150(int flags, findtext ft) fun position FindText=2150(int searchFlags, 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 position FormatRange=2151(bool draw, formatrange fr) fun position FormatRange=2151(bool draw, formatrange fr)
@ -952,7 +965,7 @@ get int GetMarginRight=2158(,)
get bool GetModify=2159(,) get bool GetModify=2159(,)
# Select a range of text. # Select a range of text.
fun void SetSel=2160(position start, position end) fun void SetSel=2160(position anchor, position caret)
# Retrieve the selected text. # Retrieve the selected text.
# Return the length of the text. # Return the length of the text.
@ -964,7 +977,7 @@ fun int GetSelText=2161(, stringresult text)
fun int GetTextRange=2162(, textrange tr) fun int GetTextRange=2162(, textrange tr)
# Draw the selection in normal style or with selection highlighted. # Draw the selection in normal style or with selection highlighted.
fun void HideSelection=2163(bool normal,) fun void HideSelection=2163(bool hide,)
# Retrieve the x value of the point in the window where a position is displayed. # Retrieve the x value of the point in the window where a position is displayed.
fun int PointXFromPosition=2164(, position pos) fun int PointXFromPosition=2164(, position pos)
@ -1041,7 +1054,7 @@ get int GetDirectFunction=2184(,)
get int GetDirectPointer=2185(,) get int GetDirectPointer=2185(,)
# Set to overtype (true) or insert mode. # Set to overtype (true) or insert mode.
set void SetOvertype=2186(bool overtype,) set void SetOvertype=2186(bool overType,)
# Returns true if overtype mode is active otherwise false is returned. # Returns true if overtype mode is active otherwise false is returned.
get bool GetOvertype=2187(,) get bool GetOvertype=2187(,)
@ -1054,14 +1067,14 @@ get int GetCaretWidth=2189(,)
# Sets the position that starts the target which is used for updating the # Sets the position that starts the target which is used for updating the
# document without affecting the scroll position. # document without affecting the scroll position.
set void SetTargetStart=2190(position pos,) set void SetTargetStart=2190(position start,)
# Get the position that starts the target. # Get the position that starts the target.
get position GetTargetStart=2191(,) get position GetTargetStart=2191(,)
# Sets the position that ends the target which is used for updating the # Sets the position that ends the target which is used for updating the
# document without affecting the scroll position. # document without affecting the scroll position.
set void SetTargetEnd=2192(position pos,) set void SetTargetEnd=2192(position end,)
# Get the position that ends the target. # Get the position that ends the target.
get position GetTargetEnd=2193(,) get position GetTargetEnd=2193(,)
@ -1070,7 +1083,7 @@ get position GetTargetEnd=2193(,)
fun void SetTargetRange=2686(position start, position end) fun void SetTargetRange=2686(position start, position end)
# Retrieve the text in the target. # Retrieve the text in the target.
get int GetTargetText=2687(, stringresult characters) get int GetTargetText=2687(, stringresult text)
# Make the target range start and end be the same as the selection range start and end. # Make the target range start and end be the same as the selection range start and end.
fun void TargetFromSelection=2287(,) fun void TargetFromSelection=2287(,)
@ -1097,7 +1110,7 @@ fun int ReplaceTargetRE=2195(int length, string text)
fun int SearchInTarget=2197(int length, string text) 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,) set void SetSearchFlags=2198(int searchFlags,)
# Get the search flags used by SearchInTarget. # Get the search flags used by SearchInTarget.
get int GetSearchFlags=2199(,) get int GetSearchFlags=2199(,)
@ -1118,7 +1131,7 @@ fun position CallTipPosStart=2203(,)
set void CallTipSetPosStart=2214(int posStart,) set void CallTipSetPosStart=2214(int posStart,)
# Highlight a segment of the definition. # Highlight a segment of the definition.
fun void CallTipSetHlt=2204(int start, int end) fun void CallTipSetHlt=2204(int highlightStart, int highlightEnd)
# Set the background colour for the call tip. # Set the background colour for the call tip.
set void CallTipSetBack=2205(colour back,) set void CallTipSetBack=2205(colour back,)
@ -1136,13 +1149,13 @@ set void CallTipUseStyle=2212(int tabSize,)
set void CallTipSetPosition=2213(bool above,) set void CallTipSetPosition=2213(bool above,)
# Find the display line of a document line taking hidden lines into account. # Find the display line of a document line taking hidden lines into account.
fun int VisibleFromDocLine=2220(int line,) fun int VisibleFromDocLine=2220(int docLine,)
# Find the document line of a display line taking hidden lines into account. # Find the document line of a display line taking hidden lines into account.
fun int DocLineFromVisible=2221(int lineDisplay,) fun int DocLineFromVisible=2221(int displayLine,)
# The number of display lines needed to wrap a document line # The number of display lines needed to wrap a document line
fun int WrapCount=2235(int line,) fun int WrapCount=2235(int docLine,)
enu FoldLevel=SC_FOLDLEVEL enu FoldLevel=SC_FOLDLEVEL
val SC_FOLDLEVELBASE=0x400 val SC_FOLDLEVELBASE=0x400
@ -1185,7 +1198,7 @@ get bool GetFoldExpanded=2230(int line,)
# Switch a header line between expanded and contracted. # Switch a header line between expanded and contracted.
fun void ToggleFold=2231(int line,) fun void ToggleFold=2231(int line,)
enu FoldAction=SC_FOLDACTION enu FoldAction=SC_FOLDACTION_
val SC_FOLDACTION_CONTRACT=0 val SC_FOLDACTION_CONTRACT=0
val SC_FOLDACTION_EXPAND=1 val SC_FOLDACTION_EXPAND=1
val SC_FOLDACTION_TOGGLE=2 val SC_FOLDACTION_TOGGLE=2
@ -1279,7 +1292,7 @@ val SC_WRAP_CHAR=2
val SC_WRAP_WHITESPACE=3 val SC_WRAP_WHITESPACE=3
# Sets whether text is word wrapped. # Sets whether text is word wrapped.
set void SetWrapMode=2268(int mode,) set void SetWrapMode=2268(int wrapMode,)
# Retrieve whether text is word wrapped. # Retrieve whether text is word wrapped.
get int GetWrapMode=2269(,) get int GetWrapMode=2269(,)
@ -1319,7 +1332,7 @@ val SC_WRAPINDENT_SAME=1
val SC_WRAPINDENT_INDENT=2 val SC_WRAPINDENT_INDENT=2
# Sets how wrapped sublines are placed. Default is fixed. # Sets how wrapped sublines are placed. Default is fixed.
set void SetWrapIndentMode=2472(int mode,) set void SetWrapIndentMode=2472(int wrapIndentMode,)
# Retrieve how wrapped sublines are placed. Default is fixed. # Retrieve how wrapped sublines are placed. Default is fixed.
get int GetWrapIndentMode=2473(,) get int GetWrapIndentMode=2473(,)
@ -1331,7 +1344,7 @@ val SC_CACHE_PAGE=2
val SC_CACHE_DOCUMENT=3 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,) set void SetLayoutCache=2272(int cacheMode,)
# Retrieve the degree of caching of layout information. # Retrieve the degree of caching of layout information.
get int GetLayoutCache=2273(,) get int GetLayoutCache=2273(,)
@ -1366,7 +1379,7 @@ get bool GetEndAtLastLine=2278(,)
fun int TextHeight=2279(int line,) fun int TextHeight=2279(int line,)
# Show or hide the vertical scroll bar. # Show or hide the vertical scroll bar.
set void SetVScrollBar=2280(bool show,) set void SetVScrollBar=2280(bool visible,)
# Is the vertical scroll bar visible? # Is the vertical scroll bar visible?
get bool GetVScrollBar=2281(,) get bool GetVScrollBar=2281(,)
@ -1381,7 +1394,7 @@ get bool GetTwoPhaseDraw=2283(,)
# and then the foreground. This avoids chopping off characters that overlap the next run. # and then the foreground. This avoids chopping off characters that overlap the next run.
set void SetTwoPhaseDraw=2284(bool twoPhase,) set void SetTwoPhaseDraw=2284(bool twoPhase,)
enu FontQuality=SC_PHASES_ enu PhasesDraw=SC_PHASES_
val SC_PHASES_ONE=0 val SC_PHASES_ONE=0
val SC_PHASES_TWO=1 val SC_PHASES_TWO=1
val SC_PHASES_MULTIPLE=2 val SC_PHASES_MULTIPLE=2
@ -1411,7 +1424,7 @@ set void SetFontQuality=2611(int fontQuality,)
get int GetFontQuality=2612(,) get int GetFontQuality=2612(,)
# Scroll so that a display line is at the top of the display. # Scroll so that a display line is at the top of the display.
set void SetFirstVisibleLine=2613(int lineDisplay,) set void SetFirstVisibleLine=2613(int displayLine,)
enu MultiPaste=SC_MULTIPASTE_ enu MultiPaste=SC_MULTIPASTE_
val SC_MULTIPASTE_ONCE=0 val SC_MULTIPASTE_ONCE=0
@ -1434,8 +1447,9 @@ fun void LinesJoin=2288(,)
# where possible. # where possible.
fun void LinesSplit=2289(int pixelWidth,) fun void LinesSplit=2289(int pixelWidth,)
# Set the colours used as a chequerboard pattern in the fold margin # Set one of the colours used as a chequerboard pattern in the fold margin
fun void SetFoldMarginColour=2290(bool useSetting, colour back) fun void SetFoldMarginColour=2290(bool useSetting, colour back)
# Set the other colour used as a chequerboard pattern in the fold margin
fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore) fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore)
## New messages go here ## New messages go here
@ -1599,17 +1613,28 @@ fun void LineEndDisplay=2347(,)
# caret position. # caret position.
fun void LineEndDisplayExtend=2348(,) fun void LineEndDisplayExtend=2348(,)
# These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? # Like Home but when word-wrap is enabled goes first to start of display line
# except they behave differently when word-wrap is enabled: # HomeDisplay, then to start of document line Home.
# They go first to the start / end of the display line, like (Home|LineEnd)Display
# The difference is that, the cursor is already at the point, it goes on to the start
# or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
fun void HomeWrap=2349(,) fun void HomeWrap=2349(,)
# Like HomeExtend but when word-wrap is enabled extends first to start of display line
# HomeDisplayExtend, then to start of document line HomeExtend.
fun void HomeWrapExtend=2450(,) fun void HomeWrapExtend=2450(,)
# Like LineEnd but when word-wrap is enabled goes first to end of display line
# LineEndDisplay, then to start of document line LineEnd.
fun void LineEndWrap=2451(,) fun void LineEndWrap=2451(,)
# Like LineEndExtend but when word-wrap is enabled extends first to end of display line
# LineEndDisplayExtend, then to start of document line LineEndExtend.
fun void LineEndWrapExtend=2452(,) fun void LineEndWrapExtend=2452(,)
# Like VCHome but when word-wrap is enabled goes first to start of display line
# VCHomeDisplay, then behaves like VCHome.
fun void VCHomeWrap=2453(,) fun void VCHomeWrap=2453(,)
# Like VCHomeExtend but when word-wrap is enabled extends first to start of display line
# VCHomeDisplayExtend, then behaves like VCHomeExtend.
fun void VCHomeWrapExtend=2454(,) fun void VCHomeWrapExtend=2454(,)
# Copy the line containing the caret. # Copy the line containing the caret.
@ -1622,19 +1647,20 @@ fun void MoveCaretInsideView=2401(,)
fun int LineLength=2350(int line,) fun int LineLength=2350(int line,)
# Highlight the characters at two positions. # Highlight the characters at two positions.
fun void BraceHighlight=2351(position pos1, position pos2) fun void BraceHighlight=2351(position posA, position posB)
# Use specified indicator to highlight matching braces instead of changing their style. # Use specified indicator to highlight matching braces instead of changing their style.
fun void BraceHighlightIndicator=2498(bool useBraceHighlightIndicator, int indicator) fun void BraceHighlightIndicator=2498(bool useSetting, int indicator)
# Highlight the character at a position indicating there is no matching brace. # Highlight the character at a position indicating there is no matching brace.
fun void BraceBadLight=2352(position pos,) fun void BraceBadLight=2352(position pos,)
# Use specified indicator to highlight non matching brace instead of changing its style. # Use specified indicator to highlight non matching brace instead of changing its style.
fun void BraceBadLightIndicator=2499(bool useBraceBadLightIndicator, int indicator) fun void BraceBadLightIndicator=2499(bool useSetting, int indicator)
# Find the position of a matching brace or INVALID_POSITION if no match. # Find the position of a matching brace or INVALID_POSITION if no match.
fun position BraceMatch=2353(position pos,) # The maxReStyle must be 0 for now. It may be defined in a future release.
fun position BraceMatch=2353(position pos, int maxReStyle)
# Are the end of line characters visible? # Are the end of line characters visible?
get bool GetViewEOL=2355(,) get bool GetViewEOL=2355(,)
@ -1646,15 +1672,16 @@ set void SetViewEOL=2356(bool visible,)
get int GetDocPointer=2357(,) get int GetDocPointer=2357(,)
# Change the document object used. # Change the document object used.
set void SetDocPointer=2358(, int pointer) set void SetDocPointer=2358(, int doc)
# Set which document modification events are sent to the container. # Set which document modification events are sent to the container.
set void SetModEventMask=2359(int mask,) set void SetModEventMask=2359(int eventMask,)
enu EdgeVisualStyle=EDGE_ enu EdgeVisualStyle=EDGE_
val EDGE_NONE=0 val EDGE_NONE=0
val EDGE_LINE=1 val EDGE_LINE=1
val EDGE_BACKGROUND=2 val EDGE_BACKGROUND=2
val EDGE_MULTILINE=3
# Retrieve the column number which text should be kept within. # Retrieve the column number which text should be kept within.
get int GetEdgeColumn=2360(,) get int GetEdgeColumn=2360(,)
@ -1666,9 +1693,9 @@ set void SetEdgeColumn=2361(int column,)
# Retrieve the edge highlight mode. # Retrieve the edge highlight mode.
get int GetEdgeMode=2362(,) get int GetEdgeMode=2362(,)
# The edge may be displayed by a line (EDGE_LINE) or by highlighting text that # The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that
# goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). # goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
set void SetEdgeMode=2363(int mode,) set void SetEdgeMode=2363(int edgeMode,)
# Retrieve the colour used in edge indication. # Retrieve the colour used in edge indication.
get colour GetEdgeColour=2364(,) get colour GetEdgeColour=2364(,)
@ -1676,16 +1703,22 @@ get colour GetEdgeColour=2364(,)
# Change the colour used in edge indication. # Change the colour used in edge indication.
set void SetEdgeColour=2365(colour edgeColour,) set void SetEdgeColour=2365(colour edgeColour,)
# Add a new vertical edge to the view.
fun void MultiEdgeAddLine=2694(int column, colour edgeColour)
# Clear all vertical edges.
fun void MultiEdgeClearAll=2695(,)
# Sets the current caret position to be the search anchor. # Sets the current caret position to be the search anchor.
fun void SearchAnchor=2366(,) fun void SearchAnchor=2366(,)
# Find some text starting at the search anchor. # Find some text starting at the search anchor.
# Does not ensure the selection is visible. # Does not ensure the selection is visible.
fun int SearchNext=2367(int flags, string text) fun int SearchNext=2367(int searchFlags, string text)
# Find some text starting at the search anchor and moving backwards. # Find some text starting at the search anchor and moving backwards.
# Does not ensure the selection is visible. # Does not ensure the selection is visible.
fun int SearchPrev=2368(int flags, string text) fun int SearchPrev=2368(int searchFlags, string text)
# Retrieves the number of lines completely visible. # Retrieves the number of lines completely visible.
get int LinesOnScreen=2370(,) get int LinesOnScreen=2370(,)
@ -1699,7 +1732,7 @@ get bool SelectionIsRectangle=2372(,)
# Set the zoom level. This number of points is added to the size of all fonts. # Set the zoom level. This number of points is added to the size of all fonts.
# It may be positive to magnify or negative to reduce. # It may be positive to magnify or negative to reduce.
set void SetZoom=2373(int zoom,) set void SetZoom=2373(int zoomInPoints,)
# Retrieve the zoom level. # Retrieve the zoom level.
get int GetZoom=2374(,) get int GetZoom=2374(,)
@ -1727,7 +1760,7 @@ val SC_STATUS_WARN_START=1000
val SC_STATUS_WARN_REGEX=1001 val SC_STATUS_WARN_REGEX=1001
# Change error status - 0 = OK. # Change error status - 0 = OK.
set void SetStatus=2382(int statusCode,) set void SetStatus=2382(int status,)
# Get error status. # Get error status.
get int GetStatus=2383(,) get int GetStatus=2383(,)
@ -1736,6 +1769,11 @@ set void SetMouseDownCaptures=2384(bool captures,)
# Get whether mouse gets captured. # Get whether mouse gets captured.
get bool GetMouseDownCaptures=2385(,) get bool GetMouseDownCaptures=2385(,)
# Set whether the mouse wheel can be active outside the window.
set void SetMouseWheelCaptures=2696(bool captures,)
# Get whether mouse wheel can be active outside the window.
get bool GetMouseWheelCaptures=2697(,)
enu CursorShape=SC_CURSOR enu CursorShape=SC_CURSOR
val SC_CURSORNORMAL=-1 val SC_CURSORNORMAL=-1
val SC_CURSORARROW=2 val SC_CURSORARROW=2
@ -1777,7 +1815,7 @@ fun void DelLineLeft=2395(,)
fun void DelLineRight=2396(,) fun void DelLineRight=2396(,)
# Get and Set the xOffset (ie, horizontal scroll position). # Get and Set the xOffset (ie, horizontal scroll position).
set void SetXOffset=2397(int newOffset,) set void SetXOffset=2397(int xOffset,)
get int GetXOffset=2398(,) get int GetXOffset=2398(,)
# Set the last x chosen value to be the caret x position. # Set the last x chosen value to be the caret x position.
@ -1819,7 +1857,7 @@ fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop)
fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop) fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop)
# Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). # Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
set void SetPrintWrapMode=2406(int mode,) set void SetPrintWrapMode=2406(int wrapMode,)
# Is printing line wrapped? # Is printing line wrapped?
get int GetPrintWrapMode=2407(,) get int GetPrintWrapMode=2407(,)
@ -1848,10 +1886,13 @@ set void SetHotspotSingleLine=2421(bool singleLine,)
# Get the HotspotSingleLine property # Get the HotspotSingleLine property
get bool GetHotspotSingleLine=2497(,) get bool GetHotspotSingleLine=2497(,)
# Move caret between paragraphs (delimited by empty lines). # Move caret down one paragraph (delimited by empty lines).
fun void ParaDown=2413(,) fun void ParaDown=2413(,)
# Extend selection down one paragraph (delimited by empty lines).
fun void ParaDownExtend=2414(,) fun void ParaDownExtend=2414(,)
# Move caret up one paragraph (delimited by empty lines).
fun void ParaUp=2415(,) fun void ParaUp=2415(,)
# Extend selection up one paragraph (delimited by empty lines).
fun void ParaUpExtend=2416(,) fun void ParaUpExtend=2416(,)
# Given a valid document position, return the previous position taking code # Given a valid document position, return the previous position taking code
@ -1880,7 +1921,7 @@ val SC_SEL_THIN=3
# Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or # Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
# by lines (SC_SEL_LINES). # by lines (SC_SEL_LINES).
set void SetSelectionMode=2422(int mode,) set void SetSelectionMode=2422(int selectionMode,)
# Get the mode of the current selection. # Get the mode of the current selection.
get int GetSelectionMode=2423(,) get int GetSelectionMode=2423(,)
@ -1970,7 +2011,7 @@ get int AutoCGetCurrent=2445(,)
# Get currently selected item text in the auto-completion list # Get currently selected item text in the auto-completion list
# Returns the length of the item text # Returns the length of the item text
# Result is NUL-terminated. # Result is NUL-terminated.
get int AutoCGetCurrentText=2610(, stringresult s) get int AutoCGetCurrentText=2610(, stringresult text)
enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_ enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_
val SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0 val SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0
@ -2080,22 +2121,22 @@ set void SetIndicatorValue=2502(int value,)
get int GetIndicatorValue=2503(,) get int GetIndicatorValue=2503(,)
# Turn a indicator on over a range. # Turn a indicator on over a range.
fun void IndicatorFillRange=2504(int position, int fillLength) fun void IndicatorFillRange=2504(position start, int lengthFill)
# Turn a indicator off over a range. # Turn a indicator off over a range.
fun void IndicatorClearRange=2505(int position, int clearLength) fun void IndicatorClearRange=2505(position start, int lengthClear)
# Are any indicators present at position? # Are any indicators present at pos?
fun int IndicatorAllOnFor=2506(int position,) fun int IndicatorAllOnFor=2506(position pos,)
# What value does a particular indicator have at at a position? # What value does a particular indicator have at a position?
fun int IndicatorValueAt=2507(int indicator, int position) fun int IndicatorValueAt=2507(int indicator, position pos)
# Where does a particular indicator start? # Where does a particular indicator start?
fun int IndicatorStart=2508(int indicator, int position) fun int IndicatorStart=2508(int indicator, position pos)
# Where does a particular indicator end? # Where does a particular indicator end?
fun int IndicatorEnd=2509(int indicator, int position) fun int IndicatorEnd=2509(int indicator, position pos)
# Set number of entries in position cache # Set number of entries in position cache
set void SetPositionCache=2514(int size,) set void SetPositionCache=2514(int size,)
@ -2112,8 +2153,8 @@ get int GetCharacterPointer=2520(,)
# Return a read-only pointer to a range of characters in the document. # Return a read-only pointer to a range of characters in the document.
# May move the gap so that the range is contiguous, but will only move up # May move the gap so that the range is contiguous, but will only move up
# to rangeLength bytes. # to lengthRange bytes.
get int GetRangePointer=2643(int position, int rangeLength) get int GetRangePointer=2643(position start, int lengthRange)
# Return a position which, to avoid performance costs, should not be within # Return a position which, to avoid performance costs, should not be within
# the range of a call to GetRangePointer. # the range of a call to GetRangePointer.
@ -2268,7 +2309,7 @@ set void SetAdditionalCaretsBlink=2567(bool additionalCaretsBlink,)
get bool GetAdditionalCaretsBlink=2568(,) get bool GetAdditionalCaretsBlink=2568(,)
# Set whether additional carets are visible # Set whether additional carets are visible
set void SetAdditionalCaretsVisible=2608(bool additionalCaretsBlink,) set void SetAdditionalCaretsVisible=2608(bool additionalCaretsVisible,)
# Whether additional carets are visible # Whether additional carets are visible
get bool GetAdditionalCaretsVisible=2609(,) get bool GetAdditionalCaretsVisible=2609(,)
@ -2283,10 +2324,10 @@ get bool GetSelectionEmpty=2650(,)
fun void ClearSelections=2571(,) fun void ClearSelections=2571(,)
# Set a simple selection # Set a simple selection
fun int SetSelection=2572(int caret, int anchor) fun int SetSelection=2572(position caret, position anchor)
# Add a selection # Add a selection
fun int AddSelection=2573(int caret, int anchor) fun int AddSelection=2573(position caret, position anchor)
# Drop one selection # Drop one selection
fun void DropSelectionN=2671(int selection,) fun void DropSelectionN=2671(int selection,)
@ -2297,34 +2338,50 @@ set void SetMainSelection=2574(int selection,)
# Which selection is the main selection # Which selection is the main selection
get int GetMainSelection=2575(,) get int GetMainSelection=2575(,)
set void SetSelectionNCaret=2576(int selection, position pos) # Set the caret position of the nth selection.
set void SetSelectionNCaret=2576(int selection, position caret)
# Return the caret position of the nth selection.
get position GetSelectionNCaret=2577(int selection,) get position GetSelectionNCaret=2577(int selection,)
set void SetSelectionNAnchor=2578(int selection, position posAnchor) # Set the anchor position of the nth selection.
set void SetSelectionNAnchor=2578(int selection, position anchor)
# Return the anchor position of the nth selection.
get position GetSelectionNAnchor=2579(int selection,) get position GetSelectionNAnchor=2579(int selection,)
# Set the virtual space of the caret of the nth selection.
set void SetSelectionNCaretVirtualSpace=2580(int selection, int space) set void SetSelectionNCaretVirtualSpace=2580(int selection, int space)
# Return the virtual space of the caret of the nth selection.
get int GetSelectionNCaretVirtualSpace=2581(int selection,) get int GetSelectionNCaretVirtualSpace=2581(int selection,)
# Set the virtual space of the anchor of the nth selection.
set void SetSelectionNAnchorVirtualSpace=2582(int selection, int space) set void SetSelectionNAnchorVirtualSpace=2582(int selection, int space)
# Return the virtual space of the anchor of the nth selection.
get int GetSelectionNAnchorVirtualSpace=2583(int selection,) get int GetSelectionNAnchorVirtualSpace=2583(int selection,)
# Sets the position that starts the selection - this becomes the anchor. # Sets the position that starts the selection - this becomes the anchor.
set void SetSelectionNStart=2584(int selection, position pos) set void SetSelectionNStart=2584(int selection, position anchor)
# Returns the position at the start of the selection. # Returns the position at the start of the selection.
get position GetSelectionNStart=2585(int selection,) get position GetSelectionNStart=2585(int selection,)
# Sets the position that ends the selection - this becomes the currentPosition. # Sets the position that ends the selection - this becomes the currentPosition.
set void SetSelectionNEnd=2586(int selection, position pos) set void SetSelectionNEnd=2586(int selection, position caret)
# Returns the position at the end of the selection. # Returns the position at the end of the selection.
get position GetSelectionNEnd=2587(int selection,) get position GetSelectionNEnd=2587(int selection,)
set void SetRectangularSelectionCaret=2588(position pos,) # Set the caret position of the rectangular selection.
set void SetRectangularSelectionCaret=2588(position caret,)
# Return the caret position of the rectangular selection.
get position GetRectangularSelectionCaret=2589(,) get position GetRectangularSelectionCaret=2589(,)
set void SetRectangularSelectionAnchor=2590(position posAnchor,) # Set the anchor position of the rectangular selection.
set void SetRectangularSelectionAnchor=2590(position anchor,)
# Return the anchor position of the rectangular selection.
get position GetRectangularSelectionAnchor=2591(,) get position GetRectangularSelectionAnchor=2591(,)
# Set the virtual space of the caret of the rectangular selection.
set void SetRectangularSelectionCaretVirtualSpace=2592(int space,) set void SetRectangularSelectionCaretVirtualSpace=2592(int space,)
# Return the virtual space of the caret of the rectangular selection.
get int GetRectangularSelectionCaretVirtualSpace=2593(,) get int GetRectangularSelectionCaretVirtualSpace=2593(,)
# Set the virtual space of the anchor of the rectangular selection.
set void SetRectangularSelectionAnchorVirtualSpace=2594(int space,) set void SetRectangularSelectionAnchorVirtualSpace=2594(int space,)
# Return the virtual space of the anchor of the rectangular selection.
get int GetRectangularSelectionAnchorVirtualSpace=2595(,) get int GetRectangularSelectionAnchorVirtualSpace=2595(,)
enu VirtualSpace=SCVS_ enu VirtualSpace=SCVS_
@ -2333,7 +2390,9 @@ val SCVS_RECTANGULARSELECTION=1
val SCVS_USERACCESSIBLE=2 val SCVS_USERACCESSIBLE=2
val SCVS_NOWRAPLINESTART=4 val SCVS_NOWRAPLINESTART=4
# Set options for virtual space behaviour.
set void SetVirtualSpaceOptions=2596(int virtualSpaceOptions,) set void SetVirtualSpaceOptions=2596(int virtualSpaceOptions,)
# Return options for virtual space behaviour.
get int GetVirtualSpaceOptions=2597(,) get int GetVirtualSpaceOptions=2597(,)
# On GTK+, allow selecting the modifier key to use for mouse-based # On GTK+, allow selecting the modifier key to use for mouse-based
@ -2510,7 +2569,7 @@ set void SetProperty=4004(string key, string value)
val KEYWORDSET_MAX=8 val KEYWORDSET_MAX=8
# Set up the key words used by the lexer. # Set up the key words used by the lexer.
set void SetKeyWords=4005(int keywordSet, string keyWords) set void SetKeyWords=4005(int keyWordSet, string keyWords)
# Set the lexing language of the document based on string name. # Set the lexing language of the document based on string name.
set void SetLexerLanguage=4006(, string language) set void SetLexerLanguage=4006(, string language)
@ -2520,16 +2579,16 @@ fun void LoadLexerLibrary=4007(, string path)
# Retrieve a "property" value previously set with SetProperty. # Retrieve a "property" value previously set with SetProperty.
# Result is NUL-terminated. # Result is NUL-terminated.
get int GetProperty=4008(string key, stringresult buf) get int GetProperty=4008(string key, stringresult value)
# Retrieve a "property" value previously set with SetProperty, # Retrieve a "property" value previously set with SetProperty,
# with "$()" variable replacement on returned buffer. # with "$()" variable replacement on returned buffer.
# Result is NUL-terminated. # Result is NUL-terminated.
get int GetPropertyExpanded=4009(string key, stringresult buf) get int GetPropertyExpanded=4009(string key, stringresult value)
# Retrieve a "property" value previously set with SetProperty, # Retrieve a "property" value previously set with SetProperty,
# interpreted as an int AFTER any "$()" variable replacement. # interpreted as an int AFTER any "$()" variable replacement.
get int GetPropertyInt=4010(string key,) get int GetPropertyInt=4010(string key, int defaultValue)
# Retrieve the number of bits the current lexer needs for styling. # Retrieve the number of bits the current lexer needs for styling.
get int GetStyleBitsNeeded=4011(,) get int GetStyleBitsNeeded=4011(,)
@ -2537,7 +2596,7 @@ get int GetStyleBitsNeeded=4011(,)
# Retrieve the name of the lexer. # Retrieve the name of the lexer.
# Return the length of the text. # Return the length of the text.
# Result is NUL-terminated. # Result is NUL-terminated.
get int GetLexerLanguage=4012(, stringresult text) get int GetLexerLanguage=4012(, stringresult language)
# For private communication between an application and a known lexer. # For private communication between an application and a known lexer.
fun int PrivateLexerCall=4013(int operation, int pointer) fun int PrivateLexerCall=4013(int operation, int pointer)
@ -3333,6 +3392,20 @@ val SCE_BAAN_OPERATOR=7
val SCE_BAAN_IDENTIFIER=8 val SCE_BAAN_IDENTIFIER=8
val SCE_BAAN_STRINGEOL=9 val SCE_BAAN_STRINGEOL=9
val SCE_BAAN_WORD2=10 val SCE_BAAN_WORD2=10
val SCE_BAAN_WORD3=11
val SCE_BAAN_WORD4=12
val SCE_BAAN_WORD5=13
val SCE_BAAN_WORD6=14
val SCE_BAAN_WORD7=15
val SCE_BAAN_WORD8=16
val SCE_BAAN_WORD9=17
val SCE_BAAN_TABLEDEF=18
val SCE_BAAN_TABLESQL=19
val SCE_BAAN_FUNCTION=20
val SCE_BAAN_DOMDEF=21
val SCE_BAAN_FUNCDEF=22
val SCE_BAAN_OBJECTDEF=23
val SCE_BAAN_DEFINEDEF=24
# Lexical states for SCLEX_LISP # Lexical states for SCLEX_LISP
lex Lisp=SCLEX_LISP SCE_LISP_ lex Lisp=SCLEX_LISP SCE_LISP_
val SCE_LISP_DEFAULT=0 val SCE_LISP_DEFAULT=0
@ -4107,39 +4180,20 @@ val SCE_PLM_OPERATOR=5
val SCE_PLM_CONTROL=6 val SCE_PLM_CONTROL=6
val SCE_PLM_KEYWORD=7 val SCE_PLM_KEYWORD=7
# Lexical state for SCLEX_PROGRESS # Lexical state for SCLEX_PROGRESS
lex Progress=SCLEX_PROGRESS SCE_4GL_ lex Progress=SCLEX_PROGRESS SCE_ABL_
val SCE_4GL_DEFAULT=0 val SCE_ABL_DEFAULT=0
val SCE_4GL_NUMBER=1 val SCE_ABL_NUMBER=1
val SCE_4GL_WORD=2 val SCE_ABL_WORD=2
val SCE_4GL_STRING=3 val SCE_ABL_STRING=3
val SCE_4GL_CHARACTER=4 val SCE_ABL_CHARACTER=4
val SCE_4GL_PREPROCESSOR=5 val SCE_ABL_PREPROCESSOR=5
val SCE_4GL_OPERATOR=6 val SCE_ABL_OPERATOR=6
val SCE_4GL_IDENTIFIER=7 val SCE_ABL_IDENTIFIER=7
val SCE_4GL_BLOCK=8 val SCE_ABL_BLOCK=8
val SCE_4GL_END=9 val SCE_ABL_END=9
val SCE_4GL_COMMENT1=10 val SCE_ABL_COMMENT=10
val SCE_4GL_COMMENT2=11 val SCE_ABL_TASKMARKER=11
val SCE_4GL_COMMENT3=12 val SCE_ABL_LINECOMMENT=12
val SCE_4GL_COMMENT4=13
val SCE_4GL_COMMENT5=14
val SCE_4GL_COMMENT6=15
val SCE_4GL_DEFAULT_=16
val SCE_4GL_NUMBER_=17
val SCE_4GL_WORD_=18
val SCE_4GL_STRING_=19
val SCE_4GL_CHARACTER_=20
val SCE_4GL_PREPROCESSOR_=21
val SCE_4GL_OPERATOR_=22
val SCE_4GL_IDENTIFIER_=23
val SCE_4GL_BLOCK_=24
val SCE_4GL_END_=25
val SCE_4GL_COMMENT1_=26
val SCE_4GL_COMMENT2_=27
val SCE_4GL_COMMENT3_=28
val SCE_4GL_COMMENT4_=29
val SCE_4GL_COMMENT5_=30
val SCE_4GL_COMMENT6_=31
# Lexical states for SCLEX_ABAQUS # Lexical states for SCLEX_ABAQUS
lex ABAQUS=SCLEX_ABAQUS SCE_ABAQUS_ lex ABAQUS=SCLEX_ABAQUS SCE_ABAQUS_
val SCE_ABAQUS_DEFAULT=0 val SCE_ABAQUS_DEFAULT=0

View File

@ -40,6 +40,36 @@ static bool IsSpaceEquiv(int state) {
|| state == SCE_COFFEESCRIPT_REGEX); || state == SCE_COFFEESCRIPT_REGEX);
} }
// Store the current lexer state and brace count prior to starting a new
// `#{}` interpolation level.
// Based on LexRuby.cxx.
static void enterInnerExpression(int *p_inner_string_types,
int *p_inner_expn_brace_counts,
int& inner_string_count,
int state,
int& brace_counts
) {
p_inner_string_types[inner_string_count] = state;
p_inner_expn_brace_counts[inner_string_count] = brace_counts;
brace_counts = 0;
++inner_string_count;
}
// Restore the lexer state and brace count for the previous `#{}` interpolation
// level upon returning to it.
// Note the previous lexer state is the return value and needs to be restored
// manually by the StyleContext.
// Based on LexRuby.cxx.
static int exitInnerExpression(int *p_inner_string_types,
int *p_inner_expn_brace_counts,
int& inner_string_count,
int& brace_counts
) {
--inner_string_count;
brace_counts = p_inner_expn_brace_counts[inner_string_count];
return p_inner_string_types[inner_string_count];
}
// Preconditions: sc.currentPos points to a character after '+' or '-'. // Preconditions: sc.currentPos points to a character after '+' or '-'.
// The test for pos reaching 0 should be redundant, // The test for pos reaching 0 should be redundant,
// and is in only for safety measures. // and is in only for safety measures.
@ -88,6 +118,27 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length
int chPrevNonWhite = ' '; int chPrevNonWhite = ' ';
int visibleChars = 0; int visibleChars = 0;
// String/Regex interpolation variables, based on LexRuby.cxx.
// In most cases a value of 2 should be ample for the code the user is
// likely to enter. For example,
// "Filling the #{container} with #{liquid}..."
// from the CoffeeScript homepage nests to a level of 2
// If the user actually hits a 6th occurrence of '#{' in a double-quoted
// string (including regexes), it will stay as a string. The problem with
// this is that quotes might flip, a 7th '#{' will look like a comment,
// and code-folding might be wrong.
#define INNER_STRINGS_MAX_COUNT 5
// These vars track our instances of "...#{,,,'..#{,,,}...',,,}..."
int inner_string_types[INNER_STRINGS_MAX_COUNT];
// Track # braces when we push a new #{ thing
int inner_expn_brace_counts[INNER_STRINGS_MAX_COUNT];
int inner_string_count = 0;
int brace_counts = 0; // Number of #{ ... } things within an expression
for (int i = 0; i < INNER_STRINGS_MAX_COUNT; i++) {
inner_string_types[i] = 0;
inner_expn_brace_counts[i] = 0;
}
// look back to set chPrevNonWhite properly for better regex colouring // look back to set chPrevNonWhite properly for better regex colouring
Sci_Position endPos = startPos + length; Sci_Position endPos = startPos + length;
if (startPos > 0 && IsSpaceEquiv(initStyle)) { if (startPos > 0 && IsSpaceEquiv(initStyle)) {
@ -109,7 +160,7 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length
StyleContext sc(startPos, endPos - startPos, initStyle, styler); StyleContext sc(startPos, endPos - startPos, initStyle, styler);
for (; sc.More(); sc.Forward()) { for (; sc.More();) {
if (sc.atLineStart) { if (sc.atLineStart) {
// Reset states to beginning of colourise so no surprises // Reset states to beginning of colourise so no surprises
@ -164,6 +215,15 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length
} }
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (sc.ch == '#' && sc.chNext == '{' && inner_string_count < INNER_STRINGS_MAX_COUNT) {
// process interpolated code #{ ... }
enterInnerExpression(inner_string_types,
inner_expn_brace_counts,
inner_string_count,
sc.state,
brace_counts);
sc.SetState(SCE_COFFEESCRIPT_OPERATOR);
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
} }
break; break;
case SCE_COFFEESCRIPT_CHARACTER: case SCE_COFFEESCRIPT_CHARACTER:
@ -255,6 +315,15 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length
// Handle '..' and '...' operators correctly. // Handle '..' and '...' operators correctly.
if (sc.ch == '.') { if (sc.ch == '.') {
for (int i = 0; i < 2 && sc.chNext == '.'; i++, sc.Forward()) ; for (int i = 0; i < 2 && sc.chNext == '.'; i++, sc.Forward()) ;
} else if (sc.ch == '{') {
++brace_counts;
} else if (sc.ch == '}' && --brace_counts <= 0 && inner_string_count > 0) {
// Return to previous state before #{ ... }
sc.ForwardSetState(exitInnerExpression(inner_string_types,
inner_expn_brace_counts,
inner_string_count,
brace_counts));
continue; // skip sc.Forward() at loop end
} }
} }
} }
@ -263,6 +332,7 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length
chPrevNonWhite = sc.ch; chPrevNonWhite = sc.ch;
visibleChars++; visibleChars++;
} }
sc.Forward();
} }
sc.Complete(); sc.Complete();
} }

View File

@ -149,6 +149,8 @@ static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length,
sc.SetState(SCE_POWERSHELL_OPERATOR); sc.SetState(SCE_POWERSHELL_OPERATOR);
} else if (IsAWordChar(sc.ch)) { } else if (IsAWordChar(sc.ch)) {
sc.SetState(SCE_POWERSHELL_IDENTIFIER); sc.SetState(SCE_POWERSHELL_IDENTIFIER);
} else if (sc.ch == '`') {
sc.Forward(); // skip next escaped character
} }
} }
} }

View File

@ -46,7 +46,7 @@ static unsigned int SpaceCount(char* lineBuffer) {
while (*headBuffer == ' ') while (*headBuffer == ' ')
headBuffer++; headBuffer++;
return headBuffer - lineBuffer; return static_cast<unsigned int>(headBuffer - lineBuffer);
} }
#define YAML_STATE_BITSIZE 16 #define YAML_STATE_BITSIZE 16
@ -148,16 +148,30 @@ static void ColouriseYAMLLine(
styler.ColourTo(endPos, SCE_YAML_KEYWORD); styler.ColourTo(endPos, SCE_YAML_KEYWORD);
return; return;
} else { } else {
Sci_PositionU startComment = i;
bInQuotes = false;
while (startComment < lengthLine) { // Comment must be space padded
if (lineBuffer[startComment] == '\'' || lineBuffer[startComment] == '\"')
bInQuotes = !bInQuotes;
if (lineBuffer[startComment] == '#' && isspacechar(lineBuffer[startComment - 1]) && !bInQuotes)
break;
startComment++;
}
Sci_PositionU i2 = i; Sci_PositionU i2 = i;
while ((i < lengthLine) && lineBuffer[i]) { while ((i < startComment) && lineBuffer[i]) {
if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') { if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-'
styler.ColourTo(endPos, SCE_YAML_DEFAULT); && lineBuffer[i] != '.' && lineBuffer[i] != ',' && lineBuffer[i] != ' ') {
styler.ColourTo(startLine + startComment - 1, SCE_YAML_DEFAULT);
if (startComment < lengthLine)
styler.ColourTo(endPos, SCE_YAML_COMMENT);
return; return;
} }
i++; i++;
} }
if (i > i2) { if (i > i2) {
styler.ColourTo(endPos, SCE_YAML_NUMBER); styler.ColourTo(startLine + startComment - 1, SCE_YAML_NUMBER);
if (startComment < lengthLine)
styler.ColourTo(endPos, SCE_YAML_COMMENT);
return; return;
} }
} }

View File

@ -25,8 +25,8 @@ namespace Scintilla {
int CompareCaseInsensitive(const char *a, const char *b) { int CompareCaseInsensitive(const char *a, const char *b) {
while (*a && *b) { while (*a && *b) {
if (*a != *b) { if (*a != *b) {
char upperA = MakeUpperCase(*a); char upperA = static_cast<char>(MakeUpperCase(*a));
char upperB = MakeUpperCase(*b); char upperB = static_cast<char>(MakeUpperCase(*b));
if (upperA != upperB) if (upperA != upperB)
return upperA - upperB; return upperA - upperB;
} }
@ -40,8 +40,8 @@ int CompareCaseInsensitive(const char *a, const char *b) {
int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
while (*a && *b && len) { while (*a && *b && len) {
if (*a != *b) { if (*a != *b) {
char upperA = MakeUpperCase(*a); char upperA = static_cast<char>(MakeUpperCase(*a));
char upperB = MakeUpperCase(*b); char upperB = static_cast<char>(MakeUpperCase(*b));
if (upperA != upperB) if (upperA != upperB)
return upperA - upperB; return upperA - upperB;
} }

View File

@ -160,13 +160,20 @@ inline bool isoperator(int ch) {
// Simple case functions for ASCII. // Simple case functions for ASCII.
inline char MakeUpperCase(char ch) { inline int MakeUpperCase(int ch) {
if (ch < 'a' || ch > 'z') if (ch < 'a' || ch > 'z')
return ch; return ch;
else else
return static_cast<char>(ch - 'a' + 'A'); return static_cast<char>(ch - 'a' + 'A');
} }
inline int MakeLowerCase(int ch) {
if (ch < 'A' || ch > 'Z')
return ch;
else
return ch - 'A' + 'a';
}
int CompareCaseInsensitive(const char *a, const char *b); int CompareCaseInsensitive(const char *a, const char *b);
int CompareNCaseInsensitive(const char *a, const char *b, size_t len); int CompareNCaseInsensitive(const char *a, const char *b, size_t len);

View File

@ -16,11 +16,28 @@
#include "LexAccessor.h" #include "LexAccessor.h"
#include "Accessor.h" #include "Accessor.h"
#include "StyleContext.h" #include "StyleContext.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
#endif #endif
bool StyleContext::MatchIgnoreCase(const char *s) {
if (MakeLowerCase(ch) != static_cast<unsigned char>(*s))
return false;
s++;
if (MakeLowerCase(chNext) != static_cast<unsigned char>(*s))
return false;
s++;
for (int n = 2; *s; n++) {
if (static_cast<unsigned char>(*s) !=
MakeLowerCase(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + n, 0))))
return false;
s++;
}
return true;
}
static void getRange(Sci_PositionU start, static void getRange(Sci_PositionU start,
Sci_PositionU end, Sci_PositionU end,
LexAccessor &styler, LexAccessor &styler,

View File

@ -12,13 +12,6 @@
namespace Scintilla { namespace Scintilla {
#endif #endif
static inline int MakeLowerCase(int ch) {
if (ch < 'A' || ch > 'Z')
return ch;
else
return ch - 'A' + 'a';
}
// All languages handled so far can treat all characters >= 0x80 as one class // All languages handled so far can treat all characters >= 0x80 as one class
// which just continues the current token or starts an identifier if in default. // which just continues the current token or starts an identifier if in default.
// DBCS treated specially as the second character can be < 0x80 and hence // DBCS treated specially as the second character can be < 0x80 and hence
@ -204,22 +197,8 @@ public:
} }
return true; return true;
} }
bool MatchIgnoreCase(const char *s) {
if (MakeLowerCase(ch) != static_cast<unsigned char>(*s))
return false;
s++;
if (MakeLowerCase(chNext) != static_cast<unsigned char>(*s))
return false;
s++;
for (int n=2; *s; n++) {
if (static_cast<unsigned char>(*s) !=
MakeLowerCase(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n, 0))))
return false;
s++;
}
return true;
}
// Non-inline // Non-inline
bool MatchIgnoreCase(const char *s);
void GetCurrent(char *s, Sci_PositionU len); void GetCurrent(char *s, Sci_PositionU len);
void GetCurrentLowered(char *s, Sci_PositionU len); void GetCurrentLowered(char *s, Sci_PositionU len);
}; };

View File

@ -236,6 +236,66 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const {
return false; return false;
} }
/** similar to InListAbbreviated, but word s can be a abridged version of a keyword.
* eg. the keyword is defined as "after.~:". This means the word must have a prefix (begins with) of
* "after." and suffix (ends with) of ":" to be a keyword, Hence "after.field:" , "after.form.item:" are valid.
* Similarly "~.is.valid" keyword is suffix only... hence "field.is.valid" , "form.is.valid" are valid.
* The marker is ~ in this case.
* No multiple markers check is done and wont work.
*/
bool WordList::InListAbridged(const char *s, const char marker) const {
if (0 == words)
return false;
unsigned char firstChar = s[0];
int j = starts[firstChar];
if (j >= 0) {
while (static_cast<unsigned char>(words[j][0]) == firstChar) {
const char *a = words[j];
const char *b = s;
while (*a && *a == *b) {
a++;
if (*a == marker) {
a++;
const size_t suffixLengthA = strlen(a);
const size_t suffixLengthB = strlen(b);
if (suffixLengthA >= suffixLengthB)
break;
b = b + suffixLengthB - suffixLengthA - 1;
}
b++;
}
if (!*a && !*b)
return true;
j++;
}
}
j = starts[static_cast<unsigned int>(marker)];
if (j >= 0) {
while (words[j][0] == marker) {
const char *a = words[j] + 1;
const char *b = s;
const size_t suffixLengthA = strlen(a);
const size_t suffixLengthB = strlen(b);
if (suffixLengthA > suffixLengthB) {
j++;
continue;
}
b = b + suffixLengthB - suffixLengthA;
while (*a && *a == *b) {
a++;
b++;
}
if (!*a && !*b)
return true;
j++;
}
}
return false;
}
const char *WordList::WordAt(int n) const { const char *WordList::WordAt(int n) const {
return words[n]; return words[n];
} }

View File

@ -31,6 +31,7 @@ public:
void Set(const char *s); void Set(const char *s);
bool InList(const char *s) const; bool InList(const char *s) const;
bool InListAbbreviated(const char *s, const char marker) const; bool InListAbbreviated(const char *s, const char marker) const;
bool InListAbridged(const char *s, const char marker) const;
const char *WordAt(int n) const; const char *WordAt(int n) const;
}; };

View File

@ -26,6 +26,7 @@
#include "Scintilla.h" #include "Scintilla.h"
#include "CharacterSet.h" #include "CharacterSet.h"
#include "CharacterCategory.h"
#include "Position.h" #include "Position.h"
#include "SplitVector.h" #include "SplitVector.h"
#include "Partitioning.h" #include "Partitioning.h"
@ -44,10 +45,6 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
static inline bool IsPunctuation(char ch) {
return IsASCII(ch) && ispunct(ch);
}
void LexInterface::Colourise(int start, int end) { void LexInterface::Colourise(int start, int end) {
if (pdoc && instance && !performingStyle) { if (pdoc && instance && !performingStyle) {
// Protect against reentrance, which may occur, for example, when // Protect against reentrance, which may occur, for example, when
@ -771,6 +768,77 @@ bool Document::NextCharacter(int &pos, int moveDir) const {
} }
} }
Document::CharacterExtracted Document::CharacterAfter(int position) const {
if (position >= Length()) {
return CharacterExtracted(unicodeReplacementChar, 0);
}
const unsigned char leadByte = static_cast<unsigned char>(cb.CharAt(position));
if (!dbcsCodePage || UTF8IsAscii(leadByte)) {
// Common case: ASCII character
return CharacterExtracted(leadByte, 1);
}
if (SC_CP_UTF8 == dbcsCodePage) {
const int widthCharBytes = UTF8BytesOfLead[leadByte];
unsigned char charBytes[UTF8MaxBytes] = { leadByte, 0, 0, 0 };
for (int b = 1; b<widthCharBytes; b++)
charBytes[b] = static_cast<unsigned char>(cb.CharAt(position + b));
int utf8status = UTF8Classify(charBytes, widthCharBytes);
if (utf8status & UTF8MaskInvalid) {
// Treat as invalid and use up just one byte
return CharacterExtracted(unicodeReplacementChar, 1);
} else {
return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth);
}
} else {
if (IsDBCSLeadByte(leadByte) && ((position + 1) < Length())) {
return CharacterExtracted::DBCS(leadByte, static_cast<unsigned char>(cb.CharAt(position + 1)));
} else {
return CharacterExtracted(leadByte, 1);
}
}
}
Document::CharacterExtracted Document::CharacterBefore(int position) const {
if (position <= 0) {
return CharacterExtracted(unicodeReplacementChar, 0);
}
const unsigned char previousByte = static_cast<unsigned char>(cb.CharAt(position - 1));
if (0 == dbcsCodePage) {
return CharacterExtracted(previousByte, 1);
}
if (SC_CP_UTF8 == dbcsCodePage) {
if (UTF8IsAscii(previousByte)) {
return CharacterExtracted(previousByte, 1);
}
position--;
// If previousByte is not a trail byte then its invalid
if (UTF8IsTrailByte(previousByte)) {
// If previousByte is a trail byte in a valid UTF-8 character then find start of character
int startUTF = position;
int endUTF = position;
if (InGoodUTF8(position, startUTF, endUTF)) {
const int widthCharBytes = endUTF - startUTF;
unsigned char charBytes[UTF8MaxBytes] = { 0, 0, 0, 0 };
for (int b = 0; b<widthCharBytes; b++)
charBytes[b] = static_cast<unsigned char>(cb.CharAt(startUTF + b));
int utf8status = UTF8Classify(charBytes, widthCharBytes);
if (utf8status & UTF8MaskInvalid) {
// Treat as invalid and use up just one byte
return CharacterExtracted(unicodeReplacementChar, 1);
} else {
return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth);
}
}
// Else invalid UTF-8 so return position of isolated trail byte
}
return CharacterExtracted(unicodeReplacementChar, 1);
} else {
// Moving backwards in DBCS is complex so use NextPosition
const int posStartCharacter = NextPosition(position, -1);
return CharacterAfter(posStartCharacter);
}
}
// Return -1 on out-of-bounds // Return -1 on out-of-bounds
Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const { Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const {
int pos = positionStart; int pos = positionStart;
@ -1485,28 +1553,104 @@ int Document::ParaDown(int pos) const {
return LineEnd(line-1); return LineEnd(line-1);
} }
CharClassify::cc Document::WordCharClass(unsigned char ch) const { bool Document::IsASCIIWordByte(unsigned char ch) const {
if ((SC_CP_UTF8 == dbcsCodePage) && (!UTF8IsAscii(ch))) if (IsASCII(ch)) {
return CharClassify::ccWord; return charClass.GetClass(ch) == CharClassify::ccWord;
return charClass.GetClass(ch); } else {
return false;
}
}
CharClassify::cc Document::WordCharacterClass(unsigned int ch) const {
if (dbcsCodePage && (!UTF8IsAscii(ch))) {
if (SC_CP_UTF8 == dbcsCodePage) {
// Use hard coded Unicode class
const CharacterCategory cc = CategoriseCharacter(ch);
switch (cc) {
// Separator, Line/Paragraph
case ccZl:
case ccZp:
return CharClassify::ccNewLine;
// Separator, Space
case ccZs:
// Other
case ccCc:
case ccCf:
case ccCs:
case ccCo:
case ccCn:
return CharClassify::ccSpace;
// Letter
case ccLu:
case ccLl:
case ccLt:
case ccLm:
case ccLo:
// Number
case ccNd:
case ccNl:
case ccNo:
// Mark - includes combining diacritics
case ccMn:
case ccMc:
case ccMe:
return CharClassify::ccWord;
// Punctuation
case ccPc:
case ccPd:
case ccPs:
case ccPe:
case ccPi:
case ccPf:
case ccPo:
// Symbol
case ccSm:
case ccSc:
case ccSk:
case ccSo:
return CharClassify::ccPunctuation;
}
} else {
// Asian DBCS
return CharClassify::ccWord;
}
}
return charClass.GetClass(static_cast<unsigned char>(ch));
} }
/** /**
* Used by commmands that want to select whole words. * Used by commmands that want to select whole words.
* Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0.
*/ */
int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) const {
CharClassify::cc ccStart = CharClassify::ccWord; CharClassify::cc ccStart = CharClassify::ccWord;
if (delta < 0) { if (delta < 0) {
if (!onlyWordCharacters) if (!onlyWordCharacters) {
ccStart = WordCharClass(cb.CharAt(pos-1)); const CharacterExtracted ce = CharacterBefore(pos);
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) ccStart = WordCharacterClass(ce.character);
pos--; }
while (pos > 0) {
const CharacterExtracted ce = CharacterBefore(pos);
if (WordCharacterClass(ce.character) != ccStart)
break;
pos -= ce.widthBytes;
}
} else { } else {
if (!onlyWordCharacters && pos < Length()) if (!onlyWordCharacters && pos < Length()) {
ccStart = WordCharClass(cb.CharAt(pos)); const CharacterExtracted ce = CharacterAfter(pos);
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) ccStart = WordCharacterClass(ce.character);
pos++; }
while (pos < Length()) {
const CharacterExtracted ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != ccStart)
break;
pos += ce.widthBytes;
}
} }
return MovePositionOutsideChar(pos, delta, true); return MovePositionOutsideChar(pos, delta, true);
} }
@ -1518,22 +1662,39 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
* additional movement to transit white space. * additional movement to transit white space.
* Used by cursor movement by word commands. * Used by cursor movement by word commands.
*/ */
int Document::NextWordStart(int pos, int delta) { int Document::NextWordStart(int pos, int delta) const {
if (delta < 0) { if (delta < 0) {
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace)) while (pos > 0) {
pos--; const CharacterExtracted ce = CharacterBefore(pos);
if (WordCharacterClass(ce.character) != CharClassify::ccSpace)
break;
pos -= ce.widthBytes;
}
if (pos > 0) { if (pos > 0) {
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); CharacterExtracted ce = CharacterBefore(pos);
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) { const CharClassify::cc ccStart = WordCharacterClass(ce.character);
pos--; while (pos > 0) {
ce = CharacterBefore(pos);
if (WordCharacterClass(ce.character) != ccStart)
break;
pos -= ce.widthBytes;
} }
} }
} else { } else {
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); CharacterExtracted ce = CharacterAfter(pos);
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) const CharClassify::cc ccStart = WordCharacterClass(ce.character);
pos++; while (pos < Length()) {
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace)) ce = CharacterAfter(pos);
pos++; if (WordCharacterClass(ce.character) != ccStart)
break;
pos += ce.widthBytes;
}
while (pos < Length()) {
ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != CharClassify::ccSpace)
break;
pos += ce.widthBytes;
}
} }
return pos; return pos;
} }
@ -1545,27 +1706,41 @@ int Document::NextWordStart(int pos, int delta) {
* additional movement to transit white space. * additional movement to transit white space.
* Used by cursor movement by word commands. * Used by cursor movement by word commands.
*/ */
int Document::NextWordEnd(int pos, int delta) { int Document::NextWordEnd(int pos, int delta) const {
if (delta < 0) { if (delta < 0) {
if (pos > 0) { if (pos > 0) {
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); CharacterExtracted ce = CharacterBefore(pos);
CharClassify::cc ccStart = WordCharacterClass(ce.character);
if (ccStart != CharClassify::ccSpace) { if (ccStart != CharClassify::ccSpace) {
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) { while (pos > 0) {
pos--; ce = CharacterBefore(pos);
if (WordCharacterClass(ce.character) != ccStart)
break;
pos -= ce.widthBytes;
} }
} }
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) { while (pos > 0) {
pos--; ce = CharacterBefore(pos);
if (WordCharacterClass(ce.character) != CharClassify::ccSpace)
break;
pos -= ce.widthBytes;
} }
} }
} else { } else {
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) { while (pos < Length()) {
pos++; CharacterExtracted ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != CharClassify::ccSpace)
break;
pos += ce.widthBytes;
} }
if (pos < Length()) { if (pos < Length()) {
CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); CharacterExtracted ce = CharacterAfter(pos);
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) { CharClassify::cc ccStart = WordCharacterClass(ce.character);
pos++; while (pos < Length()) {
ce = CharacterAfter(pos);
if (WordCharacterClass(ce.character) != ccStart)
break;
pos += ce.widthBytes;
} }
} }
} }
@ -1577,10 +1752,15 @@ int Document::NextWordEnd(int pos, int delta) {
* the previous character is of a different character class. * the previous character is of a different character class.
*/ */
bool Document::IsWordStartAt(int pos) const { bool Document::IsWordStartAt(int pos) const {
if (pos >= Length())
return false;
if (pos > 0) { if (pos > 0) {
CharClassify::cc ccPos = WordCharClass(CharAt(pos)); const CharacterExtracted cePos = CharacterAfter(pos);
const CharClassify::cc ccPos = WordCharacterClass(cePos.character);
const CharacterExtracted cePrev = CharacterBefore(pos);
const CharClassify::cc ccPrev = WordCharacterClass(cePrev.character);
return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) && return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) &&
(ccPos != WordCharClass(CharAt(pos - 1))); (ccPos != ccPrev);
} }
return true; return true;
} }
@ -1590,10 +1770,15 @@ bool Document::IsWordStartAt(int pos) const {
* the next character is of a different character class. * the next character is of a different character class.
*/ */
bool Document::IsWordEndAt(int pos) const { bool Document::IsWordEndAt(int pos) const {
if (pos <= 0)
return false;
if (pos < Length()) { if (pos < Length()) {
CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1)); const CharacterExtracted cePos = CharacterAfter(pos);
const CharClassify::cc ccPos = WordCharacterClass(cePos.character);
const CharacterExtracted cePrev = CharacterBefore(pos);
const CharClassify::cc ccPrev = WordCharacterClass(cePrev.character);
return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) && return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) &&
(ccPrev != WordCharClass(CharAt(pos))); (ccPrev != ccPos);
} }
return true; return true;
} }
@ -2075,96 +2260,137 @@ void Document::NotifyModified(DocModification mh) {
} }
} }
bool Document::IsWordPartSeparator(char ch) const { // Used for word part navigation.
return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch); static bool IsASCIIPunctuationCharacter(unsigned int ch) {
switch (ch) {
case '!':
case '"':
case '#':
case '$':
case '%':
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
case '-':
case '.':
case '/':
case ':':
case ';':
case '<':
case '=':
case '>':
case '?':
case '@':
case '[':
case '\\':
case ']':
case '^':
case '_':
case '`':
case '{':
case '|':
case '}':
case '~':
return true;
default:
return false;
}
} }
int Document::WordPartLeft(int pos) { bool Document::IsWordPartSeparator(unsigned int ch) const {
return (WordCharacterClass(ch) == CharClassify::ccWord) && IsASCIIPunctuationCharacter(ch);
}
int Document::WordPartLeft(int pos) const {
if (pos > 0) { if (pos > 0) {
--pos; pos -= CharacterBefore(pos).widthBytes;
char startChar = cb.CharAt(pos); CharacterExtracted ceStart = CharacterAfter(pos);
if (IsWordPartSeparator(startChar)) { if (IsWordPartSeparator(ceStart.character)) {
while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) { while (pos > 0 && IsWordPartSeparator(CharacterAfter(pos).character)) {
--pos; pos -= CharacterBefore(pos).widthBytes;
} }
} }
if (pos > 0) { if (pos > 0) {
startChar = cb.CharAt(pos); ceStart = CharacterAfter(pos);
--pos; pos -= CharacterBefore(pos).widthBytes;
if (IsLowerCase(startChar)) { if (IsLowerCase(ceStart.character)) {
while (pos > 0 && IsLowerCase(cb.CharAt(pos))) while (pos > 0 && IsLowerCase(CharacterAfter(pos).character))
--pos; pos -= CharacterBefore(pos).widthBytes;
if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos))) if (!IsUpperCase(CharacterAfter(pos).character) && !IsLowerCase(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (IsUpperCase(startChar)) { } else if (IsUpperCase(ceStart.character)) {
while (pos > 0 && IsUpperCase(cb.CharAt(pos))) while (pos > 0 && IsUpperCase(CharacterAfter(pos).character))
--pos; pos -= CharacterBefore(pos).widthBytes;
if (!IsUpperCase(cb.CharAt(pos))) if (!IsUpperCase(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (IsADigit(startChar)) { } else if (IsADigit(ceStart.character)) {
while (pos > 0 && IsADigit(cb.CharAt(pos))) while (pos > 0 && IsADigit(CharacterAfter(pos).character))
--pos; pos -= CharacterBefore(pos).widthBytes;
if (!IsADigit(cb.CharAt(pos))) if (!IsADigit(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (IsPunctuation(startChar)) { } else if (IsASCIIPunctuationCharacter(ceStart.character)) {
while (pos > 0 && IsPunctuation(cb.CharAt(pos))) while (pos > 0 && IsASCIIPunctuationCharacter(CharacterAfter(pos).character))
--pos; pos -= CharacterBefore(pos).widthBytes;
if (!IsPunctuation(cb.CharAt(pos))) if (!IsASCIIPunctuationCharacter(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (isspacechar(startChar)) { } else if (isspacechar(ceStart.character)) {
while (pos > 0 && isspacechar(cb.CharAt(pos))) while (pos > 0 && isspacechar(CharacterAfter(pos).character))
--pos; pos -= CharacterBefore(pos).widthBytes;
if (!isspacechar(cb.CharAt(pos))) if (!isspacechar(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (!IsASCII(startChar)) { } else if (!IsASCII(ceStart.character)) {
while (pos > 0 && !IsASCII(cb.CharAt(pos))) while (pos > 0 && !IsASCII(CharacterAfter(pos).character))
--pos; pos -= CharacterBefore(pos).widthBytes;
if (IsASCII(cb.CharAt(pos))) if (IsASCII(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else { } else {
++pos; pos += CharacterAfter(pos).widthBytes;
} }
} }
} }
return pos; return pos;
} }
int Document::WordPartRight(int pos) { int Document::WordPartRight(int pos) const {
char startChar = cb.CharAt(pos); CharacterExtracted ceStart = CharacterAfter(pos);
int length = Length(); const int length = Length();
if (IsWordPartSeparator(startChar)) { if (IsWordPartSeparator(ceStart.character)) {
while (pos < length && IsWordPartSeparator(cb.CharAt(pos))) while (pos < length && IsWordPartSeparator(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
startChar = cb.CharAt(pos); ceStart = CharacterAfter(pos);
} }
if (!IsASCII(startChar)) { if (!IsASCII(ceStart.character)) {
while (pos < length && !IsASCII(cb.CharAt(pos))) while (pos < length && !IsASCII(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (IsLowerCase(startChar)) { } else if (IsLowerCase(ceStart.character)) {
while (pos < length && IsLowerCase(cb.CharAt(pos))) while (pos < length && IsLowerCase(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (IsUpperCase(startChar)) { } else if (IsUpperCase(ceStart.character)) {
if (IsLowerCase(cb.CharAt(pos + 1))) { if (IsLowerCase(CharacterAfter(pos + ceStart.widthBytes).character)) {
++pos; pos += CharacterAfter(pos).widthBytes;
while (pos < length && IsLowerCase(cb.CharAt(pos))) while (pos < length && IsLowerCase(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else { } else {
while (pos < length && IsUpperCase(cb.CharAt(pos))) while (pos < length && IsUpperCase(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} }
if (IsLowerCase(cb.CharAt(pos)) && IsUpperCase(cb.CharAt(pos - 1))) if (IsLowerCase(CharacterAfter(pos).character) && IsUpperCase(CharacterBefore(pos).character))
--pos; pos -= CharacterBefore(pos).widthBytes;
} else if (IsADigit(startChar)) { } else if (IsADigit(ceStart.character)) {
while (pos < length && IsADigit(cb.CharAt(pos))) while (pos < length && IsADigit(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (IsPunctuation(startChar)) { } else if (IsASCIIPunctuationCharacter(ceStart.character)) {
while (pos < length && IsPunctuation(cb.CharAt(pos))) while (pos < length && IsASCIIPunctuationCharacter(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else if (isspacechar(startChar)) { } else if (isspacechar(ceStart.character)) {
while (pos < length && isspacechar(cb.CharAt(pos))) while (pos < length && isspacechar(CharacterAfter(pos).character))
++pos; pos += CharacterAfter(pos).widthBytes;
} else { } else {
++pos; pos += CharacterAfter(pos).widthBytes;
} }
return pos; return pos;
} }

View File

@ -238,6 +238,18 @@ private:
public: public:
struct CharacterExtracted {
unsigned int character;
unsigned int widthBytes;
CharacterExtracted(unsigned int character_, unsigned int widthBytes_) :
character(character_), widthBytes(widthBytes_) {
}
// For DBCS characters turn 2 bytes into an int
static CharacterExtracted DBCS(unsigned char lead, unsigned char trail) {
return CharacterExtracted((lead << 8) | trail, 2);
}
};
LexInterface *pli; LexInterface *pli;
int eolMode; int eolMode;
@ -284,6 +296,8 @@ public:
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const;
int NextPosition(int pos, int moveDir) const; int NextPosition(int pos, int moveDir) const;
bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed
Document::CharacterExtracted CharacterAfter(int position) const;
Document::CharacterExtracted CharacterBefore(int position) const;
Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const; Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const;
int GetRelativePositionUTF16(int positionStart, int characterOffset) const; int GetRelativePositionUTF16(int positionStart, int characterOffset) const;
int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const; int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const;
@ -373,19 +387,12 @@ public:
void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine); void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine);
void Indent(bool forwards); void Indent(bool forwards);
int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false) const;
int NextWordStart(int pos, int delta); int NextWordStart(int pos, int delta) const;
int NextWordEnd(int pos, int delta); int NextWordEnd(int pos, int delta) const;
Sci_Position SCI_METHOD Length() const { return cb.Length(); } Sci_Position SCI_METHOD Length() const { return cb.Length(); }
void Allocate(int newSize) { cb.Allocate(newSize); } void Allocate(int newSize) { cb.Allocate(newSize); }
struct CharacterExtracted {
unsigned int character;
unsigned int widthBytes;
CharacterExtracted(unsigned int character_, unsigned int widthBytes_) :
character(character_), widthBytes(widthBytes_) {
}
};
CharacterExtracted ExtractCharacter(int position) const; CharacterExtracted ExtractCharacter(int position) const;
bool IsWordStartAt(int pos) const; bool IsWordStartAt(int pos) const;
@ -437,10 +444,11 @@ public:
bool AddWatcher(DocWatcher *watcher, void *userData); bool AddWatcher(DocWatcher *watcher, void *userData);
bool RemoveWatcher(DocWatcher *watcher, void *userData); bool RemoveWatcher(DocWatcher *watcher, void *userData);
CharClassify::cc WordCharClass(unsigned char ch) const; bool IsASCIIWordByte(unsigned char ch) const;
bool IsWordPartSeparator(char ch) const; CharClassify::cc WordCharacterClass(unsigned int ch) const;
int WordPartLeft(int pos); bool IsWordPartSeparator(unsigned int ch) const;
int WordPartRight(int pos); int WordPartLeft(int pos) const;
int WordPartRight(int pos) const;
int ExtendStyleRange(int pos, int delta, bool singleLine = false); int ExtendStyleRange(int pos, int delta, bool singleLine = false);
bool IsWhiteLine(int line) const; bool IsWhiteLine(int line) const;
int ParaUp(int pos) const; int ParaUp(int pos) const;

View File

@ -25,6 +25,7 @@
#include "Scintilla.h" #include "Scintilla.h"
#include "StringCopy.h" #include "StringCopy.h"
#include "CharacterSet.h"
#include "Position.h" #include "Position.h"
#include "SplitVector.h" #include "SplitVector.h"
#include "Partitioning.h" #include "Partitioning.h"
@ -389,16 +390,16 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
(ll->chars[numCharsInLine] == chDoc); (ll->chars[numCharsInLine] == chDoc);
else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
allSame = allSame && allSame = allSame &&
(ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc))); (ll->chars[numCharsInLine] == MakeLowerCase(chDoc));
else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper) else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper)
allSame = allSame && allSame = allSame &&
(ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); (ll->chars[numCharsInLine] == MakeUpperCase(chDoc));
else { // Style::caseCamel else { // Style::caseCamel
if ((model.pdoc->WordCharClass(ll->chars[numCharsInLine]) == CharClassify::ccWord) && if ((model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine])) &&
((numCharsInLine == 0) || (model.pdoc->WordCharClass(ll->chars[numCharsInLine - 1]) != CharClassify::ccWord))) { ((numCharsInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine - 1])))) {
allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); allSame = allSame && (ll->chars[numCharsInLine] == MakeUpperCase(chDoc));
} else { } else {
allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc))); allSame = allSame && (ll->chars[numCharsInLine] == MakeLowerCase(chDoc));
} }
} }
numCharsInLine++; numCharsInLine++;
@ -417,7 +418,7 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
ll->widthLine = LineLayout::wrapWidthInfinite; ll->widthLine = LineLayout::wrapWidthInfinite;
ll->lines = 1; ll->lines = 1;
if (vstyle.edgeState == EDGE_BACKGROUND) { if (vstyle.edgeState == EDGE_BACKGROUND) {
ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge); ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge.column);
if (ll->edgeColumn >= posLineStart) { if (ll->edgeColumn >= posLineStart) {
ll->edgeColumn -= posLineStart; ll->edgeColumn -= posLineStart;
} }
@ -440,15 +441,15 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
for (int charInLine = 0; charInLine<lineLength; charInLine++) { for (int charInLine = 0; charInLine<lineLength; charInLine++) {
char chDoc = ll->chars[charInLine]; char chDoc = ll->chars[charInLine];
if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseUpper) if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseUpper)
ll->chars[charInLine] = static_cast<char>(toupper(chDoc)); ll->chars[charInLine] = static_cast<char>(MakeUpperCase(chDoc));
else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower) else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower)
ll->chars[charInLine] = static_cast<char>(tolower(chDoc)); ll->chars[charInLine] = static_cast<char>(MakeLowerCase(chDoc));
else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseCamel) { else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseCamel) {
if ((model.pdoc->WordCharClass(ll->chars[charInLine]) == CharClassify::ccWord) && if ((model.pdoc->IsASCIIWordByte(ll->chars[charInLine])) &&
((charInLine == 0) || (model.pdoc->WordCharClass(ll->chars[charInLine - 1]) != CharClassify::ccWord))) { ((charInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[charInLine - 1])))) {
ll->chars[charInLine] = static_cast<char>(toupper(chDoc)); ll->chars[charInLine] = static_cast<char>(MakeUpperCase(chDoc));
} else { } else {
ll->chars[charInLine] = static_cast<char>(tolower(chDoc)); ll->chars[charInLine] = static_cast<char>(MakeLowerCase(chDoc));
} }
} }
} }
@ -749,7 +750,7 @@ static ColourDesired TextBackground(const EditModel &model, const ViewStyle &vsD
if ((vsDraw.edgeState == EDGE_BACKGROUND) && if ((vsDraw.edgeState == EDGE_BACKGROUND) &&
(i >= ll->edgeColumn) && (i >= ll->edgeColumn) &&
(i < ll->numCharsBeforeEOL)) (i < ll->numCharsBeforeEOL))
return vsDraw.edgecolour; return vsDraw.theEdge.colour;
if (inHotspot && vsDraw.hotspotColours.back.isSet) if (inHotspot && vsDraw.hotspotColours.back.isSet)
return vsDraw.hotspotColours.back; return vsDraw.hotspotColours.back;
} }
@ -1339,12 +1340,24 @@ static void DrawEdgeLine(Surface *surface, const ViewStyle &vsDraw, const LineLa
Range lineRange, int xStart) { Range lineRange, int xStart) {
if (vsDraw.edgeState == EDGE_LINE) { if (vsDraw.edgeState == EDGE_LINE) {
PRectangle rcSegment = rcLine; PRectangle rcSegment = rcLine;
int edgeX = static_cast<int>(vsDraw.theEdge * vsDraw.spaceWidth); int edgeX = static_cast<int>(vsDraw.theEdge.column * vsDraw.spaceWidth);
rcSegment.left = static_cast<XYPOSITION>(edgeX + xStart); rcSegment.left = static_cast<XYPOSITION>(edgeX + xStart);
if ((ll->wrapIndent != 0) && (lineRange.start != 0)) if ((ll->wrapIndent != 0) && (lineRange.start != 0))
rcSegment.left -= ll->wrapIndent; rcSegment.left -= ll->wrapIndent;
rcSegment.right = rcSegment.left + 1; rcSegment.right = rcSegment.left + 1;
surface->FillRectangle(rcSegment, vsDraw.edgecolour); surface->FillRectangle(rcSegment, vsDraw.theEdge.colour);
} else if (vsDraw.edgeState == EDGE_MULTILINE) {
for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) {
if (vsDraw.theMultiEdge[edge].column >= 0) {
PRectangle rcSegment = rcLine;
int edgeX = static_cast<int>(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth);
rcSegment.left = static_cast<XYPOSITION>(edgeX + xStart);
if ((ll->wrapIndent != 0) && (lineRange.start != 0))
rcSegment.left -= ll->wrapIndent;
rcSegment.right = rcSegment.left + 1;
surface->FillRectangle(rcSegment, vsDraw.theMultiEdge[edge].colour);
}
}
} }
} }
@ -1919,10 +1932,19 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan
if (rcBeyondEOF.top < rcBeyondEOF.bottom) { if (rcBeyondEOF.top < rcBeyondEOF.bottom) {
surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.styles[STYLE_DEFAULT].back); surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.styles[STYLE_DEFAULT].back);
if (vsDraw.edgeState == EDGE_LINE) { if (vsDraw.edgeState == EDGE_LINE) {
int edgeX = static_cast<int>(vsDraw.theEdge * vsDraw.spaceWidth); int edgeX = static_cast<int>(vsDraw.theEdge.column * vsDraw.spaceWidth);
rcBeyondEOF.left = static_cast<XYPOSITION>(edgeX + xStart); rcBeyondEOF.left = static_cast<XYPOSITION>(edgeX + xStart);
rcBeyondEOF.right = rcBeyondEOF.left + 1; rcBeyondEOF.right = rcBeyondEOF.left + 1;
surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.edgecolour); surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theEdge.colour);
} else if (vsDraw.edgeState == EDGE_MULTILINE) {
for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) {
if (vsDraw.theMultiEdge[edge].column >= 0) {
int edgeX = static_cast<int>(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth);
rcBeyondEOF.left = static_cast<XYPOSITION>(edgeX + xStart);
rcBeyondEOF.right = rcBeyondEOF.left + 1;
surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theMultiEdge[edge].colour);
}
}
} }
} }
//Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset); //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset);
@ -1961,9 +1983,9 @@ long EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface,
// Modify the view style for printing as do not normally want any of the transient features to be printed // Modify the view style for printing as do not normally want any of the transient features to be printed
// Printing supports only the line number margin. // Printing supports only the line number margin.
int lineNumberIndex = -1; int lineNumberIndex = -1;
for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { for (size_t margin = 0; margin < vs.ms.size(); margin++) {
if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) { if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) {
lineNumberIndex = margin; lineNumberIndex = static_cast<int>(margin);
} else { } else {
vsPrint.ms[margin].width = 0; vsPrint.ms[margin].width = 0;
} }

View File

@ -112,6 +112,7 @@ Editor::Editor() {
hasFocus = false; hasFocus = false;
errorStatus = 0; errorStatus = 0;
mouseDownCaptures = true; mouseDownCaptures = true;
mouseWheelCaptures = true;
lastClickTime = 0; lastClickTime = 0;
doubleClickCloseThreshold = Point(3, 3); doubleClickCloseThreshold = Point(3, 3);
@ -739,8 +740,8 @@ void Editor::MultipleSelectAdd(AddNumber addNumber) {
const int searchEnd = it->end; const int searchEnd = it->end;
for (;;) { for (;;) {
int lengthFound = static_cast<int>(selectedText.length()); int lengthFound = static_cast<int>(selectedText.length());
int pos = pdoc->FindText(searchStart, searchEnd, selectedText.c_str(), int pos = static_cast<int>(pdoc->FindText(searchStart, searchEnd,
searchFlags, &lengthFound); selectedText.c_str(), searchFlags, &lengthFound));
if (pos >= 0) { if (pos >= 0) {
sel.AddSelection(SelectionRange(pos + lengthFound, pos)); sel.AddSelection(SelectionRange(pos + lengthFound, pos));
ScrollRange(sel.RangeMain()); ScrollRange(sel.RangeMain());
@ -2425,9 +2426,9 @@ void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctr
bool Editor::NotifyMarginClick(Point pt, int modifiers) { bool Editor::NotifyMarginClick(Point pt, int modifiers) {
int marginClicked = -1; int marginClicked = -1;
int x = vs.textStart - vs.fixedColumnWidth; int x = vs.textStart - vs.fixedColumnWidth;
for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { for (size_t margin = 0; margin < vs.ms.size(); margin++) {
if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width)) if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width))
marginClicked = margin; marginClicked = static_cast<int>(margin);
x += vs.ms[margin].width; x += vs.ms[margin].width;
} }
if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) {
@ -3319,13 +3320,13 @@ int Editor::HorizontalMove(unsigned int iMessage) {
sel.selType = Selection::selRectangle; sel.selType = Selection::selRectangle;
sel.Rectangular() = SelectionRange(spCaret, rangeBase.anchor); sel.Rectangular() = SelectionRange(spCaret, rangeBase.anchor);
SetRectangularRange(); SetRectangularRange();
} else if (sel.IsRectangular()) {
// Not a rectangular extension so switch to stream.
const SelectionPosition selAtLimit =
(NaturalDirection(iMessage) > 0) ? sel.Limits().end : sel.Limits().start;
sel.selType = Selection::selStream;
sel.SetSelection(SelectionRange(selAtLimit));
} else { } else {
if (sel.IsRectangular()) {
// Not a rectangular extension so switch to stream.
SelectionPosition selAtLimit = (NaturalDirection(iMessage) > 0) ? sel.Limits().end : sel.Limits().start;
sel.selType = Selection::selStream;
sel.SetSelection(SelectionRange(selAtLimit));
}
if (!additionalSelectionTyping) { if (!additionalSelectionTyping) {
InvalidateWholeSelection(); InvalidateWholeSelection();
sel.DropAdditionalRanges(); sel.DropAdditionalRanges();
@ -3421,7 +3422,7 @@ int Editor::HorizontalMove(unsigned int iMessage) {
const int directionMove = (spCaret < spCaretNow) ? -1 : 1; const int directionMove = (spCaret < spCaretNow) ? -1 : 1;
spCaret = MovePositionSoVisible(spCaret, directionMove); spCaret = MovePositionSoVisible(spCaret, directionMove);
// Handle move versus extend, and special behaviour for non-emoty left/right // Handle move versus extend, and special behaviour for non-empty left/right
switch (iMessage) { switch (iMessage) {
case SCI_CHARLEFT: case SCI_CHARLEFT:
case SCI_CHARRIGHT: case SCI_CHARRIGHT:
@ -4288,7 +4289,7 @@ bool Editor::PointInSelMargin(Point pt) const {
Window::Cursor Editor::GetMarginCursor(Point pt) const { Window::Cursor Editor::GetMarginCursor(Point pt) const {
int x = 0; int x = 0;
for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { for (size_t margin = 0; margin < vs.ms.size(); margin++) {
if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width)) if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width))
return static_cast<Window::Cursor>(vs.ms[margin].cursor); return static_cast<Window::Cursor>(vs.ms[margin].cursor);
x += vs.ms[margin].width; x += vs.ms[margin].width;
@ -5568,8 +5569,8 @@ void Editor::AddStyledText(char *buffer, int appendLength) {
SetEmptySelection(sel.MainCaret() + lengthInserted); SetEmptySelection(sel.MainCaret() + lengthInserted);
} }
static bool ValidMargin(uptr_t wParam) { bool Editor::ValidMargin(uptr_t wParam) {
return wParam <= SC_MAX_MARGIN; return wParam < vs.ms.size();
} }
static char *CharPtrFromSPtr(sptr_t lParam) { static char *CharPtrFromSPtr(sptr_t lParam) {
@ -6883,6 +6884,27 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
else else
return 0; return 0;
case SCI_SETMARGINBACKN:
if (ValidMargin(wParam)) {
vs.ms[wParam].back = ColourDesired(static_cast<long>(lParam));
InvalidateStyleRedraw();
}
break;
case SCI_GETMARGINBACKN:
if (ValidMargin(wParam))
return vs.ms[wParam].back.AsLong();
else
return 0;
case SCI_SETMARGINS:
if (wParam < 1000)
vs.ms.resize(wParam);
break;
case SCI_GETMARGINS:
return vs.ms.size();
case SCI_STYLECLEARALL: case SCI_STYLECLEARALL:
vs.ClearStyles(); vs.ClearStyles();
InvalidateStyleRedraw(); InvalidateStyleRedraw();
@ -7433,10 +7455,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return vs.zoomLevel; return vs.zoomLevel;
case SCI_GETEDGECOLUMN: case SCI_GETEDGECOLUMN:
return vs.theEdge; return vs.theEdge.column;
case SCI_SETEDGECOLUMN: case SCI_SETEDGECOLUMN:
vs.theEdge = static_cast<int>(wParam); vs.theEdge.column = static_cast<int>(wParam);
InvalidateStyleRedraw(); InvalidateStyleRedraw();
break; break;
@ -7449,10 +7471,20 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break; break;
case SCI_GETEDGECOLOUR: case SCI_GETEDGECOLOUR:
return vs.edgecolour.AsLong(); return vs.theEdge.colour.AsLong();
case SCI_SETEDGECOLOUR: case SCI_SETEDGECOLOUR:
vs.edgecolour = ColourDesired(static_cast<long>(wParam)); vs.theEdge.colour = ColourDesired(static_cast<long>(wParam));
InvalidateStyleRedraw();
break;
case SCI_MULTIEDGEADDLINE:
vs.theMultiEdge.push_back(EdgeProperties(wParam, lParam));
InvalidateStyleRedraw();
break;
case SCI_MULTIEDGECLEARALL:
std::vector<EdgeProperties>().swap(vs.theMultiEdge); // Free vector and memory, C++03 compatible
InvalidateStyleRedraw(); InvalidateStyleRedraw();
break; break;
@ -7584,6 +7616,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETMOUSEDOWNCAPTURES: case SCI_GETMOUSEDOWNCAPTURES:
return mouseDownCaptures; return mouseDownCaptures;
case SCI_SETMOUSEWHEELCAPTURES:
mouseWheelCaptures = wParam != 0;
break;
case SCI_GETMOUSEWHEELCAPTURES:
return mouseWheelCaptures;
case SCI_SETCURSOR: case SCI_SETCURSOR:
cursorMode = static_cast<int>(wParam); cursorMode = static_cast<int>(wParam);
DisplayCursor(Window::cursorText); DisplayCursor(Window::cursorText);

View File

@ -176,6 +176,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool hasFocus; bool hasFocus;
bool mouseDownCaptures; bool mouseDownCaptures;
bool mouseWheelCaptures;
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret
bool horizontalScrollBarVisible; bool horizontalScrollBarVisible;
@ -570,6 +571,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void AddStyledText(char *buffer, int appendLength); void AddStyledText(char *buffer, int appendLength);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
bool ValidMargin(uptr_t wParam);
void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);

View File

@ -193,7 +193,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect
Point ptOrigin = model.GetVisibleOriginInMain(); Point ptOrigin = model.GetVisibleOriginInMain();
FontAlias fontLineNumber = vs.styles[STYLE_LINENUMBER].font; FontAlias fontLineNumber = vs.styles[STYLE_LINENUMBER].font;
for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { for (size_t margin = 0; margin < vs.ms.size(); margin++) {
if (vs.ms[margin].width > 0) { if (vs.ms[margin].width > 0) {
rcSelMargin.left = rcSelMargin.right; rcSelMargin.left = rcSelMargin.right;
@ -216,6 +216,9 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect
case SC_MARGIN_FORE: case SC_MARGIN_FORE:
colour = vs.styles[STYLE_DEFAULT].fore; colour = vs.styles[STYLE_DEFAULT].fore;
break; break;
case SC_MARGIN_COLOUR:
colour = vs.ms[margin].back;
break;
default: default:
colour = vs.styles[STYLE_LINENUMBER].back; colour = vs.styles[STYLE_LINENUMBER].back;
break; break;

View File

@ -29,15 +29,17 @@ protected:
void GapTo(int position) { void GapTo(int position) {
if (position != part1Length) { if (position != part1Length) {
if (position < part1Length) { if (position < part1Length) {
memmove( // Moving the gap towards start so moving elements towards end
body + position + gapLength, std::copy_backward(
body + position, body + position,
sizeof(T) * (part1Length - position));
} else { // position > part1Length
memmove(
body + part1Length, body + part1Length,
body + gapLength + part1Length);
} else { // position > part1Length
// Moving the gap towards end so moving elements towards start
std::copy(
body + part1Length + gapLength, body + part1Length + gapLength,
sizeof(T) * (position - part1Length)); body + gapLength + position,
body + part1Length);
} }
part1Length = position; part1Length = position;
} }
@ -93,7 +95,7 @@ public:
GapTo(lengthBody); GapTo(lengthBody);
T *newBody = new T[newSize]; T *newBody = new T[newSize];
if ((size != 0) && (body != 0)) { if ((size != 0) && (body != 0)) {
memmove(newBody, body, sizeof(T) * lengthBody); std::copy(body, body + lengthBody, newBody);
delete []body; delete []body;
} }
body = newBody; body = newBody;
@ -205,7 +207,7 @@ public:
} }
RoomFor(insertLength); RoomFor(insertLength);
GapTo(positionToInsert); GapTo(positionToInsert);
memmove(body + part1Length, s + positionFrom, sizeof(T) * insertLength); std::copy(s + positionFrom, s + positionFrom + insertLength, body + part1Length);
lengthBody += insertLength; lengthBody += insertLength;
part1Length += insertLength; part1Length += insertLength;
gapLength -= insertLength; gapLength -= insertLength;
@ -254,11 +256,11 @@ public:
if (range1Length > part1AfterPosition) if (range1Length > part1AfterPosition)
range1Length = part1AfterPosition; range1Length = part1AfterPosition;
} }
memcpy(buffer, body + position, range1Length * sizeof(T)); std::copy(body + position, body + position + range1Length, buffer);
buffer += range1Length; buffer += range1Length;
position = position + range1Length + gapLength; position = position + range1Length + gapLength;
int range2Length = retrieveLength - range1Length; int range2Length = retrieveLength - range1Length;
memcpy(buffer, body + position, range2Length * sizeof(T)); std::copy(body + position, body + position + range2Length, buffer);
} }
T *BufferPointer() { T *BufferPointer() {

View File

@ -139,17 +139,13 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
alwaysShowCaretLineBackground = source.alwaysShowCaretLineBackground; alwaysShowCaretLineBackground = source.alwaysShowCaretLineBackground;
caretLineBackground = source.caretLineBackground; caretLineBackground = source.caretLineBackground;
caretLineAlpha = source.caretLineAlpha; caretLineAlpha = source.caretLineAlpha;
edgecolour = source.edgecolour;
edgeState = source.edgeState;
caretStyle = source.caretStyle; caretStyle = source.caretStyle;
caretWidth = source.caretWidth; caretWidth = source.caretWidth;
someStylesProtected = false; someStylesProtected = false;
someStylesForceCase = false; someStylesForceCase = false;
leftMarginWidth = source.leftMarginWidth; leftMarginWidth = source.leftMarginWidth;
rightMarginWidth = source.rightMarginWidth; rightMarginWidth = source.rightMarginWidth;
for (int margin=0; margin <= SC_MAX_MARGIN; margin++) { ms = source.ms;
ms[margin] = source.ms[margin];
}
maskInLine = source.maskInLine; maskInLine = source.maskInLine;
maskDrawInText = source.maskDrawInText; maskDrawInText = source.maskDrawInText;
fixedColumnWidth = source.fixedColumnWidth; fixedColumnWidth = source.fixedColumnWidth;
@ -171,7 +167,9 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
braceBadLightIndicatorSet = source.braceBadLightIndicatorSet; braceBadLightIndicatorSet = source.braceBadLightIndicatorSet;
braceBadLightIndicator = source.braceBadLightIndicator; braceBadLightIndicator = source.braceBadLightIndicator;
edgeState = source.edgeState;
theEdge = source.theEdge; theEdge = source.theEdge;
theMultiEdge = source.theMultiEdge;
marginNumberPadding = source.marginNumberPadding; marginNumberPadding = source.marginNumberPadding;
ctrlCharPadding = source.ctrlCharPadding; ctrlCharPadding = source.ctrlCharPadding;
@ -196,7 +194,7 @@ void ViewStyle::CalculateMarginWidthAndMask() {
fixedColumnWidth = marginInside ? leftMarginWidth : 0; fixedColumnWidth = marginInside ? leftMarginWidth : 0;
maskInLine = 0xffffffff; maskInLine = 0xffffffff;
int maskDefinedMarkers = 0; int maskDefinedMarkers = 0;
for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { for (size_t margin = 0; margin < ms.size(); margin++) {
fixedColumnWidth += ms[margin].width; fixedColumnWidth += ms[margin].width;
if (ms[margin].width > 0) if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask; maskInLine &= ~ms[margin].mask;
@ -268,8 +266,6 @@ void ViewStyle::Init(size_t stylesSize_) {
alwaysShowCaretLineBackground = false; alwaysShowCaretLineBackground = false;
caretLineBackground = ColourDesired(0xff, 0xff, 0); caretLineBackground = ColourDesired(0xff, 0xff, 0);
caretLineAlpha = SC_ALPHA_NOALPHA; caretLineAlpha = SC_ALPHA_NOALPHA;
edgecolour = ColourDesired(0xc0, 0xc0, 0xc0);
edgeState = EDGE_NONE;
caretStyle = CARETSTYLE_LINE; caretStyle = CARETSTYLE_LINE;
caretWidth = 1; caretWidth = 1;
someStylesProtected = false; someStylesProtected = false;
@ -282,6 +278,7 @@ void ViewStyle::Init(size_t stylesSize_) {
leftMarginWidth = 1; leftMarginWidth = 1;
rightMarginWidth = 1; rightMarginWidth = 1;
ms.resize(SC_MAX_MARGIN + 1);
ms[0].style = SC_MARGIN_NUMBER; ms[0].style = SC_MARGIN_NUMBER;
ms[0].width = 0; ms[0].width = 0;
ms[0].mask = 0; ms[0].mask = 0;
@ -310,7 +307,8 @@ void ViewStyle::Init(size_t stylesSize_) {
braceBadLightIndicatorSet = false; braceBadLightIndicatorSet = false;
braceBadLightIndicator = 0; braceBadLightIndicator = 0;
theEdge = 0; edgeState = EDGE_NONE;
theEdge = EdgeProperties(0, ColourDesired(0xc0, 0xc0, 0xc0));
marginNumberPadding = 3; marginNumberPadding = 3;
ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side

View File

@ -17,6 +17,7 @@ namespace Scintilla {
class MarginStyle { class MarginStyle {
public: public:
int style; int style;
ColourDesired back;
int width; int width;
int mask; int mask;
bool sensitive; bool sensitive;
@ -72,6 +73,17 @@ struct ForeBackColours {
ColourOptional back; ColourOptional back;
}; };
struct EdgeProperties {
int column;
ColourDesired colour;
EdgeProperties(int column_ = 0, ColourDesired colour_ = ColourDesired(0)) :
column(column_), colour(colour_) {
}
EdgeProperties(uptr_t wParam, sptr_t lParam) :
column(static_cast<int>(wParam)), colour(static_cast<long>(lParam)) {
}
};
/** /**
*/ */
class ViewStyle { class ViewStyle {
@ -115,7 +127,7 @@ public:
int rightMarginWidth; ///< Spacing margin on right of text int rightMarginWidth; ///< Spacing margin on right of text
int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
int maskDrawInText; ///< Mask for markers that always draw in text int maskDrawInText; ///< Mask for markers that always draw in text
MarginStyle ms[SC_MAX_MARGIN+1]; std::vector<MarginStyle> ms;
int fixedColumnWidth; ///< Total width of margins int fixedColumnWidth; ///< Total width of margins
bool marginInside; ///< true: margin included in text view, false: separate views bool marginInside; ///< true: margin included in text view, false: separate views
int textStart; ///< Starting x position of text within the view int textStart; ///< Starting x position of text within the view
@ -130,8 +142,6 @@ public:
bool alwaysShowCaretLineBackground; bool alwaysShowCaretLineBackground;
ColourDesired caretLineBackground; ColourDesired caretLineBackground;
int caretLineAlpha; int caretLineAlpha;
ColourDesired edgecolour;
int edgeState;
int caretStyle; int caretStyle;
int caretWidth; int caretWidth;
bool someStylesProtected; bool someStylesProtected;
@ -146,7 +156,9 @@ public:
int braceHighlightIndicator; int braceHighlightIndicator;
bool braceBadLightIndicatorSet; bool braceBadLightIndicatorSet;
int braceBadLightIndicator; int braceBadLightIndicator;
int theEdge; int edgeState;
EdgeProperties theEdge;
std::vector<EdgeProperties> theMultiEdge;
int marginNumberPadding; // the right-side padding of the number margin int marginNumberPadding; // the right-side padding of the number margin
int ctrlCharPadding; // the padding around control character text blobs int ctrlCharPadding; // the padding around control character text blobs
int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs

View File

@ -1 +1 @@
367 370