Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 13 Mar 2016 14:50:36 UTC Commit: 24f91981c057a7e212c09da66fb974c3ccc85bd6 https://github.com/geany/geany/commit/24f91981c057a7e212c09da66fb974c3ccc85b...
Log Message: ----------- Update Scintilla to version 3.6.4
Modified Paths: -------------- scintilla/gtk/ScintillaGTK.cxx scintilla/include/ScintillaWidget.h scintilla/lexers/LexCPP.cxx scintilla/lexers/LexHTML.cxx scintilla/lexers/LexRuby.cxx scintilla/lexers/LexRust.cxx scintilla/scintilla_changes.patch scintilla/src/Document.cxx scintilla/src/Document.h scintilla/src/EditView.cxx scintilla/src/Editor.cxx scintilla/src/MarginView.cxx scintilla/version.txt
Modified: scintilla/gtk/ScintillaGTK.cxx 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -2485,7 +2485,9 @@ void ScintillaGTK::PreeditChangedInlineThis() { MoveImeCarets( - (imeCharPos[preeditStr.uniStrLen]) + imeCharPos[preeditStr.cursor_pos]);
if (KoreanIME()) { +#if !PLAT_GTK_WIN32 MoveImeCarets( - imeCharPos[1]); // always 2 bytes for DBCS or 3 bytes for UTF8. +#endif view.imeCaretBlockOverride = true; }
@@ -3053,7 +3055,7 @@ sptr_t scintilla_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_ }
GEANY_API_SYMBOL -sptr_t scintilla_object_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { +gintptr scintilla_object_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return scintilla_send_message(sci, iMessage, wParam, lParam); }
Modified: scintilla/include/ScintillaWidget.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -44,7 +44,7 @@ struct _ScintillaClass {
GType scintilla_object_get_type (void); GtkWidget* scintilla_object_new (void); -long scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam); +gintptr scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam);
#ifndef G_IR_SCANNING /* The legacy names confuse the g-ir-scanner program */
Modified: scintilla/lexers/LexCPP.cxx 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -1349,14 +1349,14 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int } } if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) { - if (ch == '{' || ch == '[') { + if (ch == '{' || ch == '[' || ch == '(') { // Measure the minimum before a '{' to allow // folding on "} else {" if (levelMinCurrent > levelNext) { levelMinCurrent = levelNext; } levelNext++; - } else if (ch == '}' || ch == ']') { + } else if (ch == '}' || ch == ']' || ch == ')') { levelNext--; } }
Modified: scintilla/lexers/LexHTML.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -828,7 +828,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i // handle end of Mako comment line else if (isMako && makoComment && (ch == '\r' || ch == '\n')) { makoComment = 0; - styler.ColourTo(i, StateToPrint); + styler.ColourTo(i - 1, StateToPrint); if (scriptLanguage == eScriptPython) { state = SCE_HP_DEFAULT; } else {
Modified: scintilla/lexers/LexRuby.cxx 46 lines changed, 45 insertions(+), 1 deletions(-) =================================================================== @@ -433,6 +433,32 @@ static bool haveTargetMatch(Sci_Position currPos, return true; }
+// Finds the start position of the expression containing @p pos +// @p min_pos should be a known expression start, e.g. the start of the line +static Sci_Position findExpressionStart(Sci_Position pos, + Sci_Position min_pos, + Accessor &styler) { + int depth = 0; + for (; pos > min_pos; pos -= 1) { + int style = styler.StyleAt(pos - 1); + if (style == SCE_RB_OPERATOR) { + int ch = styler[pos - 1]; + if (ch == '}' || ch == ')' || ch == ']') { + depth += 1; + } else if (ch == '{' || ch == '(' || ch == '[') { + if (depth == 0) { + break; + } else { + depth -= 1; + } + } else if (ch == ';' && depth == 0) { + break; + } + } + } + return pos; +} + // We need a check because the form // [identifier] <<[target] // is ambiguous. The Ruby lexer/parser resolves it by @@ -458,14 +484,18 @@ static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, const bool definitely_not_a_here_doc = true; const bool looks_like_a_here_doc = false;
+ // find the expression start rather than the line start + Sci_Position exprStartPosn = findExpressionStart(lt2StartPos, lineStartPosn, styler); + // Find the first word after some whitespace - Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler); + Sci_Position firstWordPosn = skipWhitespace(exprStartPosn, lt2StartPos, styler); if (firstWordPosn >= lt2StartPos) { return definitely_not_a_here_doc; } prevStyle = styler.StyleAt(firstWordPosn); // If we have '<<' following a keyword, it's not a heredoc if (prevStyle != SCE_RB_IDENTIFIER + && prevStyle != SCE_RB_SYMBOL && prevStyle != SCE_RB_INSTANCE_VAR && prevStyle != SCE_RB_CLASS_VAR) { return definitely_not_a_here_doc; @@ -503,6 +533,16 @@ static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, } // Skip next batch of white-space firstWordPosn = skipWhitespace(firstWordPosn, lt2StartPos, styler); + // possible symbol for an implicit hash argument + if (firstWordPosn < lt2StartPos && styler.StyleAt(firstWordPosn) == SCE_RB_SYMBOL) { + for (; firstWordPosn <= lt2StartPos; firstWordPosn += 1) { + if (styler.StyleAt(firstWordPosn) != SCE_RB_SYMBOL) { + break; + } + } + // Skip next batch of white-space + firstWordPosn = skipWhitespace(firstWordPosn, lt2StartPos, styler); + } if (firstWordPosn != lt2StartPos) { // Have [[^ws[identifier]ws[*something_else*]ws<< return definitely_not_a_here_doc; @@ -1088,6 +1128,10 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init // <name>= is a name only when being def'd -- Get it the next time // This means that <name>=<name> is always lexed as // <name>, (op, =), <name> + } else if (ch == ':' + && isSafeWordcharOrHigh(chPrev) + && strchr(" \t\n\r", chNext) != NULL) { + state = SCE_RB_SYMBOL; } else if ((ch == '?' || ch == '!') && isSafeWordcharOrHigh(chPrev) && !isSafeWordcharOrHigh(chNext)) {
Modified: scintilla/lexers/LexRust.cxx 26 lines changed, 24 insertions(+), 2 deletions(-) =================================================================== @@ -407,7 +407,18 @@ static void ScanCharacterLiteralOrLifetime(Accessor &styler, Sci_Position& pos, valid_char = ScanNumericEscape(styler, pos, 2, false); } else if (n == 'u' && !ascii_only) { pos += 2; - valid_char = ScanNumericEscape(styler, pos, 4, false); + if (styler.SafeGetCharAt(pos, '\0') != '{') { + // old-style + valid_char = ScanNumericEscape(styler, pos, 4, false); + } else { + int n_digits = 0; + while (IsADigit(styler.SafeGetCharAt(++pos, '\0'), 16) && n_digits++ < 6) { + } + if (n_digits > 0 && styler.SafeGetCharAt(pos, '\0') == '}') + pos++; + else + valid_char = false; + } } else if (n == 'U' && !ascii_only) { pos += 2; valid_char = ScanNumericEscape(styler, pos, 8, false); @@ -579,7 +590,18 @@ static void ResumeString(Accessor &styler, Sci_Position& pos, Sci_Position max, error = !ScanNumericEscape(styler, pos, 2, true); } else if (n == 'u' && !ascii_only) { pos += 2; - error = !ScanNumericEscape(styler, pos, 4, true); + if (styler.SafeGetCharAt(pos, '\0') != '{') { + // old-style + error = !ScanNumericEscape(styler, pos, 4, true); + } else { + int n_digits = 0; + while (IsADigit(styler.SafeGetCharAt(++pos, '\0'), 16) && n_digits++ < 6) { + } + if (n_digits > 0 && styler.SafeGetCharAt(pos, '\0') == '}') + pos++; + else + error = true; + } } else if (n == 'U' && !ascii_only) { pos += 2; error = !ScanNumericEscape(styler, pos, 8, true);
Modified: scintilla/scintilla_changes.patch 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -15,7 +15,7 @@ index 0871ca2..49dc278 100644 }
+GEANY_API_SYMBOL - sptr_t scintilla_object_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + gintptr scintilla_object_send_message(ScintillaObject *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return scintilla_send_message(sci, iMessage, wParam, lParam); } @@ -3062,6 +3064,7 @@ extern void Platform_Initialise();
Modified: scintilla/src/Document.cxx 36 lines changed, 18 insertions(+), 18 deletions(-) =================================================================== @@ -436,12 +436,12 @@ static bool IsSubordinate(int levelStart, int levelTry) { if (levelTry & SC_FOLDLEVELWHITEFLAG) return true; else - return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK); + return LevelNumber(levelStart) < LevelNumber(levelTry); }
int Document::GetLastChild(int lineParent, int level, int lastLine) { if (level == -1) - level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK; + level = LevelNumber(GetLevel(lineParent)); int maxLine = LinesTotal(); int lookLastLine = (lastLine != -1) ? Platform::Minimum(LinesTotal() - 1, lastLine) : -1; int lineMaxSubord = lineParent; @@ -454,7 +454,7 @@ int Document::GetLastChild(int lineParent, int level, int lastLine) { lineMaxSubord++; } if (lineMaxSubord > lineParent) { - if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) { + if (level > LevelNumber(GetLevel(lineMaxSubord + 1))) { // Have chewed up some whitespace that belongs to a parent so seek back if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) { lineMaxSubord--; @@ -465,16 +465,16 @@ int Document::GetLastChild(int lineParent, int level, int lastLine) { }
int Document::GetFoldParent(int line) const { - int level = GetLevel(line) & SC_FOLDLEVELNUMBERMASK; + int level = LevelNumber(GetLevel(line)); int lineLook = line - 1; while ((lineLook > 0) && ( (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || - ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level)) + (LevelNumber(GetLevel(lineLook)) >= level)) ) { lineLook--; } if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) && - ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) { + (LevelNumber(GetLevel(lineLook)) < level)) { return lineLook; } else { return -1; @@ -487,11 +487,11 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in
int lookLine = line; int lookLineLevel = level; - int lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + int lookLineLevelNum = LevelNumber(lookLineLevel); while ((lookLine > 0) && ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || - ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum >= (GetLevel(lookLine + 1) & SC_FOLDLEVELNUMBERMASK))))) { + ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum >= LevelNumber(GetLevel(lookLine + 1)))))) { lookLineLevel = GetLevel(--lookLine); - lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + lookLineLevelNum = LevelNumber(lookLineLevel); }
int beginFoldBlock = (lookLineLevel & SC_FOLDLEVELHEADERFLAG) ? lookLine : GetFoldParent(lookLine); @@ -505,7 +505,7 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in if (endFoldBlock < line) { lookLine = beginFoldBlock - 1; lookLineLevel = GetLevel(lookLine); - lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + lookLineLevelNum = LevelNumber(lookLineLevel); while ((lookLine >= 0) && (lookLineLevelNum >= SC_FOLDLEVELBASE)) { if (lookLineLevel & SC_FOLDLEVELHEADERFLAG) { if (GetLastChild(lookLine, -1, lookLastLine) == line) { @@ -514,17 +514,17 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in firstChangeableLineBefore = line - 1; } } - if ((lookLine > 0) && (lookLineLevelNum == SC_FOLDLEVELBASE) && ((GetLevel(lookLine - 1) & SC_FOLDLEVELNUMBERMASK) > lookLineLevelNum)) + if ((lookLine > 0) && (lookLineLevelNum == SC_FOLDLEVELBASE) && (LevelNumber(GetLevel(lookLine - 1)) > lookLineLevelNum)) break; lookLineLevel = GetLevel(--lookLine); - lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + lookLineLevelNum = LevelNumber(lookLineLevel); } } if (firstChangeableLineBefore == -1) { - for (lookLine = line - 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + for (lookLine = line - 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel); lookLine >= beginFoldBlock; - lookLineLevel = GetLevel(--lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK) { - if ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || (lookLineLevelNum > (level & SC_FOLDLEVELNUMBERMASK))) { + lookLineLevel = GetLevel(--lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) { + if ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || (lookLineLevelNum > LevelNumber(level))) { firstChangeableLineBefore = lookLine; break; } @@ -534,10 +534,10 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in firstChangeableLineBefore = beginFoldBlock - 1;
int firstChangeableLineAfter = -1; - for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel); lookLine <= endFoldBlock; - lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK) { - if ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum < (GetLevel(lookLine + 1) & SC_FOLDLEVELNUMBERMASK))) { + lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) { + if ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum < LevelNumber(GetLevel(lookLine + 1)))) { firstChangeableLineAfter = lookLine; break; }
Modified: scintilla/src/Document.h 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -171,6 +171,10 @@ class HighlightDelimiter {
class Document;
+inline int LevelNumber(int level) { + return level & SC_FOLDLEVELNUMBERMASK; +} + class LexInterface { protected: Document *pdoc;
Modified: scintilla/src/EditView.cxx 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1744,7 +1744,7 @@ static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewSt const int level = model.pdoc->GetLevel(line); const int levelNext = model.pdoc->GetLevel(line + 1); if ((level & SC_FOLDLEVELHEADERFLAG) && - ((level & SC_FOLDLEVELNUMBERMASK) < (levelNext & SC_FOLDLEVELNUMBERMASK))) { + (LevelNumber(level) < LevelNumber(levelNext))) { // Paint the line above the fold if ((expanded && (model.foldFlags & SC_FOLDFLAG_LINEBEFORE_EXPANDED)) ||
Modified: scintilla/src/Editor.cxx 23 lines changed, 20 insertions(+), 3 deletions(-) =================================================================== @@ -5292,7 +5292,7 @@ void Editor::FoldExpand(int line, int action, int level) { if (expanding && (cs.HiddenLines() == 0)) // Nothing to do return; - int lineMaxSubord = pdoc->GetLastChild(line, level & SC_FOLDLEVELNUMBERMASK); + int lineMaxSubord = pdoc->GetLastChild(line, LevelNumber(level)); line++; cs.SetVisible(line, lineMaxSubord, expanding); while (line <= lineMaxSubord) { @@ -5399,7 +5399,7 @@ void Editor::FoldAll(int action) { for (int line = 0; line < maxLine; line++) { int level = pdoc->GetLevel(line); if ((level & SC_FOLDLEVELHEADERFLAG) && - (SC_FOLDLEVELBASE == (level & SC_FOLDLEVELNUMBERMASK))) { + (SC_FOLDLEVELBASE == LevelNumber(level))) { SetFoldExpanded(line, false); int lineMaxSubord = pdoc->GetLastChild(line, -1); if (lineMaxSubord > line) { @@ -5422,17 +5422,25 @@ void Editor::FoldChanged(int line, int levelNow, int levelPrev) { FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev); } } else if (levelPrev & SC_FOLDLEVELHEADERFLAG) { + const int prevLine = line - 1; + const int prevLineLevel = pdoc->GetLevel(prevLine); + + // Combining two blocks where the first block is collapsed (e.g. by deleting the line(s) which separate(s) the two blocks) + if ((LevelNumber(prevLineLevel) == LevelNumber(levelNow)) && !cs.GetVisible(prevLine)) + FoldLine(pdoc->GetFoldParent(prevLine), SC_FOLDACTION_EXPAND); + if (!cs.GetExpanded(line)) { // Removing the fold from one that has been contracted so should expand // otherwise lines are left invisible with no way to make them visible if (cs.SetExpanded(line, true)) { RedrawSelMargin(); } + // Combining two blocks where the second one is collapsed (e.g. by adding characters in the line which separates the two blocks) FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev); } } if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && - ((levelPrev & SC_FOLDLEVELNUMBERMASK) > (levelNow & SC_FOLDLEVELNUMBERMASK))) { + (LevelNumber(levelPrev) > LevelNumber(levelNow))) { if (cs.HiddenLines()) { // See if should still be hidden int parentLine = pdoc->GetFoldParent(line); @@ -5443,6 +5451,15 @@ void Editor::FoldChanged(int line, int levelNow, int levelPrev) { } } } + + // Combining two blocks where the first one is collapsed (e.g. by adding characters in the line which separates the two blocks) + if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && (LevelNumber(levelPrev) < LevelNumber(levelNow))) { + if (cs.HiddenLines()) { + const int parentLine = pdoc->GetFoldParent(line); + if (!cs.GetExpanded(parentLine) && cs.GetExpanded(line)) + FoldLine(parentLine, SC_FOLDACTION_EXPAND); + } + } }
void Editor::NeedShown(int pos, int len) {
Modified: scintilla/src/MarginView.cxx 10 lines changed, 5 insertions(+), 5 deletions(-) =================================================================== @@ -243,7 +243,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect levelPrev = model.pdoc->GetLevel(lineBack); } if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { - if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK)) + if (LevelNumber(level) < LevelNumber(levelPrev)) needWhiteClosure = true; } } @@ -279,8 +279,8 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect // Decide which fold indicator should be displayed const int level = model.pdoc->GetLevel(lineDoc); const int levelNext = model.pdoc->GetLevel(lineDoc + 1); - const int levelNum = level & SC_FOLDLEVELNUMBERMASK; - const int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK; + const int levelNum = LevelNumber(level); + const int levelNextNum = LevelNumber(levelNext); if (level & SC_FOLDLEVELHEADERFLAG) { if (firstSubLine) { if (levelNum < levelNextNum) { @@ -312,7 +312,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect needWhiteClosure = false; const int firstFollowupLine = model.cs.DocFromDisplay(model.cs.DisplayFromDoc(lineDoc + 1)); const int firstFollowupLineLevel = model.pdoc->GetLevel(firstFollowupLine); - const int secondFollowupLineLevelNum = model.pdoc->GetLevel(firstFollowupLine + 1) & SC_FOLDLEVELNUMBERMASK; + const int secondFollowupLineLevelNum = LevelNumber(model.pdoc->GetLevel(firstFollowupLine + 1)); if (!model.cs.GetExpanded(lineDoc)) { if ((firstFollowupLineLevel & SC_FOLDLEVELWHITEFLAG) && (levelNum > secondFollowupLineLevelNum)) @@ -380,7 +380,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect sprintf(number, "%c%c %03X %03X", (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - lev & SC_FOLDLEVELNUMBERMASK, + LevelNumber(lev), lev >> 16 ); } else {
Modified: scintilla/version.txt 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1 +1 @@ -363 +364
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).