From 35fce59f65c02414af6cf0fcdc698c61ae0f8b47 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 18 Feb 2018 10:41:51 -0500 Subject: Backported bugfixes and changes from Scintilla 4.0.2 to 4.0.3. --- src/scintilla_backports/6419_8760026bba6a.patch | 142 ++++++++ src/scintilla_backports/6421_fd2f856b8d58.patch | 68 ++++ src/scintilla_backports/6425_73343682cbda.patch | 168 ++++++++++ src/scintilla_backports/6434_ed27432729c3.patch | 50 +++ src/scintilla_backports/6436_a366ce1a811e.patch | 110 +++++++ src/scintilla_backports/6441_92c8f0f1b3e6.patch | 157 +++++++++ src/scintilla_backports/6442_3e3bfe29a819.patch | 319 ++++++++++++++++++ src/scintilla_backports/6444_1bd57324aa36.patch | 279 ++++++++++++++++ src/scintilla_backports/6445_89d992f380a1.patch | 418 ++++++++++++++++++++++++ src/scintilla_backports/6448_431b814a54a6.patch | 307 +++++++++++++++++ src/scintilla_backports/6449_1280ef150bbb.patch | 42 +++ 11 files changed, 2060 insertions(+) create mode 100644 src/scintilla_backports/6419_8760026bba6a.patch create mode 100644 src/scintilla_backports/6421_fd2f856b8d58.patch create mode 100644 src/scintilla_backports/6425_73343682cbda.patch create mode 100644 src/scintilla_backports/6434_ed27432729c3.patch create mode 100644 src/scintilla_backports/6436_a366ce1a811e.patch create mode 100644 src/scintilla_backports/6441_92c8f0f1b3e6.patch create mode 100644 src/scintilla_backports/6442_3e3bfe29a819.patch create mode 100644 src/scintilla_backports/6444_1bd57324aa36.patch create mode 100644 src/scintilla_backports/6445_89d992f380a1.patch create mode 100644 src/scintilla_backports/6448_431b814a54a6.patch create mode 100644 src/scintilla_backports/6449_1280ef150bbb.patch (limited to 'src') diff --git a/src/scintilla_backports/6419_8760026bba6a.patch b/src/scintilla_backports/6419_8760026bba6a.patch new file mode 100644 index 00000000..a477a80e --- /dev/null +++ b/src/scintilla_backports/6419_8760026bba6a.patch @@ -0,0 +1,142 @@ +# HG changeset patch +# User Neil Hodgson +# Date 1511240678 -39600 +# Node ID 8760026bba6ab6a5c6ee3d2d7bd7a291ecb74574 +# Parent 85205da6ec1b8eeb14c3edc94064fb0d8f685377 +Update marshalling of signals from Scintilla, changing deprecated NONE to VOID. +Has no effect on clients as NONE was an alias for VOID. + +diff -r 85205da6ec1b -r 8760026bba6a gtk/scintilla-marshal.c +--- a/gtk/scintilla-marshal.c Mon Nov 20 12:24:51 2017 +1100 ++++ b/gtk/scintilla-marshal.c Tue Nov 21 16:04:38 2017 +1100 +@@ -1,6 +1,4 @@ +- +-#include +- ++#include + + #ifdef G_ENABLE_DEBUG + #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) +@@ -48,8 +46,7 @@ + #define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer + #endif /* !G_ENABLE_DEBUG */ + +- +-/* NONE:INT,OBJECT (scintilla-marshal.list:1) */ ++/* VOID:INT,OBJECT (scintilla-marshal.list:1) */ + void + scintilla_marshal_VOID__INT_OBJECT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, +@@ -58,13 +55,13 @@ + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) + { +- typedef void (*GMarshalFunc_VOID__INT_OBJECT) (gpointer data1, +- gint arg_1, +- gpointer arg_2, +- gpointer data2); ++ typedef void (*GMarshalFunc_VOID__INT_OBJECT) (gpointer data1, ++ gint arg1, ++ gpointer arg2, ++ gpointer data2); ++ GCClosure *cc = (GCClosure *) closure; ++ gpointer data1, data2; + GMarshalFunc_VOID__INT_OBJECT callback; +- GCClosure *cc = (GCClosure*) closure; +- gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + +@@ -86,7 +83,7 @@ + data2); + } + +-/* NONE:INT,BOXED (scintilla-marshal.list:2) */ ++/* VOID:INT,BOXED (scintilla-marshal.list:2) */ + void + scintilla_marshal_VOID__INT_BOXED (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, +@@ -95,13 +92,13 @@ + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) + { +- typedef void (*GMarshalFunc_VOID__INT_BOXED) (gpointer data1, +- gint arg_1, +- gpointer arg_2, +- gpointer data2); ++ typedef void (*GMarshalFunc_VOID__INT_BOXED) (gpointer data1, ++ gint arg1, ++ gpointer arg2, ++ gpointer data2); ++ GCClosure *cc = (GCClosure *) closure; ++ gpointer data1, data2; + GMarshalFunc_VOID__INT_BOXED callback; +- GCClosure *cc = (GCClosure*) closure; +- gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + +diff -r 85205da6ec1b -r 8760026bba6a gtk/scintilla-marshal.h +--- a/gtk/scintilla-marshal.h Mon Nov 20 12:24:51 2017 +1100 ++++ b/gtk/scintilla-marshal.h Tue Nov 21 16:04:38 2017 +1100 +@@ -1,30 +1,30 @@ ++/* This file is generated, all changes will be lost */ ++#ifndef __SCINTILLA_MARSHAL_MARSHAL_H__ ++#define __SCINTILLA_MARSHAL_MARSHAL_H__ + +-#ifndef __scintilla_marshal_MARSHAL_H__ +-#define __scintilla_marshal_MARSHAL_H__ +- +-#include ++#include + + G_BEGIN_DECLS + +-/* NONE:INT,OBJECT (scintilla-marshal.list:1) */ +-extern void scintilla_marshal_VOID__INT_OBJECT (GClosure *closure, +- GValue *return_value, +- guint n_param_values, +- const GValue *param_values, +- gpointer invocation_hint, +- gpointer marshal_data); +-#define scintilla_marshal_NONE__INT_OBJECT scintilla_marshal_VOID__INT_OBJECT ++/* VOID:INT,OBJECT (scintilla-marshal.list:1) */ ++extern ++void scintilla_marshal_VOID__INT_OBJECT (GClosure *closure, ++ GValue *return_value, ++ guint n_param_values, ++ const GValue *param_values, ++ gpointer invocation_hint, ++ gpointer marshal_data); + +-/* NONE:INT,BOXED (scintilla-marshal.list:2) */ +-extern void scintilla_marshal_VOID__INT_BOXED (GClosure *closure, +- GValue *return_value, +- guint n_param_values, +- const GValue *param_values, +- gpointer invocation_hint, +- gpointer marshal_data); +-#define scintilla_marshal_NONE__INT_BOXED scintilla_marshal_VOID__INT_BOXED ++/* VOID:INT,BOXED (scintilla-marshal.list:2) */ ++extern ++void scintilla_marshal_VOID__INT_BOXED (GClosure *closure, ++ GValue *return_value, ++ guint n_param_values, ++ const GValue *param_values, ++ gpointer invocation_hint, ++ gpointer marshal_data); ++ + + G_END_DECLS + +-#endif /* __scintilla_marshal_MARSHAL_H__ */ +- ++#endif /* __SCINTILLA_MARSHAL_MARSHAL_H__ */ +diff -r 85205da6ec1b -r 8760026bba6a gtk/scintilla-marshal.list +--- a/gtk/scintilla-marshal.list Mon Nov 20 12:24:51 2017 +1100 ++++ b/gtk/scintilla-marshal.list Tue Nov 21 16:04:38 2017 +1100 +@@ -1,2 +1,2 @@ +-NONE:INT,OBJECT +-NONE:INT,BOXED ++VOID:INT,OBJECT ++VOID:INT,BOXED diff --git a/src/scintilla_backports/6421_fd2f856b8d58.patch b/src/scintilla_backports/6421_fd2f856b8d58.patch new file mode 100644 index 00000000..9e354864 --- /dev/null +++ b/src/scintilla_backports/6421_fd2f856b8d58.patch @@ -0,0 +1,68 @@ +# HG changeset patch +# User Greg Smith +# Date 1513111541 -39600 +# Node ID fd2f856b8d582df2e3e60073721a84b9f464a72b +# Parent 2286dd5fa6259c67cc8ce0d4c39b1c2e6f85ff1f +Use explicit typedefs instead of deprecated derivation from std::iterator. +This fixes a C4996 / STL4015 warning from Visual C++ 2017.5 that the +std::iterator class template is deprecated in C++17. + +diff -r 2286dd5fa625 -r fd2f856b8d58 src/Document.cxx +--- a/src/Document.cxx Tue Nov 21 16:16:25 2017 +1100 ++++ b/src/Document.cxx Wed Dec 13 07:45:41 2017 +1100 +@@ -2600,8 +2600,14 @@ + + #ifndef NO_CXX11_REGEX + +-class ByteIterator : public std::iterator { ++class ByteIterator { + public: ++ typedef std::bidirectional_iterator_tag iterator_category; ++ typedef char value_type; ++ typedef ptrdiff_t difference_type; ++ typedef char* pointer; ++ typedef char& reference; ++ + const Document *doc; + Sci::Position position; + ByteIterator(const Document *doc_ = 0, Sci::Position position_ = 0) : doc(doc_), position(position_) { +@@ -2663,7 +2669,7 @@ + + // On Windows, report non-BMP characters as 2 separate surrogates as that + // matches wregex since it is based on wchar_t. +-class UTF8Iterator : public std::iterator { ++class UTF8Iterator { + // These 3 fields determine the iterator position and are used for comparisons + const Document *doc; + Sci::Position position; +@@ -2673,6 +2679,12 @@ + size_t lenCharacters; + wchar_t buffered[2]; + public: ++ typedef std::bidirectional_iterator_tag iterator_category; ++ typedef wchar_t value_type; ++ typedef ptrdiff_t difference_type; ++ typedef wchar_t* pointer; ++ typedef wchar_t& reference; ++ + UTF8Iterator(const Document *doc_ = 0, Sci::Position position_ = 0) : + doc(doc_), position(position_), characterIndex(0), lenBytes(0), lenCharacters(0) { + buffered[0] = 0; +@@ -2775,10 +2787,16 @@ + + // On Unix, report non-BMP characters as single characters + +-class UTF8Iterator : public std::iterator { ++class UTF8Iterator { + const Document *doc; + Sci::Position position; + public: ++ typedef std::bidirectional_iterator_tag iterator_category; ++ typedef wchar_t value_type; ++ typedef ptrdiff_t difference_type; ++ typedef wchar_t* pointer; ++ typedef wchar_t& reference; ++ + UTF8Iterator(const Document *doc_=0, Sci::Position position_=0) : doc(doc_), position(position_) { + } + UTF8Iterator(const UTF8Iterator &other) NOEXCEPT { diff --git a/src/scintilla_backports/6425_73343682cbda.patch b/src/scintilla_backports/6425_73343682cbda.patch new file mode 100644 index 00000000..80225666 --- /dev/null +++ b/src/scintilla_backports/6425_73343682cbda.patch @@ -0,0 +1,168 @@ +# HG changeset patch +# User Neil +# Date 1513656040 -39600 +# Node ID 73343682cbda0937c5427ee45ea6c9104d97ac1e +# Parent 5246ca55cf2443dbd6d37bc6dfede6d5f3a14a36 +Start of bidirectional code - implement SCI_SETBIDIRECTIONAL. + +diff -r 5246ca55cf24 -r 73343682cbda doc/ScintillaDoc.html +--- a/doc/ScintillaDoc.html Wed Jan 10 10:04:03 2018 +1100 ++++ b/doc/ScintillaDoc.html Tue Dec 19 15:00:40 2017 +1100 +@@ -119,7 +119,7 @@ + +

Scintilla Documentation

+ +-

Last edited 11 August 2017 NH

++

Last edited 10 January 2018 NH

+ +

There is an overview of the internal design of + Scintilla.
+@@ -3594,6 +3594,10 @@ + SCI_GETCODEPAGE → int
+ SCI_SETIMEINTERACTION(int imeInteraction)
+ SCI_GETIMEINTERACTION → int
++

+ SCI_GRABFOCUS
+ SCI_SETFOCUS(bool focus)
+ SCI_GETFOCUS → bool
+@@ -3718,6 +3722,27 @@ + and the inline behaviour with SCI_SETIMEINTERACTION(SC_IME_INLINE). + Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.

+ ++
++ These bidirectional features are not yet implemented and the API is provisional
++

SCI_SETBIDIRECTIONAL(int bidirectional)
++ SCI_GETBIDIRECTIONAL → int
++ Some languages, like Arabic and Hebrew, are written from right to left instead of from left to right as English is. ++ Documents that use multiple languages may contain both directions and this is termed "bidirectional". ++ The default text direction may be right to left or left to right. ++ Scintilla only correctly displays bidirectional text on some platforms and there can be additional processing and storage ++ costs to this. ++ Currently, bidirectional text only works on Win32 using DirectWrite. ++ As some applications may not want to pay the costs, bidirectional support must be explicitly enabled by calling ++ SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_L2R) (1) which chooses left to right as the default direction or ++ SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_R2L) (2) for default right to left. ++ This should be done after setting the technology to SC_TECHNOLOGY_DIRECTWRITE, ++ SC_TECHNOLOGY_DIRECTWRITERETAIN, or ++ SC_TECHNOLOGY_DIRECTWRITEDC.

++

If the call succeeded SCI_GETBIDIRECTIONAL will return the same value otherwise ++ SC_BIDIRECTIONAL_DISABLED (0) is returned. ++

++
++ +

SCI_GRABFOCUS
+ SCI_SETFOCUS(bool focus)
+ SCI_GETFOCUS → bool
+@@ -8073,8 +8098,6 @@ + +

Provisional features are displayed in this document with a distinctive background colour.

+ +-

There are currently no provisional messages or values.

+- +

Some developers may want to only use features that are stable and have graduated from + provisional status. To avoid using provisional messages compile with the symbol + SCI_DISABLE_PROVISIONAL defined.

+diff -r 5246ca55cf24 -r 73343682cbda include/Scintilla.h +--- a/include/Scintilla.h Wed Jan 10 10:04:03 2018 +1100 ++++ b/include/Scintilla.h Tue Dec 19 15:00:40 2017 +1100 +@@ -1103,5 +1103,12 @@ + #define SCN_AUTOCCOMPLETED 2030 + #define SCN_MARGINRIGHTCLICK 2031 ++#ifndef SCI_DISABLE_PROVISIONAL ++#define SC_BIDIRECTIONAL_DISABLED 0 ++#define SC_BIDIRECTIONAL_L2R 1 ++#define SC_BIDIRECTIONAL_R2L 2 ++#define SCI_GETBIDIRECTIONAL 2708 ++#define SCI_SETBIDIRECTIONAL 2709 ++#endif + /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ + + /* These structures are defined to be exactly the same shape as the Win32 +diff -r 5246ca55cf24 -r 73343682cbda include/Scintilla.iface +--- a/include/Scintilla.iface Wed Jan 10 10:04:03 2018 +1100 ++++ b/include/Scintilla.iface Tue Dec 19 15:00:40 2017 +1100 +@@ -4861,9 +4861,18 @@ + evt void MarginRightClick=2031(int modifiers, int position, int margin) + +-# There are no provisional APIs currently, but some arguments to SCI_SETTECHNOLOGY are provisional. +- + cat Provisional + ++enu Bidirectional=SC_BIDIRECTIONAL_ ++val SC_BIDIRECTIONAL_DISABLED=0 ++val SC_BIDIRECTIONAL_L2R=1 ++val SC_BIDIRECTIONAL_R2L=2 ++ ++# Retrieve bidirectional text display state. ++get int GetBidirectional=2708(,) ++ ++# Set bidirectional text display state. ++set void SetBidirectional=2709(int bidirectional,) ++ + cat Deprecated + + # Divide each styling byte into lexical class bits (default: 5) and indicator +diff -r 5246ca55cf24 -r 73343682cbda src/EditModel.cxx +--- a/src/EditModel.cxx Wed Jan 10 10:04:03 2018 +1100 ++++ b/src/EditModel.cxx Tue Dec 19 15:00:40 2017 +1100 +@@ -63,6 +63,7 @@ + highlightGuideColumn = 0; + primarySelection = true; + imeInteraction = imeWindowed; ++ bidirectional = Bidirectional::bidiDisabled; + foldFlags = 0; + foldDisplayTextStyle = SC_FOLDDISPLAYTEXT_HIDDEN; + hotspot = Range(Sci::invalidPosition); +diff -r 5246ca55cf24 -r 73343682cbda src/EditModel.h +--- a/src/EditModel.h Wed Jan 10 10:04:03 2018 +1100 ++++ b/src/EditModel.h Tue Dec 19 15:00:40 2017 +1100 +@@ -38,6 +38,8 @@ + + enum IMEInteraction { imeWindowed, imeInline } imeInteraction; + ++ enum class Bidirectional { bidiDisabled, bidiL2R, bidiR2L } bidirectional; ++ + int foldFlags; + int foldDisplayTextStyle; + ContractionState cs; +diff -r 5246ca55cf24 -r 73343682cbda src/Editor.cxx +--- a/src/Editor.cxx Wed Jan 10 10:04:03 2018 +1100 ++++ b/src/Editor.cxx Tue Dec 19 15:00:40 2017 +1100 +@@ -6736,6 +6736,13 @@ + case SCI_GETIMEINTERACTION: + return imeInteraction; + ++ case SCI_SETBIDIRECTIONAL: ++ // SCI_SETBIDIRECTIONAL is implemented on platform subclasses if they support bidirectional text. ++ break; ++ ++ case SCI_GETBIDIRECTIONAL: ++ return static_cast(bidirectional); ++ + // Marker definition and setting + case SCI_MARKERDEFINE: + if (wParam <= MARKER_MAX) { +diff -r 5246ca55cf24 -r 73343682cbda win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Wed Jan 10 10:04:03 2018 +1100 ++++ b/win32/ScintillaWin.cxx Tue Dec 19 15:00:40 2017 +1100 +@@ -1744,6 +1744,17 @@ + } + break; + ++ case SCI_SETBIDIRECTIONAL: ++ if (technology == SC_TECHNOLOGY_DEFAULT) { ++ bidirectional = EditModel::Bidirectional::bidiDisabled; ++ } else if ((wParam >= SC_BIDIRECTIONAL_DISABLED) && (wParam <= SC_BIDIRECTIONAL_R2L)) { ++ bidirectional = static_cast(wParam); ++ } ++ // Invalidate all cached information including layout. ++ DropGraphics(true); ++ InvalidateStyleRedraw(); ++ break; ++ + #ifdef SCI_LEXER + case SCI_LOADLEXERLIBRARY: + LexerManager::GetInstance()->Load(reinterpret_cast(lParam)); diff --git a/src/scintilla_backports/6434_ed27432729c3.patch b/src/scintilla_backports/6434_ed27432729c3.patch new file mode 100644 index 00000000..fafca810 --- /dev/null +++ b/src/scintilla_backports/6434_ed27432729c3.patch @@ -0,0 +1,50 @@ +# HG changeset patch +# User Neil +# Date 1517090168 -39600 +# Node ID ed27432729c386c48ef4f11459aeb2ed1f0856c8 +# Parent 231ac99e1fdc2b0fa62668cf5495b2f7df3f4d82 +Use std::abs in preference to abs as std::abs is generic and abs casts to int +which may drop information. + +diff -r 231ac99e1fdc -r ed27432729c3 src/Document.cxx +--- a/src/Document.cxx Sun Jan 28 08:32:17 2018 +1100 ++++ b/src/Document.cxx Sun Jan 28 08:56:08 2018 +1100 +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -877,7 +878,7 @@ + const Sci::Position posNext = NextPosition(pos, increment); + if (posNext == pos) + return INVALID_POSITION; +- if (abs(pos-posNext) > 3) // 4 byte character = 2*UTF16. ++ if (std::abs(pos-posNext) > 3) // 4 byte character = 2*UTF16. + characterOffset -= increment; + pos = posNext; + characterOffset -= increment; +diff -r 231ac99e1fdc -r ed27432729c3 src/Editor.cxx +--- a/src/Editor.cxx Sun Jan 28 08:32:17 2018 +1100 ++++ b/src/Editor.cxx Sun Jan 28 08:56:08 2018 +1100 +@@ -11,8 +11,8 @@ + #include + #include + #include +- + #include ++ + #include + #include + #include +@@ -934,7 +934,7 @@ + // Try to optimise small scrolls + #ifndef UNDER_CE + const Sci::Line linesToMove = topLine - topLineNew; +- const bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting); ++ const bool performBlit = (std::abs(linesToMove) <= 10) && (paintState == notPainting); + willRedrawAll = !performBlit; + #endif + SetTopLine(topLineNew); diff --git a/src/scintilla_backports/6436_a366ce1a811e.patch b/src/scintilla_backports/6436_a366ce1a811e.patch new file mode 100644 index 00000000..f2a22132 --- /dev/null +++ b/src/scintilla_backports/6436_a366ce1a811e.patch @@ -0,0 +1,110 @@ +# HG changeset patch +# User Neil +# Date 1517091000 -39600 +# Node ID a366ce1a811e322b24f08a20825947113d39d698 +# Parent 5dd1b26df75f0ffa20624a61d1b77d24406ba048 +Use std::end when filling arrays as reduces chance of mistake. + +diff -r 5dd1b26df75f -r a366ce1a811e lexlib/WordList.cxx +--- a/lexlib/WordList.cxx Sun Jan 28 08:57:56 2018 +1100 ++++ b/lexlib/WordList.cxx Sun Jan 28 09:10:00 2018 +1100 +@@ -10,6 +10,7 @@ + #include + + #include ++#include + + #include "StringCopy.h" + #include "WordList.h" +@@ -128,7 +129,7 @@ + #else + SortWordList(words, len); + #endif +- std::fill(starts, starts + ELEMENTS(starts), -1); ++ std::fill(starts, std::end(starts), -1); + for (int l = len - 1; l >= 0; l--) { + unsigned char indexChar = words[l][0]; + starts[indexChar] = l; +diff -r 5dd1b26df75f -r a366ce1a811e scripts/HeaderOrder.txt +--- a/scripts/HeaderOrder.txt Sun Jan 28 08:57:56 2018 +1100 ++++ b/scripts/HeaderOrder.txt Sun Jan 28 09:10:00 2018 +1100 +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff -r 5dd1b26df75f -r a366ce1a811e src/PositionCache.cxx +--- a/src/PositionCache.cxx Sun Jan 28 08:57:56 2018 +1100 ++++ b/src/PositionCache.cxx Sun Jan 28 09:10:00 2018 +1100 +@@ -14,5 +14,6 @@ + #include + #include + #include ++#include + + #include "Platform.h" +@@ -378,7 +379,7 @@ + } + + SpecialRepresentations::SpecialRepresentations() { +- std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast(0)); ++ std::fill(startByteHasReprs, std::end(startByteHasReprs), static_cast(0)); + } + + void SpecialRepresentations::SetRepresentation(const char *charBytes, const char *value) { +@@ -419,7 +420,7 @@ + + void SpecialRepresentations::Clear() { + mapReprs.clear(); +- std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast(0)); ++ std::fill(startByteHasReprs, std::end(startByteHasReprs), static_cast(0)); + } + + void BreakFinder::Insert(int val) { +diff -r 5dd1b26df75f -r a366ce1a811e src/RESearch.cxx +--- a/src/RESearch.cxx Sun Jan 28 08:57:56 2018 +1100 ++++ b/src/RESearch.cxx Sun Jan 28 09:10:00 2018 +1100 +@@ -205,6 +205,7 @@ + #include + #include + #include ++#include + + #include "Position.h" + #include "CharClassify.h" +@@ -254,9 +255,9 @@ + charClass = charClassTable; + sta = NOP; /* status of lastpat */ + bol = 0; +- std::fill(bittab, bittab + BITBLK, static_cast(0)); +- std::fill(tagstk, tagstk + MAXTAG, 0); +- std::fill(nfa, nfa + MAXNFA, '\0'); ++ std::fill(bittab, std::end(bittab), static_cast(0)); ++ std::fill(tagstk, std::end(tagstk), 0); ++ std::fill(nfa, std::end(nfa), '\0'); + Clear(); + } + +diff -r 5dd1b26df75f -r a366ce1a811e src/XPM.cxx +--- a/src/XPM.cxx Sun Jan 28 08:57:56 2018 +1100 ++++ b/src/XPM.cxx Sun Jan 28 09:10:00 2018 +1100 +@@ -11,5 +11,7 @@ + #include + #include + #include ++#include ++#include + + #include "Platform.h" +@@ -87,7 +89,7 @@ + if (!linesForm) + return; + +- std::fill(colourCodeTable, colourCodeTable+256, 0); ++ std::fill(colourCodeTable, std::end(colourCodeTable), 0); + const char *line0 = linesForm[0]; + width = atoi(line0); + line0 = NextField(line0); diff --git a/src/scintilla_backports/6441_92c8f0f1b3e6.patch b/src/scintilla_backports/6441_92c8f0f1b3e6.patch new file mode 100644 index 00000000..edcc6338 --- /dev/null +++ b/src/scintilla_backports/6441_92c8f0f1b3e6.patch @@ -0,0 +1,157 @@ +# HG changeset patch +# User Neil +# Date 1516925530 -39600 +# Node ID 92c8f0f1b3e64900cbb868a56936898693b9cfcc +# Parent a1731ae83d2ac87c29f6b502efc5c4a747e0b704 +Add documentOption argument to SCI_CREATELOADER. + +diff -r a1731ae83d2a -r 92c8f0f1b3e6 doc/ScintillaDoc.html +--- a/doc/ScintillaDoc.html Tue Jan 30 12:40:53 2018 +1100 ++++ b/doc/ScintillaDoc.html Fri Jan 26 11:12:10 2018 +1100 +@@ -119,7 +119,7 @@ + +

Scintilla Documentation

+ +-

Last edited 10 January 2018 NH

++

Last edited 31 January 2018 NH

+ +

There is an overview of the internal design of + Scintilla.
+@@ -5711,7 +5711,7 @@ + SCI_GETDOCPOINTER → document *
+ SCI_SETDOCPOINTER(<unused>, document + *doc)
+- SCI_CREATEDOCUMENT → document *
++ SCI_CREATEDOCUMENT(int bytes, int documentOption) → document *
+ SCI_ADDREFDOCUMENT(<unused>, document + *doc)
+ SCI_RELEASEDOCUMENT(<unused>, document +@@ -5732,13 +5732,20 @@ + window.
+ 6. If doc was not 0, its reference count is increased by 1.

+ +-

SCI_CREATEDOCUMENT → document *
++

SCI_CREATEDOCUMENT(int bytes, int documentOption) → document *
+ This message creates a new, empty document and returns a pointer to it. This document is not +- selected into the editor and starts with a reference count of 1. This means that you have +- ownership of it and must either reduce its reference count by 1 after using ++ selected into the editor and starts with a reference count of 1. This means that you have ++ ownership of it and must either reduce its reference count by 1 after using + SCI_SETDOCPOINTER so that the Scintilla window owns it or you must make sure that +- you reduce the reference count by 1 with SCI_RELEASEDOCUMENT before you close the +- application to avoid memory leaks.

++ you reduce the reference count by 1 with SCI_RELEASEDOCUMENT before you close the ++ application to avoid memory leaks. The bytes argument determines ++ the initial memory allocation for the document as it is more efficient ++ to allocate once rather than rely on the buffer growing as data is added. ++ If SCI_CREATEDOCUMENT fails then 0 is returned.

++ ++

The documentOption argument may be used in future versions ++ to choose between different document capabilities which affect memory allocation and performance. ++ The only valid value for now is SC_DOCUMENTOPTION_DEFAULT (0).

+ +

SCI_ADDREFDOCUMENT(<unused>, document *doc)
+ This increases the reference count of a document by 1. If you want to replace the current +@@ -5765,7 +5772,7 @@ + +

Loading in the background

+ +-
SCI_CREATELOADER(int bytes) → int
++ SCI_CREATELOADER(int bytes, int documentOption) → int
+
+ +

An application can load all of a file into a buffer it allocates on a background thread and then add the data in that buffer +@@ -5774,13 +5781,17 @@ + +

To avoid these issues, a loader object may be created and used to load the file. The loader object supports the ILoader interface.

+ +-

SCI_CREATELOADER(int bytes) → int
++

SCI_CREATELOADER(int bytes, int documentOption) → int
+ Create an object that supports the ILoader interface which can be used to load data and then + be turned into a Scintilla document object for attachment to a view object. + The bytes argument determines the initial memory allocation for the document as it is more efficient + to allocate once rather than rely on the buffer growing as data is added. + If SCI_CREATELOADER fails then 0 is returned.

+ ++

The documentOption argument may be used in future versions ++ to choose between different document capabilities which affect memory allocation and performance. ++ The only valid value for now is SC_DOCUMENTOPTION_DEFAULT (0).

++ +

ILoader

+ +
+@@ -6573,7 +6584,7 @@ + On GTK+, there are storage and performance costs to accessibility, so it can be disabled + by calling SCI_SETACCESSIBILITY. +

+- ++ + + + +@@ -6603,7 +6614,7 @@ + + +
+- ++ +

Lexer

+ +

If you define the symbol SCI_LEXER when building Scintilla, (this is sometimes +@@ -6894,7 +6905,7 @@ +

+ Methods that return strings as const char * are not required to maintain separate allocations indefinitely: + lexer implementations may own a single buffer that is reused for each call. +-Callers should make an immediate copy of returned strings. ++Callers should make an immediate copy of returned strings. +

+ +

+diff -r a1731ae83d2a -r 92c8f0f1b3e6 include/Scintilla.h +--- a/include/Scintilla.h Tue Jan 30 12:40:53 2018 +1100 ++++ b/include/Scintilla.h Fri Jan 26 11:12:10 2018 +1100 +@@ -689,6 +689,7 @@ + #define SCI_SELECTIONISRECTANGLE 2372 + #define SCI_SETZOOM 2373 + #define SCI_GETZOOM 2374 ++#define SC_DOCUMENTOPTION_DEFAULT 0 + #define SCI_CREATEDOCUMENT 2375 + #define SCI_ADDREFDOCUMENT 2376 + #define SCI_RELEASEDOCUMENT 2377 +diff -r a1731ae83d2a -r 92c8f0f1b3e6 include/Scintilla.iface +--- a/include/Scintilla.iface Tue Jan 30 12:40:53 2018 +1100 ++++ b/include/Scintilla.iface Fri Jan 26 11:12:10 2018 +1100 +@@ -1771,9 +1771,12 @@ + # Retrieve the zoom level. + get int GetZoom=2374(,) + ++enu DocumentOption=SC_DOCUMENTOPTION_ ++val SC_DOCUMENTOPTION_DEFAULT=0 ++ + # Create a new document object. + # Starts with reference count of 1 and not selected into editor. +-fun int CreateDocument=2375(,) ++fun int CreateDocument=2375(int bytes, int documentOption) + # Extend life of document. + fun void AddRefDocument=2376(, int doc) + # Release a reference to the document, deleting document if it fades to black. +@@ -2540,7 +2543,7 @@ + get int GetTechnology=2631(,) + + # Create an ILoader*. +-fun int CreateLoader=2632(int bytes,) ++fun int CreateLoader=2632(int bytes, int documentOption) + + # On OS X, show a find indicator. + fun void FindIndicatorShow=2640(position start, position end) +diff -r a1731ae83d2a -r 92c8f0f1b3e6 src/Editor.cxx +--- a/src/Editor.cxx Tue Jan 30 12:40:53 2018 +1100 ++++ b/src/Editor.cxx Fri Jan 26 11:12:10 2018 +1100 +@@ -7556,6 +7556,7 @@ + case SCI_CREATEDOCUMENT: { + Document *doc = new Document(); + doc->AddRef(); ++ doc->Allocate(static_cast(wParam)); + return reinterpret_cast(doc); + } + diff --git a/src/scintilla_backports/6442_3e3bfe29a819.patch b/src/scintilla_backports/6442_3e3bfe29a819.patch new file mode 100644 index 00000000..acc6dbae --- /dev/null +++ b/src/scintilla_backports/6442_3e3bfe29a819.patch @@ -0,0 +1,319 @@ +# HG changeset patch +# User Neil +# Date 1516950278 -39600 +# Node ID 3e3bfe29a819c1f7a1761096ec54e9b6ee446a68 +# Parent 92c8f0f1b3e64900cbb868a56936898693b9cfcc +Extend SplitVector to allow more than 2 billion elements on 64-bit systems. + +diff -r 92c8f0f1b3e6 -r 3e3bfe29a819 src/CellBuffer.cxx +--- a/src/CellBuffer.cxx Fri Jan 26 11:12:10 2018 +1100 ++++ b/src/CellBuffer.cxx Fri Jan 26 18:04:38 2018 +1100 +@@ -394,7 +394,7 @@ + } + + Sci::Position CellBuffer::GapPosition() const { +- return substance.GapPosition(); ++ return static_cast(substance.GapPosition()); + } + + // The char* returned is to an allocation owned by the undo history +@@ -457,7 +457,7 @@ + } + + Sci::Position CellBuffer::Length() const { +- return substance.Length(); ++ return static_cast(substance.Length()); + } + + void CellBuffer::Allocate(Sci::Position newSize) { +diff -r 92c8f0f1b3e6 -r 3e3bfe29a819 src/Partitioning.h +--- a/src/Partitioning.h Fri Jan 26 11:12:10 2018 +1100 ++++ b/src/Partitioning.h Fri Jan 26 18:04:38 2018 +1100 +@@ -16,7 +16,7 @@ + + class SplitVectorWithRangeAdd : public SplitVector { + public: +- explicit SplitVectorWithRangeAdd(int growSize_) { ++ explicit SplitVectorWithRangeAdd(ptrdiff_t growSize_) { + SetGrowSize(growSize_); + ReAllocate(growSize_); + } +@@ -25,12 +25,12 @@ + void operator=(const SplitVectorWithRangeAdd &) = delete; + ~SplitVectorWithRangeAdd() { + } +- void RangeAddDelta(int start, int end, int delta) { ++ void RangeAddDelta(ptrdiff_t start, ptrdiff_t end, int delta) { + // end is 1 past end, so end-start is number of elements to change +- int i = 0; +- const int rangeLength = end - start; +- int range1Length = rangeLength; +- const int part1Left = part1Length - start; ++ ptrdiff_t i = 0; ++ const ptrdiff_t rangeLength = end - start; ++ ptrdiff_t range1Length = rangeLength; ++ const ptrdiff_t part1Left = part1Length - start; + if (range1Length > part1Left) + range1Length = part1Left; + while (i < range1Length) { +@@ -67,7 +67,7 @@ + } + stepPartition = partitionUpTo; + if (stepPartition >= body->Length()-1) { +- stepPartition = body->Length()-1; ++ stepPartition = Partitions(); + stepLength = 0; + } + } +@@ -80,7 +80,7 @@ + stepPartition = partitionDownTo; + } + +- void Allocate(int growSize) { ++ void Allocate(ptrdiff_t growSize) { + body = new SplitVectorWithRangeAdd(growSize); + stepPartition = 0; + stepLength = 0; +@@ -101,7 +101,7 @@ + } + + int Partitions() const { +- return body->Length()-1; ++ return static_cast(body->Length()-1); + } + + void InsertPartition(int partition, int pos) { +@@ -132,7 +132,7 @@ + BackStep(partitionInsert); + stepLength += delta; + } else { +- ApplyStep(body->Length()-1); ++ ApplyStep(Partitions()); + stepPartition = partitionInsert; + stepLength = delta; + } +@@ -168,10 +168,10 @@ + int PartitionFromPosition(int pos) const { + if (body->Length() <= 1) + return 0; +- if (pos >= (PositionFromPartition(body->Length()-1))) +- return body->Length() - 1 - 1; ++ if (pos >= (PositionFromPartition(Partitions()))) ++ return Partitions() - 1; + int lower = 0; +- int upper = body->Length()-1; ++ int upper = Partitions(); + do { + const int middle = (upper + lower + 1) / 2; // Round high + int posMiddle = body->ValueAt(middle); +diff -r 92c8f0f1b3e6 -r 3e3bfe29a819 src/PerLine.cxx +--- a/src/PerLine.cxx Fri Jan 26 11:12:10 2018 +1100 ++++ b/src/PerLine.cxx Fri Jan 26 18:04:38 2018 +1100 +@@ -135,7 +135,7 @@ + Sci::Line LineMarkers::MarkerNext(Sci::Line lineStart, int mask) const { + if (lineStart < 0) + lineStart = 0; +- const Sci::Line length = markers.Length(); ++ const Sci::Line length = static_cast(markers.Length()); + for (Sci::Line iLine = lineStart; iLine < length; iLine++) { + const MarkerHandleSet *onLine = markers[iLine].get(); + if (onLine && ((onLine->MarkValue() & mask) != 0)) +@@ -281,7 +281,7 @@ + } + + Sci::Line LineState::GetMaxLineState() const { +- return lineStates.Length(); ++ return static_cast(lineStates.Length()); + } + + static int NumberLines(const char *text) { +diff -r 92c8f0f1b3e6 -r 3e3bfe29a819 src/SplitVector.h +--- a/src/SplitVector.h Fri Jan 26 11:12:10 2018 +1100 ++++ b/src/SplitVector.h Fri Jan 26 18:04:38 2018 +1100 +@@ -16,15 +16,15 @@ + protected: + T *body; +- int size; +- int lengthBody; +- int part1Length; +- int gapLength; /// invariant: gapLength == size - lengthBody +- int growSize; ++ ptrdiff_t size; ++ ptrdiff_t lengthBody; ++ ptrdiff_t part1Length; ++ ptrdiff_t gapLength; /// invariant: gapLength == size - lengthBody ++ ptrdiff_t growSize; + + /// Move the gap to a particular position so that insertion and + /// deletion at that point will not require much copying and + /// hence be fast. +- void GapTo(int position) { ++ void GapTo(ptrdiff_t position) { + if (position != part1Length) { + if (position < part1Length) { + // Moving the gap towards start so moving elements towards end +@@ -45,11 +45,11 @@ + + /// Check that there is room in the buffer for an insertion, + /// reallocating if more space needed. +- void RoomFor(int insertionLength) { ++ void RoomFor(ptrdiff_t insertionLength) { + if (gapLength <= insertionLength) { + while (growSize < size / 6) + growSize *= 2; + ReAllocate(size + insertionLength + growSize); + } + } + +@@ -75,18 +75,18 @@ + ~SplitVector() { + } + +- int GetGrowSize() const { ++ ptrdiff_t GetGrowSize() const { + return growSize; + } +- +- void SetGrowSize(int growSize_) { ++ ++ void SetGrowSize(ptrdiff_t growSize_) { + growSize = growSize_; + } + + /// Reallocate the storage for the buffer to be newSize and + /// copy exisiting contents to the new buffer. + /// Must not be used to decrease the size of the buffer. +- void ReAllocate(int newSize) { ++ void ReAllocate(ptrdiff_t newSize) { + if (newSize < 0) + throw std::runtime_error("SplitVector::ReAllocate: negative size."); + +@@ -104,9 +104,9 @@ + + /// Retrieve the character at a particular position. + /// Retrieving positions outside the range of the buffer returns 0. + /// The assertions here are disabled since calling code can be + /// simpler if out of range access works and returns 0. +- T ValueAt(int position) const { ++ T ValueAt(ptrdiff_t position) const { + if (position < part1Length) { + //PLATFORM_ASSERT(position >= 0); + if (position < 0) { +@@ -124,7 +124,7 @@ + } + } + +- void SetValueAt(int position, T v) { ++ void SetValueAt(ptrdiff_t position, T v) { + if (position < part1Length) { + PLATFORM_ASSERT(position >= 0); + if (position < 0) { +@@ -144,7 +144,7 @@ + } + } + +- T &operator[](int position) const { ++ T &operator[](ptrdiff_t position) const { + PLATFORM_ASSERT(position >= 0 && position < lengthBody); + if (position < part1Length) { + return body[position]; +@@ -166,13 +166,13 @@ + } + + /// Retrieve the length of the buffer. +- int Length() const { ++ ptrdiff_t Length() const { + return lengthBody; + } + + /// Insert a single value into the buffer. + /// Inserting at positions outside the current range fails. +- void Insert(int position, T v) { ++ void Insert(ptrdiff_t position, T v) { + PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); + if ((position < 0) || (position > lengthBody)) { + return; +@@ -187,7 +187,7 @@ + + /// Insert a number of elements into the buffer setting their value. + /// Inserting at positions outside the current range fails. +- void InsertValue(int position, int insertLength, T v) { ++ void InsertValue(ptrdiff_t position, ptrdiff_t insertLength, T v) { + PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); + if (insertLength > 0) { + if ((position < 0) || (position > lengthBody)) { +@@ -225,14 +225,14 @@ + + /// Ensure at least length elements allocated, + /// appending zero valued elements if needed. +- void EnsureLength(int wantedLength) { ++ void EnsureLength(ptrdiff_t wantedLength) { + if (Length() < wantedLength) { + InsertValue(Length(), wantedLength - Length(), 0); + } + } + + /// Insert text into the buffer from an array. +- void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { ++ void InsertFromArray(ptrdiff_t positionToInsert, const T s[], ptrdiff_t positionFrom, ptrdiff_t insertLength) { + PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody)); + if (insertLength > 0) { + if ((positionToInsert < 0) || (positionToInsert > lengthBody)) { +@@ -248,7 +248,7 @@ + } + + /// Delete one element from the buffer. +- void Delete(int position) { ++ void Delete(ptrdiff_t position) { + PLATFORM_ASSERT((position >= 0) && (position < lengthBody)); + if ((position < 0) || (position >= lengthBody)) { + return; +@@ -258,7 +258,7 @@ + + /// Delete a range from the buffer. + /// Deleting positions outside the current range fails. +- void DeleteRange(int position, int deleteLength) { ++ void DeleteRange(ptrdiff_t position, ptrdiff_t deleteLength) { + PLATFORM_ASSERT((position >= 0) && (position + deleteLength <= lengthBody)); + if ((position < 0) || ((position + deleteLength) > lengthBody)) { + return; +@@ -277,17 +277,17 @@ + // Retrieve a range of elements into an array +- void GetRange(T *buffer, int position, int retrieveLength) const { ++ void GetRange(T *buffer, ptrdiff_t position, ptrdiff_t retrieveLength) const { + // Split into up to 2 ranges, before and after the split then use memcpy on each. +- int range1Length = 0; ++ ptrdiff_t range1Length = 0; + if (position < part1Length) { +- const int part1AfterPosition = part1Length - position; ++ const ptrdiff_t part1AfterPosition = part1Length - position; + range1Length = retrieveLength; + if (range1Length > part1AfterPosition) + range1Length = part1AfterPosition; + } + std::copy(body + position, body + position + range1Length, buffer); + buffer += range1Length; + position = position + range1Length + gapLength; +- int range2Length = retrieveLength - range1Length; ++ ptrdiff_t range2Length = retrieveLength - range1Length; + std::copy(body + position, body + position + range2Length, buffer); + } + +@@ -308,7 +308,7 @@ + return body; + } + +- T *RangePointer(int position, int rangeLength) { ++ T *RangePointer(ptrdiff_t position, ptrdiff_t rangeLength) { + if (position < part1Length) { + if ((position + rangeLength) > part1Length) { + // Range overlaps gap, so move gap to start of range. +@@ -323,7 +323,7 @@ + } + } + +- int GapPosition() const { ++ ptrdiff_t GapPosition() const { + return part1Length; + } + }; diff --git a/src/scintilla_backports/6444_1bd57324aa36.patch b/src/scintilla_backports/6444_1bd57324aa36.patch new file mode 100644 index 00000000..93552ba4 --- /dev/null +++ b/src/scintilla_backports/6444_1bd57324aa36.patch @@ -0,0 +1,279 @@ +# HG changeset patch +# User Neil +# Date 1517436441 -39600 +# Node ID 1bd57324aa36e3fce1ed8a2371001b062322884b +# Parent ab4efcbfdae68d1ec053db212edb1440326a7f1c +Templatize Partitioning so it can hold different types. + +diff -r ab4efcbfdae6 -r 1bd57324aa36 src/CellBuffer.h +--- a/src/CellBuffer.h Wed Jan 31 17:08:48 2018 +1100 ++++ b/src/CellBuffer.h Thu Feb 01 09:07:21 2018 +1100 +@@ -24,7 +24,7 @@ + */ + class LineVector { + +- Partitioning starts; ++ Partitioning starts; + PerLine *perLine; + + public: +diff -r ab4efcbfdae6 -r 1bd57324aa36 src/ContractionState.cxx +--- a/src/ContractionState.cxx Wed Jan 31 17:08:48 2018 +1100 ++++ b/src/ContractionState.cxx Thu Feb 01 09:07:21 2018 +1100 +@@ -39,7 +39,7 @@ + expanded = new RunStyles(); + heights = new RunStyles(); + foldDisplayTexts = new SparseVector(); +- displayLines = new Partitioning(4); ++ displayLines = new Partitioning(4); + InsertLines(0, linesInDocument); + } + } +diff -r ab4efcbfdae6 -r 1bd57324aa36 src/ContractionState.h +--- a/src/ContractionState.h Wed Jan 31 17:08:48 2018 +1100 ++++ b/src/ContractionState.h Thu Feb 01 09:07:21 2018 +1100 +@@ -21,7 +21,7 @@ + RunStyles *expanded; + RunStyles *heights; + SparseVector *foldDisplayTexts; +- Partitioning *displayLines; ++ Partitioning *displayLines; + Sci::Line linesInDocument; + + void EnsureData(); +diff -r ab4efcbfdae6 -r 1bd57324aa36 src/Partitioning.h +--- a/src/Partitioning.h Wed Jan 31 17:08:48 2018 +1100 ++++ b/src/Partitioning.h Thu Feb 01 09:07:21 2018 +1100 +@@ -14,29 +14,30 @@ + /// in a range. + /// Used by the Partitioning class. + +-class SplitVectorWithRangeAdd : public SplitVector { ++template ++class SplitVectorWithRangeAdd : public SplitVector { + public: + explicit SplitVectorWithRangeAdd(ptrdiff_t growSize_) { +- SetGrowSize(growSize_); +- ReAllocate(growSize_); ++ this->SetGrowSize(growSize_); ++ this->ReAllocate(growSize_); + } + ~SplitVectorWithRangeAdd() { + } +- void RangeAddDelta(ptrdiff_t start, ptrdiff_t end, int delta) { ++ void RangeAddDelta(ptrdiff_t start, ptrdiff_t end, T delta) { + // end is 1 past end, so end-start is number of elements to change + ptrdiff_t i = 0; + const ptrdiff_t rangeLength = end - start; + ptrdiff_t range1Length = rangeLength; +- const ptrdiff_t part1Left = part1Length - start; ++ const ptrdiff_t part1Left = this->part1Length - start; + if (range1Length > part1Left) + range1Length = part1Left; + while (i < range1Length) { +- body[start++] += delta; ++ this->body[start++] += delta; + i++; + } +- start += gapLength; ++ start += this->gapLength; + while (i < rangeLength) { +- body[start++] += delta; ++ this->body[start++] += delta; + i++; + } + } +@@ -52,16 +53,17 @@ + /// When needed, positions after the interval are considered part of the last partition + /// but the end of the last partition can be found with PositionFromPartition(last+1). + ++template + class Partitioning { + private: + // To avoid calculating all the partition positions whenever any text is inserted + // there may be a step somewhere in the list. +- int stepPartition; +- int stepLength; +- SplitVectorWithRangeAdd *body; ++ T stepPartition; ++ T stepLength; ++ SplitVectorWithRangeAdd *body; + + // Move step forward +- void ApplyStep(int partitionUpTo) { ++ void ApplyStep(T partitionUpTo) { + if (stepLength != 0) { + body->RangeAddDelta(stepPartition+1, partitionUpTo + 1, stepLength); + } +@@ -73,7 +75,7 @@ + } + + // Move step backward +- void BackStep(int partitionDownTo) { ++ void BackStep(T partitionDownTo) { + if (stepLength != 0) { + body->RangeAddDelta(partitionDownTo+1, stepPartition+1, -stepLength); + } +@@ -81,7 +83,7 @@ + } + + void Allocate(ptrdiff_t growSize) { +- body = new SplitVectorWithRangeAdd(growSize); ++ body = new SplitVectorWithRangeAdd(growSize); + stepPartition = 0; + stepLength = 0; + body->Insert(0, 0); // This value stays 0 for ever +@@ -100,11 +102,11 @@ + ~Partitioning() { + } + +- int Partitions() const { +- return static_cast(body->Length()-1); ++ T Partitions() const { ++ return static_cast(body->Length())-1; + } + +- void InsertPartition(int partition, int pos) { ++ void InsertPartition(T partition, T pos) { + if (stepPartition < partition) { + ApplyStep(partition); + } +@@ -112,7 +114,7 @@ + stepPartition++; + } + +- void SetPartitionStartPosition(int partition, int pos) { ++ void SetPartitionStartPosition(T partition, T pos) { + ApplyStep(partition+1); + if ((partition < 0) || (partition > body->Length())) { + return; +@@ -120,7 +122,7 @@ + body->SetValueAt(partition, pos); + } + +- void InsertText(int partitionInsert, int delta) { ++ void InsertText(T partitionInsert, T delta) { + // Point all the partitions after the insertion point further along in the buffer + if (stepLength != 0) { + if (partitionInsert >= stepPartition) { +@@ -142,7 +144,7 @@ + } + } + +- void RemovePartition(int partition) { ++ void RemovePartition(T partition) { + if (partition > stepPartition) { + ApplyStep(partition); + stepPartition--; +@@ -152,29 +154,29 @@ + body->Delete(partition); + } + +- int PositionFromPartition(int partition) const { ++ T PositionFromPartition(T partition) const { + PLATFORM_ASSERT(partition >= 0); + PLATFORM_ASSERT(partition < body->Length()); + if ((partition < 0) || (partition >= body->Length())) { + return 0; + } +- int pos = body->ValueAt(partition); ++ T pos = body->ValueAt(partition); + if (partition > stepPartition) + pos += stepLength; + return pos; + } + + /// Return value in range [0 .. Partitions() - 1] even for arguments outside interval +- int PartitionFromPosition(int pos) const { ++ T PartitionFromPosition(T pos) const { + if (body->Length() <= 1) + return 0; + if (pos >= (PositionFromPartition(Partitions()))) + return Partitions() - 1; +- int lower = 0; +- int upper = Partitions(); ++ T lower = 0; ++ T upper = Partitions(); + do { +- const int middle = (upper + lower + 1) / 2; // Round high +- int posMiddle = body->ValueAt(middle); ++ const T middle = (upper + lower + 1) / 2; // Round high ++ T posMiddle = body->ValueAt(middle); + if (middle > stepPartition) + posMiddle += stepLength; + if (pos < posMiddle) { +diff -r ab4efcbfdae6 -r 1bd57324aa36 src/RunStyles.cxx +--- a/src/RunStyles.cxx Wed Jan 31 17:08:48 2018 +1100 ++++ b/src/RunStyles.cxx Thu Feb 01 09:07:21 2018 +1100 +@@ -70,7 +70,7 @@ + } + + RunStyles::RunStyles() { +- starts = new Partitioning(8); ++ starts = new Partitioning(8); + styles = new SplitVector(); + styles->InsertValue(0, 2, 0); + } +@@ -204,7 +204,7 @@ + starts = NULL; + delete styles; + styles = NULL; +- starts = new Partitioning(8); ++ starts = new Partitioning(8); + styles = new SplitVector(); + styles->InsertValue(0, 2, 0); + } +diff -r ab4efcbfdae6 -r 1bd57324aa36 src/RunStyles.h +--- a/src/RunStyles.h Wed Jan 31 17:08:48 2018 +1100 ++++ b/src/RunStyles.h Thu Feb 01 09:07:21 2018 +1100 +@@ -14,7 +14,7 @@ + + class RunStyles { + private: +- Partitioning *starts; ++ Partitioning *starts; + SplitVector *styles; + int RunFromPosition(int position) const; + int SplitRun(int position); +diff -r ab4efcbfdae6 -r 1bd57324aa36 src/SparseVector.h +--- a/src/SparseVector.h Wed Jan 31 17:08:48 2018 +1100 ++++ b/src/SparseVector.h Thu Feb 01 09:07:21 2018 +1100 +@@ -15,7 +15,7 @@ + template + class SparseVector { + private: +- Partitioning *starts; ++ Partitioning *starts; + SplitVector *values; + // Private so SparseVector objects can not be copied + SparseVector(const SparseVector &); +@@ -26,7 +26,7 @@ + } + public: + SparseVector() { +- starts = new Partitioning(8); ++ starts = new Partitioning(8); + values = new SplitVector(); + values->InsertValue(0, 2, T()); + } +diff -r ab4efcbfdae6 -r 1bd57324aa36 test/unit/testPartitioning.cxx +--- a/test/unit/testPartitioning.cxx Wed Jan 31 17:08:48 2018 +1100 ++++ b/test/unit/testPartitioning.cxx Thu Feb 01 09:07:21 2018 +1100 +@@ -26,7 +26,7 @@ + + TEST_CASE("SplitVectorWithRangeAdd") { + +- SplitVectorWithRangeAdd svwra(growSize); ++ SplitVectorWithRangeAdd svwra(growSize); + + SECTION("IsEmptyInitially") { + REQUIRE(0 == svwra.Length()); +@@ -49,7 +49,7 @@ + + TEST_CASE("Partitioning") { + +- Partitioning part(growSize); ++ Partitioning part(growSize); + + SECTION("IsEmptyInitially") { + REQUIRE(1 == part.Partitions()); diff --git a/src/scintilla_backports/6445_89d992f380a1.patch b/src/scintilla_backports/6445_89d992f380a1.patch new file mode 100644 index 00000000..b0b9acae --- /dev/null +++ b/src/scintilla_backports/6445_89d992f380a1.patch @@ -0,0 +1,418 @@ +# HG changeset patch +# User Neil +# Date 1517437334 -39600 +# Node ID 89d992f380a1ce28a3ba6934230388ffaf1ea611 +# Parent 1bd57324aa36e3fce1ed8a2371001b062322884b +Templatize RunStyles so it can be over ranges of different types and contain +different style types. +Currently only instantiated over . + +diff -r 1bd57324aa36 -r 89d992f380a1 src/ContractionState.cxx +--- a/src/ContractionState.cxx Thu Feb 01 09:07:21 2018 +1100 ++++ b/src/ContractionState.cxx Thu Feb 01 09:22:14 2018 +1100 +@@ -35,9 +35,9 @@ + + void ContractionState::EnsureData() { + if (OneToOne()) { +- visible = new RunStyles(); +- expanded = new RunStyles(); +- heights = new RunStyles(); ++ visible = new RunStyles(); ++ expanded = new RunStyles(); ++ heights = new RunStyles(); + foldDisplayTexts = new SparseVector(); + displayLines = new Partitioning(4); + InsertLines(0, linesInDocument); +diff -r 1bd57324aa36 -r 89d992f380a1 src/ContractionState.h +--- a/src/ContractionState.h Thu Feb 01 09:07:21 2018 +1100 ++++ b/src/ContractionState.h Thu Feb 01 09:22:14 2018 +1100 +@@ -17,9 +17,9 @@ + */ + class ContractionState { + // These contain 1 element for every document line. +- RunStyles *visible; +- RunStyles *expanded; +- RunStyles *heights; ++ RunStyles *visible; ++ RunStyles *expanded; ++ RunStyles *heights; + SparseVector *foldDisplayTexts; + Partitioning *displayLines; + Sci::Line linesInDocument; +diff -r 1bd57324aa36 -r 89d992f380a1 src/Decoration.h +--- a/src/Decoration.h Thu Feb 01 09:07:21 2018 +1100 ++++ b/src/Decoration.h Thu Feb 01 09:22:14 2018 +1100 +@@ -12,7 +12,7 @@ + class Decoration { + int indicator; + public: + Decoration *next; +- RunStyles rs; ++ RunStyles rs; + + explicit Decoration(int indicator_); +diff -r 1bd57324aa36 -r 89d992f380a1 src/RunStyles.cxx +--- a/src/RunStyles.cxx Thu Feb 01 09:07:21 2018 +1100 ++++ b/src/RunStyles.cxx Thu Feb 01 09:22:14 2018 +1100 +@@ -26,8 +26,9 @@ + using namespace Scintilla; + + // Find the first run at a position +-int RunStyles::RunFromPosition(int position) const { +- int run = starts->PartitionFromPosition(position); ++template ++DISTANCE RunStyles::RunFromPosition(DISTANCE position) const { ++ DISTANCE run = starts->PartitionFromPosition(position); + // Go to first element with this position + while ((run > 0) && (position == starts->PositionFromPartition(run-1))) { + run--; +@@ -36,11 +37,12 @@ + } + + // If there is no run boundary at position, insert one continuing style. +-int RunStyles::SplitRun(int position) { +- int run = RunFromPosition(position); +- const int posRun = starts->PositionFromPartition(run); ++template ++DISTANCE RunStyles::SplitRun(DISTANCE position) { ++ DISTANCE run = RunFromPosition(position); ++ const DISTANCE posRun = starts->PositionFromPartition(run); + if (posRun < position) { +- int runStyle = ValueAt(position); ++ STYLE runStyle = ValueAt(position); + run++; + starts->InsertPartition(run, position); + styles->InsertValue(run, 1, runStyle); +@@ -48,12 +50,14 @@ + return run; + } + +-void RunStyles::RemoveRun(int run) { ++template ++void RunStyles::RemoveRun(DISTANCE run) { + starts->RemovePartition(run); + styles->DeleteRange(run, 1); + } + +-void RunStyles::RemoveRunIfEmpty(int run) { ++template ++void RunStyles::RemoveRunIfEmpty(DISTANCE run) { + if ((run < starts->Partitions()) && (starts->Partitions() > 1)) { + if (starts->PositionFromPartition(run) == starts->PositionFromPartition(run+1)) { + RemoveRun(run); +@@ -61,7 +65,8 @@ + } + } + +-void RunStyles::RemoveRunIfSameAsPrevious(int run) { ++template ++void RunStyles::RemoveRunIfSameAsPrevious(DISTANCE run) { + if ((run > 0) && (run < starts->Partitions())) { + if (styles->ValueAt(run-1) == styles->ValueAt(run)) { + RemoveRun(run); +@@ -69,34 +74,39 @@ + } + } + +-RunStyles::RunStyles() { +- starts = new Partitioning(8); +- styles = new SplitVector(); ++template ++RunStyles::RunStyles() { ++ starts = new Partitioning(8); ++ styles = new SplitVector