diff options
Diffstat (limited to 'src')
23 files changed, 1244 insertions, 53 deletions
diff --git a/src/Makefile b/src/Makefile index fa5f3e16..f0c7fc36 100644 --- a/src/Makefile +++ b/src/Makefile @@ -425,10 +425,15 @@ bombay_zip = bombay.zip cloc = cloc-1.60.pl $(scintilla_tgz): ; wget http://prdownloads.sourceforge.net/scintilla/$@ -O $@ -scintilla: scintilla.patch | $(scintilla_tgz) - if [ -d $@ ]; then rm -r $@; fi - mkdir $@ && tar xzf $| -C $@ && mv $@/*/* $@ - patch -d $@ -N -p1 < $< +scintilla: $(wildcard scintilla_backports/*.patch) scintilla.patch | \ + $(scintilla_tgz) + if [ -d $@/.hg ]; then \ + hg --cwd $@ update -C -r rel-3-7-3; \ + else \ + if [ -d $@ ]; then rm -r $@; fi; \ + mkdir $@ && tar xzf $| -C $@ && mv $@/*/* $@; \ + fi + for patch in $^; do echo Applying $$patch; patch -d $@ -N -p1 < $$patch; done $(tre_zip): ; wget https://github.com/laurikari/tre/archive/$@ -O $@ tre: tre.patch | $(tre_zip) if [ -d $@ ]; then rm -r $@; fi diff --git a/src/scintilla.patch b/src/scintilla.patch index 1f75f400..ac950c56 100644 --- a/src/scintilla.patch +++ b/src/scintilla.patch @@ -191,52 +191,3 @@ diff -r bfdfb44eb777 src/Document.cxx +} + +#endif -diff -r e99b1a2bfbf8 src/Editor.cxx ---- a/src/Editor.cxx Thu Feb 16 08:37:09 2017 +1100 -+++ b/src/Editor.cxx Wed Feb 22 11:37:10 2017 -0500 -@@ -3111,6 +3111,9 @@ - } - - void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { -+ if ((selt == Selection::noSel) && sel.MoveExtends()) { -+ selt = Selection::selStream; -+ } - SelectionPosition caretToUse = sel.Range(sel.Main()).caret; - if (sel.IsRectangular()) { - if (selt == Selection::noSel) { -diff -r 8cb0c9214098 -r e2523f83af01 gtk/PlatGTK.cxx ---- a/gtk/PlatGTK.cxx Wed Jan 04 09:30:05 2017 +1100 -+++ b/gtk/PlatGTK.cxx Mon Jan 02 11:43:36 2017 +1100 -@@ -1401,7 +1401,7 @@ - #endif - } - --void ListBoxX::Create(Window &parent, int, Point, int, bool, int) { -+void ListBoxX::Create(Window &, int, Point, int, bool, int) { - if (widCached != 0) { - wid = widCached; - return; -@@ -1475,10 +1475,6 @@ - gtk_widget_show(widget); - g_signal_connect(G_OBJECT(widget), "button_press_event", - G_CALLBACK(ButtonPress), this); -- -- GtkWidget *top = gtk_widget_get_toplevel(static_cast<GtkWidget *>(parent.GetID())); -- gtk_window_set_transient_for(GTK_WINDOW(static_cast<GtkWidget *>(wid)), -- GTK_WINDOW(top)); - } - - void ListBoxX::SetFont(Font &scint_font) { -diff -r 8cb0c9214098 -r e2523f83af01 gtk/ScintillaGTK.cxx ---- a/gtk/ScintillaGTK.cxx Wed Jan 04 09:30:05 2017 +1100 -+++ b/gtk/ScintillaGTK.cxx Mon Jan 02 11:43:36 2017 +1100 -@@ -1301,9 +1301,6 @@ - G_CALLBACK(ScintillaGTK::PressCT), static_cast<void *>(this)); - gtk_widget_set_events(widcdrw, - GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK); -- GtkWidget *top = gtk_widget_get_toplevel(static_cast<GtkWidget *>(wMain.GetID())); -- gtk_window_set_transient_for(GTK_WINDOW(static_cast<GtkWidget *>(PWidget(ct.wCallTip))), -- GTK_WINDOW(top)); - } - gtk_widget_set_size_request(PWidget(ct.wDraw), rc.Width(), rc.Height()); - ct.wDraw.Show(); diff --git a/src/scintilla_backports/6095_ae52e0c68190.patch b/src/scintilla_backports/6095_ae52e0c68190.patch new file mode 100644 index 00000000..f30f40dc --- /dev/null +++ b/src/scintilla_backports/6095_ae52e0c68190.patch @@ -0,0 +1,43 @@ +# HG changeset patch +# User Colomban Wendling <ban@herbesfolles.org> +# Date 1487714930 -3600 +# Node ID ae52e0c68190d423505624ae1d26e442e015d48f +# Parent 966f25e2241058f45500025b0a8e8ed4cae10ee7 +Bug [#1901]. GTK: Fix double scrolling under X11 + +Really restrict smooth scrolling handling to Wayland. + +diff -r 966f25e22410 -r ae52e0c68190 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Sun Feb 19 14:13:46 2017 +1100 ++++ b/doc/ScintillaHistory.html Tue Feb 21 23:08:50 2017 +0100 +@@ -520,6 +520,18 @@ + </li> + </ul> + <h3> ++ <a href="http://www.scintilla.org/scite374.zip">Release 3.7.4</a> ++ </h3> ++ <ul> ++ <li> ++ Released 19 February 2017. ++ </li> ++ <li> ++ Fix to prevent double scrolling on GTK+ with X11. ++ <a href="http://sourceforge.net/p/scintilla/bugs/1901/">Bug #1901</a>. ++ </li> ++ </ul> ++ <h3> + <a href="http://www.scintilla.org/scite373.zip">Release 3.7.3</a> + </h3> + <ul> +diff -r 966f25e22410 -r ae52e0c68190 gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Sun Feb 19 14:13:46 2017 +1100 ++++ b/gtk/ScintillaGTK.cxx Tue Feb 21 23:08:50 2017 +0100 +@@ -1801,7 +1801,7 @@ + return FALSE; + + #if defined(GDK_WINDOWING_WAYLAND) +- if (event->direction == GDK_SCROLL_SMOOTH) { ++ if (event->direction == GDK_SCROLL_SMOOTH && GDK_IS_WAYLAND_WINDOW(event->window)) { + const int smoothScrollFactor = 4; + sciThis->smoothScrollY += event->delta_y * smoothScrollFactor; + sciThis->smoothScrollX += event->delta_x * smoothScrollFactor;; diff --git a/src/scintilla_backports/6097_7f22895eaddb.patch b/src/scintilla_backports/6097_7f22895eaddb.patch new file mode 100644 index 00000000..2ffe1923 --- /dev/null +++ b/src/scintilla_backports/6097_7f22895eaddb.patch @@ -0,0 +1,34 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1487827984 -39600 +# Node ID 7f22895eaddb6584d488ed2e606d5d0e930db22c +# Parent cc79ed8e4f8274ba1242150f36e2ab0b40ed68f4 +Bug [#1905]. Fix stream selection mode when moving caret up or down. + +diff -r cc79ed8e4f82 -r 7f22895eaddb doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Wed Feb 22 16:35:01 2017 +1100 ++++ b/doc/ScintillaHistory.html Thu Feb 23 16:33:04 2017 +1100 +@@ -527,6 +527,10 @@ + Released 19 February 2017. + </li> + <li> ++ Fix to stream selection mode when moving caret up or down. ++ <a href="http://sourceforge.net/p/scintilla/bugs/1905/">Bug #1905</a>. ++ </li> ++ <li> + Fix to prevent double scrolling on GTK+ with X11. + <a href="http://sourceforge.net/p/scintilla/bugs/1901/">Bug #1901</a>. + </li> +diff -r cc79ed8e4f82 -r 7f22895eaddb src/Editor.cxx +--- a/src/Editor.cxx Wed Feb 22 16:35:01 2017 +1100 ++++ b/src/Editor.cxx Thu Feb 23 16:33:04 2017 +1100 +@@ -3111,6 +3111,9 @@ + } + + void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { ++ if ((selt == Selection::noSel) && sel.MoveExtends()) { ++ selt = Selection::selStream; ++ } + SelectionPosition caretToUse = sel.Range(sel.Main()).caret; + if (sel.IsRectangular()) { + if (selt == Selection::noSel) { diff --git a/src/scintilla_backports/6099_809112c81196.patch b/src/scintilla_backports/6099_809112c81196.patch new file mode 100644 index 00000000..2a10245d --- /dev/null +++ b/src/scintilla_backports/6099_809112c81196.patch @@ -0,0 +1,45 @@ +# HG changeset patch +# User Colomban Wendling <ban@herbesfolles.org> +# Date 1488136706 -3600 +# Node ID 809112c8119696afcefdcb145e04ade832fcbe0b +# Parent 4d2ba76f394abe85ce97ae7037db34bdae452dd1 +Bug [#1907]. GTK: Fix crash after destroying the widget on GTK < 3.3.6 + +On GTK2 and GTK3 < 3.3.6 there is no GtkAccessibleClass::widget_unset() +method, so we can't destroy our accessible object right away. So, to +avoid accessing a destroyed widget, we need to check whether the widget +still exists in the the ScintillaGTKAccessible destructor. + +In other methods it's not necessary because the wrapping GObject class +makes sure not to forward other when the widget has been destroyed, but +we still have to destroy the C++ instance no matter what, so the check +has to be on this side. + +diff -r 4d2ba76f394a -r 809112c81196 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Sat Feb 25 09:13:40 2017 +1100 ++++ b/doc/ScintillaHistory.html Sun Feb 26 20:18:26 2017 +0100 +@@ -535,6 +535,10 @@ + <a href="http://sourceforge.net/p/scintilla/bugs/1915/">Bug #1915</a>. + </li> + <li> ++ Fix crash in accessibility code on GTK+ < 3.3.6 caused by previous bug fix. ++ <a href="http://sourceforge.net/p/scintilla/bugs/1907/">Bug #1907</a>. ++ </li> ++ <li> + Fix to prevent double scrolling on GTK+ with X11. + <a href="http://sourceforge.net/p/scintilla/bugs/1901/">Bug #1901</a>. + </li> +diff -r 4d2ba76f394a -r 809112c81196 gtk/ScintillaGTKAccessible.cxx +--- a/gtk/ScintillaGTKAccessible.cxx Sat Feb 25 09:13:40 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.cxx Sun Feb 26 20:18:26 2017 +0100 +@@ -162,7 +162,9 @@ + } + + ScintillaGTKAccessible::~ScintillaGTKAccessible() { +- g_signal_handlers_disconnect_matched(sci->sci, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this); ++ if (gtk_accessible_get_widget(accessible)) { ++ g_signal_handlers_disconnect_matched(sci->sci, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this); ++ } + } + + gchar *ScintillaGTKAccessible::GetTextRangeUTF8(Position startByte, Position endByte) { diff --git a/src/scintilla_backports/6101_b82fe8d33961.patch b/src/scintilla_backports/6101_b82fe8d33961.patch new file mode 100644 index 00000000..e60f610f --- /dev/null +++ b/src/scintilla_backports/6101_b82fe8d33961.patch @@ -0,0 +1,94 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1488408061 -39600 +# Node ID b82fe8d33961050a7905d6588eef858b85ca804c +# Parent 29534cb8eafb48f9eacc574b8063e9d66520ae8a +Fix potential problems with IME on Cocoa when document contains invalid UTF-8. + +diff -r 29534cb8eafb -r b82fe8d33961 cocoa/ScintillaCocoa.h +--- a/cocoa/ScintillaCocoa.h Thu Mar 02 09:08:04 2017 +1100 ++++ b/cocoa/ScintillaCocoa.h Thu Mar 02 09:41:01 2017 +1100 +@@ -48,6 +48,7 @@ + #include "CaseFolder.h" + #include "Document.h" + #include "CaseConvert.h" ++#include "UniConversion.h" + #include "Selection.h" + #include "PositionCache.h" + #include "EditModel.h" +diff -r 29534cb8eafb -r b82fe8d33961 cocoa/ScintillaView.mm +--- a/cocoa/ScintillaView.mm Thu Mar 02 09:08:04 2017 +1100 ++++ b/cocoa/ScintillaView.mm Thu Mar 02 09:41:01 2017 +1100 +@@ -437,6 +437,7 @@ + [mOwner message: SCI_SETTARGETRANGE wParam: posRange.location lParam: NSMaxRange(posRange)]; + std::string text([mOwner message: SCI_TARGETASUTF8] + 1, 0); + [mOwner message: SCI_TARGETASUTF8 wParam: 0 lParam: reinterpret_cast<sptr_t>(&text[0])]; ++ text = FixInvalidUTF8(text); + NSString *result = [NSString stringWithUTF8String: text.c_str()]; + NSMutableAttributedString *asResult = [[[NSMutableAttributedString alloc] initWithString:result] autorelease]; + +diff -r 29534cb8eafb -r b82fe8d33961 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Thu Mar 02 09:08:04 2017 +1100 ++++ b/doc/ScintillaHistory.html Thu Mar 02 09:41:01 2017 +1100 +@@ -537,6 +537,10 @@ + <a href="http://sourceforge.net/p/scintilla/bugs/1881/">Bug #1881</a>. + </li> + <li> ++ Fix potential problems with IME on Cocoa when document contains invalid ++ UTF-8. ++ </li> ++ <li> + Fix crash on Cocoa with OS X 10.9 due to accessibility API not available. + <a href="http://sourceforge.net/p/scintilla/bugs/1915/">Bug #1915</a>. + </li> +diff -r 29534cb8eafb -r b82fe8d33961 src/UniConversion.cxx +--- a/src/UniConversion.cxx Thu Mar 02 09:08:04 2017 +1100 ++++ b/src/UniConversion.cxx Thu Mar 02 09:41:01 2017 +1100 +@@ -8,6 +8,7 @@ + #include <stdlib.h> + + #include <stdexcept> ++#include <string> + + #include "UniConversion.h" + +@@ -304,6 +305,28 @@ + return (utf8StatusNext & UTF8MaskInvalid) ? 1 : (utf8StatusNext & UTF8MaskWidth); + } + ++// Replace invalid bytes in UTF-8 with the replacement character ++std::string FixInvalidUTF8(const std::string &text) { ++ std::string result; ++ const unsigned char *us = reinterpret_cast<const unsigned char *>(text.c_str()); ++ size_t remaining = text.size(); ++ while (remaining > 0) { ++ const int utf8Status = UTF8Classify(us, static_cast<int>(remaining)); ++ if (utf8Status & UTF8MaskInvalid) { ++ // Replacement character 0xFFFD = UTF8:"efbfbd". ++ result.append("\xef\xbf\xbd"); ++ us++; ++ remaining--; ++ } else { ++ const int len = utf8Status&UTF8MaskWidth; ++ result.append(reinterpret_cast<const char *>(us), len); ++ us += len; ++ remaining -= len; ++ } ++ } ++ return result; ++} ++ + #ifdef SCI_NAMESPACE + } + #endif +diff -r 29534cb8eafb -r b82fe8d33961 src/UniConversion.h +--- a/src/UniConversion.h Thu Mar 02 09:08:04 2017 +1100 ++++ b/src/UniConversion.h Thu Mar 02 09:41:01 2017 +1100 +@@ -23,6 +23,7 @@ + size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen); + unsigned int UTF32FromUTF8(const char *s, unsigned int len, unsigned int *tbuf, unsigned int tlen); + unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf); ++std::string FixInvalidUTF8(const std::string &text); + + extern int UTF8BytesOfLead[256]; + void UTF8BytesOfLeadInitialise(); diff --git a/src/scintilla_backports/6102_e12538e52567.patch b/src/scintilla_backports/6102_e12538e52567.patch new file mode 100644 index 00000000..4078bf5f --- /dev/null +++ b/src/scintilla_backports/6102_e12538e52567.patch @@ -0,0 +1,61 @@ +# HG changeset patch +# User Colomban Wendling <ban@herbesfolles.org> +# Date 1487712605 -3600 +# Node ID e12538e52567bc5fc011448f42689ac52434f1fd +# Parent b82fe8d33961050a7905d6588eef858b85ca804c +Bug [#1910]. GTK a11y: Speed up converting byte offsets to character offsets + +Use a per-line cache to avoid re-computing the offset from the start of +the buffer each time. This dramatically speeds up multiple replacements +on large files. + +diff -r b82fe8d33961 -r e12538e52567 gtk/ScintillaGTKAccessible.cxx +--- a/gtk/ScintillaGTKAccessible.cxx Thu Mar 02 09:41:01 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.cxx Tue Feb 21 22:30:05 2017 +0100 +@@ -856,6 +856,13 @@ + void ScintillaGTKAccessible::Notify(GtkWidget *, gint, SCNotification *nt) { + switch (nt->nmhdr.code) { + case SCN_MODIFIED: { ++ if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { ++ // invalidate character offset cache if applicable ++ const Position line = sci->pdoc->LineFromPosition(nt->position); ++ if (character_offsets.size() > static_cast<size_t>(line + 1)) { ++ character_offsets.resize(line + 1); ++ } ++ } + if (nt->modificationType & SC_MOD_INSERTTEXT) { + int startChar = CharacterOffsetFromByteOffset(nt->position); + int lengthChar = sci->pdoc->CountCharacters(nt->position, nt->position + nt->length); +diff -r b82fe8d33961 -r e12538e52567 gtk/ScintillaGTKAccessible.h +--- a/gtk/ScintillaGTKAccessible.h Thu Mar 02 09:41:01 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.h Tue Feb 21 22:30:05 2017 +0100 +@@ -20,6 +20,9 @@ + GtkAccessible *accessible; + ScintillaGTK *sci; + ++ // cache holding character offset for each line start, see CharacterOffsetFromByteOffset() ++ std::vector<Position> character_offsets; ++ + // cached length of the deletion, in characters (see Notify()) + int deletionLengthChar; + // local state for comparing +@@ -52,7 +55,18 @@ + } + + int CharacterOffsetFromByteOffset(Position byteOffset) { +- return sci->pdoc->CountCharacters(0, byteOffset); ++ const Position line = sci->pdoc->LineFromPosition(byteOffset); ++ if (character_offsets.size() <= static_cast<size_t>(line)) { ++ if (character_offsets.empty()) ++ character_offsets.push_back(0); ++ for (Position i = character_offsets.size(); i <= line; i++) { ++ const Position start = sci->pdoc->LineStart(i - 1); ++ const Position end = sci->pdoc->LineStart(i); ++ character_offsets.push_back(character_offsets[i - 1] + sci->pdoc->CountCharacters(start, end)); ++ } ++ } ++ const Position lineStart = sci->pdoc->LineStart(line); ++ return character_offsets[line] + sci->pdoc->CountCharacters(lineStart, byteOffset); + } + + void CharacterRangeFromByteRange(Position startByte, Position endByte, int *startChar, int *endChar) { diff --git a/src/scintilla_backports/6108_b833c0659497.patch b/src/scintilla_backports/6108_b833c0659497.patch new file mode 100644 index 00000000..b38d426a --- /dev/null +++ b/src/scintilla_backports/6108_b833c0659497.patch @@ -0,0 +1,74 @@ +# HG changeset patch +# User Neil Hodgson <nyamatongwe@gmail.com> +# Date 1488583798 -39600 +# Node ID b833c0659497438d3638a1a30ef4c604123f9e3e +# Parent d4f7d1439daa636ffe50cec516667627e04174a7 +Fix minor issues in interface definitions. + +diff -r d4f7d1439daa -r b833c0659497 include/Scintilla.iface +--- a/include/Scintilla.iface Sat Mar 04 10:28:39 2017 +1100 ++++ b/include/Scintilla.iface Sat Mar 04 10:29:58 2017 +1100 +@@ -415,8 +415,7 @@ + # How many margins are there?. + get int GetMargins=2253(,) + +-# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. +-# Style 39 is for future use. ++# Styles in range 32..39 are predefined for parts of the UI and are not used as normal styles. + enu StylesCommon=STYLE_ + val STYLE_DEFAULT=32 + val STYLE_LINENUMBER=33 +@@ -1215,7 +1214,7 @@ + # Switch a header line between expanded and contracted and show some text after the line. + fun void ToggleFoldShowText=2700(int line, string text) + +-enu foldDisplayTextStyle=SC_FOLDDISPLAYTEXTSTYLE_ ++enu FoldDisplayTextStyle=SC_FOLDDISPLAYTEXT_ + val SC_FOLDDISPLAYTEXT_HIDDEN=0 + val SC_FOLDDISPLAYTEXT_STANDARD=1 + val SC_FOLDDISPLAYTEXT_BOXED=2 +@@ -1832,6 +1831,7 @@ + fun void WordPartRightExtend=2393(,) + + # Constants for use with SetVisiblePolicy, similar to SetCaretPolicy. ++enu VisiblePolicy=VISIBLE_ + val VISIBLE_SLOP=0x01 + val VISIBLE_STRICT=0x04 + # Set the way the display area is determined when a particular line +@@ -1844,8 +1844,10 @@ + # Delete forwards from the current position to the end of the line. + fun void DelLineRight=2396(,) + +-# Get and Set the xOffset (ie, horizontal scroll position). ++# Set the xOffset (ie, horizontal scroll position). + set void SetXOffset=2397(int xOffset,) ++ ++# Get the xOffset (ie, horizontal scroll position). + get int GetXOffset=2398(,) + + # Set the last x chosen value to be the caret x position. +@@ -2117,6 +2119,7 @@ + # Duplicate the selection. If selection empty duplicate the line containing the caret. + fun void SelectionDuplicate=2469(,) + ++enu Alpha=SC_ALPHA_ + val SC_ALPHA_TRANSPARENT=0 + val SC_ALPHA_OPAQUE=255 + val SC_ALPHA_NOALPHA=256 +@@ -2515,6 +2518,7 @@ + # Scroll to end of document. + fun void ScrollToEnd=2629(,) + ++enu Technology=SC_TECHNOLOGY_ + val SC_TECHNOLOGY_DEFAULT=0 + val SC_TECHNOLOGY_DIRECTWRITE=1 + val SC_TECHNOLOGY_DIRECTWRITERETAIN=2 +@@ -4811,7 +4815,7 @@ + evt void MarginClick=2010(int modifiers, int position, int margin) + evt void NeedShown=2011(int position, int length) + evt void Painted=2013(void) +-evt void UserListSelection=2014(int listType, string text, int positionint, int ch, CompletionMethods listCompletionMethod) ++evt void UserListSelection=2014(int listType, string text, int position, int ch, CompletionMethods listCompletionMethod) + evt void URIDropped=2015(string text) + evt void DwellStart=2016(int position, int x, int y) + evt void DwellEnd=2017(int position, int x, int y) diff --git a/src/scintilla_backports/6111_225f39cfd931.patch b/src/scintilla_backports/6111_225f39cfd931.patch new file mode 100644 index 00000000..29caca6d --- /dev/null +++ b/src/scintilla_backports/6111_225f39cfd931.patch @@ -0,0 +1,101 @@ +# HG changeset patch +# User johnsonj +# Date 1488691711 -39600 +# Node ID 225f39cfd93159c37966d50db15db7fdb894a503 +# Parent a3894ee30cdba2c1ced617f80bc6eb900e5cbb42 +For IMEs, do not clear selected text when there is no composition text to show. + +diff -r a3894ee30cdb -r 225f39cfd931 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Sat Mar 04 14:32:28 2017 +1100 ++++ b/doc/ScintillaHistory.html Sun Mar 05 16:28:31 2017 +1100 +@@ -527,6 +527,9 @@ + Released 19 February 2017. + </li> + <li> ++ For IMEs, do not clear selected text when there is no composition text to show. ++ </li> ++ <li> + Fix to stream selection mode when moving caret up or down. + <a href="http://sourceforge.net/p/scintilla/bugs/1905/">Bug #1905</a>. + </li> +diff -r a3894ee30cdb -r 225f39cfd931 gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Sat Mar 04 14:32:28 2017 +1100 ++++ b/gtk/ScintillaGTK.cxx Sun Mar 05 16:28:31 2017 +1100 +@@ -2323,12 +2323,13 @@ + + view.imeCaretBlockOverride = false; // If backspace. + ++ bool initialCompose = false; + if (pdoc->TentativeActive()) { + pdoc->TentativeUndo(); + } else { + // No tentative undo means start of this composition so + // fill in any virtual spaces. +- ClearBeforeTentativeStart(); ++ initialCompose = true; + } + + PreEditString preeditStr(im_context); +@@ -2345,6 +2346,8 @@ + return; + } + ++ if (initialCompose) ++ ClearBeforeTentativeStart(); + pdoc->TentativeStart(); // TentativeActive() from now on + + std::vector<int> indicator = MapImeIndicators(preeditStr.attrs, preeditStr.str); +diff -r a3894ee30cdb -r 225f39cfd931 qt/ScintillaEditBase/ScintillaEditBase.cpp +--- a/qt/ScintillaEditBase/ScintillaEditBase.cpp Sat Mar 04 14:32:28 2017 +1100 ++++ b/qt/ScintillaEditBase/ScintillaEditBase.cpp Sun Mar 05 16:28:31 2017 +1100 +@@ -525,12 +525,13 @@ + return; + } + ++ bool initialCompose = false; + if (sqt->pdoc->TentativeActive()) { + sqt->pdoc->TentativeUndo(); + } else { + // No tentative undo means start of this composition so + // Fill in any virtual spaces. +- sqt->ClearBeforeTentativeStart(); ++ initialCompose = true; + } + + sqt->view.imeCaretBlockOverride = false; +@@ -557,6 +558,8 @@ + return; + } + ++ if (initialCompose) ++ sqt->ClearBeforeTentativeStart(); + sqt->pdoc->TentativeStart(); // TentativeActive() from now on. + + std::vector<int> imeIndicator = MapImeIndicators(event); +diff -r a3894ee30cdb -r 225f39cfd931 win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Sat Mar 04 14:32:28 2017 +1100 ++++ b/win32/ScintillaWin.cxx Sun Mar 05 16:28:31 2017 +1100 +@@ -1061,12 +1061,13 @@ + return 0; + } + ++ bool initialCompose = false; + if (pdoc->TentativeActive()) { + pdoc->TentativeUndo(); + } else { + // No tentative undo means start of this composition so + // fill in any virtual spaces. +- ClearBeforeTentativeStart(); ++ initialCompose = true; + } + + view.imeCaretBlockOverride = false; +@@ -1078,6 +1079,8 @@ + return 0; + } + ++ if (initialCompose) ++ ClearBeforeTentativeStart(); + pdoc->TentativeStart(); // TentativeActive from now on. + + std::vector<int> imeIndicator = MapImeIndicators(imc.GetImeAttributes()); diff --git a/src/scintilla_backports/6116_6c62b379a52e.patch b/src/scintilla_backports/6116_6c62b379a52e.patch new file mode 100644 index 00000000..c4637e88 --- /dev/null +++ b/src/scintilla_backports/6116_6c62b379a52e.patch @@ -0,0 +1,59 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1488862473 -39600 +# Node ID 6c62b379a52e1d4a2feda80bcec9b352f120dcb6 +# Parent 313a4618efd5ac735a669f923293f296c0e90886 +Avoid potential problems with memcmp reading past end of object. + +diff -r 313a4618efd5 -r 6c62b379a52e lexers/LexErrorList.cxx +--- a/lexers/LexErrorList.cxx Tue Mar 07 12:05:15 2017 +1100 ++++ b/lexers/LexErrorList.cxx Tue Mar 07 15:54:33 2017 +1100 +@@ -106,7 +106,8 @@ + // perl error message: + // <message> at <file> line <line> + return SCE_ERR_PERL; +- } else if ((memcmp(lineBuffer, " at ", 6) == 0) && ++ } else if ((lengthLine >= 6) && ++ (memcmp(lineBuffer, " at ", 6) == 0) && + strstr(lineBuffer, ":line ")) { + // A .NET traceback + return SCE_ERR_NET; +diff -r 313a4618efd5 -r 6c62b379a52e src/Document.cxx +--- a/src/Document.cxx Tue Mar 07 12:05:15 2017 +1100 ++++ b/src/Document.cxx Tue Mar 07 15:54:33 2017 +1100 +@@ -1887,7 +1887,7 @@ + } + } else if (SC_CP_UTF8 == dbcsCodePage) { + const size_t maxFoldingExpansion = 4; +- std::vector<char> searchThing(lengthFind * UTF8MaxBytes * maxFoldingExpansion + 1); ++ std::vector<char> searchThing((lengthFind+1) * UTF8MaxBytes * maxFoldingExpansion + 1); + const int lenSearch = static_cast<int>( + pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind)); + char bytes[UTF8MaxBytes + 1]; +@@ -1914,6 +1914,8 @@ + break; + const int lenFlat = static_cast<int>(pcf->Fold(folded, sizeof(folded), bytes, widthChar)); + folded[lenFlat] = 0; ++ // memcmp may examine lenFlat bytes in both arguments so assert it doesn't read past end of searchThing ++ assert(static_cast<size_t>(indexSearch + lenFlat) <= searchThing.size()); + // Does folded match the buffer + characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat); + if (!characterMatches) +@@ -1939,7 +1941,7 @@ + } else if (dbcsCodePage) { + const size_t maxBytesCharacter = 2; + const size_t maxFoldingExpansion = 4; +- std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1); ++ std::vector<char> searchThing((lengthFind+1) * maxBytesCharacter * maxFoldingExpansion + 1); + const int lenSearch = static_cast<int>( + pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind)); + while (forward ? (pos < endPos) : (pos >= endPos)) { +@@ -1959,6 +1961,8 @@ + char folded[maxBytesCharacter * maxFoldingExpansion + 1]; + const int lenFlat = static_cast<int>(pcf->Fold(folded, sizeof(folded), bytes, widthChar)); + folded[lenFlat] = 0; ++ // memcmp may examine lenFlat bytes in both arguments so assert it doesn't read past end of searchThing ++ assert(static_cast<size_t>(indexSearch + lenFlat) <= searchThing.size()); + // Does folded match the buffer + characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat); + indexDocument += widthChar; diff --git a/src/scintilla_backports/6117_23546875480b.patch b/src/scintilla_backports/6117_23546875480b.patch new file mode 100644 index 00000000..bd0057ac --- /dev/null +++ b/src/scintilla_backports/6117_23546875480b.patch @@ -0,0 +1,313 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1488885645 -39600 +# Node ID 23546875480b1ee4a3f309c738f64166a0409a46 +# Parent 6c62b379a52e1d4a2feda80bcec9b352f120dcb6 +Bug [#1910]. Accessibility support may be queried and, on GTK+, disabled. + +diff -r 6c62b379a52e -r 23546875480b cocoa/ScintillaCocoa.mm +--- a/cocoa/ScintillaCocoa.mm Tue Mar 07 15:54:33 2017 +1100 ++++ b/cocoa/ScintillaCocoa.mm Tue Mar 07 22:20:45 2017 +1100 +@@ -906,6 +906,9 @@ + return r; + } + ++ case SCI_GETACCESSIBILITY: ++ return SC_ACCESSIBILITY_ENABLED; ++ + default: + sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); + +diff -r 6c62b379a52e -r 23546875480b doc/ScintillaDoc.html +--- a/doc/ScintillaDoc.html Tue Mar 07 15:54:33 2017 +1100 ++++ b/doc/ScintillaDoc.html Tue Mar 07 22:20:45 2017 +1100 +@@ -367,17 +367,17 @@ + <tr> + <td>○ <a class="toc" href="#LongLines">Long lines</a></td> + ++ <td>○ <a class="toc" href="#Accessibility">Accessibility</a></td> ++ + <td>○ <a class="toc" href="#Lexer">Lexer</a></td> + ++ </tr> ++ ++ <tr> + <td>○ <a class="toc" href="#LexerObjects">Lexer objects</a></td> + +- </tr> +- +- <tr> + <td>○ <a class="toc" href="#Notifications">Notifications</a></td> + +- <td>○ <a class="toc" href="#Accessibility">Accessibility</a></td> +- + <td>○ <a class="toc" href="#Images">Images</a></td> + + </tr> +@@ -6511,6 +6511,60 @@ + of a space character in <code>STYLE_DEFAULT</code>. All the edges can be cleared with + <code>SCI_MULTIEDGECLEARALL</code>.</p> + ++ <h2 id="Accessibility">Accessibility</h2> ++ ++ <p>Scintilla supports some platform accessibility features. ++ This support differs between platforms. ++ On GTK+ and Cocoa the platform accessibility APIs are implemented sufficiently to ++ make screen readers work. ++ On Win32, the system caret is manipulated to help screen readers. ++ </p> ++ ++ <code><a class="message" href="#SCI_SETACCESSIBILITY">SCI_SETACCESSIBILITY(int accessibility)</a><br /> ++ <a class="message" href="#SCI_GETACCESSIBILITY">SCI_GETACCESSIBILITY → int</a><br /> ++ </code> ++ ++ <p><b id="SCI_SETACCESSIBILITY">SCI_SETACCESSIBILITY(int accessibility)</b><br /> ++ <b id="SCI_GETACCESSIBILITY">SCI_GETACCESSIBILITY → int</b><br /> ++ These messages may enable or disable accessibility and report its current status.</p> ++ ++ <p>On most platforms, accessibility is either implemented or not implemented and this can be ++ discovered with <code>SCI_GETACCESSIBILITY</code> with ++ <code>SCI_SETACCESSIBILITY</code> performing no action. ++ On GTK+, there are storage and performance costs to accessibility, so it can be disabled ++ by calling <code>SCI_SETACCESSIBILITY</code>. ++ </p> ++ ++ <table class="standard" summary="Accessibility status"> ++ <tbody> ++ <tr> ++ <th align="left">Symbol</th> ++ ++ <th>Value</th> ++ ++ <th align="left">Accessibility status</th> ++ </tr> ++ </tbody> ++ ++ <tbody valign="top"> ++ <tr> ++ <td align="left"><code>SC_ACCESSIBILITY_DISABLED</code></td> ++ ++ <td align="center">0</td> ++ ++ <td>Accessibility is disabled.</td> ++ </tr> ++ ++ <tr> ++ <td align="left"><code>SC_ACCESSIBILITY_ENABLED</code></td> ++ ++ <td align="center">1</td> ++ ++ <td>Accessibility is enabled.</td> ++ </tr> ++ </tbody> ++ </table> ++ + <h2 id="Lexer">Lexer</h2> + + <p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes +@@ -7891,15 +7945,6 @@ + <a class="jump" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> + notification.</p> + +- <h2 id="Accessibility">Accessibility</h2> +- +- <p>Scintilla supports some platform accessibility features. +- This support differs between platforms. +- On GTK+ and Cocoa the platform accessibility APIs are implemented sufficiently to +- make screen readers work. +- On Win32, the system caret is manipulated to help screen readers. +- </p> +- + <h2 id="Images">Images</h2> + + <p>Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.</p> +diff -r 6c62b379a52e -r 23546875480b doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Tue Mar 07 15:54:33 2017 +1100 ++++ b/doc/ScintillaHistory.html Tue Mar 07 22:20:45 2017 +1100 +@@ -527,6 +527,10 @@ + Released 19 February 2017. + </li> + <li> ++ Accessibility support may be queried with SCI_GETACCESSIBILITY. ++ On GTK+, accessibility may be disabled by calling SCI_SETACCESSIBILITY. ++ </li> ++ <li> + Lexer added for "indent" language which is styled as plain text but folded by indentation level. + </li> + <li> +diff -r 6c62b379a52e -r 23546875480b gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Tue Mar 07 15:54:33 2017 +1100 ++++ b/gtk/ScintillaGTK.cxx Tue Mar 07 22:20:45 2017 +1100 +@@ -175,6 +175,7 @@ + rgnUpdate(0), + repaintFullWindow(false), + styleIdleID(0), ++ accessibilityEnabled(SC_ACCESSIBILITY_ENABLED), + accessible(0) { + sci = sci_; + wMain = GTK_WIDGET(sci); +@@ -875,6 +876,19 @@ + return ret; + } + ++ case SCI_GETACCESSIBILITY: ++ return accessibilityEnabled; ++ ++ case SCI_SETACCESSIBILITY: ++ accessibilityEnabled = wParam; ++ if (accessible) { ++ ScintillaGTKAccessible *sciAccessible = ScintillaGTKAccessible::FromAccessible(accessible); ++ if (sciAccessible) { ++ sciAccessible->SetAccessibility(); ++ } ++ } ++ break; ++ + default: + return ScintillaBase::WndProc(iMessage, wParam, lParam); + } +diff -r 6c62b379a52e -r 23546875480b gtk/ScintillaGTK.h +--- a/gtk/ScintillaGTK.h Tue Mar 07 15:54:33 2017 +1100 ++++ b/gtk/ScintillaGTK.h Tue Mar 07 22:20:45 2017 +1100 +@@ -68,6 +68,7 @@ + bool repaintFullWindow; + + guint styleIdleID; ++ int accessibilityEnabled; + AtkObject *accessible; + + // Private so ScintillaGTK objects can not be copied +diff -r 6c62b379a52e -r 23546875480b gtk/ScintillaGTKAccessible.cxx +--- a/gtk/ScintillaGTKAccessible.cxx Tue Mar 07 15:54:33 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.cxx Tue Mar 07 22:20:45 2017 +1100 +@@ -788,6 +788,10 @@ + //~ iface->set_run_attributes = SetRunAttributes; + } + ++bool ScintillaGTKAccessible::Enabled() const { ++ return sci->accessibilityEnabled == SC_ACCESSIBILITY_ENABLED; ++} ++ + // Callbacks + + void ScintillaGTKAccessible::UpdateCursor() { +@@ -820,6 +824,10 @@ + } + + void ScintillaGTKAccessible::ChangeDocument(Document *oldDoc, Document *newDoc) { ++ if (!Enabled()) { ++ return; ++ } ++ + if (oldDoc == newDoc) { + return; + } +@@ -854,7 +862,15 @@ + #endif + } + ++void ScintillaGTKAccessible::SetAccessibility() { ++ // Called by ScintillaGTK when application has enabled or disabled accessibility ++ character_offsets.resize(0); ++ character_offsets.push_back(0); ++} ++ + void ScintillaGTKAccessible::Notify(GtkWidget *, gint, SCNotification *nt) { ++ if (!Enabled()) ++ return; + switch (nt->nmhdr.code) { + case SCN_MODIFIED: { + if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { +@@ -864,6 +880,13 @@ + character_offsets.resize(line + 1); + } + } ++ if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { ++ // invalidate character offset cache if applicable ++ const Position line = sci->pdoc->LineFromPosition(nt->position); ++ if (character_offsets.size() > static_cast<size_t>(line + 1)) { ++ character_offsets.resize(line + 1); ++ } ++ } + if (nt->modificationType & SC_MOD_INSERTTEXT) { + int startChar = CharacterOffsetFromByteOffset(nt->position); + int lengthChar = sci->pdoc->CountCharacters(nt->position, nt->position + nt->length); +diff -r 6c62b379a52e -r 23546875480b gtk/ScintillaGTKAccessible.h +--- a/gtk/ScintillaGTKAccessible.h Tue Mar 07 15:54:33 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.h Tue Mar 07 22:20:45 2017 +1100 +@@ -23,12 +23,16 @@ + // cache holding character offset for each line start, see CharacterOffsetFromByteOffset() + std::vector<Position> character_offsets; + ++ // cache holding character offset for each line start, see CharacterOffsetFromByteOffset() ++ std::vector<Position> character_offsets; ++ + // cached length of the deletion, in characters (see Notify()) + int deletionLengthChar; + // local state for comparing + Position old_pos; + std::vector<SelectionRange> old_sels; + ++ bool Enabled() const; + void UpdateCursor(); + void Notify(GtkWidget *widget, gint code, SCNotification *nt); + static void SciNotify(GtkWidget *widget, gint code, SCNotification *nt, gpointer data) { +@@ -136,6 +140,7 @@ + // So ScintillaGTK can notify us + void ChangeDocument(Document *oldDoc, Document *newDoc); + void NotifyReadOnly(); ++ void SetAccessibility(); + + // Helper GtkWidget methods + static AtkObject *WidgetGetAccessibleImpl(GtkWidget *widget, AtkObject **cache, gpointer widget_parent_class); +diff -r 6c62b379a52e -r 23546875480b include/Scintilla.h +--- a/include/Scintilla.h Tue Mar 07 15:54:33 2017 +1100 ++++ b/include/Scintilla.h Tue Mar 07 22:20:45 2017 +1100 +@@ -593,6 +593,10 @@ + #define SCI_LINESSPLIT 2289 + #define SCI_SETFOLDMARGINCOLOUR 2290 + #define SCI_SETFOLDMARGINHICOLOUR 2291 ++#define SC_ACCESSIBILITY_DISABLED 0 ++#define SC_ACCESSIBILITY_ENABLED 1 ++#define SCI_SETACCESSIBILITY 2702 ++#define SCI_GETACCESSIBILITY 2703 + #define SCI_LINEDOWN 2300 + #define SCI_LINEDOWNEXTEND 2301 + #define SCI_LINEUP 2302 +diff -r 6c62b379a52e -r 23546875480b include/Scintilla.iface +--- a/include/Scintilla.iface Tue Mar 07 15:54:33 2017 +1100 ++++ b/include/Scintilla.iface Tue Mar 07 22:20:45 2017 +1100 +@@ -1476,6 +1476,16 @@ + # Set the other colour used as a chequerboard pattern in the fold margin + fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore) + ++enu Accessibility=SC_ACCESSIBILITY_ ++val SC_ACCESSIBILITY_DISABLED=0 ++val SC_ACCESSIBILITY_ENABLED=1 ++ ++# Enable or disable accessibility. ++set void SetAccessibility=2702(int accessibility,) ++ ++# Report accessibility status. ++get int GetAccessibility=2703(,) ++ + ## New messages go here + + ## Start of key messages +diff -r 6c62b379a52e -r 23546875480b src/Editor.cxx +--- a/src/Editor.cxx Tue Mar 07 15:54:33 2017 +1100 ++++ b/src/Editor.cxx Tue Mar 07 22:20:45 2017 +1100 +@@ -7554,6 +7554,13 @@ + std::vector<EdgeProperties>().swap(vs.theMultiEdge); // Free vector and memory, C++03 compatible + InvalidateStyleRedraw(); + break; ++ ++ case SCI_GETACCESSIBILITY: ++ return SC_ACCESSIBILITY_DISABLED; ++ ++ case SCI_SETACCESSIBILITY: ++ // May be implemented by platform code. ++ break; + + case SCI_GETDOCPOINTER: + return reinterpret_cast<sptr_t>(pdoc); diff --git a/src/scintilla_backports/6118_559dea66606f.patch b/src/scintilla_backports/6118_559dea66606f.patch new file mode 100644 index 00000000..cb791fc9 --- /dev/null +++ b/src/scintilla_backports/6118_559dea66606f.patch @@ -0,0 +1,20 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1488886060 -39600 +# Node ID 559dea66606f42c080f04db706a1ebe6bef83713 +# Parent 23546875480b1ee4a3f309c738f64166a0409a46 +Bug [#1910]. Fixed double declaration. + +diff -r 23546875480b -r 559dea66606f gtk/ScintillaGTKAccessible.h +--- a/gtk/ScintillaGTKAccessible.h Tue Mar 07 22:20:45 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.h Tue Mar 07 22:27:40 2017 +1100 +@@ -23,9 +23,6 @@ + // cache holding character offset for each line start, see CharacterOffsetFromByteOffset() + std::vector<Position> character_offsets; + +- // cache holding character offset for each line start, see CharacterOffsetFromByteOffset() +- std::vector<Position> character_offsets; +- + // cached length of the deletion, in characters (see Notify()) + int deletionLengthChar; + // local state for comparing diff --git a/src/scintilla_backports/6119_71bee2f06619.patch b/src/scintilla_backports/6119_71bee2f06619.patch new file mode 100644 index 00000000..693749c7 --- /dev/null +++ b/src/scintilla_backports/6119_71bee2f06619.patch @@ -0,0 +1,24 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1488922409 -39600 +# Node ID 71bee2f066197ae012f92de55433700df2bdcd09 +# Parent 559dea66606f42c080f04db706a1ebe6bef83713 +Bug [#1910]. Fixed more duplicate code. + +diff -r 559dea66606f -r 71bee2f06619 gtk/ScintillaGTKAccessible.cxx +--- a/gtk/ScintillaGTKAccessible.cxx Tue Mar 07 22:27:40 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.cxx Wed Mar 08 08:33:29 2017 +1100 +@@ -880,13 +880,6 @@ + character_offsets.resize(line + 1); + } + } +- if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { +- // invalidate character offset cache if applicable +- const Position line = sci->pdoc->LineFromPosition(nt->position); +- if (character_offsets.size() > static_cast<size_t>(line + 1)) { +- character_offsets.resize(line + 1); +- } +- } + if (nt->modificationType & SC_MOD_INSERTTEXT) { + int startChar = CharacterOffsetFromByteOffset(nt->position); + int lengthChar = sci->pdoc->CountCharacters(nt->position, nt->position + nt->length); diff --git a/src/scintilla_backports/6120_8e0cb37c4972.patch b/src/scintilla_backports/6120_8e0cb37c4972.patch new file mode 100644 index 00000000..373e1121 --- /dev/null +++ b/src/scintilla_backports/6120_8e0cb37c4972.patch @@ -0,0 +1,71 @@ +# HG changeset patch +# User Colomban Wendling <ban@herbesfolles.org> +# Date 1488893049 -3600 +# Node ID 8e0cb37c4972cd66b33293b88031acf453685cfd +# Parent 71bee2f066197ae012f92de55433700df2bdcd09 +GTK: Fix popup positioning on monitors not positioned at 0,0 + +diff -r 71bee2f06619 -r 8e0cb37c4972 gtk/PlatGTK.cxx +--- a/gtk/PlatGTK.cxx Wed Mar 08 08:33:29 2017 +1100 ++++ b/gtk/PlatGTK.cxx Tue Mar 07 14:24:09 2017 +0100 +@@ -1059,25 +1059,21 @@ + GdkWindow *wndRelativeTo = WindowFromWidget(PWidget(relativeTo.wid)); + gdk_window_get_origin(wndRelativeTo, &ox, &oy); + ox += rc.left; +- if (ox < 0) +- ox = 0; + oy += rc.top; +- if (oy < 0) +- oy = 0; + +- GdkRectangle rcScreen = MonitorRectangleForWidget(PWidget(relativeTo.wid)); ++ GdkRectangle rcMonitor = MonitorRectangleForWidget(PWidget(relativeTo.wid)); + + /* do some corrections to fit into screen */ + int sizex = rc.right - rc.left; + int sizey = rc.bottom - rc.top; +- const int screenWidth = rcScreen.width; +- const int screenHeight = rcScreen.height; +- if (sizex > screenWidth) +- ox = 0; /* the best we can do */ +- else if (ox + sizex > screenWidth) +- ox = screenWidth - sizex; +- if (oy + sizey > screenHeight) +- oy = screenHeight - sizey; ++ if (sizex > rcMonitor.width || ox < rcMonitor.x) ++ ox = rcMonitor.x; /* the best we can do */ ++ else if (ox + sizex > rcMonitor.x + rcMonitor.width) ++ ox = rcMonitor.x + rcMonitor.width - sizex; ++ if (sizey > rcMonitor.height || oy < rcMonitor.y) ++ oy = rcMonitor.y; ++ else if (oy + sizey > rcMonitor.y + rcMonitor.height) ++ oy = rcMonitor.y + rcMonitor.height - sizey; + + gtk_window_move(GTK_WINDOW(PWidget(wid)), ox, oy); + +@@ -1929,20 +1925,18 @@ + // Rely on GTK+ to do the right thing with positioning + gtk_menu_popup_at_pointer(widget, NULL); + #else +- GdkRectangle rcScreen = MonitorRectangleForWidget(PWidget(wnd.GetID())); +- const int screenWidth = rcScreen.width; +- const int screenHeight = rcScreen.height; ++ GdkRectangle rcMonitor = MonitorRectangleForWidget(PWidget(wnd.GetID())); + GtkRequisition requisition; + #if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_preferred_size(GTK_WIDGET(widget), NULL, &requisition); + #else + gtk_widget_size_request(GTK_WIDGET(widget), &requisition); + #endif +- if ((pt.x + requisition.width) > screenWidth) { +- pt.x = screenWidth - requisition.width; ++ if ((pt.x + requisition.width) > rcMonitor.x + rcMonitor.width) { ++ pt.x = rcMonitor.x + rcMonitor.width - requisition.width; + } +- if ((pt.y + requisition.height) > screenHeight) { +- pt.y = screenHeight - requisition.height; ++ if ((pt.y + requisition.height) > rcMonitor.y + rcMonitor.height) { ++ pt.y = rcMonitor.y + rcMonitor.height - requisition.height; + } + gtk_menu_popup(widget, NULL, NULL, MenuPositionFunc, + GINT_TO_POINTER((static_cast<int>(pt.y) << 16) | static_cast<int>(pt.x)), 0, diff --git a/src/scintilla_backports/6124_4527b3c217a4.patch b/src/scintilla_backports/6124_4527b3c217a4.patch new file mode 100644 index 00000000..f439b37e --- /dev/null +++ b/src/scintilla_backports/6124_4527b3c217a4.patch @@ -0,0 +1,43 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1488955608 -39600 +# Node ID 4527b3c217a44e45e4714c2a302f124df7109b2f +# Parent 0fd4b41bcec612df9a3e8204399d0acde55194ce +Fix warnings from Visual Studio 2017. + +diff -r 0fd4b41bcec6 -r 4527b3c217a4 src/PositionCache.cxx +--- a/src/PositionCache.cxx Wed Mar 08 16:36:39 2017 +1100 ++++ b/src/PositionCache.cxx Wed Mar 08 17:46:48 2017 +1100 +@@ -392,7 +392,7 @@ + } + + SpecialRepresentations::SpecialRepresentations() { +- std::fill(startByteHasReprs, startByteHasReprs+0x100, 0); ++ std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast<short>(0)); + } + + void SpecialRepresentations::SetRepresentation(const char *charBytes, const char *value) { +@@ -433,7 +433,7 @@ + + void SpecialRepresentations::Clear() { + mapReprs.clear(); +- std::fill(startByteHasReprs, startByteHasReprs+0x100, 0); ++ std::fill(startByteHasReprs, startByteHasReprs+0x100, static_cast<short>(0)); + } + + void BreakFinder::Insert(int val) { +diff -r 0fd4b41bcec6 -r 4527b3c217a4 src/RESearch.cxx +--- a/src/RESearch.cxx Wed Mar 08 16:36:39 2017 +1100 ++++ b/src/RESearch.cxx Wed Mar 08 17:46:48 2017 +1100 +@@ -256,9 +256,9 @@ + charClass = charClassTable; + sta = NOP; /* status of lastpat */ + bol = 0; +- std::fill(bittab, bittab + BITBLK, 0); ++ std::fill(bittab, bittab + BITBLK, static_cast<unsigned char>(0)); + std::fill(tagstk, tagstk + MAXTAG, 0); +- std::fill(nfa, nfa + MAXNFA, 0); ++ std::fill(nfa, nfa + MAXNFA, '\0'); + Clear(); + } + diff --git a/src/scintilla_backports/6131_a78e38849624.patch b/src/scintilla_backports/6131_a78e38849624.patch new file mode 100644 index 00000000..9fb0f43d --- /dev/null +++ b/src/scintilla_backports/6131_a78e38849624.patch @@ -0,0 +1,56 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1489619799 -39600 +# Node ID a78e38849624fca65cd615da3f976d22db03a48b +# Parent e8364d5495d60b675717c68f97cc527ab3fc95ee +Fix use-after-free in fold tags when top line folded then new top line inserted. +In SparseVector, string inserted at start then NULL inserted at start. + +diff -r e8364d5495d6 -r a78e38849624 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Sat Mar 11 10:41:32 2017 +1100 ++++ b/doc/ScintillaHistory.html Thu Mar 16 10:16:39 2017 +1100 +@@ -555,6 +555,9 @@ + For IMEs, do not clear selected text when there is no composition text to show. + </li> + <li> ++ Fix to crash with fold tags where line inserted at start. ++ </li> ++ <li> + Fix to stream selection mode when moving caret up or down. + <a href="http://sourceforge.net/p/scintilla/bugs/1905/">Bug #1905</a>. + </li> +diff -r e8364d5495d6 -r a78e38849624 src/SparseVector.h +--- a/src/SparseVector.h Sat Mar 11 10:41:32 2017 +1100 ++++ b/src/SparseVector.h Thu Mar 16 10:16:39 2017 +1100 +@@ -100,7 +100,8 @@ + if (partition == 0) { + // Inserting at start of document so ensure 0 + if (valueCurrent != T()) { +- ClearValue(0); ++ // Since valueCurrent is needed again, should not ClearValue ++ values->SetValueAt(0, T()); + starts->InsertPartition(1, 0); + values->InsertValue(1, 1, valueCurrent); + starts->InsertText(0, insertLength); +diff -r e8364d5495d6 -r a78e38849624 test/unit/testSparseVector.cxx +--- a/test/unit/testSparseVector.cxx Sat Mar 11 10:41:32 2017 +1100 ++++ b/test/unit/testSparseVector.cxx Thu Mar 16 10:16:39 2017 +1100 +@@ -89,6 +89,18 @@ + st.Check(); + } + ++ SECTION("InsertStringAtStartThenInsertSpaceAtStart") { ++ REQUIRE(1 == st.Elements()); ++ st.InsertSpace(0, 5); ++ st.SetValueAt(0, "3"); ++ REQUIRE(1 == st.Elements()); ++ REQUIRE("3----" == Representation(st)); ++ st.InsertSpace(0, 1); ++ REQUIRE(2 == st.Elements()); ++ REQUIRE("-3----" == Representation(st)); ++ st.Check(); ++ } ++ + SECTION("InsertAndDeleteAtEnd") { + REQUIRE(1 == st.Elements()); + st.InsertSpace(0, 5); diff --git a/src/scintilla_backports/6132_6cf19f2bf214.patch b/src/scintilla_backports/6132_6cf19f2bf214.patch new file mode 100644 index 00000000..3ef0f6c7 --- /dev/null +++ b/src/scintilla_backports/6132_6cf19f2bf214.patch @@ -0,0 +1,19 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1489631977 -39600 +# Node ID 6cf19f2bf214b1d1dc0ba05412a6659142c772ec +# Parent a78e38849624fca65cd615da3f976d22db03a48b +Fix difference between right of line end and left of fold tag. + +diff -r a78e38849624 -r 6cf19f2bf214 src/EditView.cxx +--- a/src/EditView.cxx Thu Mar 16 10:16:39 2017 +1100 ++++ b/src/EditView.cxx Thu Mar 16 13:39:37 2017 +1100 +@@ -1087,7 +1087,7 @@ + + const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; + XYPOSITION virtualSpace = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)) * spaceWidth; +- rcSegment.left = xStart + static_cast<XYPOSITION>(ll->positions[ll->numCharsInLine] - subLineStart) + spaceWidth + virtualSpace; ++ rcSegment.left = xStart + static_cast<XYPOSITION>(ll->positions[ll->numCharsInLine] - subLineStart) + virtualSpace + vsDraw.aveCharWidth; + rcSegment.right = rcSegment.left + static_cast<XYPOSITION>(widthFoldDisplayText); + + ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); diff --git a/src/scintilla_backports/6133_30f1573f17ac.patch b/src/scintilla_backports/6133_30f1573f17ac.patch new file mode 100644 index 00000000..a69f2c14 --- /dev/null +++ b/src/scintilla_backports/6133_30f1573f17ac.patch @@ -0,0 +1,19 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1489632019 -39600 +# Node ID 30f1573f17ace82fd1adba69e733c4726f68e867 +# Parent 6cf19f2bf214b1d1dc0ba05412a6659142c772ec +Fix 1 pixel unpainted as background. + +diff -r 6cf19f2bf214 -r 30f1573f17ac src/EditView.cxx +--- a/src/EditView.cxx Thu Mar 16 13:39:37 2017 +1100 ++++ b/src/EditView.cxx Thu Mar 16 13:40:19 2017 +1100 +@@ -1111,7 +1111,7 @@ + + // Fill Remainder of the line + PRectangle rcRemainder = rcSegment; +- rcRemainder.left = rcRemainder.right + 1; ++ rcRemainder.left = rcRemainder.right; + if (rcRemainder.left < rcLine.left) + rcRemainder.left = rcLine.left; + rcRemainder.right = rcLine.right; diff --git a/src/scintilla_backports/6134_0253f113f223.patch b/src/scintilla_backports/6134_0253f113f223.patch new file mode 100644 index 00000000..aa1ffe61 --- /dev/null +++ b/src/scintilla_backports/6134_0253f113f223.patch @@ -0,0 +1,36 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1489704595 -39600 +# Node ID 0253f113f22359c009f415099cf635b2637def1e +# Parent 30f1573f17ace82fd1adba69e733c4726f68e867 +Round left and right sides of fold text box to ensure within the allocation. + +diff -r 30f1573f17ac -r 0253f113f223 src/EditView.cxx +--- a/src/EditView.cxx Thu Mar 16 13:40:19 2017 +1100 ++++ b/src/EditView.cxx Fri Mar 17 09:49:55 2017 +1100 +@@ -1133,14 +1133,17 @@ + if (phase & drawIndicatorsFore) { + if (model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_BOXED) { + surface->PenColour(textFore); +- surface->MoveTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.top)); +- surface->LineTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.bottom)); +- surface->MoveTo(static_cast<int>(rcSegment.right), static_cast<int>(rcSegment.top)); +- surface->LineTo(static_cast<int>(rcSegment.right), static_cast<int>(rcSegment.bottom)); +- surface->MoveTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.top)); +- surface->LineTo(static_cast<int>(rcSegment.right), static_cast<int>(rcSegment.top)); +- surface->MoveTo(static_cast<int>(rcSegment.left), static_cast<int>(rcSegment.bottom - 1)); +- surface->LineTo(static_cast<int>(rcSegment.right), static_cast<int>(rcSegment.bottom - 1)); ++ PRectangle rcBox = rcSegment; ++ rcBox.left = static_cast<XYPOSITION>(RoundXYPosition(rcSegment.left)); ++ rcBox.right = static_cast<XYPOSITION>(RoundXYPosition(rcSegment.right)); ++ surface->MoveTo(static_cast<int>(rcBox.left), static_cast<int>(rcBox.top)); ++ surface->LineTo(static_cast<int>(rcBox.left), static_cast<int>(rcBox.bottom)); ++ surface->MoveTo(static_cast<int>(rcBox.right), static_cast<int>(rcBox.top)); ++ surface->LineTo(static_cast<int>(rcBox.right), static_cast<int>(rcBox.bottom)); ++ surface->MoveTo(static_cast<int>(rcBox.left), static_cast<int>(rcBox.top)); ++ surface->LineTo(static_cast<int>(rcBox.right), static_cast<int>(rcBox.top)); ++ surface->MoveTo(static_cast<int>(rcBox.left), static_cast<int>(rcBox.bottom - 1)); ++ surface->LineTo(static_cast<int>(rcBox.right), static_cast<int>(rcBox.bottom - 1)); + } + } + diff --git a/src/scintilla_backports/6135_34665edc7efd.patch b/src/scintilla_backports/6135_34665edc7efd.patch new file mode 100644 index 00000000..3f807467 --- /dev/null +++ b/src/scintilla_backports/6135_34665edc7efd.patch @@ -0,0 +1,20 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1489632594 -39600 +# Node ID 34665edc7efdd526c62e426bb0f6267f64e156e7 +# Parent 0253f113f22359c009f415099cf635b2637def1e +For multiphase drawing ensure edges and mark underline drawn over fold tags by +moving background drawing of fold tags before edge line and mark underline. + +diff -r 0253f113f223 -r 34665edc7efd src/EditView.cxx +--- a/src/EditView.cxx Fri Mar 17 09:49:55 2017 +1100 ++++ b/src/EditView.cxx Thu Mar 16 13:49:54 2017 +1100 +@@ -1849,6 +1849,8 @@ + if ((phasesDraw != phasesOne) && (phase & drawBack)) { + DrawBackground(surface, model, vsDraw, ll, rcLine, lineRange, posLineStart, xStart, + subLine, background); ++ DrawFoldDisplayText(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, subLineStart, drawBack); ++ phase = static_cast<DrawPhase>(phase & ~drawBack); + DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, + xStart, subLine, subLineStart, background); + } diff --git a/src/scintilla_backports/6136_2b25287311d0.patch b/src/scintilla_backports/6136_2b25287311d0.patch new file mode 100644 index 00000000..cea704d2 --- /dev/null +++ b/src/scintilla_backports/6136_2b25287311d0.patch @@ -0,0 +1,43 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1489633459 -39600 +# Node ID 2b25287311d015ecc9971c101f0f40ae00c8ca4e +# Parent 34665edc7efdd526c62e426bb0f6267f64e156e7 +For single phase drawing ensure edges and mark underline drawn over fold tags by +moving drawing of edge line and mark underline after fold tags. + +diff -r 34665edc7efd -r 2b25287311d0 src/EditView.cxx +--- a/src/EditView.cxx Thu Mar 16 13:49:54 2017 +1100 ++++ b/src/EditView.cxx Thu Mar 16 14:04:19 2017 +1100 +@@ -1857,8 +1857,10 @@ + + if (phase & drawIndicatorsBack) { + DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, true, model.hoverIndicatorPos); +- DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart); +- DrawMarkUnderline(surface, model, vsDraw, line, rcLine); ++ if (phasesDraw != phasesOne) { ++ DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart); ++ DrawMarkUnderline(surface, model, vsDraw, line, rcLine); ++ } + } + + if (phase & drawText) { +@@ -1874,14 +1876,15 @@ + DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, false, model.hoverIndicatorPos); + } + +- // End of the drawing of the current line ++ DrawFoldDisplayText(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, subLineStart, phase); ++ + if (phasesDraw == phasesOne) { + DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, + xStart, subLine, subLineStart, background); ++ DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart); ++ DrawMarkUnderline(surface, model, vsDraw, line, rcLine); + } + +- DrawFoldDisplayText(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, subLineStart, phase); +- + if (!hideSelection && (phase & drawSelectionTranslucent)) { + DrawTranslucentSelection(surface, model, vsDraw, ll, line, rcLine, subLine, lineRange, xStart); + } diff --git a/src/scintilla_backports/6137_c3bba4a9193e.patch b/src/scintilla_backports/6137_c3bba4a9193e.patch new file mode 100644 index 00000000..d87dec5c --- /dev/null +++ b/src/scintilla_backports/6137_c3bba4a9193e.patch @@ -0,0 +1,20 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1489633522 -39600 +# Node ID c3bba4a9193ea55175c309109e5bab8c87f2a0bd +# Parent 2b25287311d015ecc9971c101f0f40ae00c8ca4e +For single phase drawing ensure remainder of line filled by always filling +in tag fold drawing. + +diff -r 2b25287311d0 -r c3bba4a9193e src/EditView.cxx +--- a/src/EditView.cxx Thu Mar 16 14:04:19 2017 +1100 ++++ b/src/EditView.cxx Thu Mar 16 14:05:22 2017 +1100 +@@ -1106,7 +1106,7 @@ + } + } + +- if ((phasesDraw != phasesOne) && (phase & drawBack)) { ++ if (phase & drawBack) { + surface->FillRectangle(rcSegment, textBack); + + // Fill Remainder of the line diff --git a/src/scintilla_backports/6138_55368b05bb72.patch b/src/scintilla_backports/6138_55368b05bb72.patch new file mode 100644 index 00000000..7d6d4519 --- /dev/null +++ b/src/scintilla_backports/6138_55368b05bb72.patch @@ -0,0 +1,40 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1489925352 -39600 +# Node ID 55368b05bb72a05862c4ffb6cb01a1ce70f64c0f +# Parent c3bba4a9193ea55175c309109e5bab8c87f2a0bd +Group non-single-phase drawing before text. + +diff -r c3bba4a9193e -r 55368b05bb72 src/EditView.cxx +--- a/src/EditView.cxx Thu Mar 16 14:05:22 2017 +1100 ++++ b/src/EditView.cxx Sun Mar 19 23:09:12 2017 +1100 +@@ -1846,18 +1846,18 @@ + xStart += static_cast<int>(ll->wrapIndent); + } + +- if ((phasesDraw != phasesOne) && (phase & drawBack)) { +- DrawBackground(surface, model, vsDraw, ll, rcLine, lineRange, posLineStart, xStart, +- subLine, background); +- DrawFoldDisplayText(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, subLineStart, drawBack); +- phase = static_cast<DrawPhase>(phase & ~drawBack); +- DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, +- xStart, subLine, subLineStart, background); +- } ++ if (phasesDraw != phasesOne) { ++ if (phase & drawBack) { ++ DrawBackground(surface, model, vsDraw, ll, rcLine, lineRange, posLineStart, xStart, ++ subLine, background); ++ DrawFoldDisplayText(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, subLineStart, drawBack); ++ phase = static_cast<DrawPhase>(phase & ~drawBack); // Remove drawBack to not draw again in DrawFoldDisplayText ++ DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, ++ xStart, subLine, subLineStart, background); ++ } + +- if (phase & drawIndicatorsBack) { +- DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, true, model.hoverIndicatorPos); +- if (phasesDraw != phasesOne) { ++ if (phase & drawIndicatorsBack) { ++ DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, true, model.hoverIndicatorPos); + DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart); + DrawMarkUnderline(surface, model, vsDraw, line, rcLine); + } |