Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Tue, 21 Apr 2015 14:21:37 UTC Commit: 10a04f71c372734f6bfec3d7a04e4e4064cfbe14 https://github.com/geany/geany/commit/10a04f71c372734f6bfec3d7a04e4e4064cfbe...
Log Message: ----------- Update Scintilla to version 3.5.5
Modified Paths: -------------- scintilla/gtk/ScintillaGTK.cxx scintilla/include/Platform.h scintilla/include/Scintilla.h scintilla/include/Scintilla.iface scintilla/lexers/LexSQL.cxx scintilla/lexers/LexTCL.cxx scintilla/lexers/LexVHDL.cxx scintilla/lexers/LexVerilog.cxx scintilla/lexlib/SubStyles.h scintilla/src/AutoComplete.cxx scintilla/src/EditView.cxx scintilla/src/EditView.h scintilla/src/Editor.cxx scintilla/src/Style.cxx scintilla/version.txt
Modified: scintilla/gtk/ScintillaGTK.cxx 13 lines changed, 7 insertions(+), 6 deletions(-) =================================================================== @@ -160,6 +160,7 @@ class ScintillaGTK : public ScintillaBase { Window wPreedit; Window wPreeditDraw; GtkIMContext *im_context; + PangoScript lastNonCommonScript;
// Wheel mouse support unsigned int linesPerScroll; @@ -397,7 +398,7 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : verticalScrollBarWidth(30), horizontalScrollBarHeight(30), evbtn(0), capturedMouse(false), dragWasDropped(false), lastKey(0), rectangularSelectionModifier(SCMOD_CTRL), parentClass(0), - im_context(NULL), + im_context(NULL), lastNonCommonScript(PANGO_SCRIPT_INVALID_CODE), lastWheelMouseDirection(0), wheelMouseIntensity(0), rgnUpdate(0), @@ -2359,10 +2360,10 @@ gboolean ScintillaGTK::ExposePreedit(GtkWidget *widget, GdkEventExpose *ose, Sci #endif
bool ScintillaGTK::KoreanIME() { - PreEditString preeditStr(im_context); - PangoLanguage *pLang = pango_language_from_string("ko-KR"); // RFC-3066 - bool koreanIme = pango_language_includes_script(pLang, preeditStr.pscript); - return koreanIme; + PreEditString pes(im_context); + if (pes.pscript != PANGO_SCRIPT_COMMON) + lastNonCommonScript = pes.pscript; + return lastNonCommonScript == PANGO_SCRIPT_HANGUL; }
void ScintillaGTK::MoveImeCarets(int pos) { @@ -2622,7 +2623,7 @@ void ScintillaGTK::PreeditChangedWindowedThis() { }
void ScintillaGTK::PreeditChanged(GtkIMContext *, ScintillaGTK *sciThis) { - if (sciThis->imeInteraction == imeInline) { + if ((sciThis->imeInteraction == imeInline) || (sciThis->KoreanIME())) { sciThis->PreeditChangedInlineThis(); } else { sciThis->PreeditChangedWindowedThis();
Modified: scintilla/include/Platform.h 6 lines changed, 0 insertions(+), 6 deletions(-) =================================================================== @@ -271,9 +271,6 @@ struct FontParameters { class Font { protected: FontID fid; -#if PLAT_WX - int ascent; -#endif // Private so Font objects can not be copied Font(const Font &); Font &operator=(const Font &); @@ -287,9 +284,6 @@ class Font { FontID GetID() { return fid; } // Alias another font - caller guarantees not to Release void SetID(FontID fid_) { fid = fid_; } -#if PLAT_WX - void SetAscent(int ascent_) { ascent = ascent_; } -#endif friend class Surface; friend class SurfaceImpl; };
Modified: scintilla/include/Scintilla.h 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -797,8 +797,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETCHARACTERPOINTER 2520 #define SCI_GETRANGEPOINTER 2643 #define SCI_GETGAPPOSITION 2644 -#define SCI_SETKEYSUNICODE 2521 -#define SCI_GETKEYSUNICODE 2522 #define SCI_INDICSETALPHA 2523 #define SCI_INDICGETALPHA 2524 #define SCI_INDICSETOUTLINEALPHA 2558 @@ -1157,6 +1155,8 @@ struct SCNotification { #define SC_CP_DBCS 1 #define SCI_SETUSEPALETTE 2039 #define SCI_GETUSEPALETTE 2139 +#define SCI_SETKEYSUNICODE 2521 +#define SCI_GETKEYSUNICODE 2522
#endif
Modified: scintilla/include/Scintilla.iface 40 lines changed, 28 insertions(+), 12 deletions(-) =================================================================== @@ -72,11 +72,11 @@
## Line numbers and positions start at 0. ## String arguments may contain NUL ('\0') characters where the calls provide a length -## argument and retrieve NUL characters. All retrieved strings except for those retrieved -## by GetLine also have a NUL appended but client code should calculate the size that -## will be returned rather than relying upon the NUL whenever possible. Allow for the -## extra NUL character when allocating buffers. The size to allocate for a stringresult -## can be determined by calling with a NULL (0) pointer. +## argument and retrieve NUL characters. APIs marked as NUL-terminated also have a +## NUL appended but client code should calculate the size that will be returned rather +## than relying upon the NUL whenever possible. Allow for the extra NUL character when +## allocating buffers. The size to allocate for a stringresult (not including NUL) can be +## determined by calling with a NULL (0) pointer.
cat Basics
@@ -186,6 +186,7 @@ set void SetAnchor=2026(position posAnchor,)
# Retrieve the text of the line containing the caret. # Returns the index of the caret on the line. +# Result is NUL-terminated. fun int GetCurLine=2027(int length, stringresult text)
# Retrieve the position of the last correctly styled character. @@ -479,6 +480,7 @@ get int StyleGetSize=2485(int style,)
# Get the font of a style. # Returns the length of the fontName +# Result is NUL-terminated. get int StyleGetFont=2486(int style, stringresult fontName)
# Get is a style to have its end of line filled or not. @@ -578,7 +580,7 @@ set void SetCaretPeriod=2076(int periodMilliseconds,) set void SetWordChars=2077(, string characters)
# Get the set of characters making up words for when moving or selecting by word. -# Retuns the number of characters +# Returns the number of characters get int GetWordChars=2646(, stringresult characters)
# Start a sequence of actions that is undone and redone as a unit. @@ -951,6 +953,7 @@ fun void SetSel=2160(position start, position end)
# Retrieve the selected text. # Return the length of the text. +# Result is NUL-terminated. fun int GetSelText=2161(, stringresult text)
# Retrieve a range of text. @@ -1021,6 +1024,7 @@ fun void SetText=2181(, string text)
# Retrieve all the text in the document. # Returns number of characters retrieved. +# Result is NUL-terminated. fun int GetText=2182(int length, stringresult text)
# Retrieve the number of characters in the document. @@ -1396,6 +1400,7 @@ set void SetMultiPaste=2614(int multiPaste,) get int GetMultiPaste=2615(,)
# Retrieve the value of a tag from a regular expression search. +# Result is NUL-terminated. get int GetTag=2616(int tagNumber, stringresult tagValue)
# Make the target range start and end be the same as the selection range start and end. @@ -1943,6 +1948,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)
enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_ @@ -2092,12 +2098,6 @@ get int GetRangePointer=2643(int position, int rangeLength) # the range of a call to GetRangePointer. get position GetGapPosition=2644(,)
-# Always interpret keyboard input as Unicode -set void SetKeysUnicode=2521(bool keysUnicode,) - -# Are keys always interpreted as Unicode? -get bool GetKeysUnicode=2522(,) - # Set the alpha fill colour of the given indicator. set void IndicSetAlpha=2523(int indicator, int alpha)
@@ -2452,6 +2452,7 @@ get int GetLineEndTypesActive=2658(,) set void SetRepresentation=2665(string encodedCharacter, string representation)
# Set the way a character is drawn. +# Result is NUL-terminated. get int GetRepresentation=2666(string encodedCharacter, stringresult representation)
# Remove a character representation. @@ -2488,10 +2489,12 @@ set void SetLexerLanguage=4006(, string language) 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)
# 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)
# Retrieve a "property" value previously set with SetProperty, @@ -2503,12 +2506,14 @@ 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)
# For private communication between an application and a known lexer. fun int PrivateLexerCall=4013(int operation, int pointer)
# Retrieve a '\n' separated list of properties understood by the current lexer. +# Result is NUL-terminated. fun int PropertyNames=4014(, stringresult names)
enu TypeProperty=SC_TYPE_ @@ -2520,9 +2525,11 @@ val SC_TYPE_STRING=2 fun int PropertyType=4015(string name,)
# Describe a property. +# Result is NUL-terminated. fun int DescribeProperty=4016(string name, stringresult description)
# Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. +# Result is NUL-terminated. fun int DescribeKeyWordSets=4017(, stringresult descriptions)
# Bit set of LineEndType enumertion for which line ends beyond the standard @@ -2555,6 +2562,7 @@ set void SetIdentifiers=4024(int style, string identifiers) get int DistanceToSecondaryStyles=4025(,)
# Get the set of base styles that can be extended with sub styles +# Result is NUL-terminated. get int GetSubStyleBases=4026(, stringresult styles)
# Notifications @@ -4660,3 +4668,11 @@ get bool GetUsePalette=2139(,) # In palette mode, Scintilla uses the environment's palette calls to display # more colours. This may lead to ugly displays. set void SetUsePalette=2039(bool usePalette,) + +# Deprecated in 3.5.5 + +# Always interpret keyboard input as Unicode +set void SetKeysUnicode=2521(bool keysUnicode,) + +# Are keys always interpreted as Unicode? +get bool GetKeysUnicode=2522(,)
Modified: scintilla/lexers/LexSQL.cxx 9 lines changed, 5 insertions(+), 4 deletions(-) =================================================================== @@ -54,12 +54,12 @@ static inline bool IsADoxygenChar(int ch) { ch == '}' || ch == '[' || ch == ']'); }
-static inline bool IsANumberChar(int ch) { +static inline bool IsANumberChar(int ch, int chPrev) { // Not exactly following number definition (several dots are seen as OK, etc.) // but probably enough in most cases. return (ch < 0x80) && (isdigit(ch) || toupper(ch) == 'E' || - ch == '.' || ch == '-' || ch == '+'); + ch == '.' || ((ch == '-' || ch == '+') && chPrev < 0x80 && toupper(chPrev) == 'E')); }
typedef unsigned int sql_state_t; @@ -453,7 +453,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, break; case SCE_SQL_NUMBER: // We stop the number definition on non-numerical non-dot non-eE non-sign char - if (!IsANumberChar(sc.ch)) { + if (!IsANumberChar(sc.ch, sc.chPrev)) { sc.SetState(SCE_SQL_DEFAULT); } break; @@ -594,7 +594,8 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, if (sc.Match('q', ''') || sc.Match('Q', ''')) { sc.SetState(SCE_SQL_QOPERATOR); sc.Forward(); - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) || + ((sc.ch == '-' || sc.ch == '+') && IsADigit(sc.chNext) && !IsADigit(sc.chPrev))) { sc.SetState(SCE_SQL_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_SQL_IDENTIFIER);
Modified: scintilla/lexers/LexTCL.cxx 7 lines changed, 2 insertions(+), 5 deletions(-) =================================================================== @@ -257,7 +257,7 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k sc.ForwardSetState(SCE_TCL_DEFAULT); visibleChars = true; // necessary if a " is the first and only character on a line goto next; - } else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$' || sc.ch == '(') { + } else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') { sc.SetState(SCE_TCL_OPERATOR); expected = sc.ch == '['; sc.ForwardSetState(SCE_TCL_IN_QUOTE); @@ -324,10 +324,7 @@ static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *k break; case '$': subParen = 0; - if (sc.chNext == '(') { - //$("") jquery selector?! - sc.SetState(SCE_TCL_OPERATOR); - } else if (sc.chNext != '{') { + if (sc.chNext != '{') { sc.SetState(SCE_TCL_SUBSTITUTION); } else { sc.SetState(SCE_TCL_OPERATOR); // $
Modified: scintilla/lexers/LexVHDL.cxx 10 lines changed, 9 insertions(+), 1 deletions(-) =================================================================== @@ -72,6 +72,7 @@ static void ColouriseVHDLDoc( WordList &User = *keywordlists[6];
StyleContext sc(startPos, length, initStyle, styler); + bool isExtendedId = false; // true when parsing an extended identifier
for (; sc.More(); sc.Forward()) { @@ -84,7 +85,7 @@ static void ColouriseVHDLDoc( sc.SetState(SCE_VHDL_DEFAULT); } } else if (sc.state == SCE_VHDL_IDENTIFIER) { - if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { + if (!isExtendedId && (!IsAWordChar(sc.ch) || (sc.ch == '.'))) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (Keywords.InList(s)) { @@ -103,6 +104,10 @@ static void ColouriseVHDLDoc( sc.ChangeState(SCE_VHDL_USERWORD); } sc.SetState(SCE_VHDL_DEFAULT); + } else if (isExtendedId && ((sc.ch == '\') || sc.atLineEnd)) { + // extended identifiers are terminated by backslash, check for end of line in case we have invalid syntax + isExtendedId = false; + sc.ForwardSetState(SCE_VHDL_DEFAULT); } } else if (sc.state == SCE_VHDL_COMMENT || sc.state == SCE_VHDL_COMMENTLINEBANG) { if (sc.atLineEnd) { @@ -141,6 +146,9 @@ static void ColouriseVHDLDoc( sc.SetState(SCE_VHDL_BLOCK_COMMENT); } else if (sc.ch == '"') { sc.SetState(SCE_VHDL_STRING); + } else if (sc.ch == '\') { + isExtendedId = true; + sc.SetState(SCE_VHDL_IDENTIFIER); } else if (isoperator(static_cast<char>(sc.ch))) { sc.SetState(SCE_VHDL_OPERATOR); }
Modified: scintilla/lexers/LexVerilog.cxx 43 lines changed, 37 insertions(+), 6 deletions(-) =================================================================== @@ -118,6 +118,7 @@ class PPStates { struct OptionsVerilog { bool foldComment; bool foldPreprocessor; + bool foldPreprocessorElse; bool foldCompact; bool foldAtElse; bool foldAtModule; @@ -128,6 +129,7 @@ struct OptionsVerilog { OptionsVerilog() { foldComment = false; foldPreprocessor = false; + foldPreprocessorElse = false; foldCompact = false; foldAtElse = false; foldAtModule = false; @@ -161,6 +163,8 @@ struct OptionSetVerilog : public OptionSet<OptionsVerilog> { "Set to 1 to style input, output, and inout ports differently from regular keywords."); DefineProperty("lexer.verilog.allupperkeywords", &OptionsVerilog::allUppercaseDocKeyword, "Set to 1 to style identifiers that are all uppercase as documentation keyword."); + DefineProperty("lexer.verilog.fold.preprocessor.else", &OptionsVerilog::foldPreprocessorElse, + "This option enables folding on `else and `elsif preprocessor directives."); } };
@@ -342,7 +346,7 @@ int SCI_METHOD LexerVerilog::WordListSet(int n, const char *wl) { }
static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '''|| ch == '$'); + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '''|| ch == '$'); }
static inline bool IsAWordStart(const int ch) { @@ -549,7 +553,7 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty } break; case SCE_V_PREPROCESSOR: - if (!IsAWordChar(sc.ch) && !sc.atLineEnd) { + if (!IsAWordChar(sc.ch) || sc.atLineEnd) { sc.SetState(SCE_V_DEFAULT|activitySet); } break; @@ -852,8 +856,29 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt j++; } if (styler.Match(j, "if")) { + if (options.foldPreprocessorElse) { + // Measure the minimum before a begin to allow + // folding on "end else begin" + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + } + levelNext++; + } else if (options.foldPreprocessorElse && styler.Match(j, "else")) { + levelNext--; + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } levelNext++; - } else if (styler.Match(j, "end")) { + } else if (options.foldPreprocessorElse && styler.Match(j, "elsif")) { + levelNext--; + // Measure the minimum before a begin to allow + // folding on "end else begin" + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + levelNext++; + } else if (styler.Match(j, "endif")) { levelNext--; } } @@ -913,8 +938,14 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt styler.Match(j, "specify") || styler.Match(j, "table") || styler.Match(j, "task") || - (styler.Match(j, "module") && options.foldAtModule) || - styler.Match(j, "begin")) { + (styler.Match(j, "module") && options.foldAtModule)) { + levelNext++; + } else if (styler.Match(j, "begin")) { + // Measure the minimum before a begin to allow + // folding on "end else begin" + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } levelNext++; } else if (styler.Match(j, "class")) { // class does not introduce a block when used in a typedef statement @@ -958,7 +989,7 @@ void SCI_METHOD LexerVerilog::Fold(unsigned int startPos, int length, int initSt } if (atEOL) { int levelUse = levelCurrent; - if (options.foldAtElse) { + if (options.foldAtElse||options.foldPreprocessorElse) { levelUse = levelMinCurrent; } int lev = levelUse | levelNext << 16;
Modified: scintilla/lexlib/SubStyles.h 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -166,7 +166,8 @@ class SubStyles { }
const WordClassifier &Classifier(int baseStyle) const { - return classifiers[BlockFromBaseStyle(baseStyle)]; + const int block = BlockFromBaseStyle(baseStyle); + return classifiers[block >= 0 ? block : 0]; } };
Modified: scintilla/src/AutoComplete.cxx 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -167,7 +167,9 @@ void AutoComplete::SetList(const char *list) { char item[maxItemLen]; for (size_t i = 0; i < sortMatrix.size(); ++i) { int wordLen = IndexSort.indices[sortMatrix[i] * 2 + 2] - IndexSort.indices[sortMatrix[i] * 2]; - strncpy(item, list + IndexSort.indices[sortMatrix[i] * 2], wordLen); + if (wordLen > maxItemLen-2) + wordLen = maxItemLen - 2; + memcpy(item, list + IndexSort.indices[sortMatrix[i] * 2], wordLen); if ((i+1) == sortMatrix.size()) { // Last item so remove separator if present if ((wordLen > 0) && (item[wordLen-1] == separator))
Modified: scintilla/src/EditView.cxx 5 lines changed, 3 insertions(+), 2 deletions(-) =================================================================== @@ -173,6 +173,7 @@ const XYPOSITION epsilon = 0.0001f; // A small nudge to avoid floating point pre
EditView::EditView() { ldTabstops = NULL; + tabWidthMinimumPixels = 2; // needed for calculating tab stops for fractional proportional fonts hideSelection = false; drawOverstrikeCaret = true; bufferedDraw = true; @@ -220,10 +221,10 @@ void EditView::ClearAllTabstops() { }
XYPOSITION EditView::NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const { - int next = GetNextTabstop(line, static_cast<int>(x + 2)); + int next = GetNextTabstop(line, static_cast<int>(x + tabWidthMinimumPixels)); if (next > 0) return static_cast<XYPOSITION>(next); - return (static_cast<int>((x + 2) / tabWidth) + 1) * tabWidth; + return (static_cast<int>((x + tabWidthMinimumPixels) / tabWidth) + 1) * tabWidth; }
bool EditView::ClearTabstops(int line) {
Modified: scintilla/src/EditView.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -51,6 +51,7 @@ class EditView { public: PrintParameters printParameters; PerLine *ldTabstops; + int tabWidthMinimumPixels;
bool hideSelection; bool drawOverstrikeCaret;
Modified: scintilla/src/Editor.cxx 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -2056,6 +2056,7 @@ void Editor::PasteRectangular(SelectionPosition pos, const char *ptr, int len) { sel.RangeMain().caret.SetPosition(PositionFromLineX(line, xInsert)); if ((XFromPosition(sel.MainCaret()) < xInsert) && (i + 1 < len)) { while (XFromPosition(sel.MainCaret()) < xInsert) { + assert(pdoc); const int lengthInserted = pdoc->InsertString(sel.MainCaret(), " ", 1); sel.RangeMain().caret.Add(lengthInserted); } @@ -6226,6 +6227,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return TextWidth(static_cast<int>(wParam), CharPtrFromSPtr(lParam));
case SCI_TEXTHEIGHT: + RefreshStyleData(); return vs.lineHeight;
case SCI_SETENDATLASTLINE:
Modified: scintilla/src/Style.cxx 3 lines changed, 0 insertions(+), 3 deletions(-) =================================================================== @@ -163,8 +163,5 @@ void Style::ClearTo(const Style &source) {
void Style::Copy(Font &font_, const FontMeasurements &fm_) { font.MakeAlias(font_); -#if PLAT_WX - font.SetAscent(fm_.ascent); -#endif (FontMeasurements &)(*this) = fm_; }
Modified: scintilla/version.txt 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1 +1 @@ -354 +355
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).