From 1403d352b2f38c68a10e0ce4b6eb686fbef8920d Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 29 Apr 2016 01:12:20 +0200 Subject: [PATCH] Update Scintilla to version 3.6.5 --- scintilla/gtk/PlatGTK.cxx | 272 +++----------------------------------- scintilla/gtk/ScintillaGTK.cxx | 49 +++---- scintilla/include/SciLexer.h | 15 +++ scintilla/include/Scintilla.iface | 17 +++ scintilla/lexers/LexCPP.cxx | 3 + scintilla/lexers/LexPython.cxx | 16 ++- scintilla/lexers/LexRust.cxx | 2 +- scintilla/lexlib/Accessor.cxx | 4 +- scintilla/lexlib/WordList.cxx | 4 +- scintilla/scintilla_changes.patch | 3 +- scintilla/src/Document.cxx | 4 +- scintilla/src/EditView.cxx | 2 +- scintilla/src/Editor.cxx | 5 +- scintilla/src/Editor.h | 2 +- scintilla/src/KeyMap.h | 1 + scintilla/src/Position.h | 15 ++- scintilla/src/RESearch.h | 2 +- scintilla/version.txt | 2 +- 18 files changed, 116 insertions(+), 302 deletions(-) diff --git a/scintilla/gtk/PlatGTK.cxx b/scintilla/gtk/PlatGTK.cxx index 063c42b3a..059cebfa6 100644 --- a/scintilla/gtk/PlatGTK.cxx +++ b/scintilla/gtk/PlatGTK.cxx @@ -3,10 +3,10 @@ // Copyright 1998-2004 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. +#include #include #include #include -#include #include #include @@ -33,13 +33,6 @@ #pragma GCC diagnostic ignored "-Wsentinel" #endif -/* GLIB must be compiled with thread support, otherwise we - will bail on trying to use locks, and that could lead to - problems for someone. `glib-config --libs gthread` needs - to be used to get the glib libraries for linking, otherwise - g_thread_init will fail */ -#define USE_LOCK defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE) - #include "Converter.h" static const double kPi = 3.14159265358979323846; @@ -88,118 +81,39 @@ using namespace Scintilla; enum encodingType { singleByte, UTF8, dbcs}; -struct LOGFONT { - int size; - int weight; - bool italic; - int characterSet; - char faceName[300]; -}; - -#if USE_LOCK -static GMutex *fontMutex = NULL; - -static void InitializeGLIBThreads() { -#if !GLIB_CHECK_VERSION(2,31,0) - if (!g_thread_supported()) { - g_thread_init(NULL); - } -#endif -} -#endif - -static void FontMutexAllocate() { -#if USE_LOCK - if (!fontMutex) { - InitializeGLIBThreads(); -#if GLIB_CHECK_VERSION(2,31,0) - fontMutex = g_new(GMutex, 1); - g_mutex_init(fontMutex); -#else - fontMutex = g_mutex_new(); -#endif - } -#endif -} - -static void FontMutexFree() { -#if USE_LOCK - if (fontMutex) { -#if GLIB_CHECK_VERSION(2,31,0) - g_mutex_clear(fontMutex); - g_free(fontMutex); -#else - g_mutex_free(fontMutex); -#endif - fontMutex = NULL; - } -#endif -} - -static void FontMutexLock() { -#if USE_LOCK - g_mutex_lock(fontMutex); -#endif -} - -static void FontMutexUnlock() { -#if USE_LOCK - if (fontMutex) { - g_mutex_unlock(fontMutex); - } -#endif -} - // Holds a PangoFontDescription*. class FontHandle { - XYPOSITION width[128]; - encodingType et; public: - int ascent; PangoFontDescription *pfd; int characterSet; - FontHandle() : et(singleByte), ascent(0), pfd(0), characterSet(-1) { - ResetWidths(et); + FontHandle() : pfd(0), characterSet(-1) { } FontHandle(PangoFontDescription *pfd_, int characterSet_) { - et = singleByte; - ascent = 0; pfd = pfd_; characterSet = characterSet_; - ResetWidths(et); } ~FontHandle() { if (pfd) pango_font_description_free(pfd); pfd = 0; } - void ResetWidths(encodingType et_) { - et = et_; - for (int i=0; i<=127; i++) { - width[i] = 0; - } - } - XYPOSITION CharWidth(unsigned char ch, encodingType et_) const { - XYPOSITION w = 0; - FontMutexLock(); - if ((ch <= 127) && (et == et_)) { - w = width[ch]; - } - FontMutexUnlock(); - return w; - } - void SetCharWidth(unsigned char ch, XYPOSITION w, encodingType et_) { - if (ch <= 127) { - FontMutexLock(); - if (et != et_) { - ResetWidths(et_); - } - width[ch] = w; - FontMutexUnlock(); - } - } + static FontHandle *CreateNewFont(const FontParameters &fp); }; +FontHandle *FontHandle::CreateNewFont(const FontParameters &fp) { + PangoFontDescription *pfd = pango_font_description_new(); + if (pfd) { + pango_font_description_set_family(pfd, + (fp.faceName[0] == '!') ? fp.faceName+1 : fp.faceName); + pango_font_description_set_size(pfd, pangoUnitsFromDouble(fp.size)); + pango_font_description_set_weight(pfd, static_cast(fp.weight)); + pango_font_description_set_style(pfd, fp.italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL); + return new FontHandle(pfd,fp.characterSet); + } + + return NULL; +} + // X has a 16 bit coordinate space, so stop drawing here to avoid wrapping static const int maxCoordinate = 32000; @@ -217,143 +131,18 @@ Point Point::FromLong(long lpoint) { Platform::HighShortFromLong(lpoint)); } -static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, float size, int weight, bool italic) { - lf = LOGFONT(); - lf.size = size; - lf.weight = weight; - lf.italic = italic; - lf.characterSet = characterSet; - StringCopy(lf.faceName, faceName); -} - -/** - * Create a hash from the parameters for a font to allow easy checking for identity. - * If one font is the same as another, its hash will be the same, but if the hash is the - * same then they may still be different. - */ -static int HashFont(const FontParameters &fp) { - return - static_cast(fp.size+0.5) ^ - (fp.characterSet << 10) ^ - ((fp.weight / 100) << 12) ^ - (fp.italic ? 0x20000000 : 0) ^ - fp.faceName[0]; -} - -class FontCached : Font { - FontCached *next; - int usage; - LOGFONT lf; - int hash; - explicit FontCached(const FontParameters &fp); - ~FontCached() {} - bool SameAs(const FontParameters &fp); - virtual void Release(); - static FontID CreateNewFont(const FontParameters &fp); - static FontCached *first; -public: - static FontID FindOrCreate(const FontParameters &fp); - static void ReleaseId(FontID fid_); - static void ReleaseAll(); -}; - -FontCached *FontCached::first = 0; - -FontCached::FontCached(const FontParameters &fp) : -next(0), usage(0), hash(0) { - ::SetLogFont(lf, fp.faceName, fp.characterSet, fp.size, fp.weight, fp.italic); - hash = HashFont(fp); - fid = CreateNewFont(fp); - usage = 1; -} - -bool FontCached::SameAs(const FontParameters &fp) { - return - lf.size == fp.size && - lf.weight == fp.weight && - lf.italic == fp.italic && - lf.characterSet == fp.characterSet && - 0 == strcmp(lf.faceName, fp.faceName); -} - -void FontCached::Release() { - if (fid) - delete PFont(*this); - fid = 0; -} - -FontID FontCached::FindOrCreate(const FontParameters &fp) { - FontID ret = 0; - FontMutexLock(); - int hashFind = HashFont(fp); - for (FontCached *cur = first; cur; cur = cur->next) { - if ((cur->hash == hashFind) && - cur->SameAs(fp)) { - cur->usage++; - ret = cur->fid; - } - } - if (ret == 0) { - FontCached *fc = new FontCached(fp); - fc->next = first; - first = fc; - ret = fc->fid; - } - FontMutexUnlock(); - return ret; -} - -void FontCached::ReleaseId(FontID fid_) { - FontMutexLock(); - FontCached **pcur = &first; - for (FontCached *cur = first; cur; cur = cur->next) { - if (cur->fid == fid_) { - cur->usage--; - if (cur->usage == 0) { - *pcur = cur->next; - cur->Release(); - cur->next = 0; - delete cur; - } - break; - } - pcur = &cur->next; - } - FontMutexUnlock(); -} - -void FontCached::ReleaseAll() { - while (first) { - ReleaseId(first->GetID()); - } -} - -FontID FontCached::CreateNewFont(const FontParameters &fp) { - PangoFontDescription *pfd = pango_font_description_new(); - if (pfd) { - pango_font_description_set_family(pfd, - (fp.faceName[0] == '!') ? fp.faceName+1 : fp.faceName); - pango_font_description_set_size(pfd, pangoUnitsFromDouble(fp.size)); - pango_font_description_set_weight(pfd, static_cast(fp.weight)); - pango_font_description_set_style(pfd, fp.italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL); - return new FontHandle(pfd, fp.characterSet); - } - - return new FontHandle(); -} - Font::Font() : fid(0) {} Font::~Font() {} void Font::Create(const FontParameters &fp) { Release(); - fid = FontCached::FindOrCreate(fp); + fid = FontHandle::CreateNewFont(fp); } void Font::Release() { if (fid) - FontCached::ReleaseId(fid); + delete static_cast(fid); fid = 0; } @@ -989,13 +778,6 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION if (font_.GetID()) { const int lenPositions = len; if (PFont(font_)->pfd) { - if (len == 1) { - int width = PFont(font_)->CharWidth(*s, et); - if (width) { - positions[0] = width; - return; - } - } pango_layout_set_font_description(layout, PFont(font_)->pfd); if (et == UTF8) { // Simple and direct as UTF-8 is native Pango encoding @@ -1089,10 +871,6 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION PLATFORM_ASSERT(i == lenPositions); } } - if (len == 1) { - PFont(font_)->SetCharWidth(*s, positions[0], et); - } - return; } } else { // No font so return an ascending range of values @@ -1148,20 +926,17 @@ XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) { XYPOSITION SurfaceImpl::Ascent(Font &font_) { if (!(font_.GetID())) return 1; - FontMutexLock(); - int ascent = PFont(font_)->ascent; - if ((ascent == 0) && (PFont(font_)->pfd)) { + int ascent = 0; + if (PFont(font_)->pfd) { PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PFont(font_)->pfd, pango_context_get_language(pcontext)); - PFont(font_)->ascent = + ascent = doubleFromPangoUnits(pango_font_metrics_get_ascent(metrics)); pango_font_metrics_unref(metrics); - ascent = PFont(font_)->ascent; } if (ascent == 0) { ascent = 1; } - FontMutexUnlock(); return ascent; } @@ -2298,10 +2073,7 @@ int Platform::Clamp(int val, int minVal, int maxVal) { } void Platform_Initialise() { - FontMutexAllocate(); } void Platform_Finalise() { - FontCached::ReleaseAll(); - FontMutexFree(); } diff --git a/scintilla/gtk/ScintillaGTK.cxx b/scintilla/gtk/ScintillaGTK.cxx index 11f09567b..7f1929420 100644 --- a/scintilla/gtk/ScintillaGTK.cxx +++ b/scintilla/gtk/ScintillaGTK.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -423,7 +424,7 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : } ScintillaGTK::~ScintillaGTK() { - g_idle_remove_by_data(this); + g_source_remove_by_user_data(this); if (evbtn) { gdk_event_free(reinterpret_cast(evbtn)); evbtn = 0; @@ -1077,7 +1078,7 @@ bool ScintillaGTK::FineTickerRunning(TickReason reason) { void ScintillaGTK::FineTickerStart(TickReason reason, int millis, int /* tolerance */) { FineTickerCancel(reason); - timers[reason].timer = g_timeout_add(millis, TimeOut, &timers[reason]); + timers[reason].timer = gdk_threads_add_timeout(millis, TimeOut, &timers[reason]); } void ScintillaGTK::FineTickerCancel(TickReason reason) { @@ -1093,7 +1094,7 @@ bool ScintillaGTK::SetIdle(bool on) { if (!idler.state) { idler.state = true; idler.idlerID = reinterpret_cast( - g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, IdleCallback, this, NULL)); + gdk_threads_add_idle_full(G_PRIORITY_DEFAULT_IDLE, IdleCallback, this, NULL)); } } else { // Stop idler, if it's running @@ -2192,6 +2193,7 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) { bool shift = (event->state & GDK_SHIFT_MASK) != 0; bool ctrl = (event->state & GDK_CONTROL_MASK) != 0; bool alt = (event->state & GDK_MOD1_MASK) != 0; + bool super = (event->state & GDK_MOD4_MASK) != 0; guint key = event->keyval; if ((ctrl || alt) && (key < 128)) key = toupper(key); @@ -2208,15 +2210,12 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) { bool consumed = false; #if !(PLAT_GTK_MACOSX) - bool added = KeyDown(key, shift, ctrl, alt, &consumed) != 0; + bool meta = false; #else bool meta = ctrl; ctrl = (event->state & GDK_META_MASK) != 0; - bool added = KeyDownWithModifiers(key, (shift ? SCI_SHIFT : 0) | - (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0) | - (meta ? SCI_META : 0), &consumed) != 0; #endif + bool added = KeyDownWithModifiers(key, ModifierFlags(shift, ctrl, alt, meta, super), &consumed) != 0; if (!consumed) consumed = added; //fprintf(stderr, "SK-key: %d %x %x\n",event->keyval, event->state, consumed); @@ -2454,13 +2453,8 @@ void ScintillaGTK::PreeditChangedInlineThis() { pdoc->TentativeStart(); // TentativeActive() from now on - // Get preedit string attribues std::vector indicator = MapImeIndicators(preeditStr.attrs, preeditStr.str); - // Display preedit characters, one by one - glong imeCharPos[maxLenInputIME+1] = { 0 }; - glong charWidth = 0; - bool tmpRecordingMacro = recordingMacro; recordingMacro = false; for (glong i = 0; i < preeditStr.uniStrLen; i++) { @@ -2472,21 +2466,22 @@ void ScintillaGTK::PreeditChangedInlineThis() { AddCharUTF(docChar.c_str(), docChar.size()); - // Draw an indicator on the character, DrawImeIndicator(indicator[i], docChar.size()); - - // Record character positions in UTF-8 or DBCS bytes - charWidth += docChar.size(); - imeCharPos[i+1] = charWidth; } recordingMacro = tmpRecordingMacro; // Move caret to ime cursor position. - MoveImeCarets( - (imeCharPos[preeditStr.uniStrLen]) + imeCharPos[preeditStr.cursor_pos]); + int imeEndToImeCaretU32 = preeditStr.cursor_pos - preeditStr.uniStrLen; + int imeCaretPosDoc = pdoc->GetRelativePosition(CurrentPosition(), imeEndToImeCaretU32); + + MoveImeCarets(- CurrentPosition() + imeCaretPosDoc); if (KoreanIME()) { #if !PLAT_GTK_WIN32 - MoveImeCarets( - imeCharPos[1]); // always 2 bytes for DBCS or 3 bytes for UTF8. + if (preeditStr.cursor_pos > 0) { + int oneCharBefore = pdoc->GetRelativePosition(CurrentPosition(), -1); + MoveImeCarets(- CurrentPosition() + oneCharBefore); + } #endif view.imeCaretBlockOverride = true; } @@ -2939,9 +2934,6 @@ gboolean ScintillaGTK::IdleCallback(gpointer pSci) { ScintillaGTK *sciThis = static_cast(pSci); // Idler will be automatically stopped, if there is nothing // to do while idle. -#ifndef GDK_VERSION_3_6 - gdk_threads_enter(); -#endif bool ret = sciThis->Idle(); if (ret == false) { // FIXME: This will remove the idler from GTK, we don't want to @@ -2949,21 +2941,12 @@ gboolean ScintillaGTK::IdleCallback(gpointer pSci) { // returns false (although, it should be harmless). sciThis->SetIdle(false); } -#ifndef GDK_VERSION_3_6 - gdk_threads_leave(); -#endif return ret; } gboolean ScintillaGTK::StyleIdle(gpointer pSci) { -#ifndef GDK_VERSION_3_6 - gdk_threads_enter(); -#endif ScintillaGTK *sciThis = static_cast(pSci); sciThis->IdleWork(); -#ifndef GDK_VERSION_3_6 - gdk_threads_leave(); -#endif // Idler will be automatically stopped return FALSE; } @@ -2973,7 +2956,7 @@ void ScintillaGTK::QueueIdleWork(WorkNeeded::workItems items, int upTo) { if (!workNeeded.active) { // Only allow one style needed to be queued workNeeded.active = true; - g_idle_add_full(G_PRIORITY_HIGH_IDLE, StyleIdle, this, NULL); + gdk_threads_add_idle_full(G_PRIORITY_HIGH_IDLE, StyleIdle, this, NULL); } } diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index 2103b47b9..6b98b09fc 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -132,6 +132,7 @@ #define SCLEX_SREC 117 #define SCLEX_IHEX 118 #define SCLEX_TEHEX 119 +#define SCLEX_JSON 120 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 @@ -1787,6 +1788,20 @@ #define SCE_HEX_CHECKSUM 16 #define SCE_HEX_CHECKSUM_WRONG 17 #define SCE_HEX_GARBAGE 18 +#define SCE_JSON_DEFAULT 0 +#define SCE_JSON_NUMBER 1 +#define SCE_JSON_STRING 2 +#define SCE_JSON_STRINGEOL 3 +#define SCE_JSON_PROPERTYNAME 4 +#define SCE_JSON_ESCAPESEQUENCE 5 +#define SCE_JSON_LINECOMMENT 6 +#define SCE_JSON_BLOCKCOMMENT 7 +#define SCE_JSON_OPERATOR 8 +#define SCE_JSON_URI 9 +#define SCE_JSON_COMPACTIRI 10 +#define SCE_JSON_KEYWORD 11 +#define SCE_JSON_LDKEYWORD 12 +#define SCE_JSON_ERROR 13 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ #endif diff --git a/scintilla/include/Scintilla.iface b/scintilla/include/Scintilla.iface index 91b3066b5..71defe09d 100644 --- a/scintilla/include/Scintilla.iface +++ b/scintilla/include/Scintilla.iface @@ -2799,6 +2799,7 @@ val SCLEX_BIBTEX=116 val SCLEX_SREC=117 val SCLEX_IHEX=118 val SCLEX_TEHEX=119 +val SCLEX_JSON=120 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -4677,6 +4678,22 @@ val SCE_HEX_GARBAGE=18 lex IHex=SCLEX_IHEX SCE_HEX_ # Lexical state for SCLEX_TEHEX (shared with Srec) lex TEHex=SCLEX_TEHEX SCE_HEX_ +# Lexical states for SCLEX_JSON +lex JSON=SCLEX_JSON SCE_JSON_ +val SCE_JSON_DEFAULT=0 +val SCE_JSON_NUMBER=1 +val SCE_JSON_STRING=2 +val SCE_JSON_STRINGEOL=3 +val SCE_JSON_PROPERTYNAME=4 +val SCE_JSON_ESCAPESEQUENCE=5 +val SCE_JSON_LINECOMMENT=6 +val SCE_JSON_BLOCKCOMMENT=7 +val SCE_JSON_OPERATOR=8 +val SCE_JSON_URI=9 +val SCE_JSON_COMPACTIRI=10 +val SCE_JSON_KEYWORD=11 +val SCE_JSON_LDKEYWORD=12 +val SCE_JSON_ERROR=13 # Events diff --git a/scintilla/lexers/LexCPP.cxx b/scintilla/lexers/LexCPP.cxx index 76190002a..4261084d4 100644 --- a/scintilla/lexers/LexCPP.cxx +++ b/scintilla/lexers/LexCPP.cxx @@ -761,6 +761,9 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i lineCurrent++; lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); + if (rawStringTerminator != "") { + rawSTNew.Set(lineCurrent-1, rawStringTerminator); + } sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { // Even in UTF-8, \r and \n are separate diff --git a/scintilla/lexers/LexPython.cxx b/scintilla/lexers/LexPython.cxx index 7cd3bc8de..19dd0ca3b 100644 --- a/scintilla/lexers/LexPython.cxx +++ b/scintilla/lexers/LexPython.cxx @@ -117,6 +117,17 @@ inline bool IsAWordStart(int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } +static bool IsFirstNonWhitespace(Sci_Position pos, Accessor &styler) { + Sci_Position line = styler.GetLine(pos); + Sci_Position start_pos = styler.LineStart(line); + for (Sci_Position i = start_pos; i < pos; i++) { + char ch = styler[i]; + if (!(ch == ' ' || ch == '\t')) + return false; + } + return true; +} + // Options used for LexerPython struct OptionsPython { int whingeLevel; @@ -560,7 +571,10 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in } else if (sc.ch == '#') { sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE); } else if (sc.ch == '@') { - sc.SetState(SCE_P_DECORATOR); + if (IsFirstNonWhitespace(sc.currentPos, styler)) + sc.SetState(SCE_P_DECORATOR); + else + sc.SetState(SCE_P_OPERATOR); } else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) { Sci_PositionU nextIndex = 0; sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals)); diff --git a/scintilla/lexers/LexRust.cxx b/scintilla/lexers/LexRust.cxx index 0d40de2cf..a834e32f4 100644 --- a/scintilla/lexers/LexRust.cxx +++ b/scintilla/lexers/LexRust.cxx @@ -339,7 +339,7 @@ static bool IsOneCharOperator(int c) { || c == '*' || c == '/' || c == '^' || c == '%' || c == '.' || c == ':' || c == '!' || c == '<' || c == '>' || c == '=' || c == '-' || c == '&' - || c == '|' || c == '$'; + || c == '|' || c == '$' || c == '?'; } static bool IsTwoCharOperator(int c, int n) { diff --git a/scintilla/lexlib/Accessor.cxx b/scintilla/lexlib/Accessor.cxx index 283de5bd4..f8b46ef88 100644 --- a/scintilla/lexlib/Accessor.cxx +++ b/scintilla/lexlib/Accessor.cxx @@ -1,6 +1,6 @@ // Scintilla source code edit control -/** @file KeyWords.cxx - ** Colourise for particular languages. +/** @file Accessor.cxx + ** Interfaces between Scintilla and lexers. **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. diff --git a/scintilla/lexlib/WordList.cxx b/scintilla/lexlib/WordList.cxx index be7fda505..63d22338f 100644 --- a/scintilla/lexlib/WordList.cxx +++ b/scintilla/lexlib/WordList.cxx @@ -1,6 +1,6 @@ // Scintilla source code edit control -/** @file KeyWords.cxx - ** Colourise for particular languages. +/** @file WordList.cxx + ** Hold a list of words. **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. diff --git a/scintilla/scintilla_changes.patch b/scintilla/scintilla_changes.patch index 7e0df8e75..aa04574dd 100644 --- a/scintilla/scintilla_changes.patch +++ b/scintilla/scintilla_changes.patch @@ -82,7 +82,7 @@ diff --git scintilla/src/Catalogue.cxx scintilla/src/Catalogue.cxx index ed47aa8..e58f1ab 100644 --- scintilla/src/Catalogue.cxx +++ scintilla/src/Catalogue.cxx -@@ -77,120 +77,50 @@ int Scintilla_LinkLexers() { +@@ -77,121 +77,50 @@ int Scintilla_LinkLexers() { //++Autogenerated -- run scripts/LexGen.py to regenerate //**\(\tLINK_LEXER(\*);\n\) @@ -135,6 +135,7 @@ index ed47aa8..e58f1ab 100644 LINK_LEXER(lmHTML); - LINK_LEXER(lmIHex); - LINK_LEXER(lmInno); +- LINK_LEXER(lmJSON); - LINK_LEXER(lmKix); - LINK_LEXER(lmKVIrc); LINK_LEXER(lmLatex); diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index 0c6866409..5e58f26ee 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -2617,9 +2617,9 @@ bool MatchOnLines(const Document *doc, const Regex ®exp, const RESearchRange for (size_t co = 0; co < match.size(); co++) { search.bopat[co] = match[co].first.Pos(); search.eopat[co] = match[co].second.PosRoundUp(); - size_t lenMatch = search.eopat[co] - search.bopat[co]; + Sci::Position lenMatch = search.eopat[co] - search.bopat[co]; search.pat[co].resize(lenMatch); - for (size_t iPos = 0; iPos < lenMatch; iPos++) { + for (Sci::Position iPos = 0; iPos < lenMatch; iPos++) { search.pat[co][iPos] = doc->CharAt(iPos + search.bopat[co]); } } diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx index 805971a88..9ca6e95ad 100644 --- a/scintilla/src/EditView.cxx +++ b/scintilla/src/EditView.cxx @@ -1,5 +1,5 @@ // Scintilla source code edit control -/** @file Editor.cxx +/** @file EditView.cxx ** Defines the appearance of the main text area of the editor window. **/ // Copyright 1998-2014 by Neil Hodgson diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index b480287c3..eddc0e623 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -2265,12 +2265,13 @@ void Editor::DelCharBack(bool allowLineStartDeletion) { ShowCaretAtCurrentPosition(); } -int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta) { +int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta, bool super) { return (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0) | - (meta ? SCI_META : 0); + (meta ? SCI_META : 0) | + (super ? SCI_SUPER : 0); } void Editor::NotifyFocus(bool focus) { diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 67aad42d7..9cc648e84 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -414,7 +414,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void DelCharBack(bool allowLineStartDeletion); virtual void ClaimSelection() = 0; - static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false); + static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false); virtual void NotifyChange() = 0; virtual void NotifyFocus(bool focus); virtual void SetCtrlID(int identifier); diff --git a/scintilla/src/KeyMap.h b/scintilla/src/KeyMap.h index b102b356f..7c4f80720 100644 --- a/scintilla/src/KeyMap.h +++ b/scintilla/src/KeyMap.h @@ -17,6 +17,7 @@ namespace Scintilla { #define SCI_CTRL SCMOD_CTRL #define SCI_ALT SCMOD_ALT #define SCI_META SCMOD_META +#define SCI_SUPER SCMOD_SUPER #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) diff --git a/scintilla/src/Position.h b/scintilla/src/Position.h index 4ef655263..120b92f62 100644 --- a/scintilla/src/Position.h +++ b/scintilla/src/Position.h @@ -1,6 +1,6 @@ // Scintilla source code edit control /** @file Position.h - ** Will define global type name Position in the Sci internal namespace. + ** Defines global type name Position in the Sci internal namespace. **/ // Copyright 2015 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. @@ -8,14 +8,21 @@ #ifndef POSITION_H #define POSITION_H +/** + * A Position is a position within a document between two characters or at the beginning or end. + * Sometimes used as a character index where it identifies the character after the position. + */ + namespace Sci { -// After 3.6.0: -// typedef int Position; +typedef int Position; // A later version (4.x) of this file may: //#if defined(SCI_LARGE_FILE_SUPPORT) -//typedef ptrdiff_t Position; +//typedef std::ptrdiff_t Position; +// or may allow runtime choice between different position sizes. + +const Position invalidPosition = -1; } diff --git a/scintilla/src/RESearch.h b/scintilla/src/RESearch.h index 3a7f0e4d6..23795babe 100644 --- a/scintilla/src/RESearch.h +++ b/scintilla/src/RESearch.h @@ -39,7 +39,7 @@ public: int Execute(CharacterIndexer &ci, int lp, int endp); enum { MAXTAG=10 }; - enum { MAXNFA=2048 }; + enum { MAXNFA=4096 }; enum { NOTFOUND=-1 }; int bopat[MAXTAG]; diff --git a/scintilla/version.txt b/scintilla/version.txt index 9c6f0c3e0..475310214 100644 --- a/scintilla/version.txt +++ b/scintilla/version.txt @@ -1 +1 @@ -364 +365 -- 2.11.4.GIT