Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 20 Sep 2015 16:39:15 UTC Commit: 04ef30ea06982865cf6ba097e5c6f630f2a554bf https://github.com/geany/geany/commit/04ef30ea06982865cf6ba097e5c6f630f2a554...
Log Message: ----------- Update Scintilla to version 3.6.1
Modified Paths: -------------- data/filetypes.coffeescript scintilla/Makefile.am scintilla/gtk/PlatGTK.cxx scintilla/gtk/ScintillaGTK.cxx scintilla/include/ILexer.h scintilla/include/Makefile.am scintilla/include/SciLexer.h scintilla/include/Sci_Position.h scintilla/include/Scintilla.h scintilla/include/Scintilla.iface scintilla/lexers/LexAbaqus.cxx scintilla/lexers/LexAda.cxx scintilla/lexers/LexAsm.cxx scintilla/lexers/LexBash.cxx scintilla/lexers/LexBasic.cxx scintilla/lexers/LexBatch.cxx scintilla/lexers/LexCOBOL.cxx scintilla/lexers/LexCPP.cxx scintilla/lexers/LexCSS.cxx scintilla/lexers/LexCaml.cxx scintilla/lexers/LexCmake.cxx scintilla/lexers/LexCoffeeScript.cxx scintilla/lexers/LexD.cxx scintilla/lexers/LexDiff.cxx scintilla/lexers/LexErlang.cxx scintilla/lexers/LexForth.cxx scintilla/lexers/LexFortran.cxx scintilla/lexers/LexHTML.cxx scintilla/lexers/LexHaskell.cxx scintilla/lexers/LexLaTeX.cxx scintilla/lexers/LexLisp.cxx scintilla/lexers/LexLua.cxx scintilla/lexers/LexMake.cxx scintilla/lexers/LexMarkdown.cxx scintilla/lexers/LexMatlab.cxx scintilla/lexers/LexNsis.cxx scintilla/lexers/LexNull.cxx scintilla/lexers/LexOthers.cxx scintilla/lexers/LexProps.cxx scintilla/lexlib/Accessor.cxx scintilla/lexlib/Accessor.h scintilla/lexlib/LexAccessor.h scintilla/lexlib/LexerBase.cxx scintilla/lexlib/LexerBase.h scintilla/lexlib/LexerModule.cxx scintilla/lexlib/LexerModule.h scintilla/lexlib/LexerNoExceptions.cxx scintilla/lexlib/LexerNoExceptions.h scintilla/lexlib/LexerSimple.cxx scintilla/lexlib/LexerSimple.h scintilla/lexlib/StyleContext.cxx scintilla/lexlib/StyleContext.h scintilla/src/AutoComplete.cxx scintilla/src/CallTip.cxx scintilla/src/CaseConvert.cxx scintilla/src/CaseFolder.cxx scintilla/src/Catalogue.cxx scintilla/src/CellBuffer.cxx scintilla/src/CharClassify.cxx scintilla/src/ContractionState.cxx scintilla/src/Decoration.cxx scintilla/src/Document.cxx scintilla/src/Document.h scintilla/src/EditModel.cxx scintilla/src/EditView.cxx scintilla/src/Editor.cxx scintilla/src/Editor.h scintilla/src/ExternalLexer.cxx scintilla/src/Indicator.cxx scintilla/src/KeyMap.cxx scintilla/src/LineMarker.cxx scintilla/src/MarginView.cxx scintilla/src/PerLine.cxx scintilla/src/Position.h scintilla/src/PositionCache.cxx scintilla/src/RESearch.cxx scintilla/src/RunStyles.cxx scintilla/src/ScintillaBase.cxx scintilla/src/ScintillaBase.h scintilla/src/Selection.cxx scintilla/src/Selection.h scintilla/src/SplitVector.h scintilla/src/Style.cxx scintilla/src/Style.h scintilla/src/UniConversion.cxx scintilla/src/ViewStyle.cxx scintilla/src/XPM.cxx scintilla/version.txt src/highlightingmappings.h wscript
Modified: data/filetypes.coffeescript 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -15,6 +15,7 @@ verbose_regex=regex verbose_regex_comment=comment word2=keyword_2 word=keyword_1 +instanceproperty=identifier_2
[settings]
Modified: scintilla/Makefile.am 7 lines changed, 6 insertions(+), 1 deletions(-) =================================================================== @@ -11,6 +11,7 @@ lexers/LexAda.cxx \ lexers/LexAsm.cxx \ lexers/LexBash.cxx \ lexers/LexBasic.cxx \ +lexers/LexBatch.cxx \ lexers/LexCOBOL.cxx \ lexers/LexCPP.cxx \ lexers/LexCSS.cxx \ @@ -18,6 +19,7 @@ lexers/LexCaml.cxx \ lexers/LexCmake.cxx \ lexers/LexCoffeeScript.cxx \ lexers/LexD.cxx \ +lexers/LexDiff.cxx \ lexers/LexErlang.cxx \ lexers/LexForth.cxx \ lexers/LexFortran.cxx \ @@ -26,13 +28,15 @@ lexers/LexHaskell.cxx \ lexers/LexLaTeX.cxx \ lexers/LexLisp.cxx \ lexers/LexLua.cxx \ +lexers/LexMake.cxx \ lexers/LexMarkdown.cxx \ lexers/LexMatlab.cxx \ lexers/LexNsis.cxx \ -lexers/LexOthers.cxx \ +lexers/LexNull.cxx \ lexers/LexPascal.cxx \ lexers/LexPerl.cxx \ lexers/LexPowerShell.cxx \ +lexers/LexProps.cxx \ lexers/LexPython.cxx \ lexers/LexPO.cxx \ lexers/LexR.cxx \ @@ -116,6 +120,7 @@ src/MarginView.h \ src/Partitioning.h \ src/PerLine.cxx \ src/PerLine.h \ +src/Position.h \ src/PositionCache.cxx \ src/PositionCache.h \ src/RESearch.cxx \
Modified: scintilla/gtk/PlatGTK.cxx 108 lines changed, 67 insertions(+), 41 deletions(-) =================================================================== @@ -12,6 +12,7 @@ #include <string> #include <vector> #include <map> +#include <sstream>
#include <glib.h> #include <gmodule.h> @@ -41,12 +42,6 @@
#include "Converter.h"
-#if GTK_CHECK_VERSION(2,20,0) -#define IS_WIDGET_FOCUSSED(w) (gtk_widget_has_focus(GTK_WIDGET(w))) -#else -#define IS_WIDGET_FOCUSSED(w) (GTK_WIDGET_HAS_FOCUS(w)) -#endif - static const double kPi = 3.14159265358979323846;
// The Pango version guard for pango_units_from_double and pango_units_to_double @@ -79,11 +74,7 @@ static cairo_surface_t *CreateSimilarSurface(GdkWindow *window, cairo_content_t }
static GdkWindow *WindowFromWidget(GtkWidget *w) { -#if GTK_CHECK_VERSION(3,0,0) return gtk_widget_get_window(w); -#else - return w->window; -#endif }
#ifdef _MSC_VER @@ -459,6 +450,8 @@ const char *CharacterSetID(int characterSet) { return "ASCII"; case SC_CHARSET_RUSSIAN: return "KOI8-R"; + case SC_CHARSET_OEM866: + return "CP866"; case SC_CHARSET_CYRILLIC: return "CP1251"; case SC_CHARSET_SHIFTJIS: @@ -1243,7 +1236,7 @@ void Window::Destroy() { }
bool Window::HasFocus() { - return IS_WIDGET_FOCUSSED(wid); + return gtk_widget_has_focus(GTK_WIDGET(wid)); }
PRectangle Window::GetPosition() { @@ -1251,11 +1244,7 @@ PRectangle Window::GetPosition() { PRectangle rc(0, 0, 1000, 1000); if (wid) { GtkAllocation allocation; -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_get_allocation(PWidget(wid), &allocation); -#else - allocation = PWidget(wid)->allocation; -#endif rc.left = allocation.x; rc.top = allocation.y; if (allocation.width > 20) { @@ -1338,28 +1327,30 @@ void Window::SetCursor(Cursor curs) { return;
cursorLast = curs; + GdkDisplay *pdisplay = gtk_widget_get_display(PWidget(wid)); + GdkCursor *gdkCurs; switch (curs) { case cursorText: - gdkCurs = gdk_cursor_new(GDK_XTERM); + gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_XTERM); break; case cursorArrow: - gdkCurs = gdk_cursor_new(GDK_LEFT_PTR); + gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_LEFT_PTR); break; case cursorUp: - gdkCurs = gdk_cursor_new(GDK_CENTER_PTR); + gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_CENTER_PTR); break; case cursorWait: - gdkCurs = gdk_cursor_new(GDK_WATCH); + gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_WATCH); break; case cursorHand: - gdkCurs = gdk_cursor_new(GDK_HAND2); + gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_HAND2); break; case cursorReverseArrow: - gdkCurs = gdk_cursor_new(GDK_RIGHT_PTR); + gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_RIGHT_PTR); break; default: - gdkCurs = gdk_cursor_new(GDK_LEFT_PTR); + gdkCurs = gdk_cursor_new_for_display(pdisplay, GDK_LEFT_PTR); cursorLast = cursorArrow; break; } @@ -1429,17 +1420,26 @@ class ListBoxX : public ListBox { WindowID scroller; void *pixhash; GtkCellRenderer* pixbuf_renderer; + GtkCellRenderer* renderer; RGBAImageSet images; int desiredVisibleRows; unsigned int maxItemCharacters; unsigned int aveCharWidth; +#if GTK_CHECK_VERSION(3,0,0) + GtkCssProvider *cssProvider; +#endif public: CallBackAction doubleClickAction; void *doubleClickActionData;
ListBoxX() : widCached(0), frame(0), list(0), scroller(0), pixhash(NULL), pixbuf_renderer(0), + renderer(0), desiredVisibleRows(5), maxItemCharacters(0), - aveCharWidth(1), doubleClickAction(NULL), doubleClickActionData(NULL) { + aveCharWidth(1), +#if GTK_CHECK_VERSION(3,0,0) + cssProvider(NULL), +#endif + doubleClickAction(NULL), doubleClickActionData(NULL) { } virtual ~ListBoxX() { if (pixhash) { @@ -1450,6 +1450,12 @@ class ListBoxX : public ListBox { gtk_widget_destroy(GTK_WIDGET(widCached)); wid = widCached = 0; } +#if GTK_CHECK_VERSION(3,0,0) + if (cssProvider) { + g_object_unref(cssProvider); + cssProvider = NULL; + } +#endif } virtual void SetFont(Font &font); virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_); @@ -1551,7 +1557,11 @@ static void StyleSet(GtkWidget *w, GtkStyle*, void*) { recursive calls to this function after the value is updated and w->style to be set to a new object */
-#if GTK_CHECK_VERSION(3,0,0) +#if GTK_CHECK_VERSION(3,16,0) + // On recent releases of GTK+, it does not appear necessary to set the list box colours. + // This may be because of common themes and may be needed with other themes. + // The *override* calls are deprecated now, so only call them for older versions of GTK+. +#elif GTK_CHECK_VERSION(3,0,0) GtkStyleContext *styleContext = gtk_widget_get_style_context(w); if (styleContext == NULL) return; @@ -1593,6 +1603,12 @@ void ListBoxX::Create(Window &, int, Point, int, bool, int) { return; }
+#if GTK_CHECK_VERSION(3,0,0) + if (!cssProvider) { + cssProvider = gtk_css_provider_new(); + } +#endif + wid = widCached = gtk_window_new(GTK_WINDOW_POPUP);
frame = gtk_frame_new(NULL); @@ -1615,6 +1631,14 @@ void ListBoxX::Create(Window &, int, Point, int, bool, int) { list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_signal_connect(G_OBJECT(list), "style-set", G_CALLBACK(StyleSet), NULL);
+#if GTK_CHECK_VERSION(3,0,0) + GtkStyleContext *styleContext = gtk_widget_get_style_context(GTK_WIDGET(list)); + if (styleContext) { + gtk_style_context_add_provider(styleContext, GTK_STYLE_PROVIDER(cssProvider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } +#endif + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); @@ -1632,7 +1656,7 @@ void ListBoxX::Create(Window &, int, Point, int, bool, int) { gtk_tree_view_column_add_attribute(column, pixbuf_renderer, "pixbuf", PIXBUF_COLUMN);
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); + renderer = gtk_cell_renderer_text_new(); gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(renderer), 1); gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_add_attribute(column, renderer, @@ -1654,7 +1678,21 @@ void ListBoxX::SetFont(Font &scint_font) { if (Created() && PFont(scint_font)->pfd) { // Current font is Pango font #if GTK_CHECK_VERSION(3,0,0) - gtk_widget_override_font(PWidget(list), PFont(scint_font)->pfd); + if (cssProvider) { + PangoFontDescription *pfd = PFont(scint_font)->pfd; + std::ostringstream ssFontSetting; + ssFontSetting << "GtkTreeView { "; + ssFontSetting << "font-family: " << pango_font_description_get_family(pfd) << "; "; + ssFontSetting << "font-size:"; + ssFontSetting << static_cast<double>(pango_font_description_get_size(pfd)) / PANGO_SCALE; + ssFontSetting << "px; "; + ssFontSetting << "font-weight:"<< pango_font_description_get_weight(pfd) << "; "; + ssFontSetting << "}"; + gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(cssProvider), + ssFontSetting.str().c_str(), -1, NULL); + } + 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); #else gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd); #endif @@ -1865,14 +1903,12 @@ void ListBoxX::Select(int n) { #if GTK_CHECK_VERSION(3,0,0) GtkAdjustment *adj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(list)); - gfloat value = ((gfloat)n / total) * (gtk_adjustment_get_upper(adj) - gtk_adjustment_get_lower(adj)) - + gtk_adjustment_get_lower(adj) - gtk_adjustment_get_page_size(adj) / 2; #else GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(list)); - gfloat value = ((gfloat)n / total) * (adj->upper - adj->lower) - + adj->lower - adj->page_size / 2; #endif + gfloat value = ((gfloat)n / total) * (gtk_adjustment_get_upper(adj) - gtk_adjustment_get_lower(adj)) + + gtk_adjustment_get_lower(adj) - gtk_adjustment_get_page_size(adj) / 2; // Get cell height int row_height = GetRowHeight();
@@ -1886,13 +1922,8 @@ void ListBoxX::Select(int n) { } // Clamp it. value = (value < 0)? 0 : value; -#if GTK_CHECK_VERSION(3,0,0) value = (value > (gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj)))? (gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj)) : value; -#else - value = (value > (adj->upper - adj->page_size))? - (adj->upper - adj->page_size) : value; -#endif
// Set it. gtk_adjustment_set_value(adj, value); @@ -2026,12 +2057,7 @@ Menu::Menu() : mid(0) {} void Menu::CreatePopUp() { Destroy(); mid = gtk_menu_new(); -#if GLIB_CHECK_VERSION(2,10,0) - g_object_ref_sink(G_OBJECT(mid)); -#else - g_object_ref(G_OBJECT(mid)); - gtk_object_sink(GTK_OBJECT(G_OBJECT(mid))); -#endif + g_object_ref_sink(G_OBJECT(mid)); }
void Menu::Destroy() {
Modified: scintilla/gtk/ScintillaGTK.cxx 138 lines changed, 42 insertions(+), 96 deletions(-) =================================================================== @@ -38,6 +38,7 @@ #ifdef SCI_LEXER #include "LexerModule.h" #endif +#include "Position.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -82,11 +83,9 @@ #if GTK_CHECK_VERSION(2,20,0) #define IS_WIDGET_REALIZED(w) (gtk_widget_get_realized(GTK_WIDGET(w))) #define IS_WIDGET_MAPPED(w) (gtk_widget_get_mapped(GTK_WIDGET(w))) -#define IS_WIDGET_VISIBLE(w) (gtk_widget_get_visible(GTK_WIDGET(w))) #else #define IS_WIDGET_REALIZED(w) (GTK_WIDGET_REALIZED(w)) #define IS_WIDGET_MAPPED(w) (GTK_WIDGET_MAPPED(w)) -#define IS_WIDGET_VISIBLE(w) (GTK_WIDGET_VISIBLE(w)) #endif
#define SC_INDICATOR_INPUT INDIC_IME @@ -95,11 +94,7 @@ #define SC_INDICATOR_UNKNOWN INDIC_IME_MAX
static GdkWindow *WindowFromWidget(GtkWidget *w) { -#if GTK_CHECK_VERSION(3,0,0) return gtk_widget_get_window(w); -#else - return w->window; -#endif }
#ifdef _MSC_VER @@ -117,11 +112,7 @@ using namespace Scintilla;
static GdkWindow *PWindow(const Window &w) { GtkWidget *widget = reinterpret_cast<GtkWidget *>(w.GetID()); -#if GTK_CHECK_VERSION(3,0,0) return gtk_widget_get_window(widget); -#else - return widget->window; -#endif }
extern std::string UTF8FromLatin1(const char *s, int len); @@ -276,7 +267,6 @@ class ScintillaGTK : public ScintillaBase { gboolean Expose(GtkWidget *widget, GdkEventExpose *ose); static gboolean ExposeMain(GtkWidget *widget, GdkEventExpose *ose); #endif - static void Draw(GtkWidget *widget, GdkRectangle *area); void ForAll(GtkCallback callback, gpointer callback_data); static void MainForAll(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
@@ -460,11 +450,7 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { GdkWindowAttr attrs; attrs.window_type = GDK_WINDOW_CHILD; GtkAllocation allocation; -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_get_allocation(widget, &allocation); -#else - allocation = widget->allocation; -#endif attrs.x = allocation.x; attrs.y = allocation.y; attrs.width = allocation.width; @@ -475,18 +461,19 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { attrs.colormap = gtk_widget_get_colormap(widget); #endif attrs.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; - GdkCursor *cursor = gdk_cursor_new(GDK_XTERM); + GdkDisplay *pdisplay = gtk_widget_get_display(widget); + GdkCursor *cursor = gdk_cursor_new_for_display(pdisplay, GDK_XTERM); attrs.cursor = cursor; #if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_window(widget, gdk_window_new(gtk_widget_get_parent_window(widget), &attrs, GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_CURSOR)); +#if GTK_CHECK_VERSION(3,8,0) + gtk_widget_register_window(widget, gtk_widget_get_window(widget)); +#else gdk_window_set_user_data(gtk_widget_get_window(widget), widget); - GtkStyleContext *styleContext = gtk_widget_get_style_context(widget); - if (styleContext) { - GdkRGBA colourBackWidget; - gtk_style_context_get_background_color(styleContext, GTK_STATE_FLAG_NORMAL, &colourBackWidget); - gdk_window_set_background_rgba(gtk_widget_get_window(widget), &colourBackWidget); - } +#endif + gtk_style_context_set_background(gtk_widget_get_style_context(widget), + gtk_widget_get_window(widget)); gdk_window_show(gtk_widget_get_window(widget)); UnRefCursor(cursor); #else @@ -516,15 +503,15 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { gtk_widget_realize(PWidget(scrollbarv)); gtk_widget_realize(PWidget(scrollbarh));
- cursor = gdk_cursor_new(GDK_XTERM); + cursor = gdk_cursor_new_for_display(pdisplay, GDK_XTERM); gdk_window_set_cursor(PWindow(wText), cursor); UnRefCursor(cursor);
- cursor = gdk_cursor_new(GDK_LEFT_PTR); + cursor = gdk_cursor_new_for_display(pdisplay, GDK_LEFT_PTR); gdk_window_set_cursor(PWindow(scrollbarv), cursor); UnRefCursor(cursor);
- cursor = gdk_cursor_new(GDK_LEFT_PTR); + cursor = gdk_cursor_new_for_display(pdisplay, GDK_LEFT_PTR); gdk_window_set_cursor(PWindow(scrollbarh), cursor); UnRefCursor(cursor);
@@ -572,7 +559,7 @@ void ScintillaGTK::UnRealize(GtkWidget *widget) {
static void MapWidget(GtkWidget *widget) { if (widget && - IS_WIDGET_VISIBLE(widget) && + gtk_widget_get_visible(GTK_WIDGET(widget)) && !IS_WIDGET_MAPPED(widget)) { gtk_widget_map(widget); } @@ -751,11 +738,7 @@ void ScintillaGTK::GetPreferredHeight(GtkWidget *widget, gint *minimalHeight, gi void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { ScintillaGTK *sciThis = ScintillaFromWidget(widget); try { -#if GTK_CHECK_VERSION(2,20,0) gtk_widget_set_allocation(widget, allocation); -#else - widget->allocation = *allocation; -#endif if (IS_WIDGET_REALIZED(widget)) gdk_window_move_resize(WindowFromWidget(widget), allocation->x, @@ -775,13 +758,8 @@ void ScintillaGTK::Initialise() { parentClass = reinterpret_cast<GtkWidgetClass *>( g_type_class_ref(gtk_container_get_type()));
-#if GTK_CHECK_VERSION(2,20,0) gtk_widget_set_can_focus(PWidget(wMain), TRUE); gtk_widget_set_sensitive(PWidget(wMain), TRUE); -#else - GTK_WIDGET_SET_FLAGS(PWidget(wMain), GTK_CAN_FOCUS); - GTK_WIDGET_SET_FLAGS(GTK_WIDGET(PWidget(wMain)), GTK_SENSITIVE); -#endif gtk_widget_set_events(PWidget(wMain), GDK_EXPOSURE_MASK | GDK_SCROLL_MASK @@ -825,11 +803,7 @@ void ScintillaGTK::Initialise() { #else scrollbarv = gtk_vscrollbar_new(GTK_ADJUSTMENT(adjustmentv)); #endif -#if GTK_CHECK_VERSION(2,20,0) gtk_widget_set_can_focus(PWidget(scrollbarv), FALSE); -#else - GTK_WIDGET_UNSET_FLAGS(PWidget(scrollbarv), GTK_CAN_FOCUS); -#endif g_signal_connect(G_OBJECT(adjustmentv), "value_changed", G_CALLBACK(ScrollSignal), this); gtk_widget_set_parent(PWidget(scrollbarv), PWidget(wMain)); @@ -841,11 +815,7 @@ void ScintillaGTK::Initialise() { #else scrollbarh = gtk_hscrollbar_new(GTK_ADJUSTMENT(adjustmenth)); #endif -#if GTK_CHECK_VERSION(2,20,0) gtk_widget_set_can_focus(PWidget(scrollbarh), FALSE); -#else - GTK_WIDGET_UNSET_FLAGS(PWidget(scrollbarh), GTK_CAN_FOCUS); -#endif g_signal_connect(G_OBJECT(adjustmenth), "value_changed", G_CALLBACK(ScrollHSignal), this); gtk_widget_set_parent(PWidget(scrollbarh), PWidget(wMain)); @@ -1210,6 +1180,10 @@ PRectangle ScintillaGTK::GetClientRectangle() const { // Move to origin rc.right -= rc.left; rc.bottom -= rc.top; + if (rc.bottom < 0) + rc.bottom = 0; + if (rc.right < 0) + rc.right = 0; rc.left = 0; rc.top = 0; return rc; @@ -1242,7 +1216,6 @@ bool ScintillaGTK::ModifyScrollBars(int nMax, int nPage) { bool modified = false; int pageScroll = LinesToScroll();
-#if GTK_CHECK_VERSION(3,0,0) if (gtk_adjustment_get_upper(adjustmentv) != (nMax + 1) || gtk_adjustment_get_page_size(adjustmentv) != nPage || gtk_adjustment_get_page_increment(adjustmentv) != pageScroll) { @@ -1252,17 +1225,6 @@ bool ScintillaGTK::ModifyScrollBars(int nMax, int nPage) { gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmentv)); modified = true; } -#else - if (GTK_ADJUSTMENT(adjustmentv)->upper != (nMax + 1) || - GTK_ADJUSTMENT(adjustmentv)->page_size != nPage || - GTK_ADJUSTMENT(adjustmentv)->page_increment != pageScroll) { - GTK_ADJUSTMENT(adjustmentv)->upper = nMax + 1; - GTK_ADJUSTMENT(adjustmentv)->page_size = nPage; - GTK_ADJUSTMENT(adjustmentv)->page_increment = pageScroll; - gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmentv)); - modified = true; - } -#endif
PRectangle rcText = GetTextRectangle(); int horizEndPreferred = scrollWidth; @@ -1271,7 +1233,6 @@ bool ScintillaGTK::ModifyScrollBars(int nMax, int nPage) { unsigned int pageWidth = rcText.Width(); unsigned int pageIncrement = pageWidth / 3; unsigned int charWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; -#if GTK_CHECK_VERSION(3,0,0) if (gtk_adjustment_get_upper(adjustmenth) != horizEndPreferred || gtk_adjustment_get_page_size(adjustmenth) != pageWidth || gtk_adjustment_get_page_increment(adjustmenth) != pageIncrement || @@ -1283,19 +1244,6 @@ bool ScintillaGTK::ModifyScrollBars(int nMax, int nPage) { gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmenth)); modified = true; } -#else - if (GTK_ADJUSTMENT(adjustmenth)->upper != horizEndPreferred || - GTK_ADJUSTMENT(adjustmenth)->page_size != pageWidth || - GTK_ADJUSTMENT(adjustmenth)->page_increment != pageIncrement || - GTK_ADJUSTMENT(adjustmenth)->step_increment != charWidth) { - GTK_ADJUSTMENT(adjustmenth)->upper = horizEndPreferred; - GTK_ADJUSTMENT(adjustmenth)->step_increment = charWidth; - GTK_ADJUSTMENT(adjustmenth)->page_size = pageWidth; - GTK_ADJUSTMENT(adjustmenth)->page_increment = pageIncrement; - gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmenth)); - modified = true; - } -#endif if (modified && (paintState == painting)) { repaintFullWindow = true; } @@ -1569,17 +1517,10 @@ void ScintillaGTK::ClaimSelection() { } }
-#if GTK_CHECK_VERSION(3,0,0) static const guchar *DataOfGSD(GtkSelectionData *sd) { return gtk_selection_data_get_data(sd); } static gint LengthOfGSD(GtkSelectionData *sd) { return gtk_selection_data_get_length(sd); } static GdkAtom TypeOfGSD(GtkSelectionData *sd) { return gtk_selection_data_get_data_type(sd); } static GdkAtom SelectionOfGSD(GtkSelectionData *sd) { return gtk_selection_data_get_selection(sd); } -#else -static const guchar *DataOfGSD(GtkSelectionData *sd) { return sd->data; } -static gint LengthOfGSD(GtkSelectionData *sd) { return sd->length; } -static GdkAtom TypeOfGSD(GtkSelectionData *sd) { return sd->type; } -static GdkAtom SelectionOfGSD(GtkSelectionData *sd) { return sd->selection; } -#endif
// Detect rectangular text, convert line ends to current mode, convert from or to UTF-8 void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText) { @@ -1834,13 +1775,8 @@ void ScintillaGTK::Resize(int width, int height) {
static void SetAdjustmentValue(GtkAdjustment *object, int value) { GtkAdjustment *adjustment = GTK_ADJUSTMENT(object); -#if GTK_CHECK_VERSION(3,0,0) int maxValue = static_cast<int>( gtk_adjustment_get_upper(adjustment) - gtk_adjustment_get_page_size(adjustment)); -#else - int maxValue = static_cast<int>( - adjustment->upper - adjustment->page_size); -#endif
if (value > maxValue) value = maxValue; @@ -2503,7 +2439,7 @@ void ScintillaGTK::PreeditChangedInlineThis() { } else { // No tentative undo means start of this composition so // fill in any virtual spaces. - FillVirtualSpace(); + ClearBeforeTentativeStart(); }
PreEditString preeditStr(im_context); @@ -2583,6 +2519,7 @@ void ScintillaGTK::PreeditChangedInlineThis() { MoveImeCarets( - (imeCharPos[preeditStr.uniStrLen]) + imeCharPos[preeditStr.cursor_pos]); }
+ EnsureCaretVisible(); SetCandidateWindowPos(); ShowCaretAtCurrentPosition(); } catch (...) { @@ -2658,6 +2595,9 @@ void ScintillaGTK::Destroy(GObject *object) { //Platform::DebugPrintf("Destroying %x %x\n", sciThis, object); sciThis->Finalise();
+ gtk_widget_unparent(PWidget(sciThis->scrollbarv)); + gtk_widget_unparent(PWidget(sciThis->scrollbarh)); + delete sciThis; scio->pscin = 0; scintilla_class_parent_class->finalize(object); @@ -2724,6 +2664,24 @@ gboolean ScintillaGTK::DrawText(GtkWidget *, cairo_t *cr, ScintillaGTK *sciThis)
gboolean ScintillaGTK::DrawThis(cairo_t *cr) { try { +#ifdef GTK_STYLE_CLASS_SCROLLBARS_JUNCTION /* GTK >= 3.4 */ + // if both scrollbars are visible, paint the little square on the bottom right corner + if (verticalScrollBarVisible && horizontalScrollBarVisible && !Wrapping()) { + GtkStyleContext *styleContext = gtk_widget_get_style_context(PWidget(wMain)); + PRectangle rc = GetClientRectangle(); + + gtk_style_context_save(styleContext); + gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_SCROLLBARS_JUNCTION); + + gtk_render_background(styleContext, cr, rc.right, rc.bottom, + verticalScrollBarWidth, horizontalScrollBarHeight); + gtk_render_frame(styleContext, cr, rc.right, rc.bottom, + verticalScrollBarWidth, horizontalScrollBarHeight); + + gtk_style_context_restore(styleContext); + } +#endif + gtk_container_propagate_draw( GTK_CONTAINER(PWidget(wMain)), PWidget(scrollbarh), cr); gtk_container_propagate_draw( @@ -2822,11 +2780,7 @@ gboolean ScintillaGTK::Expose(GtkWidget *, GdkEventExpose *ose) {
void ScintillaGTK::ScrollSignal(GtkAdjustment *adj, ScintillaGTK *sciThis) { try { -#if GTK_CHECK_VERSION(3,0,0) sciThis->ScrollTo(static_cast<int>(gtk_adjustment_get_value(adj)), false); -#else - sciThis->ScrollTo(static_cast<int>(adj->value), false); -#endif } catch (...) { sciThis->errorStatus = SC_STATUS_FAILURE; } @@ -2834,11 +2788,7 @@ void ScintillaGTK::ScrollSignal(GtkAdjustment *adj, ScintillaGTK *sciThis) {
void ScintillaGTK::ScrollHSignal(GtkAdjustment *adj, ScintillaGTK *sciThis) { try { -#if GTK_CHECK_VERSION(3,0,0) sciThis->HorizontalScrollTo(static_cast<int>(gtk_adjustment_get_value(adj))); -#else - sciThis->HorizontalScrollTo(static_cast<int>(adj->value)); -#endif } catch (...) { sciThis->errorStatus = SC_STATUS_FAILURE; } @@ -2882,7 +2832,7 @@ gboolean ScintillaGTK::DragMotionThis(GdkDragContext *context, try { Point npt(x, y); SetDragPosition(SPositionFromLocation(npt, false, false, UserVirtualSpace())); -#if GTK_CHECK_VERSION(3,0,0) +#if GTK_CHECK_VERSION(2,22,0) GdkDragAction preferredAction = gdk_drag_context_get_suggested_action(context); GdkDragAction actions = gdk_drag_context_get_actions(context); #else @@ -2966,7 +2916,7 @@ void ScintillaGTK::DragDataGet(GtkWidget *widget, GdkDragContext *context, if (!sciThis->sel.Empty()) { sciThis->GetSelection(selection_data, info, &sciThis->drag); } -#if GTK_CHECK_VERSION(3,0,0) +#if GTK_CHECK_VERSION(2,22,0) GdkDragAction action = gdk_drag_context_get_selected_action(context); #else GdkDragAction action = context->action; @@ -3245,11 +3195,7 @@ static void scintilla_class_init(ScintillaClass *klass) {
static void scintilla_init(ScintillaObject *sci) { try { -#if GTK_CHECK_VERSION(2,20,0) gtk_widget_set_can_focus(GTK_WIDGET(sci), TRUE); -#else - GTK_WIDGET_SET_FLAGS(sci, GTK_CAN_FOCUS); -#endif sci->pscin = new ScintillaGTK(sci); } catch (...) { }
Modified: scintilla/include/ILexer.h 48 lines changed, 25 insertions(+), 23 deletions(-) =================================================================== @@ -8,6 +8,8 @@ #ifndef ILEXER_H #define ILEXER_H
+#include "Sci_Position.h" + #ifdef SCI_NAMESPACE namespace Scintilla { #endif @@ -24,32 +26,32 @@ class IDocument { public: virtual int SCI_METHOD Version() const = 0; virtual void SCI_METHOD SetErrorStatus(int status) = 0; - virtual int SCI_METHOD Length() const = 0; - virtual void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const = 0; - virtual char SCI_METHOD StyleAt(int position) const = 0; - virtual int SCI_METHOD LineFromPosition(int position) const = 0; - virtual int SCI_METHOD LineStart(int line) const = 0; - virtual int SCI_METHOD GetLevel(int line) const = 0; - virtual int SCI_METHOD SetLevel(int line, int level) = 0; - virtual int SCI_METHOD GetLineState(int line) const = 0; - virtual int SCI_METHOD SetLineState(int line, int state) = 0; - virtual void SCI_METHOD StartStyling(int position, char mask) = 0; - virtual bool SCI_METHOD SetStyleFor(int length, char style) = 0; - virtual bool SCI_METHOD SetStyles(int length, const char *styles) = 0; + virtual Sci_Position SCI_METHOD Length() const = 0; + virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0; + virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0; + virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0; + virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0; + virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0; + virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0; + virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0; + virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0; + virtual void SCI_METHOD StartStyling(Sci_Position position, char mask) = 0; + virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0; + virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0; virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0; - virtual void SCI_METHOD DecorationFillRange(int position, int value, int fillLength) = 0; - virtual void SCI_METHOD ChangeLexerState(int start, int end) = 0; + virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0; + virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0; virtual int SCI_METHOD CodePage() const = 0; virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0; virtual const char * SCI_METHOD BufferPointer() = 0; - virtual int SCI_METHOD GetLineIndentation(int line) = 0; + virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0; };
class IDocumentWithLineEnd : public IDocument { public: - virtual int SCI_METHOD LineEnd(int line) const = 0; - virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0; - virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0; + virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0; + virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0; + virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0; };
enum { lvOriginal=0, lvSubStyles=1 }; @@ -61,11 +63,11 @@ class ILexer { virtual const char * SCI_METHOD PropertyNames() = 0; virtual int SCI_METHOD PropertyType(const char *name) = 0; virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0; - virtual int SCI_METHOD PropertySet(const char *key, const char *val) = 0; + virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0; virtual const char * SCI_METHOD DescribeWordListSets() = 0; - virtual int SCI_METHOD WordListSet(int n, const char *wl) = 0; - virtual void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; - virtual void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; + virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0; + virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; + virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0; };
@@ -87,7 +89,7 @@ class ILoader { public: virtual int SCI_METHOD Release() = 0; // Returns a status code from SC_STATUS_* - virtual int SCI_METHOD AddData(char *data, int length) = 0; + virtual int SCI_METHOD AddData(char *data, Sci_Position length) = 0; virtual void * SCI_METHOD ConvertToDocument() = 0; };
Modified: scintilla/include/Makefile.am 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -9,4 +9,5 @@ scintilla_include_HEADERS = \ SciLexer.h \ Scintilla.h \ Scintilla.iface \ - ScintillaWidget.h + ScintillaWidget.h \ + Sci_Position.h
Modified: scintilla/include/SciLexer.h 19 lines changed, 19 insertions(+), 0 deletions(-) =================================================================== @@ -498,6 +498,24 @@ #define SCE_ERR_JAVA_STACK 20 #define SCE_ERR_VALUE 21 #define SCE_ERR_GCC_INCLUDED_FROM 22 +#define SCE_ERR_ESCSEQ 23 +#define SCE_ERR_ESCSEQ_UNKNOWN 24 +#define SCE_ERR_ES_BLACK 40 +#define SCE_ERR_ES_RED 41 +#define SCE_ERR_ES_GREEN 42 +#define SCE_ERR_ES_BROWN 43 +#define SCE_ERR_ES_BLUE 44 +#define SCE_ERR_ES_MAGENTA 45 +#define SCE_ERR_ES_CYAN 46 +#define SCE_ERR_ES_GRAY 47 +#define SCE_ERR_ES_DARK_GRAY 48 +#define SCE_ERR_ES_BRIGHT_RED 49 +#define SCE_ERR_ES_BRIGHT_GREEN 50 +#define SCE_ERR_ES_YELLOW 51 +#define SCE_ERR_ES_BRIGHT_BLUE 52 +#define SCE_ERR_ES_BRIGHT_MAGENTA 53 +#define SCE_ERR_ES_BRIGHT_CYAN 54 +#define SCE_ERR_ES_WHITE 55 #define SCE_BAT_DEFAULT 0 #define SCE_BAT_COMMENT 1 #define SCE_BAT_WORD 2 @@ -1567,6 +1585,7 @@ #define SCE_COFFEESCRIPT_COMMENTBLOCK 22 #define SCE_COFFEESCRIPT_VERBOSE_REGEX 23 #define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24 +#define SCE_COFFEESCRIPT_INSTANCEPROPERTY 25 #define SCE_AVS_DEFAULT 0 #define SCE_AVS_COMMENTBLOCK 1 #define SCE_AVS_COMMENTBLOCKN 2
Modified: scintilla/include/Sci_Position.h 21 lines changed, 21 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,21 @@ +// Scintilla source code edit control +/** @file Sci_Position.h + ** Define the Sci_Position type used in Scintilla's external interfaces. + ** These need to be available to clients written in C so are not in a C++ namespace. + **/ +// Copyright 2015 by Neil Hodgson neilh@scintilla.org +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SCI_POSITION_H +#define SCI_POSITION_H + +// Basic signed type used throughout interface +typedef int Sci_Position; + +// Unsigned variant used for ILexer::Lex and ILexer::Fold +typedef unsigned int Sci_PositionU; + +// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE +typedef long Sci_PositionCR; + +#endif
Modified: scintilla/include/Scintilla.h 36 lines changed, 27 insertions(+), 9 deletions(-) =================================================================== @@ -11,6 +11,8 @@ #ifndef SCINTILLA_H #define SCINTILLA_H
+#include "Sci_Position.h" + #ifdef __cplusplus extern "C" { #endif @@ -194,6 +196,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_CHARSET_MAC 77 #define SC_CHARSET_OEM 255 #define SC_CHARSET_RUSSIAN 204 +#define SC_CHARSET_OEM866 866 #define SC_CHARSET_CYRILLIC 1251 #define SC_CHARSET_SHIFTJIS 128 #define SC_CHARSET_SYMBOL 2 @@ -217,6 +220,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_CASE_MIXED 0 #define SC_CASE_UPPER 1 #define SC_CASE_LOWER 2 +#define SC_CASE_CAMEL 3 #define SCI_STYLEGETFORE 2481 #define SCI_STYLEGETBACK 2482 #define SCI_STYLEGETBOLD 2483 @@ -434,6 +438,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETTARGETEND 2193 #define SCI_SETTARGETRANGE 2686 #define SCI_GETTARGETTEXT 2687 +#define SCI_TARGETFROMSELECTION 2287 +#define SCI_TARGETWHOLEDOCUMENT 2690 #define SCI_REPLACETARGET 2194 #define SCI_REPLACETARGETRE 2195 #define SCI_SEARCHINTARGET 2197 @@ -498,6 +504,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETMOUSEDWELLTIME 2265 #define SCI_WORDSTARTPOSITION 2266 #define SCI_WORDENDPOSITION 2267 +#define SCI_ISRANGEWORD 2691 #define SC_WRAP_NONE 0 #define SC_WRAP_WORD 1 #define SC_WRAP_CHAR 2 @@ -559,7 +566,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETMULTIPASTE 2614 #define SCI_GETMULTIPASTE 2615 #define SCI_GETTAG 2616 -#define SCI_TARGETFROMSELECTION 2287 #define SCI_LINESJOIN 2288 #define SCI_LINESSPLIT 2289 #define SCI_SETFOLDMARGINCOLOUR 2290 @@ -894,6 +900,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETADDITIONALCARETFORE 2605 #define SCI_ROTATESELECTION 2606 #define SCI_SWAPMAINANCHORCARET 2607 +#define SCI_MULTIPLESELECTADDNEXT 2688 +#define SCI_MULTIPLESELECTADDEACH 2689 #define SCI_CHANGELEXERSTATE 2617 #define SCI_CONTRACTEDFOLDNEXT 2618 #define SCI_VERTICALCENTRECARET 2619 @@ -1019,6 +1027,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCMOD_ALT 4 #define SCMOD_SUPER 8 #define SCMOD_META 16 +#define SC_AC_FILLUP 1 +#define SC_AC_DOUBLECLICK 2 +#define SC_AC_TAB 3 +#define SC_AC_NEWLINE 4 +#define SC_AC_COMMAND 5 #define SCN_STYLENEEDED 2000 #define SCN_CHARADDED 2001 #define SCN_SAVEPOINTREACHED 2002 @@ -1048,6 +1061,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_HOTSPOTRELEASECLICK 2027 #define SCN_FOCUSIN 2028 #define SCN_FOCUSOUT 2029 +#define SCN_AUTOCCOMPLETED 2030 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
/* These structures are defined to be exactly the same shape as the Win32 @@ -1059,8 +1073,8 @@ namespace Scintilla { #endif
struct Sci_CharacterRange { - long cpMin; - long cpMax; + Sci_PositionCR cpMin; + Sci_PositionCR cpMax; };
struct Sci_TextRange { @@ -1113,14 +1127,16 @@ struct Sci_NotifyHeader {
struct SCNotification { struct Sci_NotifyHeader nmhdr; - int position; + Sci_Position position; /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */ /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */ /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */ /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
- int ch; /* SCN_CHARADDED, SCN_KEY */ + int ch; + /* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */ + /* SCN_USERLISTSELECTION */ int modifiers; /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */ /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ @@ -1129,12 +1145,12 @@ struct SCNotification { const char *text; /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
- int length; /* SCN_MODIFIED */ - int linesAdded; /* SCN_MODIFIED */ + Sci_Position length; /* SCN_MODIFIED */ + Sci_Position linesAdded; /* SCN_MODIFIED */ int message; /* SCN_MACRORECORD */ uptr_t wParam; /* SCN_MACRORECORD */ sptr_t lParam; /* SCN_MACRORECORD */ - int line; /* SCN_MODIFIED */ + Sci_Position line; /* SCN_MODIFIED */ int foldLevelNow; /* SCN_MODIFIED */ int foldLevelPrev; /* SCN_MODIFIED */ int margin; /* SCN_MARGINCLICK */ @@ -1142,8 +1158,10 @@ struct SCNotification { int x; /* SCN_DWELLSTART, SCN_DWELLEND */ int y; /* SCN_DWELLSTART, SCN_DWELLEND */ int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ - int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ + Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ int updated; /* SCN_UPDATEUI */ + int listCompletionMethod; + /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */ };
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
Modified: scintilla/include/Scintilla.iface 65 lines changed, 57 insertions(+), 8 deletions(-) =================================================================== @@ -417,6 +417,7 @@ val SC_CHARSET_HANGUL=129 val SC_CHARSET_MAC=77 val SC_CHARSET_OEM=255 val SC_CHARSET_RUSSIAN=204 +val SC_CHARSET_OEM866=866 val SC_CHARSET_CYRILLIC=1251 val SC_CHARSET_SHIFTJIS=128 val SC_CHARSET_SYMBOL=2 @@ -462,6 +463,7 @@ enu CaseVisible=SC_CASE_ val SC_CASE_MIXED=0 val SC_CASE_UPPER=1 val SC_CASE_LOWER=2 +val SC_CASE_CAMEL=3
# Get the foreground colour of a style. get colour StyleGetFore=2481(int style,) @@ -1069,6 +1071,12 @@ fun void SetTargetRange=2686(position start, position end) # Retrieve the text in the target. get int GetTargetText=2687(, stringresult characters)
+# Make the target range start and end be the same as the selection range start and end. +fun void TargetFromSelection=2287(,) + +# Sets the target to the whole document. +fun void TargetWholeDocument=2690(,) + # Replace the target text with the argument text. # Text is counted so it can contain NULs. # Returns the length of the replacement text. @@ -1248,6 +1256,9 @@ fun int WordStartPosition=2266(position pos, bool onlyWordCharacters) # Get position of end of word. fun int WordEndPosition=2267(position pos, bool onlyWordCharacters)
+# Is the range start..end considered a word? +fun bool IsRangeWord=2691(position start, position end) + enu Wrap=SC_WRAP_ val SC_WRAP_NONE=0 val SC_WRAP_WORD=1 @@ -1403,9 +1414,6 @@ get int GetMultiPaste=2615(,) # Result is NUL-terminated. get int GetTag=2616(int tagNumber, stringresult tagValue)
-# Make the target range start and end be the same as the selection range start and end. -fun void TargetFromSelection=2287(,) - # Join the lines in the target. fun void LinesJoin=2288(,)
@@ -1785,7 +1793,7 @@ val CARET_STRICT=0x04 val CARET_JUMPS=0x10 # If CARET_EVEN is not set, instead of having symmetrical UZs, # the left and bottom UZs are extended up to right and top UZs respectively. -# This way, we favour the displaying of useful information: the begining of lines, +# This way, we favour the displaying of useful information: the beginning of lines, # where most code reside, and the lines after the caret, eg. the body of a function. val CARET_EVEN=0x08
@@ -2350,6 +2358,14 @@ fun void RotateSelection=2606(,) # Swap that caret and anchor of the main selection. fun void SwapMainAnchorCaret=2607(,)
+# Add the next occurrence of the main selection to the set of selections as main. +# If the current selection is empty then select word around caret. +fun void MultipleSelectAddNext=2688(,) + +# Add each occurrence of the main selection in the target to the set of selections. +# If the current selection is empty then select word around caret. +fun void MultipleSelectAddEach=2689(,) + # Indicate that the internal state of a lexer has changed over a range and therefore # there may be a need to redraw. fun int ChangeLexerState=2617(position start, position end) @@ -2642,6 +2658,13 @@ val SCMOD_ALT=4 val SCMOD_SUPER=8 val SCMOD_META=16
+enu CompletionMethods=SC_AC_ +val SC_AC_FILLUP=1 +val SC_AC_DOUBLECLICK=2 +val SC_AC_TAB=3 +val SC_AC_NEWLINE=4 +val SC_AC_COMMAND=5 + ################################################ # For SciLexer.h enu Lexer=SCLEX_ @@ -2786,9 +2809,12 @@ val SCE_P_COMMENTBLOCK=12 val SCE_P_STRINGEOL=13 val SCE_P_WORD2=14 val SCE_P_DECORATOR=15 -# Lexical states for SCLEX_CPP +# Lexical states for SCLEX_CPP, SCLEX_BULLANT, SCLEX_COBOL, SCLEX_TACL, SCLEX_TAL lex Cpp=SCLEX_CPP SCE_C_ lex BullAnt=SCLEX_BULLANT SCE_C_ +lex COBOL=SCLEX_COBOL SCE_C_ +lex TACL=SCLEX_TACL SCE_C_ +lex TAL=SCLEX_TAL SCE_C_ val SCE_C_DEFAULT=0 val SCE_C_COMMENT=1 val SCE_C_COMMENTLINE=2 @@ -3075,10 +3101,13 @@ val SCE_RB_STDIN=30 val SCE_RB_STDOUT=31 val SCE_RB_STDERR=40 val SCE_RB_UPPER_BOUND=41 -# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC +# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC lex VB=SCLEX_VB SCE_B_ lex VBScript=SCLEX_VBSCRIPT SCE_B_ lex PowerBasic=SCLEX_POWERBASIC SCE_B_ +lex BlitzBasic=SCLEX_BLITZBASIC SCE_B_ +lex PureBasic=SCLEX_PUREBASIC SCE_B_ +lex FreeBasic=SCLEX_FREEBASIC SCE_B_ val SCE_B_DEFAULT=0 val SCE_B_COMMENT=1 val SCE_B_NUMBER=2 @@ -3173,6 +3202,24 @@ val SCE_ERR_TIDY=19 val SCE_ERR_JAVA_STACK=20 val SCE_ERR_VALUE=21 val SCE_ERR_GCC_INCLUDED_FROM=22 +val SCE_ERR_ESCSEQ=23 +val SCE_ERR_ESCSEQ_UNKNOWN=24 +val SCE_ERR_ES_BLACK=40 +val SCE_ERR_ES_RED=41 +val SCE_ERR_ES_GREEN=42 +val SCE_ERR_ES_BROWN=43 +val SCE_ERR_ES_BLUE=44 +val SCE_ERR_ES_MAGENTA=45 +val SCE_ERR_ES_CYAN=46 +val SCE_ERR_ES_GRAY=47 +val SCE_ERR_ES_DARK_GRAY=48 +val SCE_ERR_ES_BRIGHT_RED=49 +val SCE_ERR_ES_BRIGHT_GREEN=50 +val SCE_ERR_ES_YELLOW=51 +val SCE_ERR_ES_BRIGHT_BLUE=52 +val SCE_ERR_ES_BRIGHT_MAGENTA=53 +val SCE_ERR_ES_BRIGHT_CYAN=54 +val SCE_ERR_ES_WHITE=55 # Lexical states for SCLEX_BATCH lex Batch=SCLEX_BATCH SCE_BAT_ val SCE_BAT_DEFAULT=0 @@ -4387,6 +4434,7 @@ val SCE_COFFEESCRIPT_TRIPLEVERBATIM=21 val SCE_COFFEESCRIPT_COMMENTBLOCK=22 val SCE_COFFEESCRIPT_VERBOSE_REGEX=23 val SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT=24 +val SCE_COFFEESCRIPT_INSTANCEPROPERTY=25 # Lexical states for SCLEX_AVS lex AVS=SCLEX_AVS SCE_AVS_ val SCE_AVS_DEFAULT=0 @@ -4633,7 +4681,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 position) +evt void UserListSelection=2014(int listType, string text, int positionint, 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) @@ -4641,7 +4689,7 @@ evt void Zoom=2018(void) evt void HotSpotClick=2019(int modifiers, int position) evt void HotSpotDoubleClick=2020(int modifiers, int position) evt void CallTipClick=2021(int position) -evt void AutoCSelection=2022(string text, int position) +evt void AutoCSelection=2022(string text, int position, int ch, CompletionMethods listCompletionMethod) evt void IndicatorClick=2023(int modifiers, int position) evt void IndicatorRelease=2024(int modifiers, int position) evt void AutoCCancelled=2025(void) @@ -4649,6 +4697,7 @@ evt void AutoCCharDeleted=2026(void) evt void HotSpotReleaseClick=2027(int modifiers, int position) evt void FocusIn=2028(void) evt void FocusOut=2029(void) +evt void AutoCCompleted=2030(string text, int position, int ch, CompletionMethods listCompletionMethod)
# There are no provisional features currently
Modified: scintilla/lexers/LexAbaqus.cxx 50 lines changed, 25 insertions(+), 25 deletions(-) =================================================================== @@ -38,7 +38,7 @@ static inline bool IsASetChar(const int ch) { return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-'))); }
-static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */, +static void ColouriseABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList*[] /* *keywordlists[] */, Accessor &styler) { enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \ DAT_LINE_VAL, DAT_LINE_COMMA,\ @@ -301,10 +301,10 @@ static int LowerCase(int c) return c; }
-static int LineEnd(int line, Accessor &styler) +static Sci_Position LineEnd(Sci_Position line, Accessor &styler) { - const int docLines = styler.GetLine(styler.Length() - 1); // Available last line - int eol_pos ; + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line + Sci_Position eol_pos ; // if the line is the last line, the eol_pos is styler.Length() // eol will contain a new line, or a virtual new line if ( docLines == line ) @@ -314,7 +314,7 @@ static int LineEnd(int line, Accessor &styler) return eol_pos ; }
-static int LineStart(int line, Accessor &styler) +static Sci_Position LineStart(Sci_Position line, Accessor &styler) { return styler.LineStart(line) ; } @@ -330,14 +330,14 @@ static int LineStart(int line, Accessor &styler) // 6 : block close keyword line // 7 : keyword line in error // 8 : comment line -static int LineType(int line, Accessor &styler) { - int pos = LineStart(line, styler) ; - int eol_pos = LineEnd(line, styler) ; +static int LineType(Sci_Position line, Accessor &styler) { + Sci_Position pos = LineStart(line, styler) ; + Sci_Position eol_pos = LineEnd(line, styler) ;
int c ; char ch = ' ';
- int i = pos ; + Sci_Position i = pos ; while ( i < eol_pos ) { c = styler.SafeGetCharAt(i); ch = static_cast<char>(LowerCase(c)); @@ -418,7 +418,7 @@ static int LineType(int line, Accessor &styler) { return 4 ; }
-static void SafeSetLevel(int line, int level, Accessor &styler) +static void SafeSetLevel(Sci_Position line, int level, Accessor &styler) { if ( line < 0 ) return ; @@ -432,20 +432,20 @@ static void SafeSetLevel(int line, int level, Accessor &styler) styler.SetLevel(line, level) ; }
-static void FoldABAQUSDoc(unsigned int startPos, int length, int, +static void FoldABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int startLine = styler.GetLine(startPos) ; - int endLine = styler.GetLine(startPos+length-1) ; + Sci_Position startLine = styler.GetLine(startPos) ; + Sci_Position endLine = styler.GetLine(startPos+length-1) ;
// bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; // We want to deal with all the cases // To know the correct indentlevel, we need to look back to the // previous command line indentation level // order of formatting keyline datalines commentlines - int beginData = -1 ; - int beginComment = -1 ; - int prvKeyLine = startLine ; - int prvKeyLineTp = 0 ; + Sci_Position beginData = -1 ; + Sci_Position beginComment = -1 ; + Sci_Position prvKeyLine = startLine ; + Sci_Position prvKeyLineTp = 0 ;
// Scan until we find the previous keyword line // this will give us the level reference that we need @@ -467,7 +467,7 @@ WordList *[], Accessor &styler) { prvKeyLine = -1 ;
// Now start scanning over the lines. - for ( int line = startLine; line <= endLine; line++ ) { + for ( Sci_Position line = startLine; line <= endLine; line++ ) { int lineType = LineType(line, styler) ;
// Check for comment line @@ -516,7 +516,7 @@ WordList *[], Accessor &styler) { datLevel = level ; }
- for ( int ll = beginData; ll < beginComment; ll++ ) + for ( Sci_Position ll = beginData; ll < beginComment; ll++ ) SafeSetLevel(ll, datLevel, styler) ;
// The keyword we just found is going to be written at another level @@ -532,7 +532,7 @@ WordList *[], Accessor &styler) { } }
- for ( int lll = beginComment; lll < line; lll++ ) + for ( Sci_Position lll = beginComment; lll < line; lll++ ) SafeSetLevel(lll, level, styler) ;
// wrap and reset @@ -549,10 +549,10 @@ WordList *[], Accessor &styler) { } else { // We need to find out whether this comment block is followed by // a data line or a keyword line - const int docLines = styler.GetLine(styler.Length() - 1); + const Sci_Position docLines = styler.GetLine(styler.Length() - 1);
- for ( int line = endLine + 1; line <= docLines; line++ ) { - int lineType = LineType(line, styler) ; + for ( Sci_Position line = endLine + 1; line <= docLines; line++ ) { + Sci_Position lineType = LineType(line, styler) ;
if ( lineType != 8 ) { if ( !(lineType & 4) ) { @@ -578,7 +578,7 @@ WordList *[], Accessor &styler) { datLevel = level ; }
- for ( int ll = beginData; ll < beginComment; ll++ ) + for ( Sci_Position ll = beginData; ll < beginComment; ll++ ) SafeSetLevel(ll, datLevel, styler) ;
if ( prvKeyLineTp == 5 ) { @@ -588,7 +588,7 @@ WordList *[], Accessor &styler) { if ( prvKeyLineTp == 6 ) { level -= 1 ; } - for ( int m = beginComment; m <= endLine; m++ ) + for ( Sci_Position m = beginComment; m <= endLine; m++ ) SafeSetLevel(m, level, styler) ; }
Modified: scintilla/lexers/LexAda.cxx 10 lines changed, 5 insertions(+), 5 deletions(-) =================================================================== @@ -34,8 +34,8 @@ using namespace Scintilla; */
static void ColouriseDocument( - unsigned int startPos, - int length, + Sci_PositionU startPos, + Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler); @@ -222,8 +222,8 @@ static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostrophe //
static void ColouriseDocument( - unsigned int startPos, - int length, + Sci_PositionU startPos, + Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { @@ -231,7 +231,7 @@ static void ColouriseDocument(
StyleContext sc(startPos, length, initStyle, styler);
- int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
while (sc.More()) {
Modified: scintilla/lexers/LexAsm.cxx 26 lines changed, 13 insertions(+), 13 deletions(-) =================================================================== @@ -172,13 +172,13 @@ class LexerAsm : public ILexer { const char * SCI_METHOD DescribeProperty(const char *name) { return osAsm.DescribeProperty(name); } - int SCI_METHOD PropertySet(const char *key, const char *val); + Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); const char * SCI_METHOD DescribeWordListSets() { return osAsm.DescribeWordListSets(); } - int SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + 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);
void * SCI_METHOD PrivateCall(int, void *) { return 0; @@ -193,14 +193,14 @@ class LexerAsm : public ILexer { } };
-int SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) { +Sci_Position SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) { if (osAsm.PropertySet(&options, key, val)) { return 0; } return -1; }
-int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { +Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: @@ -228,7 +228,7 @@ int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { wordListN = &directives4foldend; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -240,7 +240,7 @@ int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { return firstModification; }
-void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess);
// Do not leak onto next line @@ -371,16 +371,16 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "else".
-void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
if (!options.fold) return;
LexAccessor styler(pAccess);
- unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -391,7 +391,7 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, char word[100]; int wordlen = 0; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -453,7 +453,7 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, } lineCurrent++; levelCurrent = levelNext; - if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) { + if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length() - 1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); }
Modified: scintilla/lexers/LexBash.cxx 24 lines changed, 12 insertions(+), 12 deletions(-) =================================================================== @@ -96,7 +96,7 @@ static int opposite(int ch) { return ch; }
-static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, +static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0]; @@ -223,14 +223,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
int numBase = 0; int digit; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int cmdState = BASH_CMD_START; int testExprType = 0;
// Always backtracks to the start of a line that is not a continuation // of the previous line (i.e. start of a bash command segment) - int ln = styler.GetLine(startPos); - if (ln > 0 && startPos == static_cast<unsigned int>(styler.LineStart(ln))) + Sci_Position ln = styler.GetLine(startPos); + if (ln > 0 && startPos == static_cast<Sci_PositionU>(styler.LineStart(ln))) ln--; for (;;) { startPos = styler.LineStart(ln); @@ -752,10 +752,10 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.Complete(); }
-static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; @@ -765,19 +765,19 @@ static bool IsCommentLine(int line, Accessor &styler) { return false; }
-static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[], +static void FoldBashDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; int skipHereCh = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext;
Modified: scintilla/lexers/LexBasic.cxx 24 lines changed, 12 insertions(+), 12 deletions(-) =================================================================== @@ -255,13 +255,13 @@ class LexerBasic : public ILexer { const char * SCI_METHOD DescribeProperty(const char *name) { return osBasic.DescribeProperty(name); } - int SCI_METHOD PropertySet(const char *key, const char *val); + Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); const char * SCI_METHOD DescribeWordListSets() { return osBasic.DescribeWordListSets(); } - int SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + 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);
void * SCI_METHOD PrivateCall(int, void *) { return 0; @@ -277,14 +277,14 @@ class LexerBasic : public ILexer { } };
-int SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) { +Sci_Position SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) { if (osBasic.PropertySet(&options, key, val)) { return 0; } return -1; }
-int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { +Sci_Position SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: @@ -300,7 +300,7 @@ int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { wordListN = &keywordlists[3]; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -312,7 +312,7 @@ int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { return firstModification; }
-void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerBasic::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess);
bool wasfirst = true, isfirst = true; // true if first token in a line @@ -471,17 +471,17 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle }
-void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initStyle */, IDocument *pAccess) { +void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) {
if (!options.fold) return;
LexAccessor styler(pAccess);
- int line = styler.GetLine(startPos); + Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line); int go = 0, done = 0; - int endPos = startPos + length; + Sci_Position endPos = startPos + length; char word[256]; int wordlen = 0; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); @@ -489,7 +489,7 @@ void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initS
// Scan for tokens at the start of the line (they may include // whitespace, for tokens like "End Function" - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { int c = cNext; cNext = styler.SafeGetCharAt(i + 1); bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n');
Modified: scintilla/lexers/LexBatch.cxx 500 lines changed, 500 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,500 @@ +// Scintilla source code edit control +/** @file LexBatch.cxx + ** Lexer for batch files. + **/ +// Copyright 1998-2001 by Neil Hodgson neilh@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 <stdarg.h> +#include <assert.h> +#include <ctype.h> + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static bool Is0To9(char ch) { + return (ch >= '0') && (ch <= '9'); +} + +static bool IsAlphabetic(int ch) { + return IsASCII(ch) && isalpha(ch); +} + +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { + return (styler[i] == '\n') || + ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); +} + +// Tests for BATCH Operators +static bool IsBOperator(char ch) { + return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') || + (ch == '|') || (ch == '?') || (ch == '*'); +} + +// Tests for BATCH Separators +static bool IsBSeparator(char ch) { + return (ch == '\') || (ch == '.') || (ch == ';') || + (ch == '"') || (ch == ''') || (ch == '/'); +} + +static void ColouriseBatchLine( + char *lineBuffer, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, + WordList *keywordlists[], + Accessor &styler) { + + Sci_PositionU offset = 0; // Line Buffer Offset + Sci_PositionU cmdLoc; // External Command / Program Location + char wordBuffer[81]; // Word Buffer - large to catch long paths + Sci_PositionU wbl; // Word Buffer Length + Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length + WordList &keywords = *keywordlists[0]; // Internal Commands + WordList &keywords2 = *keywordlists[1]; // External Commands (optional) + + // CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords + // Toggling Regular Keyword Checking off improves readability + // Other Regular Keywords and External Commands / Programs might also benefit from toggling + // Need a more robust algorithm to properly toggle Regular Keyword Checking + bool continueProcessing = true; // Used to toggle Regular Keyword Checking + // Special Keywords are those that allow certain characters without whitespace after the command + // Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path= + // Special Keyword Buffer used to determine if the first n characters is a Keyword + char sKeywordBuffer[10]; // Special Keyword Buffer + bool sKeywordFound; // Exit Special Keyword for-loop if found + + // Skip initial spaces + while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { + offset++; + } + // Colorize Default Text + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + // Set External Command / Program Location + cmdLoc = offset; + + // Check for Fake Label (Comment) or Real Label - return if found + if (lineBuffer[offset] == ':') { + if (lineBuffer[offset + 1] == ':') { + // Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm + styler.ColourTo(endPos, SCE_BAT_COMMENT); + } else { + // Colorize Real Label + styler.ColourTo(endPos, SCE_BAT_LABEL); + } + return; + // Check for Drive Change (Drive Change is internal command) - return if found + } else if ((IsAlphabetic(lineBuffer[offset])) && + (lineBuffer[offset + 1] == ':') && + ((isspacechar(lineBuffer[offset + 2])) || + (((lineBuffer[offset + 2] == '\')) && + (isspacechar(lineBuffer[offset + 3]))))) { + // Colorize Regular Keyword + styler.ColourTo(endPos, SCE_BAT_WORD); + return; + } + + // Check for Hide Command (@ECHO OFF/ON) + if (lineBuffer[offset] == '@') { + styler.ColourTo(startLine + offset, SCE_BAT_HIDE); + offset++; + } + // Skip next spaces + while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { + offset++; + } + + // Read remainder of line word-at-a-time or remainder-of-word-at-a-time + while (offset < lengthLine) { + if (offset > startLine) { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + } + // Copy word from Line Buffer into Word Buffer + wbl = 0; + for (; offset < lengthLine && wbl < 80 && + !isspacechar(lineBuffer[offset]); wbl++, offset++) { + wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset])); + } + wordBuffer[wbl] = '\0'; + wbo = 0; + + // Check for Comment - return if found + if (CompareCaseInsensitive(wordBuffer, "rem") == 0) { + styler.ColourTo(endPos, SCE_BAT_COMMENT); + return; + } + // Check for Separator + if (IsBSeparator(wordBuffer[0])) { + // Check for External Command / Program + if ((cmdLoc == offset - wbl) && + ((wordBuffer[0] == ':') || + (wordBuffer[0] == '\') || + (wordBuffer[0] == '.'))) { + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + // Colorize External Command / Program + if (!keywords2) { + styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); + } else if (keywords2.InList(wordBuffer)) { + styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); + } else { + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + } + // Reset External Command / Program Location + cmdLoc = offset; + } else { + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + // Colorize Default Text + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + } + // Check for Regular Keyword in list + } else if ((keywords.InList(wordBuffer)) && + (continueProcessing)) { + // ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking + if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) || + (CompareCaseInsensitive(wordBuffer, "goto") == 0) || + (CompareCaseInsensitive(wordBuffer, "prompt") == 0) || + (CompareCaseInsensitive(wordBuffer, "set") == 0)) { + continueProcessing = false; + } + // Identify External Command / Program Location for ERRORLEVEL, and EXIST + if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) || + (CompareCaseInsensitive(wordBuffer, "exist") == 0)) { + // Reset External Command / Program Location + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Skip comparison + while ((cmdLoc < lengthLine) && + (!isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Identify External Command / Program Location for CALL, DO, LOADHIGH and LH + } else if ((CompareCaseInsensitive(wordBuffer, "call") == 0) || + (CompareCaseInsensitive(wordBuffer, "do") == 0) || + (CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) || + (CompareCaseInsensitive(wordBuffer, "lh") == 0)) { + // Reset External Command / Program Location + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + } + // Colorize Regular keyword + styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD); + // No need to Reset Offset + // Check for Special Keyword in list, External Command / Program, or Default Text + } else if ((wordBuffer[0] != '%') && + (wordBuffer[0] != '!') && + (!IsBOperator(wordBuffer[0])) && + (continueProcessing)) { + // Check for Special Keyword + // Affected Commands are in Length range 2-6 + // Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected + sKeywordFound = false; + for (Sci_PositionU keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { + wbo = 0; + // Copy Keyword Length from Word Buffer into Special Keyword Buffer + for (; wbo < keywordLength; wbo++) { + sKeywordBuffer[wbo] = static_cast<char>(wordBuffer[wbo]); + } + sKeywordBuffer[wbo] = '\0'; + // Check for Special Keyword in list + if ((keywords.InList(sKeywordBuffer)) && + ((IsBOperator(wordBuffer[wbo])) || + (IsBSeparator(wordBuffer[wbo])))) { + sKeywordFound = true; + // ECHO requires no further Regular Keyword Checking + if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) { + continueProcessing = false; + } + // Colorize Special Keyword as Regular Keyword + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + } + // Check for External Command / Program or Default Text + if (!sKeywordFound) { + wbo = 0; + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + // Read up to %, Operator or Separator + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Reset External Command / Program Location + cmdLoc = offset - (wbl - wbo); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + // CHOICE requires no further Regular Keyword Checking + if (CompareCaseInsensitive(wordBuffer, "choice") == 0) { + continueProcessing = false; + } + // Check for START (and its switches) - What follows is External Command \ Program + if (CompareCaseInsensitive(wordBuffer, "start") == 0) { + // Reset External Command / Program Location + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Reset External Command / Program Location if command switch detected + if (lineBuffer[cmdLoc] == '/') { + // Skip command switch + while ((cmdLoc < lengthLine) && + (!isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + } + } + // Colorize External Command / Program + if (!keywords2) { + styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); + } else if (keywords2.InList(wordBuffer)) { + styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); + } else { + styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); + } + // No need to Reset Offset + // Check for Default Text + } else { + // Read up to %, Operator or Separator + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + } + // Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a) + } else if (wordBuffer[0] == '%') { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + wbo++; + // Search to end of word for second % (can be a long path) + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Check for Argument (%n) or (%*) + if (((Is0To9(wordBuffer[1])) || (wordBuffer[1] == '*')) && + (wordBuffer[wbo] != '%')) { + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - 2); + } + // Colorize Argument + styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - 2); + // Check for Expanded Argument (%~...) / Variable (%%~...) + } else if (((wbl > 1) && (wordBuffer[1] == '~')) || + ((wbl > 2) && (wordBuffer[1] == '%') && (wordBuffer[2] == '~'))) { + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - wbo); + } + // Colorize Expanded Argument / Variable + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + // Check for Environment Variable (%x...%) + } else if ((wordBuffer[1] != '%') && + (wordBuffer[wbo] == '%')) { + wbo++; + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - wbo); + } + // Colorize Environment Variable + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + // Check for Local Variable (%%a) + } else if ( + (wbl > 2) && + (wordBuffer[1] == '%') && + (wordBuffer[2] != '%') && + (!IsBOperator(wordBuffer[2])) && + (!IsBSeparator(wordBuffer[2]))) { + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - 3); + } + // Colorize Local Variable + styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - 3); + } + // Check for Environment Variable (!x...!) + } else if (wordBuffer[0] == '!') { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + wbo++; + // Search to end of word for second ! (can be a long path) + while ((wbo < wbl) && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + if (wordBuffer[wbo] == '!') { + wbo++; + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - wbo); + } + // Colorize Environment Variable + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + // Check for Operator + } else if (IsBOperator(wordBuffer[0])) { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + // Check for Comparison Operator + if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) { + // Identify External Command / Program Location for IF + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Colorize Comparison Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 2); + // Check for Pipe Operator + } else if (wordBuffer[0] == '|') { + // Reset External Command / Program Location + cmdLoc = offset - wbl + 1; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Colorize Pipe Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + // Check for Other Operator + } else { + // Check for > Operator + if (wordBuffer[0] == '>') { + // Turn Keyword and External Command / Program checking back on + continueProcessing = true; + } + // Colorize Other Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + } + // Check for Default Text + } else { + // Read up to %, Operator or Separator + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (wordBuffer[wbo] != '!') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + // Skip next spaces - nothing happens if Offset was Reset + while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { + offset++; + } + } + // Colorize Default Text for remainder of line - currently not lexed + styler.ColourTo(endPos, SCE_BAT_DEFAULT); +} + +static void ColouriseBatchDoc( + Sci_PositionU startPos, + Sci_Position length, + int /*initStyle*/, + WordList *keywordlists[], + Accessor &styler) { + + char lineBuffer[1024]; + + styler.StartAt(startPos); + styler.StartSegment(startPos); + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { + // End of line (or of line buffer) met, colourise it + lineBuffer[linePos] = '\0'; + ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler); + linePos = 0; + startLine = i + 1; + } + } + if (linePos > 0) { // Last line does not have ending characters + lineBuffer[linePos] = '\0'; + ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1, + keywordlists, styler); + } +} + +static const char *const batchWordListDesc[] = { + "Internal Commands", + "External Commands", + 0 +}; + +LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);
Modified: scintilla/lexers/LexCOBOL.cxx 30 lines changed, 15 insertions(+), 15 deletions(-) =================================================================== @@ -64,12 +64,12 @@ static int CountBits(int nBits) return count; }
-static void getRange(unsigned int start, - unsigned int end, +static void getRange(Sci_PositionU start, + Sci_PositionU end, Accessor &styler, char *s, - unsigned int len) { - unsigned int i = 0; + Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast<char>(tolower(styler[start + i])); i++; @@ -77,12 +77,12 @@ static void getRange(unsigned int start, s[i] = '\0'; }
-static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) { +static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr) { styler.ColourTo(end, attr); }
-static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { +static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { int ret = 0;
WordList& a_keywords = *keywordlists[0]; @@ -142,7 +142,7 @@ static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &k return ret; }
-static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], +static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
styler.StartAt(startPos); @@ -152,11 +152,11 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length;
int nContainment;
- int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); if (currentLine > 0) { styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); nContainment = styler.GetLineState(currentLine); @@ -170,7 +170,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, bool bNewLine = true; bool bAarea = !isspacechar(chNext); int column = 0; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1); @@ -277,7 +277,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, if (ch == '\r' || ch == '\n') { if (((i > styler.GetStartSegment() + 2) || ( (initStyle == SCE_C_COMMENTDOC) && - (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { + (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) { ColourTo(styler, i, state); state = SCE_C_DEFAULT; } @@ -309,12 +309,12 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, ColourTo(styler, lengthDoc - 1, state); }
-static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[], +static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF; char chNext = styler[startPos];
@@ -322,7 +322,7 @@ static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[], bool bAarea = !isspacechar(chNext); int column = 0; bool bComment = false; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); ++column;
Modified: scintilla/lexers/LexCPP.cxx 72 lines changed, 36 insertions(+), 36 deletions(-) =================================================================== @@ -54,7 +54,7 @@ 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) { - int pos = (int) sc.currentPos; + Sci_Position pos = (Sci_Position) sc.currentPos; while (--pos > 0) { char ch = styler[pos]; if (ch == '+' || ch == '-') { @@ -66,9 +66,9 @@ bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { // Don't look at styles, so no need to flush. - int pos = (int) sc.currentPos; - int currentLine = styler.GetLine(pos); - int lineStartPos = styler.LineStart(currentLine); + Sci_Position pos = (Sci_Position) sc.currentPos; + Sci_Position currentLine = styler.GetLine(pos); + Sci_Position lineStartPos = styler.LineStart(currentLine); while (--pos > lineStartPos) { char ch = styler.SafeGetCharAt(pos); if (ch != ' ' && ch != '\t') { @@ -145,7 +145,7 @@ void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { const int lengthMarker = 50; char marker[lengthMarker+1]; - int currPos = (int) sc.currentPos; + Sci_Position currPos = (Sci_Position) sc.currentPos; int i = 0; while (i < lengthMarker) { char ch = styler.SafeGetCharAt(currPos + i); @@ -199,11 +199,11 @@ struct EscapeSequence { } };
-std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) { +std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) { std::string restOfLine; - int i =0; + Sci_Position i =0; char ch = styler.SafeGetCharAt(start, '\n'); - int endLine = styler.LineEnd(styler.GetLine(start)); + Sci_Position endLine = styler.LineEnd(styler.GetLine(start)); while (((start+i) < endLine) && (ch != '\r')) { char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); if (ch == '/' && (chNext == '/' || chNext == '*')) @@ -224,12 +224,12 @@ bool IsStreamCommentStyle(int style) { }
struct PPDefinition { - int line; + Sci_Position line; std::string key; std::string value; bool isUndef; std::string arguments; - PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : + PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) { } }; @@ -285,14 +285,14 @@ class LinePPState { class PPStates { std::vector<LinePPState> vlls; public: - LinePPState ForLine(int line) const { + LinePPState ForLine(Sci_Position line) const { if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) { return vlls[line]; } else { return LinePPState(); } } - void Add(int line, LinePPState lls) { + void Add(Sci_Position line, LinePPState lls) { vlls.resize(line+1); vlls[line] = lls; } @@ -495,13 +495,13 @@ class LexerCPP : public ILexerWithSubStyles { const char * SCI_METHOD DescribeProperty(const char *name) { return osCPP.DescribeProperty(name); } - int SCI_METHOD PropertySet(const char *key, const char *val); + Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); const char * SCI_METHOD DescribeWordListSets() { return osCPP.DescribeWordListSets(); } - int SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + 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);
void * SCI_METHOD PrivateCall(int, void *) { return 0; @@ -555,7 +555,7 @@ class LexerCPP : public ILexerWithSubStyles { bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions); };
-int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { +Sci_Position SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { if (osCPP.PropertySet(&options, key, val)) { if (strcmp(key, "lexer.cpp.allow.dollars") == 0) { setWord = CharacterSet(CharacterSet::setAlphaNum, "._", 0x80, true); @@ -568,7 +568,7 @@ int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { return -1; }
-int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { +Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: @@ -590,7 +590,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { wordListN = &markerList; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -630,14 +630,14 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
// Functor used to truncate history struct After { - int line; - explicit After(int line_) : line(line_) {} + Sci_Position line; + explicit After(Sci_Position line_) : line(line_) {} bool operator()(PPDefinition &p) const { return p.line > line; } };
-void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess);
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); @@ -664,13 +664,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, bool inRERange = false; bool seenDocKeyBrace = false;
- int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || (MaskActive(initStyle) == SCE_C_COMMENTLINE) || (MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) { // Set continuationLine if last character of previous line is '' if (lineCurrent > 0) { - int endLinePrevious = styler.LineEnd(lineCurrent - 1); + Sci_Position endLinePrevious = styler.LineEnd(lineCurrent - 1); if (endLinePrevious > 0) { continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\'; } @@ -679,7 +679,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// look back to set chPrevNonWhite properly for better regex colouring if (startPos > 0) { - int back = startPos; + Sci_Position back = startPos; while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back)))) ; if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) { @@ -719,7 +719,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER); const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD);
- int lineEndNext = styler.LineEnd(lineCurrent); + Sci_Position lineEndNext = styler.LineEnd(lineCurrent);
for (; sc.More();) {
@@ -757,7 +757,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// Handle line continuation generically. if (sc.ch == '\') { - if (static_cast<int>((sc.currentPos+1)) >= lineEndNext) { + if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) { lineCurrent++; lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); @@ -1026,7 +1026,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, while ((sc.ch < 0x80) && islower(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '\' && (static_cast<int>(sc.currentPos+1) < lineEndNext)) { + } else if (sc.ch == '\' && (static_cast<Sci_Position>(sc.currentPos+1) < lineEndNext)) { // Gobble up the escaped character sc.Forward(); } else if (sc.ch == '[') { @@ -1132,7 +1132,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) { sc.SetState(SCE_C_STRINGRAW|activitySet); rawStringTerminator = ")"; - for (int termPos = sc.currentPos + 1;; termPos++) { + for (Sci_Position termPos = sc.currentPos + 1;; termPos++) { char chTerminator = styler.SafeGetCharAt(termPos, '('); if (chTerminator == '(') break; @@ -1279,28 +1279,28 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {".
-void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { +void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
if (!options.fold) return;
LexAccessor styler(pAccess);
- unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; bool inLineComment = false; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - unsigned int lineStartNext = styler.LineStart(lineCurrent+1); + Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = MaskActive(styler.StyleAt(startPos)); int style = MaskActive(initStyle); const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -1337,7 +1337,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, } if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '#') { - unsigned int j = i + 1; + Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -1379,7 +1379,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, lineStartNext = styler.LineStart(lineCurrent+1); levelCurrent = levelNext; levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) { + if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); }
Modified: scintilla/lexers/LexCSS.cxx 24 lines changed, 12 insertions(+), 12 deletions(-) =================================================================== @@ -58,11 +58,11 @@ inline bool IsCssOperator(const int ch) { }
// look behind (from start of document to our start position) to determine current nesting level -inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) { +inline int NestingLevelLookBehind(Sci_PositionU startPos, Accessor &styler) { int ch; int nestingLevel = 0;
- for (unsigned int i = 0; i < startPos; i++) { + for (Sci_PositionU i = 0; i < startPos; i++) { ch = styler.SafeGetCharAt(i); if (ch == '{') nestingLevel++; @@ -73,7 +73,7 @@ inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) { return nestingLevel; }
-static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { +static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &css1Props = *keywordlists[0]; WordList &pseudoClasses = *keywordlists[1]; WordList &css2Props = *keywordlists[2]; @@ -131,7 +131,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo if (lastStateC == -1) { // backtrack to get last state: // comments are like whitespace, so we must return to the previous state - unsigned int i = startPos; + Sci_PositionU i = startPos; for (; i > 0; i--) { if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) { if (lastStateC == SCE_CSS_OPERATOR) { @@ -165,7 +165,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) { if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '"' : ''')) continue; - unsigned int i = sc.currentPos; + Sci_PositionU i = sc.currentPos; while (i && styler[i-1] == '\') i--; if ((sc.currentPos - i) % 2 == 1) @@ -175,7 +175,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.state == SCE_CSS_OPERATOR) { if (op == ' ') { - unsigned int i = startPos; + Sci_PositionU i = startPos; op = styler.SafeGetCharAt(i-1); opPrev = styler.SafeGetCharAt(i-2); while (--i) { @@ -380,10 +380,10 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo // check for nested rule selector if (sc.state == SCE_CSS_IDENTIFIER && (IsAWordChar(sc.ch) || sc.ch == ':' || sc.ch == '.' || sc.ch == '#')) { // look ahead to see whether { comes before next ; and } - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int ch;
- for (unsigned int i = sc.currentPos; i < endPos; i++) { + for (Sci_PositionU i = sc.currentPos; i < endPos; i++) { ch = styler.SafeGetCharAt(i); if (ch == ';' || ch == '}') break; @@ -502,17 +502,17 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo sc.Complete(); }
-static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { +static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i);
Modified: scintilla/lexers/LexCaml.cxx 27 lines changed, 14 insertions(+), 13 deletions(-) ===@@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).