Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Wed, 16 Oct 2013 13:45:01 UTC Commit: 7d79df7975dab3aa6a2c824cf5a504069c291077 https://github.com/geany/geany/commit/7d79df7975dab3aa6a2c824cf5a504069c2910...
Log Message: ----------- Merge branch 'scintilla-update-336'
Modified Paths: -------------- scintilla/gtk/PlatGTK.cxx scintilla/gtk/ScintillaGTK.cxx scintilla/include/ILexer.h scintilla/include/Platform.h scintilla/include/SciLexer.h scintilla/include/Scintilla.h scintilla/include/Scintilla.iface scintilla/lexers/LexCPP.cxx scintilla/lexers/LexOthers.cxx scintilla/lexers/LexPascal.cxx scintilla/lexers/LexPerl.cxx scintilla/lexers/LexSQL.cxx scintilla/lexlib/StyleContext.h scintilla/lexlib/SubStyles.h scintilla/lexlib/WordList.cxx scintilla/scintilla_changes.patch scintilla/src/Document.cxx scintilla/src/Editor.cxx scintilla/src/ScintillaBase.cxx scintilla/src/ScintillaBase.h scintilla/src/ViewStyle.cxx scintilla/src/ViewStyle.h scintilla/version.txt
Modified: scintilla/gtk/PlatGTK.cxx 14 files changed, 1 insertions(+), 13 deletions(-) =================================================================== @@ -890,18 +890,6 @@ static size_t MultiByteLenFromIconv(const Converter &conv, const char *s, size_t return 1; }
-static size_t UTF8CharLength(const char *s) { - const unsigned char *us = reinterpret_cast<const unsigned char *>(s); - unsigned char ch = *us; - if (ch < 0x80) { - return 1; - } else if (ch < 0x80 + 0x40 + 0x20) { - return 2; - } else { - return 3; - } -} - void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) { PenColour(fore); @@ -1045,7 +1033,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION positions[i++] = iti.position - (places - place) * iti.distance / places; positionsCalculated++; } - clusterStart += UTF8CharLength(utfForm.c_str()+clusterStart); + clusterStart += UTF8CharLength(static_cast<unsigned char>(utfForm.c_str()[clusterStart])); place++; } }
Modified: scintilla/gtk/ScintillaGTK.cxx 23 files changed, 12 insertions(+), 11 deletions(-) =================================================================== @@ -89,15 +89,6 @@ static GdkWindow *WindowFromWidget(GtkWidget *w) { #endif }
-static GdkWindow *PWindow(const Window &w) { - GtkWidget *widget = reinterpret_cast<GtkWidget *>(w.GetID()); -#if GTK_CHECK_VERSION(3,0,0) - return gtk_widget_get_window(widget); -#else - return widget->window; -#endif -} - #ifdef _MSC_VER // Constant conditional expressions are because of GTK+ headers #pragma warning(disable: 4127) @@ -111,6 +102,15 @@ static GdkWindow *PWindow(const Window &w) { using namespace Scintilla; #endif
+static GdkWindow *PWindow(const Window &w) { + GtkWidget *widget = reinterpret_cast<GtkWidget *>(w.GetID()); +#if GTK_CHECK_VERSION(3,0,0) + return gtk_widget_get_window(widget); +#else + return widget->window; +#endif +} + extern std::string UTF8FromLatin1(const char *s, int len);
class ScintillaGTK : public ScintillaBase { @@ -1208,6 +1208,7 @@ void ScintillaGTK::NotifyFocus(bool focus) { g_signal_emit(G_OBJECT(sci), scintilla_signals[COMMAND_SIGNAL], 0, Platform::LongFromTwoShorts (GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), PWidget(wMain)); + Editor::NotifyFocus(focus); }
void ScintillaGTK::NotifyParent(SCNotification scn) { @@ -1218,7 +1219,7 @@ void ScintillaGTK::NotifyParent(SCNotification scn) { }
void ScintillaGTK::NotifyKey(int key, int modifiers) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_KEY; scn.ch = key; scn.modifiers = modifiers; @@ -1227,7 +1228,7 @@ void ScintillaGTK::NotifyKey(int key, int modifiers) { }
void ScintillaGTK::NotifyURIDropped(const char *list) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_URIDROPPED; scn.text = list;
Modified: scintilla/include/ILexer.h 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -75,6 +75,8 @@ class ILexerWithSubStyles : public ILexer { virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0; virtual int SCI_METHOD SubStylesStart(int styleBase) = 0; virtual int SCI_METHOD SubStylesLength(int styleBase) = 0; + virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0; + virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0; virtual void SCI_METHOD FreeSubStyles() = 0; virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0; virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;
Modified: scintilla/include/Platform.h 18 files changed, 0 insertions(+), 18 deletions(-) =================================================================== @@ -345,22 +345,10 @@ class Surface { class Window { protected: WindowID wid; -#if PLAT_MACOSX - void *windowRef; - void *control; -#endif public: Window() : wid(0), cursorLast(cursorInvalid) { -#if PLAT_MACOSX - windowRef = 0; - control = 0; -#endif } Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) { -#if PLAT_MACOSX - windowRef = 0; - control = 0; -#endif } virtual ~Window(); Window &operator=(WindowID wid_) { @@ -383,10 +371,6 @@ class Window { void SetCursor(Cursor curs); void SetTitle(const char *s); PRectangle GetMonitorRect(Point pt); -#if PLAT_MACOSX - void SetWindow(void *ref) { windowRef = ref; } - void SetControl(void *_control) { control = _control; } -#endif private: Cursor cursorLast; }; @@ -528,9 +512,7 @@ class Platform { #endif
#if defined(__GNUC__) && defined(SCINTILLA_QT) -#pragma GCC diagnostic ignored "-Wmissing-braces" #pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#pragma GCC diagnostic ignored "-Wchar-subscripts" #endif
#endif
Modified: scintilla/include/SciLexer.h 22 files changed, 22 insertions(+), 0 deletions(-) =================================================================== @@ -123,6 +123,7 @@ #define SCLEX_LITERATEHASKELL 108 #define SCLEX_STTXT 109 #define SCLEX_KVIRC 110 +#define SCLEX_RUST 111 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 @@ -1661,6 +1662,27 @@ #define SCE_KVIRC_OPERATOR 10 #define SCE_KVIRC_STRING_FUNCTION 11 #define SCE_KVIRC_STRING_VARIABLE 12 +#define SCE_RUST_DEFAULT 0 +#define SCE_RUST_COMMENTBLOCK 1 +#define SCE_RUST_COMMENTLINE 2 +#define SCE_RUST_COMMENTBLOCKDOC 3 +#define SCE_RUST_COMMENTLINEDOC 4 +#define SCE_RUST_NUMBER 5 +#define SCE_RUST_WORD 6 +#define SCE_RUST_WORD2 7 +#define SCE_RUST_WORD3 8 +#define SCE_RUST_WORD4 9 +#define SCE_RUST_WORD5 10 +#define SCE_RUST_WORD6 11 +#define SCE_RUST_WORD7 12 +#define SCE_RUST_STRING 13 +#define SCE_RUST_STRINGR 14 +#define SCE_RUST_CHARACTER 15 +#define SCE_RUST_OPERATOR 16 +#define SCE_RUST_IDENTIFIER 17 +#define SCE_RUST_LIFETIME 18 +#define SCE_RUST_MACRO 19 +#define SCE_RUST_LEXERROR 20 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif
Modified: scintilla/include/Scintilla.h 4 files changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -987,6 +987,8 @@ #define SCN_AUTOCCANCELLED 2025 #define SCN_AUTOCCHARDELETED 2026 #define SCN_HOTSPOTRELEASECLICK 2027 +#define SCN_FOCUSIN 2028 +#define SCN_FOCUSOUT 2029 #ifndef SCI_DISABLE_PROVISIONAL #define SC_LINE_END_TYPE_DEFAULT 0 #define SC_LINE_END_TYPE_UNICODE 1 @@ -997,6 +999,8 @@ #define SCI_ALLOCATESUBSTYLES 4020 #define SCI_GETSUBSTYLESSTART 4021 #define SCI_GETSUBSTYLESLENGTH 4022 +#define SCI_GETSTYLEFROMSUBSTYLE 4027 +#define SCI_GETPRIMARYSTYLEFROMSTYLE 4028 #define SCI_FREESUBSTYLES 4023 #define SCI_SETIDENTIFIERS 4024 #define SCI_DISTANCETOSECONDARYSTYLES 4025
Modified: scintilla/include/Scintilla.iface 32 files changed, 32 insertions(+), 0 deletions(-) =================================================================== @@ -2600,6 +2600,7 @@ val SCLEX_VISUALPROLOG=107 val SCLEX_LITERATEHASKELL=108 val SCLEX_STTXT=109 val SCLEX_KVIRC=110 +val SCLEX_RUST=111
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -4340,6 +4341,29 @@ val SCE_KVIRC_NUMBER=9 val SCE_KVIRC_OPERATOR=10 val SCE_KVIRC_STRING_FUNCTION=11 val SCE_KVIRC_STRING_VARIABLE=12 +# Lexical states for SCLEX_RUST +lex Rust=SCLEX_RUST SCE_RUST_ +val SCE_RUST_DEFAULT=0 +val SCE_RUST_COMMENTBLOCK=1 +val SCE_RUST_COMMENTLINE=2 +val SCE_RUST_COMMENTBLOCKDOC=3 +val SCE_RUST_COMMENTLINEDOC=4 +val SCE_RUST_NUMBER=5 +val SCE_RUST_WORD=6 +val SCE_RUST_WORD2=7 +val SCE_RUST_WORD3=8 +val SCE_RUST_WORD4=9 +val SCE_RUST_WORD5=10 +val SCE_RUST_WORD6=11 +val SCE_RUST_WORD7=12 +val SCE_RUST_STRING=13 +val SCE_RUST_STRINGR=14 +val SCE_RUST_CHARACTER=15 +val SCE_RUST_OPERATOR=16 +val SCE_RUST_IDENTIFIER=17 +val SCE_RUST_LIFETIME=18 +val SCE_RUST_MACRO=19 +val SCE_RUST_LEXERROR=20
# Events
@@ -4371,6 +4395,8 @@ evt void IndicatorRelease=2024(int modifiers, int position) evt void AutoCCancelled=2025(void) evt void AutoCCharDeleted=2026(void) evt void HotSpotReleaseClick=2027(int modifiers, int position) +evt void FocusIn=2028(void) +evt void FocusOut=2029(void)
cat Provisional
@@ -4403,6 +4429,12 @@ get int GetSubStylesStart=4021(int styleBase,) # The number of sub styles associated with a base style get int GetSubStylesLength=4022(int styleBase,)
+# For a sub style, return the base style, else return the argument. +get int GetStyleFromSubStyle=4027(int subStyle,) + +# For a secondary style, return the primary style, else return the argument. +get int GetPrimaryStyleFromStyle=4028(int style,) + # Free allocated sub styles fun void FreeSubStyles=4023(,)
Modified: scintilla/lexers/LexCPP.cxx 8 files changed, 8 insertions(+), 0 deletions(-) =================================================================== @@ -387,6 +387,14 @@ class LexerCPP : public ILexerWithSubStyles { int SCI_METHOD SubStylesLength(int styleBase) { return subStyles.Length(styleBase); } + int SCI_METHOD StyleFromSubStyle(int subStyle) { + int styleBase = subStyles.BaseStyle(MaskActive(subStyle)); + int active = subStyle & activeFlag; + return styleBase | active; + } + int SCI_METHOD PrimaryStyleFromStyle(int style) { + return MaskActive(style); + } void SCI_METHOD FreeSubStyles() { subStyles.Free(); }
Modified: scintilla/lexers/LexOthers.cxx 13 files changed, 10 insertions(+), 3 deletions(-) =================================================================== @@ -954,15 +954,16 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin // Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal // Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal // Microsoft: <filename>(<line>,<column>)<message> - // CTags: \t<message> + // CTags: <identifier>\t<filename>\t<message> // Lua 5 traceback: \t<filename>:<line>:<message> // Lua 5.1: <exe>: <filename>:<line>:<message> bool initialTab = (lineBuffer[0] == '\t'); bool initialColonPart = false; + bool canBeCtags = !initialTab; // For ctags must have an identifier with no spaces then a tab enum { stInitial, stGccStart, stGccDigit, stGccColumn, stGcc, stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet, - stCtagsStart, stCtagsStartString, stCtagsStringDollar, stCtags, + stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags, stUnrecognized } state = stInitial; for (unsigned int i = 0; i < lengthLine; i++) { @@ -984,9 +985,11 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin // May be Microsoft // Check against '0' often removes phone numbers state = stMsStart; - } else if ((ch == '\t') && (!initialTab)) { + } else if ((ch == '\t') && canBeCtags) { // May be CTags state = stCtagsStart; + } else if (ch == ' ') { + canBeCtags = false; } } else if (state == stGccStart) { // <filename>: state = Is1To9(ch) ? stGccDigit : stUnrecognized; @@ -1047,6 +1050,10 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin state = stUnrecognized; } } else if (state == stCtagsStart) { + if (ch == '\t') { + state = stCtagsFile; + } + } else if (state == stCtagsFile) { if ((lineBuffer[i - 1] == '\t') && ((ch == '/' && chNext == '^') || Is0To9(ch))) { state = stCtags;
Modified: scintilla/lexers/LexPascal.cxx 21 files changed, 11 insertions(+), 10 deletions(-) =================================================================== @@ -12,7 +12,7 @@ A few words about features of the new completely rewritten LexPascal...
Generally speaking LexPascal tries to support all available Delphi features (up -to Delphi 2009 at this time), including .NET specific features. +to Delphi XE4 at this time).
~ HIGHLIGHTING:
@@ -89,17 +89,18 @@ related to property and DLL exports declarations (similar to how Delphi IDE ~ KEYWORDS:
The list of keywords that can be used in pascal.properties file (up to Delphi -2009): +XE4):
- Keywords: absolute abstract and array as asm assembler automated begin case -cdecl class const constructor deprecated destructor dispid dispinterface div do -downto dynamic else end except export exports external far file final -finalization finally for forward function goto if implementation in inherited -initialization inline interface is label library message mod near nil not object -of on or out overload override packed pascal platform private procedure program -property protected public published raise record register reintroduce repeat -resourcestring safecall sealed set shl shr static stdcall strict string then -threadvar to try type unit unsafe until uses var varargs virtual while with xor +cdecl class const constructor delayed deprecated destructor dispid dispinterface +div do downto dynamic else end except experimental export exports external far +file final finalization finally for forward function goto helper if +implementation in inherited initialization inline interface is label library +message mod near nil not object of on operator or out overload override packed +pascal platform private procedure program property protected public published +raise record reference register reintroduce repeat resourcestring safecall +sealed set shl shr static stdcall strict string then threadvar to try type unit +unsafe until uses var varargs virtual while winapi with xor
- Keywords related to the "smart highlithing" feature: add default implements index name nodefault read readonly remove stored write writeonly
Modified: scintilla/lexers/LexPerl.cxx 28 files changed, 16 insertions(+), 12 deletions(-) =================================================================== @@ -191,9 +191,9 @@ static int styleCheckIdentifier(LexAccessor &styler, unsigned int bk) { static int podLineScan(LexAccessor &styler, unsigned int &pos, unsigned int endPos) { // forward scan the current line to classify line for POD style int state = -1; - while (pos <= endPos) { + while (pos < endPos) { int ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos)); - if (ch == '\n' || ch == '\r' || pos >= endPos) { + if (ch == '\n' || ch == '\r') { if (ch == '\r' && styler.SafeGetCharAt(pos + 1) == '\n') pos++; break; } @@ -861,10 +861,14 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, sc.Forward(); } if (sc.ch != '\r') { // skip CR if CRLF - HereDoc.Append(sc.ch); + int i = 0; // else append char, possibly an extended char + while (i < sc.width) { + HereDoc.Append(static_cast<unsigned char>(styler.SafeGetCharAt(sc.currentPos + i))); + i++; + } } } - } else { // an unquoted here-doc delimiter + } else { // an unquoted here-doc delimiter, no extended charsets if (setHereDocDelim.Contains(sc.ch)) { HereDoc.Append(sc.ch); } else { @@ -885,7 +889,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, if (HereDoc.DelimiterLength == 0 || sc.Match(HereDoc.Delimiter)) { int c = sc.GetRelative(HereDoc.DelimiterLength); if (c == '\r' || c == '\n') { // peek first, do not consume match - sc.Forward(HereDoc.DelimiterLength); + sc.ForwardBytes(HereDoc.DelimiterLength); sc.SetState(SCE_PL_DEFAULT); backFlag = BACK_NONE; HereDoc.State = 0; @@ -939,7 +943,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, if (pod == SCE_PL_DEFAULT) { if (sc.state == SCE_PL_POD_VERB) { unsigned int fw2 = fw; - while (fw2 <= endPos && pod == SCE_PL_DEFAULT) { + while (fw2 < (endPos - 1) && pod == SCE_PL_DEFAULT) { fw = fw2++; // penultimate line (last blank line) pod = podLineScan(styler, fw2, endPos); styler.SetLineState(styler.GetLine(fw2), pod); @@ -961,7 +965,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, } sc.SetState(pod); } - sc.Forward(fw - sc.currentPos); // commit style + sc.ForwardBytes(fw - sc.currentPos); // commit style } break; case SCE_PL_REGEX: @@ -1021,7 +1025,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, // For '#', if no whitespace in between, it's a delimiter. if (IsASpace(c)) { // Keep going - } else if (c == '#' && IsASpaceOrTab(sc.GetRelative(sLen - 1))) { + } else if (c == '#' && IsASpaceOrTab(sc.GetRelativeCharacter(sLen - 1))) { endType = 3; } else Quote.Open(c); @@ -1109,7 +1113,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, while (setSubPrototype.Contains(sc.GetRelative(i))) i++; if (sc.GetRelative(i) == ')') { // valid sub prototype - sc.Forward(i); + sc.ForwardBytes(i); sc.ForwardSetState(SCE_PL_DEFAULT); } else { // abandon prototype, restart from '(' @@ -1322,7 +1326,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, if (setArray.Contains(sc.chNext)) { // no special treatment } else if (sc.chNext == ':' && sc.GetRelative(2) == ':') { - sc.Forward(2); + sc.ForwardBytes(2); } else if (sc.chNext == '{' || sc.chNext == '[') { sc.ForwardSetState(SCE_PL_OPERATOR); } else { @@ -1445,7 +1449,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, if (preferRE) { sc.SetState(SCE_PL_SYMBOLTABLE); if (sc.chNext == ':' && sc.GetRelative(2) == ':') { - sc.Forward(2); + sc.ForwardBytes(2); } else if (sc.chNext == '{') { sc.ForwardSetState(SCE_PL_OPERATOR); } else { @@ -1462,7 +1466,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, if (setHash.Contains(sc.chNext)) { sc.Forward(); } else if (sc.chNext == ':' && sc.GetRelative(2) == ':') { - sc.Forward(2); + sc.ForwardBytes(2); } else if (sc.chNext == '{') { sc.ForwardSetState(SCE_PL_OPERATOR); } else {
Modified: scintilla/lexers/LexSQL.cxx 162 files changed, 131 insertions(+), 31 deletions(-) =================================================================== @@ -62,6 +62,7 @@ static inline bool IsANumberChar(int ch) { ch == '.' || ch == '-' || ch == '+'); }
+typedef unsigned int sql_state_t;
class SQLStates { public : @@ -69,7 +70,7 @@ class SQLStates { sqlStatement.Set(lineNumber, sqlStatesLine); }
- unsigned short int IgnoreWhen (unsigned short int sqlStatesLine, bool enable) { + sql_state_t IgnoreWhen (sql_state_t sqlStatesLine, bool enable) { if (enable) sqlStatesLine |= MASK_IGNORE_WHEN; else @@ -78,7 +79,7 @@ class SQLStates { return sqlStatesLine; }
- unsigned short int IntoCondition (unsigned short int sqlStatesLine, bool enable) { + sql_state_t IntoCondition (sql_state_t sqlStatesLine, bool enable) { if (enable) sqlStatesLine |= MASK_INTO_CONDITION; else @@ -87,7 +88,7 @@ class SQLStates { return sqlStatesLine; }
- unsigned short int IntoExceptionBlock (unsigned short int sqlStatesLine, bool enable) { + sql_state_t IntoExceptionBlock (sql_state_t sqlStatesLine, bool enable) { if (enable) sqlStatesLine |= MASK_INTO_EXCEPTION; else @@ -96,7 +97,7 @@ class SQLStates { return sqlStatesLine; }
- unsigned short int IntoDeclareBlock (unsigned short int sqlStatesLine, bool enable) { + sql_state_t IntoDeclareBlock (sql_state_t sqlStatesLine, bool enable) { if (enable) sqlStatesLine |= MASK_INTO_DECLARE; else @@ -105,7 +106,7 @@ class SQLStates { return sqlStatesLine; }
- unsigned short int IntoMergeStatement (unsigned short int sqlStatesLine, bool enable) { + sql_state_t IntoMergeStatement (sql_state_t sqlStatesLine, bool enable) { if (enable) sqlStatesLine |= MASK_MERGE_STATEMENT; else @@ -114,7 +115,7 @@ class SQLStates { return sqlStatesLine; }
- unsigned short int CaseMergeWithoutWhenFound (unsigned short int sqlStatesLine, bool found) { + sql_state_t CaseMergeWithoutWhenFound (sql_state_t sqlStatesLine, bool found) { if (found) sqlStatesLine |= MASK_CASE_MERGE_WITHOUT_WHEN_FOUND; else @@ -122,7 +123,7 @@ class SQLStates {
return sqlStatesLine; } - unsigned short int IntoSelectStatementOrAssignment (unsigned short int sqlStatesLine, bool found) { + sql_state_t IntoSelectStatementOrAssignment (sql_state_t sqlStatesLine, bool found) { if (found) sqlStatesLine |= MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT; else @@ -130,67 +131,109 @@ class SQLStates { return sqlStatesLine; }
- unsigned short int BeginCaseBlock (unsigned short int sqlStatesLine) { + sql_state_t BeginCaseBlock (sql_state_t sqlStatesLine) { if ((sqlStatesLine & MASK_NESTED_CASES) < MASK_NESTED_CASES) { sqlStatesLine++; } return sqlStatesLine; }
- unsigned short int EndCaseBlock (unsigned short int sqlStatesLine) { + sql_state_t EndCaseBlock (sql_state_t sqlStatesLine) { if ((sqlStatesLine & MASK_NESTED_CASES) > 0) { sqlStatesLine--; } return sqlStatesLine; }
- bool IsIgnoreWhen (unsigned short int sqlStatesLine) { + sql_state_t IntoCreateStatement (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_CREATE; + else + sqlStatesLine &= ~MASK_INTO_CREATE; + + return sqlStatesLine; + } + + sql_state_t IntoCreateViewStatement (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_CREATE_VIEW; + else + sqlStatesLine &= ~MASK_INTO_CREATE_VIEW; + + return sqlStatesLine; + } + + sql_state_t IntoCreateViewAsStatement (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_CREATE_VIEW_AS_STATEMENT; + else + sqlStatesLine &= ~MASK_INTO_CREATE_VIEW_AS_STATEMENT; + + return sqlStatesLine; + } + + bool IsIgnoreWhen (sql_state_t sqlStatesLine) { return (sqlStatesLine & MASK_IGNORE_WHEN) != 0; }
- bool IsIntoCondition (unsigned short int sqlStatesLine) { + bool IsIntoCondition (sql_state_t sqlStatesLine) { return (sqlStatesLine & MASK_INTO_CONDITION) != 0; }
- bool IsIntoCaseBlock (unsigned short int sqlStatesLine) { + bool IsIntoCaseBlock (sql_state_t sqlStatesLine) { return (sqlStatesLine & MASK_NESTED_CASES) != 0; }
- bool IsIntoExceptionBlock (unsigned short int sqlStatesLine) { + bool IsIntoExceptionBlock (sql_state_t sqlStatesLine) { return (sqlStatesLine & MASK_INTO_EXCEPTION) != 0; } - bool IsIntoSelectStatementOrAssignment (unsigned short int sqlStatesLine) { + bool IsIntoSelectStatementOrAssignment (sql_state_t sqlStatesLine) { return (sqlStatesLine & MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT) != 0; } - bool IsCaseMergeWithoutWhenFound (unsigned short int sqlStatesLine) { + bool IsCaseMergeWithoutWhenFound (sql_state_t sqlStatesLine) { return (sqlStatesLine & MASK_CASE_MERGE_WITHOUT_WHEN_FOUND) != 0; }
- bool IsIntoDeclareBlock (unsigned short int sqlStatesLine) { + bool IsIntoDeclareBlock (sql_state_t sqlStatesLine) { return (sqlStatesLine & MASK_INTO_DECLARE) != 0; }
- bool IsIntoMergeStatement (unsigned short int sqlStatesLine) { + bool IsIntoMergeStatement (sql_state_t sqlStatesLine) { return (sqlStatesLine & MASK_MERGE_STATEMENT) != 0; }
- unsigned short int ForLine(int lineNumber) { + bool IsIntoCreateStatement (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_CREATE) != 0; + } + + bool IsIntoCreateViewStatement (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_CREATE_VIEW) != 0; + } + + bool IsIntoCreateViewAsStatement (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_CREATE_VIEW_AS_STATEMENT) != 0; + } + + sql_state_t ForLine(int lineNumber) { return sqlStatement.ValueAt(lineNumber); }
SQLStates() {}
private : - SparseState <unsigned short int> sqlStatement; + SparseState <sql_state_t> sqlStatement; enum { - MASK_NESTED_CASES = 0x01FF, - MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT = 0x0200, - MASK_CASE_MERGE_WITHOUT_WHEN_FOUND = 0x0400, - MASK_MERGE_STATEMENT = 0x0800, - MASK_INTO_DECLARE = 0x1000, - MASK_INTO_EXCEPTION = 0x2000, - MASK_INTO_CONDITION = 0x4000, - MASK_IGNORE_WHEN = 0x8000 + MASK_NESTED_CASES = 0x0001FF, + MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT = 0x000200, + MASK_CASE_MERGE_WITHOUT_WHEN_FOUND = 0x000400, + MASK_MERGE_STATEMENT = 0x000800, + MASK_INTO_DECLARE = 0x001000, + MASK_INTO_EXCEPTION = 0x002000, + MASK_INTO_CONDITION = 0x004000, + MASK_IGNORE_WHEN = 0x008000, + MASK_INTO_CREATE = 0x010000, + MASK_INTO_CREATE_VIEW = 0x020000, + MASK_INTO_CREATE_VIEW_AS_STATEMENT = 0x040000 }; };
@@ -561,12 +604,46 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
if (lineCurrent > 0) { // Backtrack to previous line in case need to fix its fold status for folding block of single-line comments (i.e. '--'). - lineCurrent -= 1; - startPos = styler.LineStart(lineCurrent); - + int lastNLPos = -1; + // And keep going back until we find an operator ';' followed + // by white-space and/or comments. This will improve folding. + while (--startPos > 0) { + char ch = styler[startPos]; + if (ch == '\n' || (ch == '\r' && styler[startPos + 1] != '\n')) { + lastNLPos = startPos; + } else if (ch == ';' && + styler.StyleAt(startPos) == SCE_SQL_OPERATOR) { + bool isAllClear = true; + for (int tempPos = startPos + 1; + tempPos < lastNLPos; + ++tempPos) { + int tempStyle = styler.StyleAt(tempPos); + if (!IsCommentStyle(tempStyle) + && tempStyle != SCE_SQL_DEFAULT) { + isAllClear = false; + break; + } + } + if (isAllClear) { + startPos = lastNLPos + 1; + break; + } + } + } + lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16; } + // And because folding ends at ';', keep going until we find one + // Otherwise if create ... view ... as is split over multiple + // lines the folding won't always update immediately. + unsigned int docLength = styler.Length(); + for (; endPos < docLength; ++endPos) { + if (styler.SafeGetCharAt(endPos) == ';') { + break; + } + } + int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); @@ -576,7 +653,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, // this statementFound flag avoids to fold when the statement is on only one line by ignoring ELSE or ELSIF // eg. "IF condition1 THEN ... ELSIF condition2 THEN ... ELSE ... END IF;" bool statementFound = false; - unsigned short int sqlStatesCurrentLine = 0; + sql_state_t sqlStatesCurrentLine = 0; if (!options.foldOnlyBegin) { sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent); } @@ -606,6 +683,16 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, } if (sqlStates.IsIntoSelectStatementOrAssignment(sqlStatesCurrentLine)) sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, false); + if (sqlStates.IsIntoCreateStatement(sqlStatesCurrentLine)) { + if (sqlStates.IsIntoCreateViewStatement(sqlStatesCurrentLine)) { + if (sqlStates.IsIntoCreateViewAsStatement(sqlStatesCurrentLine)) { + levelNext--; + sqlStatesCurrentLine = sqlStates.IntoCreateViewAsStatement(sqlStatesCurrentLine, false); + } + sqlStatesCurrentLine = sqlStates.IntoCreateViewStatement(sqlStatesCurrentLine, false); + } + sqlStatesCurrentLine = sqlStates.IntoCreateStatement(sqlStatesCurrentLine, false); + } } if (ch == ':' && chNext == '=' && !IsCommentStyle(style)) sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, true); @@ -805,6 +892,19 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, true); levelNext++; statementFound = true; + } else if ((!options.foldOnlyBegin) && + strcmp(s, "create") == 0) { + sqlStatesCurrentLine = sqlStates.IntoCreateStatement(sqlStatesCurrentLine, true); + } else if ((!options.foldOnlyBegin) && + strcmp(s, "view") == 0 && + sqlStates.IsIntoCreateStatement(sqlStatesCurrentLine)) { + sqlStatesCurrentLine = sqlStates.IntoCreateViewStatement(sqlStatesCurrentLine, true); + } else if ((!options.foldOnlyBegin) && + strcmp(s, "as") == 0 && + sqlStates.IsIntoCreateViewStatement(sqlStatesCurrentLine) && + ! sqlStates.IsIntoCreateViewAsStatement(sqlStatesCurrentLine)) { + sqlStatesCurrentLine = sqlStates.IntoCreateViewAsStatement(sqlStatesCurrentLine, true); + levelNext++; } } if (atEOL) {
Modified: scintilla/lexlib/StyleContext.h 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -172,11 +172,11 @@ class StyleContext { } int diffRelative = n - offsetRelative; int posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative); - int ch = multiByteAccess->GetCharacterAndWidth(posNew, 0); + int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, 0); posRelative = posNew; currentPosLastRelative = currentPos; offsetRelative = n; - return ch; + return chReturn; } else { // fast version for single byte encodings return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + n, 0));
Modified: scintilla/lexlib/SubStyles.h 25 files changed, 20 insertions(+), 5 deletions(-) =================================================================== @@ -13,13 +13,14 @@ #endif
class WordClassifier { + int baseStyle; int firstStyle; int lenStyles; std::map<std::string, int> wordToStyle;
public:
- WordClassifier() : firstStyle(0), lenStyles(0) { + WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) { }
void Allocate(int firstStyle_, int lenStyles_) { @@ -28,6 +29,10 @@ class WordClassifier { wordToStyle.clear(); }
+ int Base() const { + return baseStyle; + } + int Start() const { return firstStyle; } @@ -57,10 +62,12 @@ class WordClassifier { void SetIdentifiers(int style, const char *identifiers) { while (*identifiers) { const char *cpSpace = identifiers; - while (*cpSpace && *cpSpace != ' ') + while (*cpSpace && !(*cpSpace == ' ' || *cpSpace == '\t' || *cpSpace == '\r' || *cpSpace == '\n')) cpSpace++; - std::string word(identifiers, cpSpace - identifiers); - wordToStyle[word] = style; + if (cpSpace > identifiers) { + std::string word(identifiers, cpSpace - identifiers); + wordToStyle[word] = style; + } identifiers = cpSpace; if (*identifiers) identifiers++; @@ -105,8 +112,8 @@ class SubStyles { secondaryDistance(secondaryDistance_), allocated(0) { while (baseStyles[classifications]) { + classifiers.push_back(WordClassifier(baseStyles[classifications])); classifications++; - classifiers.push_back(WordClassifier()); } }
@@ -134,6 +141,14 @@ class SubStyles { return (block >= 0) ? classifiers[block].Length() : 0; }
+ int BaseStyle(int subStyle) const { + int block = BlockFromStyle(subStyle); + if (block >= 0) + return classifiers[block].Base(); + else + return subStyle; + } + int DistanceToSecondaryStyles() const { return secondaryDistance; }
Modified: scintilla/lexlib/WordList.cxx 40 files changed, 21 insertions(+), 19 deletions(-) =================================================================== @@ -32,11 +32,11 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa for (int i=0; i<256; i++) { wordSeparator[i] = false; } - wordSeparator['\r'] = true; - wordSeparator['\n'] = true; + wordSeparator[static_cast<unsigned int>('\r')] = true; + wordSeparator[static_cast<unsigned int>('\n')] = true; if (!onlyLineEnds) { - wordSeparator[' '] = true; - wordSeparator['\t'] = true; + wordSeparator[static_cast<unsigned int>(' ')] = true; + wordSeparator[static_cast<unsigned int>('\t')] = true; } for (int j = 0; wordlist[j]; j++) { int curr = static_cast<unsigned char>(wordlist[j]); @@ -45,22 +45,24 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa prev = curr; } char **keywords = new char *[words + 1]; - words = 0; - prev = '\0'; - size_t slen = strlen(wordlist); - for (size_t k = 0; k < slen; k++) { - if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) { - if (!prev) { - keywords[words] = &wordlist[k]; - words++; + int wordsStore = 0; + const size_t slen = strlen(wordlist); + if (words) { + prev = '\0'; + for (size_t k = 0; k < slen; k++) { + if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) { + if (!prev) { + keywords[wordsStore] = &wordlist[k]; + wordsStore++; + } + } else { + wordlist[k] = '\0'; } - } else { - wordlist[k] = '\0'; + prev = wordlist[k]; } - prev = wordlist[k]; } - keywords[words] = &wordlist[slen]; - *len = words; + keywords[wordsStore] = &wordlist[slen]; + *len = wordsStore; return keywords; }
@@ -161,7 +163,7 @@ bool WordList::InList(const char *s) const { j++; } } - j = starts['^']; + j = starts[static_cast<unsigned int>('^')]; if (j >= 0) { while (words[j][0] == '^') { const char *a = words[j] + 1; @@ -213,7 +215,7 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const { j++; } } - j = starts['^']; + j = starts[static_cast<unsigned int>('^')]; if (j >= 0) { while (words[j][0] == '^') { const char *a = words[j] + 1;
Modified: scintilla/scintilla_changes.patch 5 files changed, 3 insertions(+), 2 deletions(-) =================================================================== @@ -28,10 +28,10 @@ diff -Naur scintilla_orig/gtk/scintilla-marshal.c scintilla/gtk/scintilla-marsha { typedef void (*GMarshalFunc_VOID__INT_POINTER) (gpointer data1, diff --git b/scintilla/src/Catalogue.cxx a/scintilla/src/Catalogue.cxx -index 84d003e..37b2a3c 100644 +index e728f34..85116a5 100644 +++ scintilla/src/Catalogue.cxx --- scintilla/src/Catalogue.cxx -@@ -81,111 +81,47 @@ int Scintilla_LinkLexers() { +@@ -76,112 +76,47 @@ int Scintilla_LinkLexers() {
//++Autogenerated -- run scripts/LexGen.py to regenerate //**(\tLINK_LEXER(*);\n) @@ -121,6 +121,7 @@ index 84d003e..37b2a3c 100644 LINK_LEXER(lmR); - LINK_LEXER(lmREBOL); LINK_LEXER(lmRuby); +- LINK_LEXER(lmRust); - LINK_LEXER(lmScriptol); - LINK_LEXER(lmSmalltalk); - LINK_LEXER(lmSML);
Modified: scintilla/src/Document.cxx 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -279,7 +279,7 @@ int SCI_METHOD Document::LineStart(int line) const { }
int SCI_METHOD Document::LineEnd(int line) const { - if (line == LinesTotal() - 1) { + if (line >= LinesTotal() - 1) { return LineStart(line + 1); } else { int position = LineStart(line + 1);
Modified: scintilla/src/Editor.cxx 45 files changed, 27 insertions(+), 18 deletions(-) =================================================================== @@ -542,6 +542,9 @@ SelectionPosition Editor::SPositionFromLocation(Point pt, bool canReturnInvalid, RefreshStyleData(); if (canReturnInvalid) { PRectangle rcClient = GetTextRectangle(); + // May be in scroll view coordinates so translate back to main view + Point ptOrigin = GetVisibleOriginInMain(); + rcClient.Move(-ptOrigin.x, -ptOrigin.y); if (!rcClient.Contains(pt)) return SelectionPosition(INVALID_POSITION); if (pt.x < vs.textStart) @@ -720,6 +723,8 @@ void Editor::RedrawSelMargin(int line, bool allAfter) { rcSelMargin.top = rcLine.top; if (!allAfter) rcSelMargin.bottom = rcLine.bottom; + if (rcSelMargin.Empty()) + return; } if (wMargin.GetID()) { Point ptOrigin = GetVisibleOriginInMain(); @@ -4409,14 +4414,18 @@ void Editor::DelCharBack(bool allowLineStartDeletion) { ShowCaretAtCurrentPosition(); }
-void Editor::NotifyFocus(bool) {} +void Editor::NotifyFocus(bool focus) { + SCNotification scn = {}; + scn.nmhdr.code = focus ? SCN_FOCUSIN : SCN_FOCUSOUT; + NotifyParent(scn); +}
void Editor::SetCtrlID(int identifier) { ctrlID = identifier; }
void Editor::NotifyStyleToNeeded(int endStyleNeeded) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_STYLENEEDED; scn.position = endStyleNeeded; NotifyParent(scn); @@ -4434,14 +4443,14 @@ void Editor::NotifyErrorOccurred(Document *, void *, int status) { }
void Editor::NotifyChar(int ch) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_CHARADDED; scn.ch = ch; NotifyParent(scn); }
void Editor::NotifySavePoint(bool isSavePoint) { - SCNotification scn = {0}; + SCNotification scn = {}; if (isSavePoint) { scn.nmhdr.code = SCN_SAVEPOINTREACHED; } else { @@ -4451,13 +4460,13 @@ void Editor::NotifySavePoint(bool isSavePoint) { }
void Editor::NotifyModifyAttempt() { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_MODIFYATTEMPTRO; NotifyParent(scn); }
void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_DOUBLECLICK; scn.line = LineFromLocation(pt); scn.position = PositionFromLocation(pt, true); @@ -4467,7 +4476,7 @@ void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { }
void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; scn.position = position; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | @@ -4476,7 +4485,7 @@ void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, boo }
void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_HOTSPOTCLICK; scn.position = position; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | @@ -4485,7 +4494,7 @@ void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) }
void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK; scn.position = position; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | @@ -4495,7 +4504,7 @@ void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool
bool Editor::NotifyUpdateUI() { if (needUpdateUI) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_UPDATEUI; scn.updated = needUpdateUI; NotifyParent(scn); @@ -4506,7 +4515,7 @@ bool Editor::NotifyUpdateUI() { }
void Editor::NotifyPainted() { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_PAINTED; NotifyParent(scn); } @@ -4514,7 +4523,7 @@ void Editor::NotifyPainted() { void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt) { int mask = pdoc->decorations.AllOnFor(position); if ((click && mask) || pdoc->decorations.clickNotified) { - SCNotification scn = {0}; + SCNotification scn = {}; pdoc->decorations.clickNotified = click; scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0); @@ -4553,7 +4562,7 @@ bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { } return true; } - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_MARGINCLICK; scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0); @@ -4567,7 +4576,7 @@ bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { }
void Editor::NotifyNeedShown(int pos, int len) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_NEEDSHOWN; scn.position = pos; scn.length = len; @@ -4575,7 +4584,7 @@ void Editor::NotifyNeedShown(int pos, int len) { }
void Editor::NotifyDwelling(Point pt, bool state) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = state ? SCN_DWELLSTART : SCN_DWELLEND; scn.position = PositionFromLocation(pt, true); scn.x = pt.x + vs.ExternalMarginWidth(); @@ -4584,7 +4593,7 @@ void Editor::NotifyDwelling(Point pt, bool state) { }
void Editor::NotifyZoom() { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_ZOOM; NotifyParent(scn); } @@ -4776,7 +4785,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { NotifyChange(); // Send EN_CHANGE }
- SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_MODIFIED; scn.position = mh.position; scn.modificationType = mh.modificationType; @@ -4918,7 +4927,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar }
// Send notification - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_MACRORECORD; scn.message = iMessage; scn.wParam = wParam;
Modified: scintilla/src/ScintillaBase.cxx 30 files changed, 26 insertions(+), 4 deletions(-) =================================================================== @@ -289,7 +289,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
void ScintillaBase::AutoCompleteCancel() { if (ac.Active()) { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_AUTOCCANCELLED; scn.wParam = 0; scn.listType = 0; @@ -325,7 +325,7 @@ void ScintillaBase::AutoCompleteCharacterDeleted() { } else { AutoCompleteMoveToCurrentWord(); } - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_AUTOCCHARDELETED; scn.wParam = 0; scn.listType = 0; @@ -342,7 +342,7 @@ void ScintillaBase::AutoCompleteCompleted() {
ac.Show(false);
- SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION; scn.message = 0; scn.wParam = listType; @@ -434,7 +434,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) { }
void ScintillaBase::CallTipClick() { - SCNotification scn = {0}; + SCNotification scn = {}; scn.nmhdr.code = SCN_CALLTIPCLICK; scn.position = ct.clickPlace; NotifyParent(scn); @@ -503,6 +503,8 @@ class LexState : public LexInterface { int AllocateSubStyles(int styleBase, int numberStyles); int SubStylesStart(int styleBase); int SubStylesLength(int styleBase); + int StyleFromSubStyle(int subStyle); + int PrimaryStyleFromStyle(int style); void FreeSubStyles(); void SetIdentifiers(int style, const char *identifiers); int DistanceToSecondaryStyles(); @@ -678,6 +680,20 @@ int LexState::SubStylesLength(int styleBase) { return 0; }
+int LexState::StyleFromSubStyle(int subStyle) { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast<ILexerWithSubStyles *>(instance)->StyleFromSubStyle(subStyle); + } + return 0; +} + +int LexState::PrimaryStyleFromStyle(int style) { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast<ILexerWithSubStyles *>(instance)->PrimaryStyleFromStyle(style); + } + return 0; +} + void LexState::FreeSubStyles() { if (instance && (interfaceVersion >= lvSubStyles)) { static_cast<ILexerWithSubStyles *>(instance)->FreeSubStyles(); @@ -983,6 +999,12 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_GETSUBSTYLESLENGTH: return DocumentLexState()->SubStylesLength(wParam);
+ case SCI_GETSTYLEFROMSUBSTYLE: + return DocumentLexState()->StyleFromSubStyle(wParam); + + case SCI_GETPRIMARYSTYLEFROMSTYLE: + return DocumentLexState()->PrimaryStyleFromStyle(wParam); + case SCI_FREESUBSTYLES: DocumentLexState()->FreeSubStyles(); break;
Modified: scintilla/src/ScintillaBase.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -57,7 +57,7 @@ class ScintillaBase : public Editor { ScintillaBase(); virtual ~ScintillaBase(); virtual void Initialise() = 0; - virtual void Finalise() = 0; + virtual void Finalise();
virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); void Command(int cmdId);
Modified: scintilla/src/ViewStyle.cxx 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -324,7 +324,7 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { } maxAscent = 1; maxDescent = 1; - FindMaxAscentDescent(maxAscent, maxDescent); + FindMaxAscentDescent(); maxAscent += extraAscent; maxDescent += extraDescent; lineHeight = maxAscent + maxDescent; @@ -514,7 +514,7 @@ FontRealised *ViewStyle::Find(const FontSpecification &fs) { return 0; }
-void ViewStyle::FindMaxAscentDescent(unsigned int &maxAscent, unsigned int &maxDescent) { +void ViewStyle::FindMaxAscentDescent() { for (FontMap::const_iterator it = fonts.begin(); it != fonts.end(); ++it) { if (maxAscent < it->second->ascent) maxAscent = it->second->ascent;
Modified: scintilla/src/ViewStyle.h 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -180,7 +180,7 @@ class ViewStyle { void AllocStyles(size_t sizeNew); void CreateFont(const FontSpecification &fs); FontRealised *Find(const FontSpecification &fs); - void FindMaxAscentDescent(unsigned int &maxAscent, unsigned int &maxDescent); + void FindMaxAscentDescent(); // Private so can only be copied through copy constructor which ensures font names initialised correctly ViewStyle &operator=(const ViewStyle &); };
Modified: scintilla/version.txt 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1 +1 @@ -335 +336
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).