From 70a4fe3fc0163fc90dcd55de962ad99bac237790 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Tue, 15 Feb 2022 22:04:46 -0500 Subject: Updated to Scintilla 5.2.0. --- src/Makefile | 4 ++-- src/scintilla.patch | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++- src/textadept.c | 2 -- 3 files changed, 63 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Makefile b/src/Makefile index ae0da75f..3291ba1e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -87,7 +87,7 @@ else pkg-config --silence-errors --cflags ncurses || pkg-config --silence-errors --cflags curses) CURSES_LIBS = $(shell pkg-config --silence-errors --libs ncursesw || \ pkg-config --silence-errors --libs ncurses || pkg-config --silence-errors --libs curses || \ - echo -lncursesw) + echo -lncursesw) -lpthread install_targets = ../textadept-curses endif endif @@ -345,7 +345,7 @@ else gtdialog_url = $(root_url)/gtdialog/archive/default.zip endif -scintilla_tgz = scintilla514.tgz +scintilla_tgz = scintilla520.tgz lexilla_tgz = lexilla510.tgz scinterm_zip = 475d8d43f3418590c28bd2fb07ee9229d1fa2d07.zip scintillua_zip = 4cb1464ef738a098f008d6530b776fe780b19c34.zip diff --git a/src/scintilla.patch b/src/scintilla.patch index 74fba967..3e1efde2 100644 --- a/src/scintilla.patch +++ b/src/scintilla.patch @@ -3,6 +3,8 @@ Scintilla changes: * Add Message::ChangeInsertion for programmatically setting input method. This is helpful on newer versions of macOS, where changing the input method is flaky. * Handle leading whitespace in XPM images in order to prevent crashes. +* Fix preprocessor condition to enable threading on Linux. This has been committed upstream. +* Fix crash due to re-entrant painting. This has been committed upstream. diff -r 52d56f79dc0f gtk/ScintillaGTK.cxx --- a/gtk/ScintillaGTK.cxx Fri Apr 09 15:11:26 2021 +1000 @@ -13,7 +15,7 @@ diff -r 52d56f79dc0f gtk/ScintillaGTK.cxx + case Message::ChangeInsertion: + // Hijack this interface to programmatically set input method. -+ gtk_im_multicontext_set_context_id(GTK_IM_MULTICONTEXT(im_context), ConstCharPtrFromSPtr(lParam)); ++ gtk_im_multicontext_set_context_id(GTK_IM_MULTICONTEXT(im_context.get()), ConstCharPtrFromSPtr(lParam)); + break; + case Message::TargetAsUTF8: @@ -32,3 +34,61 @@ diff -r 22b6bbb36280 src/XPM.cxx if ((0 == memcmp(textForm, "/* X", 4)) && (0 == memcmp(textForm, "/* XPM */", 9))) { // Build the lines form out of the text form std::vector linesForm = LinesFormFromTextForm(textForm); +diff -r b0e5467561f7 -r c44165c2283e gtk/PlatGTK.cxx +--- a/gtk/PlatGTK.cxx Thu Feb 10 13:57:56 2022 +1100 ++++ b/gtk/PlatGTK.cxx Wed Feb 16 09:13:39 2022 +1100 +@@ -214,7 +214,7 @@ + Supports::FractionalStrokeWidth, + Supports::TranslucentStroke, + Supports::PixelModification, +-#if !defined(PLAT_GTK_WIN32) && !defined(PLAT_GTK_MACOSX) ++#if defined(G_OS_UNIX) && !defined(__APPLE__) + // Pango is not thread-safe on Win32 or macOS + Supports::ThreadSafeMeasureWidths, + #endif +diff -r c44165c2283e -r 58bb44ceae61 gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Wed Feb 16 09:13:39 2022 +1100 ++++ b/gtk/ScintillaGTK.cxx Wed Feb 16 09:32:20 2022 +1100 +@@ -2656,13 +2656,13 @@ + + rcPaint = GetClientRectangle(); + +- PLATFORM_ASSERT(rgnUpdate == nullptr); ++ cairo_rectangle_list_t *oldRgnUpdate = rgnUpdate; + rgnUpdate = cairo_copy_clip_rectangle_list(cr); + if (rgnUpdate && rgnUpdate->status != CAIRO_STATUS_SUCCESS) { + // If not successful then ignore + fprintf(stderr, "DrawTextThis failed to copy update region %d [%d]\n", rgnUpdate->status, rgnUpdate->num_rectangles); + cairo_rectangle_list_destroy(rgnUpdate); +- rgnUpdate = 0; ++ rgnUpdate = nullptr; + } + + double x1, y1, x2, y2; +@@ -2687,7 +2687,7 @@ + if (rgnUpdate) { + cairo_rectangle_list_destroy(rgnUpdate); + } +- rgnUpdate = 0; ++ rgnUpdate = oldRgnUpdate; + paintState = PaintState::notPainting; + } catch (...) { + errorStatus = Status::Failure; +@@ -2759,7 +2759,7 @@ + ose->area.x + ose->area.width, + ose->area.y + ose->area.height); + +- PLATFORM_ASSERT(rgnUpdate == nullptr); ++ GdkRegion *oldRgnUpdate = rgnUpdate; + rgnUpdate = gdk_region_copy(ose->region); + const PRectangle rcClient = GetClientRectangle(); + paintingAllText = rcPaint.Contains(rcClient); +@@ -2779,7 +2779,7 @@ + if (rgnUpdate) { + gdk_region_destroy(rgnUpdate); + } +- rgnUpdate = nullptr; ++ rgnUpdate = oldRgnUpdate; + } catch (...) { + errorStatus = Status::Failure; + } diff --git a/src/textadept.c b/src/textadept.c index 6c50c04f..794acd3f 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1154,8 +1154,6 @@ static int call_scintilla( len = SS(view, msg, wparam, 0); if (wtype == SLEN) wparam = len; text = malloc(len + 1), text[len] = '\0'; - if (msg == SCI_GETTEXT || msg == SCI_GETSELTEXT || msg == SCI_GETCURLINE) - len--; // Scintilla appends '\0' for these messages; compensate lparam = (sptr_t)text; } -- cgit v1.2.3