Skip to content
Browse files

Update Scintilla to version 3.2.0

  • Loading branch information...
1 parent 40da14b commit 4dd0fe917501e1d67bf840f8f183acb32ad92b5b @b4n b4n committed
Showing with 2,435 additions and 2,477 deletions.
  1. +150 −1,054 scintilla/gtk/PlatGTK.cxx
  2. +48 −94 scintilla/gtk/ScintillaGTK.cxx
  3. +8 −0 scintilla/include/ILexer.h
  4. +77 −119 scintilla/include/Platform.h
  5. +130 −0 scintilla/include/SciLexer.h
  6. +29 −2 scintilla/include/Scintilla.h
  7. +224 −9 scintilla/include/Scintilla.iface
  8. +1 −0 scintilla/lexers/LexAda.cxx
  9. +1 −5 scintilla/lexers/LexAsm.cxx
  10. +9 −2 scintilla/lexers/LexBash.cxx
  11. +1 −5 scintilla/lexers/LexBasic.cxx
  12. +30 −20 scintilla/lexers/LexCPP.cxx
  13. +204 −24 scintilla/lexers/LexCSS.cxx
  14. +1 −5 scintilla/lexers/LexD.cxx
  15. +19 −12 scintilla/lexers/LexHTML.cxx
  16. +1 −0 scintilla/lexers/LexNsis.cxx
  17. +25 −8 scintilla/lexers/LexOthers.cxx
  18. +20 −0 scintilla/lexers/LexPascal.cxx
  19. +2 −7 scintilla/lexers/LexPerl.cxx
  20. +2 −4 scintilla/lexers/LexRuby.cxx
  21. +128 −35 scintilla/lexers/LexSQL.cxx
  22. +0 −3 scintilla/lexers/LexVHDL.cxx
  23. +1 −1 scintilla/lexlib/LexAccessor.h
  24. +2 −2 scintilla/lexlib/PropSetSimple.cxx
  25. +14 −5 scintilla/scintilla_changes.patch
  26. +7 −4 scintilla/src/AutoComplete.cxx
  27. +2 −1 scintilla/src/AutoComplete.h
  28. +34 −29 scintilla/src/CallTip.cxx
  29. +12 −11 scintilla/src/CallTip.h
  30. +8 −0 scintilla/src/CellBuffer.cxx
  31. +2 −0 scintilla/src/CellBuffer.h
  32. +2 −2 scintilla/src/Decoration.cxx
  33. +155 −126 scintilla/src/Document.cxx
  34. +8 −3 scintilla/src/Document.h
  35. +590 −509 scintilla/src/Editor.cxx
  36. +16 −18 scintilla/src/Editor.h
  37. +3 −0 scintilla/src/FontQuality.h
  38. +5 −9 scintilla/src/Indicator.cxx
  39. +1 −1 scintilla/src/Indicator.h
  40. +82 −86 scintilla/src/LineMarker.cxx
  41. +18 −17 scintilla/src/LineMarker.h
  42. +39 −24 scintilla/src/PerLine.cxx
  43. +1 −0 scintilla/src/PerLine.h
  44. +9 −9 scintilla/src/PositionCache.cxx
  45. +7 −7 scintilla/src/PositionCache.h
  46. +25 −11 scintilla/src/ScintillaBase.cxx
  47. +0 −2 scintilla/src/ScintillaBase.h
  48. +18 −0 scintilla/src/SplitVector.h
  49. +18 −20 scintilla/src/Style.cxx
  50. +8 −10 scintilla/src/Style.h
  51. +117 −0 scintilla/src/UniConversion.cxx
  52. +15 −0 scintilla/src/UniConversion.h
  53. +73 −93 scintilla/src/ViewStyle.cxx
  54. +23 −23 scintilla/src/ViewStyle.h
  55. +6 −38 scintilla/src/XPM.cxx
  56. +3 −7 scintilla/src/XPM.h
  57. +1 −1 scintilla/version.txt
View
1,204 scintilla/gtk/PlatGTK.cxx
150 additions, 1,054 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
142 scintilla/gtk/ScintillaGTK.cxx
@@ -64,6 +64,11 @@
#include "Converter.h"
+#if defined(__clang__)
+// Clang 3.0 incorrectly displays sentinel warnings. Fixed by clang 3.1.
+#pragma GCC diagnostic ignored "-Wsentinel"
+#endif
+
#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)))
@@ -74,8 +79,6 @@
#define IS_WIDGET_VISIBLE(w) (GTK_WIDGET_VISIBLE(w))
#endif
-#define USE_CAIRO 1
-
static GdkWindow *WindowFromWidget(GtkWidget *w) {
#if GTK_CHECK_VERSION(3,0,0)
return gtk_widget_get_window(w);
@@ -100,10 +103,6 @@ static GdkWindow *PWindow(const Window &w) {
#pragma warning(disable: 4505)
#endif
-#if GTK_CHECK_VERSION(2,6,0)
-#define USE_GTK_CLIPBOARD
-#endif
-
#define OBJECT_CLASS GObjectClass
#ifdef SCI_NAMESPACE
@@ -122,11 +121,6 @@ class ScintillaGTK : public ScintillaBase {
int scrollBarWidth;
int scrollBarHeight;
- // Because clipboard access is asynchronous, copyText is created by Copy
-#ifndef USE_GTK_CLIPBOARD
- SelectionText copyText;
-#endif
-
SelectionText primary;
GdkEventButton evbtn;
@@ -218,11 +212,9 @@ class ScintillaGTK : public ScintillaBase {
void ReceivedSelection(GtkSelectionData *selection_data);
void ReceivedDrop(GtkSelectionData *selection_data);
static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *selected);
-#ifdef USE_GTK_CLIPBOARD
void StoreOnClipboard(SelectionText *clipText);
static void ClipboardGetSelection(GtkClipboard* clip, GtkSelectionData *selection_data, guint info, void *data);
static void ClipboardClearSelection(GtkClipboard* clip, void *data);
-#endif
void UnclaimSelection(GdkEventSelection *selection_event);
void Resize(int width, int height);
@@ -505,10 +497,6 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) {
gtk_selection_add_targets(widget, GDK_SELECTION_PRIMARY,
clipboardCopyTargets, nClipboardCopyTargets);
-#ifndef USE_GTK_CLIPBOARD
- gtk_selection_add_targets(widget, atomClipboard,
- clipboardPasteTargets, nClipboardPasteTargets);
-#endif
}
void ScintillaGTK::Realize(GtkWidget *widget) {
@@ -519,9 +507,6 @@ void ScintillaGTK::Realize(GtkWidget *widget) {
void ScintillaGTK::UnRealizeThis(GtkWidget *widget) {
try {
gtk_selection_clear_targets(widget, GDK_SELECTION_PRIMARY);
-#ifndef USE_GTK_CLIPBOARD
- gtk_selection_clear_targets(widget, atomClipboard);
-#endif
if (IS_WIDGET_MAPPED(widget)) {
gtk_widget_unmap(widget);
@@ -594,7 +579,7 @@ void ScintillaGTK::UnMapThis() {
#else
GTK_WIDGET_UNSET_FLAGS(PWidget(wMain), GTK_MAPPED);
#endif
- DropGraphics();
+ DropGraphics(false);
gdk_window_hide(PWindow(wMain));
gtk_widget_unmap(PWidget(wText));
gtk_widget_unmap(PWidget(scrollbarh));
@@ -739,6 +724,7 @@ void ScintillaGTK::Initialise() {
#endif
gtk_widget_set_events(PWidget(wMain),
GDK_EXPOSURE_MASK
+ | GDK_SCROLL_MASK
| GDK_STRUCTURE_MASK
| GDK_KEY_PRESS_MASK
| GDK_KEY_RELEASE_MASK
@@ -765,7 +751,11 @@ void ScintillaGTK::Initialise() {
gtk_widget_set_double_buffered(widtxt, FALSE);
gtk_widget_set_size_request(widtxt, 100, 100);
adjustmentv = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 201.0, 1.0, 20.0, 20.0));
+#if GTK_CHECK_VERSION(3,0,0)
+ scrollbarv = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT(adjustmentv));
+#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
@@ -777,7 +767,11 @@ void ScintillaGTK::Initialise() {
gtk_widget_show(PWidget(scrollbarv));
adjustmenth = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 101.0, 1.0, 20.0, 20.0));
+#if GTK_CHECK_VERSION(3,0,0)
+ scrollbarh = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT(adjustmenth));
+#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
@@ -1085,8 +1079,8 @@ bool ScintillaGTK::PaintContains(PRectangle rc) {
rc.right - rc.left, rc.bottom - rc.top};
contains = CRectListContains(rgnUpdate, grc);
#else
- GdkRectangle grc = {rc.left, rc.top,
- rc.right - rc.left, rc.bottom - rc.top};
+ GdkRectangle grc = {static_cast<gint>(rc.left), static_cast<gint>(rc.top),
+ static_cast<gint>(rc.right - rc.left), static_cast<gint>(rc.bottom - rc.top)};
if (gdk_region_rect_in(rgnUpdate, &grc) != GDK_OVERLAP_RECTANGLE_IN) {
contains = false;
}
@@ -1122,20 +1116,14 @@ void ScintillaGTK::SyncPaint(PRectangle rc) {
PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient);
if (PWindow(wText)) {
- Surface *sw = Surface::Allocate();
+ Surface *sw = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (sw) {
-#if GTK_CHECK_VERSION(3,0,0)
cairo_t *cr = gdk_cairo_create(PWindow(wText));
sw->Init(cr, PWidget(wText));
-#else
- sw->Init(PWindow(wText), PWidget(wText));
-#endif
Paint(sw, rc);
sw->Release();
delete sw;
-#if GTK_CHECK_VERSION(3,0,0)
cairo_destroy(cr);
-#endif
}
}
if (paintState == paintAbandoned) {
@@ -1151,8 +1139,10 @@ void ScintillaGTK::ScrollText(int linesToMove) {
// rc.left, rc.top, rc.right, rc.bottom);
GtkWidget *wi = PWidget(wText);
- gdk_window_scroll(WindowFromWidget(wi), 0, -diff);
- gdk_window_process_updates(WindowFromWidget(wi), FALSE);
+ if (IS_WIDGET_REALIZED(wi)) {
+ gdk_window_scroll(WindowFromWidget(wi), 0, -diff);
+ gdk_window_process_updates(WindowFromWidget(wi), FALSE);
+ }
}
void ScintillaGTK::SetVerticalScrollPos() {
@@ -1416,48 +1406,22 @@ std::string ScintillaGTK::CaseMapString(const std::string &s, int caseMapping) {
}
int ScintillaGTK::KeyDefault(int key, int modifiers) {
- if (!(modifiers & SCI_CTRL) && !(modifiers & SCI_ALT)) {
- if (key < 256) {
- NotifyKey(key, modifiers);
- return 0;
- } else {
- // Pass up to container in case it is an accelerator
- NotifyKey(key, modifiers);
- return 0;
- }
- } else {
- // Pass up to container in case it is an accelerator
- NotifyKey(key, modifiers);
- return 0;
- }
- //Platform::DebugPrintf("SK-key: %d %x %x\n",key, modifiers);
+ // Pass up to container in case it is an accelerator
+ NotifyKey(key, modifiers);
+ return 0;
}
void ScintillaGTK::CopyToClipboard(const SelectionText &selectedText) {
-#ifndef USE_GTK_CLIPBOARD
- copyText.Copy(selectedText);
- gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)),
- atomClipboard,
- GDK_CURRENT_TIME);
-#else
SelectionText *clipText = new SelectionText();
clipText->Copy(selectedText);
StoreOnClipboard(clipText);
-#endif
}
void ScintillaGTK::Copy() {
if (!sel.Empty()) {
-#ifndef USE_GTK_CLIPBOARD
- CopySelectionRange(&copyText);
- gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)),
- atomClipboard,
- GDK_CURRENT_TIME);
-#else
SelectionText *clipText = new SelectionText();
CopySelectionRange(clipText);
StoreOnClipboard(clipText);
-#endif
#if PLAT_GTK_WIN32
if (sel.IsRectangular()) {
::OpenClipboard(NULL);
@@ -1717,7 +1681,6 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
#endif
}
-#ifdef USE_GTK_CLIPBOARD
void ScintillaGTK::StoreOnClipboard(SelectionText *clipText) {
GtkClipboard *clipBoard =
gtk_widget_get_clipboard(GTK_WIDGET(PWidget(wMain)), atomClipboard);
@@ -1738,7 +1701,6 @@ void ScintillaGTK::ClipboardClearSelection(GtkClipboard *, void *data) {
SelectionText *obj = static_cast<SelectionText*>(data);
delete obj;
}
-#endif
void ScintillaGTK::UnclaimSelection(GdkEventSelection *selection_event) {
try {
@@ -2010,6 +1972,13 @@ gint ScintillaGTK::ScrollEvent(GtkWidget *widget,
return FALSE;
}
+#if GTK_CHECK_VERSION(3,4,0)
+ // Smooth scrolling not supported
+ if (event->direction == GDK_SCROLL_SMOOTH) {
+ return FALSE;
+ }
+#endif
+
// Horizontal scrolling
if (event->direction == GDK_SCROLL_LEFT || event->direction == GDK_SCROLL_RIGHT) {
sciThis->HorizontalScrollTo(sciThis->xOffset + cLineScroll);
@@ -2043,7 +2012,12 @@ gint ScintillaGTK::Motion(GtkWidget *widget, GdkEventMotion *event) {
int y = 0;
GdkModifierType state;
if (event->is_hint) {
+#if GTK_CHECK_VERSION(3,0,0)
+ gdk_window_get_device_position(event->window,
+ event->device, &x, &y, &state);
+#else
gdk_window_get_pointer(event->window, &x, &y, &state);
+#endif
} else {
x = static_cast<int>(event->x);
y = static_cast<int>(event->y);
@@ -2235,8 +2209,7 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) {
bool added = KeyDown(key, shift, ctrl, alt, &consumed) != 0;
#else
bool meta = ctrl;
- ctrl = alt;
- alt = (event->state & GDK_MOD5_MASK) != 0;
+ ctrl = (event->state & GDK_META_MASK) != 0;
bool added = KeyDownWithModifiers(key, (shift ? SCI_SHIFT : 0) |
(ctrl ? SCI_CTRL : 0) |
(alt ? SCI_ALT : 0) |
@@ -2312,28 +2285,10 @@ gboolean ScintillaGTK::ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose)
PangoLayout *layout = gtk_widget_create_pango_layout(PWidget(wText), str);
pango_layout_set_attributes(layout, attrs);
-#ifdef USE_CAIRO
cairo_t *context = gdk_cairo_create(reinterpret_cast<GdkDrawable *>(WindowFromWidget(widget)));
cairo_move_to(context, 0, 0);
pango_cairo_show_layout(context, layout);
cairo_destroy(context);
-#else
- GdkGC *gc = gdk_gc_new(widget->window);
- GdkColor color[2] = { {0, 0x0000, 0x0000, 0x0000},
- {0, 0xffff, 0xffff, 0xffff}
- };
- gdk_colormap_alloc_color(gdk_colormap_get_system(), color, FALSE, TRUE);
- gdk_colormap_alloc_color(gdk_colormap_get_system(), color + 1, FALSE, TRUE);
-
- gdk_gc_set_foreground(gc, color + 1);
- gdk_draw_rectangle(widget->window, gc, TRUE, ose->area.x, ose->area.y,
- ose->area.width, ose->area.height);
-
- gdk_gc_set_foreground(gc, color);
- gdk_gc_set_background(gc, color + 1);
- gdk_draw_layout(widget->window, gc, 0, 0, layout);
- g_object_unref(gc);
-#endif
g_free(str);
pango_attr_list_unref(attrs);
g_object_unref(layout);
@@ -2483,7 +2438,7 @@ gboolean ScintillaGTK::DrawTextThis(cairo_t *cr) {
rcPaint.bottom = y2;
PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient);
- Surface *surfaceWindow = Surface::Allocate();
+ Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (surfaceWindow) {
surfaceWindow->Init(cr, PWidget(wText));
Paint(surfaceWindow, rcPaint);
@@ -2544,12 +2499,14 @@ gboolean ScintillaGTK::ExposeTextThis(GtkWidget * /*widget*/, GdkEventExpose *os
rgnUpdate = gdk_region_copy(ose->region);
PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient);
- Surface *surfaceWindow = Surface::Allocate();
+ Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (surfaceWindow) {
- surfaceWindow->Init(PWindow(wText), PWidget(wText));
+ cairo_t *cr = gdk_cairo_create(PWindow(wText));
+ surfaceWindow->Init(cr, PWidget(wText));
Paint(surfaceWindow, rcPaint);
surfaceWindow->Release();
delete surfaceWindow;
+ cairo_destroy(cr);
}
if (paintState == paintAbandoned) {
// Painting area was insufficient to cover new styling or brace highlight positions
@@ -2640,11 +2597,6 @@ void ScintillaGTK::SelectionGet(GtkWidget *widget,
}
sciThis->GetSelection(selection_data, info, &sciThis->primary);
}
-#ifndef USE_GTK_CLIPBOARD
- else {
- sciThis->GetSelection(selection_data, info, &sciThis->copyText);
- }
-#endif
} catch (...) {
sciThis->errorStatus = SC_STATUS_FAILURE;
}
@@ -2841,7 +2793,7 @@ gboolean ScintillaGTK::PressCT(GtkWidget *widget, GdkEventButton *event, Scintil
gboolean ScintillaGTK::DrawCT(GtkWidget *widget, cairo_t *cr, CallTip *ctip) {
try {
- Surface *surfaceWindow = Surface::Allocate();
+ Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (surfaceWindow) {
surfaceWindow->Init(cr, widget);
surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
@@ -2860,14 +2812,16 @@ gboolean ScintillaGTK::DrawCT(GtkWidget *widget, cairo_t *cr, CallTip *ctip) {
gboolean ScintillaGTK::ExposeCT(GtkWidget *widget, GdkEventExpose * /*ose*/, CallTip *ctip) {
try {
- Surface *surfaceWindow = Surface::Allocate();
+ Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (surfaceWindow) {
- surfaceWindow->Init(WindowFromWidget(widget), widget);
+ cairo_t *cr = gdk_cairo_create(WindowFromWidget(widget));
+ surfaceWindow->Init(cr, widget);
surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ctip->codePage);
surfaceWindow->SetDBCSMode(ctip->codePage);
ctip->PaintCT(surfaceWindow);
surfaceWindow->Release();
delete surfaceWindow;
+ cairo_destroy(cr);
}
} catch (...) {
// No pointer back to Scintilla to save status
View
8 scintilla/include/ILexer.h
@@ -62,6 +62,14 @@ class ILexer {
virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0;
};
+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 void * SCI_METHOD ConvertToDocument() = 0;
+};
+
#ifdef SCI_NAMESPACE
}
#endif
View
196 scintilla/include/Platform.h
@@ -20,6 +20,7 @@
#define PLAT_MACOSX 0
#define PLAT_WIN 0
#define PLAT_WX 0
+#define PLAT_QT 0
#define PLAT_FOX 0
#if defined(FOX)
@@ -34,6 +35,10 @@
#undef PLAT_GTK
#define PLAT_GTK 1
+#elif defined(SCINTILLA_QT)
+#undef PLAT_QT
+#define PLAT_QT 1
+
#if defined(__WIN32__) || defined(_MSC_VER)
#undef PLAT_GTK_WIN32
#define PLAT_GTK_WIN32 1
@@ -59,6 +64,10 @@
namespace Scintilla {
#endif
+typedef float XYPOSITION;
+typedef double XYACCUMULATOR;
+//#define XYPOSITION int
+
// Underlying the implementation of the platform classes are platform specific types.
// Sometimes these need to be passed around by client code so they are defined here
@@ -76,10 +85,10 @@ typedef void *IdlerID;
*/
class Point {
public:
- int x;
- int y;
+ XYPOSITION x;
+ XYPOSITION y;
- explicit Point(int x_=0, int y_=0) : x(x_), y(y_) {
+ explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
@@ -94,12 +103,12 @@ class Point {
*/
class PRectangle {
public:
- int left;
- int top;
- int right;
- int bottom;
+ XYPOSITION left;
+ XYPOSITION top;
+ XYPOSITION right;
+ XYPOSITION bottom;
- PRectangle(int left_=0, int top_=0, int right_=0, int bottom_ = 0) :
+ PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :
left(left_), top(top_), right(right_), bottom(bottom_) {
}
@@ -121,32 +130,20 @@ class PRectangle {
return (right > other.left) && (left < other.right) &&
(bottom > other.top) && (top < other.bottom);
}
- void Move(int xDelta, int yDelta) {
+ void Move(XYPOSITION xDelta, XYPOSITION yDelta) {
left += xDelta;
top += yDelta;
right += xDelta;
bottom += yDelta;
}
- int Width() { return right - left; }
- int Height() { return bottom - top; }
+ XYPOSITION Width() { return right - left; }
+ XYPOSITION Height() { return bottom - top; }
bool Empty() {
return (Height() <= 0) || (Width() <= 0);
}
};
/**
- * In some circumstances, including Win32 in paletted mode and GTK+, each colour
- * must be allocated before use. The desired colours are held in the ColourDesired class,
- * and after allocation the allocation entry is stored in the ColourAllocated class. In other
- * circumstances, such as Win32 in true colour mode, the allocation process just copies
- * the RGB values from the desired to the allocated class.
- * As each desired colour requires allocation before it can be used, the ColourPair class
- * holds both a ColourDesired and a ColourAllocated
- * The Palette class is responsible for managing the palette of colours which contains a
- * list of ColourPair objects and performs the allocation.
- */
-
-/**
* Holds a desired RGB colour.
*/
class ColourDesired {
@@ -211,82 +208,39 @@ class ColourDesired {
};
/**
- * Holds an allocated RGB colour which may be an approximation to the desired colour.
- */
-class ColourAllocated {
- long coAllocated;
-
-public:
-
- ColourAllocated(long lcol=0) {
- coAllocated = lcol;
- }
-
- void Set(long lcol) {
- coAllocated = lcol;
- }
-
- long AsLong() const {
- return coAllocated;
- }
-};
-
-/**
- * Colour pairs hold a desired colour and an allocated colour.
+ * Font management.
*/
-struct ColourPair {
- ColourDesired desired;
- ColourAllocated allocated;
- ColourPair(ColourDesired desired_=ColourDesired(0,0,0)) {
- desired = desired_;
- allocated.Set(desired.AsLong());
- }
- void Copy() {
- allocated.Set(desired.AsLong());
+struct FontParameters {
+ const char *faceName;
+ float size;
+ int weight;
+ bool italic;
+ int extraFontFlag;
+ int technology;
+ int characterSet;
+
+ FontParameters(
+ const char *faceName_,
+ float size_=10,
+ int weight_=400,
+ bool italic_=false,
+ int extraFontFlag_=0,
+ int technology_=0,
+ int characterSet_=0) :
+
+ faceName(faceName_),
+ size(size_),
+ weight(weight_),
+ italic(italic_),
+ extraFontFlag(extraFontFlag_),
+ technology(technology_),
+ characterSet(characterSet_)
+ {
}
-};
-
-class Window; // Forward declaration for Palette
-
-/**
- * Colour palette management.
- */
-class Palette {
- int used;
- int size;
- ColourPair *entries;
-#if PLAT_GTK
- void *allocatedPalette; // GdkColor *
- int allocatedLen;
-#endif
- // Private so Palette objects can not be copied
- Palette(const Palette &);
- Palette &operator=(const Palette &);
-public:
-#if PLAT_WIN
- void *hpal;
-#endif
- bool allowRealization;
- Palette();
- ~Palette();
-
- void Release();
-
- /**
- * This method either adds a colour to the list of wanted colours (want==true)
- * or retrieves the allocated colour back to the ColourPair.
- * This is one method to make it easier to keep the code for wanting and retrieving in sync.
- */
- void WantFind(ColourPair &cp, bool want);
-
- void Allocate(Window &w);
};
-/**
- * Font management.
- */
class Font {
protected:
FontID fid;
@@ -300,8 +254,7 @@ class Font {
Font();
virtual ~Font();
- virtual void Create(const char *faceName, int characterSet, int size,
- bool bold, bool italic, int extraFontFlag=0);
+ virtual void Create(const FontParameters &fp);
virtual void Release();
FontID GetID() { return fid; }
@@ -325,7 +278,7 @@ class Surface {
public:
Surface() {}
virtual ~Surface() {}
- static Surface *Allocate();
+ static Surface *Allocate(int technology);
virtual void Init(WindowID wid)=0;
virtual void Init(SurfaceID sid, WindowID wid)=0;
@@ -333,36 +286,35 @@ class Surface {
virtual void Release()=0;
virtual bool Initialised()=0;
- virtual void PenColour(ColourAllocated fore)=0;
+ virtual void PenColour(ColourDesired fore)=0;
virtual int LogPixelsY()=0;
virtual int DeviceHeightFont(int points)=0;
virtual void MoveTo(int x_, int y_)=0;
virtual void LineTo(int x_, int y_)=0;
- virtual void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back)=0;
- virtual void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
- virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0;
+ virtual void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back)=0;
+ virtual void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back)=0;
+ virtual void FillRectangle(PRectangle rc, ColourDesired back)=0;
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
- virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
- virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
- ColourAllocated outline, int alphaOutline, int flags)=0;
+ virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back)=0;
+ virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
+ ColourDesired outline, int alphaOutline, int flags)=0;
virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0;
- virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
+ virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)=0;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
- virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0;
- virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0;
- virtual void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore)=0;
- virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions)=0;
- virtual int WidthText(Font &font_, const char *s, int len)=0;
- virtual int WidthChar(Font &font_, char ch)=0;
- virtual int Ascent(Font &font_)=0;
- virtual int Descent(Font &font_)=0;
- virtual int InternalLeading(Font &font_)=0;
- virtual int ExternalLeading(Font &font_)=0;
- virtual int Height(Font &font_)=0;
- virtual int AverageCharWidth(Font &font_)=0;
-
- virtual int SetPalette(Palette *pal, bool inBackGround)=0;
+ virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0;
+ virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0;
+ virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore)=0;
+ virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)=0;
+ virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0;
+ virtual XYPOSITION WidthChar(Font &font_, char ch)=0;
+ virtual XYPOSITION Ascent(Font &font_)=0;
+ virtual XYPOSITION Descent(Font &font_)=0;
+ virtual XYPOSITION InternalLeading(Font &font_)=0;
+ virtual XYPOSITION ExternalLeading(Font &font_)=0;
+ virtual XYPOSITION Height(Font &font_)=0;
+ virtual XYPOSITION AverageCharWidth(Font &font_)=0;
+
virtual void SetClip(PRectangle rc)=0;
virtual void FlushCachedState()=0;
@@ -439,7 +391,7 @@ class ListBox : public Window {
static ListBox *Allocate();
virtual void SetFont(Font &font)=0;
- virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0;
+ virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_, int technology_)=0;
virtual void SetAverageCharWidth(int width)=0;
virtual void SetVisibleRows(int rows)=0;
virtual int GetVisibleRows() const=0;
@@ -564,4 +516,10 @@ class Platform {
#pragma warning(disable: 4244 4309 4514 4710)
#endif
+#if defined(__GNUC__) && defined(SCINTILLA_QT)
+#pragma GCC diagnostic ignored "-Wmissing-braces"
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#pragma GCC diagnostic ignored "-Wchar-subscripts"
+#endif
+
#endif
View
130 scintilla/include/SciLexer.h
@@ -114,6 +114,12 @@
#define SCLEX_TXT2TAGS 99
#define SCLEX_A68K 100
#define SCLEX_MODULA 101
+#define SCLEX_COFFEESCRIPT 102
+#define SCLEX_TCMD 103
+#define SCLEX_AVS 104
+#define SCLEX_ECL 105
+#define SCLEX_OSCRIPT 106
+#define SCLEX_VISUALPROLOG 107
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@@ -153,6 +159,7 @@
#define SCE_C_GLOBALCLASS 19
#define SCE_C_STRINGRAW 20
#define SCE_C_TRIPLEVERBATIM 21
+#define SCE_C_HASHQUOTEDSTRING 22
#define SCE_D_DEFAULT 0
#define SCE_D_COMMENT 1
#define SCE_D_COMMENTLINE 2
@@ -477,6 +484,17 @@
#define SCE_BAT_COMMAND 5
#define SCE_BAT_IDENTIFIER 6
#define SCE_BAT_OPERATOR 7
+#define SCE_TCMD_DEFAULT 0
+#define SCE_TCMD_COMMENT 1
+#define SCE_TCMD_WORD 2
+#define SCE_TCMD_LABEL 3
+#define SCE_TCMD_HIDE 4
+#define SCE_TCMD_COMMAND 5
+#define SCE_TCMD_IDENTIFIER 6
+#define SCE_TCMD_OPERATOR 7
+#define SCE_TCMD_ENVIRONMENT 8
+#define SCE_TCMD_EXPANSION 9
+#define SCE_TCMD_CLABEL 10
#define SCE_MAKE_DEFAULT 0
#define SCE_MAKE_COMMENT 1
#define SCE_MAKE_PREPROCESSOR 2
@@ -663,6 +681,7 @@
#define SCE_CSS_EXTENDED_PSEUDOCLASS 20
#define SCE_CSS_EXTENDED_PSEUDOELEMENT 21
#define SCE_CSS_MEDIA 22
+#define SCE_CSS_VARIABLE 23
#define SCE_POV_DEFAULT 0
#define SCE_POV_COMMENT 1
#define SCE_POV_COMMENTLINE 2
@@ -1476,6 +1495,117 @@
#define SCE_MODULA_PRGKEY 15
#define SCE_MODULA_OPERATOR 16
#define SCE_MODULA_BADSTR 17
+#define SCE_COFFEESCRIPT_DEFAULT 0
+#define SCE_COFFEESCRIPT_COMMENT 1
+#define SCE_COFFEESCRIPT_COMMENTLINE 2
+#define SCE_COFFEESCRIPT_COMMENTDOC 3
+#define SCE_COFFEESCRIPT_NUMBER 4
+#define SCE_COFFEESCRIPT_WORD 5
+#define SCE_COFFEESCRIPT_STRING 6
+#define SCE_COFFEESCRIPT_CHARACTER 7
+#define SCE_COFFEESCRIPT_UUID 8
+#define SCE_COFFEESCRIPT_PREPROCESSOR 9
+#define SCE_COFFEESCRIPT_OPERATOR 10
+#define SCE_COFFEESCRIPT_IDENTIFIER 11
+#define SCE_COFFEESCRIPT_STRINGEOL 12
+#define SCE_COFFEESCRIPT_VERBATIM 13
+#define SCE_COFFEESCRIPT_REGEX 14
+#define SCE_COFFEESCRIPT_COMMENTLINEDOC 15
+#define SCE_COFFEESCRIPT_WORD2 16
+#define SCE_COFFEESCRIPT_COMMENTDOCKEYWORD 17
+#define SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR 18
+#define SCE_COFFEESCRIPT_GLOBALCLASS 19
+#define SCE_COFFEESCRIPT_STRINGRAW 20
+#define SCE_COFFEESCRIPT_TRIPLEVERBATIM 21
+#define SCE_COFFEESCRIPT_HASHQUOTEDSTRING 22
+#define SCE_COFFEESCRIPT_COMMENTBLOCK 22
+#define SCE_COFFEESCRIPT_VERBOSE_REGEX 23
+#define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
+#define SCE_AVS_DEFAULT 0
+#define SCE_AVS_COMMENTBLOCK 1
+#define SCE_AVS_COMMENTBLOCKN 2
+#define SCE_AVS_COMMENTLINE 3
+#define SCE_AVS_NUMBER 4
+#define SCE_AVS_OPERATOR 5
+#define SCE_AVS_IDENTIFIER 6
+#define SCE_AVS_STRING 7
+#define SCE_AVS_TRIPLESTRING 8
+#define SCE_AVS_KEYWORD 9
+#define SCE_AVS_FILTER 10
+#define SCE_AVS_PLUGIN 11
+#define SCE_AVS_FUNCTION 12
+#define SCE_AVS_CLIPPROP 13
+#define SCE_AVS_USERDFN 14
+#define SCE_ECL_DEFAULT 0
+#define SCE_ECL_COMMENT 1
+#define SCE_ECL_COMMENTLINE 2
+#define SCE_ECL_NUMBER 3
+#define SCE_ECL_STRING 4
+#define SCE_ECL_WORD0 5
+#define SCE_ECL_OPERATOR 6
+#define SCE_ECL_CHARACTER 7
+#define SCE_ECL_UUID 8
+#define SCE_ECL_PREPROCESSOR 9
+#define SCE_ECL_UNKNOWN 10
+#define SCE_ECL_IDENTIFIER 11
+#define SCE_ECL_STRINGEOL 12
+#define SCE_ECL_VERBATIM 13
+#define SCE_ECL_REGEX 14
+#define SCE_ECL_COMMENTLINEDOC 15
+#define SCE_ECL_WORD1 16
+#define SCE_ECL_COMMENTDOCKEYWORD 17
+#define SCE_ECL_COMMENTDOCKEYWORDERROR 18
+#define SCE_ECL_WORD2 19
+#define SCE_ECL_WORD3 20
+#define SCE_ECL_WORD4 21
+#define SCE_ECL_WORD5 22
+#define SCE_ECL_COMMENTDOC 23
+#define SCE_ECL_ADDED 24
+#define SCE_ECL_DELETED 25
+#define SCE_ECL_CHANGED 26
+#define SCE_ECL_MOVED 27
+#define SCE_OSCRIPT_DEFAULT 0
+#define SCE_OSCRIPT_LINE_COMMENT 1
+#define SCE_OSCRIPT_BLOCK_COMMENT 2
+#define SCE_OSCRIPT_DOC_COMMENT 3
+#define SCE_OSCRIPT_PREPROCESSOR 4
+#define SCE_OSCRIPT_NUMBER 5
+#define SCE_OSCRIPT_SINGLEQUOTE_STRING 6
+#define SCE_OSCRIPT_DOUBLEQUOTE_STRING 7
+#define SCE_OSCRIPT_CONSTANT 8
+#define SCE_OSCRIPT_IDENTIFIER 9
+#define SCE_OSCRIPT_GLOBAL 10
+#define SCE_OSCRIPT_KEYWORD 11
+#define SCE_OSCRIPT_OPERATOR 12
+#define SCE_OSCRIPT_LABEL 13
+#define SCE_OSCRIPT_TYPE 14
+#define SCE_OSCRIPT_FUNCTION 15
+#define SCE_OSCRIPT_OBJECT 16
+#define SCE_OSCRIPT_PROPERTY 17
+#define SCE_OSCRIPT_METHOD 18
+#define SCE_VISUALPROLOG_DEFAULT 0
+#define SCE_VISUALPROLOG_KEY_MAJOR 1
+#define SCE_VISUALPROLOG_KEY_MINOR 2
+#define SCE_VISUALPROLOG_KEY_DIRECTIVE 3
+#define SCE_VISUALPROLOG_COMMENT_BLOCK 4
+#define SCE_VISUALPROLOG_COMMENT_LINE 5
+#define SCE_VISUALPROLOG_COMMENT_KEY 6
+#define SCE_VISUALPROLOG_COMMENT_KEY_ERROR 7
+#define SCE_VISUALPROLOG_IDENTIFIER 8
+#define SCE_VISUALPROLOG_VARIABLE 9
+#define SCE_VISUALPROLOG_ANONYMOUS 10
+#define SCE_VISUALPROLOG_NUMBER 11
+#define SCE_VISUALPROLOG_OPERATOR 12
+#define SCE_VISUALPROLOG_CHARACTER 13
+#define SCE_VISUALPROLOG_CHARACTER_TOO_MANY 14
+#define SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR 15
+#define SCE_VISUALPROLOG_STRING 16
+#define SCE_VISUALPROLOG_STRING_ESCAPE 17
+#define SCE_VISUALPROLOG_STRING_ESCAPE_ERROR 18
+#define SCE_VISUALPROLOG_STRING_EOL_OPEN 19
+#define SCE_VISUALPROLOG_STRING_VERBATIM 20
+#define SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21
+#define SCE_VISUALPROLOG_STRING_VERBATIM_EOL 22
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif
View
31 scintilla/include/Scintilla.h
@@ -51,6 +51,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_ADDSTYLEDTEXT 2002
#define SCI_INSERTTEXT 2003
#define SCI_CLEARALL 2004
+#define SCI_DELETERANGE 2645
#define SCI_CLEARDOCUMENTSTYLE 2005
#define SCI_GETLENGTH 2006
#define SCI_GETCHARAT 2007
@@ -92,7 +93,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETTABWIDTH 2121
#define SC_CP_UTF8 65001
#define SCI_SETCODEPAGE 2037
-#define SCI_SETUSEPALETTE 2039
#define MARKER_MAX 31
#define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1
@@ -221,6 +221,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_STYLEGETCHANGEABLE 2492
#define SCI_STYLEGETHOTSPOT 2493
#define SCI_STYLESETCASE 2060
+#define SC_FONT_SIZE_MULTIPLIER 100
+#define SCI_STYLESETSIZEFRACTIONAL 2061
+#define SCI_STYLEGETSIZEFRACTIONAL 2062
+#define SC_WEIGHT_NORMAL 400
+#define SC_WEIGHT_SEMIBOLD 600
+#define SC_WEIGHT_BOLD 700
+#define SCI_STYLESETWEIGHT 2063
+#define SCI_STYLEGETWEIGHT 2064
#define SCI_STYLESETCHARACTERSET 2066
#define SCI_STYLESETHOTSPOT 2409
#define SCI_SETSELFORE 2067
@@ -316,6 +324,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETLINEINDENTATION 2127
#define SCI_GETLINEINDENTPOSITION 2128
#define SCI_GETCOLUMN 2129
+#define SCI_COUNTCHARACTERS 2633
#define SCI_SETHSCROLLBAR 2130
#define SCI_GETHSCROLLBAR 2131
#define SC_IV_NONE 0
@@ -329,7 +338,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETLINEENDPOSITION 2136
#define SCI_GETCODEPAGE 2137
#define SCI_GETCARETFORE 2138
-#define SCI_GETUSEPALETTE 2139
#define SCI_GETREADONLY 2140
#define SCI_SETCURRENTPOS 2141
#define SCI_SETSELECTIONSTART 2142
@@ -409,6 +417,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CALLTIPSETFORE 2206
#define SCI_CALLTIPSETFOREHLT 2207
#define SCI_CALLTIPUSESTYLE 2212
+#define SCI_CALLTIPSETPOSITION 2213
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SCI_WRAPCOUNT 2235
@@ -423,6 +432,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SHOWLINES 2226
#define SCI_HIDELINES 2227
#define SCI_GETLINEVISIBLE 2228
+#define SCI_GETALLLINESVISIBLE 2236
#define SCI_SETFOLDEXPANDED 2229
#define SCI_GETFOLDEXPANDED 2230
#define SCI_TOGGLEFOLD 2231
@@ -451,6 +461,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_WRAPVISUALFLAG_NONE 0x0000
#define SC_WRAPVISUALFLAG_END 0x0001
#define SC_WRAPVISUALFLAG_START 0x0002
+#define SC_WRAPVISUALFLAG_MARGIN 0x0004
#define SCI_SETWRAPVISUALFLAGS 2460
#define SCI_GETWRAPVISUALFLAGS 2461
#define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000
@@ -676,6 +687,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETCHARSDEFAULT 2444
#define SCI_AUTOCGETCURRENT 2445
#define SCI_AUTOCGETCURRENTTEXT 2610
+#define SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0
+#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
+#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634
+#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635
#define SCI_ALLOCATE 2446
#define SCI_TARGETASUTF8 2447
#define SCI_SETLENGTHFORENCODE 2448
@@ -714,6 +729,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETPOSITIONCACHE 2515
#define SCI_COPYALLOWLINE 2519
#define SCI_GETCHARACTERPOINTER 2520
+#define SCI_GETRANGEPOINTER 2643
+#define SCI_GETGAPPOSITION 2644
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#define SCI_INDICSETALPHA 2523
@@ -819,6 +836,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_REGISTERRGBAIMAGE 2627
#define SCI_SCROLLTOSTART 2628
#define SCI_SCROLLTOEND 2629
+#define SC_TECHNOLOGY_DEFAULT 0
+#define SC_TECHNOLOGY_DIRECTWRITE 1
+#define SCI_SETTECHNOLOGY 2630
+#define SCI_GETTECHNOLOGY 2631
+#define SCI_CREATELOADER 2632
+#define SCI_FINDINDICATORSHOW 2640
+#define SCI_FINDINDICATORFLASH 2641
+#define SCI_FINDINDICATORHIDE 2642
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@@ -1028,6 +1053,8 @@ struct SCNotification {
#ifdef INCLUDE_DEPRECATED_FEATURES
#define SC_CP_DBCS 1
+#define SCI_SETUSEPALETTE 2039
+#define SCI_GETUSEPALETTE 2139
#endif
View
233 scintilla/include/Scintilla.iface
@@ -101,6 +101,9 @@ fun void InsertText=2003(position pos, string text)
# Delete all text in the document.
fun void ClearAll=2004(,)
+# Delete a range of text in the document.
+fun void DeleteRange=2645(position pos, int deleteLength)
+
# Set all style bytes to 0, remove all folding information.
fun void ClearDocumentStyle=2005(,)
@@ -228,10 +231,6 @@ val SC_CP_UTF8=65001
# The SC_CP_UTF8 value can be used to enter Unicode mode.
set void SetCodePage=2037(int codePage,)
-# In palette mode, Scintilla uses the environment's palette calls to display
-# more colours. This may lead to ugly displays.
-set void SetUsePalette=2039(bool usePalette,)
-
enu MarkerSymbol=SC_MARK_
val MARKER_MAX=31
val SC_MARK_CIRCLE=0
@@ -482,6 +481,25 @@ get bool StyleGetHotSpot=2493(int style,)
# Set a style to be mixed case, or to force upper or lower case.
set void StyleSetCase=2060(int style, int caseForce)
+val SC_FONT_SIZE_MULTIPLIER=100
+
+# Set the size of characters of a style. Size is in points multiplied by 100.
+set void StyleSetSizeFractional=2061(int style, int caseForce)
+
+# Get the size of characters of a style in points multiplied by 100
+get int StyleGetSizeFractional=2062(int style,)
+
+enu FontWeight=SC_WEIGHT_
+val SC_WEIGHT_NORMAL=400
+val SC_WEIGHT_SEMIBOLD=600
+val SC_WEIGHT_BOLD=700
+
+# Set the weight of characters of a style.
+set void StyleSetWeight=2063(int style, int weight)
+
+# Get the weight of characters of a style.
+get int StyleGetWeight=2064(int style,)
+
# Set the character set of the font in a style.
set void StyleSetCharacterSet=2066(int style, int characterSet)
@@ -748,9 +766,11 @@ get position GetLineIndentPosition=2128(int line,)
# Retrieve the column number of a position, taking tab width into account.
get int GetColumn=2129(position pos,)
+# Count characters between two positions.
+fun int CountCharacters=2633(int startPos, int endPos)
+
# Show or hide the horizontal scroll bar.
set void SetHScrollBar=2130(bool show,)
-
# Is the horizontal scroll bar visible?
get bool GetHScrollBar=2131(,)
@@ -774,7 +794,7 @@ set void SetHighlightGuide=2134(int column,)
get int GetHighlightGuide=2135(,)
# Get the position after the last visible characters on a line.
-get int GetLineEndPosition=2136(int line,)
+get position GetLineEndPosition=2136(int line,)
# Get the code page used to interpret the bytes of the document as characters.
get int GetCodePage=2137(,)
@@ -782,9 +802,6 @@ get int GetCodePage=2137(,)
# Get the foreground colour of the caret.
get colour GetCaretFore=2138(,)
-# In palette mode?
-get bool GetUsePalette=2139(,)
-
# In read-only mode?
get bool GetReadOnly=2140(,)
@@ -1027,6 +1044,9 @@ set void CallTipSetForeHlt=2207(colour fore,)
# Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
set void CallTipUseStyle=2212(int tabSize,)
+# Set position of calltip, above or below text.
+set void CallTipSetPosition=2213(bool above,)
+
# Find the display line of a document line taking hidden lines into account.
fun int VisibleFromDocLine=2220(int line,)
@@ -1065,6 +1085,9 @@ fun void HideLines=2227(int lineStart, int lineEnd)
# Is a line visible?
get bool GetLineVisible=2228(int line,)
+# Are all lines visible?
+get bool GetAllLinesVisible=2236(,)
+
# Show the children of a header line.
set void SetFoldExpanded=2229(int line, bool expanded)
@@ -1132,6 +1155,7 @@ enu WrapVisualFlag=SC_WRAPVISUALFLAG_
val SC_WRAPVISUALFLAG_NONE=0x0000
val SC_WRAPVISUALFLAG_END=0x0001
val SC_WRAPVISUALFLAG_START=0x0002
+val SC_WRAPVISUALFLAG_MARGIN=0x0004
# Set the display mode of visual flags for wrapped lines.
set void SetWrapVisualFlags=2460(int wrapVisualFlags,)
@@ -1786,6 +1810,16 @@ fun int AutoCGetCurrent=2445(,)
# Returns the length of the item text
fun int AutoCGetCurrentText=2610(, stringresult s)
+enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_
+val SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0
+val SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE=1
+
+# Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
+set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,)
+
+# Get auto-completion case insensitive behaviour.
+get int AutoCGetCaseInsensitiveBehaviour=2635(,)
+
# Enlarge the document to a particular size of text bytes.
fun void Allocate=2446(int bytes,)
@@ -1893,6 +1927,15 @@ fun void CopyAllowLine=2519(,)
# characters in the document.
get int GetCharacterPointer=2520(,)
+# Return a read-only pointer to a range of characters in the document.
+# May move the gap so that the range is contiguous, but will only move up
+# to rangeLength bytes.
+get int GetRangePointer=2643(int position, int rangeLength)
+
+# Return a position which, to avoid performance costs, should not be within
+# the range of a call to GetRangePointer.
+get position GetGapPosition=2644(,)
+
# Always interpret keyboard input as Unicode
set void SetKeysUnicode=2521(bool keysUnicode,)
@@ -2175,6 +2218,27 @@ fun void ScrollToStart=2628(,)
# Scroll to end of document.
fun void ScrollToEnd=2629(,)
+val SC_TECHNOLOGY_DEFAULT=0
+val SC_TECHNOLOGY_DIRECTWRITE=1
+
+# Set the technolgy used.
+set void SetTechnology=2630(int technology,)
+
+# Get the tech.
+get int GetTechnology=2631(,)
+
+# Create an ILoader*.
+fun int CreateLoader=2632(int bytes,)
+
+# On OS X, show a find indicator.
+fun void FindIndicatorShow=2640(position start, position end)
+
+# On OS X, flash a find indicator, then fade out.
+fun void FindIndicatorFlash=2641(position start, position end)
+
+# On OS X, hide the find indicator.
+fun void FindIndicatorHide=2642(,)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@@ -2421,6 +2485,12 @@ val SCLEX_MARKDOWN=98
val SCLEX_TXT2TAGS=99
val SCLEX_A68K=100
val SCLEX_MODULA=101
+val SCLEX_COFFEESCRIPT=102
+val SCLEX_TCMD=103
+val SCLEX_AVS=104
+val SCLEX_ECL=105
+val SCLEX_OSCRIPT=106
+val SCLEX_VISUALPROLOG=107
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -2469,6 +2539,7 @@ val SCE_C_COMMENTDOCKEYWORDERROR=18
val SCE_C_GLOBALCLASS=19
val SCE_C_STRINGRAW=20
val SCE_C_TRIPLEVERBATIM=21
+val SCE_C_HASHQUOTEDSTRING=22
# Lexical states for SCLEX_D
lex D=SCLEX_D SCE_D_
val SCE_D_DEFAULT=0
@@ -2832,6 +2903,19 @@ val SCE_BAT_HIDE=4
val SCE_BAT_COMMAND=5
val SCE_BAT_IDENTIFIER=6
val SCE_BAT_OPERATOR=7
+# Lexical states for SCLEX_TCMD
+lex TCMD=SCLEX_TCMD SCE_TCMD_
+val SCE_TCMD_DEFAULT=0
+val SCE_TCMD_COMMENT=1
+val SCE_TCMD_WORD=2
+val SCE_TCMD_LABEL=3
+val SCE_TCMD_HIDE=4
+val SCE_TCMD_COMMAND=5
+val SCE_TCMD_IDENTIFIER=6
+val SCE_TCMD_OPERATOR=7
+val SCE_TCMD_ENVIRONMENT=8
+val SCE_TCMD_EXPANSION=9
+val SCE_TCMD_CLABEL=10
# Lexical states for SCLEX_MAKEFILE
lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_
val SCE_MAKE_DEFAULT=0
@@ -3051,6 +3135,7 @@ val SCE_CSS_EXTENDED_IDENTIFIER=19
val SCE_CSS_EXTENDED_PSEUDOCLASS=20
val SCE_CSS_EXTENDED_PSEUDOELEMENT=21
val SCE_CSS_MEDIA=22
+val SCE_CSS_VARIABLE=23
# Lexical states for SCLEX_POV
lex POV=SCLEX_POV SCE_POV_
val SCE_POV_DEFAULT=0
@@ -3968,6 +4053,127 @@ val SCE_MODULA_PRAGMA=14
val SCE_MODULA_PRGKEY=15
val SCE_MODULA_OPERATOR=16
val SCE_MODULA_BADSTR=17
+# Lexical states for SCLEX_COFFEESCRIPT
+lex CoffeeScript=SCLEX_COFFEESCRIPT SCE_COFFEESCRIPT_
+val SCE_COFFEESCRIPT_DEFAULT=0
+val SCE_COFFEESCRIPT_COMMENT=1
+val SCE_COFFEESCRIPT_COMMENTLINE=2
+val SCE_COFFEESCRIPT_COMMENTDOC=3
+val SCE_COFFEESCRIPT_NUMBER=4
+val SCE_COFFEESCRIPT_WORD=5
+val SCE_COFFEESCRIPT_STRING=6
+val SCE_COFFEESCRIPT_CHARACTER=7
+val SCE_COFFEESCRIPT_UUID=8
+val SCE_COFFEESCRIPT_PREPROCESSOR=9
+val SCE_COFFEESCRIPT_OPERATOR=10
+val SCE_COFFEESCRIPT_IDENTIFIER=11
+val SCE_COFFEESCRIPT_STRINGEOL=12
+val SCE_COFFEESCRIPT_VERBATIM=13
+val SCE_COFFEESCRIPT_REGEX=14
+val SCE_COFFEESCRIPT_COMMENTLINEDOC=15
+val SCE_COFFEESCRIPT_WORD2=16
+val SCE_COFFEESCRIPT_COMMENTDOCKEYWORD=17
+val SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR=18
+val SCE_COFFEESCRIPT_GLOBALCLASS=19
+val SCE_COFFEESCRIPT_STRINGRAW=20
+val SCE_COFFEESCRIPT_TRIPLEVERBATIM=21
+val SCE_COFFEESCRIPT_HASHQUOTEDSTRING=22
+val SCE_COFFEESCRIPT_COMMENTBLOCK=22
+val SCE_COFFEESCRIPT_VERBOSE_REGEX=23
+val SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT=24
+# Lexical states for SCLEX_AVS
+lex AVS=SCLEX_AVS SCE_AVS_
+val SCE_AVS_DEFAULT=0
+val SCE_AVS_COMMENTBLOCK=1
+val SCE_AVS_COMMENTBLOCKN=2
+val SCE_AVS_COMMENTLINE=3
+val SCE_AVS_NUMBER=4
+val SCE_AVS_OPERATOR=5
+val SCE_AVS_IDENTIFIER=6
+val SCE_AVS_STRING=7
+val SCE_AVS_TRIPLESTRING=8
+val SCE_AVS_KEYWORD=9
+val SCE_AVS_FILTER=10
+val SCE_AVS_PLUGIN=11
+val SCE_AVS_FUNCTION=12
+val SCE_AVS_CLIPPROP=13
+val SCE_AVS_USERDFN=14
+# Lexical states for SCLEX_ECL
+lex ECL=SCLEX_ECL SCE_ECL_
+val SCE_ECL_DEFAULT=0
+val SCE_ECL_COMMENT=1
+val SCE_ECL_COMMENTLINE=2
+val SCE_ECL_NUMBER=3
+val SCE_ECL_STRING=4
+val SCE_ECL_WORD0=5
+val SCE_ECL_OPERATOR=6
+val SCE_ECL_CHARACTER=7
+val SCE_ECL_UUID=8
+val SCE_ECL_PREPROCESSOR=9
+val SCE_ECL_UNKNOWN=10
+val SCE_ECL_IDENTIFIER=11
+val SCE_ECL_STRINGEOL=12
+val SCE_ECL_VERBATIM=13
+val SCE_ECL_REGEX=14
+val SCE_ECL_COMMENTLINEDOC=15
+val SCE_ECL_WORD1=16
+val SCE_ECL_COMMENTDOCKEYWORD=17
+val SCE_ECL_COMMENTDOCKEYWORDERROR=18
+val SCE_ECL_WORD2=19
+val SCE_ECL_WORD3=20
+val SCE_ECL_WORD4=21
+val SCE_ECL_WORD5=22
+val SCE_ECL_COMMENTDOC=23
+val SCE_ECL_ADDED=24
+val SCE_ECL_DELETED=25
+val SCE_ECL_CHANGED=26
+val SCE_ECL_MOVED=27
+# Lexical states for SCLEX_OSCRIPT
+lex OScript=SCLEX_OSCRIPT SCE_OSCRIPT_
+val SCE_OSCRIPT_DEFAULT=0
+val SCE_OSCRIPT_LINE_COMMENT=1
+val SCE_OSCRIPT_BLOCK_COMMENT=2
+val SCE_OSCRIPT_DOC_COMMENT=3
+val SCE_OSCRIPT_PREPROCESSOR=4
+val SCE_OSCRIPT_NUMBER=5
+val SCE_OSCRIPT_SINGLEQUOTE_STRING=6
+val SCE_OSCRIPT_DOUBLEQUOTE_STRING=7
+val SCE_OSCRIPT_CONSTANT=8
+val SCE_OSCRIPT_IDENTIFIER=9
+val SCE_OSCRIPT_GLOBAL=10
+val SCE_OSCRIPT_KEYWORD=11
+val SCE_OSCRIPT_OPERATOR=12
+val SCE_OSCRIPT_LABEL=13
+val SCE_OSCRIPT_TYPE=14
+val SCE_OSCRIPT_FUNCTION=15
+val SCE_OSCRIPT_OBJECT=16
+val SCE_OSCRIPT_PROPERTY=17
+val SCE_OSCRIPT_METHOD=18
+# Lexical states for SCLEX_VISUALPROLOG
+lex VisualProlog=SCLEX_VISUALPROLOG SCE_VISUALPROLOG_
+val SCE_VISUALPROLOG_DEFAULT=0
+val SCE_VISUALPROLOG_KEY_MAJOR=1
+val SCE_VISUALPROLOG_KEY_MINOR=2
+val SCE_VISUALPROLOG_KEY_DIRECTIVE=3
+val SCE_VISUALPROLOG_COMMENT_BLOCK=4
+val SCE_VISUALPROLOG_COMMENT_LINE=5
+val SCE_VISUALPROLOG_COMMENT_KEY=6
+val SCE_VISUALPROLOG_COMMENT_KEY_ERROR=7
+val SCE_VISUALPROLOG_IDENTIFIER=8
+val SCE_VISUALPROLOG_VARIABLE=9
+val SCE_VISUALPROLOG_ANONYMOUS=10
+val SCE_VISUALPROLOG_NUMBER=11
+val SCE_VISUALPROLOG_OPERATOR=12
+val SCE_VISUALPROLOG_CHARACTER=13
+val SCE_VISUALPROLOG_CHARACTER_TOO_MANY=14
+val SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR=15
+val SCE_VISUALPROLOG_STRING=16
+val SCE_VISUALPROLOG_STRING_ESCAPE=17
+val SCE_VISUALPROLOG_STRING_ESCAPE_ERROR=18
+val SCE_VISUALPROLOG_STRING_EOL_OPEN=19
+val SCE_VISUALPROLOG_STRING_VERBATIM=20
+val SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL=21
+val SCE_VISUALPROLOG_STRING_VERBATIM_EOL=22
# Events
@@ -4005,3 +4211,12 @@ cat Deprecated
# Deprecated in 2.21
# The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+.
val SC_CP_DBCS=1
+
+# Deprecated in 2.30
+
+# In palette mode?
+get bool GetUsePalette=2139(,)
+
+# In palette mode, Scintilla uses the environment's palette calls to display
+# more colours. This may lead to ugly displays.
+set void SetUsePalette=2039(bool usePalette,)
View
1 scintilla/lexers/LexAda.cxx
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
+#include <ctype.h>
#include <string>
View
6 scintilla/lexers/LexAsm.cxx
@@ -16,10 +16,6 @@
#include <assert.h>
#include <ctype.h>
-#ifdef _MSC_VER
-#pragma warning(disable: 4786)
-#endif
-
#include <string>
#include <map>
#include <set>
@@ -157,7 +153,7 @@ class LexerAsm : public ILexer {
public:
LexerAsm() {
}
- ~LexerAsm() {
+ virtual ~LexerAsm() {
}
void SCI_METHOD Release() {
delete this;
View
11 scintilla/lexers/LexBash.cxx
@@ -425,7 +425,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
}
break;
case SCE_SH_STRING: // delimited styles
- case SCE_SH_CHARACTER:
case SCE_SH_BACKTICKS:
case SCE_SH_PARAM:
if (sc.ch == '\\' && Quote.Up != '\\') {
@@ -439,6 +438,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
Quote.Count++;
}
break;
+ case SCE_SH_CHARACTER: // singly-quoted strings
+ if (sc.ch == Quote.Down) {
+ Quote.Count--;
+ if (Quote.Count == 0) {
+ sc.ForwardSetState(SCE_SH_DEFAULT);
+ }
+ }
+ break;
}
// Must check end of HereDoc state 1 before default state is handled
@@ -507,7 +514,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
if (sc.ch == '{') {
sc.ChangeState(SCE_SH_PARAM);
} else if (sc.ch == '\'') {
- sc.ChangeState(SCE_SH_CHARACTER);
+ sc.ChangeState(SCE_SH_STRING);
} else if (sc.ch == '"') {
sc.ChangeState(SCE_SH_STRING);
} else if (sc.ch == '(' || sc.ch == '`') {
View
6 scintilla/lexers/LexBasic.cxx
@@ -24,10 +24,6 @@
#include <assert.h>
#include <ctype.h>
-#ifdef _MSC_VER
-#pragma warning(disable: 4786)
-#endif
-
#include <string>
#include <map>
@@ -227,7 +223,7 @@ class LexerBasic : public ILexer {
CheckFoldPoint(CheckFoldPoint_),
osBasic(wordListDescriptions) {
}
- ~LexerBasic() {
+ virtual ~LexerBasic() {
}
void SCI_METHOD Release() {
delete this;
View
50 scintilla/lexers/LexCPP.cxx
@@ -13,10 +13,6 @@
#include <stdarg.h>
#include <assert.h>
-#ifdef _MSC_VER
-#pragma warning(disable: 4786)
-#endif
-
#include <string>
#include <vector>
#include <map>
@@ -90,7 +86,7 @@ static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
std::string restOfLine;
int i =0;
- char ch = styler.SafeGetCharAt(start + i, '\n');
+ char ch = styler.SafeGetCharAt(start, '\n');
while ((ch != '\r') && (ch != '\n')) {
if (allowSpace || (ch != ' '))
restOfLine += ch;
@@ -209,6 +205,7 @@ struct OptionsCPP {
bool trackPreprocessor;
bool updatePreprocessor;
bool triplequotedStrings;
+ bool hashquotedStrings;
bool fold;
bool foldSyntaxBased;
bool foldComment;
@@ -226,6 +223,7 @@ struct OptionsCPP {
trackPreprocessor = true;
updatePreprocessor = true;
triplequotedStrings = false;
+ hashquotedStrings = false;
fold = false;
foldSyntaxBased = true;
foldComment = false;
@@ -268,6 +266,9 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings,
"Set to 1 to enable highlighting of triple-quoted strings.");
+ DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings,
+ "Set to 1 to enable highlighting of hash-quoted strings.");
+
DefineProperty("fold", &OptionsCPP::fold);
DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased,
@@ -334,7 +335,7 @@ class LexerCPP : public ILexer {
setRelOp(CharacterSet::setNone, "=!<>"),
setLogicalOp(CharacterSet::setNone, "|&") {
}
- ~LexerCPP() {
+ virtual ~LexerCPP() {
}
void SCI_METHOD Release() {
delete this;
@@ -463,9 +464,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
bool isIncludePreprocessor = false;
int lineCurrent = styler.GetLine(startPos);
- if ((initStyle == SCE_C_PREPROCESSOR) ||
- (initStyle == SCE_C_COMMENTLINE) ||
- (initStyle == SCE_C_COMMENTLINEDOC)) {
+ 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 chBack = styler.SafeGetCharAt(startPos-1, 0);
@@ -483,9 +484,9 @@ 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;
- while (--back && IsSpaceEquiv(styler.StyleAt(back)))
+ while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back))))
;
- if (styler.StyleAt(back) == SCE_C_OPERATOR) {
+ if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) {
chPrevNonWhite = styler.SafeGetCharAt(back);
}
}
@@ -519,6 +520,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) {
+ // Using MaskActive() is not needed in the following statement.
+ // Inside inactive preprocessor declaration, state will be reset anyway at the end of this block.
if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) {
// Prevent SCE_C_STRINGEOL from leaking back to previous line which
// ends with a line continuation by locking in the state upto this position.
@@ -533,13 +536,6 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
activitySet = activeFlag;
sc.SetState(sc.state | activitySet);
}
- if (activitySet) {
- if (sc.ch == '#') {
- if (sc.Match("#else") || sc.Match("#end") || sc.Match("#if")) {
- //activitySet = 0;
- }
- }
- }
}
if (sc.atLineEnd) {
@@ -553,6 +549,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// Handle line continuation generically.
if (sc.ch == '\\') {
if (sc.chNext == '\n' || sc.chNext == '\r') {
+ lineCurrent++;
+ vlls.Add(lineCurrent, preproc);
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
@@ -673,7 +671,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet);
}
- sc.SetState(styleBeforeDCKeyword);
+ sc.SetState(styleBeforeDCKeyword|activitySet);
}
break;
case SCE_C_STRING:
@@ -692,6 +690,15 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
}
break;
+ case SCE_C_HASHQUOTEDSTRING:
+ if (sc.ch == '\\') {
+ if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
+ sc.Forward();
+ }
+ } else if (sc.ch == '\"') {
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
case SCE_C_STRINGRAW:
if (sc.Match(rawStringTerminator.c_str())) {
for (size_t termPos=rawStringTerminator.size(); termPos; termPos--)
@@ -768,6 +775,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} else if (options.triplequotedStrings && sc.Match("\"\"\"")) {
sc.SetState(SCE_C_TRIPLEVERBATIM|activitySet);
sc.Forward(2);
+ } else if (options.hashquotedStrings && sc.Match('#', '\"')) {
+ sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet);
+ sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
if (lastWordWasUUID) {
sc.SetState(SCE_C_UUID|activitySet);
@@ -1037,7 +1047,7 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
if (tokens[i+2] == ")") {
// defined()
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3);
- } else if (((i+2)<tokens.size()) && (tokens[i+3] == ")")) {
+ } else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) {
// defined(<int>)
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4);
val = "1";
View
228 scintilla/lexers/LexCSS.cxx
@@ -3,10 +3,16 @@
** Lexer for Cascading Style Sheets
** Written by Jakub Vrána
** Improved by Philippe Lhoste (CSS2)
+ ** Improved by Ross McKay (SCSS mode; see http://sass-lang.com/ )
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
+// TODO: handle SCSS nested properties like font: { weight: bold; size: 1em; }
+// TODO: handle SCSS interpolation: #{}
+// TODO: add features for Less if somebody feels like contributing; http://lesscss.org/
+// TODO: refactor this monster so that the next poor slob can read it!
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -51,6 +57,22 @@ inline bool IsCssOperator(const int ch) {
return false;
}
+// look behind (from start of document to our start position) to determine current nesting level
+inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) {
+ int ch;
+ int nestingLevel = 0;
+
+ for (unsigned int i = 0; i < startPos; i++) {
+ ch = styler.SafeGetCharAt(i);
+ if (ch == '{')
+ nestingLevel++;
+ else if (ch == '}')
+ nestingLevel--;
+ }
+
+ return nestingLevel;
+}
+
static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &css1Props = *keywordlists[0];
WordList &pseudoClasses = *keywordlists[1];
@@ -66,11 +88,35 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
int lastState = -1; // before operator
int lastStateC = -1; // before comment
int lastStateS = -1; // before single-quoted/double-quoted string
+ int lastStateVar = -1; // before variable (SCSS)
+ int lastStateVal = -1; // before value (SCSS)
int op = ' '; // last operator
int opPrev = ' '; // last operator
+ bool insideParentheses = false; // true if currently in a CSS url() or similar construct
+
+ // property lexer.css.scss.language
+ // Set to 1 for Sassy CSS (.scss)
+ bool isScssDocument = styler.GetPropertyInt("lexer.css.scss.language") != 0;
+
+ // TODO: implement Less support
+ bool isLessDocument = false;
+ // SCSS and Less both support single-line comments
+ typedef enum _CommentModes { eCommentBlock = 0, eCommentLine = 1} CommentMode;
+ CommentMode comment_mode = eCommentBlock;
+ bool hasSingleLineComments = isScssDocument || isLessDocument;
+
+ // must keep track of nesting level in document types that support it (SCSS, Less)
+ bool hasNesting = false;
+ int nestingLevel = 0;
+ if (isScssDocument || isLessDocument) {
+ hasNesting = true;
+ nestingLevel = NestingLevelLookBehind(startPos, styler);
+ }
+
+ // "the loop"
for (; sc.More(); sc.Forward()) {
- if (sc.state == SCE_CSS_COMMENT && sc.Match('*', '/')) {
+ if (sc.state == SCE_CSS_COMMENT && ((comment_mode == eCommentBlock && sc.Match('*', '/')) || (comment_mode == eCommentLine && sc.atLineEnd))) {
if (lastStateC == -1) {
// backtrack to get last state:
// comments are like whitespace, so we must return to the previous state
@@ -94,8 +140,12 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (i == 0)
lastStateC = SCE_CSS_DEFAULT;
}
- sc.Forward();
- sc.ForwardSetState(lastStateC);
+ if (comment_mode == eCommentBlock) {
+ sc.Forward();
+ sc.ForwardSetState(lastStateC);
+ } else /* eCommentLine */ {
+ sc.SetState(lastStateC);
+ }
}
if (sc.state == SCE_CSS_COMMENT)
@@ -125,7 +175,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
}
switch (op) {
case '@':
- if (lastState == SCE_CSS_DEFAULT)
+ if (lastState == SCE_CSS_DEFAULT || hasNesting)
sc.SetState(SCE_CSS_DIRECTIVE);
break;
case '>':
@@ -144,15 +194,33 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_CSS_TAG);
break;
case '{':
- if (lastState == SCE_CSS_MEDIA)
+ nestingLevel++;
+ switch (lastState) {
+ case SCE_CSS_MEDIA:
sc.SetState(SCE_CSS_DEFAULT);
- else if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DIRECTIVE)
+ break;
+ case SCE_CSS_TAG:
+ case SCE_CSS_DIRECTIVE:
sc.SetState(SCE_CSS_IDENTIFIER);
+ break;
+ }
break;
case '}':
- if (lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT ||
- lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 || lastState == SCE_CSS_IDENTIFIER3)
- sc.SetState(SCE_CSS_DEFAULT);
+ if (--nestingLevel < 0)
+ nestingLevel = 0;
+ switch (lastState) {
+ case SCE_CSS_DEFAULT:
+ case SCE_CSS_VALUE:
+ case SCE_CSS_IMPORTANT:
+ case SCE_CSS_IDENTIFIER:
+ case SCE_CSS_IDENTIFIER2:
+ case SCE_CSS_IDENTIFIER3:
+ if (hasNesting)
+ sc.SetState(nestingLevel > 0 ? SCE_CSS_IDENTIFIER : SCE_CSS_DEFAULT);
+ else
+ sc.SetState(SCE_CSS_DEFAULT);
+ break;
+ }
break;
case '(':
if (lastState == SCE_CSS_PSEUDOCLASS)
@@ -167,14 +235,28 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_CSS_TAG);
break;
case ':':
- if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
- lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS ||
- lastState == SCE_CSS_PSEUDOELEMENT || lastState == SCE_CSS_EXTENDED_PSEUDOELEMENT)
+ switch (lastState) {
+ case SCE_CSS_TAG:
+ case SCE_CSS_DEFAULT:
+ case SCE_CSS_CLASS:
+ case SCE_CSS_ID:
+ case SCE_CSS_PSEUDOCLASS:
+ case SCE_CSS_EXTENDED_PSEUDOCLASS:
+ case SCE_CSS_UNKNOWN_PSEUDOCLASS:
+ case SCE_CSS_PSEUDOELEMENT:
+ case SCE_CSS_EXTENDED_PSEUDOELEMENT:
sc.SetState(SCE_CSS_PSEUDOCLASS);
- else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 ||
- lastState == SCE_CSS_IDENTIFIER3 || lastState == SCE_CSS_EXTENDED_IDENTIFIER ||
- lastState == SCE_CSS_UNKNOWN_IDENTIFIER)
+ break;
+ case SCE_CSS_IDENTIFIER:
+ case SCE_CSS_IDENTIFIER2:
+ case SCE_CSS_IDENTIFIER3:
+ case SCE_CSS_EXTENDED_IDENTIFIER:
+ case SCE_CSS_UNKNOWN_IDENTIFIER:
+ case SCE_CSS_VARIABLE:
sc.SetState(SCE_CSS_VALUE);
+ lastStateVal = lastState;
+ break;
+ }
break;
case '.':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
@@ -193,10 +275,40 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_CSS_DEFAULT);
break;
case ';':
- if (lastState == SCE_CSS_DIRECTIVE)
- sc.SetState(SCE_CSS_DEFAULT);
- else if (lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT)
- sc.SetState(SCE_CSS_IDENTIFIER);
+ switch (lastState) {
+ case SCE_CSS_DIRECTIVE:
+ if (hasNesting) {
+ sc.SetState(nestingLevel > 0 ? SCE_CSS_IDENTIFIER : SCE_CSS_DEFAULT);
+ } else {
+ sc.SetState(SCE_CSS_DEFAULT);
+ }
+ break;
+ case SCE_CSS_VALUE:
+ case SCE_CSS_IMPORTANT:
+ // data URLs can have semicolons; simplistically check for wrapping parentheses and move along
+ if (insideParentheses) {
+ sc.SetState(lastState);
+ } else {
+ if (lastStateVal == SCE_CSS_VARIABLE) {
+ sc.SetState(SCE_CSS_DEFAULT);
+ } else {
+ sc.SetState(SCE_CSS_IDENTIFIER);
+ }
+ }
+ break;
+ case SCE_CSS_VARIABLE:
+ if (lastStateVar == SCE_CSS_VALUE) {
+ // data URLs can have semicolons; simplistically check for wrapping parentheses and move along
+ if (insideParentheses) {
+ sc.SetState(SCE_CSS_VALUE);
+ } else {
+ sc.SetState(SCE_CSS_IDENTIFIER);
+ }
+ } else {
+ sc.SetState(SCE_CSS_DEFAULT);
+ }
+ break;
+ }
break;
case '!':
if (lastState == SCE_CSS_VALUE)
@@ -205,14 +317,75 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
}
}
- if (IsAWordChar(sc.ch)) {
- if (sc.state == SCE_CSS_DEFAULT)
- sc.SetState(SCE_CSS_TAG);
+ if (sc.ch == '*' && sc.state == SCE_CSS_DEFAULT) {
+ sc.SetState(SCE_CSS_TAG);
continue;
}
- if (sc.ch == '*' && sc.state == SCE_CSS_DEFAULT) {
- sc.SetState(SCE_CSS_TAG);
+ // check for inside parentheses (whether part of an "operator" or not)
+ if (sc.ch == '(')
+ insideParentheses = true;
+ else if (sc.ch == ')')
+ insideParentheses = false;
+
+ // SCSS special modes
+ if (isScssDocument) {
+ // variable name
+ if (sc.ch == '$') {
+ switch (sc.state) {
+ case SCE_CSS_DEFAULT:
+ case SCE_CSS_VALUE:
+ lastStateVar = sc.state;
+ sc.SetState(SCE_CSS_VARIABLE);
+ continue;
+ }
+ }
+ if (sc.state == SCE_CSS_VARIABLE) {
+ if (IsAWordChar(sc.ch)) {
+ // still looking at the variable name
+ continue;
+ }
+ if (lastStateVar == SCE_CSS_VALUE) {
+ // not looking at the variable name any more, and it was part of a value
+ sc.SetState(SCE_CSS_VALUE);
+ }
+ }
+
+ // nested rule parent selector
+ if (sc.ch == '&') {
+ switch (sc.state) {
+ case SCE_CSS_DEFAULT:
+ case SCE_CSS_IDENTIFIER:
+ sc.SetState(SCE_CSS_TAG);
+ continue;
+ }
+ }
+ }
+
+ // nesting rules that apply to SCSS and Less
+ if (hasNesting) {
+ // 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;
+ int ch;
+
+ for (unsigned int i = sc.currentPos; i < endPos; i++) {
+ ch = styler.SafeGetCharAt(i);
+ if (ch == ';' || ch == '}')
+ break;
+ if (ch == '{') {
+ sc.SetState(SCE_CSS_DEFAULT);
+ continue;
+ }
+ }
+ }
+
+ }
+
+ if (IsAWordChar(sc.ch)) {
+ if (sc.state == SCE_CSS_DEFAULT)
+ sc.SetState(SCE_CSS_TAG);
continue;
}
@@ -287,6 +460,13 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.Match('/', '*')) {
lastStateC = sc.state;
+ comment_mode = eCommentBlock;
+ sc.SetState(SCE_CSS_COMMENT);
+ sc.Forward();
+ } else if (hasSingleLineComments && sc.Match('/', '/') && !insideParentheses) {
+ // note that we've had to treat ([...]// as the start of a URL not a comment, e.g. url(http://example.com), url(//example.com)
+ lastStateC = sc.state;
+ comment_mode = eCommentLine;
sc.SetState(SCE_CSS_COMMENT);
sc.Forward();
} else if ((sc.state == SCE_CSS_VALUE || sc.state == SCE_CSS_ATTRIBUTE)
View
6 scintilla/lexers/LexD.cxx
@@ -14,10 +14,6 @@
#include <assert.h>
#include <ctype.h>
-#ifdef _MSC_VER
-#pragma warning(disable: 4786)
-#endif
-
#include <string>
#include <map>
@@ -164,7 +160,7 @@ class LexerD : public ILexer {
LexerD(bool caseSensitive_) :
caseSensitive(caseSensitive_) {
}
- ~LexerD() {
+ virtual ~LexerD() {
}
void SCI_METHOD Release() {
delete this;
View
31 scintilla/lexers/LexHTML.cxx
@@ -261,28 +261,29 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k
static int classifyTagHTML(unsigned int start, unsigned int end,
WordList &keywords, Accessor &styler, bool &tagDontFold,
bool caseSensitive, bool isXml, bool allowScripts) {
- char s[30 + 2];
+ char withSpace[30 + 2] = " ";
+ const char *s = withSpace + 1;
// Copy after the '<'
- unsigned int i = 0;
+ unsigned int i = 1;
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
char ch = styler[cPos];
if ((ch != '<') && (ch != '/')) {
- s[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
+ withSpace[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
}
}
//The following is only a quick hack, to see if this whole thing would work
//we first need the tagname with a trailing space...
- s[i] = ' ';
- s[i+1] = '\0';
+ withSpace[i] = ' ';
+ withSpace[i+1] = '\0';
// if the current language is XML, I can fold any tag
// if the current language is HTML, I don't want to fold certain tags (input, meta, etc.)
//...to find it in the list of no-container-tags
- tagDontFold = (!isXml) && (NULL != strstr("meta link img area br hr input ", s));
+ tagDontFold = (!isXml) && (NULL != strstr(" area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr ", withSpace));
//now we can remove the trailing space
- s[i] = '\0';
+ withSpace[i] = '\0';
// No keywords -> all are known
char chAttr = SCE_H_TAGUNKNOWN;
@@ -597,11 +598,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
char djangoBlockType[2];
djangoBlockType[0] = '\0';
- // If inside a tag, it may be a script tag, so reread from the start to ensure any language tags are seen
+ // If inside a tag, it may be a script tag, so reread from the start of line starting tag to ensure any language tags are seen
if (InTagState(state)) {
while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) {
- startPos--;
- length++;
+ int backLineStart = styler.LineStart(styler.GetLine(startPos-1));
+ length += startPos - backLineStart;
+ startPos = backLineStart;
}
state = SCE_H_DEFAULT;
}
@@ -902,7 +904,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
(chNext == '?') &&