[geany/geany] 183604: Update Scintilla to version 3.7.5 (#1503)
Colomban Wendling
git-noreply at xxxxx
Mon Jul 24 23:24:05 UTC 2017
Branch: refs/heads/master
Author: Colomban Wendling <lists.ban at herbesfolles.org>
Committer: elextr <elextr at gmail.com>
Date: Mon, 24 Jul 2017 23:24:05 UTC
Commit: 18360460abb4f4bec23dff127031ecf4e9120f7f
https://github.com/geany/geany/commit/18360460abb4f4bec23dff127031ecf4e9120f7f
Log Message:
-----------
Update Scintilla to version 3.7.5 (#1503)
* Update Scintilla to version 3.7.5
This now requires a C++11-capable compiler.
Closes #1308.
* Test using newer dist on Travis
Since Scintilla needs C++11
* Add debugging code for when configure fails
* Workaround a pkg-config-corsswrapper bug on Ubuntu 14.04
See https://bugs.launchpad.net/ubuntu/+source/mingw-w64/+bug/1327242
Modified Paths:
--------------
.travis.yml
configure.ac
m4/ax_cxx_compile_stdcxx_11.m4
scintilla/Makefile.am
scintilla/gtk/PlatGTK.cxx
scintilla/gtk/ScintillaGTK.cxx
scintilla/gtk/ScintillaGTK.h
scintilla/gtk/ScintillaGTKAccessible.cxx
scintilla/gtk/ScintillaGTKAccessible.h
scintilla/include/Platform.h
scintilla/include/SciLexer.h
scintilla/include/Scintilla.h
scintilla/include/Scintilla.iface
scintilla/lexers/LexAsm.cxx
scintilla/lexers/LexBash.cxx
scintilla/lexers/LexBasic.cxx
scintilla/lexers/LexCPP.cxx
scintilla/lexers/LexD.cxx
scintilla/lexers/LexDiff.cxx
scintilla/lexers/LexFortran.cxx
scintilla/lexers/LexHTML.cxx
scintilla/lexers/LexHaskell.cxx
scintilla/lexers/LexLaTeX.cxx
scintilla/lexers/LexLua.cxx
scintilla/lexers/LexPerl.cxx
scintilla/lexers/LexPowerShell.cxx
scintilla/lexers/LexProps.cxx
scintilla/lexers/LexPython.cxx
scintilla/lexers/LexRust.cxx
scintilla/lexers/LexSQL.cxx
scintilla/lexers/LexVHDL.cxx
scintilla/lexers/LexVerilog.cxx
scintilla/lexers/LexYAML.cxx
scintilla/lexlib/Accessor.cxx
scintilla/lexlib/CharacterCategory.cxx
scintilla/lexlib/CharacterCategory.h
scintilla/lexlib/CharacterSet.cxx
scintilla/lexlib/CharacterSet.h
scintilla/lexlib/LexAccessor.h
scintilla/lexlib/LexerBase.cxx
scintilla/lexlib/LexerModule.cxx
scintilla/lexlib/LexerModule.h
scintilla/lexlib/LexerNoExceptions.cxx
scintilla/lexlib/LexerSimple.cxx
scintilla/lexlib/PropSetSimple.cxx
scintilla/lexlib/StyleContext.cxx
scintilla/lexlib/StyleContext.h
scintilla/lexlib/WordList.cxx
scintilla/scintilla_changes.patch
scintilla/src/AutoComplete.cxx
scintilla/src/AutoComplete.h
scintilla/src/CallTip.cxx
scintilla/src/CallTip.h
scintilla/src/CaseConvert.cxx
scintilla/src/CaseFolder.h
scintilla/src/Catalogue.cxx
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/ExternalLexer.cxx
scintilla/src/ExternalLexer.h
scintilla/src/Indicator.cxx
scintilla/src/KeyMap.cxx
scintilla/src/LineMarker.cxx
scintilla/src/LineMarker.h
scintilla/src/MarginView.cxx
scintilla/src/MarginView.h
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/RunStyles.h
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.h
scintilla/src/ViewStyle.cxx
scintilla/src/ViewStyle.h
scintilla/src/XPM.cxx
scintilla/src/XPM.h
scintilla/version.txt
scripts/cross-build-mingw.sh
Modified: .travis.yml
5 lines changed, 4 insertions(+), 1 deletions(-)
===================================================================
@@ -1,5 +1,6 @@
# we use both C and C++, so advertize C++
language: cpp
+dist: trusty
compiler:
- gcc
env:
@@ -13,6 +14,8 @@ install:
- sudo apt-get install -y intltool libtool
- test -n "$MINGW" || sudo apt-get install -y libgtk2.0-dev libgtk-3-dev
- test -z "$MINGW" || sudo apt-get install -y mingw-w64-tools g++-mingw-w64-i686 gcc-mingw-w64-i686 binutils-mingw-w64-i686
+ # fix broken pkg-config-crosswrapper, see https://bugs.launchpad.net/ubuntu/+source/mingw-w64/+bug/1327242
+ - test -z "$MINGW" || sudo sed -e 's/PKG_CONFIG_PATH=/&$PKG_CONFIG_PATH:/' -i /usr/bin/i686-w64-mingw32-pkg-config
- sudo apt-get install -y python-docutils rst2pdf
# try not to install doxygen-latex because we don't need it and it's huge
- sudo apt-get install -y --no-install-recommends doxygen
@@ -29,7 +32,7 @@ script:
else
mkdir _build &&
cd _build &&
- ../configure --enable-gtk3=$GTK3 &&
+ { ../configure --enable-gtk3=$GTK3 || { cat config.log; exit 1; } ; } &&
make -j2 &&
make -j2 check;
fi
Modified: configure.ac
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -31,6 +31,7 @@ AM_PROG_CC_C_O
AC_PROG_CXX
GEANY_PROG_CXX
+AX_CXX_COMPILE_STDCXX_11
AC_PROG_INSTALL
AC_PROG_LN_S
Modified: m4/ax_cxx_compile_stdcxx_11.m4
142 lines changed, 142 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,142 @@
+# ============================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
+#
+# DESCRIPTION
+#
+# Check for baseline language coverage in the compiler for the C++11
+# standard; if necessary, add switches to CXXFLAGS to enable support.
+#
+# The first argument, if specified, indicates whether you insist on an
+# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
+# -std=c++11). If neither is specified, you get whatever works, with
+# preference for an extended mode.
+#
+# The second argument, if specified 'mandatory' or if left unspecified,
+# indicates that baseline C++11 support is required and that the macro
+# should error out if no mode with that support is found. If specified
+# 'optional', then configuration proceeds regardless, after defining
+# HAVE_CXX11 if and only if a supporting mode is found.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Benjamin Kosnik <bkoz at redhat.com>
+# Copyright (c) 2012 Zack Weinberg <zackw at panix.com>
+# Copyright (c) 2013 Roy Stogner <roystgnr at ices.utexas.edu>
+# Copyright (c) 2014 Alexey Sokolov <sokolov at google.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 4
+
+m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ struct Base {
+ virtual void f() {}
+ };
+ struct Child : public Base {
+ virtual void f() override {}
+ };
+
+ typedef check<check<bool>> right_angle_brackets;
+
+ int a;
+ decltype(a) b;
+
+ typedef check<int> check_type;
+ check_type c;
+ check_type&& cr = static_cast<check_type&&>(c);
+
+ auto d = a;
+ auto l = [](){};
+]])
+
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
+ m4_if([$1], [], [],
+ [$1], [ext], [],
+ [$1], [noext], [],
+ [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
+ m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
+ [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
+ [$2], [optional], [ax_cxx_compile_cxx11_required=false],
+ [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
+ AC_LANG_PUSH([C++])dnl
+ ac_success=no
+ AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
+ ax_cv_cxx_compile_cxx11,
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+ [ax_cv_cxx_compile_cxx11=yes],
+ [ax_cv_cxx_compile_cxx11=no])])
+ if test x$ax_cv_cxx_compile_cxx11 = xyes; then
+ ac_success=yes
+ fi
+
+ m4_if([$1], [noext], [], [dnl
+ if test x$ac_success = xno; then
+ for switch in -std=gnu++11 -std=gnu++0x; do
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
+ AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+ $cachevar,
+ [ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $switch"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+ [eval $cachevar=yes],
+ [eval $cachevar=no])
+ CXXFLAGS="$ac_save_CXXFLAGS"])
+ if eval test x\$$cachevar = xyes; then
+ CXXFLAGS="$CXXFLAGS $switch"
+ ac_success=yes
+ break
+ fi
+ done
+ fi])
+
+ m4_if([$1], [ext], [], [dnl
+ if test x$ac_success = xno; then
+ for switch in -std=c++11 -std=c++0x; do
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
+ AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
+ $cachevar,
+ [ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $switch"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
+ [eval $cachevar=yes],
+ [eval $cachevar=no])
+ CXXFLAGS="$ac_save_CXXFLAGS"])
+ if eval test x\$$cachevar = xyes; then
+ CXXFLAGS="$CXXFLAGS $switch"
+ ac_success=yes
+ break
+ fi
+ done
+ fi])
+ AC_LANG_POP([C++])
+ if test x$ax_cxx_compile_cxx11_required = xtrue; then
+ if test x$ac_success = xno; then
+ AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
+ fi
+ else
+ if test x$ac_success = xno; then
+ HAVE_CXX11=0
+ AC_MSG_NOTICE([No compiler with C++11 support was found])
+ else
+ HAVE_CXX11=1
+ AC_DEFINE(HAVE_CXX11,1,
+ [define if the compiler supports basic C++11 syntax])
+ fi
+
+ AC_SUBST(HAVE_CXX11)
+ fi
+])
Modified: scintilla/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -142,6 +142,7 @@ src/Style.h \
src/UniConversion.cxx \
src/UniConversion.h \
src/UnicodeFromUTF8.h \
+src/UniqueString.h \
src/ViewStyle.cxx \
src/ViewStyle.h \
src/XPM.cxx \
Modified: scintilla/gtk/PlatGTK.cxx
158 lines changed, 82 insertions(+), 76 deletions(-)
===================================================================
@@ -3,15 +3,16 @@
// Copyright 1998-2004 by Neil Hodgson <neilh at scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <math.h>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+#include <cmath>
#include <string>
#include <vector>
#include <map>
+#include <memory>
#include <sstream>
#include <glib.h>
@@ -162,49 +163,50 @@ class SurfaceImpl : public Surface {
void SetConverter(int characterSet_);
public:
SurfaceImpl();
- virtual ~SurfaceImpl();
-
- void Init(WindowID wid);
- void Init(SurfaceID sid, WindowID wid);
- void InitPixMap(int width, int height, Surface *surface_, WindowID wid);
-
- void Release();
- bool Initialised();
- void PenColour(ColourDesired fore);
- int LogPixelsY();
- int DeviceHeightFont(int points);
- void MoveTo(int x_, int y_);
- void LineTo(int x_, int y_);
- void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back);
- void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back);
- void FillRectangle(PRectangle rc, ColourDesired back);
- void FillRectangle(PRectangle rc, Surface &surfacePattern);
- void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back);
+ ~SurfaceImpl() override;
+
+ void Init(WindowID wid) override;
+ void Init(SurfaceID sid, WindowID wid) override;
+ void InitPixMap(int width, int height, Surface *surface_, WindowID wid) override;
+
+ void Clear();
+ void Release() override;
+ bool Initialised() override;
+ void PenColour(ColourDesired fore) override;
+ int LogPixelsY() override;
+ int DeviceHeightFont(int points) override;
+ void MoveTo(int x_, int y_) override;
+ void LineTo(int x_, int y_) override;
+ void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back) override;
+ void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override;
+ void FillRectangle(PRectangle rc, ColourDesired back) override;
+ void FillRectangle(PRectangle rc, Surface &surfacePattern) override;
+ void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
- ColourDesired outline, int alphaOutline, int flags);
- void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage);
- void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back);
- void Copy(PRectangle rc, Point from, Surface &surfaceSource);
+ ColourDesired outline, int alphaOutline, int flags) override;
+ void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) override;
+ 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 DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back);
- void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back);
- void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore);
- void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions);
- XYPOSITION WidthText(Font &font_, const char *s, int len);
- XYPOSITION WidthChar(Font &font_, char ch);
- XYPOSITION Ascent(Font &font_);
- XYPOSITION Descent(Font &font_);
- XYPOSITION InternalLeading(Font &font_);
- XYPOSITION ExternalLeading(Font &font_);
- XYPOSITION Height(Font &font_);
- XYPOSITION AverageCharWidth(Font &font_);
-
- void SetClip(PRectangle rc);
- void FlushCachedState();
-
- void SetUnicodeMode(bool unicodeMode_);
- void SetDBCSMode(int codePage);
+ 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;
+ void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) override;
+ XYPOSITION WidthText(Font &font_, const char *s, int len) override;
+ XYPOSITION WidthChar(Font &font_, char ch) override;
+ XYPOSITION Ascent(Font &font_) override;
+ XYPOSITION Descent(Font &font_) override;
+ XYPOSITION InternalLeading(Font &font_) override;
+ XYPOSITION ExternalLeading(Font &font_) override;
+ XYPOSITION Height(Font &font_) override;
+ XYPOSITION AverageCharWidth(Font &font_) override;
+
+ void SetClip(PRectangle rc) override;
+ void FlushCachedState() override;
+
+ void SetUnicodeMode(bool unicodeMode_) override;
+ void SetDBCSMode(int codePage) override;
};
#ifdef SCI_NAMESPACE
}
@@ -276,10 +278,10 @@ x(0), y(0), inited(false), createdGC(false)
}
SurfaceImpl::~SurfaceImpl() {
- Release();
+ Clear();
}
-void SurfaceImpl::Release() {
+void SurfaceImpl::Clear() {
et = singleByte;
if (createdGC) {
createdGC = false;
@@ -303,6 +305,10 @@ void SurfaceImpl::Release() {
createdGC = false;
}
+void SurfaceImpl::Release() {
+ Clear();
+}
+
bool SurfaceImpl::Initialised() {
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
if (inited && context) {
@@ -1235,7 +1241,7 @@ class ListBoxX : public ListBox {
#endif
doubleClickAction(NULL), doubleClickActionData(NULL) {
}
- virtual ~ListBoxX() {
+ ~ListBoxX() override {
if (pixhash) {
g_hash_table_foreach((GHashTable *) pixhash, list_image_free, NULL);
g_hash_table_destroy((GHashTable *) pixhash);
@@ -1251,30 +1257,30 @@ class ListBoxX : public ListBox {
}
#endif
}
- virtual void SetFont(Font &font);
- virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_);
- virtual void SetAverageCharWidth(int width);
- virtual void SetVisibleRows(int rows);
- virtual int GetVisibleRows() const;
+ void SetFont(Font &font) override;
+ void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_) override;
+ void SetAverageCharWidth(int width) override;
+ void SetVisibleRows(int rows) override;
+ int GetVisibleRows() const override;
int GetRowHeight();
- virtual PRectangle GetDesiredRect();
- virtual int CaretFromEdge();
- virtual void Clear();
- virtual void Append(char *s, int type = -1);
- virtual int Length();
- virtual void Select(int n);
- virtual int GetSelection();
- virtual int Find(const char *prefix);
- virtual void GetValue(int n, char *value, int len);
+ PRectangle GetDesiredRect() override;
+ int CaretFromEdge() override;
+ void Clear() override;
+ void Append(char *s, int type = -1) override;
+ int Length() override;
+ void Select(int n) override;
+ int GetSelection() override;
+ int Find(const char *prefix) override;
+ void GetValue(int n, char *value, int len) override;
void RegisterRGBA(int type, RGBAImage *image);
- virtual void RegisterImage(int type, const char *xpm_data);
- virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage);
- virtual void ClearRegisteredImages();
- virtual void SetDoubleClickAction(CallBackAction action, void *data) {
+ void RegisterImage(int type, const char *xpm_data) override;
+ void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) override;
+ void ClearRegisteredImages() override;
+ void SetDoubleClickAction(CallBackAction action, void *data) override {
doubleClickAction = action;
doubleClickActionData = data;
}
- virtual void SetList(const char *listText, char separator, char typesep);
+ void SetList(const char *listText, char separator, char typesep) override;
};
ListBox *ListBox::Allocate() {
@@ -1505,13 +1511,13 @@ void ListBoxX::Create(Window &parent, int, Point, int, bool, int) {
GTK_WINDOW(top));
}
-void ListBoxX::SetFont(Font &scint_font) {
+void ListBoxX::SetFont(Font &font) {
// Only do for Pango font as there have been crashes for GDK fonts
- if (Created() && PFont(scint_font)->pfd) {
+ if (Created() && PFont(font)->pfd) {
// Current font is Pango font
#if GTK_CHECK_VERSION(3,0,0)
if (cssProvider) {
- PangoFontDescription *pfd = PFont(scint_font)->pfd;
+ PangoFontDescription *pfd = PFont(font)->pfd;
std::ostringstream ssFontSetting;
ssFontSetting << "GtkTreeView, treeview { ";
ssFontSetting << "font-family: " << pango_font_description_get_family(pfd) << "; ";
@@ -1532,7 +1538,7 @@ void ListBoxX::SetFont(Font &scint_font) {
ssFontSetting.str().c_str(), -1, NULL);
}
#else
- gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd);
+ gtk_widget_modify_font(PWidget(list), PFont(font)->pfd);
#endif
gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), -1);
gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), 1);
@@ -1918,14 +1924,14 @@ static void MenuPositionFunc(GtkMenu *, gint *x, gint *y, gboolean *, gpointer u
}
#endif
-void Menu::Show(Point pt, Window &wnd) {
+void Menu::Show(Point pt, Window &w) {
GtkMenu *widget = static_cast<GtkMenu *>(mid);
gtk_widget_show_all(GTK_WIDGET(widget));
#if GTK_CHECK_VERSION(3,22,0)
// Rely on GTK+ to do the right thing with positioning
gtk_menu_popup_at_pointer(widget, NULL);
#else
- GdkRectangle rcMonitor = MonitorRectangleForWidget(PWidget(wnd.GetID()));
+ GdkRectangle rcMonitor = MonitorRectangleForWidget(PWidget(w.GetID()));
GtkRequisition requisition;
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(GTK_WIDGET(widget), NULL, &requisition);
@@ -1959,13 +1965,13 @@ class DynamicLibraryImpl : public DynamicLibrary {
m = g_module_open(modulePath, G_MODULE_BIND_LAZY);
}
- virtual ~DynamicLibraryImpl() {
+ ~DynamicLibraryImpl() override {
if (m != NULL)
g_module_close(m);
}
// Use g_module_symbol to get a pointer to the relevant function.
- virtual Function FindFunction(const char *name) {
+ Function FindFunction(const char *name) override {
if (m != NULL) {
gpointer fn_address = NULL;
gboolean status = g_module_symbol(m, name, &fn_address);
@@ -1978,7 +1984,7 @@ class DynamicLibraryImpl : public DynamicLibrary {
}
}
- virtual bool IsValid() {
+ bool IsValid() override {
return m != NULL;
}
};
Modified: scintilla/gtk/ScintillaGTK.cxx
154 lines changed, 79 insertions(+), 75 deletions(-)
===================================================================
@@ -3,20 +3,22 @@
// Copyright 1998-2004 by Neil Hodgson <neilh at scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <time.h>
-#include <math.h>
-#include <assert.h>
-#include <ctype.h>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+#include <cstring>
+#include <cctype>
+#include <cstdio>
+#include <ctime>
+#include <cmath>
#include <stdexcept>
#include <new>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
+#include <memory>
#include <glib.h>
#include <gmodule.h>
@@ -44,6 +46,7 @@
#include "LexerModule.h"
#endif
#include "Position.h"
+#include "UniqueString.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
@@ -174,6 +177,7 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) :
rgnUpdate(0),
repaintFullWindow(false),
styleIdleID(0),
+ accessibilityEnabled(SC_ACCESSIBILITY_ENABLED),
accessible(0) {
sci = sci_;
wMain = GTK_WIDGET(sci);
@@ -202,7 +206,7 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) :
lastWheelMouseTime.tv_sec = 0;
lastWheelMouseTime.tv_usec = 0;
- Initialise();
+ Init();
}
ScintillaGTK::~ScintillaGTK() {
@@ -546,8 +550,7 @@ void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) {
}
}
-void ScintillaGTK::Initialise() {
- //Platform::DebugPrintf("ScintillaGTK::Initialise\n");
+void ScintillaGTK::Init() {
parentClass = reinterpret_cast<GtkWidgetClass *>(
g_type_class_ref(gtk_container_get_type()));
@@ -874,6 +877,19 @@ sptr_t ScintillaGTK::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
return ret;
}
+ case SCI_GETACCESSIBILITY:
+ return accessibilityEnabled;
+
+ case SCI_SETACCESSIBILITY:
+ accessibilityEnabled = wParam;
+ if (accessible) {
+ ScintillaGTKAccessible *sciAccessible = ScintillaGTKAccessible::FromAccessible(accessible);
+ if (sciAccessible) {
+ sciAccessible->SetAccessibility();
+ }
+ }
+ break;
+
default:
return ScintillaBase::WndProc(iMessage, wParam, lParam);
}
@@ -1014,17 +1030,19 @@ PRectangle ScintillaGTK::GetClientRectangle() const {
return rc;
}
-void ScintillaGTK::ScrollText(int linesToMove) {
- int diff = vs.lineHeight * -linesToMove;
- //Platform::DebugPrintf("ScintillaGTK::ScrollText %d %d %0d,%0d %0d,%0d\n", linesToMove, diff,
- // rc.left, rc.top, rc.right, rc.bottom);
- GtkWidget *wi = PWidget(wText);
+void ScintillaGTK::ScrollText(Sci::Line linesToMove) {
NotifyUpdateUI();
+#if GTK_CHECK_VERSION(3,22,0)
+ Redraw();
+#else
+ GtkWidget *wi = PWidget(wText);
if (IS_WIDGET_REALIZED(wi)) {
+ const int diff = vs.lineHeight * -linesToMove;
gdk_window_scroll(WindowFromWidget(wi), 0, -diff);
gdk_window_process_updates(WindowFromWidget(wi), FALSE);
}
+#endif
}
void ScintillaGTK::SetVerticalScrollPos() {
@@ -1037,7 +1055,7 @@ void ScintillaGTK::SetHorizontalScrollPos() {
gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmenth), xOffset);
}
-bool ScintillaGTK::ModifyScrollBars(int nMax, int nPage) {
+bool ScintillaGTK::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) {
bool modified = false;
int pageScroll = LinesToScroll();
@@ -1133,7 +1151,7 @@ class CaseFolderDBCS : public CaseFolderTable {
explicit CaseFolderDBCS(const char *charSet_) : charSet(charSet_) {
StandardASCII();
}
- virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) {
+ size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override {
if ((lenMixed == 1) && (sizeFolded > 0)) {
folded[0] = mapping[static_cast<unsigned char>(mixed[0])];
return 1;
@@ -1278,7 +1296,7 @@ void ScintillaGTK::Paste() {
class Helper : GObjectWatcher {
ScintillaGTK *sci;
- virtual void Destroyed() {
+ void Destroyed() override {
sci = 0;
}
@@ -1483,24 +1501,24 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
// GDK on Win32 expands any \n into \r\n, so make a copy of
// the clip text now with newlines converted to \n. Use { } to hide symbols
// from code below
- SelectionText *newline_normalized = NULL;
+ std::unique_ptr<SelectionText> newline_normalized;
{
std::string tmpstr = Document::TransformLineEnds(text->Data(), text->Length(), SC_EOL_LF);
- newline_normalized = new SelectionText();
+ newline_normalized.reset(new SelectionText());
newline_normalized->Copy(tmpstr, SC_CP_UTF8, 0, text->rectangular, false);
- text = newline_normalized;
+ text = newline_normalized.get();
}
#endif
// Convert text to utf8 if it isn't already
- SelectionText *converted = 0;
+ std::unique_ptr<SelectionText> converted;
if ((text->codePage != SC_CP_UTF8) && (info == TARGET_UTF8_STRING)) {
const char *charSet = ::CharacterSetID(text->characterSet);
if (*charSet) {
std::string tmputf = ConvertText(text->Data(), text->Length(), "UTF-8", charSet, false);
- converted = new SelectionText();
+ converted.reset(new SelectionText());
converted->Copy(tmputf, SC_CP_UTF8, 0, text->rectangular, false);
- text = converted;
+ text = converted.get();
}
}
@@ -1525,11 +1543,6 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
static_cast<GdkAtom>(GDK_SELECTION_TYPE_STRING),
8, reinterpret_cast<const unsigned char *>(textData), len);
}
- delete converted;
-
-#if PLAT_GTK_WIN32
- delete newline_normalized;
-#endif
}
void ScintillaGTK::StoreOnClipboard(SelectionText *clipText) {
@@ -1801,7 +1814,7 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget, GdkEventScroll *event) {
return FALSE;
#if defined(GDK_WINDOWING_WAYLAND)
- if (event->direction == GDK_SCROLL_SMOOTH && GDK_IS_WAYLAND_WINDOW (event->window)) {
+ if (event->direction == GDK_SCROLL_SMOOTH && GDK_IS_WAYLAND_WINDOW(event->window)) {
const int smoothScrollFactor = 4;
sciThis->smoothScrollY += event->delta_y * smoothScrollFactor;
sciThis->smoothScrollX += event->delta_x * smoothScrollFactor;;
@@ -2212,7 +2225,7 @@ void ScintillaGTK::DrawImeIndicator(int indicator, int len) {
if (indicator < 8 || indicator > INDIC_MAX) {
return;
}
- pdoc->decorations.SetCurrentIndicator(indicator);
+ pdoc->DecorationSetCurrentIndicator(indicator);
for (size_t r=0; r<sel.Count(); r++) {
int positionInsert = sel.Range(r).Start().Position();
pdoc->DecorationFillRange(positionInsert - len, 1, len);
@@ -2323,12 +2336,13 @@ void ScintillaGTK::PreeditChangedInlineThis() {
view.imeCaretBlockOverride = false; // If backspace.
+ bool initialCompose = false;
if (pdoc->TentativeActive()) {
pdoc->TentativeUndo();
} else {
// No tentative undo means start of this composition so
// fill in any virtual spaces.
- ClearBeforeTentativeStart();
+ initialCompose = true;
}
PreEditString preeditStr(im_context);
@@ -2345,6 +2359,8 @@ void ScintillaGTK::PreeditChangedInlineThis() {
return;
}
+ if (initialCompose)
+ ClearBeforeTentativeStart();
pdoc->TentativeStart(); // TentativeActive() from now on
std::vector<int> indicator = MapImeIndicators(preeditStr.attrs, preeditStr.str);
@@ -2513,13 +2529,10 @@ gboolean ScintillaGTK::DrawTextThis(cairo_t *cr) {
rcPaint.bottom = y2;
PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient);
- Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
- if (surfaceWindow) {
- surfaceWindow->Init(cr, PWidget(wText));
- Paint(surfaceWindow, rcPaint);
- surfaceWindow->Release();
- delete surfaceWindow;
- }
+ std::unique_ptr<Surface> surfaceWindow(Surface::Allocate(SC_TECHNOLOGY_DEFAULT));
+ surfaceWindow->Init(cr, PWidget(wText));
+ Paint(surfaceWindow.get(), rcPaint);
+ surfaceWindow->Release();
if ((paintState == paintAbandoned) || repaintFullWindow) {
// Painting area was insufficient to cover new styling or brace highlight positions
FullPaint();
@@ -2603,15 +2616,12 @@ gboolean ScintillaGTK::ExposeTextThis(GtkWidget * /*widget*/, GdkEventExpose *os
rgnUpdate = gdk_region_copy(ose->region);
PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient);
- Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
- if (surfaceWindow) {
- cairo_t *cr = gdk_cairo_create(PWindow(wText));
- surfaceWindow->Init(cr, PWidget(wText));
- Paint(surfaceWindow, rcPaint);
- surfaceWindow->Release();
- delete surfaceWindow;
- cairo_destroy(cr);
- }
+ std::unique_ptr<Surface> surfaceWindow(Surface::Allocate(SC_TECHNOLOGY_DEFAULT));
+ cairo_t *cr = gdk_cairo_create(PWindow(wText));
+ surfaceWindow->Init(cr, PWidget(wText));
+ Paint(surfaceWindow.get(), rcPaint);
+ surfaceWindow->Release();
+ cairo_destroy(cr);
if (paintState == paintAbandoned) {
// Painting area was insufficient to cover new styling or brace highlight positions
FullPaint();
@@ -2745,7 +2755,7 @@ gboolean ScintillaGTK::DragMotion(GtkWidget *widget, GdkDragContext *context,
void ScintillaGTK::DragLeave(GtkWidget *widget, GdkDragContext * /*context*/, guint) {
ScintillaGTK *sciThis = FromWidget(widget);
try {
- sciThis->SetDragPosition(SelectionPosition(invalidPosition));
+ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition));
//Platform::DebugPrintf("DragLeave %x\n", sciThis);
} catch (...) {
sciThis->errorStatus = SC_STATUS_FAILURE;
@@ -2758,7 +2768,7 @@ void ScintillaGTK::DragEnd(GtkWidget *widget, GdkDragContext * /*context*/) {
// If drag did not result in drop here or elsewhere
if (!sciThis->dragWasDropped)
sciThis->SetEmptySelection(sciThis->posDrag);
- sciThis->SetDragPosition(SelectionPosition(invalidPosition));
+ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition));
//Platform::DebugPrintf("DragEnd %x %d\n", sciThis, sciThis->dragWasDropped);
sciThis->inDragDrop = ddNone;
} catch (...) {
@@ -2771,7 +2781,7 @@ gboolean ScintillaGTK::Drop(GtkWidget *widget, GdkDragContext * /*context*/,
ScintillaGTK *sciThis = FromWidget(widget);
try {
//Platform::DebugPrintf("Drop %x\n", sciThis);
- sciThis->SetDragPosition(SelectionPosition(invalidPosition));
+ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition));
} catch (...) {
sciThis->errorStatus = SC_STATUS_FAILURE;
}
@@ -2783,7 +2793,7 @@ void ScintillaGTK::DragDataReceived(GtkWidget *widget, GdkDragContext * /*contex
ScintillaGTK *sciThis = FromWidget(widget);
try {
sciThis->ReceivedDrop(selection_data);
- sciThis->SetDragPosition(SelectionPosition(invalidPosition));
+ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition));
} catch (...) {
sciThis->errorStatus = SC_STATUS_FAILURE;
}
@@ -2814,7 +2824,7 @@ void ScintillaGTK::DragDataGet(GtkWidget *widget, GdkDragContext *context,
}
sciThis->ClearSelection();
}
- sciThis->SetDragPosition(SelectionPosition(invalidPosition));
+ sciThis->SetDragPosition(SelectionPosition(Sci::invalidPosition));
} catch (...) {
sciThis->errorStatus = SC_STATUS_FAILURE;
}
@@ -2852,7 +2862,7 @@ void ScintillaGTK::IdleWork() {
styleIdleID = 0;
}
-void ScintillaGTK::QueueIdleWork(WorkNeeded::workItems items, int upTo) {
+void ScintillaGTK::QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) {
Editor::QueueIdleWork(items, upTo);
if (!styleIdleID) {
// Only allow one style needed to be queued
@@ -2909,15 +2919,12 @@ gboolean ScintillaGTK::PressCT(GtkWidget *widget, GdkEventButton *event, Scintil
gboolean ScintillaGTK::DrawCT(GtkWidget *widget, cairo_t *cr, CallTip *ctip) {
try {
- Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
- if (surfaceWindow) {
- surfaceWindow->Init(cr, widget);
- surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
- surfaceWindow->SetDBCSMode(ctip->codePage);
- ctip->PaintCT(surfaceWindow);
- surfaceWindow->Release();
- delete surfaceWindow;
- }
+ std::unique_ptr<Surface> surfaceWindow(Surface::Allocate(SC_TECHNOLOGY_DEFAULT));
+ surfaceWindow->Init(cr, widget);
+ surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
+ surfaceWindow->SetDBCSMode(ctip->codePage);
+ ctip->PaintCT(surfaceWindow.get());
+ surfaceWindow->Release();
} catch (...) {
// No pointer back to Scintilla to save status
}
@@ -2928,17 +2935,14 @@ gboolean ScintillaGTK::DrawCT(GtkWidget *widget, cairo_t *cr, CallTip *ctip) {
gboolean ScintillaGTK::ExposeCT(GtkWidget *widget, GdkEventExpose * /*ose*/, CallTip *ctip) {
try {
- Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
- if (surfaceWindow) {
- cairo_t *cr = gdk_cairo_create(WindowFromWidget(widget));
- surfaceWindow->Init(cr, widget);
- surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
- surfaceWindow->SetDBCSMode(ctip->codePage);
- ctip->PaintCT(surfaceWindow);
- surfaceWindow->Release();
- delete surfaceWindow;
- cairo_destroy(cr);
- }
+ std::unique_ptr<Surface> surfaceWindow(Surface::Allocate(SC_TECHNOLOGY_DEFAULT));
+ cairo_t *cr = gdk_cairo_create(WindowFromWidget(widget));
+ surfaceWindow->Init(cr, widget);
+ surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
+ surfaceWindow->SetDBCSMode(ctip->codePage);
+ ctip->PaintCT(surfaceWindow.get());
+ surfaceWindow->Release();
+ cairo_destroy(cr);
} catch (...) {
// No pointer back to Scintilla to save status
}
@@ -3027,7 +3031,7 @@ void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_
// Define default signal handlers for the class: Could move more
// of the signal handlers here (those that currently attached to wDraw
- // in Initialise() may require coordinate translation?)
+ // in Init() may require coordinate translation?)
object_class->dispose = Dispose;
object_class->finalize = Destroy;
Modified: scintilla/gtk/ScintillaGTK.h
90 lines changed, 45 insertions(+), 45 deletions(-)
===================================================================
@@ -68,73 +68,73 @@ class ScintillaGTK : public ScintillaBase {
bool repaintFullWindow;
guint styleIdleID;
+ int accessibilityEnabled;
AtkObject *accessible;
- // Private so ScintillaGTK objects can not be copied
- ScintillaGTK(const ScintillaGTK &);
- ScintillaGTK &operator=(const ScintillaGTK &);
-
public:
explicit ScintillaGTK(_ScintillaObject *sci_);
+ // Deleted so ScintillaGTK objects can not be copied.
+ ScintillaGTK(const ScintillaGTK &) = delete;
+ ScintillaGTK &operator=(const ScintillaGTK &) = delete;
virtual ~ScintillaGTK();
static ScintillaGTK *FromWidget(GtkWidget *widget);
static void ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class);
private:
- virtual void Initialise();
- virtual void Finalise();
- virtual bool AbandonPaint();
- virtual void DisplayCursor(Window::Cursor c);
- virtual bool DragThreshold(Point ptStart, Point ptNow);
- virtual void StartDrag();
+ void Init();
+ void Finalise() override;
+ bool AbandonPaint() override;
+ void DisplayCursor(Window::Cursor c) override;
+ bool DragThreshold(Point ptStart, Point ptNow) override;
+ void StartDrag() override;
int TargetAsUTF8(char *text);
int EncodedFromUTF8(char *utf8, char *encoded) const;
- virtual bool ValidCodePage(int codePage) const;
+ bool ValidCodePage(int codePage) const override;
public: // Public for scintilla_send_message
- virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+ sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
private:
- virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+ sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
struct TimeThunk {
TickReason reason;
ScintillaGTK *scintilla;
guint timer;
TimeThunk() : reason(tickCaret), scintilla(NULL), timer(0) {}
};
TimeThunk timers[tickDwell+1];
- virtual bool FineTickerAvailable();
- virtual bool FineTickerRunning(TickReason reason);
- virtual void FineTickerStart(TickReason reason, int millis, int tolerance);
- virtual void FineTickerCancel(TickReason reason);
- virtual bool SetIdle(bool on);
- virtual void SetMouseCapture(bool on);
- virtual bool HaveMouseCapture();
- virtual bool PaintContains(PRectangle rc);
+ bool FineTickerAvailable() override;
+ bool FineTickerRunning(TickReason reason) override;
+ void FineTickerStart(TickReason reason, int millis, int tolerance) override;
+ void FineTickerCancel(TickReason reason) override;
+ bool SetIdle(bool on) override;
+ void SetMouseCapture(bool on) override;
+ bool HaveMouseCapture() override;
+ bool PaintContains(PRectangle rc) override;
void FullPaint();
- virtual PRectangle GetClientRectangle() const;
- virtual void ScrollText(int linesToMove);
- virtual void SetVerticalScrollPos();
- virtual void SetHorizontalScrollPos();
- virtual bool ModifyScrollBars(int nMax, int nPage);
- void ReconfigureScrollBars();
- virtual void NotifyChange();
- virtual void NotifyFocus(bool focus);
- virtual void NotifyParent(SCNotification scn);
+ PRectangle GetClientRectangle() const override;
+ void ScrollText(Sci::Line linesToMove) override;
+ void SetVerticalScrollPos() override;
+ void SetHorizontalScrollPos() override;
+ bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) override;
+ void ReconfigureScrollBars() override;
+ void NotifyChange() override;
+ void NotifyFocus(bool focus) override;
+ void NotifyParent(SCNotification scn) override;
void NotifyKey(int key, int modifiers);
void NotifyURIDropped(const char *list);
const char *CharacterSetID() const;
- virtual CaseFolder *CaseFolderForEncoding();
- virtual std::string CaseMapString(const std::string &s, int caseMapping);
- virtual int KeyDefault(int key, int modifiers);
- virtual void CopyToClipboard(const SelectionText &selectedText);
- virtual void Copy();
- virtual void Paste();
- virtual void CreateCallTipWindow(PRectangle rc);
- virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
+ CaseFolder *CaseFolderForEncoding() override;
+ std::string CaseMapString(const std::string &s, int caseMapping) override;
+ int KeyDefault(int key, int modifiers) override;
+ void CopyToClipboard(const SelectionText &selectedText) override;
+ void Copy() override;
+ void Paste() override;
+ void CreateCallTipWindow(PRectangle rc) override;
+ void AddToPopUp(const char *label, int cmd = 0, bool enabled = true) override;
bool OwnPrimarySelection();
- virtual void ClaimSelection();
+ void ClaimSelection() override;
void GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText);
void ReceivedSelection(GtkSelectionData *selection_data);
void ReceivedDrop(GtkSelectionData *selection_data);
- static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *selected);
+ static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *text);
void StoreOnClipboard(SelectionText *clipText);
static void ClipboardGetSelection(GtkClipboard* clip, GtkSelectionData *selection_data, guint info, void *data);
static void ClipboardClearSelection(GtkClipboard* clip, void *data);
@@ -196,7 +196,7 @@ class ScintillaGTK : public ScintillaBase {
static AtkObject* GetAccessible(GtkWidget *widget);
bool KoreanIME();
- void CommitThis(char *str);
+ void CommitThis(char *commitStr);
static void Commit(GtkIMContext *context, char *str, ScintillaGTK *sciThis);
void PreeditChangedInlineThis();
void PreeditChangedWindowedThis();
@@ -229,15 +229,15 @@ class ScintillaGTK : public ScintillaBase {
static gboolean TimeOut(gpointer ptt);
static gboolean IdleCallback(gpointer pSci);
static gboolean StyleIdle(gpointer pSci);
- virtual void IdleWork();
- virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo);
- virtual void SetDocPointer(Document *document);
+ void IdleWork() override;
+ void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) override;
+ void SetDocPointer(Document *document) override;
static void PopUpCB(GtkMenuItem *menuItem, ScintillaGTK *sciThis);
#if GTK_CHECK_VERSION(3,0,0)
static gboolean DrawCT(GtkWidget *widget, cairo_t *cr, CallTip *ctip);
#else
- static gboolean ExposeCT(GtkWidget *widget, GdkEventExpose *ose, CallTip *ct);
+ static gboolean ExposeCT(GtkWidget *widget, GdkEventExpose *ose, CallTip *ctip);
#endif
static gboolean PressCT(GtkWidget *widget, GdkEventButton *event, ScintillaGTK *sciThis);
Modified: scintilla/gtk/ScintillaGTKAccessible.cxx
83 lines changed, 51 insertions(+), 32 deletions(-)
===================================================================
@@ -51,15 +51,17 @@
// FIXME: optimize character/byte offset conversion (with a cache?)
-#include <stdlib.h>
-#include <string.h>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
#include <stdexcept>
#include <new>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
+#include <memory>
#include <glib.h>
#include <gtk/gtk.h>
@@ -93,6 +95,7 @@
#include "LexerModule.h"
#endif
#include "Position.h"
+#include "UniqueString.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
@@ -167,7 +170,7 @@ ScintillaGTKAccessible::~ScintillaGTKAccessible() {
}
}
-gchar *ScintillaGTKAccessible::GetTextRangeUTF8(Position startByte, Position endByte) {
+gchar *ScintillaGTKAccessible::GetTextRangeUTF8(Sci::Position startByte, Sci::Position endByte) {
g_return_val_if_fail(startByte >= 0, NULL);
// FIXME: should we swap start/end if necessary?
g_return_val_if_fail(endByte >= startByte, NULL);
@@ -195,7 +198,7 @@ gchar *ScintillaGTKAccessible::GetTextRangeUTF8(Position startByte, Position end
}
gchar *ScintillaGTKAccessible::GetText(int startChar, int endChar) {
- Position startByte, endByte;
+ Sci::Position startByte, endByte;
if (endChar == -1) {
startByte = ByteOffsetFromCharacterOffset(startChar);
endByte = sci->pdoc->Length();
@@ -209,8 +212,8 @@ gchar *ScintillaGTKAccessible::GetTextAfterOffset(int charOffset,
AtkTextBoundary boundaryType, int *startChar, int *endChar) {
g_return_val_if_fail(charOffset >= 0, NULL);
- Position startByte, endByte;
- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
+ Sci::Position startByte, endByte;
+ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
switch (boundaryType) {
case ATK_TEXT_BOUNDARY_CHAR:
@@ -260,8 +263,8 @@ gchar *ScintillaGTKAccessible::GetTextBeforeOffset(int charOffset,
AtkTextBoundary boundaryType, int *startChar, int *endChar) {
g_return_val_if_fail(charOffset >= 0, NULL);
- Position startByte, endByte;
- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
+ Sci::Position startByte, endByte;
+ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
switch (boundaryType) {
case ATK_TEXT_BOUNDARY_CHAR:
@@ -322,8 +325,8 @@ gchar *ScintillaGTKAccessible::GetTextAtOffset(int charOffset,
AtkTextBoundary boundaryType, int *startChar, int *endChar) {
g_return_val_if_fail(charOffset >= 0, NULL);
- Position startByte, endByte;
- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
+ Sci::Position startByte, endByte;
+ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
switch (boundaryType) {
case ATK_TEXT_BOUNDARY_CHAR:
@@ -385,8 +388,8 @@ gchar *ScintillaGTKAccessible::GetStringAtOffset(int charOffset,
AtkTextGranularity granularity, int *startChar, int *endChar) {
g_return_val_if_fail(charOffset >= 0, NULL);
- Position startByte, endByte;
- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
+ Sci::Position startByte, endByte;
+ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
switch (granularity) {
case ATK_TEXT_GRANULARITY_CHAR:
@@ -416,8 +419,8 @@ gchar *ScintillaGTKAccessible::GetStringAtOffset(int charOffset,
gunichar ScintillaGTKAccessible::GetCharacterAtOffset(int charOffset) {
g_return_val_if_fail(charOffset >= 0, 0);
- Position startByte = ByteOffsetFromCharacterOffset(charOffset);
- Position endByte = PositionAfter(startByte);
+ Sci::Position startByte = ByteOffsetFromCharacterOffset(charOffset);
+ Sci::Position endByte = PositionAfter(startByte);
gchar *ch = GetTextRangeUTF8(startByte, endByte);
gunichar unichar = g_utf8_get_char_validated(ch, -1);
g_free(ch);
@@ -465,7 +468,7 @@ void ScintillaGTKAccessible::GetCharacterExtents(int charOffset,
gint *x, gint *y, gint *width, gint *height, AtkCoordType coords) {
*x = *y = *height = *width = 0;
- Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
+ Sci::Position byteOffset = ByteOffsetFromCharacterOffset(charOffset);
// FIXME: should we handle scrolling?
*x = sci->WndProc(SCI_POINTXFROMPOSITION, 0, byteOffset);
@@ -549,7 +552,7 @@ AtkAttributeSet *ScintillaGTKAccessible::GetAttributesForStyle(unsigned int styl
AtkAttributeSet *ScintillaGTKAccessible::GetRunAttributes(int charOffset, int *startChar, int *endChar) {
g_return_val_if_fail(charOffset >= -1, NULL);
- Position byteOffset;
+ Sci::Position byteOffset;
if (charOffset == -1) {
byteOffset = sci->WndProc(SCI_GETCURRENTPOS, 0, 0);
} else {
@@ -561,11 +564,11 @@ AtkAttributeSet *ScintillaGTKAccessible::GetRunAttributes(int charOffset, int *s
const char style = StyleAt(byteOffset, true);
// compute the range for this style
- Position startByte = byteOffset;
+ Sci::Position startByte = byteOffset;
// when going backwards, we know the style is already computed
while (startByte > 0 && sci->pdoc->StyleAt((startByte) - 1) == style)
(startByte)--;
- Position endByte = byteOffset + 1;
+ Sci::Position endByte = byteOffset + 1;
while (endByte < length && StyleAt(endByte, true) == style)
(endByte)++;
@@ -585,16 +588,16 @@ gchar *ScintillaGTKAccessible::GetSelection(gint selection_num, int *startChar,
if (selection_num < 0 || (unsigned int) selection_num >= sci->sel.Count())
return NULL;
- Position startByte = sci->sel.Range(selection_num).Start().Position();
- Position endByte = sci->sel.Range(selection_num).End().Position();
+ Sci::Position startByte = sci->sel.Range(selection_num).Start().Position();
+ Sci::Position endByte = sci->sel.Range(selection_num).End().Position();
CharacterRangeFromByteRange(startByte, endByte, startChar, endChar);
return GetTextRangeUTF8(startByte, endByte);
}
gboolean ScintillaGTKAccessible::AddSelection(int startChar, int endChar) {
size_t n_selections = sci->sel.Count();
- Position startByte, endByte;
+ Sci::Position startByte, endByte;
ByteRangeFromCharacterRange(startChar, endChar, startByte, endByte);
// use WndProc() to set the selections so it notifies as needed
if (n_selections > 1 || ! sci->sel.Empty()) {
@@ -626,7 +629,7 @@ gboolean ScintillaGTKAccessible::SetSelection(gint selection_num, int startChar,
if (selection_num < 0 || (unsigned int) selection_num >= sci->sel.Count())
return FALSE;
- Position startByte, endByte;
+ Sci::Position startByte, endByte;
ByteRangeFromCharacterRange(startChar, endChar, startByte, endByte);
sci->WndProc(SCI_SETSELECTIONNSTART, selection_num, startByte);
@@ -667,7 +670,7 @@ void ScintillaGTKAccessible::SetTextContents(const gchar *contents) {
}
}
-bool ScintillaGTKAccessible::InsertStringUTF8(Position bytePos, const gchar *utf8, int lengthBytes) {
+bool ScintillaGTKAccessible::InsertStringUTF8(Sci::Position bytePos, const gchar *utf8, Sci::Position lengthBytes) {
if (sci->pdoc->IsReadOnly()) {
return false;
}
@@ -687,7 +690,7 @@ bool ScintillaGTKAccessible::InsertStringUTF8(Position bytePos, const gchar *utf
}
void ScintillaGTKAccessible::InsertText(const gchar *text, int lengthBytes, int *charPosition) {
- Position bytePosition = ByteOffsetFromCharacterOffset(*charPosition);
+ Sci::Position bytePosition = ByteOffsetFromCharacterOffset(*charPosition);
// FIXME: should we update the target?
if (InsertStringUTF8(bytePosition, text, lengthBytes)) {
@@ -696,7 +699,7 @@ void ScintillaGTKAccessible::InsertText(const gchar *text, int lengthBytes, int
}
void ScintillaGTKAccessible::CopyText(int startChar, int endChar) {
- Position startByte, endByte;
+ Sci::Position startByte, endByte;
ByteRangeFromCharacterRange(startChar, endChar, startByte, endByte);
sci->CopyRangeToClipboard(startByte, endByte);
}
@@ -715,7 +718,7 @@ void ScintillaGTKAccessible::DeleteText(int startChar, int endChar) {
g_return_if_fail(endChar >= startChar);
if (! sci->pdoc->IsReadOnly()) {
- Position startByte, endByte;
+ Sci::Position startByte, endByte;
ByteRangeFromCharacterRange(startChar, endChar, startByte, endByte);
if (! sci->RangeContainsProtected(startByte, endByte)) {
@@ -734,13 +737,13 @@ void ScintillaGTKAccessible::PasteText(int charPosition) {
// has always done that without problems, so let's guess it's a fairly safe bet.
struct Helper : GObjectWatcher {
ScintillaGTKAccessible *scia;
- Position bytePosition;
+ Sci::Position bytePosition;
- virtual void Destroyed() {
+ void Destroyed() override {
scia = 0;
}
- Helper(ScintillaGTKAccessible *scia_, Position bytePos_) :
+ Helper(ScintillaGTKAccessible *scia_, Sci::Position bytePos_) :
GObjectWatcher(G_OBJECT(scia_->sci->sci)),
scia(scia_),
bytePosition(bytePos_) {
@@ -756,7 +759,7 @@ void ScintillaGTKAccessible::PasteText(int charPosition) {
len = convertedText.length();
text = convertedText.c_str();
}
- scia->InsertStringUTF8(bytePosition, text, static_cast<int>(len));
+ scia->InsertStringUTF8(bytePosition, text, static_cast<Sci::Position>(len));
}
}
@@ -787,10 +790,14 @@ void ScintillaGTKAccessible::AtkEditableTextIface::init(::AtkEditableTextIface *
//~ iface->set_run_attributes = SetRunAttributes;
}
+bool ScintillaGTKAccessible::Enabled() const {
+ return sci->accessibilityEnabled == SC_ACCESSIBILITY_ENABLED;
+}
+
// Callbacks
void ScintillaGTKAccessible::UpdateCursor() {
- Position pos = sci->WndProc(SCI_GETCURRENTPOS, 0, 0);
+ Sci::Position pos = sci->WndProc(SCI_GETCURRENTPOS, 0, 0);
if (old_pos != pos) {
int charPosition = CharacterOffsetFromByteOffset(pos);
g_signal_emit_by_name(accessible, "text-caret-moved", charPosition);
@@ -819,6 +826,10 @@ void ScintillaGTKAccessible::UpdateCursor() {
}
void ScintillaGTKAccessible::ChangeDocument(Document *oldDoc, Document *newDoc) {
+ if (!Enabled()) {
+ return;
+ }
+
if (oldDoc == newDoc) {
return;
}
@@ -853,12 +864,20 @@ void ScintillaGTKAccessible::NotifyReadOnly() {
#endif
}
+void ScintillaGTKAccessible::SetAccessibility() {
+ // Called by ScintillaGTK when application has enabled or disabled accessibility
+ character_offsets.resize(0);
+ character_offsets.push_back(0);
+}
+
void ScintillaGTKAccessible::Notify(GtkWidget *, gint, SCNotification *nt) {
+ if (!Enabled())
+ return;
switch (nt->nmhdr.code) {
case SCN_MODIFIED: {
if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) {
// invalidate character offset cache if applicable
- const Position line = sci->pdoc->LineFromPosition(nt->position);
+ const Sci::Line line = sci->pdoc->LineFromPosition(nt->position);
if (character_offsets.size() > static_cast<size_t>(line + 1)) {
character_offsets.resize(line + 1);
}
Modified: scintilla/gtk/ScintillaGTKAccessible.h
44 lines changed, 23 insertions(+), 21 deletions(-)
===================================================================
@@ -21,14 +21,15 @@ class ScintillaGTKAccessible {
ScintillaGTK *sci;
// cache holding character offset for each line start, see CharacterOffsetFromByteOffset()
- std::vector<Position> character_offsets;
+ std::vector<Sci::Position> character_offsets;
// cached length of the deletion, in characters (see Notify())
int deletionLengthChar;
// local state for comparing
- Position old_pos;
+ Sci::Position old_pos;
std::vector<SelectionRange> old_sels;
+ bool Enabled() const;
void UpdateCursor();
void Notify(GtkWidget *widget, gint code, SCNotification *nt);
static void SciNotify(GtkWidget *widget, gint code, SCNotification *nt, gpointer data) {
@@ -37,8 +38,8 @@ class ScintillaGTKAccessible {
} catch (...) {}
}
- Position ByteOffsetFromCharacterOffset(Position startByte, int characterOffset) {
- Position pos = sci->pdoc->GetRelativePosition(startByte, characterOffset);
+ Sci::Position ByteOffsetFromCharacterOffset(Sci::Position startByte, int characterOffset) {
+ Sci::Position pos = sci->pdoc->GetRelativePosition(startByte, characterOffset);
if (pos == INVALID_POSITION) {
// clamp invalid positions inside the document
if (characterOffset > 0) {
@@ -50,51 +51,51 @@ class ScintillaGTKAccessible {
return pos;
}
- Position ByteOffsetFromCharacterOffset(int characterOffset) {
+ Sci::Position ByteOffsetFromCharacterOffset(Sci::Position characterOffset) {
return ByteOffsetFromCharacterOffset(0, characterOffset);
}
- int CharacterOffsetFromByteOffset(Position byteOffset) {
- const Position line = sci->pdoc->LineFromPosition(byteOffset);
+ Sci::Position CharacterOffsetFromByteOffset(Sci::Position byteOffset) {
+ const Sci::Line line = sci->pdoc->LineFromPosition(byteOffset);
if (character_offsets.size() <= static_cast<size_t>(line)) {
if (character_offsets.empty())
character_offsets.push_back(0);
- for (Position i = character_offsets.size(); i <= line; i++) {
- const Position start = sci->pdoc->LineStart(i - 1);
- const Position end = sci->pdoc->LineStart(i);
+ for (Sci::Position i = character_offsets.size(); i <= line; i++) {
+ const Sci::Position start = sci->pdoc->LineStart(i - 1);
+ const Sci::Position end = sci->pdoc->LineStart(i);
character_offsets.push_back(character_offsets[i - 1] + sci->pdoc->CountCharacters(start, end));
}
}
- const Position lineStart = sci->pdoc->LineStart(line);
+ const Sci::Position lineStart = sci->pdoc->LineStart(line);
return character_offsets[line] + sci->pdoc->CountCharacters(lineStart, byteOffset);
}
- void CharacterRangeFromByteRange(Position startByte, Position endByte, int *startChar, int *endChar) {
+ void CharacterRangeFromByteRange(Sci::Position startByte, Sci::Position endByte, int *startChar, int *endChar) {
*startChar = CharacterOffsetFromByteOffset(startByte);
*endChar = *startChar + sci->pdoc->CountCharacters(startByte, endByte);
}
- void ByteRangeFromCharacterRange(int startChar, int endChar, Position& startByte, Position& endByte) {
+ void ByteRangeFromCharacterRange(int startChar, int endChar, Sci::Position& startByte, Sci::Position& endByte) {
startByte = ByteOffsetFromCharacterOffset(startChar);
endByte = ByteOffsetFromCharacterOffset(startByte, endChar - startChar);
}
- Position PositionBefore(Position pos) {
+ Sci::Position PositionBefore(Sci::Position pos) {
return sci->pdoc->MovePositionOutsideChar(pos - 1, -1, true);
}
- Position PositionAfter(Position pos) {
+ Sci::Position PositionAfter(Sci::Position pos) {
return sci->pdoc->MovePositionOutsideChar(pos + 1, 1, true);
}
- int StyleAt(Position position, bool ensureStyle = false) {
+ int StyleAt(Sci::Position position, bool ensureStyle = false) {
if (ensureStyle)
sci->pdoc->EnsureStyledTo(position);
return sci->pdoc->StyleAt(position);
}
// For AtkText
- gchar *GetTextRangeUTF8(Position startByte, Position endByte);
+ gchar *GetTextRangeUTF8(Sci::Position startByte, Sci::Position endByte);
gchar *GetText(int startChar, int endChar);
gchar *GetTextAfterOffset(int charOffset, AtkTextBoundary boundaryType, int *startChar, int *endChar);
gchar *GetTextBeforeOffset(int charOffset, AtkTextBoundary boundaryType, int *startChar, int *endChar);
@@ -108,7 +109,7 @@ class ScintillaGTKAccessible {
gboolean SetCaretOffset(int charOffset);
gint GetOffsetAtPoint(gint x, gint y, AtkCoordType coords);
void GetCharacterExtents(int charOffset, gint *x, gint *y, gint *width, gint *height, AtkCoordType coords);
- AtkAttributeSet *GetAttributesForStyle(unsigned int style);
+ AtkAttributeSet *GetAttributesForStyle(unsigned int styleNum);
AtkAttributeSet *GetRunAttributes(int charOffset, int *startChar, int *endChar);
AtkAttributeSet *GetDefaultAttributes();
gint GetNSelections();
@@ -117,16 +118,16 @@ class ScintillaGTKAccessible {
gboolean RemoveSelection(int selection_num);
gboolean SetSelection(gint selection_num, int startChar, int endChar);
// for AtkEditableText
- bool InsertStringUTF8(Position bytePos, const gchar *utf8, int lengthBytes);
+ bool InsertStringUTF8(Sci::Position bytePos, const gchar *utf8, Sci::Position lengthBytes);
void SetTextContents(const gchar *contents);
- void InsertText(const gchar *contents, int lengthBytes, int *charPosition);
+ void InsertText(const gchar *text, int lengthBytes, int *charPosition);
void CopyText(int startChar, int endChar);
void CutText(int startChar, int endChar);
void DeleteText(int startChar, int endChar);
void PasteText(int charPosition);
public:
- ScintillaGTKAccessible(GtkAccessible *accessible, GtkWidget *widget);
+ ScintillaGTKAccessible(GtkAccessible *accessible_, GtkWidget *widget_);
~ScintillaGTKAccessible();
static ScintillaGTKAccessible *FromAccessible(GtkAccessible *accessible);
@@ -136,6 +137,7 @@ class ScintillaGTKAccessible {
// So ScintillaGTK can notify us
void ChangeDocument(Document *oldDoc, Document *newDoc);
void NotifyReadOnly();
+ void SetAccessibility();
// Helper GtkWidget methods
static AtkObject *WidgetGetAccessibleImpl(GtkWidget *widget, AtkObject **cache, gpointer widget_parent_class);
Modified: scintilla/include/Platform.h
12 lines changed, 10 insertions(+), 2 deletions(-)
===================================================================
@@ -78,7 +78,7 @@ namespace Scintilla {
typedef float XYPOSITION;
typedef double XYACCUMULATOR;
inline int RoundXYPosition(XYPOSITION xyPos) {
- return int(xyPos + 0.5);
+ return static_cast<int>(xyPos + 0.5);
}
// Underlying the implementation of the platform classes are platform specific types.
@@ -136,7 +136,7 @@ class PRectangle {
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
- bool operator==(PRectangle &rc) const {
+ bool operator==(const PRectangle &rc) const {
return (rc.left == left) && (rc.right == right) &&
(rc.top == top) && (rc.bottom == bottom);
}
@@ -363,6 +363,14 @@ class Window {
virtual ~Window();
Window &operator=(WindowID wid_) {
wid = wid_;
+ cursorLast = cursorInvalid;
+ return *this;
+ }
+ Window &operator=(const Window &other) {
+ if (this != &other) {
+ wid = other.wid;
+ cursorLast = other.cursorLast;
+ }
return *this;
}
WindowID GetID() const { return wid; }
Modified: scintilla/include/SciLexer.h
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -134,6 +134,7 @@
#define SCLEX_TEHEX 119
#define SCLEX_JSON 120
#define SCLEX_EDIFACT 121
+#define SCLEX_INDENT 122
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
Modified: scintilla/include/Scintilla.h
7 lines changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -329,6 +329,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETCARETLINEVISIBLE 2096
#define SCI_GETCARETLINEBACK 2097
#define SCI_SETCARETLINEBACK 2098
+#define SCI_GETCARETLINEFRAME 2704
+#define SCI_SETCARETLINEFRAME 2705
#define SCI_STYLESETCHANGEABLE 2099
#define SCI_AUTOCSHOW 2100
#define SCI_AUTOCCANCEL 2101
@@ -593,6 +595,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_LINESSPLIT 2289
#define SCI_SETFOLDMARGINCOLOUR 2290
#define SCI_SETFOLDMARGINHICOLOUR 2291
+#define SC_ACCESSIBILITY_DISABLED 0
+#define SC_ACCESSIBILITY_ENABLED 1
+#define SCI_SETACCESSIBILITY 2702
+#define SCI_GETACCESSIBILITY 2703
#define SCI_LINEDOWN 2300
#define SCI_LINEDOWNEXTEND 2301
#define SCI_LINEUP 2302
@@ -634,6 +640,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_LINECUT 2337
#define SCI_LINEDELETE 2338
#define SCI_LINETRANSPOSE 2339
+#define SCI_LINEREVERSE 2354
#define SCI_LINEDUPLICATE 2404
#define SCI_LOWERCASE 2340
#define SCI_UPPERCASE 2341
Modified: scintilla/include/Scintilla.iface
36 lines changed, 31 insertions(+), 5 deletions(-)
===================================================================
@@ -415,8 +415,7 @@ set void SetMargins=2252(int margins,)
# How many margins are there?.
get int GetMargins=2253(,)
-# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
-# Style 39 is for future use.
+# Styles in range 32..39 are predefined for parts of the UI and are not used as normal styles.
enu StylesCommon=STYLE_
val STYLE_DEFAULT=32
val STYLE_LINENUMBER=33
@@ -732,6 +731,14 @@ get colour GetCaretLineBack=2097(,)
# Set the colour of the background of the line containing the caret.
set void SetCaretLineBack=2098(colour back,)
+# Retrieve the caret line frame width.
+# Width = 0 means this option is disabled.
+get int GetCaretLineFrame=2704(,)
+
+# Display the caret line framed.
+# Set width != 0 to enable this option and width = 0 to disable it.
+set void SetCaretLineFrame=2705(int width,)
+
# Set a style to be changeable or not (read only).
# Experimental feature, currently buggy.
set void StyleSetChangeable=2099(int style, bool changeable)
@@ -1215,7 +1222,7 @@ fun void ToggleFold=2231(int line,)
# Switch a header line between expanded and contracted and show some text after the line.
fun void ToggleFoldShowText=2700(int line, string text)
-enu foldDisplayTextStyle=SC_FOLDDISPLAYTEXTSTYLE_
+enu FoldDisplayTextStyle=SC_FOLDDISPLAYTEXT_
val SC_FOLDDISPLAYTEXT_HIDDEN=0
val SC_FOLDDISPLAYTEXT_STANDARD=1
val SC_FOLDDISPLAYTEXT_BOXED=2
@@ -1477,6 +1484,16 @@ fun void SetFoldMarginColour=2290(bool useSetting, colour back)
# Set the other colour used as a chequerboard pattern in the fold margin
fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore)
+enu Accessibility=SC_ACCESSIBILITY_
+val SC_ACCESSIBILITY_DISABLED=0
+val SC_ACCESSIBILITY_ENABLED=1
+
+# Enable or disable accessibility.
+set void SetAccessibility=2702(int accessibility,)
+
+# Report accessibility status.
+get int GetAccessibility=2703(,)
+
## New messages go here
## Start of key messages
@@ -1605,6 +1622,9 @@ fun void LineDelete=2338(,)
# Switch the current line with the previous.
fun void LineTranspose=2339(,)
+# Reverse order of selected lines.
+fun void LineReverse=2354(,)
+
# Duplicate the current line.
fun void LineDuplicate=2404(,)
@@ -1832,6 +1852,7 @@ fun void WordPartRight=2392(,)
fun void WordPartRightExtend=2393(,)
# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy.
+enu VisiblePolicy=VISIBLE_
val VISIBLE_SLOP=0x01
val VISIBLE_STRICT=0x04
# Set the way the display area is determined when a particular line
@@ -1844,8 +1865,10 @@ fun void DelLineLeft=2395(,)
# Delete forwards from the current position to the end of the line.
fun void DelLineRight=2396(,)
-# Get and Set the xOffset (ie, horizontal scroll position).
+# Set the xOffset (ie, horizontal scroll position).
set void SetXOffset=2397(int xOffset,)
+
+# Get the xOffset (ie, horizontal scroll position).
get int GetXOffset=2398(,)
# Set the last x chosen value to be the caret x position.
@@ -2117,6 +2140,7 @@ get bool GetPasteConvertEndings=2468(,)
# Duplicate the selection. If selection empty duplicate the line containing the caret.
fun void SelectionDuplicate=2469(,)
+enu Alpha=SC_ALPHA_
val SC_ALPHA_TRANSPARENT=0
val SC_ALPHA_OPAQUE=255
val SC_ALPHA_NOALPHA=256
@@ -2515,6 +2539,7 @@ fun void ScrollToStart=2628(,)
# Scroll to end of document.
fun void ScrollToEnd=2629(,)
+enu Technology=SC_TECHNOLOGY_
val SC_TECHNOLOGY_DEFAULT=0
val SC_TECHNOLOGY_DIRECTWRITE=1
val SC_TECHNOLOGY_DIRECTWRITERETAIN=2
@@ -2891,6 +2916,7 @@ val SCLEX_IHEX=118
val SCLEX_TEHEX=119
val SCLEX_JSON=120
val SCLEX_EDIFACT=121
+val SCLEX_INDENT=122
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -4811,7 +4837,7 @@ evt void MacroRecord=2009(int message, int wParam, int lParam)
evt void MarginClick=2010(int modifiers, int position, int margin)
evt void NeedShown=2011(int position, int length)
evt void Painted=2013(void)
-evt void UserListSelection=2014(int listType, string text, int positionint, int ch, CompletionMethods listCompletionMethod)
+evt void UserListSelection=2014(int listType, string text, int position, int ch, CompletionMethods listCompletionMethod)
evt void URIDropped=2015(string text)
evt void DwellStart=2016(int position, int x, int y)
evt void DwellEnd=2017(int position, int x, int y)
Modified: scintilla/lexers/LexAsm.cxx
22 lines changed, 11 insertions(+), 11 deletions(-)
===================================================================
@@ -157,30 +157,30 @@ class LexerAsm : public ILexer {
}
virtual ~LexerAsm() {
}
- void SCI_METHOD Release() {
+ void SCI_METHOD Release() override {
delete this;
}
- int SCI_METHOD Version() const {
+ int SCI_METHOD Version() const override {
return lvOriginal;
}
- const char * SCI_METHOD PropertyNames() {
+ const char * SCI_METHOD PropertyNames() override {
return osAsm.PropertyNames();
}
- int SCI_METHOD PropertyType(const char *name) {
+ int SCI_METHOD PropertyType(const char *name) override {
return osAsm.PropertyType(name);
}
- const char * SCI_METHOD DescribeProperty(const char *name) {
+ const char * SCI_METHOD DescribeProperty(const char *name) override {
return osAsm.DescribeProperty(name);
}
- Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
- const char * SCI_METHOD DescribeWordListSets() {
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
+ const char * SCI_METHOD DescribeWordListSets() override {
return osAsm.DescribeWordListSets();
}
- Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
- void * SCI_METHOD PrivateCall(int, void *) {
+ void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
Modified: scintilla/lexers/LexBash.cxx
17 lines changed, 15 insertions(+), 2 deletions(-)
===================================================================
@@ -97,13 +97,26 @@ static int opposite(int ch) {
}
static int GlobScan(StyleContext &sc) {
- // forward scan for a glob-like (...), no whitespace allowed
+ // forward scan for zsh globs, disambiguate versus bash arrays
+ // complex expressions may still fail, e.g. unbalanced () '' "" etc
int c, sLen = 0;
+ int pCount = 0;
+ int hash = 0;
while ((c = sc.GetRelativeCharacter(++sLen)) != 0) {
if (IsASpace(c)) {
return 0;
+ } else if (c == '\'' || c == '\"') {
+ if (hash != 2) return 0;
+ } else if (c == '#' && hash == 0) {
+ hash = (sLen == 1) ? 2:1;
+ } else if (c == '(') {
+ pCount++;
} else if (c == ')') {
- return sLen;
+ if (pCount == 0) {
+ if (hash) return sLen;
+ return 0;
+ }
+ pCount--;
}
}
return 0;
Modified: scintilla/lexers/LexBasic.cxx
22 lines changed, 11 insertions(+), 11 deletions(-)
===================================================================
@@ -240,30 +240,30 @@ class LexerBasic : public ILexer {
}
virtual ~LexerBasic() {
}
- void SCI_METHOD Release() {
+ void SCI_METHOD Release() override {
delete this;
}
- int SCI_METHOD Version() const {
+ int SCI_METHOD Version() const override {
return lvOriginal;
}
- const char * SCI_METHOD PropertyNames() {
+ const char * SCI_METHOD PropertyNames() override {
return osBasic.PropertyNames();
}
- int SCI_METHOD PropertyType(const char *name) {
+ int SCI_METHOD PropertyType(const char *name) override {
return osBasic.PropertyType(name);
}
- const char * SCI_METHOD DescribeProperty(const char *name) {
+ const char * SCI_METHOD DescribeProperty(const char *name) override {
return osBasic.DescribeProperty(name);
}
- Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
- const char * SCI_METHOD DescribeWordListSets() {
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
+ const char * SCI_METHOD DescribeWordListSets() override {
return osBasic.DescribeWordListSets();
}
- Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
- void * SCI_METHOD PrivateCall(int, void *) {
+ void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
static ILexer *LexerFactoryBlitzBasic() {
Modified: scintilla/lexers/LexCPP.cxx
108 lines changed, 54 insertions(+), 54 deletions(-)
===================================================================
@@ -54,9 +54,9 @@ bool IsSpaceEquiv(int state) {
// Putting a space between the '++' post-inc operator and the '+' binary op
// fixes this, and is highly recommended for readability anyway.
bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
- Sci_Position pos = (Sci_Position) sc.currentPos;
+ Sci_Position pos = static_cast<Sci_Position>(sc.currentPos);
while (--pos > 0) {
- char ch = styler[pos];
+ const char ch = styler[pos];
if (ch == '+' || ch == '-') {
return styler[pos - 1] == ch;
}
@@ -66,11 +66,11 @@ bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
// Don't look at styles, so no need to flush.
- Sci_Position pos = (Sci_Position) sc.currentPos;
+ Sci_Position pos = static_cast<Sci_Position>(sc.currentPos);
Sci_Position currentLine = styler.GetLine(pos);
- Sci_Position lineStartPos = styler.LineStart(currentLine);
+ const Sci_Position lineStartPos = styler.LineStart(currentLine);
while (--pos > lineStartPos) {
- char ch = styler.SafeGetCharAt(pos);
+ const char ch = styler.SafeGetCharAt(pos);
if (ch != ' ' && ch != '\t') {
break;
}
@@ -91,20 +91,20 @@ bool IsSpaceOrTab(int ch) {
}
bool OnlySpaceOrTab(const std::string &s) {
- for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
- if (!IsSpaceOrTab(*it))
+ for (const char ch : s) {
+ if (!IsSpaceOrTab(ch))
return false;
}
return true;
}
std::vector<std::string> StringSplit(const std::string &text, int separator) {
std::vector<std::string> vs(text.empty() ? 0 : 1);
- for (std::string::const_iterator it = text.begin(); it != text.end(); ++it) {
- if (*it == separator) {
+ for (const char ch : text) {
+ if (ch == separator) {
vs.push_back(std::string());
} else {
- vs.back() += *it;
+ vs.back() += ch;
}
}
return vs;
@@ -141,14 +141,14 @@ BracketPair FindBracketPair(std::vector<std::string> &tokens) {
}
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
- int activity, WordList &markerList, bool caseSensitive){
+ int activity, const WordList &markerList, bool caseSensitive){
if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) {
const int lengthMarker = 50;
char marker[lengthMarker+1];
- Sci_Position currPos = (Sci_Position) sc.currentPos;
+ Sci_Position currPos = static_cast<Sci_Position>(sc.currentPos);
int i = 0;
while (i < lengthMarker) {
- char ch = styler.SafeGetCharAt(currPos + i);
+ const char ch = styler.SafeGetCharAt(currPos + i);
if (IsASpace(ch) || isoperator(ch)) {
break;
}
@@ -203,9 +203,9 @@ std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpa
std::string restOfLine;
Sci_Position i =0;
char ch = styler.SafeGetCharAt(start, '\n');
- Sci_Position endLine = styler.LineEnd(styler.GetLine(start));
+ const Sci_Position endLine = styler.LineEnd(styler.GetLine(start));
while (((start+i) < endLine) && (ch != '\r')) {
- char chNext = styler.SafeGetCharAt(start + i + 1, '\n');
+ const char chNext = styler.SafeGetCharAt(start + i + 1, '\n');
if (ch == '/' && (chNext == '/' || chNext == '*'))
break;
if (allowSpace || (ch != ' '))
@@ -485,64 +485,64 @@ class LexerCPP : public ILexerWithSubStyles {
}
virtual ~LexerCPP() {
}
- void SCI_METHOD Release() {
+ void SCI_METHOD Release() override {
delete this;
}
- int SCI_METHOD Version() const {
+ int SCI_METHOD Version() const override {
return lvSubStyles;
}
- const char * SCI_METHOD PropertyNames() {
+ const char * SCI_METHOD PropertyNames() override {
return osCPP.PropertyNames();
}
- int SCI_METHOD PropertyType(const char *name) {
+ int SCI_METHOD PropertyType(const char *name) override {
return osCPP.PropertyType(name);
}
- const char * SCI_METHOD DescribeProperty(const char *name) {
+ const char * SCI_METHOD DescribeProperty(const char *name) override {
return osCPP.DescribeProperty(name);
}
- Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
- const char * SCI_METHOD DescribeWordListSets() {
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
+ const char * SCI_METHOD DescribeWordListSets() override {
return osCPP.DescribeWordListSets();
}
- Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
- void * SCI_METHOD PrivateCall(int, void *) {
+ void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
- int SCI_METHOD LineEndTypesSupported() {
+ int SCI_METHOD LineEndTypesSupported() override {
return SC_LINE_END_TYPE_UNICODE;
}
- int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) {
+ int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override {
return subStyles.Allocate(styleBase, numberStyles);
}
- int SCI_METHOD SubStylesStart(int styleBase) {
+ int SCI_METHOD SubStylesStart(int styleBase) override {
return subStyles.Start(styleBase);
}
- int SCI_METHOD SubStylesLength(int styleBase) {
+ int SCI_METHOD SubStylesLength(int styleBase) override {
return subStyles.Length(styleBase);
}
- int SCI_METHOD StyleFromSubStyle(int subStyle) {
- int styleBase = subStyles.BaseStyle(MaskActive(subStyle));
- int active = subStyle & activeFlag;
+ int SCI_METHOD StyleFromSubStyle(int subStyle) override {
+ const int styleBase = subStyles.BaseStyle(MaskActive(subStyle));
+ const int active = subStyle & activeFlag;
return styleBase | active;
}
- int SCI_METHOD PrimaryStyleFromStyle(int style) {
+ int SCI_METHOD PrimaryStyleFromStyle(int style) override {
return MaskActive(style);
}
- void SCI_METHOD FreeSubStyles() {
+ void SCI_METHOD FreeSubStyles() override {
subStyles.Free();
}
- void SCI_METHOD SetIdentifiers(int style, const char *identifiers) {
+ void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override {
subStyles.SetIdentifiers(style, identifiers);
}
- int SCI_METHOD DistanceToSecondaryStyles() {
+ int SCI_METHOD DistanceToSecondaryStyles() override {
return activeFlag;
}
- const char * SCI_METHOD GetSubStyleBases() {
+ const char * SCI_METHOD GetSubStyleBases() override {
return styleSubable;
}
@@ -637,7 +637,7 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
struct After {
Sci_Position line;
explicit After(Sci_Position line_) : line(line_) {}
- bool operator()(PPDefinition &p) const {
+ bool operator()(const PPDefinition &p) const {
return p.line > line;
}
};
@@ -709,11 +709,11 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
}
SymbolTable preprocessorDefinitions = preprocessorDefinitionsStart;
- for (std::vector<PPDefinition>::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) {
- if (itDef->isUndef)
- preprocessorDefinitions.erase(itDef->key);
+ for (const PPDefinition &ppDef : ppDefineHistory) {
+ if (ppDef.isUndef)
+ preprocessorDefinitions.erase(ppDef.key);
else
- preprocessorDefinitions[itDef->key] = SymbolValue(itDef->value, itDef->arguments);
+ preprocessorDefinitions[ppDef.key] = SymbolValue(ppDef.value, ppDef.arguments);
}
std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1);
@@ -829,7 +829,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext);
if (raw)
s[lenS--] = '\0';
- bool valid =
+ const bool valid =
(lenS == 0) ||
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
@@ -1198,7 +1198,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
if (!preproc.CurrentIfTaken()) {
// Similar to #if
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true);
- bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
+ const bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
if (ifGood) {
preproc.InvertCurrentLevel();
activitySet = preproc.IsInactive() ? activeFlag : 0;
@@ -1294,7 +1294,7 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int
LexAccessor styler(pAccess);
- Sci_PositionU endPos = startPos + length;
+ const Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
bool inLineComment = false;
Sci_Position lineCurrent = styler.GetLine(startPos);
@@ -1309,12 +1309,12 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int
int style = MaskActive(initStyle);
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
for (Sci_PositionU i = startPos; i < endPos; i++) {
- char ch = chNext;
+ const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
- int stylePrev = style;
+ const int stylePrev = style;
style = styleNext;
styleNext = MaskActive(styler.StyleAt(i + 1));
- bool atEOL = i == (lineStartNext-1);
+ const bool atEOL = i == (lineStartNext-1);
if ((style == SCE_C_COMMENTLINE) || (style == SCE_C_COMMENTLINEDOC))
inLineComment = true;
if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) {
@@ -1334,7 +1334,7 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int
}
} else {
if ((ch == '/') && (chNext == '/')) {
- char chNext2 = styler.SafeGetCharAt(i + 2);
+ const char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelNext++;
} else if (chNext2 == '}') {
@@ -1537,14 +1537,14 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl
for (int prec=precArithmetic; prec <= precLogical; prec++) {
// Looking at 3 tokens at a time so end at 2 before end
for (size_t k=0; (k+2)<tokens.size();) {
- char chOp = tokens[k+1][0];
+ const char chOp = tokens[k+1][0];
if (
((prec==precArithmetic) && setArithmethicOp.Contains(chOp)) ||
((prec==precRelative) && setRelOp.Contains(chOp)) ||
((prec==precLogical) && setLogicalOp.Contains(chOp))
) {
- int valA = atoi(tokens[k].c_str());
- int valB = atoi(tokens[k+2].c_str());
+ const int valA = atoi(tokens[k].c_str());
+ const int valB = atoi(tokens[k+2].c_str());
int result = 0;
if (tokens[k+1] == "+")
result = valA + valB;
@@ -1631,7 +1631,7 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &pr
EvaluateTokens(tokens, preprocessorDefinitions);
// "0" or "" -> false else true
- bool isFalse = tokens.empty() ||
+ const bool isFalse = tokens.empty() ||
((tokens.size() == 1) && ((tokens[0] == "") || tokens[0] == "0"));
return !isFalse;
}
Modified: scintilla/lexers/LexD.cxx
22 lines changed, 11 insertions(+), 11 deletions(-)
===================================================================
@@ -162,30 +162,30 @@ class LexerD : public ILexer {
}
virtual ~LexerD() {
}
- void SCI_METHOD Release() {
+ void SCI_METHOD Release() override {
delete this;
}
- int SCI_METHOD Version() const {
+ int SCI_METHOD Version() const override {
return lvOriginal;
}
- const char * SCI_METHOD PropertyNames() {
+ const char * SCI_METHOD PropertyNames() override {
return osD.PropertyNames();
}
- int SCI_METHOD PropertyType(const char *name) {
+ int SCI_METHOD PropertyType(const char *name) override {
return osD.PropertyType(name);
}
- const char * SCI_METHOD DescribeProperty(const char *name) {
+ const char * SCI_METHOD DescribeProperty(const char *name) override {
return osD.DescribeProperty(name);
}
- Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
- const char * SCI_METHOD DescribeWordListSets() {
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
+ const char * SCI_METHOD DescribeWordListSets() override {
return osD.DescribeWordListSets();
}
- Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
- void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
- void * SCI_METHOD PrivateCall(int, void *) {
+ void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
Modified: scintilla/lexers/LexDiff.cxx
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -126,7 +126,7 @@ static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi
int nextLevel;
do {
- int lineType = styler.StyleAt(curLineStart);
+ const int lineType = styler.StyleAt(curLineStart);
if (lineType == SCE_DIFF_COMMAND)
nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
else if (lineType == SCE_DIFF_HEADER)
Modified: scintilla/lexers/LexFortran.cxx
242 lines changed, 224 insertions(+), 18 deletions(-)
===================================================================
@@ -120,14 +120,6 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
continue;
}
/***************************************/
- // Hanndle preprocessor directives
- if (sc.ch == '#' && numNonBlank == 1)
- {
- sc.SetState(SCE_F_PREPROCESSOR);
- while (!sc.atLineEnd && sc.More())
- sc.Forward(); // Until line end
- }
- /***************************************/
// Handle line continuation generically.
if (!isFixFormat && sc.ch == '&' && sc.state != SCE_F_COMMENT) {
char chTemp = ' ';
@@ -143,7 +135,11 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
int currentState = sc.state;
sc.SetState(SCE_F_CONTINUATION);
sc.ForwardSetState(SCE_F_DEFAULT);
- while (IsASpace(sc.ch) && sc.More()) sc.Forward();
+ while (IsASpace(sc.ch) && sc.More()) {
+ sc.Forward();
+ if (sc.atLineStart) numNonBlank = 0;
+ if (!IsASpaceOrTab(sc.ch)) numNonBlank ++;
+ }
if (sc.ch == '&') {
sc.SetState(SCE_F_CONTINUATION);
sc.Forward();
@@ -152,6 +148,14 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
}
}
/***************************************/
+ // Hanndle preprocessor directives
+ if (sc.ch == '#' && numNonBlank == 1)
+ {
+ sc.SetState(SCE_F_PREPROCESSOR);
+ while (!sc.atLineEnd && sc.More())
+ sc.Forward(); // Until line end
+ }
+ /***************************************/
// Determine if the current state should terminate.
if (sc.state == SCE_F_OPERATOR) {
sc.SetState(SCE_F_DEFAULT);
@@ -223,7 +227,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
if (sc.state == SCE_F_DEFAULT) {
if (sc.ch == '!') {
if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") ||
- sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
+ sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR);
} else {
sc.SetState(SCE_F_COMMENT);
@@ -233,7 +237,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_F_NUMBER);
} else if ((tolower(sc.ch) == 'b' || tolower(sc.ch) == 'o' ||
- tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) {
+ tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) {
sc.SetState(SCE_F_NUMBER);
sc.Forward();
} else if (sc.ch == '.' && isalpha(sc.chNext)) {
@@ -252,6 +256,165 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int
sc.Complete();
}
/***************************************/
+static void CheckLevelCommentLine(const unsigned int nComL,
+ int nComColB[], int nComColF[], int &nComCur,
+ bool comLineB[], bool comLineF[], bool &comLineCur,
+ int &levelDeltaNext) {
+ levelDeltaNext = 0;
+ if (!comLineCur) {
+ return;
+ }
+
+ if (!comLineF[0] || nComColF[0] != nComCur) {
+ unsigned int i=0;
+ for (; i<nComL; i++) {
+ if (!comLineB[i] || nComColB[i] != nComCur) {
+ break;
+ }
+ }
+ if (i == nComL) {
+ levelDeltaNext = -1;
+ }
+ }
+ else if (!comLineB[0] || nComColB[0] != nComCur) {
+ unsigned int i=0;
+ for (; i<nComL; i++) {
+ if (!comLineF[i] || nComColF[i] != nComCur) {
+ break;
+ }
+ }
+ if (i == nComL) {
+ levelDeltaNext = 1;
+ }
+ }
+}
+/***************************************/
+static void GetIfLineComment(Accessor &styler, bool isFixFormat, const Sci_Position line, bool &isComLine, Sci_Position &comCol) {
+ Sci_Position col = 0;
+ isComLine = false;
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position len = styler.Length();
+ while(pos<len) {
+ char ch = styler.SafeGetCharAt(pos);
+ if (ch == '!' || (isFixFormat && col == 0 && (tolower(ch) == 'c' || ch == '*'))) {
+ isComLine = true;
+ comCol = col;
+ break;
+ }
+ else if (!IsABlank(ch) || IsALineEnd(ch)) {
+ break;
+ }
+ pos++;
+ col++;
+ }
+}
+/***************************************/
+static void StepCommentLine(Accessor &styler, bool isFixFormat, Sci_Position lineCurrent, const unsigned int nComL,
+ Sci_Position nComColB[], Sci_Position nComColF[], Sci_Position &nComCur,
+ bool comLineB[], bool comLineF[], bool &comLineCur) {
+ Sci_Position nLineTotal = styler.GetLine(styler.Length()-1) + 1;
+ if (lineCurrent >= nLineTotal) {
+ return;
+ }
+
+ for (int i=nComL-2; i>=0; i--) {
+ nComColB[i+1] = nComColB[i];
+ comLineB[i+1] = comLineB[i];
+ }
+ nComColB[0] = nComCur;
+ comLineB[0] = comLineCur;
+ nComCur = nComColF[0];
+ comLineCur = comLineF[0];
+ for (unsigned int i=0; i+1<nComL; i++) {
+ nComColF[i] = nComColF[i+1];
+ comLineF[i] = comLineF[i+1];
+ }
+ Sci_Position chL = lineCurrent + nComL;
+ if (chL < nLineTotal) {
+ GetIfLineComment(styler, isFixFormat, chL, comLineF[nComL-1], nComColF[nComL-1]);
+ }
+ else {
+ comLineF[nComL-1] = false;
+ }
+}
+/***************************************/
+static void CheckBackComLines(Accessor &styler, bool isFixFormat, Sci_Position lineCurrent, const unsigned int nComL,
+ Sci_Position nComColB[], Sci_Position nComColF[], Sci_Position nComCur,
+ bool comLineB[], bool comLineF[], bool &comLineCur) {
+ unsigned int nLines = nComL + nComL + 1;
+ bool* comL = new bool[nLines];
+ Sci_Position* nComCol = new Sci_Position[nLines];
+ bool comL0;
+ Sci_Position nComCol0;
+ GetIfLineComment(styler, isFixFormat, lineCurrent-nComL-1, comL0, nComCol0);
+ for (unsigned int i=0; i<nComL; i++) {
+ unsigned copyTo = nComL - i - 1;
+ comL[copyTo] = comLineB[i];
+ nComCol[copyTo] = nComColB[i];
+ }
+ assert(nComL < nLines);
+ comL[nComL] = comLineCur;
+ nComCol[nComL] = nComCur;
+ for (unsigned int i=0; i<nComL; i++) {
+ unsigned copyTo = i + nComL + 1;
+ comL[copyTo] = comLineF[i];
+ nComCol[copyTo] = nComColF[i];
+ }
+
+ Sci_Position lineC = lineCurrent - nComL + 1;
+ unsigned int iStart;
+ if (lineC <= 0) {
+ lineC = 0;
+ iStart = nComL - lineCurrent;
+ }
+ else {
+ iStart = 1;
+ }
+ bool levChanged = false;
+ int lev = styler.LevelAt(lineC) & SC_FOLDLEVELNUMBERMASK;
+
+ for (unsigned int i=iStart; i<=nComL; i++) {
+ if (comL[i] && (!comL[i-1] || nComCol[i] != nComCol[i-1])) {
+ bool increase = true;
+ unsigned int until = i + nComL;
+ for (unsigned int j=i+1; j<=until; j++) {
+ if (!comL[j] || nComCol[j] != nComCol[i]) {
+ increase = false;
+ break;
+ }
+ }
+ lev = styler.LevelAt(lineC) & SC_FOLDLEVELNUMBERMASK;
+ if (increase) {
+ int levH = lev | SC_FOLDLEVELHEADERFLAG;
+ lev += 1;
+ if (levH != styler.LevelAt(lineC)) {
+ styler.SetLevel(lineC, levH);
+ }
+ for (Sci_Position j=lineC+1; j<=lineCurrent; j++) {
+ if (lev != styler.LevelAt(j)) {
+ styler.SetLevel(j, lev);
+ }
+ }
+ break;
+ }
+ else {
+ if (lev != styler.LevelAt(lineC)) {
+ styler.SetLevel(lineC, lev);
+ }
+ }
+ levChanged = true;
+ }
+ else if (levChanged && comL[i]) {
+ if (lev != styler.LevelAt(lineC)) {
+ styler.SetLevel(lineC, lev);
+ }
+ }
+ lineC++;
+ }
+ delete[] comL;
+ delete[] nComCol;
+}
+/***************************************/
// To determine the folding level depending on keywords
static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) {
int lev = 0;
@@ -298,29 +461,62 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
// Folding the code
static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
Accessor &styler, bool isFixFormat) {
- //
- // bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
- // Do not know how to fold the comment at the moment.
- //
+
+ bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
Sci_Position lineCurrent = styler.GetLine(startPos);
- int levelCurrent;
bool isPrevLine;
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
- levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
isPrevLine = true;
} else {
- levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
isPrevLine = false;
}
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
int levelDeltaNext = 0;
+
+ const unsigned int nComL = 3; // defines how many comment lines should be before they are folded
+ Sci_Position nComColB[nComL];
+ Sci_Position nComColF[nComL] = {};
+ Sci_Position nComCur;
+ bool comLineB[nComL];
+ bool comLineF[nComL];
+ bool comLineCur;
+ Sci_Position nLineTotal = styler.GetLine(styler.Length()-1) + 1;
+ if (foldComment) {
+ for (unsigned int i=0; i<nComL; i++) {
+ Sci_Position chL = lineCurrent-(i+1);
+ if (chL < 0) {
+ comLineB[i] = false;
+ break;
+ }
+ GetIfLineComment(styler, isFixFormat, chL, comLineB[i], nComColB[i]);
+ if (!comLineB[i]) {
+ for (unsigned int j=i+1; j<nComL; j++) {
+ comLineB[j] = false;
+ }
+ break;
+ }
+ }
+ for (unsigned int i=0; i<nComL; i++) {
+ Sci_Position chL = lineCurrent+i+1;
+ if (chL >= nLineTotal) {
+ comLineF[i] = false;
+ break;
+ }
+ GetIfLineComment(styler, isFixFormat, chL, comLineF[i], nComColF[i]);
+ }
+ GetIfLineComment(styler, isFixFormat, lineCurrent, comLineCur, nComCur);
+ CheckBackComLines(styler, isFixFormat, lineCurrent, nComL, nComColB, nComColF, nComCur,
+ comLineB, comLineF, comLineCur);
+ }
+ int levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+
/***************************************/
Sci_Position lastStart = 0;
char prevWord[32] = "";
@@ -463,6 +659,11 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init
}
}
if (atEOL) {
+ if (foldComment) {
+ int ldNext;
+ CheckLevelCommentLine(nComL, nComColB, nComColF, nComCur, comLineB, comLineF, comLineCur, ldNext);
+ levelDeltaNext += ldNext;
+ }
int lev = levelCurrent;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
@@ -477,6 +678,11 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init
visibleChars = 0;
strcpy(prevWord, "");
isPrevLine = false;
+
+ if (foldComment) {
+ StepCommentLine(styler, isFixFormat, lineCurrent, nComL, nComColB, nComColF, nComCur,
+ comLineB, comLineF, comLineCur);
+ }
}
/***************************************/
if (!isspacechar(ch)) visibleChars++;
Modified: scintilla/lexers/LexHTML.cxx
8 lines changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -490,9 +490,9 @@ static bool isMakoBlockEnd(const int ch, const int chNext, const char *blockType
return ((ch == '/') && (chNext == '>'));
} else if (0 == strcmp(blockType, "%")) {
if (ch == '/' && isLineEnd(chNext))
- return 1;
+ return true;
else
- return isLineEnd(ch);
+ return isLineEnd(ch);
} else if (0 == strcmp(blockType, "{")) {
return ch == '}';
} else {
@@ -502,13 +502,13 @@ static bool isMakoBlockEnd(const int ch, const int chNext, const char *blockType
static bool isDjangoBlockEnd(const int ch, const int chNext, const char *blockType) {
if (strlen(blockType) == 0) {
- return 0;
+ return false;
} else if (0 == strcmp(blockType, "%")) {
return ((ch == '%') && (chNext == '}'));
} else if (0 == strcmp(blockType, "{")) {
return ((ch == '}') && (chNext == '}'));
} else {
- return 0;
+ return false;
}
}
Modified: scintilla/lexers/LexHaskell.cxx
22 lines changed, 11 insertions(+), 11 deletions(-)
===================================================================
@@ -396,39 +396,39 @@ class LexerHaskell : public ILexer {
{}
virtual ~LexerHaskell() {}
- void SCI_METHOD Release() {
+ void SCI_METHOD Release() override {
delete this;
}
- int SCI_METHOD Version() const {
+ int SCI_METHOD Version() const override {
return lvOriginal;
}
- const char * SCI_METHOD PropertyNames() {
+ const char * SCI_METHOD PropertyNames() override {
return osHaskell.PropertyNames();
}
- int SCI_METHOD PropertyType(const char *name) {
+ int SCI_METHOD PropertyType(const char *name) override {
return osHaskell.PropertyType(name);
}
- const char * SCI_METHOD DescribeProperty(const char *name) {
+ const char * SCI_METHOD DescribeProperty(const char *name) override {
return osHaskell.DescribeProperty(name);
}
- Sci_Position SCI_METHOD PropertySet(const char *key, const char *val);
+ Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
- const char * SCI_METHOD DescribeWordListSets() {
+ const char * SCI_METHOD DescribeWordListSets() override {
return osHaskell.DescribeWordListSets();
}
- Sci_Position SCI_METHOD WordListSet(int n, const char *wl);
+ Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
- void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
- void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
- void * SCI_METHOD PrivateCall(int, void *) {
+ void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
Modified: scintilla/lexers/LexLaTeX.cxx
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -81,8 +81,8 @@ class LexerLaTeX : public LexerBase {
static ILexer *LexerFactoryLaTeX() {
return new LexerLaTeX();
}
- void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
- void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess);
+ void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
+ void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
};
static bool latexIsSpecial(int ch) {
Modified: scintilla/lexers/LexLua.cxx
30 lines changed, 15 insertions(+), 15 deletions(-)
===================================================================
@@ -48,14 +48,14 @@ static void ColouriseLuaDoc(
WordList *keywordlists[],
Accessor &styler) {
- WordList &keywords = *keywordlists[0];
- WordList &keywords2 = *keywordlists[1];
- WordList &keywords3 = *keywordlists[2];
- WordList &keywords4 = *keywordlists[3];
- WordList &keywords5 = *keywordlists[4];
- WordList &keywords6 = *keywordlists[5];
- WordList &keywords7 = *keywordlists[6];
- WordList &keywords8 = *keywordlists[7];
+ const WordList &keywords = *keywordlists[0];
+ const WordList &keywords2 = *keywordlists[1];
+ const WordList &keywords3 = *keywordlists[2];
+ const WordList &keywords4 = *keywordlists[3];
+ const WordList &keywords5 = *keywordlists[4];
+ const WordList &keywords6 = *keywordlists[5];
+ const WordList &keywords7 = *keywordlists[6];
+ const WordList &keywords8 = *keywordlists[7];
// Accepts accented characters
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
@@ -77,7 +77,7 @@ static void ColouriseLuaDoc(
int stringWs = 0;
if (initStyle == SCE_LUA_LITERALSTRING || initStyle == SCE_LUA_COMMENT ||
initStyle == SCE_LUA_STRING || initStyle == SCE_LUA_CHARACTER) {
- int lineState = styler.GetLineState(currentLine - 1);
+ const int lineState = styler.GetLineState(currentLine - 1);
nestLevel = lineState >> 9;
sepCount = lineState & 0xFF;
stringWs = lineState & 0x100;
@@ -257,7 +257,7 @@ static void ColouriseLuaDoc(
}
} else if (sc.state == SCE_LUA_LITERALSTRING || sc.state == SCE_LUA_COMMENT) {
if (sc.ch == '[') {
- int sep = LongDelimCheck(sc);
+ const int sep = LongDelimCheck(sc);
if (sep == 1 && sepCount == 1) { // [[-only allowed to nest
nestLevel++;
sc.Forward();
@@ -349,21 +349,21 @@ static void ColouriseLuaDoc(
static void FoldLuaDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
- Sci_PositionU lengthDoc = startPos + length;
+ const Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
- bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+ const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
int styleNext = styler.StyleAt(startPos);
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
- char ch = chNext;
+ const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
- int style = styleNext;
+ const int style = styleNext;
styleNext = styler.StyleAt(i + 1);
- bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+ const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LUA_WORD) {
if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') {
char s[10] = "";
Modified: scintilla/lexers/LexPerl.cxx
22 lines changed, 11 insertions(+), 11 deletions(-)
===================================================================
@@ -415,30 +415,30 @@ class LexerPerl : public ILexer {
}
v@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list