Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: GitHub noreply@github.com Date: Sat, 26 Sep 2020 10:03:07 UTC Commit: 8f0909685dad46096ecf92152e82d309b0852bfd https://github.com/geany/geany/commit/8f0909685dad46096ecf92152e82d309b0852b...
Log Message: ----------- Update Scintilla to version 3.21.1 (#2506)
Modified Paths: -------------- scintilla/Makefile.am scintilla/gtk/Converter.h scintilla/gtk/PlatGTK.cxx scintilla/gtk/ScintillaGTK.cxx scintilla/gtk/ScintillaGTK.h scintilla/gtk/ScintillaGTKAccessible.cxx scintilla/gtk/ScintillaGTKAccessible.h scintilla/include/Compat.h scintilla/include/ILexer.h scintilla/include/Makefile.am scintilla/include/Platform.h scintilla/include/SciLexer.h scintilla/include/Scintilla.h scintilla/include/Scintilla.iface scintilla/lexers/LexAbaqus.cxx scintilla/lexers/LexAsm.cxx scintilla/lexers/LexBash.cxx scintilla/lexers/LexBasic.cxx scintilla/lexers/LexBatch.cxx scintilla/lexers/LexCPP.cxx scintilla/lexers/LexCmake.cxx scintilla/lexers/LexD.cxx scintilla/lexers/LexHTML.cxx scintilla/lexers/LexHaskell.cxx scintilla/lexers/LexLaTeX.cxx scintilla/lexers/LexMatlab.cxx scintilla/lexers/LexPerl.cxx scintilla/lexers/LexProps.cxx scintilla/lexers/LexPython.cxx scintilla/lexers/LexR.cxx scintilla/lexers/LexRuby.cxx scintilla/lexers/LexRust.cxx scintilla/lexers/LexSQL.cxx scintilla/lexers/LexTCL.cxx scintilla/lexers/LexVHDL.cxx scintilla/lexers/LexVerilog.cxx scintilla/lexlib/CatalogueModules.h scintilla/lexlib/CharacterCategory.cxx scintilla/lexlib/CharacterCategory.h scintilla/lexlib/CharacterSet.cxx scintilla/lexlib/CharacterSet.h scintilla/lexlib/DefaultLexer.cxx scintilla/lexlib/DefaultLexer.h scintilla/lexlib/LexAccessor.h scintilla/lexlib/LexerBase.cxx scintilla/lexlib/LexerBase.h scintilla/lexlib/LexerModule.cxx scintilla/lexlib/LexerModule.h scintilla/lexlib/LexerSimple.cxx scintilla/lexlib/LexerSimple.h scintilla/lexlib/OptionSet.h scintilla/lexlib/PropSetSimple.cxx scintilla/lexlib/PropSetSimple.h scintilla/lexlib/SparseState.h scintilla/lexlib/StyleContext.h scintilla/lexlib/SubStyles.h scintilla/lexlib/WordList.cxx scintilla/lexlib/WordList.h scintilla/scintilla_changes.patch scintilla/src/AutoComplete.h scintilla/src/CallTip.cxx scintilla/src/CallTip.h scintilla/src/CaseConvert.cxx scintilla/src/CaseConvert.h scintilla/src/CaseFolder.cxx scintilla/src/CaseFolder.h scintilla/src/Catalogue.cxx scintilla/src/Catalogue.h scintilla/src/CellBuffer.cxx scintilla/src/CellBuffer.h scintilla/src/CharClassify.cxx scintilla/src/CharClassify.h scintilla/src/ContractionState.cxx scintilla/src/ContractionState.h scintilla/src/Decoration.cxx scintilla/src/Decoration.h scintilla/src/Document.cxx scintilla/src/Document.h scintilla/src/EditModel.cxx scintilla/src/EditModel.h scintilla/src/EditView.cxx scintilla/src/EditView.h scintilla/src/Editor.cxx scintilla/src/Editor.h scintilla/src/ElapsedPeriod.h scintilla/src/ExternalLexer.cxx scintilla/src/ExternalLexer.h scintilla/src/Indicator.cxx scintilla/src/Indicator.h scintilla/src/KeyMap.cxx scintilla/src/KeyMap.h scintilla/src/LineMarker.cxx scintilla/src/LineMarker.h scintilla/src/MarginView.cxx scintilla/src/Partitioning.h scintilla/src/PerLine.cxx scintilla/src/PerLine.h scintilla/src/Position.h scintilla/src/PositionCache.cxx scintilla/src/PositionCache.h scintilla/src/RESearch.cxx scintilla/src/RESearch.h scintilla/src/RunStyles.cxx scintilla/src/ScintillaBase.cxx scintilla/src/ScintillaBase.h scintilla/src/Selection.cxx scintilla/src/Selection.h scintilla/src/SparseVector.h scintilla/src/SplitVector.h scintilla/src/Style.cxx scintilla/src/Style.h scintilla/src/UniConversion.cxx scintilla/src/UniConversion.h scintilla/src/UniqueString.cxx scintilla/src/UniqueString.h scintilla/src/ViewStyle.cxx scintilla/src/ViewStyle.h scintilla/src/XPM.cxx scintilla/src/XPM.h scintilla/version.txt
Modified: scintilla/Makefile.am 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -60,6 +60,7 @@ gtk/scintilla-marshal.c \ gtk/scintilla-marshal.h \ lexlib/Accessor.cxx \ lexlib/Accessor.h \ +lexlib/CatalogueModules.h \ lexlib/CharacterCategory.cxx \ lexlib/CharacterCategory.h \ lexlib/CharacterSet.cxx \
Modified: scintilla/gtk/Converter.h 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -29,6 +29,11 @@ class Converter { iconvh = iconvhBad; Open(charSetDestination, charSetSource, transliterations); } + // Deleted so Converter objects can not be copied. + Converter(const Converter &) = delete; + Converter(Converter &&) = delete; + Converter &operator=(const Converter &) = delete; + Converter &operator=(Converter &&) = delete; ~Converter() { Close(); }
Modified: scintilla/gtk/PlatGTK.cxx 159 lines changed, 84 insertions(+), 75 deletions(-) =================================================================== @@ -42,16 +42,16 @@ using namespace Scintilla;
namespace {
-const double kPi = 3.14159265358979323846; +constexpr double kPi = 3.14159265358979323846;
// The Pango version guard for pango_units_from_double and pango_units_to_double // is more complex than simply implementing these here.
-int pangoUnitsFromDouble(double d) noexcept { +constexpr int pangoUnitsFromDouble(double d) noexcept { return static_cast<int>(d * PANGO_SCALE + 0.5); }
-float floatFromPangoUnits(int pu) noexcept { +constexpr float floatFromPangoUnits(int pu) noexcept { return static_cast<float>(pu) / PANGO_SCALE; }
@@ -80,6 +80,11 @@ class FontHandle { pfd = pfd_; characterSet = characterSet_; } + // Deleted so FontHandle objects can not be copied. + FontHandle(const FontHandle &) = delete; + FontHandle(FontHandle &&) = delete; + FontHandle &operator=(const FontHandle &) = delete; + FontHandle &operator=(FontHandle &&) = delete; ~FontHandle() { if (pfd) pango_font_description_free(pfd); @@ -103,7 +108,7 @@ FontHandle *FontHandle::CreateNewFont(const FontParameters &fp) { }
// X has a 16 bit coordinate space, so stop drawing here to avoid wrapping -const int maxCoordinate = 32000; +constexpr int maxCoordinate = 32000;
FontHandle *PFont(const Font &f) noexcept { return static_cast<FontHandle *>(f.GetID()); @@ -145,6 +150,11 @@ class SurfaceImpl : public Surface { void SetConverter(int characterSet_); public: SurfaceImpl() noexcept; + // Deleted so SurfaceImpl objects can not be copied. + SurfaceImpl(const SurfaceImpl&) = delete; + SurfaceImpl(SurfaceImpl&&) = delete; + SurfaceImpl&operator=(const SurfaceImpl&) = delete; + SurfaceImpl&operator=(SurfaceImpl&&) = delete; ~SurfaceImpl() override;
void Init(WindowID wid) override; @@ -171,7 +181,7 @@ class SurfaceImpl : public Surface { void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override; void Copy(PRectangle rc, Point from, Surface &surfaceSource) override;
- void DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); + void DrawTextBase(PRectangle rc, const Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back) override; void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back) override; void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) override; @@ -292,7 +302,7 @@ bool SurfaceImpl::Initialised() { if (inited && context) { if (cairo_status(context) == CAIRO_STATUS_SUCCESS) { // Even when status is success, the target surface may have been - // finished whch may cause an assertion to fail crashing the application. + // finished which may cause an assertion to fail crashing the application. // The cairo_surface_has_show_text_glyphs call checks the finished flag // and when set, sets the status to CAIRO_STATUS_SURFACE_FINISHED // which leads to warning messages instead of crashes. @@ -339,7 +349,8 @@ void SurfaceImpl::Init(SurfaceID sid, WindowID wid) { void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID wid) { PLATFORM_ASSERT(surface_); Release(); - SurfaceImpl *surfImpl = static_cast<SurfaceImpl *>(surface_); + SurfaceImpl *surfImpl = dynamic_cast<SurfaceImpl *>(surface_); + PLATFORM_ASSERT(surfImpl); PLATFORM_ASSERT(wid); context = cairo_reference(surfImpl->context); pcontext = gtk_widget_create_pango_context(PWidget(wid)); @@ -448,7 +459,7 @@ void SurfaceImpl::Polygon(Point *pts, size_t npts, ColourDesired fore, void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) { if (context) { cairo_rectangle(context, rc.left + 0.5, rc.top + 0.5, - rc.right - rc.left - 1, rc.bottom - rc.top - 1); + rc.Width() - 1, rc.Height() - 1); PenColour(back); cairo_fill_preserve(context); PenColour(fore); @@ -459,37 +470,21 @@ void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) { PenColour(back); if (context && (rc.left < maxCoordinate)) { // Protect against out of range - rc.left = std::round(rc.left); - rc.right = std::round(rc.right); - cairo_rectangle(context, rc.left, rc.top, - rc.right - rc.left, rc.bottom - rc.top); + rc.left = Sci::round(rc.left); + rc.right = Sci::round(rc.right); + cairo_rectangle(context, rc.left, rc.top, rc.Width(), rc.Height()); cairo_fill(context); } }
void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { - SurfaceImpl &surfi = static_cast<SurfaceImpl &>(surfacePattern); - const bool canDraw = surfi.psurf != nullptr; - if (canDraw) { - PLATFORM_ASSERT(context); + SurfaceImpl &surfi = dynamic_cast<SurfaceImpl &>(surfacePattern); + if (context && surfi.psurf) { // Tile pattern over rectangle - // Currently assumes 8x8 pattern - const int widthPat = 8; - const int heightPat = 8; - const IntegerRectangle irc(rc); - for (int xTile = irc.left; xTile < irc.right; xTile += widthPat) { - const int widthx = (xTile + widthPat > irc.right) ? irc.right - xTile : widthPat; - for (int yTile = irc.top; yTile < irc.bottom; yTile += heightPat) { - const int heighty = (yTile + heightPat > irc.bottom) ? irc.bottom - yTile : heightPat; - cairo_set_source_surface(context, surfi.psurf, xTile, yTile); - cairo_rectangle(context, xTile, yTile, widthx, heighty); - cairo_fill(context); - } - } - } else { - // Something is wrong so try to show anyway - // Shows up black because colour not allocated - FillRectangle(rc, ColourDesired(0)); + cairo_set_source_surface(context, surfi.psurf, rc.left, rc.top); + cairo_pattern_set_extend(cairo_get_source(context), CAIRO_EXTEND_REPEAT); + cairo_rectangle(context, rc.left, rc.top, rc.Width(), rc.Height()); + cairo_fill(context); } }
@@ -506,14 +501,14 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi Point(rc.left, rc.bottom - 2), Point(rc.left, rc.top + 2), }; - Polygon(pts, ELEMENTS(pts), fore, back); + Polygon(pts, Sci::size(pts), fore, back); } else { RectangleDraw(rc, fore, back); } }
-static void PathRoundRectangle(cairo_t *context, double left, double top, double width, double height, int radius) noexcept { - const double degrees = kPi / 180.0; +static void PathRoundRectangle(cairo_t *context, double left, double top, double width, double height, double radius) noexcept { + constexpr double degrees = kPi / 180.0;
cairo_new_sub_path(context); cairo_arc(context, left + width - radius, top + radius, radius, -90 * degrees, 0 * degrees); @@ -533,9 +528,9 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fi cdFill.GetBlue() / 255.0, alphaFill / 255.0); if (cornerSize > 0) - PathRoundRectangle(context, rc.left + 1.0, rc.top + 1.0, rc.right - rc.left - 2.0, rc.bottom - rc.top - 2.0, cornerSize); + PathRoundRectangle(context, rc.left + 1.0, rc.top + 1.0, rc.Width() - 2.0, rc.Height() - 2.0, cornerSize); else - cairo_rectangle(context, rc.left + 1.0, rc.top + 1.0, rc.right - rc.left - 2.0, rc.bottom - rc.top - 2.0); + cairo_rectangle(context, rc.left + 1.0, rc.top + 1.0, rc.Width() - 2.0, rc.Height() - 2.0); cairo_fill(context);
const ColourDesired cdOutline(outline.AsInteger()); @@ -545,9 +540,9 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fi cdOutline.GetBlue() / 255.0, alphaOutline / 255.0); if (cornerSize > 0) - PathRoundRectangle(context, rc.left + 0.5, rc.top + 0.5, rc.right - rc.left - 1, rc.bottom - rc.top - 1, cornerSize); + PathRoundRectangle(context, rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1, cornerSize); else - cairo_rectangle(context, rc.left + 0.5, rc.top + 0.5, rc.right - rc.left - 1, rc.bottom - rc.top - 1); + cairo_rectangle(context, rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1); cairo_stroke(context); } } @@ -587,23 +582,18 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi rc.top += (rc.Height() - height) / 2; rc.bottom = rc.top + height;
- int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width); + const int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width); const int ucs = stride * height; std::vector<unsigned char> image(ucs); - for (int iy=0; iy<height; iy++) { - for (int ix=0; ix<width; ix++) { - unsigned char *pixel = &image[0] + iy*stride + ix * 4; - const unsigned char alpha = pixelsImage[3]; - pixel[2] = (*pixelsImage++) * alpha / 255; - pixel[1] = (*pixelsImage++) * alpha / 255; - pixel[0] = (*pixelsImage++) * alpha / 255; - pixel[3] = *pixelsImage++; - } + for (ptrdiff_t iy=0; iy<height; iy++) { + unsigned char *pixel = &image[0] + iy*stride; + RGBAImage::BGRAFromRGBA(pixel, pixelsImage, width); + pixelsImage += RGBAImage::bytesPerPixel * width; }
cairo_surface_t *psurfImage = cairo_image_surface_create_for_data(&image[0], CAIRO_FORMAT_ARGB32, width, height, stride); cairo_set_source_surface(context, psurfImage, rc.left, rc.top); - cairo_rectangle(context, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top); + cairo_rectangle(context, rc.left, rc.top, rc.Width(), rc.Height()); cairo_fill(context);
cairo_surface_destroy(psurfImage); @@ -626,7 +616,7 @@ void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) { PLATFORM_ASSERT(context); cairo_set_source_surface(context, surfi.psurf, rc.left - from.x, rc.top - from.y); - cairo_rectangle(context, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top); + cairo_rectangle(context, rc.left, rc.top, rc.Width(), rc.Height()); cairo_fill(context); } } @@ -635,7 +625,7 @@ std::string UTF8FromLatin1(const char *s, int len) { std::string utfForm(len*2 + 1, '\0'); size_t lenU = 0; for (int i=0; i<len; i++) { - unsigned int uch = static_cast<unsigned char>(s[i]); + const unsigned char uch = static_cast<unsigned char>(s[i]); if (uch < 0x80) { utfForm[lenU++] = uch; } else { @@ -647,7 +637,9 @@ std::string UTF8FromLatin1(const char *s, int len) { return utfForm; }
-static std::string UTF8FromIconv(const Converter &conv, const char *s, int len) { +namespace { + +std::string UTF8FromIconv(const Converter &conv, const char *s, int len) { if (conv) { std::string utfForm(len*3+1, '\0'); char *pin = const_cast<char *>(s); @@ -667,9 +659,9 @@ static std::string UTF8FromIconv(const Converter &conv, const char *s, int len)
// Work out how many bytes are in a character by trying to convert using iconv, // returning the first length that succeeds. -static size_t MultiByteLenFromIconv(const Converter &conv, const char *s, size_t len) { +size_t MultiByteLenFromIconv(const Converter &conv, const char *s, size_t len) noexcept { for (size_t lenMB=1; (lenMB<4) && (lenMB <= len); lenMB++) { - char wcForm[2]; + char wcForm[2] {}; char *pin = const_cast<char *>(s); gsize inLeft = lenMB; char *pout = wcForm; @@ -682,7 +674,9 @@ static size_t MultiByteLenFromIconv(const Converter &conv, const char *s, size_t return 1; }
-void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, +} + +void SurfaceImpl::DrawTextBase(PRectangle rc, const Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) { PenColour(fore); if (context) { @@ -747,6 +741,12 @@ class ClusterIterator { iter = pango_layout_get_iter(layout); pango_layout_iter_get_cluster_extents(iter, nullptr, &pos); } + // Deleted so ClusterIterator objects can not be copied. + ClusterIterator(const ClusterIterator&) = delete; + ClusterIterator(ClusterIterator&&) = delete; + ClusterIterator&operator=(const ClusterIterator&) = delete; + ClusterIterator&operator=(ClusterIterator&&) = delete; + ~ClusterIterator() { pango_layout_iter_free(iter); } @@ -814,7 +814,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION positions[i++] = iti.position - (places - place) * iti.distance / places; positionsCalculated++; } - clusterStart += UTF8BytesOfLead[static_cast<unsigned char>(utfForm.c_str()[clusterStart])]; + clusterStart += UTF8BytesOfLead[static_cast<unsigned char>(utfForm[clusterStart])]; place++; } } @@ -877,7 +877,6 @@ XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) { if (PFont(font_)->pfd) { std::string utfForm; pango_layout_set_font_description(layout, PFont(font_)->pfd); - PangoRectangle pos; if (et == UTF8) { pango_layout_set_text(layout, s, len); } else { @@ -889,6 +888,7 @@ XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) { pango_layout_set_text(layout, utfForm.c_str(), utfForm.length()); } PangoLayoutLine *pangoLine = pango_layout_get_line_readonly(layout, 0); + PangoRectangle pos {}; pango_layout_line_get_extents(pangoLine, nullptr, &pos); return floatFromPangoUnits(pos.width); } @@ -907,7 +907,7 @@ XYPOSITION SurfaceImpl::Ascent(Font &font_) { if (PFont(font_)->pfd) { PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PFont(font_)->pfd, pango_context_get_language(pcontext)); - ascent = std::floor(floatFromPangoUnits( + ascent = Sci::round(floatFromPangoUnits( pango_font_metrics_get_ascent(metrics))); pango_font_metrics_unref(metrics); } @@ -923,7 +923,7 @@ XYPOSITION SurfaceImpl::Descent(Font &font_) { if (PFont(font_)->pfd) { PangoFontMetrics *metrics = pango_context_get_metrics(pcontext, PFont(font_)->pfd, pango_context_get_language(pcontext)); - const XYPOSITION descent = std::floor(floatFromPangoUnits( + const XYPOSITION descent = Sci::round(floatFromPangoUnits( pango_font_metrics_get_descent(metrics))); pango_font_metrics_unref(metrics); return descent; @@ -945,7 +945,7 @@ XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) {
void SurfaceImpl::SetClip(PRectangle rc) { PLATFORM_ASSERT(context); - cairo_rectangle(context, rc.left, rc.top, rc.right, rc.bottom); + cairo_rectangle(context, rc.left, rc.top, rc.Width(), rc.Height()); cairo_clip(context); }
@@ -1011,7 +1011,7 @@ void Window::SetPosition(PRectangle rc) {
namespace {
-GdkRectangle MonitorRectangleForWidget(GtkWidget *wid) { +GdkRectangle MonitorRectangleForWidget(GtkWidget *wid) noexcept { GdkWindow *wnd = WindowFromWidget(wid); GdkRectangle rcScreen = GdkRectangle(); #if GTK_CHECK_VERSION(3,22,0) @@ -1136,7 +1136,7 @@ PRectangle Window::GetMonitorRect(Point pt) {
gdk_window_get_origin(WindowFromWidget(PWidget(wid)), &x_offset, &y_offset);
- GdkRectangle rect; + GdkRectangle rect {};
#if GTK_CHECK_VERSION(3,22,0) GdkDisplay *pdisplay = gtk_widget_get_display(PWidget(wid)); @@ -1208,6 +1208,11 @@ class ListBoxX : public ListBox { #endif delegate(nullptr) { } + // Deleted so ListBoxX objects can not be copied. + ListBoxX(const ListBoxX&) = delete; + ListBoxX(ListBoxX&&) = delete; + ListBoxX&operator=(const ListBoxX&) = delete; + ListBoxX&operator=(ListBoxX&&) = delete; ~ListBoxX() override { if (pixhash) { g_hash_table_foreach((GHashTable *) pixhash, list_image_free, nullptr); @@ -1360,13 +1365,13 @@ static gboolean ButtonRelease(GtkWidget *, GdkEventButton *ev, gpointer p) { return FALSE; }
-/* Change the active color to the selected color so the listbox uses the color +/* Change the active colour to the selected colour so the listbox uses the colour scheme that it would use if it had the focus. */ static void StyleSet(GtkWidget *w, GtkStyle *, void *) {
g_return_if_fail(w != nullptr);
- /* Copy the selected color to active. Note that the modify calls will cause + /* Copy the selected colour to active. Note that the modify calls will cause recursive calls to this function after the value is updated and w->style to be set to a new object */
@@ -1675,7 +1680,7 @@ void ListBoxX::Append(char *s, int type) { list_image = static_cast<ListImage *>(g_hash_table_lookup((GHashTable *) pixhash, GINT_TO_POINTER(type))); } - GtkTreeIter iter; + GtkTreeIter iter {}; GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list))); gtk_list_store_append(GTK_LIST_STORE(store), &iter); @@ -1715,7 +1720,7 @@ int ListBoxX::Length() { }
void ListBoxX::Select(int n) { - GtkTreeIter iter; + GtkTreeIter iter {}; GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); @@ -1770,8 +1775,8 @@ void ListBoxX::Select(int n) {
int ListBoxX::GetSelection() { int index = -1; - GtkTreeIter iter; - GtkTreeModel *model; + GtkTreeIter iter {}; + GtkTreeModel *model {}; GtkTreeSelection *selection; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); if (gtk_tree_selection_get_selected(selection, &model, &iter)) { @@ -1786,13 +1791,13 @@ int ListBoxX::GetSelection() { }
int ListBoxX::Find(const char *prefix) { - GtkTreeIter iter; + GtkTreeIter iter {}; GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); bool valid = gtk_tree_model_get_iter_first(model, &iter) != FALSE; int i = 0; while (valid) { - gchar *s; + gchar *s = nullptr; gtk_tree_model_get(model, &iter, TEXT_COLUMN, &s, -1); if (s && (0 == strncmp(prefix, s, strlen(prefix)))) { g_free(s); @@ -1807,7 +1812,7 @@ int ListBoxX::Find(const char *prefix) {
void ListBoxX::GetValue(int n, char *value, int len) { char *text = nullptr; - GtkTreeIter iter; + GtkTreeIter iter {}; GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list)); const bool valid = gtk_tree_model_iter_nth_child(model, &iter, nullptr, n) != FALSE; if (valid) { @@ -1907,7 +1912,7 @@ void Menu::Destroy() { }
#if !GTK_CHECK_VERSION(3,22,0) -static void MenuPositionFunc(GtkMenu *, gint *x, gint *y, gboolean *, gpointer userData) { +static void MenuPositionFunc(GtkMenu *, gint *x, gint *y, gboolean *, gpointer userData) noexcept { sptr_t intFromPointer = GPOINTER_TO_INT(userData); *x = intFromPointer & 0xffff; *y = intFromPointer >> 16; @@ -1947,7 +1952,11 @@ class DynamicLibraryImpl : public DynamicLibrary { explicit DynamicLibraryImpl(const char *modulePath) noexcept { m = g_module_open(modulePath, G_MODULE_BIND_LAZY); } - + // Deleted so DynamicLibraryImpl objects can not be copied. + DynamicLibraryImpl(const DynamicLibraryImpl&) = delete; + DynamicLibraryImpl(DynamicLibraryImpl&&) = delete; + DynamicLibraryImpl&operator=(const DynamicLibraryImpl&) = delete; + DynamicLibraryImpl&operator=(DynamicLibraryImpl&&) = delete; ~DynamicLibraryImpl() override { if (m != nullptr) g_module_close(m);
Modified: scintilla/gtk/ScintillaGTK.cxx 185 lines changed, 99 insertions(+), 86 deletions(-) =================================================================== @@ -41,14 +41,8 @@ #include "ILexer.h" #include "Scintilla.h" #include "ScintillaWidget.h" -#ifdef SCI_LEXER -#include "SciLexer.h" -#endif #include "StringCopy.h" #include "CharacterCategory.h" -#ifdef SCI_LEXER -#include "LexerModule.h" -#endif #include "Position.h" #include "UniqueString.h" #include "SplitVector.h" @@ -77,10 +71,6 @@ #include "AutoComplete.h" #include "ScintillaBase.h"
-#ifdef SCI_LEXER -#include "ExternalLexer.h" -#endif - #include "ScintillaGTK.h" #include "scintilla-marshal.h" #include "ScintillaGTKAccessible.h" @@ -90,10 +80,10 @@ #define IS_WIDGET_REALIZED(w) (gtk_widget_get_realized(GTK_WIDGET(w))) #define IS_WIDGET_MAPPED(w) (gtk_widget_get_mapped(GTK_WIDGET(w)))
-#define SC_INDICATOR_INPUT INDIC_IME -#define SC_INDICATOR_TARGET INDIC_IME+1 -#define SC_INDICATOR_CONVERTED INDIC_IME+2 -#define SC_INDICATOR_UNKNOWN INDIC_IME_MAX +#define SC_INDICATOR_INPUT INDICATOR_IME +#define SC_INDICATOR_TARGET INDICATOR_IME+1 +#define SC_INDICATOR_CONVERTED INDICATOR_IME+2 +#define SC_INDICATOR_UNKNOWN INDICATOR_IME_MAX
static GdkWindow *WindowFromWidget(GtkWidget *w) noexcept { return gtk_widget_get_window(w); @@ -132,6 +122,7 @@ enum { };
GdkAtom ScintillaGTK::atomUTF8 = nullptr; +GdkAtom ScintillaGTK::atomUTF8Mime = nullptr; GdkAtom ScintillaGTK::atomString = nullptr; GdkAtom ScintillaGTK::atomUriList = nullptr; GdkAtom ScintillaGTK::atomDROPFILES_DND = nullptr; @@ -140,22 +131,22 @@ static const GtkTargetEntry clipboardCopyTargets[] = { { (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING }, { (gchar *) "STRING", 0, TARGET_STRING }, }; -static const gint nClipboardCopyTargets = ELEMENTS(clipboardCopyTargets); +static constexpr gint nClipboardCopyTargets = ELEMENTS(clipboardCopyTargets);
static const GtkTargetEntry clipboardPasteTargets[] = { { (gchar *) "text/uri-list", 0, TARGET_URI }, { (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING }, { (gchar *) "STRING", 0, TARGET_STRING }, }; -static const gint nClipboardPasteTargets = ELEMENTS(clipboardPasteTargets); +static constexpr gint nClipboardPasteTargets = ELEMENTS(clipboardPasteTargets);
static const GdkDragAction actionCopyOrMove = static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE);
static GtkWidget *PWidget(const Window &w) noexcept { return static_cast<GtkWidget *>(w.GetID()); }
-ScintillaGTK *ScintillaGTK::FromWidget(GtkWidget *widget) { +ScintillaGTK *ScintillaGTK::FromWidget(GtkWidget *widget) noexcept { ScintillaObject *scio = SCINTILLA(widget); return static_cast<ScintillaGTK *>(scio->pscin); } @@ -169,8 +160,10 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : lastKey(0), rectangularSelectionModifier(SCMOD_CTRL), parentClass(nullptr), atomSought(nullptr), + preeditInitialized(false), im_context(nullptr), - lastNonCommonScript(PANGO_SCRIPT_INVALID_CODE), + lastNonCommonScript(G_UNICODE_SCRIPT_INVALID_CODE), + lastWheelMouseTime(0), lastWheelMouseDirection(0), wheelMouseIntensity(0), smoothScrollY(0), @@ -200,8 +193,6 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : #else linesPerScroll = 4; #endif - lastWheelMouseTime.tv_sec = 0; - lastWheelMouseTime.tv_usec = 0;
Init(); } @@ -218,7 +209,7 @@ ScintillaGTK::~ScintillaGTK() { wPreedit.Destroy(); }
-static void UnRefCursor(GdkCursor *cursor) { +static void UnRefCursor(GdkCursor *cursor) noexcept { #if GTK_CHECK_VERSION(3,0,0) g_object_unref(cursor); #else @@ -269,6 +260,8 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { gdk_window_show(widget->window); UnRefCursor(cursor); #endif + + preeditInitialized = false; gtk_widget_realize(PWidget(wPreedit)); gtk_widget_realize(PWidget(wPreeditDraw));
@@ -278,6 +271,7 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { g_signal_connect(G_OBJECT(im_context), "preedit_changed", G_CALLBACK(PreeditChanged), this); gtk_im_context_set_client_window(im_context, WindowFromWidget(widget)); + GtkWidget *widtxt = PWidget(wText); // // No code inside the G_OBJECT macro g_signal_connect_after(G_OBJECT(widtxt), "style_set", G_CALLBACK(ScintillaGTK::StyleSetText), nullptr); @@ -343,7 +337,7 @@ void ScintillaGTK::UnRealize(GtkWidget *widget) { sciThis->UnRealizeThis(widget); }
-static void MapWidget(GtkWidget *widget) { +static void MapWidget(GtkWidget *widget) noexcept { if (widget && gtk_widget_get_visible(GTK_WIDGET(widget)) && !IS_WIDGET_MAPPED(widget)) { @@ -424,14 +418,19 @@ class PreEditString { gboolean validUTF8; glong uniStrLen; gunichar *uniStr; - PangoScript pscript; + GUnicodeScript pscript;
- explicit PreEditString(GtkIMContext *im_context) { + explicit PreEditString(GtkIMContext *im_context) noexcept { gtk_im_context_get_preedit_string(im_context, &str, &attrs, &cursor_pos); validUTF8 = g_utf8_validate(str, strlen(str), nullptr); uniStr = g_utf8_to_ucs4_fast(str, strlen(str), &uniStrLen); - pscript = pango_script_for_unichar(uniStr[0]); + pscript = g_unichar_get_script(uniStr[0]); } + // Deleted so PreEditString objects can not be copied. + PreEditString(const PreEditString&) = delete; + PreEditString(PreEditString&&) = delete; + PreEditString&operator=(const PreEditString&) = delete; + PreEditString&operator=(PreEditString&&) = delete; ~PreEditString() { g_free(str); g_free(uniStr); @@ -444,18 +443,24 @@ class PreEditString { gint ScintillaGTK::FocusInThis(GtkWidget *) { try { SetFocusState(true); + if (im_context) { + gtk_im_context_focus_in(im_context); PreEditString pes(im_context); if (PWidget(wPreedit)) { + if (!preeditInitialized) { + GtkWidget *top = gtk_widget_get_toplevel(PWidget(wMain)); + gtk_window_set_transient_for(GTK_WINDOW(PWidget(wPreedit)), GTK_WINDOW(top)); + preeditInitialized = true; + } + if (strlen(pes.str) > 0) { gtk_widget_show(PWidget(wPreedit)); } else { gtk_widget_hide(PWidget(wPreedit)); } } - gtk_im_context_focus_in(im_context); } - } catch (...) { errorStatus = SC_STATUS_FAILURE; } @@ -536,7 +541,7 @@ void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { }
void ScintillaGTK::Init() { - parentClass = reinterpret_cast<GtkWidgetClass *>( + parentClass = static_cast<GtkWidgetClass *>( g_type_class_ref(gtk_container_get_type()));
gint maskSmooth = 0; @@ -751,24 +756,24 @@ std::string ConvertText(const char *s, size_t len, const char *charSetDest, // Returns the target converted to UTF8. // Return the length in bytes. Sci::Position ScintillaGTK::TargetAsUTF8(char *text) const { - const Sci::Position targetLength = targetEnd - targetStart; + const Sci::Position targetLength = targetRange.Length(); if (IsUnicodeMode()) { if (text) { - pdoc->GetCharRange(text, targetStart, targetLength); + pdoc->GetCharRange(text, targetRange.start.Position(), targetLength); } } else { // Need to convert const char *charSetBuffer = CharacterSetID(); if (*charSetBuffer) { - std::string s = RangeText(targetStart, targetEnd); + std::string s = RangeText(targetRange.start.Position(), targetRange.end.Position()); std::string tmputf = ConvertText(&s[0], targetLength, "UTF-8", charSetBuffer, false); if (text) { memcpy(text, tmputf.c_str(), tmputf.length()); } return tmputf.length(); } else { if (text) { - pdoc->GetCharRange(text, targetStart, targetLength); + pdoc->GetCharRange(text, targetRange.start.Position(), targetLength); } } } @@ -828,11 +833,6 @@ sptr_t ScintillaGTK::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case SCI_GETDIRECTPOINTER: return reinterpret_cast<sptr_t>(this);
-#ifdef SCI_LEXER - case SCI_LOADLEXERLIBRARY: - LexerManager::GetInstance()->Load(ConstCharPtrFromSPtr(lParam)); - break; -#endif case SCI_TARGETASUTF8: return TargetAsUTF8(CharPtrFromSPtr(lParam));
@@ -1201,6 +1201,11 @@ struct CaseMapper { mapped = g_utf8_strdown(sUTF8.c_str(), sUTF8.length()); } } + // Deleted so CaseMapper objects can not be copied. + CaseMapper(const CaseMapper&) = delete; + CaseMapper(CaseMapper&&) = delete; + CaseMapper&operator=(const CaseMapper&) = delete; + CaseMapper&operator=(CaseMapper&&) = delete; ~CaseMapper() { g_free(mapped); } @@ -1268,7 +1273,7 @@ namespace { class SelectionReceiver : GObjectWatcher { ScintillaGTK *sci;
- void Destroyed() override { + void Destroyed() noexcept override { sci = nullptr; }
@@ -1278,10 +1283,10 @@ class SelectionReceiver : GObjectWatcher { sci(sci_) { }
- static void ClipboardReceived(GtkClipboard *, GtkSelectionData *selection_data, gpointer data) { + static void ClipboardReceived(GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer data) { SelectionReceiver *self = static_cast<SelectionReceiver *>(data); if (self->sci) { - self->sci->ReceivedClipboard(selection_data); + self->sci->ReceivedClipboard(clipboard, selection_data); } delete self; } @@ -1321,9 +1326,8 @@ void ScintillaGTK::CreateCallTipWindow(PRectangle rc) { G_CALLBACK(ScintillaGTK::PressCT), 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)); + GtkWidget *top = gtk_widget_get_toplevel(PWidget(wMain)); + gtk_window_set_transient_for(GTK_WINDOW(PWidget(ct.wCallTip)), GTK_WINDOW(top)); } const int width = static_cast<int>(rc.Width()); const int height = static_cast<int>(rc.Height()); @@ -1374,10 +1378,14 @@ void ScintillaGTK::ClaimSelection() { } }
-static const guchar *DataOfGSD(GtkSelectionData *sd) { return gtk_selection_data_get_data(sd); } -static gint LengthOfGSD(GtkSelectionData *sd) { return gtk_selection_data_get_length(sd); } -static GdkAtom TypeOfGSD(GtkSelectionData *sd) { return gtk_selection_data_get_data_type(sd); } -static GdkAtom SelectionOfGSD(GtkSelectionData *sd) { return gtk_selection_data_get_selection(sd); } +bool ScintillaGTK::IsStringAtom(GdkAtom type) { + return (type == GDK_TARGET_STRING) || (type == atomUTF8) || (type == atomUTF8Mime); +} + +static const guchar *DataOfGSD(GtkSelectionData *sd) noexcept { return gtk_selection_data_get_data(sd); } +static gint LengthOfGSD(GtkSelectionData *sd) noexcept { return gtk_selection_data_get_length(sd); } +static GdkAtom TypeOfGSD(GtkSelectionData *sd) noexcept { return gtk_selection_data_get_data_type(sd); } +static GdkAtom SelectionOfGSD(GtkSelectionData *sd) noexcept { return gtk_selection_data_get_selection(sd); }
// Detect rectangular text, convert line ends to current mode, convert from or to UTF-8 void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText) { @@ -1386,7 +1394,7 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio GdkAtom selectionTypeData = TypeOfGSD(selectionData);
// Return empty string if selection is not a string - if ((selectionTypeData != GDK_TARGET_STRING) && (selectionTypeData != atomUTF8)) { + if (!IsStringAtom(selectionTypeData)) { selText.Clear(); return; } @@ -1432,7 +1440,7 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio } }
-void ScintillaGTK::InsertSelection(GtkSelectionData *selectionData) { +void ScintillaGTK::InsertSelection(GtkClipboard *clipBoard, GtkSelectionData *selectionData) { const gint length = gtk_selection_data_get_length(selectionData); if (length >= 0) { GdkAtom selection = gtk_selection_data_get_selection(selectionData); @@ -1447,6 +1455,15 @@ void ScintillaGTK::InsertSelection(GtkSelectionData *selectionData) { InsertPasteShape(selText.Data(), selText.Length(), selText.rectangular ? pasteRectangular : pasteStream); EnsureCaretVisible(); + } else { + GdkAtom target = gtk_selection_data_get_target(selectionData); + if (target == atomUTF8) { + // In case data is actually only stored as text/plain;charset=utf-8 not UTF8_STRING + gtk_clipboard_request_contents(clipBoard, atomUTF8Mime, + SelectionReceiver::ClipboardReceived, + new SelectionReceiver(this) + ); + } } Redraw(); } @@ -1455,9 +1472,9 @@ GObject *ScintillaGTK::MainObject() const noexcept { return G_OBJECT(PWidget(wMain)); }
-void ScintillaGTK::ReceivedClipboard(GtkSelectionData *selection_data) noexcept { +void ScintillaGTK::ReceivedClipboard(GtkClipboard *clipBoard, GtkSelectionData *selection_data) noexcept { try { - InsertSelection(selection_data); + InsertSelection(clipBoard, selection_data); } catch (...) { errorStatus = SC_STATUS_FAILURE; } @@ -1471,9 +1488,9 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) { atomSought = atomString; gtk_selection_convert(GTK_WIDGET(PWidget(wMain)), SelectionOfGSD(selection_data), atomSought, GDK_CURRENT_TIME); - } else if ((LengthOfGSD(selection_data) > 0) && - ((TypeOfGSD(selection_data) == GDK_TARGET_STRING) || (TypeOfGSD(selection_data) == atomUTF8))) { - InsertSelection(selection_data); + } else if ((LengthOfGSD(selection_data) > 0) && IsStringAtom(TypeOfGSD(selection_data))) { + GtkClipboard *clipBoard = gtk_widget_get_clipboard(GTK_WIDGET(PWidget(wMain)), SelectionOfGSD(selection_data)); + InsertSelection(clipBoard, selection_data); } } // else fprintf(stderr, "Target non string %d %d\n", (int)(selection_data->type), @@ -1490,7 +1507,7 @@ void ScintillaGTK::ReceivedDrop(GtkSelectionData *selection_data) { std::vector<char> drop(data, data + LengthOfGSD(selection_data)); drop.push_back('\0'); NotifyURIDropped(&drop[0]); - } else if ((TypeOfGSD(selection_data) == GDK_TARGET_STRING) || (TypeOfGSD(selection_data) == atomUTF8)) { + } else if (IsStringAtom(TypeOfGSD(selection_data))) { if (LengthOfGSD(selection_data) > 0) { SelectionText selText; GetGtkSelectionText(selection_data, selText); @@ -1524,7 +1541,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se const char *charSet = ::CharacterSetID(text->characterSet); if (*charSet) { std::string tmputf = ConvertText(text->Data(), text->Length(), "UTF-8", charSet, false); - converted.reset(new SelectionText()); + converted = Sci::make_unique<SelectionText>(); converted->Copy(tmputf, SC_CP_UTF8, 0, text->rectangular, false); text = converted.get(); } @@ -1534,7 +1551,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se // As I can not work out how to store data on the clipboard in multiple formats // and need some way to mark the clipping as being stream or rectangular, // the terminating \0 is included in the length for rectangular clippings. - // All other tested aplications behave benignly by ignoring the \0. + // All other tested applications behave benignly by ignoring the \0. // The #if is here because on Windows cfColumnSelect clip entry is used // instead as standard indicator of rectangularness (so no need to kludge) const char *textData = text->Data(); @@ -1684,7 +1701,7 @@ void ScintillaGTK::Resize(int width, int height) {
namespace {
-void SetAdjustmentValue(GtkAdjustment *object, int value) { +void SetAdjustmentValue(GtkAdjustment *object, int value) noexcept { GtkAdjustment *adjustment = GTK_ADJUSTMENT(object); const int maxValue = static_cast<int>( gtk_adjustment_get_upper(adjustment) - gtk_adjustment_get_page_size(adjustment)); @@ -1751,7 +1768,7 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) { if (event->button == 1) { #if PLAT_GTK_MACOSX const bool meta = ctrl; - // GDK reports the Command modifer key as GDK_MOD2_MASK for button events, + // GDK reports the Command modifier key as GDK_MOD2_MASK for button events, // not GDK_META_MASK like in key events. ctrl = (event->state & GDK_MOD2_MASK) != 0; #else @@ -1780,7 +1797,7 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) { } else { #if PLAT_GTK_MACOSX const bool meta = ctrl; - // GDK reports the Command modifer key as GDK_MOD2_MASK for button events, + // GDK reports the Command modifier key as GDK_MOD2_MASK for button events, // not GDK_META_MASK like in key events. ctrl = (event->state & GDK_MOD2_MASK) != 0; #else @@ -1882,13 +1899,8 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget, GdkEventScroll *event) { cLineScroll = 4; sciThis->wheelMouseIntensity = cLineScroll; #else - int timeDelta = 1000000; - GTimeVal curTime; - g_get_current_time(&curTime); - if (curTime.tv_sec == sciThis->lastWheelMouseTime.tv_sec) - timeDelta = curTime.tv_usec - sciThis->lastWheelMouseTime.tv_usec; - else if (curTime.tv_sec == sciThis->lastWheelMouseTime.tv_sec + 1) - timeDelta = 1000000 + (curTime.tv_usec - sciThis->lastWheelMouseTime.tv_usec); + const gint64 curTime = g_get_monotonic_time(); + const gint64 timeDelta = curTime - sciThis->lastWheelMouseTime; if ((event->direction == sciThis->lastWheelMouseDirection) && (timeDelta < 250000)) { if (sciThis->wheelMouseIntensity < 12) sciThis->wheelMouseIntensity++; @@ -1899,11 +1911,11 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget, GdkEventScroll *event) { cLineScroll = 4; sciThis->wheelMouseIntensity = cLineScroll; } + sciThis->lastWheelMouseTime = curTime; #endif if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_LEFT) { cLineScroll *= -1; } - g_get_current_time(&sciThis->lastWheelMouseTime); sciThis->lastWheelMouseDirection = event->direction;
// Note: Unpatched versions of win32gtk don't set the 'state' value so @@ -1954,7 +1966,7 @@ gint ScintillaGTK::Motion(GtkWidget *widget, GdkEventMotion *event) { return FALSE; int x = 0; int y = 0; - GdkModifierType state; + GdkModifierType state {}; if (event->is_hint) { #if GTK_CHECK_VERSION(3,0,0) gdk_window_get_device_position(event->window, @@ -1982,7 +1994,7 @@ gint ScintillaGTK::Motion(GtkWidget *widget, GdkEventMotion *event) { }
// Map the keypad keys to their equivalent functions -static int KeyTranslate(int keyIn) { +static int KeyTranslate(int keyIn) noexcept { switch (keyIn) { #if GTK_CHECK_VERSION(3,0,0) case GDK_KEY_ISO_Left_Tab: @@ -2241,9 +2253,9 @@ gboolean ScintillaGTK::ExposePreedit(GtkWidget *widget, GdkEventExpose *ose, Sci
bool ScintillaGTK::KoreanIME() { PreEditString pes(im_context); - if (pes.pscript != PANGO_SCRIPT_COMMON) + if (pes.pscript != G_UNICODE_SCRIPT_COMMON) lastNonCommonScript = pes.pscript; - return lastNonCommonScript == PANGO_SCRIPT_HANGUL; + return lastNonCommonScript == G_UNICODE_SCRIPT_HANGUL; }
void ScintillaGTK::MoveImeCarets(int pos) { @@ -2258,9 +2270,9 @@ void ScintillaGTK::MoveImeCarets(int pos) { void ScintillaGTK::DrawImeIndicator(int indicator, int len) { // Emulate the visual style of IME characters with indicators. // Draw an indicator on the character before caret by the character bytes of len - // so it should be called after addCharUTF(). + // so it should be called after InsertCharacter(). // It does not affect caret positions. - if (indicator < 8 || indicator > INDIC_MAX) { + if (indicator < 8 || indicator > INDICATOR_MAX) { return; } pdoc->DecorationSetCurrentIndicator(indicator); @@ -2325,8 +2337,10 @@ void ScintillaGTK::SetCandidateWindowPos() { // Composition box accompanies candidate box. const Point pt = PointMainCaret(); GdkRectangle imeBox = {0}; // No need to set width - imeBox.x = static_cast<gint>(pt.x); // Only need positiion - imeBox.y = static_cast<gint>(pt.y) + vs.lineHeight; // underneath the first charater + imeBox.x = static_cast<gint>(pt.x); + imeBox.y = static_cast<gint>(pt.y + std::max(4, vs.lineHeight/4)); + // prevent overlapping with current line + imeBox.height = vs.lineHeight; gtk_im_context_set_cursor_location(im_context, &imeBox); }
@@ -2350,7 +2364,7 @@ void ScintillaGTK::CommitThis(char *commitStr) { if (!IsUnicodeMode()) docChar = ConvertText(u8Char, u8CharLen, charSetSource, "UTF-8", true);
- AddCharUTF(docChar.c_str(), docChar.size()); + InsertCharacter(docChar.c_str(), docChar.size(), CharacterSource::directInput); } g_free(uniStr); ShowCaretAtCurrentPosition(); @@ -2397,26 +2411,26 @@ void ScintillaGTK::PreeditChangedInlineThis() { return; }
- if (initialCompose) + if (initialCompose) { ClearBeforeTentativeStart(); + } + + SetCandidateWindowPos(); pdoc->TentativeStart(); // TentativeActive() from now on
std::vector<int> indicator = MapImeIndicators(preeditStr.attrs, preeditStr.str);
- const bool tmpRecordingMacro = recordingMacro; - recordingMacro = false; for (glong i = 0; i < preeditStr.uniStrLen; i++) { gchar u8Char[UTF8MaxBytes+2] = {0}; const gint u8CharLen = g_unichar_to_utf8(preeditStr.uniStr[i], u8Char); std::string docChar = u8Char; if (!IsUnicodeMode()) docChar = ConvertText(u8Char, u8CharLen, charSetSource, "UTF-8", true);
- AddCharUTF(docChar.c_str(), docChar.size()); + InsertCharacter(docChar.c_str(), docChar.size(), CharacterSource::tentativeInput);
DrawImeIndicator(indicator[i], docChar.size()); } - recordingMacro = tmpRecordingMacro;
// Move caret to ime cursor position. const int imeEndToImeCaretU32 = preeditStr.cursor_pos - preeditStr.uniStrLen; @@ -2435,7 +2449,6 @@ void ScintillaGTK::PreeditChangedInlineThis() { }
EnsureCaretVisible(); - SetCandidateWindowPos(); ShowCaretAtCurrentPosition(); } catch (...) { errorStatus = SC_STATUS_FAILURE; @@ -2446,6 +2459,8 @@ void ScintillaGTK::PreeditChangedWindowedThis() { try { PreEditString pes(im_context); if (strlen(pes.str) > 0) { + SetCandidateWindowPos(); + PangoLayout *layout = gtk_widget_create_pango_layout(PWidget(wText), pes.str); pango_layout_set_attributes(layout, pes.attrs);
@@ -3048,10 +3063,8 @@ GType scintilla_object_get_type() {
void ScintillaGTK::ClassInit(OBJECT_CLASS *object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class) { Platform_Initialise(); -#ifdef SCI_LEXER - Scintilla_LinkLexers(); -#endif atomUTF8 = gdk_atom_intern("UTF8_STRING", FALSE); + atomUTF8Mime = gdk_atom_intern("text/plain;charset=utf-8", FALSE); atomString = GDK_SELECTION_TYPE_STRING; atomUriList = gdk_atom_intern("text/uri-list", FALSE); atomDROPFILES_DND = gdk_atom_intern("DROPFILES_DND", FALSE);
Modified: scintilla/gtk/ScintillaGTK.h 19 lines changed, 14 insertions(+), 5 deletions(-) =================================================================== @@ -37,6 +37,7 @@ class ScintillaGTK : public ScintillaBase { GtkWidgetClass *parentClass;
static GdkAtom atomUTF8; + static GdkAtom atomUTF8Mime; static GdkAtom atomString; static GdkAtom atomUriList; static GdkAtom atomDROPFILES_DND; @@ -46,14 +47,15 @@ class ScintillaGTK : public ScintillaBase { CLIPFORMAT cfColumnSelect; #endif
+ bool preeditInitialized; Window wPreedit; Window wPreeditDraw; GtkIMContext *im_context; - PangoScript lastNonCommonScript; + GUnicodeScript lastNonCommonScript;
// Wheel mouse support unsigned int linesPerScroll; - GTimeVal lastWheelMouseTime; + gint64 lastWheelMouseTime; gint lastWheelMouseDirection; gint wheelMouseIntensity; gdouble smoothScrollY; @@ -78,7 +80,7 @@ class ScintillaGTK : public ScintillaBase { ScintillaGTK &operator=(const ScintillaGTK &) = delete; ScintillaGTK &operator=(ScintillaGTK &&) = delete; virtual ~ScintillaGTK(); - static ScintillaGTK *FromWidget(GtkWidget *widget); + static ScintillaGTK *FromWidget(GtkWidget *widget) noexcept; static void ClassInit(OBJECT_CLASS *object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class); private: void Init(); @@ -132,11 +134,12 @@ class ScintillaGTK : public ScintillaBase { void AddToPopUp(const char *label, int cmd = 0, bool enabled = true) override; bool OwnPrimarySelection(); void ClaimSelection() override; + static bool IsStringAtom(GdkAtom type); void GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText); - void InsertSelection(GtkSelectionData *selectionData); + void InsertSelection(GtkClipboard *clipBoard, GtkSelectionData *selectionData); public: // Public for SelectionReceiver GObject *MainObject() const noexcept; - void ReceivedClipboard(GtkSelectionData *selection_data) noexcept; + void ReceivedClipboard(GtkClipboard *clipBoard, GtkSelectionData *selection_data) noexcept; private: void ReceivedSelection(GtkSelectionData *selection_data); void ReceivedDrop(GtkSelectionData *selection_data); @@ -274,6 +277,12 @@ class GObjectWatcher { g_object_weak_ref(weakRef, WeakNotify, this); }
+ // Deleted so GObjectWatcher objects can not be copied. + GObjectWatcher(const GObjectWatcher&) = delete; + GObjectWatcher(GObjectWatcher&&) = delete; + GObjectWatcher&operator=(const GObjectWatcher&) = delete; + GObjectWatcher&operator=(GObjectWatcher&&) = delete; + virtual ~GObjectWatcher() { if (weakRef) { g_object_weak_unref(weakRef, WeakNotify, this);
Modified: scintilla/gtk/ScintillaGTKAccessible.cxx 9 lines changed, 2 insertions(+), 7 deletions(-) =================================================================== @@ -1,5 +1,5 @@ /* Scintilla source code edit control */ -/* ScintillaGTKAccessible.c - GTK+ accessibility for ScintillaGTK */ +/* ScintillaGTKAccessible.cxx - GTK+ accessibility for ScintillaGTK */ /* Copyright 2016 by Colomban Wendling colomban@geany.org * The License.txt file describes the conditions under which this software may be distributed. */
@@ -53,6 +53,7 @@
#include <cstddef> #include <cstdlib> +#include <cassert> #include <cstring>
#include <stdexcept> @@ -91,14 +92,8 @@ #include "ILexer.h" #include "Scintilla.h" #include "ScintillaWidget.h" -#ifdef SCI_LEXER -#include "SciLexer.h" -#endif #include "StringCopy.h" #include "CharacterCategory.h" -#ifdef SCI_LEXER -#include "LexerModule.h" -#endif #include "Position.h" #include "UniqueString.h" #include "SplitVector.h"
Modified: scintilla/gtk/ScintillaGTKAccessible.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -191,4 +191,4 @@ class ScintillaGTKAccessible { }
-#endif /* SCINTILLAGTKACCESSIBLE_H */ +#endif
Modified: scintilla/include/Compat.h 70 lines changed, 70 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,70 @@ +// c++11 compatibility with some c++14 features and higher. +// This helps minimize changes from the default branch. + +#ifndef COMPAT_H +#define COMPAT_H + +#ifdef __cplusplus + +#include <cmath> +#include <cstddef> +#include <memory> +#include <type_traits> +#include <utility> + +namespace Sci { + +// std::clamp +template <typename T> +inline constexpr T clamp(T val, T minVal, T maxVal) { + return (val > maxVal) ? maxVal : ((val < minVal) ? minVal : val); +} + +// std::round (not present on older MacOSX SDKs) +template<class T> +T round(T arg) { + return ::round(arg); +} + +// std::lround (not present on older MacOSX SDKs) +template<class T> +long lround(T arg) { + return ::lround(arg); +} + +// std::make_unique +template<class T> struct _Unique_if { + typedef std::unique_ptr<T> _Single_object; +}; +template<class T> struct _Unique_if<T[]> { + typedef std::unique_ptr<T[]> _Unknown_bound; +}; +template<class T, size_t N> struct _Unique_if<T[N]> { + typedef void _Known_bound; +}; +template<class T, class... Args> + typename _Unique_if<T>::_Single_object + make_unique(Args&&... args) { + return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); + } +template<class T> + typename _Unique_if<T>::_Unknown_bound + make_unique(size_t n) { + typedef typename std::remove_extent<T>::type U; + return std::unique_ptr<T>(new U[n]()); + } +template<class T, class... Args> + typename _Unique_if<T>::_Known_bound + make_unique(Args&&...) = delete; + +// std::size +template <typename T, size_t N> +constexpr size_t size(const T (&)[N]) noexcept { + return N; +} + +} + +#endif + +#endif
Modified: scintilla/include/ILexer.h 9 lines changed, 8 insertions(+), 1 deletions(-) =================================================================== @@ -46,7 +46,7 @@ class IDocumentWithLineEnd : public IDocument { virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0; };
-enum { lvOriginal=0, lvSubStyles=1, lvMetaData=2 }; +enum { lvOriginal=0, lvSubStyles=1, lvMetaData=2, lvIdentity=3 };
class ILexer { public: @@ -85,6 +85,13 @@ class ILexerWithMetaData : public ILexerWithSubStyles { virtual const char * SCI_METHOD DescriptionOfStyle(int style) = 0; };
+class ILexerWithIdentity : public ILexerWithMetaData { +public: + virtual const char * SCI_METHOD GetName() = 0; + virtual int SCI_METHOD GetIdentifier() = 0; + virtual const char * SCI_METHOD PropertyGet(const char *key) = 0; +}; + }
#endif
Modified: scintilla/include/Makefile.am 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -7,6 +7,7 @@ noinst_HEADERS = \
scintilla_includedir = $(includedir)/geany/scintilla/ scintilla_include_HEADERS = \ + Compat.h \ SciLexer.h \ Scintilla.h \ Scintilla.iface \
Modified: scintilla/include/Platform.h 70 lines changed, 35 insertions(+), 35 deletions(-) =================================================================== @@ -104,19 +104,19 @@ class Point { constexpr explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) noexcept : x(x_), y(y_) { }
- static Point FromInts(int x_, int y_) noexcept { + static constexpr Point FromInts(int x_, int y_) noexcept { return Point(static_cast<XYPOSITION>(x_), static_cast<XYPOSITION>(y_)); }
- bool operator!=(Point other) const noexcept { + constexpr bool operator!=(Point other) const noexcept { return (x != other.x) || (y != other.y); }
- Point operator+(Point other) const noexcept { + constexpr Point operator+(Point other) const noexcept { return Point(x + other.x, y + other.y); }
- Point operator-(Point other) const noexcept { + constexpr Point operator-(Point other) const noexcept { return Point(x - other.x, y - other.y); }
@@ -139,31 +139,31 @@ class PRectangle { left(left_), top(top_), right(right_), bottom(bottom_) { }
- static PRectangle FromInts(int left_, int top_, int right_, int bottom_) noexcept { + static constexpr PRectangle FromInts(int left_, int top_, int right_, int bottom_) noexcept { return PRectangle(static_cast<XYPOSITION>(left_), static_cast<XYPOSITION>(top_), static_cast<XYPOSITION>(right_), static_cast<XYPOSITION>(bottom_)); }
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
- bool operator==(const PRectangle &rc) const noexcept { + constexpr bool operator==(const PRectangle &rc) const noexcept { return (rc.left == left) && (rc.right == right) && (rc.top == top) && (rc.bottom == bottom); } - bool Contains(Point pt) const noexcept { + constexpr bool Contains(Point pt) const noexcept { return (pt.x >= left) && (pt.x <= right) && (pt.y >= top) && (pt.y <= bottom); } - bool ContainsWholePixel(Point pt) const noexcept { + constexpr bool ContainsWholePixel(Point pt) const noexcept { // Does the rectangle contain all of the pixel to left/below the point return (pt.x >= left) && ((pt.x+1) <= right) && (pt.y >= top) && ((pt.y+1) <= bottom); } - bool Contains(PRectangle rc) const noexcept { + constexpr bool Contains(PRectangle rc) const noexcept { return (rc.left >= left) && (rc.right <= right) && (rc.top >= top) && (rc.bottom <= bottom); } - bool Intersects(PRectangle other) const noexcept { + constexpr bool Intersects(PRectangle other) const noexcept { return (right > other.left) && (left < other.right) && (bottom > other.top) && (top < other.bottom); } @@ -173,9 +173,9 @@ class PRectangle { right += xDelta; bottom += yDelta; } - XYPOSITION Width() const noexcept { return right - left; } - XYPOSITION Height() const noexcept { return bottom - top; } - bool Empty() const noexcept { + constexpr XYPOSITION Width() const noexcept { return right - left; } + constexpr XYPOSITION Height() const noexcept { return bottom - top; } + constexpr bool Empty() const noexcept { return (Height() <= 0) || (Width() <= 0); } }; @@ -187,40 +187,40 @@ constexpr const float componentMaximum = 255.0f; class ColourDesired { int co; public: - explicit ColourDesired(int co_=0) noexcept : co(co_) { + constexpr explicit ColourDesired(int co_=0) noexcept : co(co_) { }
- ColourDesired(unsigned int red, unsigned int green, unsigned int blue) noexcept : + constexpr ColourDesired(unsigned int red, unsigned int green, unsigned int blue) noexcept : co(red | (green << 8) | (blue << 16)) { }
- bool operator==(const ColourDesired &other) const noexcept { + constexpr bool operator==(const ColourDesired &other) const noexcept { return co == other.co; }
- int AsInteger() const noexcept { + constexpr int AsInteger() const noexcept { return co; }
// Red, green and blue values as bytes 0..255 - unsigned char GetRed() const noexcept { + constexpr unsigned char GetRed() const noexcept { return co & 0xff; } - unsigned char GetGreen() const noexcept { + constexpr unsigned char GetGreen() const noexcept { return (co >> 8) & 0xff; } - unsigned char GetBlue() const noexcept { + constexpr unsigned char GetBlue() const noexcept { return (co >> 16) & 0xff; }
// Red, green and blue values as float 0..1.0 - float GetRedComponent() const noexcept { + constexpr float GetRedComponent() const noexcept { return GetRed() / componentMaximum; } - float GetGreenComponent() const noexcept { + constexpr float GetGreenComponent() const noexcept { return GetGreen() / componentMaximum; } - float GetBlueComponent() const noexcept { + constexpr float GetBlueComponent() const noexcept { return GetBlue() / componentMaximum; } }; @@ -230,30 +230,30 @@ class ColourDesired { */ class ColourAlpha : public ColourDesired { public: - explicit ColourAlpha(int co_ = 0) noexcept : ColourDesired(co_) { + constexpr explicit ColourAlpha(int co_ = 0) noexcept : ColourDesired(co_) { }
- ColourAlpha(unsigned int red, unsigned int green, unsigned int blue) noexcept : + constexpr ColourAlpha(unsigned int red, unsigned int green, unsigned int blue) noexcept : ColourDesired(red | (green << 8) | (blue << 16)) { }
- ColourAlpha(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha) noexcept : + constexpr ColourAlpha(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha) noexcept : ColourDesired(red | (green << 8) | (blue << 16) | (alpha << 24)) { }
- ColourAlpha(ColourDesired cd, unsigned int alpha) noexcept : + constexpr ColourAlpha(ColourDesired cd, unsigned int alpha) noexcept : ColourDesired(cd.AsInteger() | (alpha << 24)) { }
- ColourDesired GetColour() const noexcept { + constexpr ColourDesired GetColour() const noexcept { return ColourDesired(AsInteger() & 0xffffff); }
- unsigned char GetAlpha() const noexcept { + constexpr unsigned char GetAlpha() const noexcept { return (AsInteger() >> 24) & 0xff; }
- float GetAlphaComponent() const noexcept { + constexpr float GetAlphaComponent() const noexcept { return GetAlpha() / componentMaximum; }
@@ -371,11 +371,11 @@ class Surface { virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)=0; virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
- virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0; - virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0; - virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore)=0; - virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)=0; - virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0; + virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back) = 0; + virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back) = 0; + virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) = 0; + virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) = 0; + virtual XYPOSITION WidthText(Font &font_, const char *s, int len) = 0; virtual XYPOSITION Ascent(Font &font_)=0; virtual XYPOSITION Descent(Font &font_)=0; virtual XYPOSITION InternalLeading(Font &font_)=0;
Modified: scintilla/include/SciLexer.h 73 lines changed, 73 insertions(+), 0 deletions(-) =================================================================== @@ -140,6 +140,10 @@ #define SCLEX_SAS 125 #define SCLEX_NIM 126 #define SCLEX_CIL 127 +#define SCLEX_X12 128 +#define SCLEX_DATAFLEX 129 +#define SCLEX_HOLLYWOOD 130 +#define SCLEX_RAKU 131 #define SCLEX_LPEG 999 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 @@ -513,6 +517,7 @@ #define SCE_ERR_GCC_INCLUDED_FROM 22 #define SCE_ERR_ESCSEQ 23 #define SCE_ERR_ESCSEQ_UNKNOWN 24 +#define SCE_ERR_GCC_EXCERPT 25 #define SCE_ERR_ES_BLACK 40 #define SCE_ERR_ES_RED 41 #define SCE_ERR_ES_GREEN 42 @@ -1886,6 +1891,74 @@ #define SCE_CIL_OPERATOR 8 #define SCE_CIL_IDENTIFIER 9 #define SCE_CIL_STRINGEOL 10 +#define SCE_X12_DEFAULT 0 +#define SCE_X12_BAD 1 +#define SCE_X12_ENVELOPE 2 +#define SCE_X12_FUNCTIONGROUP 3 +#define SCE_X12_TRANSACTIONSET 4 +#define SCE_X12_SEGMENTHEADER 5 +#define SCE_X12_SEGMENTEND 6 +#define SCE_X12_SEP_ELEMENT 7 +#define SCE_X12_SEP_SUBELEMENT 8 +#define SCE_DF_DEFAULT 0 +#define SCE_DF_IDENTIFIER 1 +#define SCE_DF_METATAG 2 +#define SCE_DF_IMAGE 3 +#define SCE_DF_COMMENTLINE 4 +#define SCE_DF_PREPROCESSOR 5 +#define SCE_DF_PREPROCESSOR2 6 +#define SCE_DF_NUMBER 7 +#define SCE_DF_HEXNUMBER 8 +#define SCE_DF_WORD 9 +#define SCE_DF_STRING 10 +#define SCE_DF_STRINGEOL 11 +#define SCE_DF_SCOPEWORD 12 +#define SCE_DF_OPERATOR 13 +#define SCE_DF_ICODE 14 +#define SCE_HOLLYWOOD_DEFAULT 0 +#define SCE_HOLLYWOOD_COMMENT 1 +#define SCE_HOLLYWOOD_COMMENTBLOCK 2 +#define SCE_HOLLYWOOD_NUMBER 3 +#define SCE_HOLLYWOOD_KEYWORD 4 +#define SCE_HOLLYWOOD_STDAPI 5 +#define SCE_HOLLYWOOD_PLUGINAPI 6 +#define SCE_HOLLYWOOD_PLUGINMETHOD 7 +#define SCE_HOLLYWOOD_STRING 8 +#define SCE_HOLLYWOOD_STRINGBLOCK 9 +#define SCE_HOLLYWOOD_PREPROCESSOR 10 +#define SCE_HOLLYWOOD_OPERATOR 11 +#define SCE_HOLLYWOOD_IDENTIFIER 12 +#define SCE_HOLLYWOOD_CONSTANT 13 +#define SCE_HOLLYWOOD_HEXNUMBER 14 +#define SCE_RAKU_DEFAULT 0 +#define SCE_RAKU_ERROR 1 +#define SCE_RAKU_COMMENTLINE 2 +#define SCE_RAKU_COMMENTEMBED 3 +#define SCE_RAKU_POD 4 +#define SCE_RAKU_CHARACTER 5 +#define SCE_RAKU_HEREDOC_Q 6 +#define SCE_RAKU_HEREDOC_QQ 7 +#define SCE_RAKU_STRING 8 +#define SCE_RAKU_STRING_Q 9 +#define SCE_RAKU_STRING_QQ 10 +#define SCE_RAKU_STRING_Q_LANG 11 +#define SCE_RAKU_STRING_VAR 12 +#define SCE_RAKU_REGEX 13 +#define SCE_RAKU_REGEX_VAR 14 +#define SCE_RAKU_ADVERB 15 +#define SCE_RAKU_NUMBER 16 +#define SCE_RAKU_PREPROCESSOR 17 +#define SCE_RAKU_OPERATOR 18 +#define SCE_RAKU_WORD 19 +#define SCE_RAKU_FUNCTION 20 +#define SCE_RAKU_IDENTIFIER 21 +#define SCE_RAKU_TYPEDEF 22 +#define SCE_RAKU_MU 23 +#define SCE_RAKU_POSITIONAL 24 +#define SCE_RAKU_ASSOCIATIVE 25 +#define SCE_RAKU_CALLABLE 26 +#define SCE_RAKU_GRAMMAR 27 +#define SCE_RAKU_CLASS 28 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif
Modified: scintilla/include/Scintilla.h 76 lines changed, 60 insertions(+), 16 deletions(-) =================================================================== @@ -38,6 +38,8 @@ typedef intptr_t sptr_t;
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+#ifndef SCI_DISABLE_AUTOGENERATED + /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ #define INVALID_POSITION -1 #define SCI_START 2000 @@ -63,6 +65,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_CANREDO 2016 #define SCI_MARKERLINEFROMHANDLE 2017 #define SCI_MARKERDELETEHANDLE 2018 +#define SCI_MARKERHANDLEFROMLINE 2732 +#define SCI_MARKERNUMBERFROMLINE 2733 #define SCI_GETUNDOCOLLECTION 2019 #define SCWS_INVISIBLE 0 #define SCWS_VISIBLEALWAYS 1 @@ -93,6 +97,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETBUFFEREDDRAW 2035 #define SCI_SETTABWIDTH 2036 #define SCI_GETTABWIDTH 2121 +#define SCI_SETTABMINIMUMWIDTH 2724 +#define SCI_GETTABMINIMUMWIDTH 2725 #define SCI_CLEARTABSTOPS 2675 #define SCI_ADDTABSTOP 2676 #define SCI_GETNEXTTABSTOP 2677 @@ -102,6 +108,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_IME_INLINE 1 #define SCI_GETIMEINTERACTION 2678 #define SCI_SETIMEINTERACTION 2679 +#define SC_ALPHA_TRANSPARENT 0 +#define SC_ALPHA_OPAQUE 255 +#define SC_ALPHA_NOALPHA 256 +#define SC_CURSORNORMAL -1 +#define SC_CURSORARROW 2 +#define SC_CURSORWAIT 4 +#define SC_CURSORREVERSEARROW 7 #define MARKER_MAX 31 #define SC_MARK_CIRCLE 0 #define SC_MARK_ROUNDRECT 1 @@ -293,14 +306,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define INDIC_POINTCHARACTER 19 #define INDIC_GRADIENT 20 #define INDIC_GRADIENTCENTRE 21 +#define INDIC_CONTAINER 8 #define INDIC_IME 32 #define INDIC_IME_MAX 35 #define INDIC_MAX 35 -#define INDIC_CONTAINER 8 -#define INDIC0_MASK 0x20 -#define INDIC1_MASK 0x40 -#define INDIC2_MASK 0x80 -#define INDICS_MASK 0xE0 +#define INDICATOR_CONTAINER 8 +#define INDICATOR_IME 32 +#define INDICATOR_IME_MAX 35 +#define INDICATOR_MAX 35 #define SCI_INDICSETSTYLE 2080 #define SCI_INDICGETSTYLE 2081 #define SCI_INDICSETFORE 2082 @@ -399,6 +412,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_PRINT_SCREENCOLOURS 5 #define SCI_SETPRINTCOLOURMODE 2148 #define SCI_GETPRINTCOLOURMODE 2149 +#define SCFIND_NONE 0x0 #define SCFIND_WHOLEWORD 0x2 #define SCFIND_MATCHCASE 0x4 #define SCFIND_WORDSTART 0x00100000 @@ -448,8 +462,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETCARETWIDTH 2189 #define SCI_SETTARGETSTART 2190 #define SCI_GETTARGETSTART 2191 +#define SCI_SETTARGETSTARTVIRTUALSPACE 2728 +#define SCI_GETTARGETSTARTVIRTUALSPACE 2729 #define SCI_SETTARGETEND 2192 #define SCI_GETTARGETEND 2193 +#define SCI_SETTARGETENDVIRTUALSPACE 2730 +#define SCI_GETTARGETENDVIRTUALSPACE 2731 #define SCI_SETTARGETRANGE 2686 #define SCI_GETTARGETTEXT 2687 #define SCI_TARGETFROMSELECTION 2287 @@ -669,6 +687,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_BRACEBADLIGHT 2352 #define SCI_BRACEBADLIGHTINDICATOR 2499 #define SCI_BRACEMATCH 2353 +#define SCI_BRACEMATCHNEXT 2369 #define SCI_GETVIEWEOL 2355 #define SCI_SETVIEWEOL 2356 #define SCI_GETDOCPOINTER 2357 @@ -686,6 +705,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETEDGECOLOUR 2365 #define SCI_MULTIEDGEADDLINE 2694 #define SCI_MULTIEDGECLEARALL 2695 +#define SCI_GETMULTIEDGECOLUMN 2749 #define SCI_SEARCHANCHOR 2366 #define SCI_SEARCHNEXT 2367 #define SCI_SEARCHPREV 2368 @@ -720,10 +740,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETMOUSEDOWNCAPTURES 2385 #define SCI_SETMOUSEWHEELCAPTURES 2696 #define SCI_GETMOUSEWHEELCAPTURES 2697 -#define SC_CURSORNORMAL -1 -#define SC_CURSORARROW 2 -#define SC_CURSORWAIT 4 -#define SC_CURSORREVERSEARROW 7 #define SCI_SETCURSOR 2386 #define SCI_GETCURSOR 2387 #define SCI_SETCONTROLCHARSYMBOL 2388 @@ -818,26 +834,24 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETLENGTHFORENCODE 2448 #define SCI_ENCODEDFROMUTF8 2449 #define SCI_FINDCOLUMN 2456 -#define SCI_GETCARETSTICKY 2457 -#define SCI_SETCARETSTICKY 2458 #define SC_CARETSTICKY_OFF 0 #define SC_CARETSTICKY_ON 1 #define SC_CARETSTICKY_WHITESPACE 2 +#define SCI_GETCARETSTICKY 2457 +#define SCI_SETCARETSTICKY 2458 #define SCI_TOGGLECARETSTICKY 2459 #define SCI_SETPASTECONVERTENDINGS 2467 #define SCI_GETPASTECONVERTENDINGS 2468 #define SCI_SELECTIONDUPLICATE 2469 -#define SC_ALPHA_TRANSPARENT 0 -#define SC_ALPHA_OPAQUE 255 -#define SC_ALPHA_NOALPHA 256 #define SCI_SETCARETLINEBACKALPHA 2470 #define SCI_GETCARETLINEBACKALPHA 2471 #define CARETSTYLE_INVISIBLE 0 #define CARETSTYLE_LINE 1 #define CARETSTYLE_BLOCK 2 #define CARETSTYLE_OVERSTRIKE_BAR 0 -#define CARETSTYLE_OVERSTRIKE_BLOCK 16 +#define CARETSTYLE_OVERSTRIKE_BLOCK 0x10 #define CARETSTYLE_INS_MASK 0xF +#define CARETSTYLE_BLOCK_AFTER 0x100 #define SCI_SETCARETSTYLE 2512 #define SCI_GETCARETSTYLE 2513 #define SCI_SETINDICATORCURRENT 2500 @@ -896,6 +910,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_ANNOTATIONGETSTYLEOFFSET 2551 #define SCI_RELEASEALLEXTENDEDSTYLES 2552 #define SCI_ALLOCATEEXTENDEDSTYLES 2553 +#define UNDO_NONE 0 #define UNDO_MAY_COALESCE 1 #define SCI_ADDUNDOACTION 2560 #define SCI_CHARPOSITIONFROMPOINT 2561 @@ -928,7 +943,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETSELECTIONNANCHORVIRTUALSPACE 2583 #define SCI_SETSELECTIONNSTART 2584 #define SCI_GETSELECTIONNSTART 2585 +#define SCI_GETSELECTIONNSTARTVIRTUALSPACE 2726 #define SCI_SETSELECTIONNEND 2586 +#define SCI_GETSELECTIONNENDVIRTUALSPACE 2727 #define SCI_GETSELECTIONNEND 2587 #define SCI_SETRECTANGULARSELECTIONCARET 2588 #define SCI_GETRECTANGULARSELECTIONCARET 2589 @@ -992,6 +1009,18 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETREPRESENTATION 2665 #define SCI_GETREPRESENTATION 2666 #define SCI_CLEARREPRESENTATION 2667 +#define SCI_EOLANNOTATIONSETTEXT 2740 +#define SCI_EOLANNOTATIONGETTEXT 2741 +#define SCI_EOLANNOTATIONSETSTYLE 2742 +#define SCI_EOLANNOTATIONGETSTYLE 2743 +#define SCI_EOLANNOTATIONCLEARALL 2744 +#define EOLANNOTATION_HIDDEN 0 +#define EOLANNOTATION_STANDARD 1 +#define EOLANNOTATION_BOXED 2 +#define SCI_EOLANNOTATIONSETVISIBLE 2745 +#define SCI_EOLANNOTATIONGETVISIBLE 2746 +#define SCI_EOLANNOTATIONSETSTYLEOFFSET 2747 +#define SCI_EOLANNOTATIONGETSTYLEOFFSET 2748 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 @@ -1028,6 +1057,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_NAMEOFSTYLE 4030 #define SCI_TAGSOFSTYLE 4031 #define SCI_DESCRIPTIONOFSTYLE 4032 +#define SC_MOD_NONE 0x0 #define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_DELETETEXT 0x2 #define SC_MOD_CHANGESTYLE 0x4 @@ -1050,7 +1080,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MOD_LEXERSTATE 0x80000 #define SC_MOD_INSERTCHECK 0x100000 #define SC_MOD_CHANGETABSTOPS 0x200000 -#define SC_MODEVENTMASKALL 0x3FFFFF +#define SC_MOD_CHANGEEOLANNOTATION 0x400000 +#define SC_MODEVENTMASKALL 0x7FFFFF #define SC_UPDATE_CONTENT 0x1 #define SC_UPDATE_SELECTION 0x2 #define SC_UPDATE_V_SCROLL 0x4 @@ -1089,6 +1120,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_AC_TAB 3 #define SC_AC_NEWLINE 4 #define SC_AC_COMMAND 5 +#define SC_CHARACTERSOURCE_DIRECT_INPUT 0 +#define SC_CHARACTERSOURCE_TENTATIVE_INPUT 1 +#define SC_CHARACTERSOURCE_IME_RESULT 2 #define SCN_STYLENEEDED 2000 #define SCN_CHARADDED 2001 #define SCN_SAVEPOINTREACHED 2002 @@ -1133,6 +1167,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #endif /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
+#endif + /* These structures are defined to be exactly the same shape as the Win32 * CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. * So older code that treats Scintilla as a RichEdit will work. */ @@ -1226,6 +1262,7 @@ struct SCNotification { int updated; /* SCN_UPDATEUI */ int listCompletionMethod; /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */ + int characterSource; /* SCN_CHARADDED */ };
#ifdef INCLUDE_DEPRECATED_FEATURES @@ -1243,6 +1280,13 @@ struct SCNotification { #define SCI_GETSTYLEBITS 2091 #define SCI_GETSTYLEBITSNEEDED 4011
+#define INDIC0_MASK 0x20 +#define INDIC1_MASK 0x40 +#define INDIC2_MASK 0x80 +#define INDICS_MASK 0xE0 + #endif
+#include "Compat.h" + #endif
Modified: scintilla/include/Scintilla.iface 905 lines changed, 633 insertions(+), 272 deletions(-) =================================================================== @@ -10,7 +10,7 @@ ## A line starting with # followed by a space is a documentation comment and refers ## to the next feature definition.
-## Each feature is defined by a line starting with fun, get, set, val or evt. +## Each feature is defined by a line starting with fun, get, set, val, evt, enu, lex, or ali. ## cat -> start a category ## fun -> a function ## get -> a property get function @@ -19,6 +19,7 @@ ## evt -> an event ## enu -> associate an enumeration with a set of vals with a prefix ## lex -> associate a lexer with the lexical classes it produces +## ali -> add an alias for a val, commonly adding '_' to separate words ## ## All other feature names should be ignored. They may be defined in the future. ## A property may have a set function, a get function or both. Each will have @@ -46,19 +47,22 @@ ## to enu. The name may not be the same as that used within the lexer so the lexerVal ## should be used to tie these entities together.
-## Types: +## Types: Never start with a capital letter ## void ## int ## bool -> integer, 1=true, 0=false -## position -> integer position in a document +## position -> intptr_t position in a document +## line -> intptr_t line in a document ## colour -> colour integer containing red, green and blue bytes. ## string -> pointer to const character ## stringresult -> pointer to character, NULL-> return size of result ## cells -> pointer to array of cells, each cell containing a style byte and character byte +## pointer -> void* pointer that may point to a document, loader, internal text storage or similar ## textrange -> range of a min and a max position with an output string ## findtext -> searchrange, text -> foundposition ## keymod -> integer containing key in low half and modifiers in high half ## formatrange +## Enumeration types always start with a capital letter ## Types no longer used: ## findtextex -> searchrange ## charrange -> range of a min and a max position @@ -90,28 +94,28 @@ val SCI_OPTIONAL_START=3000 val SCI_LEXER_START=4000
# Add text to the document at current position. -fun void AddText=2001(int length, string text) +fun void AddText=2001(position length, string text)
# Add array of cells to document. -fun void AddStyledText=2002(int length, cells c) +fun void AddStyledText=2002(position length, cells c)
# Insert string at a position. fun void InsertText=2003(position pos, string text)
# Change the text that is being inserted in response to SC_MOD_INSERTCHECK -fun void ChangeInsertion=2672(int length, string text) +fun void ChangeInsertion=2672(position length, string text)
# Delete all text in the document. fun void ClearAll=2004(,)
# Delete a range of text in the document. -fun void DeleteRange=2645(position start, int lengthDelete) +fun void DeleteRange=2645(position start, position lengthDelete)
# Set all style bytes to 0, remove all folding information. fun void ClearDocumentStyle=2005(,)
# Returns the number of bytes in the document. -get int GetLength=2006(,) +get position GetLength=2006(,)
# Returns the character byte at the position. get int GetCharAt=2007(position pos,) @@ -141,17 +145,23 @@ fun void SetSavePoint=2014(,)
# Retrieve a buffer of cells. # Returns the number of bytes in the buffer not including terminating NULs. -fun int GetStyledText=2015(, textrange tr) +fun position GetStyledText=2015(, textrange tr)
# Are there any redoable actions in the undo history? fun bool CanRedo=2016(,)
# Retrieve the line number at which a particular marker is located. -fun int MarkerLineFromHandle=2017(int markerHandle,) +fun line MarkerLineFromHandle=2017(int markerHandle,)
# Delete a marker. fun void MarkerDeleteHandle=2018(int markerHandle,)
+# Retrieve marker handles of a line +fun int MarkerHandleFromLine=2732(line line, int which) + +# Retrieve marker number of a marker handle +fun int MarkerNumberFromLine=2733(line line, int which) + # Is undo history being collected? get bool GetUndoCollection=2019(,)
@@ -161,23 +171,30 @@ val SCWS_VISIBLEALWAYS=1 val SCWS_VISIBLEAFTERINDENT=2 val SCWS_VISIBLEONLYININDENT=3
+ali SCWS_VISIBLEALWAYS=VISIBLE_ALWAYS +ali SCWS_VISIBLEAFTERINDENT=VISIBLE_AFTER_INDENT +ali SCWS_VISIBLEONLYININDENT=VISIBLE_ONLY_IN_INDENT + # Are white space characters currently visible? # Returns one of SCWS_* constants. -get int GetViewWS=2020(,) +get WhiteSpace GetViewWS=2020(,)
# Make white space characters invisible, always visible or visible outside indentation. -set void SetViewWS=2021(int viewWS,) +set void SetViewWS=2021(WhiteSpace viewWS,)
enu TabDrawMode=SCTD_ val SCTD_LONGARROW=0 val SCTD_STRIKEOUT=1
+ali SCTD_LONGARROW=LONG_ARROW +ali SCTD_STRIKEOUT=STRIKE_OUT + # Retrieve the current tab draw mode. # Returns one of SCTD_* constants. -get int GetTabDrawMode=2698(,) +get TabDrawMode GetTabDrawMode=2698(,)
# Set how tabs are drawn when visible. -set void SetTabDrawMode=2699(int tabDrawMode,) +set void SetTabDrawMode=2699(TabDrawMode tabDrawMode,)
# Find the position from a point within the window. fun position PositionFromPoint=2022(int x, int y) @@ -187,7 +204,7 @@ fun position PositionFromPoint=2022(int x, int y) fun position PositionFromPointClose=2023(int x, int y)
# Set caret to start of a line and ensure it is visible. -fun void GotoLine=2024(int line,) +fun void GotoLine=2024(line line,)
# Set caret to a position and ensure it is visible. fun void GotoPos=2025(position caret,) @@ -199,7 +216,7 @@ set void SetAnchor=2026(position anchor,) # Retrieve the text of the line containing the caret. # Returns the index of the caret on the line. # Result is NUL-terminated. -fun int GetCurLine=2027(int length, stringresult text) +fun position GetCurLine=2027(position length, stringresult text)
# Retrieve the position of the last correctly styled character. get position GetEndStyled=2028(,) @@ -209,22 +226,24 @@ val SC_EOL_CRLF=0 val SC_EOL_CR=1 val SC_EOL_LF=2
+ali SC_EOL_CRLF=CR_LF + # Convert all line endings in the document to one mode. -fun void ConvertEOLs=2029(int eolMode,) +fun void ConvertEOLs=2029(EndOfLine eolMode,)
# Retrieve the current end of line mode - one of CRLF, CR, or LF. -get int GetEOLMode=2030(,) +get EndOfLine GetEOLMode=2030(,)
# Set the current end of line mode. -set void SetEOLMode=2031(int eolMode,) +set void SetEOLMode=2031(EndOfLine eolMode,)
# Set the current styling position to start. # The unused parameter is no longer used and should be set to 0. fun void StartStyling=2032(position start, int unused)
# Change style from current styling position for length characters to a style # and move the current styling position to after this newly styled segment. -fun void SetStyling=2033(int length, int style) +fun void SetStyling=2033(position length, int style)
# Is drawing done first into a buffer or direct to the screen? get bool GetBufferedDraw=2034(,) @@ -239,14 +258,20 @@ set void SetTabWidth=2036(int tabWidth,) # Retrieve the visible size of a tab. get int GetTabWidth=2121(,)
+# Set the minimum visual width of a tab. +set void SetTabMinimumWidth=2724(int pixels,) + +# Get the minimum visual width of a tab. +get int GetTabMinimumWidth=2725(,) + # Clear explicit tabstops on a line. -fun void ClearTabStops=2675(int line,) +fun void ClearTabStops=2675(line line,)
# Add an explicit tab stop for a line. -fun void AddTabStop=2676(int line, int x) +fun void AddTabStop=2676(line line, int x)
# Find the next explicit tab stop position on a line after a position. -fun int GetNextTabStop=2677(int line, int x) +fun int GetNextTabStop=2677(line line, int x)
# The SC_CP_UTF8 value can be used to enter Unicode mode. # This is the same value as CP_UTF8 in Windows @@ -261,10 +286,25 @@ val SC_IME_WINDOWED=0 val SC_IME_INLINE=1
# Is the IME displayed in a window or inline? -get int GetIMEInteraction=2678(,) +get IMEInteraction GetIMEInteraction=2678(,)
-# Choose to display the the IME in a winow or inline. -set void SetIMEInteraction=2679(int imeInteraction,) +# Choose to display the IME in a window or inline. +set void SetIMEInteraction=2679(IMEInteraction imeInteraction,) + +enu Alpha=SC_ALPHA_ +val SC_ALPHA_TRANSPARENT=0 +val SC_ALPHA_OPAQUE=255 +val SC_ALPHA_NOALPHA=256 + +ali SC_ALPHA_NOALPHA=NO_ALPHA + +enu CursorShape=SC_CURSOR +val SC_CURSORNORMAL=-1 +val SC_CURSORARROW=2 +val SC_CURSORWAIT=4 +val SC_CURSORREVERSEARROW=7 + +ali SC_CURSORREVERSEARROW=REVERSE_ARROW
enu MarkerSymbol=SC_MARK_ val MARKER_MAX=31 @@ -308,6 +348,29 @@ val SC_MARK_VERTICALBOOKMARK=32
val SC_MARK_CHARACTER=10000
+ali SC_MARK_ROUNDRECT=ROUND_RECT +ali SC_MARK_SMALLRECT=SMALL_RECT +ali SC_MARK_SHORTARROW=SHORT_ARROW +ali SC_MARK_ARROWDOWN=ARROW_DOWN +ali SC_MARK_VLINE=V_LINE +ali SC_MARK_LCORNER=L_CORNER +ali SC_MARK_TCORNER=T_CORNER +ali SC_MARK_BOXPLUS=BOX_PLUS +ali SC_MARK_BOXPLUSCONNECTED=BOX_PLUS_CONNECTED +ali SC_MARK_BOXMINUS=BOX_MINUS +ali SC_MARK_BOXMINUSCONNECTED=BOX_MINUS_CONNECTED +ali SC_MARK_LCORNERCURVE=L_CORNER_CURVE +ali SC_MARK_TCORNERCURVE=T_CORNER_CURVE +ali SC_MARK_CIRCLEPLUS=CIRCLE_PLUS +ali SC_MARK_CIRCLEPLUSCONNECTED=CIRCLE_PLUS_CONNECTED +ali SC_MARK_CIRCLEMINUS=CIRCLE_MINUS +ali SC_MARK_CIRCLEMINUSCONNECTED=CIRCLE_MINUS_CONNECTED +ali SC_MARK_DOTDOTDOT=DOT_DOT_DOT +ali SC_MARK_FULLRECT=FULL_RECT +ali SC_MARK_LEFTRECT=LEFT_RECT +ali SC_MARK_RGBAIMAGE=RGBA_IMAGE +ali SC_MARK_VERTICALBOOKMARK=VERTICAL_BOOKMARK + enu MarkerOutline=SC_MARKNUM_ # Markers used for outlining column. val SC_MARKNUM_FOLDEREND=25 @@ -318,10 +381,18 @@ val SC_MARKNUM_FOLDERSUB=29 val SC_MARKNUM_FOLDER=30 val SC_MARKNUM_FOLDEROPEN=31
+ali SC_MARKNUM_FOLDEREND=FOLDER_END +ali SC_MARKNUM_FOLDEROPENMID=FOLDER_OPEN_MID +ali SC_MARKNUM_FOLDERMIDTAIL=FOLDER_MID_TAIL +ali SC_MARKNUM_FOLDERTAIL=FOLDER_TAIL +ali SC_MARKNUM_FOLDERSUB=FOLDER_SUB +ali SC_MARKNUM_FOLDEROPEN=FOLDER_OPEN + +# SC_MASK_FOLDERS doesn't go in an enumeration as larger than max 32-bit positive integer val SC_MASK_FOLDERS=0xFE000000
# Set the symbol used for a particular marker number. -fun void MarkerDefine=2040(int markerNumber, int markerSymbol) +fun void MarkerDefine=2040(int markerNumber, MarkerSymbol markerSymbol)
# Set the foreground colour used for a particular marker number. set void MarkerSetFore=2041(int markerNumber, colour fore) @@ -332,36 +403,36 @@ set void MarkerSetBack=2042(int markerNumber, colour back) # Set the background colour used for a particular marker number when its folding block is selected. set void MarkerSetBackSelected=2292(int markerNumber, colour back)
-# Enable/disable highlight for current folding bloc (smallest one that contains the caret) +# Enable/disable highlight for current folding block (smallest one that contains the caret) fun void MarkerEnableHighlight=2293(bool enabled,)
# Add a marker to a line, returning an ID which can be used to find or delete the marker. -fun int MarkerAdd=2043(int line, int markerNumber) +fun int MarkerAdd=2043(line line, int markerNumber)
# Delete a marker from a line. -fun void MarkerDelete=2044(int line, int markerNumber) +fun void MarkerDelete=2044(line line, int markerNumber)
# Delete all markers with a particular number from all lines. fun void MarkerDeleteAll=2045(int markerNumber,)
# Get a bit mask of all the markers set on a line. -fun int MarkerGet=2046(int line,) +fun int MarkerGet=2046(line line,)
# Find the next line at or after lineStart that includes a marker in mask. # Return -1 when no more lines. -fun int MarkerNext=2047(int lineStart, int markerMask) +fun line MarkerNext=2047(line lineStart, int markerMask)
# Find the previous line before lineStart that includes a marker in mask. -fun int MarkerPrevious=2048(int lineStart, int markerMask) +fun line MarkerPrevious=2048(line lineStart, int markerMask)
# Define a marker from a pixmap. fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap)
# Add a set of markers to a line. -fun void MarkerAddSet=2466(int line, int markerSet) +fun void MarkerAddSet=2466(line line, int markerSet)
# Set the alpha used for a marker that is drawn in the text area, not the margin. -set void MarkerSetAlpha=2476(int markerNumber, int alpha) +set void MarkerSetAlpha=2476(int markerNumber, Alpha alpha)
val SC_MAX_MARGIN=4
@@ -374,11 +445,13 @@ val SC_MARGIN_TEXT=4 val SC_MARGIN_RTEXT=5 val SC_MARGIN_COLOUR=6
+ali SC_MARGIN_RTEXT=R_TEXT + # Set a margin to be either numeric or symbolic. -set void SetMarginTypeN=2240(int margin, int marginType) +set void SetMarginTypeN=2240(int margin, MarginType marginType)
# Retrieve the type of a margin. -get int GetMarginTypeN=2241(int margin,) +get MarginType GetMarginTypeN=2241(int margin,)
# Set the width of a margin to a width expressed in pixels. set void SetMarginWidthN=2242(int margin, int pixelWidth) @@ -399,10 +472,10 @@ set void SetMarginSensitiveN=2246(int margin, bool sensitive) get bool GetMarginSensitiveN=2247(int margin,)
# Set the cursor shown when the mouse is inside a margin. -set void SetMarginCursorN=2248(int margin, int cursor) +set void SetMarginCursorN=2248(int margin, CursorShape cursor)
# Retrieve the cursor shown in a margin. -get int GetMarginCursorN=2249(int margin,) +get CursorShape GetMarginCursorN=2249(int margin,)
# Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. set void SetMarginBackN=2250(int margin, colour back) @@ -429,6 +502,15 @@ val STYLE_FOLDDISPLAYTEXT=39 val STYLE_LASTPREDEFINED=39 val STYLE_MAX=255
+ali STYLE_LINENUMBER=LINE_NUMBER +ali STYLE_BRACELIGHT=BRACE_LIGHT +ali STYLE_BRACEBAD=BRACE_BAD +ali STYLE_CONTROLCHAR=CONTROL_CHAR +ali STYLE_INDENTGUIDE=INDENT_GUIDE +ali STYLE_CALLTIP=CALL_TIP +ali STYLE_FOLDDISPLAYTEXT=FOLD_DISPLAY_TEXT +ali STYLE_LASTPREDEFINED=LAST_PREDEFINED + # Character set identifiers are used in StyleSetCharacterSet. # The values are the same as the Windows *_CHARSET values. enu CharacterSet=SC_CHARSET_ @@ -455,6 +537,13 @@ val SC_CHARSET_VIETNAMESE=163 val SC_CHARSET_THAI=222 val SC_CHARSET_8859_15=1000
+ali SC_CHARSET_CHINESEBIG5=CHINESE_BIG5 +ali SC_CHARSET_EASTEUROPE=EAST_EUROPE +ali SC_CHARSET_GB2312=G_B_2312 +ali SC_CHARSET_OEM866=OEM_866 +ali SC_CHARSET_SHIFTJIS=SHIFT_JIS +ali SC_CHARSET_8859_15=ISO_8859_15 + # Clear all the styles and make equivalent to the global default style. fun void StyleClearAll=2050(,)
@@ -518,10 +607,10 @@ get bool StyleGetEOLFilled=2487(int style,) get bool StyleGetUnderline=2488(int style,)
# Get is a style mixed case, or to force upper or lower case. -get int StyleGetCase=2489(int style,) +get CaseVisible StyleGetCase=2489(int style,)
# Get the character get of the font in a style. -get int StyleGetCharacterSet=2490(int style,) +get CharacterSet StyleGetCharacterSet=2490(int style,)
# Get is a style visible or not. get bool StyleGetVisible=2491(int style,) @@ -534,7 +623,7 @@ get bool StyleGetChangeable=2492(int style,) get bool StyleGetHotSpot=2493(int style,)
# Set a style to be mixed case, or to force upper or lower case. -set void StyleSetCase=2060(int style, int caseVisible) +set void StyleSetCase=2060(int style, CaseVisible caseVisible)
val SC_FONT_SIZE_MULTIPLIER=100
@@ -549,14 +638,16 @@ val SC_WEIGHT_NORMAL=400 val SC_WEIGHT_SEMIBOLD=600 val SC_WEIGHT_BOLD=700
+ali SC_WEIGHT_SEMIBOLD=SEMI_BOLD + # Set the weight of characters of a style. -set void StyleSetWeight=2063(int style, int weight) +set void StyleSetWeight=2063(int style, FontWeight weight)
# Get the weight of characters of a style. -get int StyleGetWeight=2064(int style,) +get FontWeight StyleGetWeight=2064(int style,)
# Set the character set of the font in a style. -set void StyleSetCharacterSet=2066(int style, int characterSet) +set void StyleSetCharacterSet=2066(int style, CharacterSet characterSet)
# Set a style to be a hotspot or not. set void StyleSetHotSpot=2409(int style, bool hotspot) @@ -568,10 +659,10 @@ fun void SetSelFore=2067(bool useSetting, colour fore) fun void SetSelBack=2068(bool useSetting, colour back)
# Get the alpha of the selection. -get int GetSelAlpha=2477(,) +get Alpha GetSelAlpha=2477(,)
# Set the alpha of the selection. -set void SetSelAlpha=2478(int alpha,) +set void SetSelAlpha=2478(Alpha alpha,)
# Is the selection end of line filled? get bool GetSelEOLFilled=2479(,) @@ -592,7 +683,7 @@ fun void ClearCmdKey=2071(keymod keyDefinition,) fun void ClearAllCmdKeys=2072(,)
# Set the styles for a segment of the document. -fun void SetStylingEx=2073(int length, string styles) +fun void SetStylingEx=2073(position length, string styles)
# Set a style to be visible or not. set void StyleSetVisible=2074(int style, bool visible) @@ -648,20 +739,39 @@ val INDIC_POINT=18 val INDIC_POINTCHARACTER=19 val INDIC_GRADIENT=20 val INDIC_GRADIENTCENTRE=21 + +# INDIC_CONTAINER, INDIC_IME, INDIC_IME_MAX, and INDIC_MAX are indicator numbers, +# not IndicatorStyles so should not really be in the INDIC_ enumeration. +# They are redeclared in IndicatorNumbers INDICATOR_. +val INDIC_CONTAINER=8 val INDIC_IME=32 val INDIC_IME_MAX=35 val INDIC_MAX=35 -val INDIC_CONTAINER=8 -val INDIC0_MASK=0x20 -val INDIC1_MASK=0x40 -val INDIC2_MASK=0x80 -val INDICS_MASK=0xE0 + +enu IndicatorNumbers=INDICATOR_ +val INDICATOR_CONTAINER=8 +val INDICATOR_IME=32 +val INDICATOR_IME_MAX=35 +val INDICATOR_MAX=35 + +ali INDIC_TT=T_T +ali INDIC_ROUNDBOX=ROUND_BOX +ali INDIC_STRAIGHTBOX=STRAIGHT_BOX +ali INDIC_SQUIGGLELOW=SQUIGGLE_LOW +ali INDIC_DOTBOX=DOT_BOX +ali INDIC_SQUIGGLEPIXMAP=SQUIGGLE_PIXMAP +ali INDIC_COMPOSITIONTHICK=COMPOSITION_THICK +ali INDIC_COMPOSITIONTHIN=COMPOSITION_THIN +ali INDIC_FULLBOX=FULL_BOX +ali INDIC_TEXTFORE=TEXT_FORE +ali INDIC_POINTCHARACTER=POINT_CHARACTER +ali INDIC_GRADIENTCENTRE=GRADIENT_CENTRE
# Set an indicator to plain, squiggle or TT. -set void IndicSetStyle=2080(int indicator, int indicatorStyle) +set void IndicSetStyle=2080(int indicator, IndicatorStyle indicatorStyle)
# Retrieve the style of an indicator. -get int IndicGetStyle=2081(int indicator,) +get IndicatorStyle IndicGetStyle=2081(int indicator,)
# Set the foreground colour of an indicator. set void IndicSetFore=2082(int indicator, colour fore) @@ -676,28 +786,31 @@ set void IndicSetUnder=2510(int indicator, bool under) get bool IndicGetUnder=2511(int indicator,)
# Set a hover indicator to plain, squiggle or TT. -set void IndicSetHoverStyle=2680(int indicator, int indicatorStyle) +set void IndicSetHoverStyle=2680(int indicator, IndicatorStyle indicatorStyle)
# Retrieve the hover style of an indicator. -get int IndicGetHoverStyle=2681(int indicator,) +get IndicatorStyle IndicGetHoverStyle=2681(int indicator,)
# Set the foreground hover colour of an indicator. set void IndicSetHoverFore=2682(int indicator, colour fore)
# Retrieve the foreground hover colour of an indicator. get colour IndicGetHoverFore=2683(int indicator,)
+enu IndicValue=SC_INDICVALUE val SC_INDICVALUEBIT=0x1000000 val SC_INDICVALUEMASK=0xFFFFFF
enu IndicFlag=SC_INDICFLAG_ val SC_INDICFLAG_VALUEFORE=1
+ali SC_INDICFLAG_VALUEFORE=VALUE_FORE + # Set the attributes of an indicator. -set void IndicSetFlags=2684(int indicator, int flags) +set void IndicSetFlags=2684(int indicator, IndicFlag flags)
# Retrieve the attributes of an indicator. -get int IndicGetFlags=2685(int indicator,) +get IndicFlag IndicGetFlags=2685(int indicator,)
# Set the foreground colour of all whitespace and whether to use this setting. fun void SetWhitespaceFore=2084(bool useSetting, colour fore) @@ -712,10 +825,10 @@ set void SetWhitespaceSize=2086(int size,) get int GetWhitespaceSize=2087(,)
# Used to hold extra styling information for each line. -set void SetLineState=2092(int line, int state) +set void SetLineState=2092(line line, int state)
# Retrieve the extra styling information for a line. -get int GetLineState=2093(int line,) +get int GetLineState=2093(line line,)
# Retrieve the last line number that has line state. get int GetMaxLineState=2094(,) @@ -747,7 +860,7 @@ set void StyleSetChangeable=2099(int style, bool changeable) # Display a auto-completion list. # The lengthEntered parameter indicates how many characters before # the caret should be used to provide context. -fun void AutoCShow=2100(int lengthEntered, string itemList) +fun void AutoCShow=2100(position lengthEntered, string itemList)
# Remove the auto-completion list from the screen. fun void AutoCCancel=2101(,) @@ -855,22 +968,22 @@ set void SetUseTabs=2124(bool useTabs,) get bool GetUseTabs=2125(,)
# Change the indentation of a line to a number of columns. -set void SetLineIndentation=2126(int line, int indentation) +set void SetLineIndentation=2126(line line, int indentation)
# Retrieve the number of columns that a line is indented. -get int GetLineIndentation=2127(int line,) +get int GetLineIndentation=2127(line line,)
# Retrieve the position before the first non indentation character on a line. -get position GetLineIndentPosition=2128(int line,) +get position GetLineIndentPosition=2128(line line,)
# Retrieve the column number of a position, taking tab width into account. -get int GetColumn=2129(position pos,) +get position GetColumn=2129(position pos,)
# Count characters between two positions. -fun int CountCharacters=2633(position start, position end) +fun position CountCharacters=2633(position start, position end)
# Count code units between two positions. -fun int CountCodeUnits=2715(position start, position end) +fun position CountCodeUnits=2715(position start, position end)
# Show or hide the horizontal scroll bar. set void SetHScrollBar=2130(bool visible,) @@ -883,21 +996,24 @@ val SC_IV_REAL=1 val SC_IV_LOOKFORWARD=2 val SC_IV_LOOKBOTH=3
+ali SC_IV_LOOKFORWARD=LOOK_FORWARD +ali SC_IV_LOOKBOTH=LOOK_BOTH + # Show or hide indentation guides. -set void SetIndentationGuides=2132(int indentView,) +set void SetIndentationGuides=2132(IndentView indentView,)
# Are the indentation guides visible? -get int GetIndentationGuides=2133(,) +get IndentView GetIndentationGuides=2133(,)
# Set the highlighted indentation guide column. # 0 = no highlighted guide. -set void SetHighlightGuide=2134(int column,) +set void SetHighlightGuide=2134(position column,)
# Get the highlighted indentation guide column. -get int GetHighlightGuide=2135(,) +get position GetHighlightGuide=2135(,)
# Get the position after the last visible characters on a line. -get position GetLineEndPosition=2136(int line,) +get position GetLineEndPosition=2136(line line,)
# Get the code page used to interpret the bytes of the document as characters. get int GetCodePage=2137(,) @@ -947,35 +1063,48 @@ val SC_PRINT_COLOURONWHITEDEFAULTBG=4 # PrintColourMode - use same colours as screen, including line number margins. val SC_PRINT_SCREENCOLOURS=5
+ali SC_PRINT_INVERTLIGHT=INVERT_LIGHT +ali SC_PRINT_BLACKONWHITE=BLACK_ON_WHITE +ali SC_PRINT_COLOURONWHITE=COLOUR_ON_WHITE +ali SC_PRINT_COLOURONWHITEDEFAULTBG=COLOUR_ON_WHITE_DEFAULT_B_G +ali SC_PRINT_SCREENCOLOURS=SCREEN_COLOURS + # Modify colours when printing for clearer printed text. -set void SetPrintColourMode=2148(int mode,) +set void SetPrintColourMode=2148(PrintOption mode,)
# Returns the print colour mode. -get int GetPrintColourMode=2149(,) +get PrintOption GetPrintColourMode=2149(,)
enu FindOption=SCFIND_ +val SCFIND_NONE=0x0 val SCFIND_WHOLEWORD=0x2 val SCFIND_MATCHCASE=0x4 val SCFIND_WORDSTART=0x00100000 val SCFIND_REGEXP=0x00200000 val SCFIND_POSIX=0x00400000 val SCFIND_CXX11REGEX=0x00800000
+ali SCFIND_WHOLEWORD=WHOLE_WORD +ali SCFIND_MATCHCASE=MATCH_CASE +ali SCFIND_WORDSTART=WORD_START +ali SCFIND_REGEXP=REG_EXP +ali SCFIND_CXX11REGEX=CXX11_REG_EX + # Find some text in the document. -fun position FindText=2150(int searchFlags, findtext ft) +fun position FindText=2150(FindOption searchFlags, findtext ft)
# On Windows, will draw the document into a display context such as a printer. fun position FormatRange=2151(bool draw, formatrange fr)
# Retrieve the display line at the top of the display. -get int GetFirstVisibleLine=2152(,) +get line GetFirstVisibleLine=2152(,)
# Retrieve the contents of a line. # Returns the length of the line. -fun int GetLine=2153(int line, stringresult text) +fun position GetLine=2153(line line, stringresult text)
# Returns the number of lines in the document. There is always at least one. -get int GetLineCount=2154(,) +get line GetLineCount=2154(,)
# Sets the size in pixels of the left margin. set void SetMarginLeft=2155(, int pixelWidth) @@ -998,11 +1127,11 @@ fun void SetSel=2160(position anchor, position caret) # Retrieve the selected text. # Return the length of the text. # Result is NUL-terminated. -fun int GetSelText=2161(, stringresult text) +fun position GetSelText=2161(, stringresult text)
# Retrieve a range of text. # Return the length of the text. -fun int GetTextRange=2162(, textrange tr) +fun position GetTextRange=2162(, textrange tr)
# Draw the selection either highlighted or in normal (non-highlighted) style. fun void HideSelection=2163(bool hide,) @@ -1014,13 +1143,13 @@ fun int PointXFromPosition=2164(, position pos) fun int PointYFromPosition=2165(, position pos)
# Retrieve the line containing a position. -fun int LineFromPosition=2166(position pos,) +fun line LineFromPosition=2166(position pos,)
# Retrieve the position at the start of a line. -fun position PositionFromLine=2167(int line,) +fun position PositionFromLine=2167(line line,)
# Scroll horizontally and vertically. -fun void LineScroll=2168(int columns, int lines) +fun void LineScroll=2168(position columns, line lines)
# Ensure the caret is visible. fun void ScrollCaret=2169(,) @@ -1069,17 +1198,17 @@ fun void SetText=2181(, string text) # Retrieve all the text in the document. # Returns number of characters retrieved. # Result is NUL-terminated. -fun int GetText=2182(int length, stringresult text) +fun position GetText=2182(position length, stringresult text)
# Retrieve the number of characters in the document. -get int GetTextLength=2183(,) +get position GetTextLength=2183(,)
# Retrieve a pointer to a function that processes messages for this Scintilla. -get int GetDirectFunction=2184(,) +get pointer GetDirectFunction=2184(,)
# Retrieve a pointer value to use as the first argument when calling # the function returned by GetDirectFunction. -get int GetDirectPointer=2185(,) +get pointer GetDirectPointer=2185(,)
# Set to overtype (true) or insert mode. set void SetOvertype=2186(bool overType,) @@ -1100,18 +1229,30 @@ set void SetTargetStart=2190(position start,) # Get the position that starts the target. get position GetTargetStart=2191(,)
+# Sets the virtual space of the target start +set void SetTargetStartVirtualSpace=2728(position space,) + +# Get the virtual space of the target start +get position GetTargetStartVirtualSpace=2729(,) + # Sets the position that ends the target which is used for updating the # document without affecting the scroll position. set void SetTargetEnd=2192(position end,)
# Get the position that ends the target. get position GetTargetEnd=2193(,)
+# Sets the virtual space of the target end +set void SetTargetEndVirtualSpace=2730(position space,) + +# Get the virtual space of the target end +get position GetTargetEndVirtualSpace=2731(,) + # Sets both the start and end of the target in one call. fun void SetTargetRange=2686(position start, position end)
# Retrieve the text in the target. -get int GetTargetText=2687(, stringresult text) +get position GetTargetText=2687(, stringresult text)
# Make the target range start and end be the same as the selection range start and end. fun void TargetFromSelection=2287(,) @@ -1122,26 +1263,26 @@ fun void TargetWholeDocument=2690(,) # Replace the target text with the argument text. # Text is counted so it can contain NULs. # Returns the length of the replacement text. -fun int ReplaceTarget=2194(int length, string text) +fun position ReplaceTarget=2194(position length, string text)
# Replace the target text with the argument text after \d processing. # Text is counted so it can contain NULs. # Looks for \d where d is between 1 and 9 and replaces these with the strings # matched in the last search operation which were surrounded by ( and ). # Returns the length of the replacement text including any change # caused by processing the \d patterns. -fun int ReplaceTargetRE=2195(int length, string text) +fun position ReplaceTargetRE=2195(position length, string text)
# Search for a counted string in the target and set the target to the found # range. Text is counted so it can contain NULs. -# Returns length of range or -1 for failure in which case target is not moved. -fun int SearchInTarget=2197(int length, string text) +# Returns start of found range or -1 for failure in which case target is not moved. +fun position SearchInTarget=2197(position length, string text)
# Set the search flags used by SearchInTarget. -set void SetSearchFlags=2198(int searchFlags,) +set void SetSearchFlags=2198(FindOption searchFlags,)
# Get the search flags used by SearchInTarget. -get int GetSearchFlags=2199(,) +get FindOption GetSearchFlags=2199(,)
# Show a call tip containing a definition near position pos. fun void CallTipShow=2200(position pos, string definition) @@ -1156,10 +1297,10 @@ fun bool CallTipActive=2202(,) fun position CallTipPosStart=2203(,)
# Set the start position in order to change when backspacing removes the calltip. -set void CallTipSetPosStart=2214(int posStart,) +set void CallTipSetPosStart=2214(position posStart,)
# Highlight a segment of the definition. -fun void CallTipSetHlt=2204(int highlightStart, int highlightEnd) +fun void CallTipSetHlt=2204(position highlightStart, position highlightEnd)
# Set the background colour for the call tip. set void@@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).