Hello community, here is the log from the commit of package scintilla for openSUSE:Factory checked in at 2016-04-22 16:24:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/scintilla (Old) and /work/SRC/openSUSE:Factory/.scintilla.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "scintilla" Changes: -------- --- /work/SRC/openSUSE:Factory/scintilla/scintilla.changes 2016-02-01 19:57:02.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.scintilla.new/scintilla.changes 2016-04-22 16:24:13.000000000 +0200 @@ -1,0 +2,7 @@ +Sun Apr 10 09:38:49 UTC 2016 - [email protected] + +- Update to 3.6.4 + * avoids some folding bugs by automatically unfolding and + improves clipboard robustness on Win32. + +------------------------------------------------------------------- Old: ---- scintilla363.tgz New: ---- scintilla364.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ scintilla.spec ++++++ --- /var/tmp/diff_new_pack.vwaMJX/_old 2016-04-22 16:24:14.000000000 +0200 +++ /var/tmp/diff_new_pack.vwaMJX/_new 2016-04-22 16:24:14.000000000 +0200 @@ -16,10 +16,10 @@ # -%define tar_ver 363 +%define tar_ver 364 %define so_ver 3.0 Name: scintilla -Version: 3.6.3 +Version: 3.6.4 Release: 0 Summary: A free source code editing component License: MIT ++++++ scintilla-shared.patch ++++++ --- /var/tmp/diff_new_pack.vwaMJX/_old 2016-04-22 16:24:14.000000000 +0200 +++ /var/tmp/diff_new_pack.vwaMJX/_new 2016-04-22 16:24:14.000000000 +0200 @@ -2,7 +2,7 @@ =================================================================== --- gtk/makefile.orig +++ gtk/makefile -@@ -41,7 +41,7 @@ DEL = del /q +@@ -42,7 +42,7 @@ DEL = del /q COMPLIB=..\bin\scintilla.a else DEL = rm -f @@ -11,16 +11,16 @@ endif vpath %.h ../src ../include ../lexlib -@@ -76,7 +76,7 @@ endif +@@ -77,7 +77,7 @@ endif CFLAGS:=$(CTFLAGS) - CXXTFLAGS:=--std=c++0x $(CTFLAGS) $(REFLAGS) + CXXTFLAGS:=--std=gnu++0x $(CTFLAGS) $(REFLAGS) -CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION)) +CONFIGFLAGS:=$(shell pkg-config --cflags --libs $(GTKVERSION)) MARSHALLER=scintilla-marshal.o .cxx.o: -@@ -104,8 +104,7 @@ $(COMPLIB): Accessor.o CharacterSet.o Le +@@ -105,8 +105,7 @@ $(COMPLIB): Accessor.o CharacterSet.o Le KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o CharacterCategory.o ViewStyle.o \ RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \ $(MARSHALLER) $(LEXOBJS) ++++++ scintilla363.tgz -> scintilla364.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/cocoa/ScintillaFramework/Info.plist new/scintilla/cocoa/ScintillaFramework/Info.plist --- old/scintilla/cocoa/ScintillaFramework/Info.plist 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/cocoa/ScintillaFramework/Info.plist 2016-03-13 05:16:34.000000000 +0100 @@ -17,11 +17,11 @@ <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> - <string>3.6.3</string> + <string>3.6.4</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>3.6.3</string> + <string>3.6.4</string> <key>NSPrincipalClass</key> <string></string> </dict> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/doc/ScintillaDownload.html new/scintilla/doc/ScintillaDownload.html --- old/scintilla/doc/ScintillaDownload.html 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/doc/ScintillaDownload.html 2016-03-13 05:16:34.000000000 +0100 @@ -26,9 +26,9 @@ <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0"> <tr> <td> - <font size="4"> <a href="http://www.scintilla.org/scintilla363.zip"> + <font size="4"> <a href="http://www.scintilla.org/scintilla364.zip"> Windows</a> - <a href="http://www.scintilla.org/scintilla363.tgz"> + <a href="http://www.scintilla.org/scintilla364.tgz"> GTK+/Linux</a> </font> </td> @@ -42,7 +42,7 @@ containing very few restrictions. </p> <h3> - Release 3.6.3 + Release 3.6.4 </h3> <h4> Source Code @@ -50,8 +50,8 @@ The source code package contains all of the source code for Scintilla but no binary executable code and is available in <ul> - <li><a href="http://www.scintilla.org/scintilla363.zip">zip format</a> (1500K) commonly used on Windows</li> - <li><a href="http://www.scintilla.org/scintilla363.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li> + <li><a href="http://www.scintilla.org/scintilla364.zip">zip format</a> (1500K) commonly used on Windows</li> + <li><a href="http://www.scintilla.org/scintilla364.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li> </ul> Instructions for building on both Windows and Linux are included in the readme file. <h4> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/doc/ScintillaHistory.html new/scintilla/doc/ScintillaHistory.html --- old/scintilla/doc/ScintillaHistory.html 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/doc/ScintillaHistory.html 2016-03-13 05:16:34.000000000 +0100 @@ -480,6 +480,10 @@ <td>Yury Dubinsky</td> <td>Sam Hocevar</td> <td>Luyomi</td> + <td>Matt Gilarde</td> + </tr><tr> + <td>Mark C</td> + <td>Johannes Sasongko</td> </tr> </table> <p> @@ -492,6 +496,73 @@ </li> </ul> <h3> + <a href="http://www.scintilla.org/scite364.zip">Release 3.6.4</a> + </h3> + <ul> + <li> + Released 13 March 2016. + </li> + <li> + SciTE allows setting the autocompletion type separator character. + </li> + <li> + The C++ folder folds code on '(' and ')' to allow multi-line calls to be folded. + <a href="http://sourceforge.net/p/scintilla/feature-requests/1138/">Feature #1138.</a> + </li> + <li> + For the HTML lexer, limit the extent of Mako line comments to finish before + the line end characters. + </li> + <li> + Folds unfolded when two fold regions are merged by either deleting an intervening line + or changing its fold level by adding characters. + This was fixed both in Scintilla and in SciTE's equivalent code. + <a href="http://sourceforge.net/p/scintilla/bugs/1799/">Bug #1799</a>.<br /> + </li> + <li> + The Progress lexer supports hexadecimal numeric literals, + single-line comments, abbreviated keywords and + extends nested comments to unlimited levels. + </li> + <li> + Ruby lexer treats alternate hash key syntax "key:" as a symbol. + <a href="http://sourceforge.net/p/scintilla/bugs/1810/">Bug #1810</a>. + </li> + <li> + Rust lexer handles bracketed Unicode string escapes like "\u{123abc}". + <a href="http://sourceforge.net/p/scintilla/bugs/1809/">Bug #1809</a>. + </li> + <li> + For GTK+ on Windows fix 64-bit build which was broken in 3.6.3. + </li> + <li> + For Qt, release builds have assertions turned off. + </li> + <li> + For Qt on Windows, fix compilation failure for Qt 4.x. + </li> + <li> + IME target range displayed on Qt for OS X. + </li> + <li> + On Windows, make clipboard operations more robust by retrying OpenClipboard if it fails + as this may occur when another application has opened the clipboard. + </li> + <li> + On Windows back out change that removed use of def file to ensure + Scintilla_DirectFunction exported without name mangling. + <a href="http://sourceforge.net/p/scintilla/bugs/1813/">Bug #1813</a>. + </li> + <li> + On GTK+ and Qt over Win32 in Korean fix bug caused by last release's word input change. + </li> + <li> + For SciTE, more descriptive error messages are displayed when there are problems loading the + Lua startup script. + <a href="http://sourceforge.net/p/scintilla/feature-requests/1139/">Feature #1139.</a> + </li> + </ul> + <h3> <a href="http://www.scintilla.org/scite363.zip">Release 3.6.3</a> </h3> <ul> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/doc/index.html new/scintilla/doc/index.html --- old/scintilla/doc/index.html 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/doc/index.html 2016-03-13 05:16:34.000000000 +0100 @@ -9,7 +9,7 @@ <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" /> <meta name="Description" content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." /> - <meta name="Date.Modified" content="20160118" /> + <meta name="Date.Modified" content="20160313" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style type="text/css"> #versionlist { @@ -56,8 +56,8 @@ GTK+, and OS X</font> </td> <td width="40%" align="right"> - <font color="#FFCC99" size="3"> Release version 3.6.3<br /> - Site last modified January 18 2016</font> + <font color="#FFCC99" size="3"> Release version 3.6.4<br /> + Site last modified March 13 2016</font> </td> <td width="20%"> @@ -72,6 +72,7 @@ </tr> </table> <ul id="versionlist"> + <li>Version 3.6.4 avoids some folding bugs by automatically unfolding and improves clipboard robustness on Win32.</li> <li>Version 3.6.3 supports idle-time styling.</li> <li>Version 3.6.2 fixes crashes and other bugs, particularly on Cocoa.</li> <li>Version 3.6.1 adds minor features and fixes bugs.</li> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/gtk/ScintillaGTK.cxx new/scintilla/gtk/ScintillaGTK.cxx --- old/scintilla/gtk/ScintillaGTK.cxx 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/gtk/ScintillaGTK.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -2485,7 +2485,9 @@ 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; } @@ -3051,7 +3053,7 @@ return psci->WndProc(iMessage, wParam, lParam); } -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); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/gtk/makefile new/scintilla/gtk/makefile --- old/scintilla/gtk/makefile 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/gtk/makefile 2016-03-13 05:16:34.000000000 +0100 @@ -37,6 +37,7 @@ endif ifdef windir +CC = gcc DEL = del /q COMPLIB=..\bin\scintilla.a else @@ -74,7 +75,7 @@ endif CFLAGS:=$(CTFLAGS) -CXXTFLAGS:=--std=c++0x $(CTFLAGS) $(REFLAGS) +CXXTFLAGS:=--std=gnu++0x $(CTFLAGS) $(REFLAGS) CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION)) MARSHALLER=scintilla-marshal.o diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/include/ScintillaWidget.h new/scintilla/include/ScintillaWidget.h --- old/scintilla/include/ScintillaWidget.h 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/include/ScintillaWidget.h 2016-03-13 05:16:34.000000000 +0100 @@ -44,7 +44,7 @@ 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 */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/lexers/LexCPP.cxx new/scintilla/lexers/LexCPP.cxx --- old/scintilla/lexers/LexCPP.cxx 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/lexers/LexCPP.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -1349,14 +1349,14 @@ } } 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--; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/lexers/LexHTML.cxx new/scintilla/lexers/LexHTML.cxx --- old/scintilla/lexers/LexHTML.cxx 2015-08-03 01:21:07.000000000 +0200 +++ new/scintilla/lexers/LexHTML.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -828,7 +828,7 @@ // 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 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/lexers/LexProgress.cxx new/scintilla/lexers/LexProgress.cxx --- old/scintilla/lexers/LexProgress.cxx 2015-08-03 01:21:07.000000000 +0200 +++ new/scintilla/lexers/LexProgress.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -9,7 +9,6 @@ /** TODO: WebSpeed support in html lexer Support "end triggers" expression of the triggers phrase -Support more than 6 comments levels **/ #include <stdlib.h> #include <string.h> @@ -44,13 +43,26 @@ enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0 static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { + Accessor &styler) { - WordList &keywords1 = *keywordlists[0]; // regular keywords - WordList &keywords2 = *keywordlists[1]; // block opening keywords, only when SentenceStart - WordList &keywords3 = *keywordlists[2]; // block opening keywords - //WordList &keywords4 = *keywordlists[3]; // preprocessor keywords. Not implemented + WordList &keywords1 = *keywordlists[0]; // regular keywords + WordList &keywords2 = *keywordlists[1]; // block opening keywords, only when SentenceStart + WordList &keywords3 = *keywordlists[2]; // block opening keywords + //WordList &keywords4 = *keywordlists[3]; // preprocessor keywords. Not implemented + + Sci_Position currentLine = styler.GetLine(startPos); + // Initialize the block comment /* */ nesting level, if we are inside such a comment. + int blockCommentLevel = 0; + if (initStyle == SCE_4GL_COMMENT1 || + initStyle == SCE_4GL_COMMENT1_) { + blockCommentLevel = styler.GetLineState(currentLine - 1); + } + // Do not leak single-line comments onto next line + if (initStyle == SCE_4GL_COMMENT2 || + initStyle == SCE_4GL_COMMENT2_) { + initStyle = SCE_4GL_DEFAULT; + } int visibleChars = 0; int mask; @@ -65,6 +77,19 @@ visibleChars = 0; } + if (sc.atLineEnd) { + // Update the line state, so it can be seen by next line + currentLine = styler.GetLine(sc.currentPos); + if (sc.state == SCE_4GL_COMMENT1 || + sc.state == SCE_4GL_COMMENT1_) { + // Inside a block comment, we set the line state + styler.SetLineState(currentLine, blockCommentLevel); + } else { + // Reset the line state + styler.SetLineState(currentLine, 0); + } + } + // Handle line continuation generically. if ((sc.state & 0xf) < SCE_4GL_COMMENT1) { if (sc.ch == '~') { @@ -96,7 +121,9 @@ sc.SetState(SCE_4GL_DEFAULT | mask); break; case SCE_4GL_NUMBER: - if (!(IsADigit(sc.ch))) { + // Hex numbers (0xnnnn) are supported so accept any + // alphanumeric character if it follows a leading digit. + if (!(IsAlphaNumeric(sc.ch))) { sc.SetState(SCE_4GL_DEFAULT | mask); } break; @@ -104,10 +131,10 @@ if (!IsAWordChar(sc.ch) && sc.ch != '-') { char s[1000]; sc.GetCurrentLowered(s, sizeof(s)); - if ((((sc.state & 0x10) == 0) && keywords2.InList(s)) || keywords3.InList(s)) { + if ((((sc.state & 0x10) == 0) && keywords2.InListAbbreviated(s, '(')) || keywords3.InListAbbreviated(s, '(')) { sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart); } - else if (keywords1.InList(s)) { + else if (keywords1.InListAbbreviated(s, '(')) { if ((s[0] == 'e' && s[1] =='n' && s[2] == 'd' && !isalnum(s[3]) && s[3] != '-') || (s[0] == 'f' && s[1] =='o' && s[2] == 'r' && s[3] == 'w' && s[4] =='a' && s[5] == 'r' && s[6] == 'd'&& !isalnum(s[7]))) { sc.ChangeState(SCE_4GL_END | ResetSentenceStart); @@ -141,20 +168,23 @@ sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } break; - default: - if ((sc.state & 0xf) >= SCE_4GL_COMMENT1) { - if (sc.ch == '*' && sc.chNext == '/') { - sc.Forward(); - if ((sc.state & 0xf) == SCE_4GL_COMMENT1) { - sc.ForwardSetState(SCE_4GL_DEFAULT | mask); - } - else - sc.SetState((sc.state & 0x1f) - 1); - } else if (sc.ch == '/' && sc.chNext == '*') { - sc.Forward(); - sc.SetState((sc.state & 0x1f) + 1); + case SCE_4GL_COMMENT1: + if (sc.Match('/', '*')) { + blockCommentLevel++; + sc.Forward(); + } else if (sc.Match('*', '/') && blockCommentLevel > 0) { + blockCommentLevel--; + sc.Forward(); + if (blockCommentLevel == 0) { + sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } } + break; + case SCE_4GL_COMMENT2: + if (sc.atLineEnd) { + sc.ForwardSetState(SCE_4GL_DEFAULT | mask); + } + break; } // Determine if a new state should be entered. @@ -164,9 +194,13 @@ sc.SetState(SCE_4GL_NUMBER | ResetSentenceStart); } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) { sc.SetState(SCE_4GL_IDENTIFIER | mask); - } else if (sc.ch == '/' && sc.chNext == '*') { + } else if (sc.Match('/', '*')) { + blockCommentLevel = 1; sc.SetState(SCE_4GL_COMMENT1 | mask); sc.Forward(); + } else if (sc.Match('/', '/') && + (sc.atLineStart || sc.chPrev == ' ')) { + sc.SetState(SCE_4GL_COMMENT2 | mask); } else if (sc.ch == '\"') { sc.SetState(SCE_4GL_STRING | ResetSentenceStart); } else if (sc.ch == '\'') { @@ -199,7 +233,7 @@ } static bool IsStreamCommentStyle(int style) { - return (style & 0xf) >= SCE_4GL_COMMENT1 ; + return (style & 0xf) == SCE_4GL_COMMENT1 ; } // Store both the current line's fold level and the next lines in the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/lexers/LexRuby.cxx new/scintilla/lexers/LexRuby.cxx --- old/scintilla/lexers/LexRuby.cxx 2015-08-03 01:21:07.000000000 +0200 +++ new/scintilla/lexers/LexRuby.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -433,6 +433,32 @@ 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 @@ 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 @@ } // 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 @@ // <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)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/lexers/LexRust.cxx new/scintilla/lexers/LexRust.cxx --- old/scintilla/lexers/LexRust.cxx 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/lexers/LexRust.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -407,7 +407,18 @@ 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 @@ 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); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEdit/ScintillaEdit.pro new/scintilla/qt/ScintillaEdit/ScintillaEdit.pro --- old/scintilla/qt/ScintillaEdit/ScintillaEdit.pro 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/qt/ScintillaEdit/ScintillaEdit.pro 2016-03-13 05:16:34.000000000 +0100 @@ -11,7 +11,7 @@ TEMPLATE = lib CONFIG += lib_bundle -VERSION = 3.6.3 +VERSION = 3.6.4 SOURCES += \ ScintillaEdit.cpp \ @@ -70,6 +70,9 @@ INCLUDEPATH += ../ScintillaEditBase ../../include ../../src ../../lexlib DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 SCI_LEXER=1 _CRT_SECURE_NO_DEPRECATE=1 +CONFIG(release, debug|release) { + DEFINES += NDEBUG=1 +} DESTDIR = ../../bin DLLDESTDIR = ../../bin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEditBase/PlatQt.cpp new/scintilla/qt/ScintillaEditBase/PlatQt.cpp --- old/scintilla/qt/ScintillaEditBase/PlatQt.cpp 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/qt/ScintillaEditBase/PlatQt.cpp 2016-03-13 05:16:34.000000000 +0100 @@ -819,8 +819,11 @@ #if defined(Q_OS_WIN) // On Windows, Qt::ToolTip causes a crash when the list is clicked on // so Qt::Tool is used. - list->setParent(0, Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | - Qt::WindowDoesNotAcceptFocus); + list->setParent(0, Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + | Qt::WindowDoesNotAcceptFocus +#endif + ); #else // On OS X, Qt::Tool takes focus so main window loses focus so // keyboard stops working. Qt::ToolTip works but its only really diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEditBase/ScintillaEditBase.cpp new/scintilla/qt/ScintillaEditBase/ScintillaEditBase.cpp --- old/scintilla/qt/ScintillaEditBase/ScintillaEditBase.cpp 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/qt/ScintillaEditBase/ScintillaEditBase.cpp 2016-03-13 05:16:34.000000000 +0100 @@ -447,17 +447,9 @@ return 0; } -static std::vector<int> MapImeIndicators(QInputMethodEvent *event, bool preeditNotChanged) +static std::vector<int> MapImeIndicators(QInputMethodEvent *event) { -#ifndef Q_OS_LINUX - Q_UNUSED(preeditNotChanged) -#endif - const QString preeditStr = event->preeditString(); - std::vector<int> imeIndicator(preeditStr.length(), SC_INDICATOR_UNKNOWN); -#ifdef Q_OS_LINUX - const int imeCaretPos = GetImeCaretPos(event); -#endif - + std::vector<int> imeIndicator(event->preeditString().size(), SC_INDICATOR_UNKNOWN); foreach (QInputMethodEvent::Attribute attr, event->attributes()) { if (attr.type == QInputMethodEvent::TextFormat) { QTextFormat format = attr.value.value<QTextFormat>(); @@ -465,12 +457,12 @@ int indicator = SC_INDICATOR_UNKNOWN; switch (charFormat.underlineStyle()) { - case QTextCharFormat::NoUnderline: - indicator = SC_INDICATOR_TARGET; //target input + case QTextCharFormat::NoUnderline: // win32, linux + indicator = SC_INDICATOR_TARGET; break; - case QTextCharFormat::SingleUnderline: - case QTextCharFormat::DashUnderline: - indicator = SC_INDICATOR_INPUT; //normal input + case QTextCharFormat::SingleUnderline: // osx + case QTextCharFormat::DashUnderline: // win32, linux + indicator = SC_INDICATOR_INPUT; break; case QTextCharFormat::DotLine: case QTextCharFormat::DashDotLine: @@ -482,16 +474,19 @@ default: indicator = SC_INDICATOR_UNKNOWN; } -#ifdef Q_OS_LINUX - // ibus-qt has a bug to return only one underline style. - // Q_OS_LINUX blocks are temporary work around to cope with it. - if ((attr.length > 0) && (attr.start == imeCaretPos)) { + + if (format.hasProperty(QTextFormat::BackgroundBrush)) // win32, linux indicator = SC_INDICATOR_TARGET; - if ((imeCaretPos == 0) && (preeditNotChanged)) { // moved by an arrow key. - indicator = SC_INDICATOR_INPUT; + +#ifdef Q_OS_OSX + if (charFormat.underlineStyle() == QTextCharFormat::SingleUnderline) { + QColor uc = charFormat.underlineColor(); + if (uc.lightness() < 2) { // osx + indicator = SC_INDICATOR_TARGET; } } #endif + for (int i = attr.start; i < attr.start+attr.length; i++) { imeIndicator[i] = indicator; } @@ -544,10 +539,7 @@ sqt->pdoc->TentativeStart(); // TentativeActive() from now on. - std::vector<int> imeIndicator = MapImeIndicators(event, preeditString == preeditStr); -#ifdef Q_OS_LINUX - preeditString = preeditStr; -#endif + std::vector<int> imeIndicator = MapImeIndicators(event); // Display preedit characters one by one. int imeCharPos[MAXLENINPUTIME] = {0}; @@ -578,7 +570,9 @@ MoveImeCarets(- imeCharPos[preeditStrLen] + imeCharPos[imeCaretPos]); if (IsHangul(preeditStr.at(0))) { +#ifndef Q_OS_WIN MoveImeCarets(- imeCharPos[1]); +#endif sqt->view.imeCaretBlockOverride = true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro new/scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro --- old/scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro 2016-03-13 05:16:34.000000000 +0100 @@ -11,7 +11,7 @@ TEMPLATE = lib CONFIG += lib_bundle -VERSION = 3.6.3 +VERSION = 3.6.4 SOURCES += \ PlatQt.cpp \ @@ -113,6 +113,9 @@ INCLUDEPATH += ../../include ../../src ../../lexlib DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 SCI_LEXER=1 _CRT_SECURE_NO_DEPRECATE=1 +CONFIG(release, debug|release) { + DEFINES += NDEBUG=1 +} DESTDIR = ../../bin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEditPy/ScintillaEditPy.pro new/scintilla/qt/ScintillaEditPy/ScintillaEditPy.pro --- old/scintilla/qt/ScintillaEditPy/ScintillaEditPy.pro 2014-08-10 01:52:02.000000000 +0200 +++ new/scintilla/qt/ScintillaEditPy/ScintillaEditPy.pro 2016-03-13 05:16:34.000000000 +0100 @@ -107,6 +107,9 @@ ../ScintillaEditBase/ScintillaEditBase.h DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 SCI_LEXER=1 _CRT_SECURE_NO_DEPRECATE=1 +CONFIG(release, debug|release) { + DEFINES += NDEBUG=1 +} DESTDIR = ../../bin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Document.cxx new/scintilla/src/Document.cxx --- old/scintilla/src/Document.cxx 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/src/Document.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -436,12 +436,12 @@ 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 @@ 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::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 @@ 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 @@ 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 @@ 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 @@ 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; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Document.h new/scintilla/src/Document.h --- old/scintilla/src/Document.h 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/src/Document.h 2016-03-13 05:16:34.000000000 +0100 @@ -171,6 +171,10 @@ class Document; +inline int LevelNumber(int level) { + return level & SC_FOLDLEVELNUMBERMASK; +} + class LexInterface { protected: Document *pdoc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/EditView.cxx new/scintilla/src/EditView.cxx --- old/scintilla/src/EditView.cxx 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/src/EditView.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -1744,7 +1744,7 @@ 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)) || diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Editor.cxx new/scintilla/src/Editor.cxx --- old/scintilla/src/Editor.cxx 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/src/Editor.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -5292,7 +5292,7 @@ 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 @@ 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 @@ 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 @@ } } } + + // 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) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/MarginView.cxx new/scintilla/src/MarginView.cxx --- old/scintilla/src/MarginView.cxx 2015-08-03 01:21:07.000000000 +0200 +++ new/scintilla/src/MarginView.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -243,7 +243,7 @@ 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 @@ // 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 @@ 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 @@ sprintf(number, "%c%c %03X %03X", (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - lev & SC_FOLDLEVELNUMBERMASK, + LevelNumber(lev), lev >> 16 ); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/test/gi/Scintilla-0.1.gir.good new/scintilla/test/gi/Scintilla-0.1.gir.good --- old/scintilla/test/gi/Scintilla-0.1.gir.good 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/test/gi/Scintilla-0.1.gir.good 2016-03-13 05:16:34.000000000 +0100 @@ -53,7 +53,7 @@ </virtual-method> <method name="send_message" c:identifier="scintilla_object_send_message"> <return-value transfer-ownership="none"> - <type name="glong" c:type="long"/> + <type name="gintptr" c:type="gintptr"/> </return-value> <parameters> <instance-parameter name="sci" transfer-ownership="none"> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/test/simpleTests.py new/scintilla/test/simpleTests.py --- old/scintilla/test/simpleTests.py 2015-09-05 00:28:50.000000000 +0200 +++ new/scintilla/test/simpleTests.py 2016-03-13 05:16:34.000000000 +0100 @@ -493,13 +493,15 @@ self.ed.AddText(5, b"a1b2c") self.ed.SetSel(1,3) self.ed.Cut() - self.xite.DoEvents() + # Clipboard = "1b" + self.assertEquals(self.ed.Contents(), b"a2c") self.assertEquals(self.ed.CanPaste(), 1) self.ed.SetSel(0, 0) self.ed.Paste() self.assertEquals(self.ed.Contents(), b"1ba2c") self.ed.SetSel(4,5) self.ed.Copy() + # Clipboard = "c" self.ed.SetSel(1,3) self.ed.Paste() self.assertEquals(self.ed.Contents(), b"1c2c") @@ -508,13 +510,12 @@ self.assertEquals(self.ed.Contents(), b"1c") def testCopyAllowLine(self): - self.xite.DoEvents() lineEndType = self.ed.EOLMode self.ed.EOLMode = self.ed.SC_EOL_LF self.ed.AddText(5, b"a1\nb2") self.ed.SetSel(1,1) self.ed.CopyAllowLine() - self.xite.DoEvents() + # Clipboard = "a1\n" self.assertEquals(self.ed.CanPaste(), 1) self.ed.SetSel(0, 0) self.ed.Paste() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/version.txt new/scintilla/version.txt --- old/scintilla/version.txt 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/version.txt 2016-03-13 05:16:34.000000000 +0100 @@ -1 +1 @@ -363 +364 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/PlatWin.cxx new/scintilla/win32/PlatWin.cxx --- old/scintilla/win32/PlatWin.cxx 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/win32/PlatWin.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -5,6 +5,7 @@ // Copyright 1998-2003 by Neil Hodgson <[email protected]> // The License.txt file describes the conditions under which this software may be distributed. +#include <stddef.h> #include <stdlib.h> #include <string.h> #include <stdio.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/ScintRes.rc new/scintilla/win32/ScintRes.rc --- old/scintilla/win32/ScintRes.rc 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/win32/ScintRes.rc 2016-03-13 05:16:34.000000000 +0100 @@ -4,8 +4,8 @@ #include <windows.h> -#define VERSION_SCINTILLA "3.6.3" -#define VERSION_WORDS 3, 6, 3, 0 +#define VERSION_SCINTILLA "3.6.4" +#define VERSION_WORDS 3, 6, 4, 0 VS_VERSION_INFO VERSIONINFO FILEVERSION VERSION_WORDS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/ScintillaWin.cxx new/scintilla/win32/ScintillaWin.cxx --- old/scintilla/win32/ScintillaWin.cxx 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/win32/ScintillaWin.cxx 2016-03-13 05:16:34.000000000 +0100 @@ -210,6 +210,24 @@ if (hIMC) ::ImmReleaseContext(hwnd, hIMC); } + + unsigned int GetImeCaretPos() { + return ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, NULL, 0); + } + + std::vector<BYTE> GetImeAttributes() { + int attrLen = ::ImmGetCompositionStringW(hIMC, GCS_COMPATTR, NULL, 0); + std::vector<BYTE> attr(attrLen, 0); + ::ImmGetCompositionStringW(hIMC, GCS_COMPATTR, &attr[0], static_cast<DWORD>(attr.size())); + return attr; + } + + std::wstring GetCompositionString(DWORD dwIndex) { + const LONG byteLen = ::ImmGetCompositionStringW(hIMC, dwIndex, NULL, 0); + std::wstring wcs(byteLen / 2, 0); + ::ImmGetCompositionStringW(hIMC, dwIndex, &wcs[0], byteLen); + return wcs; + } }; } @@ -291,6 +309,7 @@ void SelectionToHangul(); void EscapeHanja(); void ToggleHanja(); + void AddWString(std::wstring wcs); UINT CodePageOfDocument() const; virtual bool ValidCodePage(int codePage) const; @@ -834,24 +853,8 @@ if (lParam & GCS_RESULTSTR) { IMContext imc(MainHWND()); if (imc.hIMC) { - wchar_t wcs[maxLenInputIME]; - LONG bytes = ::ImmGetCompositionStringW(imc.hIMC, - GCS_RESULTSTR, wcs, (maxLenInputIME-1)*2); - int wides = bytes / 2; - if (IsUnicodeMode()) { - char utfval[maxLenInputIME * 3]; - unsigned int len = UTF8Length(wcs, wides); - UTF8FromUTF16(wcs, wides, utfval, len); - utfval[len] = '\0'; - AddCharUTF(utfval, len); - } else { - char dbcsval[maxLenInputIME * 2]; - int size = ::WideCharToMultiByte(InputCodePage(), - 0, wcs, wides, dbcsval, sizeof(dbcsval) - 1, 0, 0); - for (int i=0; i<size; i++) { - AddChar(dbcsval[i]); - } - } + AddWString(imc.GetCompositionString(GCS_RESULTSTR)); + // Set new position after converted Point pos = PointMainCaret(); COMPOSITIONFORM CompForm; @@ -1000,18 +1003,9 @@ } } -static unsigned int GetImeCaretPos(HIMC hIMC) { - return ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, NULL, 0); -} - -static std::vector<BYTE> GetImeAttributes(HIMC hIMC) { - int attrLen = ::ImmGetCompositionStringW(hIMC, GCS_COMPATTR, NULL, 0); - std::vector<BYTE> attr(attrLen, 0); - ::ImmGetCompositionStringW(hIMC, GCS_COMPATTR, &attr[0], static_cast<DWORD>(attr.size())); - return attr; -} +namespace { -static std::vector<int> MapImeIndicators(std::vector<BYTE> inputStyle) { +std::vector<int> MapImeIndicators(std::vector<BYTE> inputStyle) { std::vector<int> imeIndicator(inputStyle.size(), SC_INDICATOR_UNKNOWN); for (size_t i = 0; i < inputStyle.size(); i++) { switch (static_cast<int>(inputStyle.at(i))) { @@ -1033,6 +1027,23 @@ return imeIndicator; } +} + +void ScintillaWin::AddWString(std::wstring wcs) { + if (wcs.empty()) + return; + + int codePage = CodePageOfDocument(); + for (size_t i = 0; i < wcs.size(); ) { + const size_t ucWidth = UTF16CharLength(wcs[i]); + const std::wstring uniChar(wcs, i, ucWidth); + std::string docChar = StringEncode(uniChar, codePage); + + AddCharUTF(docChar.c_str(), static_cast<unsigned int>(docChar.size())); + i += ucWidth; + } +} + sptr_t ScintillaWin::HandleCompositionInline(uptr_t, sptr_t lParam) { // Copy & paste by johnsonj with a lot of helps of Neil. // Great thanks for my foreruners, jiniya and BLUEnLIVE. @@ -1056,82 +1067,42 @@ view.imeCaretBlockOverride = false; if (lParam & GCS_COMPSTR) { - wchar_t wcs[maxLenInputIME] = { 0 }; - long bytes = ::ImmGetCompositionStringW - (imc.hIMC, GCS_COMPSTR, wcs, maxLenInputIME); - unsigned int wcsLen = bytes / 2; - - if ((wcsLen == 0) || (wcsLen >= maxLenInputIME)) { + const std::wstring wcs = imc.GetCompositionString(GCS_COMPSTR); + if ((wcs.size() == 0) || (wcs.size() >= maxLenInputIME)) { ShowCaretAtCurrentPosition(); return 0; } pdoc->TentativeStart(); // TentativeActive from now on. - std::vector<int> imeIndicator = MapImeIndicators(GetImeAttributes(imc.hIMC)); - - // Display character by character. - int numBytes = 0; - int imeCharPos[maxLenInputIME + 1] = { 0 }; + std::vector<int> imeIndicator = MapImeIndicators(imc.GetImeAttributes()); bool tmpRecordingMacro = recordingMacro; recordingMacro = false; - for (size_t i = 0; i < wcsLen; ) { + int codePage = CodePageOfDocument(); + for (size_t i = 0; i < wcs.size(); ) { const size_t ucWidth = UTF16CharLength(wcs[i]); - const std::wstring uniChar(wcs+i, ucWidth); - char oneChar[UTF8MaxBytes + 1] = "\0\0\0\0"; // Maximum 4 bytes in utf8 - unsigned int oneCharLen = 0; + const std::wstring uniChar(wcs, i, ucWidth); + std::string docChar = StringEncode(uniChar, codePage); - if (IsUnicodeMode()) { - oneCharLen = UTF8Length(uniChar.c_str(), static_cast<unsigned int>(uniChar.length())); - UTF8FromUTF16(uniChar.c_str(), static_cast<unsigned int>(uniChar.length()), oneChar, oneCharLen); - } else { - oneCharLen = ::WideCharToMultiByte(InputCodePage(), 0, - uniChar.c_str(), static_cast<unsigned int>(uniChar.length()), oneChar, sizeof(oneChar)-1, 0, 0); - } - oneChar[oneCharLen] = '\0'; - - // Display a character. - AddCharUTF(oneChar, oneCharLen); + AddCharUTF(docChar.c_str(), static_cast<unsigned int>(docChar.size())); - // Record compstr character positions for moving IME carets. - numBytes += oneCharLen; - imeCharPos[i + ucWidth] = numBytes; - - DrawImeIndicator(imeIndicator[i], oneCharLen); + DrawImeIndicator(imeIndicator[i], static_cast<unsigned int>(docChar.size())); i += ucWidth; } recordingMacro = tmpRecordingMacro; - // Move IME caret position. - unsigned int imeCursorPos = GetImeCaretPos(imc.hIMC); - MoveImeCarets(-imeCharPos[wcsLen] + imeCharPos[imeCursorPos]); + // Move IME caret from current last position to imeCaretPos. + int toImeStart = static_cast<unsigned int>(StringEncode(wcs, codePage).size()); + std::string imeCaret(StringEncode(wcs.substr(0, imc.GetImeCaretPos()), codePage)); + int toImeCaret = static_cast<unsigned int>(imeCaret.size()); + MoveImeCarets(- toImeStart + toImeCaret); + if (KoreanIME()) { view.imeCaretBlockOverride = true; } } else if (lParam & GCS_RESULTSTR) { - wchar_t wcs[maxLenInputIME] = { 0 }; - long bytes = ::ImmGetCompositionStringW - (imc.hIMC, GCS_RESULTSTR, wcs, maxLenInputIME); - unsigned int wcsLen = bytes / 2; - - for (size_t i = 0; i < wcsLen;) { - const size_t ucWidth = UTF16CharLength(wcs[i]); - const std::wstring uniChar(wcs+i, ucWidth); - char oneChar[UTF8MaxBytes+1] = "\0\0\0\0"; // Maximum 4 bytes in UTF-8. - unsigned int oneCharLen = 0; - - if (IsUnicodeMode()) { - oneCharLen = UTF8Length(uniChar.c_str(), static_cast<unsigned int>(uniChar.length())); - UTF8FromUTF16(uniChar.c_str(), static_cast<unsigned int>(uniChar.length()), oneChar, oneCharLen); - } else { - oneCharLen = ::WideCharToMultiByte(InputCodePage(), 0, - uniChar.c_str(), static_cast<unsigned int>(uniChar.length()), oneChar, sizeof(oneChar)-1, 0, 0); - } - oneChar[oneCharLen] = '\0'; - AddCharUTF(oneChar, oneCharLen); - i += ucWidth; - } + AddWString(imc.GetCompositionString(GCS_RESULTSTR)); } EnsureCaretVisible(); SetCandidateWindowPos(); @@ -2213,9 +2184,25 @@ } }; +// OpenClipboard may fail if another application has opened the clipboard. +// Try up to 8 times, with an initial delay of 1 ms and an exponential back off +// for a maximum total delay of 127 ms (1+2+4+8+16+32+64). +static bool OpenClipboardRetry(HWND hwnd) { + for (int attempt=0; attempt<8; attempt++) { + if (attempt > 0) { + ::Sleep(1 << (attempt-1)); + } + if (::OpenClipboard(hwnd)) { + return true; + } + } + return false; +} + void ScintillaWin::Paste() { - if (!::OpenClipboard(MainHWND())) + if (!::OpenClipboardRetry(MainHWND())) { return; + } UndoGroup ug(pdoc); const bool isLine = SelectionEmpty() && (::IsClipboardFormatAvailable(cfLineSelect) || ::IsClipboardFormatAvailable(cfVSLineTag)); @@ -2766,8 +2753,9 @@ } void ScintillaWin::CopyToClipboard(const SelectionText &selectedText) { - if (!::OpenClipboard(MainHWND())) + if (!::OpenClipboardRetry(MainHWND())) { return; + } ::EmptyClipboard(); GlobalMemory uniText; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/makefile new/scintilla/win32/makefile --- old/scintilla/win32/makefile 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/win32/makefile 2016-03-13 05:16:34.000000000 +0100 @@ -31,7 +31,7 @@ D2DFLAGS=-DDISABLE_D2D endif -CXXBASEFLAGS=--std=c++0x -Wall -pedantic $(INCLUDEDIRS) $(D2DFLAGS) +CXXBASEFLAGS=--std=gnu++0x -Wall -pedantic $(INCLUDEDIRS) $(D2DFLAGS) ifdef CXX11_REGEX REFLAGS=-DCXX11_REGEX @@ -96,7 +96,7 @@ SOBJS = ScintillaWin.o ScintillaBase.o $(BASEOBJS) -$(COMPONENT): $(SOBJS) +$(COMPONENT): $(SOBJS) Scintilla.def $(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) $(SOBJS) $(CXXFLAGS) $(LIBS) LOBJS = \ @@ -112,7 +112,7 @@ WordList.o \ $(BASEOBJS) \ $(LEXOBJS) -$(LEXCOMPONENT): $(LOBJS) +$(LEXCOMPONENT): $(LOBJS) Scintilla.def $(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) $(LOBJS) $(CXXFLAGS) $(LIBS) $(LEXLIB): $(LEXOBJS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/scintilla.mak new/scintilla/win32/scintilla.mak --- old/scintilla/win32/scintilla.mak 2016-01-17 23:34:04.000000000 +0100 +++ new/scintilla/win32/scintilla.mak 2016-03-13 05:16:34.000000000 +0100 @@ -228,10 +228,10 @@ $(RC) -fo$@ $** $(COMPONENT): $(SOBJS) $(DIR_O)\ScintRes.res - $(LD) $(LDFLAGS) -DLL -OUT:$@ $** $(LIBS) + $(LD) $(LDFLAGS) -DEF:Scintilla.def -DLL -OUT:$@ $** $(LIBS) $(LEXCOMPONENT): $(LOBJS) $(DIR_O)\ScintRes.res - $(LD) $(LDFLAGS) -DLL -OUT:$@ $** $(LIBS) + $(LD) $(LDFLAGS) -DEF:Scintilla.def -DLL -OUT:$@ $** $(LIBS) $(LEXLIB): $(LEXOBJS) LIB /OUT:$@ $(LEXOBJS)
