Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 16 Oct 2016 20:37:40 UTC Commit: f5c4b1b6e52f556d1abbd17d2c707b1e6223d70d https://github.com/geany/geany/commit/f5c4b1b6e52f556d1abbd17d2c707b1e6223d7...
Log Message: ----------- Update Scintilla to version 3.7.0
Modified Paths: -------------- scintilla/include/SciLexer.h scintilla/include/Scintilla.h scintilla/include/Scintilla.iface scintilla/lexers/LexCoffeeScript.cxx scintilla/lexers/LexPowerShell.cxx scintilla/lexers/LexYAML.cxx scintilla/lexlib/CharacterSet.cxx scintilla/lexlib/CharacterSet.h scintilla/lexlib/StyleContext.cxx scintilla/lexlib/StyleContext.h scintilla/lexlib/WordList.cxx scintilla/lexlib/WordList.h scintilla/src/Document.cxx scintilla/src/Document.h scintilla/src/EditView.cxx scintilla/src/Editor.cxx scintilla/src/Editor.h scintilla/src/MarginView.cxx scintilla/src/SplitVector.h scintilla/src/ViewStyle.cxx scintilla/src/ViewStyle.h scintilla/version.txt
Modified: scintilla/include/SciLexer.h 59 lines changed, 27 insertions(+), 32 deletions(-) =================================================================== @@ -599,6 +599,20 @@ #define SCE_BAAN_IDENTIFIER 8 #define SCE_BAAN_STRINGEOL 9 #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_COMMENT 1 #define SCE_LISP_NUMBER 2 @@ -1277,38 +1291,19 @@ #define SCE_PLM_OPERATOR 5 #define SCE_PLM_CONTROL 6 #define SCE_PLM_KEYWORD 7 -#define SCE_4GL_DEFAULT 0 -#define SCE_4GL_NUMBER 1 -#define SCE_4GL_WORD 2 -#define SCE_4GL_STRING 3 -#define SCE_4GL_CHARACTER 4 -#define SCE_4GL_PREPROCESSOR 5 -#define SCE_4GL_OPERATOR 6 -#define SCE_4GL_IDENTIFIER 7 -#define SCE_4GL_BLOCK 8 -#define SCE_4GL_END 9 -#define SCE_4GL_COMMENT1 10 -#define SCE_4GL_COMMENT2 11 -#define SCE_4GL_COMMENT3 12 -#define SCE_4GL_COMMENT4 13 -#define SCE_4GL_COMMENT5 14 -#define SCE_4GL_COMMENT6 15 -#define SCE_4GL_DEFAULT_ 16 -#define SCE_4GL_NUMBER_ 17 -#define SCE_4GL_WORD_ 18 -#define SCE_4GL_STRING_ 19 -#define SCE_4GL_CHARACTER_ 20 -#define SCE_4GL_PREPROCESSOR_ 21 -#define SCE_4GL_OPERATOR_ 22 -#define SCE_4GL_IDENTIFIER_ 23 -#define SCE_4GL_BLOCK_ 24 -#define SCE_4GL_END_ 25 -#define SCE_4GL_COMMENT1_ 26 -#define SCE_4GL_COMMENT2_ 27 -#define SCE_4GL_COMMENT3_ 28 -#define SCE_4GL_COMMENT4_ 29 -#define SCE_4GL_COMMENT5_ 30 -#define SCE_4GL_COMMENT6_ 31 +#define SCE_ABL_DEFAULT 0 +#define SCE_ABL_NUMBER 1 +#define SCE_ABL_WORD 2 +#define SCE_ABL_STRING 3 +#define SCE_ABL_CHARACTER 4 +#define SCE_ABL_PREPROCESSOR 5 +#define SCE_ABL_OPERATOR 6 +#define SCE_ABL_IDENTIFIER 7 +#define SCE_ABL_BLOCK 8 +#define SCE_ABL_END 9 +#define SCE_ABL_COMMENT 10 +#define SCE_ABL_TASKMARKER 11 +#define SCE_ABL_LINECOMMENT 12 #define SCE_ABAQUS_DEFAULT 0 #define SCE_ABAQUS_COMMENT 1 #define SCE_ABAQUS_COMMENTBLOCK 2
Modified: scintilla/include/Scintilla.h 10 lines changed, 10 insertions(+), 0 deletions(-) =================================================================== @@ -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_TEXT 4 #define SC_MARGIN_RTEXT 5 +#define SC_MARGIN_COLOUR 6 #define SCI_SETMARGINTYPEN 2240 #define SCI_GETMARGINTYPEN 2241 #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_SETMARGINCURSORN 2248 #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_LINENUMBER 33 #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_LINE 1 #define EDGE_BACKGROUND 2 +#define EDGE_MULTILINE 3 #define SCI_GETEDGECOLUMN 2360 #define SCI_SETEDGECOLUMN 2361 #define SCI_GETEDGEMODE 2362 #define SCI_SETEDGEMODE 2363 #define SCI_GETEDGECOLOUR 2364 #define SCI_SETEDGECOLOUR 2365 +#define SCI_MULTIEDGEADDLINE 2694 +#define SCI_MULTIEDGECLEARALL 2695 #define SCI_SEARCHANCHOR 2366 #define SCI_SEARCHNEXT 2367 #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_SETMOUSEDOWNCAPTURES 2384 #define SCI_GETMOUSEDOWNCAPTURES 2385 +#define SCI_SETMOUSEWHEELCAPTURES 2696 +#define SCI_GETMOUSEWHEELCAPTURES 2697 #define SC_CURSORNORMAL -1 #define SC_CURSORARROW 2 #define SC_CURSORWAIT 4
Modified: scintilla/include/Scintilla.iface 332 lines changed, 193 insertions(+), 139 deletions(-) =================================================================== @@ -105,7 +105,7 @@ fun void ChangeInsertion=2672(int length, string text) fun void ClearAll=2004(,)
# 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. fun void ClearDocumentStyle=2005(,) @@ -147,10 +147,10 @@ fun int GetStyledText=2015(, textrange tr) fun bool CanRedo=2016(,)
# 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. -fun void MarkerDeleteHandle=2018(int handle,) +fun void MarkerDeleteHandle=2018(int markerHandle,)
# Is undo history being collected? get bool GetUndoCollection=2019(,) @@ -179,11 +179,11 @@ fun position PositionFromPointClose=2023(int x, int y) fun void GotoLine=2024(int line,)
# 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 # 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. # 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 void SetEOLMode=2031(int eolMode,)
-# Set the current styling position to pos and the styling mask to mask. -# The styling mask can be used to protect some bits in each styling byte from modification. -fun void StartStyling=2032(position pos, int mask) +# Set the current styling position to start. +# The unused parameter is no longer used and should be set to 0. +fun void StartStyling=2032(position start, int unused)
# Change style from current styling position for length characters to a style # 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)
# 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 void MarkerSetAlpha=2476(int markerNumber, int alpha) @@ -360,6 +360,7 @@ val SC_MARGIN_BACK=2 val SC_MARGIN_FORE=3 val SC_MARGIN_TEXT=4 val SC_MARGIN_RTEXT=5 +val SC_MARGIN_COLOUR=6
# Set a margin to be either numeric or symbolic. 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. 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. # Style 39 is for future use. enu StylesCommon=STYLE_ @@ -452,7 +465,7 @@ set void StyleSetSize=2055(int style, int sizePoints) set void StyleSetFont=2056(int style, string fontName)
# 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 fun void StyleResetDefault=2058(,) @@ -509,12 +522,12 @@ get bool StyleGetChangeable=2492(int style,) get bool StyleGetHotSpot=2493(int style,)
# Set a style to be mixed case, or to force upper or lower case. -set void StyleSetCase=2060(int style, int caseForce) +set void StyleSetCase=2060(int style, int caseVisible)
val SC_FONT_SIZE_MULTIPLIER=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 int StyleGetSizeFractional=2062(int style,) @@ -557,11 +570,11 @@ set void SetSelEOLFilled=2480(bool filled,) # Set the foreground colour of the caret. set void SetCaretFore=2069(colour fore,)
-# When key+modifier combination km is pressed perform msg. -fun void AssignCmdKey=2070(keymod km, int msg) +# When key+modifier combination keyDefinition is pressed perform sciCommand. +fun void AssignCmdKey=2070(keymod keyDefinition, int sciCommand)
-# When key+modifier combination km is pressed do nothing. -fun void ClearCmdKey=2071(keymod km,) +# When key+modifier combination keyDefinition is pressed do nothing. +fun void ClearCmdKey=2071(keymod keyDefinition,)
# Drop all key mappings. fun void ClearAllCmdKeys=2072(,) @@ -623,34 +636,34 @@ val INDIC2_MASK=0x80 val INDICS_MASK=0xE0
# 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. -get int IndicGetStyle=2081(int indic,) +get int IndicGetStyle=2081(int 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. -get colour IndicGetFore=2083(int indic,) +get colour IndicGetFore=2083(int indicator,)
# 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. -get bool IndicGetUnder=2511(int indic,) +get bool IndicGetUnder=2511(int indicator,)
# 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. -get int IndicGetHoverStyle=2681(int indic,) +get int IndicGetHoverStyle=2681(int 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. -get colour IndicGetHoverFore=2683(int indic,) +get colour IndicGetHoverFore=2683(int indicator,)
val SC_INDICVALUEBIT=0x1000000 val SC_INDICVALUEMASK=0xFFFFFF @@ -659,10 +672,10 @@ enu IndicFlag=SC_INDICFLAG_ val SC_INDICFLAG_VALUEFORE=1
# 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. -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. 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)
# 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. -fun void AutoCShow=2100(int lenEntered, string itemList) +fun void AutoCShow=2100(int lengthEntered, string itemList)
# Remove the auto-completion list from the screen. fun void AutoCCancel=2101(,) @@ -737,7 +750,7 @@ set void AutoCSetSeparator=2106(int separatorCharacter,) get int AutoCGetSeparator=2107(,)
# 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 # position before where the box was created. @@ -820,7 +833,7 @@ set void SetUseTabs=2124(bool useTabs,) get bool GetUseTabs=2125(,)
# 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. get int GetLineIndentation=2127(int line,) @@ -832,10 +845,10 @@ get position GetLineIndentPosition=2128(int line,) get int GetColumn=2129(position pos,)
# 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. -set void SetHScrollBar=2130(bool show,) +set void SetHScrollBar=2130(bool visible,) # Is the horizontal scroll bar visible? get bool GetHScrollBar=2131(,)
@@ -871,22 +884,22 @@ get colour GetCaretFore=2138(,) get bool GetReadOnly=2140(,)
# 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. -set void SetSelectionStart=2142(position pos,) +set void SetSelectionStart=2142(position anchor,)
# Returns the position at the start of the selection. get position GetSelectionStart=2143(,)
-# Sets the position that ends the selection - this becomes the currentPosition. -set void SetSelectionEnd=2144(position pos,) +# Sets the position that ends the selection - this becomes the caret. +set void SetSelectionEnd=2144(position caret,)
# Returns the position at the end of the selection. get position GetSelectionEnd=2145(,)
# 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. set void SetPrintMagnification=2146(int magnification,) @@ -921,7 +934,7 @@ val SCFIND_POSIX=0x00400000 val SCFIND_CXX11REGEX=0x00800000
# 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. fun position FormatRange=2151(bool draw, formatrange fr) @@ -952,7 +965,7 @@ get int GetMarginRight=2158(,) get bool GetModify=2159(,)
# 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. # Return the length of the text. @@ -964,7 +977,7 @@ fun int GetSelText=2161(, stringresult text) fun int GetTextRange=2162(, textrange tr)
# 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. fun int PointXFromPosition=2164(, position pos) @@ -1041,7 +1054,7 @@ get int GetDirectFunction=2184(,) get int GetDirectPointer=2185(,)
# 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. 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 # 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 position GetTargetStart=2191(,)
# Sets the position that ends the target which is used for updating the # document without affecting the scroll position. -set void SetTargetEnd=2192(position pos,) +set void SetTargetEnd=2192(position end,)
# Get the position that ends the target. get position GetTargetEnd=2193(,) @@ -1070,7 +1083,7 @@ get position GetTargetEnd=2193(,) fun void SetTargetRange=2686(position start, position end)
# 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. fun void TargetFromSelection=2287(,) @@ -1097,7 +1110,7 @@ fun int ReplaceTargetRE=2195(int length, string text) fun int SearchInTarget=2197(int length, string text)
# 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 int GetSearchFlags=2199(,) @@ -1118,7 +1131,7 @@ fun position CallTipPosStart=2203(,) set void CallTipSetPosStart=2214(int posStart,)
# 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 void CallTipSetBack=2205(colour back,) @@ -1136,13 +1149,13 @@ set void CallTipUseStyle=2212(int tabSize,) set void CallTipSetPosition=2213(bool above,)
# 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. -fun int DocLineFromVisible=2221(int lineDisplay,) +fun int DocLineFromVisible=2221(int displayLine,)
# 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 val SC_FOLDLEVELBASE=0x400 @@ -1185,7 +1198,7 @@ get bool GetFoldExpanded=2230(int line,) # Switch a header line between expanded and contracted. fun void ToggleFold=2231(int line,)
-enu FoldAction=SC_FOLDACTION +enu FoldAction=SC_FOLDACTION_ val SC_FOLDACTION_CONTRACT=0 val SC_FOLDACTION_EXPAND=1 val SC_FOLDACTION_TOGGLE=2 @@ -1279,7 +1292,7 @@ val SC_WRAP_CHAR=2 val SC_WRAP_WHITESPACE=3
# Sets whether text is word wrapped. -set void SetWrapMode=2268(int mode,) +set void SetWrapMode=2268(int wrapMode,)
# Retrieve whether text is word wrapped. get int GetWrapMode=2269(,) @@ -1319,7 +1332,7 @@ val SC_WRAPINDENT_SAME=1 val SC_WRAPINDENT_INDENT=2
# 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. get int GetWrapIndentMode=2473(,) @@ -1331,7 +1344,7 @@ val SC_CACHE_PAGE=2 val SC_CACHE_DOCUMENT=3
# 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. get int GetLayoutCache=2273(,) @@ -1366,7 +1379,7 @@ get bool GetEndAtLastLine=2278(,) fun int TextHeight=2279(int line,)
# 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? 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. set void SetTwoPhaseDraw=2284(bool twoPhase,)
-enu FontQuality=SC_PHASES_ +enu PhasesDraw=SC_PHASES_ val SC_PHASES_ONE=0 val SC_PHASES_TWO=1 val SC_PHASES_MULTIPLE=2 @@ -1411,7 +1424,7 @@ set void SetFontQuality=2611(int fontQuality,) get int GetFontQuality=2612(,)
# 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_ val SC_MULTIPASTE_ONCE=0 @@ -1434,8 +1447,9 @@ fun void LinesJoin=2288(,) # where possible. 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) +# Set the other colour used as a chequerboard pattern in the fold margin fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore)
## New messages go here @@ -1599,17 +1613,28 @@ fun void LineEndDisplay=2347(,) # caret position. fun void LineEndDisplayExtend=2348(,)
-# These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? -# except they behave differently when word-wrap is enabled: -# 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)?. - +# Like Home but when word-wrap is enabled goes first to start of display line +# HomeDisplay, then to start of document line Home. 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(,) + +# 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(,) + +# 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(,) + +# Like VCHome but when word-wrap is enabled goes first to start of display line +# VCHomeDisplay, then behaves like VCHome. 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(,)
# Copy the line containing the caret. @@ -1622,19 +1647,20 @@ fun void MoveCaretInsideView=2401(,) fun int LineLength=2350(int line,)
# Highlight the characters at two positions. -fun void BraceHighlight=2351(position pos1, position pos2) +fun void BraceHighlight=2351(position posA, position posB)
# 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. fun void BraceBadLight=2352(position pos,)
# 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. -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? get bool GetViewEOL=2355(,) @@ -1646,15 +1672,16 @@ set void SetViewEOL=2356(bool visible,) get int GetDocPointer=2357(,)
# Change the document object used. -set void SetDocPointer=2358(, int pointer) +set void SetDocPointer=2358(, int doc)
# 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_ val EDGE_NONE=0 val EDGE_LINE=1 val EDGE_BACKGROUND=2 +val EDGE_MULTILINE=3
# Retrieve the column number which text should be kept within. get int GetEdgeColumn=2360(,) @@ -1666,26 +1693,32 @@ set void SetEdgeColumn=2361(int column,) # Retrieve the edge highlight mode. 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). -set void SetEdgeMode=2363(int mode,) +set void SetEdgeMode=2363(int edgeMode,)
# Retrieve the colour used in edge indication. get colour GetEdgeColour=2364(,)
# Change the colour used in edge indication. 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. fun void SearchAnchor=2366(,)
# Find some text starting at the search anchor. # Does not ensure the selection is visible. -fun int SearchNext=2367(int flags, string text) +fun int SearchNext=2367(int searchFlags, string text)
# Find some text starting at the search anchor and moving backwards. # Does not ensure the selection is visible. -fun int SearchPrev=2368(int flags, string text) +fun int SearchPrev=2368(int searchFlags, string text)
# Retrieves the number of lines completely visible. 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. # 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. get int GetZoom=2374(,)
@@ -1727,7 +1760,7 @@ val SC_STATUS_WARN_START=1000 val SC_STATUS_WARN_REGEX=1001
# Change error status - 0 = OK. -set void SetStatus=2382(int statusCode,) +set void SetStatus=2382(int status,) # Get error status. get int GetStatus=2383(,)
@@ -1736,6 +1769,11 @@ set void SetMouseDownCaptures=2384(bool captures,) # Get whether mouse gets captured. 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 val SC_CURSORNORMAL=-1 val SC_CURSORARROW=2 @@ -1777,7 +1815,7 @@ fun void DelLineLeft=2395(,) fun void DelLineRight=2396(,)
# 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(,)
# 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)
# 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? get int GetPrintWrapMode=2407(,) @@ -1848,10 +1886,13 @@ set void SetHotspotSingleLine=2421(bool singleLine,) # Get the HotspotSingleLine property 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(,) +# Extend selection down one paragraph (delimited by empty lines). fun void ParaDownExtend=2414(,) +# Move caret up one paragraph (delimited by empty lines). fun void ParaUp=2415(,) +# Extend selection up one paragraph (delimited by empty lines). fun void ParaUpExtend=2416(,)
# 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 # 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 int GetSelectionMode=2423(,) @@ -1970,7 +2011,7 @@ get int AutoCGetCurrent=2445(,) # Get currently selected item text in the auto-completion list # Returns the length of the item text # Result is NUL-terminated. -get int AutoCGetCurrentText=2610(, stringresult s) +get int AutoCGetCurrentText=2610(, stringresult text)
enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_ val SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0 @@ -2080,22 +2121,22 @@ set void SetIndicatorValue=2502(int value,) get int GetIndicatorValue=2503(,)
# 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. -fun void IndicatorClearRange=2505(int position, int clearLength) +fun void IndicatorClearRange=2505(position start, int lengthClear)
-# Are any indicators present at position? -fun int IndicatorAllOnFor=2506(int position,) +# Are any indicators present at pos? +fun int IndicatorAllOnFor=2506(position pos,)
-# What value does a particular indicator have at at a position? -fun int IndicatorValueAt=2507(int indicator, int position) +# What value does a particular indicator have at a position? +fun int IndicatorValueAt=2507(int indicator, position pos)
# 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? -fun int IndicatorEnd=2509(int indicator, int position) +fun int IndicatorEnd=2509(int indicator, position pos)
# Set number of entries in position cache 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. # May move the gap so that the range is contiguous, but will only move up -# to rangeLength bytes. -get int GetRangePointer=2643(int position, int rangeLength) +# to lengthRange bytes. +get int GetRangePointer=2643(position start, int lengthRange)
# Return a position which, to avoid performance costs, should not be within # the range of a call to GetRangePointer. @@ -2268,7 +2309,7 @@ set void SetAdditionalCaretsBlink=2567(bool additionalCaretsBlink,) get bool GetAdditionalCaretsBlink=2568(,)
# Set whether additional carets are visible -set void SetAdditionalCaretsVisible=2608(bool additionalCaretsBlink,) +set void SetAdditionalCaretsVisible=2608(bool additionalCaretsVisible,)
# Whether additional carets are visible get bool GetAdditionalCaretsVisible=2609(,) @@ -2283,10 +2324,10 @@ get bool GetSelectionEmpty=2650(,) fun void ClearSelections=2571(,)
# Set a simple selection -fun int SetSelection=2572(int caret, int anchor) +fun int SetSelection=2572(position caret, position anchor)
# Add a selection -fun int AddSelection=2573(int caret, int anchor) +fun int AddSelection=2573(position caret, position anchor)
# Drop one selection fun void DropSelectionN=2671(int selection,) @@ -2297,34 +2338,50 @@ set void SetMainSelection=2574(int selection,) # Which selection is the main selection 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,) -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,) +# Set the virtual space of the caret of the nth selection. 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,) +# Set the virtual space of the anchor of the nth selection. 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,)
# 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. get position GetSelectionNStart=2585(int selection,)
# 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. 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(,) -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(,) +# Set the virtual space of the caret of the rectangular selection. set void SetRectangularSelectionCaretVirtualSpace=2592(int space,) +# Return the virtual space of the caret of the rectangular selection. get int GetRectangularSelectionCaretVirtualSpace=2593(,) +# Set the virtual space of the anchor of the rectangular selection. set void SetRectangularSelectionAnchorVirtualSpace=2594(int space,) +# Return the virtual space of the anchor of the rectangular selection. get int GetRectangularSelectionAnchorVirtualSpace=2595(,)
enu VirtualSpace=SCVS_ @@ -2333,7 +2390,9 @@ val SCVS_RECTANGULARSELECTION=1 val SCVS_USERACCESSIBLE=2 val SCVS_NOWRAPLINESTART=4
+# Set options for virtual space behaviour. set void SetVirtualSpaceOptions=2596(int virtualSpaceOptions,) +# Return options for virtual space behaviour. get int GetVirtualSpaceOptions=2597(,)
# 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
# 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 void SetLexerLanguage=4006(, string language) @@ -2520,24 +2579,24 @@ fun void LoadLexerLibrary=4007(, string path)
# Retrieve a "property" value previously set with SetProperty. # 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, # with "$()" variable replacement on returned buffer. # 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, # 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. get int GetStyleBitsNeeded=4011(,)
# Retrieve the name of the lexer. # Return the length of the text. # 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. 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_STRINGEOL=9 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 lex Lisp=SCLEX_LISP SCE_LISP_ val SCE_LISP_DEFAULT=0 @@ -4107,39 +4180,20 @@ val SCE_PLM_OPERATOR=5 val SCE_PLM_CONTROL=6 val SCE_PLM_KEYWORD=7 # Lexical state for SCLEX_PROGRESS -lex Progress=SCLEX_PROGRESS SCE_4GL_ -val SCE_4GL_DEFAULT=0 -val SCE_4GL_NUMBER=1 -val SCE_4GL_WORD=2 -val SCE_4GL_STRING=3 -val SCE_4GL_CHARACTER=4 -val SCE_4GL_PREPROCESSOR=5 -val SCE_4GL_OPERATOR=6 -val SCE_4GL_IDENTIFIER=7 -val SCE_4GL_BLOCK=8 -val SCE_4GL_END=9 -val SCE_4GL_COMMENT1=10 -val SCE_4GL_COMMENT2=11 -val SCE_4GL_COMMENT3=12 -val SCE_4GL_COMMENT4=13 -val SCE_4GL_COMMENT5=14 -val SCE_4GL_COMMENT6=15 -val SCE_4GL_DEFAULT_=16 -val SCE_4GL_NUMBER_=17 -val SCE_4GL_WORD_=18 -val SCE_4GL_STRING_=19 -val SCE_4GL_CHARACTER_=20 -val SCE_4GL_PREPROCESSOR_=21 -val SCE_4GL_OPERATOR_=22 -val SCE_4GL_IDENTIFIER_=23 -val SCE_4GL_BLOCK_=24 -val SCE_4GL_END_=25 -val SCE_4GL_COMMENT1_=26 -val SCE_4GL_COMMENT2_=27 -val SCE_4GL_COMMENT3_=28 -val SCE_4GL_COMMENT4_=29 -val SCE_4GL_COMMENT5_=30 -val SCE_4GL_COMMENT6_=31 +lex Progress=SCLEX_PROGRESS SCE_ABL_ +val SCE_ABL_DEFAULT=0 +val SCE_ABL_NUMBER=1 +val SCE_ABL_WORD=2 +val SCE_ABL_STRING=3 +val SCE_ABL_CHARACTER=4 +val SCE_ABL_PREPROCESSOR=5 +val SCE_ABL_OPERATOR=6 +val SCE_ABL_IDENTIFIER=7 +val SCE_ABL_BLOCK=8 +val SCE_ABL_END=9 +val SCE_ABL_COMMENT=10 +val SCE_ABL_TASKMARKER=11 +val SCE_ABL_LINECOMMENT=12 # Lexical states for SCLEX_ABAQUS lex ABAQUS=SCLEX_ABAQUS SCE_ABAQUS_ val SCE_ABAQUS_DEFAULT=0
Modified: scintilla/lexers/LexCoffeeScript.cxx 72 lines changed, 71 insertions(+), 1 deletions(-) =================================================================== @@ -40,6 +40,36 @@ static bool IsSpaceEquiv(int state) { || 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 '-'. // The test for pos reaching 0 should be redundant, // and is in only for safety measures. @@ -88,6 +118,27 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length int chPrevNonWhite = ' '; 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 Sci_Position endPos = startPos + length; 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);
- for (; sc.More(); sc.Forward()) { + for (; sc.More();) {
if (sc.atLineStart) { // 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 == '"') { 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; case SCE_COFFEESCRIPT_CHARACTER: @@ -255,6 +315,15 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length // Handle '..' and '...' operators correctly. if (sc.ch == '.') { 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; visibleChars++; } + sc.Forward(); } sc.Complete(); }
Modified: scintilla/lexers/LexPowerShell.cxx 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -149,6 +149,8 @@ static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length, sc.SetState(SCE_POWERSHELL_OPERATOR); } else if (IsAWordChar(sc.ch)) { sc.SetState(SCE_POWERSHELL_IDENTIFIER); + } else if (sc.ch == '`') { + sc.Forward(); // skip next escaped character } } }
Modified: scintilla/lexers/LexYAML.cxx 24 lines changed, 19 insertions(+), 5 deletions(-) =================================================================== @@ -46,7 +46,7 @@ static unsigned int SpaceCount(char* lineBuffer) { while (*headBuffer == ' ') headBuffer++;
- return headBuffer - lineBuffer; + return static_cast<unsigned int>(headBuffer - lineBuffer); }
#define YAML_STATE_BITSIZE 16 @@ -148,16 +148,30 @@ static void ColouriseYAMLLine( styler.ColourTo(endPos, SCE_YAML_KEYWORD); return; } 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; - while ((i < lengthLine) && lineBuffer[i]) { - if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') { - styler.ColourTo(endPos, SCE_YAML_DEFAULT); + while ((i < startComment) && lineBuffer[i]) { + if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' + && lineBuffer[i] != '.' && lineBuffer[i] != ',' && lineBuffer[i] != ' ') { + styler.ColourTo(startLine + startComment - 1, SCE_YAML_DEFAULT); + if (startComment < lengthLine) + styler.ColourTo(endPos, SCE_YAML_COMMENT); return; } i++; } 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; } }
Modified: scintilla/lexlib/CharacterSet.cxx 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -25,8 +25,8 @@ namespace Scintilla { int CompareCaseInsensitive(const char *a, const char *b) { while (*a && *b) { if (*a != *b) { - char upperA = MakeUpperCase(*a); - char upperB = MakeUpperCase(*b); + char upperA = static_cast<char>(MakeUpperCase(*a)); + char upperB = static_cast<char>(MakeUpperCase(*b)); if (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) { while (*a && *b && len) { if (*a != *b) { - char upperA = MakeUpperCase(*a); - char upperB = MakeUpperCase(*b); + char upperA = static_cast<char>(MakeUpperCase(*a)); + char upperB = static_cast<char>(MakeUpperCase(*b)); if (upperA != upperB) return upperA - upperB; }
Modified: scintilla/lexlib/CharacterSet.h 9 lines changed, 8 insertions(+), 1 deletions(-) =================================================================== @@ -160,13 +160,20 @@ inline bool isoperator(int ch) {
// Simple case functions for ASCII.
-inline char MakeUpperCase(char ch) { +inline int MakeUpperCase(int ch) { if (ch < 'a' || ch > 'z') return ch; else 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 CompareNCaseInsensitive(const char *a, const char *b, size_t len);
Modified: scintilla/lexlib/StyleContext.cxx 17 lines changed, 17 insertions(+), 0 deletions(-) =================================================================== @@ -16,11 +16,28 @@ #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" +#include "CharacterSet.h"
#ifdef SCI_NAMESPACE using namespace Scintilla; #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, Sci_PositionU end, LexAccessor &styler,
Modified: scintilla/lexlib/StyleContext.h 23 lines changed, 1 insertions(+), 22 deletions(-) =================================================================== @@ -12,13 +12,6 @@ namespace Scintilla { #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 // 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 @@ -204,22 +197,8 @@ class StyleContext { } 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 + bool MatchIgnoreCase(const char *s); void GetCurrent(char *s, Sci_PositionU len); void GetCurrentLowered(char *s, Sci_PositionU len); };
Modified: scintilla/lexlib/WordList.cxx 60 lines changed, 60 insertions(+), 0 deletions(-) =================================================================== @@ -236,6 +236,66 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const { 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 { return words[n]; }
Modified: scintilla/lexlib/WordList.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -31,6 +31,7 @@ class WordList { void Set(const char *s); bool InList(const char *s) 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; };
Modified: scintilla/src/Document.cxx 462 lines changed, 344 insertions(+), 118 deletions(-) =================================================================== @@ -26,6 +26,7 @@ #include "Scintilla.h"
#include "CharacterSet.h" +#include "CharacterCategory.h" #include "Position.h" #include "SplitVector.h" #include "Partitioning.h" @@ -44,10 +45,6 @@ using namespace Scintilla; #endif
-static inline bool IsPunctuation(char ch) { - return IsASCII(ch) && ispunct(ch); -} - void LexInterface::Colourise(int start, int end) { if (pdoc && instance && !performingStyle) { // 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 Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const { int pos = positionStart; @@ -1485,28 +1553,104 @@ int Document::ParaDown(int pos) const { return LineEnd(line-1); }
-CharClassify::cc Document::WordCharClass(unsigned char ch) const { - if ((SC_CP_UTF8 == dbcsCodePage) && (!UTF8IsAscii(ch))) - return CharClassify::ccWord; - return charClass.GetClass(ch); +bool Document::IsASCIIWordByte(unsigned char ch) const { + if (IsASCII(ch)) { + return charClass.GetClass(ch) == CharClassify::ccWord; + } 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. * 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; if (delta < 0) { - if (!onlyWordCharacters) - ccStart = WordCharClass(cb.CharAt(pos-1)); - while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) - pos--; + if (!onlyWordCharacters) { + const CharacterExtracted ce = CharacterBefore(pos); + ccStart = WordCharacterClass(ce.character); + } + while (pos > 0) { + const CharacterExtracted ce = CharacterBefore(pos); + if (WordCharacterClass(ce.character) != ccStart) + break; + pos -= ce.widthBytes; + } } else { - if (!onlyWordCharacters && pos < Length()) - ccStart = WordCharClass(cb.CharAt(pos)); - while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) - pos++; + if (!onlyWordCharacters && pos < Length()) { + const CharacterExtracted ce = CharacterAfter(pos); + ccStart = WordCharacterClass(ce.character); + } + while (pos < Length()) { + const CharacterExtracted ce = CharacterAfter(pos); + if (WordCharacterClass(ce.character) != ccStart) + break; + pos += ce.widthBytes; + } } return MovePositionOutsideChar(pos, delta, true); } @@ -1518,22 +1662,39 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { * additional movement to transit white space. * 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) { - while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace)) - pos--; + while (pos > 0) { + const CharacterExtracted ce = CharacterBefore(pos); + if (WordCharacterClass(ce.character) != CharClassify::ccSpace) + break; + pos -= ce.widthBytes; + } if (pos > 0) { - CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); - while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) { - pos--; + CharacterExtracted ce = CharacterBefore(pos); + const CharClassify::cc ccStart = WordCharacterClass(ce.character); + while (pos > 0) { + ce = CharacterBefore(pos); + if (WordCharacterClass(ce.character) != ccStart) + break; + pos -= ce.widthBytes; } } } else { - CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); - while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) - pos++; - while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace)) - pos++; + CharacterExtracted ce = CharacterAfter(pos); + const CharClassify::cc ccStart = WordCharacterClass(ce.character); + while (pos < Length()) { + ce = CharacterAfter(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; } @@ -1545,27 +1706,41 @@ int Document::NextWordStart(int pos, int delta) { * additional movement to transit white space. * 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 (pos > 0) { - CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); + CharacterExtracted ce = CharacterBefore(pos); + CharClassify::cc ccStart = WordCharacterClass(ce.character); if (ccStart != CharClassify::ccSpace) { - while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) { - pos--; + while (pos > 0) { + ce = CharacterBefore(pos); + if (WordCharacterClass(ce.character) != ccStart) + break; + pos -= ce.widthBytes; } } - while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) { - pos--; + while (pos > 0) { + ce = CharacterBefore(pos); + if (WordCharacterClass(ce.character) != CharClassify::ccSpace) + break; + pos -= ce.widthBytes; } } } else { - while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) { - pos++; + while (pos < Length()) { + CharacterExtracted ce = CharacterAfter(pos); + if (WordCharacterClass(ce.character) != CharClassify::ccSpace) + break; + pos += ce.widthBytes; } if (pos < Length()) { - CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); - while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) { - pos++; + CharacterExtracted ce = CharacterAfter(pos); + CharClassify::cc ccStart = WordCharacterClass(ce.character); + 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. */ bool Document::IsWordStartAt(int pos) const { + if (pos >= Length()) + return false; 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) && - (ccPos != WordCharClass(CharAt(pos - 1))); + (ccPos != ccPrev); } return true; } @@ -1590,10 +1770,15 @@ bool Document::IsWordStartAt(int pos) const { * the next character is of a different character class. */ bool Document::IsWordEndAt(int pos) const { + if (pos <= 0) + return false; 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) && - (ccPrev != WordCharClass(CharAt(pos))); + (ccPrev != ccPos); } return true; } @@ -2075,96 +2260,137 @@ void Document::NotifyModified(DocModification mh) { } }
-bool Document::IsWordPartSeparator(char ch) const { - return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch); +// Used for word part navigation. +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; + } +} + +bool Document::IsWordPartSeparator(unsigned int ch) const { + return (WordCharacterClass(ch) == CharClassify::ccWord) && IsASCIIPunctuationCharacter(ch); }
-int Document::WordPartLeft(int pos) { +int Document::WordPartLeft(int pos) const { if (pos > 0) { - --pos; - char startChar = cb.CharAt(pos); - if (IsWordPartSeparator(startChar)) { - while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) { - --pos; + pos -= CharacterBefore(pos).widthBytes; + CharacterExtracted ceStart = CharacterAfter(pos); + if (IsWordPartSeparator(ceStart.character)) { + while (pos > 0 && IsWordPartSeparator(CharacterAfter(pos).character)) { + pos -= CharacterBefore(pos).widthBytes; } } if (pos > 0) { - startChar = cb.CharAt(pos); - --pos; - if (IsLowerCase(startChar)) { - while (pos > 0 && IsLowerCase(cb.CharAt(pos))) - --pos; - if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos))) - ++pos; - } else if (IsUpperCase(startChar)) { - while (pos > 0 && IsUpperCase(cb.CharAt(pos))) - --pos; - if (!IsUpperCase(cb.CharAt(pos))) - ++pos; - } else if (IsADigit(startChar)) { - while (pos > 0 && IsADigit(cb.CharAt(pos))) - --pos; - if (!IsADigit(cb.CharAt(pos))) - ++pos; - } else if (IsPunctuation(startChar)) { - while (pos > 0 && IsPunctuation(cb.CharAt(pos))) - --pos; - if (!IsPunctuation(cb.CharAt(pos))) - ++pos; - } else if (isspacechar(startChar)) { - while (pos > 0 && isspacechar(cb.CharAt(pos))) - --pos; - if (!isspacechar(cb.CharAt(pos))) - ++pos; - } else if (!IsASCII(startChar)) { - while (pos > 0 && !IsASCII(cb.CharAt(pos))) - --pos; - if (IsASCII(cb.CharAt(pos))) - ++pos; + ceStart = CharacterAfter(pos); + pos -= CharacterBefore(pos).widthBytes; + if (IsLowerCase(ceStart.character)) { + while (pos > 0 && IsLowerCase(CharacterAfter(pos).character)) + pos -= CharacterBefore(pos).widthBytes; + if (!IsUpperCase(CharacterAfter(pos).character) && !IsLowerCase(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (IsUpperCase(ceStart.character)) { + while (pos > 0 && IsUpperCase(CharacterAfter(pos).character)) + pos -= CharacterBefore(pos).widthBytes; + if (!IsUpperCase(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (IsADigit(ceStart.character)) { + while (pos > 0 && IsADigit(CharacterAfter(pos).character)) + pos -= CharacterBefore(pos).widthBytes; + if (!IsADigit(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (IsASCIIPunctuationCharacter(ceStart.character)) { + while (pos > 0 && IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) + pos -= CharacterBefore(pos).widthBytes; + if (!IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (isspacechar(ceStart.character)) { + while (pos > 0 && isspacechar(CharacterAfter(pos).character)) + pos -= CharacterBefore(pos).widthBytes; + if (!isspacechar(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (!IsASCII(ceStart.character)) { + while (pos > 0 && !IsASCII(CharacterAfter(pos).character)) + pos -= CharacterBefore(pos).widthBytes; + if (IsASCII(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; } else { - ++pos; + pos += CharacterAfter(pos).widthBytes; } } } return pos; }
-int Document::WordPartRight(int pos) { - char startChar = cb.CharAt(pos); - int length = Length(); - if (IsWordPartSeparator(startChar)) { - while (pos < length && IsWordPartSeparator(cb.CharAt(pos))) - ++pos; - startChar = cb.CharAt(pos); - } - if (!IsASCII(startChar)) { - while (pos < length && !IsASCII(cb.CharAt(pos))) - ++pos; - } else if (IsLowerCase(startChar)) { - while (pos < length && IsLowerCase(cb.CharAt(pos))) - ++pos; - } else if (IsUpperCase(startChar)) { - if (IsLowerCase(cb.CharAt(pos + 1))) { - ++pos; - while (pos < length && IsLowerCase(cb.CharAt(pos))) - ++pos; +int Document::WordPartRight(int pos) const { + CharacterExtracted ceStart = CharacterAfter(pos); + const int length = Length(); + if (IsWordPartSeparator(ceStart.character)) { + while (pos < length && IsWordPartSeparator(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + ceStart = CharacterAfter(pos); + } + if (!IsASCII(ceStart.character)) { + while (pos < length && !IsASCII(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (IsLowerCase(ceStart.character)) { + while (pos < length && IsLowerCase(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (IsUpperCase(ceStart.character)) { + if (IsLowerCase(CharacterAfter(pos + ceStart.widthBytes).character)) { + pos += CharacterAfter(pos).widthBytes; + while (pos < length && IsLowerCase(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; } else { - while (pos < length && IsUpperCase(cb.CharAt(pos))) - ++pos; - } - if (IsLowerCase(cb.CharAt(pos)) && IsUpperCase(cb.CharAt(pos - 1))) - --pos; - } else if (IsADigit(startChar)) { - while (pos < length && IsADigit(cb.CharAt(pos))) - ++pos; - } else if (IsPunctuation(startChar)) { - while (pos < length && IsPunctuation(cb.CharAt(pos))) - ++pos; - } else if (isspacechar(startChar)) { - while (pos < length && isspacechar(cb.CharAt(pos))) - ++pos; + while (pos < length && IsUpperCase(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } + if (IsLowerCase(CharacterAfter(pos).character) && IsUpperCase(CharacterBefore(pos).character)) + pos -= CharacterBefore(pos).widthBytes; + } else if (IsADigit(ceStart.character)) { + while (pos < length && IsADigit(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (IsASCIIPunctuationCharacter(ceStart.character)) { + while (pos < length && IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; + } else if (isspacechar(ceStart.character)) { + while (pos < length && isspacechar(CharacterAfter(pos).character)) + pos += CharacterAfter(pos).widthBytes; } else { - ++pos; + pos += CharacterAfter(pos).widthBytes; } return pos; }
Modified: scintilla/src/Document.h 36 lines changed, 22 insertions(+), 14 deletions(-) =================================================================== @@ -238,6 +238,18 @@ class Document : PerLine, public IDocumentWithLineEnd, public ILoader {
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;
int eolMode; @@ -284,6 +296,8 @@ class Document : PerLine, public IDocumentWithLineEnd, public ILoader { int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; int NextPosition(int pos, int moveDir) const; 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; int GetRelativePositionUTF16(int positionStart, int characterOffset) const; int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const; @@ -373,19 +387,12 @@ class Document : PerLine, public IDocumentWithLineEnd, public ILoader { void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine);
void Indent(bool forwards); - int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); - int NextWordStart(int pos, int delta); - int NextWordEnd(int pos, int delta); + int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false) const; + int NextWordStart(int pos, int delta) const; + int NextWordEnd(int pos, int delta) const; Sci_Position SCI_METHOD Length() const { return cb.Length(); } 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;
bool IsWordStartAt(int pos) const; @@ -437,10 +444,11 @@ class Document : PerLine, public IDocumentWithLineEnd, public ILoader { bool AddWatcher(DocWatcher *watcher, void *userData); bool RemoveWatcher(DocWatcher *watcher, void *userData);
- CharClassify::cc WordCharClass(unsigned char ch) const; - bool IsWordPartSeparator(char ch) const; - int WordPartLeft(int pos); - int WordPartRight(int pos); + bool IsASCIIWordByte(unsigned char ch) const; + CharClassify::cc WordCharacterClass(unsigned int ch) const; + bool IsWordPartSeparator(unsigned int ch) const; + int WordPartLeft(int pos) const; + int WordPartRight(int pos) const; int ExtendStyleRange(int pos, int delta, bool singleLine = false); bool IsWhiteLine(int line) const; int ParaUp(int pos) const;
Modified: scintilla/src/EditView.cxx 62 lines changed, 42 insertions(+), 20 deletions(-) =================================================================== @@ -25,6 +25,7 @@ #include "Scintilla.h"
#include "StringCopy.h" +#include "CharacterSet.h" #include "Position.h" #include "SplitVector.h" #include "Partitioning.h" @@ -389,16 +390,16 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co (ll->chars[numCharsInLine] == chDoc); else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) 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) allSame = allSame && - (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); + (ll->chars[numCharsInLine] == MakeUpperCase(chDoc)); else { // Style::caseCamel - if ((model.pdoc->WordCharClass(ll->chars[numCharsInLine]) == CharClassify::ccWord) && - ((numCharsInLine == 0) || (model.pdoc->WordCharClass(ll->chars[numCharsInLine - 1]) != CharClassify::ccWord))) { - allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc))); + if ((model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine])) && + ((numCharsInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine - 1])))) { + allSame = allSame && (ll->chars[numCharsInLine] == MakeUpperCase(chDoc)); } else { - allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc))); + allSame = allSame && (ll->chars[numCharsInLine] == MakeLowerCase(chDoc)); } } numCharsInLine++; @@ -417,7 +418,7 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co ll->widthLine = LineLayout::wrapWidthInfinite; ll->lines = 1; 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) { 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++) { char chDoc = ll->chars[charInLine]; 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) - 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) { - if ((model.pdoc->WordCharClass(ll->chars[charInLine]) == CharClassify::ccWord) && - ((charInLine == 0) || (model.pdoc->WordCharClass(ll->chars[charInLine - 1]) != CharClassify::ccWord))) { - ll->chars[charInLine] = static_cast<char>(toupper(chDoc)); + if ((model.pdoc->IsASCIIWordByte(ll->chars[charInLine])) && + ((charInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[charInLine - 1])))) { + ll->chars[charInLine] = static_cast<char>(MakeUpperCase(chDoc)); } 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) && (i >= ll->edgeColumn) && (i < ll->numCharsBeforeEOL)) - return vsDraw.edgecolour; + return vsDraw.theEdge.colour; if (inHotspot && vsDraw.hotspotColours.back.isSet) return vsDraw.hotspotColours.back; } @@ -1339,12 +1340,24 @@ static void DrawEdgeLine(Surface *surface, const ViewStyle &vsDraw, const LineLa Range lineRange, int xStart) { if (vsDraw.edgeState == EDGE_LINE) { 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); if ((ll->wrapIndent != 0) && (lineRange.start != 0)) rcSegment.left -= ll->wrapIndent; 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) { surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.styles[STYLE_DEFAULT].back); 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.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); @@ -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 // Printing supports only the line number margin. 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)) { - lineNumberIndex = margin; + lineNumberIndex = static_cast<int>(margin); } else { vsPrint.ms[margin].width = 0; }
Modified: scintilla/src/Editor.cxx 75 lines changed, 57 insertions(+), 18 deletions(-) =================================================================== @@ -112,6 +112,7 @@ Editor::Editor() { hasFocus = false; errorStatus = 0; mouseDownCaptures = true; + mouseWheelCaptures = true;
lastClickTime = 0; doubleClickCloseThreshold = Point(3, 3); @@ -739,8 +740,8 @@ void Editor::MultipleSelectAdd(AddNumber addNumber) { const int searchEnd = it->end; for (;;) { int lengthFound = static_cast<int>(selectedText.length()); - int pos = pdoc->FindText(searchStart, searchEnd, selectedText.c_str(), - searchFlags, &lengthFound); + int pos = static_cast<int>(pdoc->FindText(searchStart, searchEnd, + selectedText.c_str(), searchFlags, &lengthFound)); if (pos >= 0) { sel.AddSelection(SelectionRange(pos + lengthFound, pos)); 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) { int marginClicked = -1; 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)) - marginClicked = margin; + marginClicked = static_cast<int>(margin); x += vs.ms[margin].width; } if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { @@ -3319,13 +3320,13 @@ int Editor::HorizontalMove(unsigned int iMessage) { sel.selType = Selection::selRectangle; sel.Rectangular() = SelectionRange(spCaret, rangeBase.anchor); 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 { - 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) { InvalidateWholeSelection(); sel.DropAdditionalRanges(); @@ -3421,7 +3422,7 @@ int Editor::HorizontalMove(unsigned int iMessage) { const int directionMove = (spCaret < spCaretNow) ? -1 : 1; 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) { case SCI_CHARLEFT: case SCI_CHARRIGHT: @@ -4288,7 +4289,7 @@ bool Editor::PointInSelMargin(Point pt) const {
Window::Cursor Editor::GetMarginCursor(Point pt) const { 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)) return static_castWindow::Cursor(vs.ms[margin].cursor); x += vs.ms[margin].width; @@ -5568,8 +5569,8 @@ void Editor::AddStyledText(char *buffer, int appendLength) { SetEmptySelection(sel.MainCaret() + lengthInserted); }
-static bool ValidMargin(uptr_t wParam) { - return wParam <= SC_MAX_MARGIN; +bool Editor::ValidMargin(uptr_t wParam) { + return wParam < vs.ms.size(); }
static char *CharPtrFromSPtr(sptr_t lParam) { @@ -6883,6 +6884,27 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { else 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: vs.ClearStyles(); InvalidateStyleRedraw(); @@ -7433,10 +7455,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return vs.zoomLevel;
case SCI_GETEDGECOLUMN: - return vs.theEdge; + return vs.theEdge.column;
case SCI_SETEDGECOLUMN: - vs.theEdge = static_cast<int>(wParam); + vs.theEdge.column = static_cast<int>(wParam); InvalidateStyleRedraw(); break;
@@ -7449,10 +7471,20 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break;
case SCI_GETEDGECOLOUR: - return vs.edgecolour.AsLong(); + return vs.theEdge.colour.AsLong();
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(); break;
@@ -7584,6 +7616,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETMOUSEDOWNCAPTURES: return mouseDownCaptures;
+ case SCI_SETMOUSEWHEELCAPTURES: + mouseWheelCaptures = wParam != 0; + break; + + case SCI_GETMOUSEWHEELCAPTURES: + return mouseWheelCaptures; + case SCI_SETCURSOR: cursorMode = static_cast<int>(wParam); DisplayCursor(Window::cursorText);
Modified: scintilla/src/Editor.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -176,6 +176,7 @@ class Editor : public EditModel, public DocWatcher {
bool hasFocus; bool mouseDownCaptures; + bool mouseWheelCaptures;
int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret bool horizontalScrollBarVisible; @@ -570,6 +571,7 @@ class Editor : public EditModel, public DocWatcher { void AddStyledText(char *buffer, int appendLength);
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); sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
Modified: scintilla/src/MarginView.cxx 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -193,7 +193,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect
Point ptOrigin = model.GetVisibleOriginInMain(); 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) {
rcSelMargin.left = rcSelMargin.right; @@ -216,6 +216,9 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect case SC_MARGIN_FORE: colour = vs.styles[STYLE_DEFAULT].fore; break; + case SC_MARGIN_COLOUR: + colour = vs.ms[margin].back; + break; default: colour = vs.styles[STYLE_LINENUMBER].back; break;
Modified: scintilla/src/SplitVector.h 22 lines changed, 12 insertions(+), 10 deletions(-) =================================================================== @@ -29,15 +29,17 @@ class SplitVector { void GapTo(int position) { if (position != part1Length) { if (position < part1Length) { - memmove( - body + position + gapLength, + // Moving the gap towards start so moving elements towards end + std::copy_backward( body + position, - sizeof(T) * (part1Length - position)); - } else { // position > part1Length - memmove( body + part1Length, + body + gapLength + part1Length); + } else { // position > part1Length + // Moving the gap towards end so moving elements towards start + std::copy( body + part1Length + gapLength, - sizeof(T) * (position - part1Length)); + body + gapLength + position, + body + part1Length); } part1Length = position; } @@ -93,7 +95,7 @@ class SplitVector { GapTo(lengthBody); T *newBody = new T[newSize]; if ((size != 0) && (body != 0)) { - memmove(newBody, body, sizeof(T) * lengthBody); + std::copy(body, body + lengthBody, newBody); delete []body; } body = newBody; @@ -205,7 +207,7 @@ class SplitVector { } RoomFor(insertLength); GapTo(positionToInsert); - memmove(body + part1Length, s + positionFrom, sizeof(T) * insertLength); + std::copy(s + positionFrom, s + positionFrom + insertLength, body + part1Length); lengthBody += insertLength; part1Length += insertLength; gapLength -= insertLength; @@ -254,11 +256,11 @@ class SplitVector { if (range1Length > part1AfterPosition) range1Length = part1AfterPosition; } - memcpy(buffer, body + position, range1Length * sizeof(T)); + std::copy(body + position, body + position + range1Length, buffer); buffer += range1Length; position = position + range1Length + gapLength; int range2Length = retrieveLength - range1Length; - memcpy(buffer, body + position, range2Length * sizeof(T)); + std::copy(body + position, body + position + range2Length, buffer); }
T *BufferPointer() {
Modified: scintilla/src/ViewStyle.cxx 16 lines changed, 7 insertions(+), 9 deletions(-) =================================================================== @@ -139,17 +139,13 @@ ViewStyle::ViewStyle(const ViewStyle &source) { alwaysShowCaretLineBackground = source.alwaysShowCaretLineBackground; caretLineBackground = source.caretLineBackground; caretLineAlpha = source.caretLineAlpha; - edgecolour = source.edgecolour; - edgeState = source.edgeState; caretStyle = source.caretStyle; caretWidth = source.caretWidth; someStylesProtected = false; someStylesForceCase = false; leftMarginWidth = source.leftMarginWidth; rightMarginWidth = source.rightMarginWidth; - for (int margin=0; margin <= SC_MAX_MARGIN; margin++) { - ms[margin] = source.ms[margin]; - } + ms = source.ms; maskInLine = source.maskInLine; maskDrawInText = source.maskDrawInText; fixedColumnWidth = source.fixedColumnWidth; @@ -171,7 +167,9 @@ ViewStyle::ViewStyle(const ViewStyle &source) { braceBadLightIndicatorSet = source.braceBadLightIndicatorSet; braceBadLightIndicator = source.braceBadLightIndicator;
+ edgeState = source.edgeState; theEdge = source.theEdge; + theMultiEdge = source.theMultiEdge;
marginNumberPadding = source.marginNumberPadding; ctrlCharPadding = source.ctrlCharPadding; @@ -196,7 +194,7 @@ void ViewStyle::CalculateMarginWidthAndMask() { fixedColumnWidth = marginInside ? leftMarginWidth : 0; maskInLine = 0xffffffff; 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; if (ms[margin].width > 0) maskInLine &= ~ms[margin].mask; @@ -268,8 +266,6 @@ void ViewStyle::Init(size_t stylesSize_) { alwaysShowCaretLineBackground = false; caretLineBackground = ColourDesired(0xff, 0xff, 0); caretLineAlpha = SC_ALPHA_NOALPHA; - edgecolour = ColourDesired(0xc0, 0xc0, 0xc0); - edgeState = EDGE_NONE; caretStyle = CARETSTYLE_LINE; caretWidth = 1; someStylesProtected = false; @@ -282,6 +278,7 @@ void ViewStyle::Init(size_t stylesSize_) {
leftMarginWidth = 1; rightMarginWidth = 1; + ms.resize(SC_MAX_MARGIN + 1); ms[0].style = SC_MARGIN_NUMBER; ms[0].width = 0; ms[0].mask = 0; @@ -310,7 +307,8 @@ void ViewStyle::Init(size_t stylesSize_) { braceBadLightIndicatorSet = false; braceBadLightIndicator = 0;
- theEdge = 0; + edgeState = EDGE_NONE; + theEdge = EdgeProperties(0, ColourDesired(0xc0, 0xc0, 0xc0));
marginNumberPadding = 3; ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side
Modified: scintilla/src/ViewStyle.h 20 lines changed, 16 insertions(+), 4 deletions(-) =================================================================== @@ -17,6 +17,7 @@ namespace Scintilla { class MarginStyle { public: int style; + ColourDesired back; int width; int mask; bool sensitive; @@ -72,6 +73,17 @@ struct ForeBackColours { 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 { @@ -115,7 +127,7 @@ class ViewStyle { 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 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 bool marginInside; ///< true: margin included in text view, false: separate views int textStart; ///< Starting x position of text within the view @@ -130,8 +142,6 @@ class ViewStyle { bool alwaysShowCaretLineBackground; ColourDesired caretLineBackground; int caretLineAlpha; - ColourDesired edgecolour; - int edgeState; int caretStyle; int caretWidth; bool someStylesProtected; @@ -146,7 +156,9 @@ class ViewStyle { int braceHighlightIndicator; bool braceBadLightIndicatorSet; int braceBadLightIndicator; - int theEdge; + int edgeState; + EdgeProperties theEdge; + std::vector<EdgeProperties> theMultiEdge; int marginNumberPadding; // the right-side padding of the number margin int ctrlCharPadding; // the padding around control character text blobs int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
Modified: scintilla/version.txt 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1 +1 @@ -367 +370
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).