[geany/geany] 6c5a0d: Update Scintilla to version 3.4.1

Colomban Wendling git-noreply at xxxxx
Mon Apr 14 14:25:01 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 14 Apr 2014 14:25:01 UTC
Commit:      6c5a0dd7179b3f0ff183134059d596632a52e9cb
             https://github.com/geany/geany/commit/6c5a0dd7179b3f0ff183134059d596632a52e9cb

Log Message:
-----------
Update Scintilla to version 3.4.1


Modified Paths:
--------------
    scintilla/Makefile.am
    scintilla/gtk/Converter.h
    scintilla/gtk/PlatGTK.cxx
    scintilla/gtk/ScintillaGTK.cxx
    scintilla/include/Platform.h
    scintilla/include/SciLexer.h
    scintilla/include/Scintilla.h
    scintilla/include/Scintilla.iface
    scintilla/lexers/LexAbaqus.cxx
    scintilla/lexers/LexAsm.cxx
    scintilla/lexers/LexBash.cxx
    scintilla/lexers/LexBasic.cxx
    scintilla/lexers/LexCPP.cxx
    scintilla/lexers/LexCmake.cxx
    scintilla/lexers/LexForth.cxx
    scintilla/lexers/LexFortran.cxx
    scintilla/lexers/LexHTML.cxx
    scintilla/lexers/LexMarkdown.cxx
    scintilla/lexers/LexMatlab.cxx
    scintilla/lexers/LexOthers.cxx
    scintilla/lexers/LexPerl.cxx
    scintilla/lexers/LexSQL.cxx
    scintilla/lexers/LexTxt2tags.cxx
    scintilla/lexers/LexVHDL.cxx
    scintilla/lexlib/Accessor.h
    scintilla/lexlib/CharacterCategory.cxx
    scintilla/lexlib/LexAccessor.h
    scintilla/lexlib/LexerModule.cxx
    scintilla/lexlib/LexerSimple.h
    scintilla/lexlib/PropSetSimple.cxx
    scintilla/lexlib/SparseState.h
    scintilla/lexlib/StringCopy.h
    scintilla/lexlib/StyleContext.h
    scintilla/lexlib/SubStyles.h
    scintilla/lexlib/WordList.cxx
    scintilla/lexlib/WordList.h
    scintilla/scintilla_changes.patch
    scintilla/src/AutoComplete.cxx
    scintilla/src/AutoComplete.h
    scintilla/src/CallTip.cxx
    scintilla/src/CaseConvert.cxx
    scintilla/src/CellBuffer.cxx
    scintilla/src/CellBuffer.h
    scintilla/src/Decoration.h
    scintilla/src/Document.cxx
    scintilla/src/Document.h
    scintilla/src/Editor.cxx
    scintilla/src/Editor.h
    scintilla/src/ExternalLexer.cxx
    scintilla/src/ExternalLexer.h
    scintilla/src/FontQuality.h
    scintilla/src/KeyMap.cxx
    scintilla/src/KeyMap.h
    scintilla/src/LineMarker.cxx
    scintilla/src/Partitioning.h
    scintilla/src/PerLine.cxx
    scintilla/src/PositionCache.cxx
    scintilla/src/PositionCache.h
    scintilla/src/RESearch.cxx
    scintilla/src/RESearch.h
    scintilla/src/ScintillaBase.cxx
    scintilla/src/ScintillaBase.h
    scintilla/src/Selection.cxx
    scintilla/src/Selection.h
    scintilla/src/SplitVector.h
    scintilla/src/UniConversion.cxx
    scintilla/src/ViewStyle.cxx
    scintilla/src/ViewStyle.h
    scintilla/src/XPM.cxx
    scintilla/src/XPM.h
    scintilla/version.txt

Modified: scintilla/Makefile.am
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -69,6 +69,7 @@ lexlib/OptionSet.h \
 lexlib/PropSetSimple.cxx \
 lexlib/PropSetSimple.h \
 lexlib/SparseState.h \
+lexlib/StringCopy.h \
 lexlib/StyleContext.cxx \
 lexlib/StyleContext.h \
 lexlib/SubStyles.h \


Modified: scintilla/gtk/Converter.h
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -51,8 +51,8 @@ class Converter {
 			// Try allowing approximate transliterations
 			if (transliterations) {
 				char fullDest[200];
-				strcpy(fullDest, charSetDestination);
-				strcat(fullDest, "//TRANSLIT");
+				g_strlcpy(fullDest, charSetDestination, sizeof(fullDest));
+				g_strlcat(fullDest, "//TRANSLIT", sizeof(fullDest));
 				OpenHandle(fullDest, charSetSource);
 			}
 			if (!Succeeded()) {


Modified: scintilla/gtk/PlatGTK.cxx
38 files changed, 19 insertions(+), 19 deletions(-)
===================================================================
@@ -23,8 +23,9 @@
 
 #include "Scintilla.h"
 #include "ScintillaWidget.h"
-#include "UniConversion.h"
+#include "StringCopy.h"
 #include "XPM.h"
+#include "UniConversion.h"
 
 #if defined(__clang__)
 // Clang 3.0 incorrectly displays  sentinel warnings. Fixed by clang 3.1.
@@ -48,7 +49,7 @@
 
 static const double kPi = 3.14159265358979323846;
 
-// The Pango version guard for pango_units_from_double and pango_units_to_double 
+// The Pango version guard for pango_units_from_double and pango_units_to_double
 // is more complex than simply implementing these here.
 
 static int pangoUnitsFromDouble(double d) {
@@ -226,12 +227,12 @@ Point Point::FromLong(long lpoint) {
 }
 
 static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, float size, int weight, bool italic) {
-	memset(&lf, 0, sizeof(lf));
+	lf = LOGFONT();
 	lf.size = size;
 	lf.weight = weight;
 	lf.italic = italic;
 	lf.characterSet = characterSet;
-	strncpy(lf.faceName, faceName, sizeof(lf.faceName) - 1);
+	StringCopy(lf.faceName, faceName);
 }
 
 /**
@@ -253,7 +254,7 @@ class FontCached : Font {
 	int usage;
 	LOGFONT lf;
 	int hash;
-	FontCached(const FontParameters &fp);
+	explicit FontCached(const FontParameters &fp);
 	~FontCached() {}
 	bool SameAs(const FontParameters &fp);
 	virtual void Release();
@@ -339,7 +340,7 @@ void FontCached::ReleaseAll() {
 FontID FontCached::CreateNewFont(const FontParameters &fp) {
 	PangoFontDescription *pfd = pango_font_description_new();
 	if (pfd) {
-		pango_font_description_set_family(pfd, 
+		pango_font_description_set_family(pfd,
 			(fp.faceName[0] == '!') ? fp.faceName+1 : fp.faceName);
 		pango_font_description_set_size(pfd, pangoUnitsFromDouble(fp.size));
 		pango_font_description_set_weight(pfd, static_cast<PangoWeight>(fp.weight));
@@ -666,7 +667,7 @@ void SurfaceImpl::Polygon(Point *pts, int npts, ColourDesired fore,
                           ColourDesired back) {
 	PenColour(back);
 	cairo_move_to(context, pts[0].x + 0.5, pts[0].y + 0.5);
-	for (int i = 1;i < npts;i++) {
+	for (int i = 1; i < npts; i++) {
 		cairo_line_to(context, pts[i].x + 0.5, pts[i].y + 0.5);
 	}
 	cairo_close_path(context);
@@ -734,7 +735,7 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi
 		                  Point(rc.left, rc.bottom - 2),
 		                  Point(rc.left, rc.top + 2),
 		              };
-		Polygon(pts, sizeof(pts) / sizeof(pts[0]), fore, back);
+		Polygon(pts, ELEMENTS(pts), fore, back);
 	} else {
 		RectangleDraw(rc, fore, back);
 	}
@@ -821,7 +822,7 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi
 
 void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) {
 	PenColour(back);
-	cairo_arc(context, (rc.left + rc.right) / 2 + 0.5, (rc.top + rc.bottom) / 2 + 0.5,
+	cairo_arc(context, (rc.left + rc.right) / 2, (rc.top + rc.bottom) / 2,
 		Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*kPi);
 	cairo_fill_preserve(context);
 	PenColour(fore);
@@ -842,7 +843,7 @@ void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
 std::string UTF8FromLatin1(const char *s, int len) {
 	std::string utfForm(len*2 + 1, '\0');
 	size_t lenU = 0;
-	for (int i=0;i<len;i++) {
+	for (int i=0; i<len; i++) {
 		unsigned int uch = static_cast<unsigned char>(s[i]);
 		if (uch < 0x80) {
 			utfForm[lenU++] = uch;
@@ -936,7 +937,7 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase,
 void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len,
                                   ColourDesired fore) {
 	// Avoid drawing spaces in transparent mode
-	for (int i=0;i<len;i++) {
+	for (int i=0; i<len; i++) {
 		if (s[i] != ' ') {
 			DrawTextBase(rc, font_, ybase, s, len, fore);
 			return;
@@ -1064,7 +1065,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
 							int widthLayout = 0;
 							pango_layout_get_size(layout, &widthLayout, NULL);
 							XYPOSITION widthTotal = doubleFromPangoUnits(widthLayout);
-							for (int bytePos=0;bytePos<lenPositions; bytePos++) {
+							for (int bytePos=0; bytePos<lenPositions; bytePos++) {
 								positions[bytePos] = widthTotal / lenPositions * (bytePos + 1);
 							}
 							return;
@@ -1598,7 +1599,7 @@ PRectangle ListBoxX::GetDesiredRect() {
 		GtkRequisition req;
 #if GTK_CHECK_VERSION(3,0,0)
 		// This, apparently unnecessary call, ensures gtk_tree_view_column_cell_get_size
-		// returns reasonable values. 
+		// returns reasonable values.
 		gtk_widget_get_preferred_size(GTK_WIDGET(scroller), NULL, &req);
 #endif
 		int height;
@@ -1830,8 +1831,7 @@ void ListBoxX::GetValue(int n, char *value, int len) {
 		gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1);
 	}
 	if (text && len > 0) {
-		strncpy(value, text, len);
-		value[len - 1] = '\0';
+		g_strlcpy(value, text, len);
 	} else {
 		value[0] = '\0';
 	}
@@ -1963,7 +1963,7 @@ class DynamicLibraryImpl : public DynamicLibrary {
 protected:
 	GModule* m;
 public:
-	DynamicLibraryImpl(const char *modulePath) {
+	explicit DynamicLibraryImpl(const char *modulePath) {
 		m = g_module_open(modulePath, G_MODULE_BIND_LAZY);
 	}
 
@@ -1981,8 +1981,9 @@ class DynamicLibraryImpl : public DynamicLibrary {
 				return static_cast<Function>(fn_address);
 			else
 				return NULL;
-		} else
+		} else {
 			return NULL;
+		}
 	}
 
 	virtual bool IsValid() {
@@ -2141,8 +2142,7 @@ bool Platform::ShowAssertionPopUps(bool assertionPopUps_) {
 
 void Platform::Assert(const char *c, const char *file, int line) {
 	char buffer[2000];
-	sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line);
-	strcat(buffer, "\r\n");
+	g_snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\r\n", c, file, line);
 	Platform::DebugDisplay(buffer);
 	abort();
 }


Modified: scintilla/gtk/ScintillaGTK.cxx
50 files changed, 31 insertions(+), 19 deletions(-)
===================================================================
@@ -31,6 +31,7 @@
 #ifdef SCI_LEXER
 #include "SciLexer.h"
 #endif
+#include "StringCopy.h"
 #include "SplitVector.h"
 #include "Partitioning.h"
 #include "RunStyles.h"
@@ -165,7 +166,7 @@ class ScintillaGTK : public ScintillaBase {
 	ScintillaGTK &operator=(const ScintillaGTK &);
 
 public:
-	ScintillaGTK(_ScintillaObject *sci_);
+	explicit ScintillaGTK(_ScintillaObject *sci_);
 	virtual ~ScintillaGTK();
 	static void ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class);
 private:
@@ -338,14 +339,14 @@ static const GtkTargetEntry clipboardCopyTargets[] = {
 	{ (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING },
 	{ (gchar *) "STRING", 0, TARGET_STRING },
 };
-static const gint nClipboardCopyTargets = sizeof(clipboardCopyTargets) / sizeof(clipboardCopyTargets[0]);
+static const gint nClipboardCopyTargets = ELEMENTS(clipboardCopyTargets);
 
 static const GtkTargetEntry clipboardPasteTargets[] = {
 	{ (gchar *) "text/uri-list", 0, TARGET_URI },
 	{ (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING },
 	{ (gchar *) "STRING", 0, TARGET_STRING },
 };
-static const gint nClipboardPasteTargets = sizeof(clipboardPasteTargets) / sizeof(clipboardPasteTargets[0]);
+static const gint nClipboardPasteTargets = ELEMENTS(clipboardPasteTargets);
 
 static GtkWidget *PWidget(Window &w) {
 	return reinterpret_cast<GtkWidget *>(w.GetID());
@@ -1126,7 +1127,7 @@ void ScintillaGTK::SetVerticalScrollPos() {
 
 void ScintillaGTK::SetHorizontalScrollPos() {
 	DwellEnd(true);
-	gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmenth), xOffset / 2);
+	gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmenth), xOffset);
 }
 
 bool ScintillaGTK::ModifyScrollBars(int nMax, int nPage) {
@@ -1244,7 +1245,7 @@ const char *ScintillaGTK::CharacterSetID() const {
 class CaseFolderDBCS : public CaseFolderTable {
 	const char *charSet;
 public:
-	CaseFolderDBCS(const char *charSet_) : charSet(charSet_) {
+	explicit CaseFolderDBCS(const char *charSet_) : charSet(charSet_) {
 		StandardASCII();
 	}
 	virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) {
@@ -1334,7 +1335,7 @@ std::string ScintillaGTK::CaseMapString(const std::string &s, int caseMapping) {
 
 	if (IsUnicodeMode()) {
 		std::string retMapped(s.length() * maxExpansionCaseConversion, 0);
-		size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), 
+		size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(),
 			(caseMapping == cmUpper) ? CaseConversionUpper : CaseConversionLower);
 		retMapped.resize(lenMapped);
 		return retMapped;
@@ -1769,17 +1770,24 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) {
 			return FALSE;
 		}
 
+		bool shift = (event->state & GDK_SHIFT_MASK) != 0;
 		bool ctrl = (event->state & GDK_CONTROL_MASK) != 0;
+		// On X, instead of sending literal modifiers use the user specified
+		// modifier, defaulting to control instead of alt.
+		// This is because most X window managers grab alt + click for moving
+		bool alt = (event->state & modifierTranslated(rectangularSelectionModifier)) != 0;
 
 		gtk_widget_grab_focus(PWidget(wMain));
 		if (event->button == 1) {
-			// On X, instead of sending literal modifiers use the user specified
-			// modifier, defaulting to control instead of alt.
-			// This is because most X window managers grab alt + click for moving
-			ButtonDown(pt, event->time,
-			        (event->state & GDK_SHIFT_MASK) != 0,
-			        (event->state & GDK_CONTROL_MASK) != 0,
-			        (event->state & modifierTranslated(rectangularSelectionModifier)) != 0);
+#if PLAT_GTK_MACOSX
+			bool meta = ctrl;
+			// GDK reports the Command modifer key as GDK_MOD2_MASK for button events,
+			// not GDK_META_MASK like in key events.
+			ctrl = (event->state & GDK_MOD2_MASK) != 0;
+#else
+			bool meta = false;
+#endif
+			ButtonDownWithModifiers(pt, event->time, ModifierFlags(shift, ctrl, alt, meta));
 		} else if (event->button == 2) {
 			// Grab the primary selection if it exists
 			SelectionPosition pos = SPositionFromLocation(pt, false, false, UserVirtualSpace());
@@ -1807,13 +1815,13 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) {
 		} else if (event->button == 4) {
 			// Wheel scrolling up (only GTK 1.x does it this way)
 			if (ctrl)
-				SetAdjustmentValue(adjustmenth, (xOffset / 2) - 6);
+				SetAdjustmentValue(adjustmenth, xOffset - 6);
 			else
 				SetAdjustmentValue(adjustmentv, topLine - 3);
 		} else if (event->button == 5) {
 			// Wheel scrolling down (only GTK 1.x does it this way)
 			if (ctrl)
-				SetAdjustmentValue(adjustmenth, (xOffset / 2) + 6);
+				SetAdjustmentValue(adjustmenth, xOffset + 6);
 			else
 				SetAdjustmentValue(adjustmentv, topLine + 3);
 		}
@@ -1950,7 +1958,7 @@ gint ScintillaGTK::Motion(GtkWidget *widget, GdkEventMotion *event) {
 		GdkModifierType state;
 		if (event->is_hint) {
 #if GTK_CHECK_VERSION(3,0,0)
-			gdk_window_get_device_position(event->window, 
+			gdk_window_get_device_position(event->window,
 				event->device, &x, &y, &state);
 #else
 			gdk_window_get_pointer(event->window, &x, &y, &state);
@@ -2336,9 +2344,12 @@ void ScintillaGTK::RealizeText(GtkWidget *widget, void*) {
 	}
 }
 
+static GObjectClass *scintilla_class_parent_class;
+
 void ScintillaGTK::Destroy(GObject *object) {
 	try {
 		ScintillaObject *scio = reinterpret_cast<ScintillaObject *>(object);
+
 		// This avoids a double destruction
 		if (!scio->pscin)
 			return;
@@ -2348,6 +2359,7 @@ void ScintillaGTK::Destroy(GObject *object) {
 
 		delete sciThis;
 		scio->pscin = 0;
+		scintilla_class_parent_class->finalize(object);
 	} catch (...) {
 		// Its dead so nowhere to save the status
 	}
@@ -2510,9 +2522,9 @@ 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) * 2));
+		sciThis->HorizontalScrollTo(static_cast<int>(gtk_adjustment_get_value(adj)));
 #else
-		sciThis->HorizontalScrollTo(static_cast<int>(adj->value * 2));
+		sciThis->HorizontalScrollTo(static_cast<int>(adj->value));
 #endif
 	} catch (...) {
 		sciThis->errorStatus = SC_STATUS_FAILURE;
@@ -2910,7 +2922,7 @@ static void scintilla_class_init(ScintillaClass *klass) {
 
 		klass->command = NULL;
 		klass->notify = NULL;
-
+		scintilla_class_parent_class = G_OBJECT_CLASS(g_type_class_peek_parent(klass));
 		ScintillaGTK::ClassInit(object_class, widget_class, container_class);
 	} catch (...) {
 	}


Modified: scintilla/include/Platform.h
12 files changed, 11 insertions(+), 1 deletions(-)
===================================================================
@@ -444,6 +444,16 @@ class DynamicLibrary {
 	static DynamicLibrary *Load(const char *modulePath);
 };
 
+#if defined(__clang__)
+# if __has_feature(attribute_analyzer_noreturn)
+#  define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
+# else
+#  define CLANG_ANALYZER_NORETURN
+# endif
+#else
+# define CLANG_ANALYZER_NORETURN
+#endif
+
 /**
  * Platform class used to retrieve system wide parameters such as double click speed
  * and chrome colour. Not a creatable object, more of a module with several functions.
@@ -488,7 +498,7 @@ class Platform {
 	}
 	static void DebugPrintf(const char *format, ...);
 	static bool ShowAssertionPopUps(bool assertionPopUps_);
-	static void Assert(const char *c, const char *file, int line);
+	static void Assert(const char *c, const char *file, int line) CLANG_ANALYZER_NORETURN;
 	static int Clamp(int val, int minVal, int maxVal);
 };
 


Modified: scintilla/include/SciLexer.h
19 files changed, 18 insertions(+), 1 deletions(-)
===================================================================
@@ -124,6 +124,8 @@
 #define SCLEX_STTXT 109
 #define SCLEX_KVIRC 110
 #define SCLEX_RUST 111
+#define SCLEX_DMAP 112
+#define SCLEX_AS 113
 #define SCLEX_AUTOMATIC 1000
 #define SCE_P_DEFAULT 0
 #define SCE_P_COMMENTLINE 1
@@ -166,6 +168,7 @@
 #define SCE_C_HASHQUOTEDSTRING 22
 #define SCE_C_PREPROCESSORCOMMENT 23
 #define SCE_C_PREPROCESSORCOMMENTDOC 24
+#define SCE_C_USERLITERAL 25
 #define SCE_D_DEFAULT 0
 #define SCE_D_COMMENT 1
 #define SCE_D_COMMENTLINE 2
@@ -420,6 +423,10 @@
 #define SCE_B_ERROR 16
 #define SCE_B_HEXNUMBER 17
 #define SCE_B_BINNUMBER 18
+#define SCE_B_COMMENTBLOCK 19
+#define SCE_B_DOCLINE 20
+#define SCE_B_DOCBLOCK 21
+#define SCE_B_DOCKEYWORD 22
 #define SCE_PROPS_DEFAULT 0
 #define SCE_PROPS_COMMENT 1
 #define SCE_PROPS_SECTION 2
@@ -1541,7 +1548,6 @@
 #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
@@ -1683,6 +1689,17 @@
 #define SCE_RUST_LIFETIME 18
 #define SCE_RUST_MACRO 19
 #define SCE_RUST_LEXERROR 20
+#define SCE_DMAP_DEFAULT 0
+#define SCE_DMAP_COMMENT 1
+#define SCE_DMAP_NUMBER 2
+#define SCE_DMAP_STRING1 3
+#define SCE_DMAP_STRING2 4
+#define SCE_DMAP_STRINGEOL 5
+#define SCE_DMAP_OPERATOR 6
+#define SCE_DMAP_IDENTIFIER 7
+#define SCE_DMAP_WORD 8
+#define SCE_DMAP_WORD2 9
+#define SCE_DMAP_WORD3 10
 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
 
 #endif


Modified: scintilla/include/Scintilla.h
42 files changed, 22 insertions(+), 20 deletions(-)
===================================================================
@@ -125,6 +125,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SC_MARK_AVAILABLE 28
 #define SC_MARK_UNDERLINE 29
 #define SC_MARK_RGBAIMAGE 30
+#define SC_MARK_BOOKMARK 31
 #define SC_MARK_CHARACTER 10000
 #define SC_MARKNUM_FOLDEREND 25
 #define SC_MARKNUM_FOLDEROPENMID 26
@@ -358,8 +359,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SC_PRINT_COLOURONWHITEDEFAULTBG 4
 #define SCI_SETPRINTCOLOURMODE 2148
 #define SCI_GETPRINTCOLOURMODE 2149
-#define SCFIND_WHOLEWORD 2
-#define SCFIND_MATCHCASE 4
+#define SCFIND_WHOLEWORD 0x2
+#define SCFIND_MATCHCASE 0x4
 #define SCFIND_WORDSTART 0x00100000
 #define SCFIND_REGEXP 0x00200000
 #define SCFIND_POSIX 0x00400000
@@ -417,6 +418,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCI_CALLTIPCANCEL 2201
 #define SCI_CALLTIPACTIVE 2202
 #define SCI_CALLTIPPOSSTART 2203
+#define SCI_CALLTIPSETPOSSTART 2214
 #define SCI_CALLTIPSETHLT 2204
 #define SCI_CALLTIPSETBACK 2205
 #define SCI_CALLTIPSETFORE 2206
@@ -473,6 +475,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SC_WRAP_NONE 0
 #define SC_WRAP_WORD 1
 #define SC_WRAP_CHAR 2
+#define SC_WRAP_WHITESPACE 3
 #define SCI_SETWRAPMODE 2268
 #define SCI_GETWRAPMODE 2269
 #define SC_WRAPVISUALFLAG_NONE 0x0000
@@ -817,6 +820,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCI_CLEARSELECTIONS 2571
 #define SCI_SETSELECTION 2572
 #define SCI_ADDSELECTION 2573
+#define SCI_DROPSELECTIONN 2671
 #define SCI_SETMAINSELECTION 2574
 #define SCI_GETMAINSELECTION 2575
 #define SCI_SETSELECTIONNCARET 2576
@@ -880,6 +884,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCI_VCHOMEDISPLAYEXTEND 2653
 #define SCI_GETCARETLINEVISIBLEALWAYS 2654
 #define SCI_SETCARETLINEVISIBLEALWAYS 2655
+#define SC_LINE_END_TYPE_DEFAULT 0
+#define SC_LINE_END_TYPE_UNICODE 1
+#define SCI_SETLINEENDTYPESALLOWED 2656
+#define SCI_GETLINEENDTYPESALLOWED 2657
+#define SCI_GETLINEENDTYPESACTIVE 2658
 #define SCI_SETREPRESENTATION 2665
 #define SCI_GETREPRESENTATION 2666
 #define SCI_CLEARREPRESENTATION 2667
@@ -906,6 +915,16 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
 #define SCI_PROPERTYTYPE 4015
 #define SCI_DESCRIBEPROPERTY 4016
 #define SCI_DESCRIBEKEYWORDSETS 4017
+#define SCI_GETLINEENDTYPESSUPPORTED 4018
+#define SCI_ALLOCATESUBSTYLES 4020
+#define SCI_GETSUBSTYLESSTART 4021
+#define SCI_GETSUBSTYLESLENGTH 4022
+#define SCI_GETSTYLEFROMSUBSTYLE 4027
+#define SCI_GETPRIMARYSTYLEFROMSTYLE 4028
+#define SCI_FREESUBSTYLES 4023
+#define SCI_SETIDENTIFIERS 4024
+#define SCI_DISTANCETOSECONDARYSTYLES 4025
+#define SCI_GETSUBSTYLEBASES 4026
 #define SC_MOD_INSERTTEXT 0x1
 #define SC_MOD_DELETETEXT 0x2
 #define SC_MOD_CHANGESTYLE 0x4
@@ -989,23 +1008,6 @@ 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
-#ifndef SCI_DISABLE_PROVISIONAL
-#define SC_LINE_END_TYPE_DEFAULT 0
-#define SC_LINE_END_TYPE_UNICODE 1
-#define SCI_SETLINEENDTYPESALLOWED 2656
-#define SCI_GETLINEENDTYPESALLOWED 2657
-#define SCI_GETLINEENDTYPESACTIVE 2658
-#define SCI_GETLINEENDTYPESSUPPORTED 4018
-#define SCI_ALLOCATESUBSTYLES 4020
-#define SCI_GETSUBSTYLESSTART 4021
-#define SCI_GETSUBSTYLESLENGTH 4022
-#define SCI_GETSTYLEFROMSUBSTYLE 4027
-#define SCI_GETPRIMARYSTYLEFROMSTYLE 4028
-#define SCI_FREESUBSTYLES 4023
-#define SCI_SETIDENTIFIERS 4024
-#define SCI_DISTANCETOSECONDARYSTYLES 4025
-#define SCI_GETSUBSTYLEBASES 4026
-#endif
 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
 
 /* These structures are defined to be exactly the same shape as the Win32
@@ -1028,7 +1030,7 @@ struct Sci_TextRange {
 
 struct Sci_TextToFind {
 	struct Sci_CharacterRange chrg;
-	char *lpstrText;
+	const char *lpstrText;
 	struct Sci_CharacterRange chrgText;
 };
 


Modified: scintilla/include/Scintilla.iface
142 files changed, 85 insertions(+), 57 deletions(-)
===================================================================
@@ -268,6 +268,7 @@ val SC_MARK_LEFTRECT=27
 val SC_MARK_AVAILABLE=28
 val SC_MARK_UNDERLINE=29
 val SC_MARK_RGBAIMAGE=30
+val SC_MARK_BOOKMARK=31
 
 val SC_MARK_CHARACTER=10000
 
@@ -856,8 +857,8 @@ set void SetPrintColourMode=2148(int mode,)
 get int GetPrintColourMode=2149(,)
 
 enu FindOption=SCFIND_
-val SCFIND_WHOLEWORD=2
-val SCFIND_MATCHCASE=4
+val SCFIND_WHOLEWORD=0x2
+val SCFIND_MATCHCASE=0x4
 val SCFIND_WORDSTART=0x00100000
 val SCFIND_REGEXP=0x00200000
 val SCFIND_POSIX=0x00400000
@@ -1042,6 +1043,9 @@ fun bool CallTipActive=2202(,)
 # Retrieve the position where the caret was before displaying the call tip.
 fun position CallTipPosStart=2203(,)
 
+# Set the start position in order to change when backspacing removes the calltip.
+set void CallTipSetPosStart=2214(int posStart,)
+
 # Highlight a segment of the definition.
 fun void CallTipSetHlt=2204(int start, int end)
 
@@ -1185,6 +1189,7 @@ enu Wrap=SC_WRAP_
 val SC_WRAP_NONE=0
 val SC_WRAP_WORD=1
 val SC_WRAP_CHAR=2
+val SC_WRAP_WHITESPACE=3
 
 # Sets whether text is word wrapped.
 set void SetWrapMode=2268(int mode,)
@@ -2176,6 +2181,9 @@ fun int SetSelection=2572(int caret, int anchor)
 # Add a selection
 fun int AddSelection=2573(int caret, int anchor)
 
+# Drop one selection
+fun void DropSelectionN=2671(int selection,)
+
 # Set the main selection
 set void SetMainSelection=2574(int selection,)
 
@@ -2336,6 +2344,22 @@ get bool GetCaretLineVisibleAlways=2654(,)
 # Sets the caret line to always visible.
 set void SetCaretLineVisibleAlways=2655(bool alwaysVisible,)
 
+# Line end types which may be used in addition to LF, CR, and CRLF
+# SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator,
+# U+2029 Paragraph Separator, and U+0085 Next Line
+enu LineEndType=SC_LINE_END_TYPE_
+val SC_LINE_END_TYPE_DEFAULT=0
+val SC_LINE_END_TYPE_UNICODE=1
+
+# Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding.
+set void SetLineEndTypesAllowed=2656(int lineEndBitSet,)
+
+# Get the line end types currently allowed.
+get int GetLineEndTypesAllowed=2657(,)
+
+# Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation.
+get int GetLineEndTypesActive=2658(,)
+
 # Set the way a character is drawn.
 set void SetRepresentation=2665(string encodedCharacter, string representation)
 
@@ -2413,6 +2437,38 @@ fun int DescribeProperty=4016(string name, stringresult description)
 # Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
 fun int DescribeKeyWordSets=4017(, stringresult descriptions)
 
+# Bit set of LineEndType enumertion for which line ends beyond the standard
+# LF, CR, and CRLF are supported by the lexer.
+get int GetLineEndTypesSupported=4018(,)
+
+# Allocate a set of sub styles for a particular base style, returning start of range
+fun int AllocateSubStyles=4020(int styleBase, int numberStyles)
+
+# The starting style number for the sub styles associated with a base style
+get int GetSubStylesStart=4021(int styleBase,)
+
+# The number of sub styles associated with a base style
+get int GetSubStylesLength=4022(int styleBase,)
+
+# For a sub style, return the base style, else return the argument.
+get int GetStyleFromSubStyle=4027(int subStyle,)
+
+# For a secondary style, return the primary style, else return the argument.
+get int GetPrimaryStyleFromStyle=4028(int style,)
+
+# Free allocated sub styles
+fun void FreeSubStyles=4023(,)
+
+# Set the identifiers that are shown in a particular style
+set void SetIdentifiers=4024(int style, string identifiers)
+
+# Where styles are duplicated by a feature such as active/inactive code
+# return the distance between the two types.
+get int DistanceToSecondaryStyles=4025(,)
+
+# Get the set of base styles that can be extended with sub styles
+get int GetSubStyleBases=4026(, stringresult styles)
+
 # Notifications
 # Type of modification and the action which caused the modification.
 # These are defined as a bit mask to make it easy to specify which notifications are wanted.
@@ -2601,6 +2657,8 @@ val SCLEX_LITERATEHASKELL=108
 val SCLEX_STTXT=109
 val SCLEX_KVIRC=110
 val SCLEX_RUST=111
+val SCLEX_DMAP=112
+val SCLEX_AS=113
 
 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
 # value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -2652,6 +2710,7 @@ val SCE_C_TRIPLEVERBATIM=21
 val SCE_C_HASHQUOTEDSTRING=22
 val SCE_C_PREPROCESSORCOMMENT=23
 val SCE_C_PREPROCESSORCOMMENTDOC=24
+val SCE_C_USERLITERAL=25
 # Lexical states for SCLEX_D
 lex D=SCLEX_D SCE_D_
 val SCE_D_DEFAULT=0
@@ -2704,8 +2763,6 @@ val SCE_TCL_BLOCK_COMMENT=21
 # Lexical states for SCLEX_HTML, SCLEX_XML
 lex HTML=SCLEX_HTML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
 lex XML=SCLEX_XML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
-lex ASP=SCLEX_ASP SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
-lex PHP=SCLEX_PHP SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
 val SCE_H_DEFAULT=0
 val SCE_H_TAG=1
 val SCE_H_TAGUNKNOWN=2
@@ -2935,6 +2992,10 @@ val SCE_B_LABEL=15
 val SCE_B_ERROR=16
 val SCE_B_HEXNUMBER=17
 val SCE_B_BINNUMBER=18
+val SCE_B_COMMENTBLOCK=19
+val SCE_B_DOCLINE=20
+val SCE_B_DOCBLOCK=21
+val SCE_B_DOCKEYWORD=22
 # Lexical states for SCLEX_PROPERTIES
 lex Properties=SCLEX_PROPERTIES SCE_PROPS_
 val SCE_PROPS_DEFAULT=0
@@ -3187,8 +3248,9 @@ val SCE_SCRIPTOL_IDENTIFIER=12
 val SCE_SCRIPTOL_TRIPLE=13
 val SCE_SCRIPTOL_CLASSNAME=14
 val SCE_SCRIPTOL_PREPROCESSOR=15
-# Lexical states for SCLEX_ASM
+# Lexical states for SCLEX_ASM, SCLEX_AS
 lex Asm=SCLEX_ASM SCE_ASM_
+lex As=SCLEX_AS SCE_ASM_
 val SCE_ASM_DEFAULT=0
 val SCE_ASM_COMMENT=1
 val SCE_ASM_NUMBER=2
@@ -3945,8 +4007,8 @@ val SCE_R_OPERATOR=8
 val SCE_R_IDENTIFIER=9
 val SCE_R_INFIX=10
 val SCE_R_INFIXEOL=11
-# Lexical state for SCLEX_MAGIKSF
-lex MagikSF=SCLEX_MAGIKSF SCE_MAGIK_
+# Lexical state for SCLEX_MAGIK
+lex MagikSF=SCLEX_MAGIK SCE_MAGIK_
 val SCE_MAGIK_DEFAULT=0
 val SCE_MAGIK_COMMENT=1
 val SCE_MAGIK_HYPER_COMMENT=16
@@ -4208,7 +4270,6 @@ 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
@@ -4327,7 +4388,7 @@ val SCE_STTXT_DATETIME=16
 val SCE_STTXT_VARS=17
 val SCE_STTXT_PRAGMAS=18
 # Lexical states for SCLEX_KVIRC
-lex KVIrc=SCLEX_KVIRC SCLEX_KVIRC_
+lex KVIrc=SCLEX_KVIRC SCE_KVIRC_
 val SCE_KVIRC_DEFAULT=0
 val SCE_KVIRC_COMMENT=1
 val SCE_KVIRC_COMMENTBLOCK=2
@@ -4364,6 +4425,19 @@ val SCE_RUST_IDENTIFIER=17
 val SCE_RUST_LIFETIME=18
 val SCE_RUST_MACRO=19
 val SCE_RUST_LEXERROR=20
+# Lexical states for SCLEX_DMAP
+lex DMAP=SCLEX_DMAP SCE_DMAP_
+val SCE_DMAP_DEFAULT=0
+val SCE_DMAP_COMMENT=1
+val SCE_DMAP_NUMBER=2
+val SCE_DMAP_STRING1=3
+val SCE_DMAP_STRING2=4
+val SCE_DMAP_STRINGEOL=5
+val SCE_DMAP_OPERATOR=6
+val SCE_DMAP_IDENTIFIER=7
+val SCE_DMAP_WORD=8
+val SCE_DMAP_WORD2=9
+val SCE_DMAP_WORD3=10
 
 # Events
 
@@ -4398,55 +4472,9 @@ evt void HotSpotReleaseClick=2027(int modifiers, int position)
 evt void FocusIn=2028(void)
 evt void FocusOut=2029(void)
 
-cat Provisional
+# There are no provisional features currently
 
-# Line end types which may be used in addition to LF, CR, and CRLF
-# SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator,
-# U+2029 Paragraph Separator, and U+0085 Next Line
-enu LineEndType=SC_LINE_END_TYPE_
-val SC_LINE_END_TYPE_DEFAULT=0
-val SC_LINE_END_TYPE_UNICODE=1
-
-# Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding.
-set void SetLineEndTypesAllowed=2656(int lineEndBitSet,)
-
-# Get the line end types currently allowed.
-get int GetLineEndTypesAllowed=2657(,)
-
-# Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation.
-get int GetLineEndTypesActive=2658(,)
-
-# Bit set of LineEndType enumertion for which line ends beyond the standard
-# LF, CR, and CRLF are supported by the lexer.
-get int GetLineEndTypesSupported=4018(,)
-
-# Allocate a set of sub styles for a particular base style, returning start of range
-fun int AllocateSubStyles=4020(int styleBase, int numberStyles)
-
-# The starting style number for the sub styles associated with a base style
-get int GetSubStylesStart=4021(int styleBase,)
-
-# The number of sub styles associated with a base style
-get int GetSubStylesLength=4022(int styleBase,)
-
-# For a sub style, return the base style, else return the argument.
-get int GetStyleFromSubStyle=4027(int subStyle,)
-
-# For a secondary style, return the primary style, else return the argument.
-get int GetPrimaryStyleFromStyle=4028(int style,)
-
-# Free allocated sub styles
-fun void FreeSubStyles=4023(,)
-
-# Set the identifiers that are shown in a particular style
-set void SetIdentifiers=4024(int style, string identifiers)
-
-# Where styles are duplicated by a feature such as active/inactive code
-# return the distance between the two types.
-get int DistanceToSecondaryStyles=4025(,)
-
-# Get the set of base styles that can be extended with sub styles
-get int GetSubStyleBases=4026(, stringresult styles)
+cat Provisional
 
 cat Deprecated
 


Modified: scintilla/lexers/LexAbaqus.cxx
15 files changed, 0 insertions(+), 15 deletions(-)
===================================================================
@@ -30,10 +30,6 @@
 using namespace Scintilla;
 #endif
 
-static inline bool IsAWordChar(const int ch) {
-	return (ch < 0x80 && (isalnum(ch) || (ch == '_')));
-}
-
 static inline bool IsAKeywordChar(const int ch) {
 	return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == ' ')));
 }
@@ -42,17 +38,6 @@ static inline bool IsASetChar(const int ch) {
 	return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-')));
 }
 
-static inline bool IsAnOperator(char ch) {
-	// '.' left out as it is used to make up numbers
-	if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
-		ch == '(' || ch == ')' || ch == '=' || ch == '^' ||
-		ch == '[' || ch == ']' || ch == '<' || ch == '&' ||
-		ch == '>' || ch == ',' || ch == '|' || ch == '~' ||
-		ch == '$' || ch == ':' || ch == '%')
-		return true;
-	return false;
-}
-
 static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */,
                             Accessor &styler) {
 	enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \


Modified: scintilla/lexers/LexAsm.cxx
13 files changed, 10 insertions(+), 3 deletions(-)
===================================================================
@@ -150,8 +150,10 @@ class LexerAsm : public ILexer {
 	WordList directives4foldend;
 	OptionsAsm options;
 	OptionSetAsm osAsm;
+	int commentChar;
 public:
-	LexerAsm() {
+	LexerAsm(int commentChar_) {
+		commentChar = commentChar_;
 	}
 	virtual ~LexerAsm() {
 	}
@@ -183,7 +185,11 @@ class LexerAsm : public ILexer {
 	}
 
 	static ILexer *LexerFactoryAsm() {
-		return new LexerAsm();
+		return new LexerAsm(';');
+	}
+
+	static ILexer *LexerFactoryAs() {
+		return new LexerAsm('#');
 	}
 };
 
@@ -342,7 +348,7 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle,
 
 		// Determine if a new state should be entered.
 		if (sc.state == SCE_ASM_DEFAULT) {
-			if (sc.ch == ';'){
+			if (sc.ch == commentChar){
 				sc.SetState(SCE_ASM_COMMENT);
 			} else if (IsASCII(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && IsASCII(sc.chNext) && isdigit(sc.chNext)))) {
 				sc.SetState(SCE_ASM_NUMBER);
@@ -457,4 +463,5 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle,
 }
 
 LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc);
+LexerModule lmAs(SCLEX_AS, LexerAsm::LexerFactoryAs, "as", asmWordListDesc);
 


Modified: scintilla/lexers/LexBash.cxx
9 files changed, 8 insertions(+), 1 deletions(-)
===================================================================
@@ -108,6 +108,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
 	CharacterSet setWordStart(CharacterSet::setAlpha, "_");
 	// note that [+-] are often parts of identifiers in shell scripts
 	CharacterSet setWord(CharacterSet::setAlphaNum, "._+-");
+	CharacterSet setMetaCharacter(CharacterSet::setNone, "|&;()<> \t\r\n");
+	setMetaCharacter.Add(0);
 	CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/<?!.~@");
 	CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMACahGLNn");
 	CharacterSet setParam(CharacterSet::setAlphaNum, "$_");
@@ -627,7 +629,12 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
 			} else if (setWordStart.Contains(sc.ch)) {
 				sc.SetState(SCE_SH_WORD);
 			} else if (sc.ch == '#') {
-				sc.SetState(SCE_SH_COMMENTLINE);
+				if (stylePrev != SCE_SH_WORD && stylePrev != SCE_SH_IDENTIFIER &&
+					(sc.currentPos == 0 || setMetaCharacter.Contains(sc.chPrev))) {
+					sc.SetState(SCE_SH_COMMENTLINE);
+				} else {
+					sc.SetState(SCE_SH_WORD);
+				}
 			} else if (sc.ch == '\"') {
 				sc.SetState(SCE_SH_STRING);
 				QuoteStack.Start(sc.ch, BASH_DELIM_STRING);


Modified: scintilla/lexers/LexBasic.cxx
92 files changed, 74 insertions(+), 18 deletions(-)
===================================================================
@@ -49,17 +49,18 @@ using namespace Scintilla;
  * 8  - decimal digit
  * 16 - hex digit
  * 32 - bin digit
+ * 64 - letter
  */
 static int character_classification[128] =
 {
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  1,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    1,  2,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  10, 2,
-    60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2,  2,  2,  2,  2,  2,
-    2,  20, 20, 20, 20, 20, 20, 4,  4,  4,  4,  4,  4,  4,  4,  4,
-    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  4,
-    2,  20, 20, 20, 20, 20, 20, 4,  4,  4,  4,  4,  4,  4,  4,  4,
-    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  0
+		0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  1,  0,  0,
+		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+		1,  2,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  10, 2,
+	 60, 60, 28, 28, 28, 28, 28, 28, 28, 28,  2,  2,  2,  2,  2,  2,
+		2, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+	 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,  2,  2,  2,  2, 68,
+		2, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+	 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,  2,  2,  2,  2,  0
 };
 
 static bool IsSpace(int c) {
@@ -86,6 +87,10 @@ static bool IsBinDigit(int c) {
 	return c < 128 && (character_classification[c] & 32);
 }
 
+static bool IsLetter(int c) {
+	return c < 128 && (character_classification[c] & 64);
+}
+
 static int LowerCase(int c)
 {
 	if (c >= 'A' && c <= 'Z')
@@ -126,13 +131,23 @@ static int CheckPureFoldPoint(char const *token, int &level) {
 static int CheckFreeFoldPoint(char const *token, int &level) {
 	if (!strcmp(token, "function") ||
 		!strcmp(token, "sub") ||
-		!strcmp(token, "type")) {
+		!strcmp(token, "enum") ||
+		!strcmp(token, "type") ||
+		!strcmp(token, "union") ||
+		!strcmp(token, "property") ||
+		!strcmp(token, "destructor") ||
+		!strcmp(token, "constructor")) {
 		level |= SC_FOLDLEVELHEADERFLAG;
 		return 1;
 	}
 	if (!strcmp(token, "end function") ||
 		!strcmp(token, "end sub") ||
-		!strcmp(token, "end type")) {
+		!strcmp(token, "end enum") ||
+		!strcmp(token, "end type") ||
+		!strcmp(token, "end union") ||
+		!strcmp(token, "end property") ||
+		!strcmp(token, "end destructor") ||
+		!strcmp(token, "end constructor")) {
 		return -1;
 	}
 	return 0;
@@ -219,9 +234,9 @@ class LexerBasic : public ILexer {
 	OptionSetBasic osBasic;
 public:
 	LexerBasic(char comment_char_, int (*CheckFoldPoint_)(char const *, int &), const char * const wordListDescriptions[]) :
-	           comment_char(comment_char_),
-	           CheckFoldPoint(CheckFoldPoint_),
-	           osBasic(wordListDescriptions) {
+						 comment_char(comment_char_),
+						 CheckFoldPoint(CheckFoldPoint_),
+						 osBasic(wordListDescriptions) {
 	}
 	virtual ~LexerBasic() {
 	}
@@ -302,6 +317,7 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle
 
 	bool wasfirst = true, isfirst = true; // true if first token in a line
 	styler.StartAt(startPos);
+	int styleBeforeKeyword = SCE_B_DEFAULT;
 
 	StyleContext sc(startPos, length, initStyle, styler);
 
@@ -367,14 +383,44 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle
 			if (sc.atLineEnd) {
 				sc.SetState(SCE_B_DEFAULT);
 			}
+		} else if (sc.state == SCE_B_DOCLINE) {
+			if (sc.atLineEnd) {
+				sc.SetState(SCE_B_DEFAULT);
+			} else if (sc.ch == '\\' || sc.ch == '@') {
+				if (IsLetter(sc.chNext) && sc.chPrev != '\\') {
+					styleBeforeKeyword = sc.state;
+					sc.SetState(SCE_B_DOCKEYWORD);
+				};
+			}
+		} else if (sc.state == SCE_B_DOCKEYWORD) {
+			if (IsSpace(sc.ch)) {
+				sc.SetState(styleBeforeKeyword);
+			}	else if (sc.atLineEnd && styleBeforeKeyword == SCE_B_DOCLINE) {
+				sc.SetState(SCE_B_DEFAULT);
+			}
+		} else if (sc.state == SCE_B_COMMENTBLOCK) {
+			if (sc.Match("\'/")) {
+				sc.Forward();
+				sc.ForwardSetState(SCE_B_DEFAULT);
+			}
+		} else if (sc.state == SCE_B_DOCBLOCK) {
+			if (sc.Match("\'/")) {
+				sc.Forward();
+				sc.ForwardSetState(SCE_B_DEFAULT);
+			} else if (sc.ch == '\\' || sc.ch == '@') {
+				if (IsLetter(sc.chNext) && sc.chPrev != '\\') {
+					styleBeforeKeyword = sc.state;
+					sc.SetState(SCE_B_DOCKEYWORD);
+				};
+			}
 		}
 
 		if (sc.atLineStart)
 			isfirst = true;
 
 		if (sc.state == SCE_B_DEFAULT || sc.state == SCE_B_ERROR) {
-			if (isfirst && sc.Match('.')) {
-				sc.SetState(SCE_B_LABEL);
+			if (isfirst && sc.Match('.') && comment_char != '\'') {
+					sc.SetState(SCE_B_LABEL);
 			} else if (isfirst && sc.Match('#')) {
 				wasfirst = isfirst;
 				sc.SetState(SCE_B_IDENTIFIER);
@@ -383,15 +429,25 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle
 				// up in freebasic with SCE_B_PREPROCESSOR.
 				if (comment_char == '\'' && sc.Match(comment_char, '$'))
 					sc.SetState(SCE_B_PREPROCESSOR);
-				else
+				else if (sc.Match("\'*") || sc.Match("\'!")) {
+					sc.SetState(SCE_B_DOCLINE);
+				} else {
 					sc.SetState(SCE_B_COMMENT);
+				}
+			} else if (sc.Match("/\'")) {
+				if (sc.Match("/\'*") || sc.Match("/\'!")) {	// Support of gtk-doc/Doxygen doc. style
+					sc.SetState(SCE_B_DOCBLOCK);
+				} else {
+					sc.SetState(SCE_B_COMMENTBLOCK);
+				}
+				sc.Forward();	// Eat the ' so it isn't used for the end of the comment
 			} else if (sc.Match('"')) {
 				sc.SetState(SCE_B_STRING);
 			} else if (IsDigit(sc.ch)) {
 				sc.SetState(SCE_B_NUMBER);
-			} else if (sc.Match('$')) {
+			} else if (sc.Match('$') || sc.Match("&h") || sc.Match("&H") || sc.Match("&o") || sc.Match("&O")) {
 				sc.SetState(SCE_B_HEXNUMBER);
-			} else if (sc.Match('%')) {
+			} else if (sc.Match('%') || sc.Match("&b") || sc.Match("&B")) {
 				sc.SetState(SCE_B_BINNUMBER);
 			} else if (sc.Match('#')) {
 				sc.SetState(SCE_B_CONSTANT);


Modified: scintilla/lexers/LexCPP.cxx
44 files changed, 34 insertions(+), 10 deletions(-)
===================================================================
@@ -336,7 +336,7 @@ class LexerCPP : public ILexerWithSubStyles {
 	enum { ssIdentifier, ssDocKeyword };
 	SubStyles subStyles;
 public:
-	LexerCPP(bool caseSensitive_) :
+	explicit LexerCPP(bool caseSensitive_) :
 		caseSensitive(caseSensitive_),
 		setWord(CharacterSet::setAlphaNum, "._", 0x80, true),
 		setNegationOp(CharacterSet::setNone, "!"),
@@ -376,7 +376,7 @@ class LexerCPP : public ILexerWithSubStyles {
 
 	int SCI_METHOD LineEndTypesSupported() {
 		return SC_LINE_END_TYPE_UNICODE;
-	};
+	}
 
 	int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) {
 		return subStyles.Allocate(styleBase, numberStyles);
@@ -485,7 +485,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
 // Functor used to truncate history
 struct After {
 	int line;
-	After(int line_) : line(line_) {}
+	explicit After(int line_) : line(line_) {}
 	bool operator()(PPDefinition &p) const {
 		return p.line > line;
 	}
@@ -515,6 +515,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
 	bool isIncludePreprocessor = false;
 	bool isStringInPreprocessor = false;
 	bool inRERange = false;
+	bool seenDocKeyBrace = false;
 
 	int lineCurrent = styler.GetLine(startPos);
 	if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) ||
@@ -633,12 +634,19 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
 				break;
 			case SCE_C_NUMBER:
 				// We accept almost anything because of hex. and number suffixes
-				if (!(setWord.Contains(sc.ch)
+				if (sc.ch == '_') {
+					sc.ChangeState(SCE_C_USERLITERAL|activitySet);
+				} else if (!(setWord.Contains(sc.ch)
+				   || (sc.ch == '\'')
 				   || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E' ||
 				                                          sc.chPrev == 'p' || sc.chPrev == 'P')))) {
 					sc.SetState(SCE_C_DEFAULT|activitySet);
 				}
 				break;
+			case SCE_C_USERLITERAL:
+				if (!(setWord.Contains(sc.ch)))
+					sc.SetState(SCE_C_DEFAULT|activitySet);
+				break;
 			case SCE_C_IDENTIFIER:
 				if (sc.atLineStart || sc.atLineEnd || !setWord.Contains(sc.ch) || (sc.ch == '.')) {
 					char s[1000];
@@ -675,9 +683,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
 								sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet);
 							else
 								sc.ChangeState(SCE_C_CHARACTER|activitySet);
+						} else {
+							sc.SetState(SCE_C_DEFAULT | activitySet);
 						}
+					} else {
+						sc.SetState(SCE_C_DEFAULT|activitySet);
 					}
-					sc.SetState(SCE_C_DEFAULT|activitySet);
 				}
 				break;
 			case SCE_C_PREPROCESSOR:
@@ -685,7 +696,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
 					if (IsASpace(sc.ch)) {
 						sc.SetState(SCE_C_DEFAULT|activitySet);
 					}
-				} else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"'))) {
+				} else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"') || sc.atLineEnd)) {
 					isStringInPreprocessor = false;
 				} else if (!isStringInPreprocessor) {
 					if ((isIncludePreprocessor && sc.Match('<')) || sc.Match('\"')) {
@@ -749,14 +760,18 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
 					sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
 					sc.Forward();
 					sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
-				} else if (!setDoxygen.Contains(sc.ch)) {
+					seenDocKeyBrace = false;
+				} else if (sc.ch == '[' || sc.ch == '{') {
+					seenDocKeyBrace = true;
+				} else if (!setDoxygen.Contains(sc.ch)
+				           && !(seenDocKeyBrace && (sc.ch == ',' || sc.ch == '.'))) {
 					char s[100];
 					if (caseSensitive) {
 						sc.GetCurrent(s, sizeof(s));
 					} else {
 						sc.GetCurrentLowered(s, sizeof(s));
 					}
-					if (!IsASpace(sc.ch)) {
+					if (!(IsASpace(sc.ch) || (sc.ch == 0))) {
 						sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet);
 					} else if (!keywords3.InList(s + 1)) {
 						int subStyleCDKW = classifierDocKeyWords.ValueFor(s+1);
@@ -767,6 +782,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
 						}
 					}
 					sc.SetState(styleBeforeDCKeyword|activitySet);
+					seenDocKeyBrace = false;
 				}
 				break;
 			case SCE_C_STRING:
@@ -782,7 +798,11 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
 						sc.Forward();
 					}
 				} else if (sc.ch == '\"') {
-					sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+					if (sc.chNext == '_') {
+						sc.ChangeState(SCE_C_USERLITERAL|activitySet);
+					} else {
+						sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+					}
 				}
 				break;
 			case SCE_C_HASHQUOTEDSTRING:
@@ -810,7 +830,11 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
 						sc.Forward();
 					}
 				} else if (sc.ch == '\'') {
-					sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+					if (sc.chNext == '_') {
+						sc.ChangeState(SCE_C_USERLITERAL|activitySet);
+					} else {
+						sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+					}
 				}
 				break;
 			case SCE_C_REGEX:


Modified: scintilla/lexers/LexCmake.cxx
14 files changed, 5 insertions(+), 9 deletions(-)
===================================================================
@@ -226,14 +226,13 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
 
             break;
         case SCE_CMAKE_COMMENT:
-            if ( cNextChar == '\n' || cNextChar == '\r' ) {
-                // Special case:
-                if ( cCurrChar == '\\' ) {
+            if ( cCurrChar == '\n' || cCurrChar == '\r' ) {
+                if ( styler.SafeGetCharAt(i-1) == '\\' ) {
                     styler.ColourTo(i-2,state);
-                    styler.ColourTo(i,SCE_CMAKE_DEFAULT);
+                    styler.ColourTo(i-1,SCE_CMAKE_DEFAULT);
                 }
                 else {
-                    styler.ColourTo(i,state);
+                    styler.ColourTo(i-1,state);
                     state = SCE_CMAKE_DEFAULT;
                 }
             }
@@ -335,10 +334,7 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
             break;
         }
 
-        if ( state == SCE_CMAKE_COMMENT) {
-            styler.ColourTo(i,state);
-        }
-        else if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) {
+        if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) {
             bool bIngoreNextDollarSign = false;
 
             if ( bVarInString && cCurrChar == '$' ) {


Modified: scintilla/lexers/LexForth.cxx
9 files changed, 0 insertions(+), 9 deletions(-)
===================================================================
@@ -27,15 +27,6 @@
 using namespace Scintilla;
 #endif
 
-static inline bool IsAWordChar(int ch) {
-	return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
-		ch == '_' || ch == '?' || ch == '"' || ch == '@' ||
-		ch == '!' || ch == '[' || ch == ']' || ch == '/' ||
-		ch == '+' || ch == '-' || ch == '*' || ch == '<' ||
-		ch == '>' || ch == '=' || ch == ';' || ch == '(' ||
-		ch == ')' );
-}
-
 static inline bool IsAWordStart(int ch) {
 	return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
 }


Modified: scintilla/lexers/LexFortran.cxx
235 files changed, 132 insertions(+), 103 deletions(-)
===================================================================
@@ -38,15 +38,15 @@ static inline bool IsAWordStart(const int ch) {
 	return (ch < 0x80) && (isalnum(ch));
 }
 /***************************************/
-inline bool IsABlank(unsigned int ch) {
-    return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
+static inline bool IsABlank(unsigned int ch) {
+	return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
 }
 /***************************************/
-inline bool IsALineEnd(char ch) {
-    return ((ch == '\n') || (ch == '\r')) ;
+static inline bool IsALineEnd(char ch) {
+	return ((ch == '\n') || (ch == '\r')) ;
 }
 /***************************************/
-unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
+static unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
 	while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue;
 	if (styler.SafeGetCharAt(pos) == '\n') pos++;
 	while (IsABlank(styler.SafeGetCharAt(pos++))) continue;
@@ -60,7 +60,7 @@ unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
 }
 /***************************************/
 static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle,
-			WordList *keywordlists[], Accessor &styler, bool isFixFormat) {
+        WordList *keywordlists[], Accessor &styler, bool isFixFormat) {
 	WordList &keywords = *keywordlists[0];
 	WordList &keywords2 = *keywordlists[1];
 	WordList &keywords3 = *keywordlists[2];
@@ -89,11 +89,11 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
 		int toLineStart = sc.currentPos - posLineStart;
 		if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) {
 			if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') {
-                if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
-                    sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") ||
-                    sc.MatchIgnoreCase("cms$")  || sc.MatchIgnoreCase("*ms$")  || sc.MatchIgnoreCase("!ms$")  ||
-                    sc.chNext == '$') {
-                    sc.SetState(SCE_F_PREPROCESSOR);
+				if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
+				        sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") ||
+				        sc.MatchIgnoreCase("cms$")  || sc.MatchIgnoreCase("*ms$")  || sc.MatchIgnoreCase("!ms$")  ||
+				        sc.chNext == '$') {
+					sc.SetState(SCE_F_PREPROCESSOR);
 				} else {
 					sc.SetState(SCE_F_COMMENT);
 				}
@@ -111,8 +111,8 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
 				//if (!IsASpace(sc.ch) && sc.ch != '0') {
 				if (sc.ch != '\r' && sc.ch != '\n') {
 					sc.SetState(SCE_F_CONTINUATION);
-                    if (!IsASpace(sc.ch) && sc.ch != '0')
-                        sc.ForwardSetState(prevState);
+					if (!IsASpace(sc.ch) && sc.ch != '0')
+						sc.ForwardSetState(prevState);
 				} else
 					sc.SetState(SCE_F_DEFAULT);
 			}
@@ -122,9 +122,9 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
 		// Hanndle preprocessor directives
 		if (sc.ch == '#' && numNonBlank == 1)
 		{
-            sc.SetState(SCE_F_PREPROCESSOR);
-            while (!sc.atLineEnd && sc.More())
-                sc.Forward(); // Until line end
+			sc.SetState(SCE_F_PREPROCESSOR);
+			while (!sc.atLineEnd && sc.More())
+				sc.Forward(); // Until line end
 		}
 		/***************************************/
 		// Handle line continuation generically.
@@ -221,8 +221,8 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
 		// Determine if a new state should be entered.
 		if (sc.state == SCE_F_DEFAULT) {
 			if (sc.ch == '!') {
-                if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") ||
-                    sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
+				if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") ||
+				        sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
 					sc.SetState(SCE_F_PREPROCESSOR);
 				} else {
 					sc.SetState(SCE_F_COMMENT);
@@ -232,7 +232,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
 			} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
 				sc.SetState(SCE_F_NUMBER);
 			} else if ((tolower(sc.ch) == 'b' || tolower(sc.ch) == 'o' ||
-					    tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) {
+			        tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) {
 				sc.SetState(SCE_F_NUMBER);
 				sc.Forward();
 			} else if (sc.ch == '.' && isalpha(sc.chNext)) {
@@ -254,41 +254,48 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
 // To determine the folding level depending on keywords
 static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) {
 	int lev = 0;
-	if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0)
-		return -1;
-	if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0
-	    || strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0
-	    || strcmp(s, "do") == 0 || strcmp(s, "enum") ==0
-	    || strcmp(s, "function") == 0 || strcmp(s, "interface") == 0
-		|| strcmp(s, "module") == 0 || strcmp(s, "program") == 0
-		|| strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0
-		|| (strcmp(s, "type") == 0 && chNextNonBlank != '(')
-        || strcmp(s, "critical") == 0){
-			if (strcmp(prevWord, "end") == 0)
-				lev = 0;
-			else
-				lev = 1;
+
+	if ((strcmp(prevWord, "module") == 0 && strcmp(s, "subroutine") == 0)
+		|| (strcmp(prevWord, "module") == 0 && strcmp(s, "function") == 0)) {
+		lev = 0;
+	} else if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0
+	        || strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0
+	        || strcmp(s, "do") == 0 || strcmp(s, "enum") ==0
+	        || strcmp(s, "function") == 0 || strcmp(s, "interface") == 0
+	        || strcmp(s, "module") == 0 || strcmp(s, "program") == 0
+	        || strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0
+	        || (strcmp(s, "type") == 0 && chNextNonBlank != '(')
+		|| strcmp(s, "critical") == 0 || strcmp(s, "submodule") == 0){
+		if (strcmp(prevWord, "end") == 0)
+			lev = 0;
+		else
+			lev = 1;
 	} else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=')
-		|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
-		|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
-		|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0
-		|| strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0
-		|| strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0
-		|| strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0
-		|| strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0
-		|| strcmp(s, "endwhere") == 0 || strcmp(s, "endcritical") == 0
-		|| (strcmp(s, "procedure") == 0 && strcmp(prevWord, "module") == 0) ) { // Take care of the "module procedure" statement
-			lev = -1;
+	        || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
+	        || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
+	        || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0
+	        || strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0
+	        || strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0
+	        || strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0
+	        || strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0
+	        || strcmp(s, "endwhere") == 0 || strcmp(s, "endcritical") == 0
+		|| (strcmp(prevWord, "module") == 0 && strcmp(s, "procedure") == 0)  // Take care of the "module procedure" statement
+		|| strcmp(s, "endsubmodule") == 0) {
+		lev = -1;
 	} else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if
-			lev = 0;
+		lev = 0;
 	} else if (strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0){ // type is
-                        lev = -1;
-        }
+		lev = -1;
+	} else if ((strcmp(prevWord, "end") == 0 && strcmp(s, "procedure") == 0)
+			   || strcmp(s, "endprocedure") == 0) {
+			lev = 1; // level back to 0, because no folding support for "module procedure" in submodule
+	}
 	return lev;
 }
+/***************************************/
 // Folding the code
 static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
-						   Accessor &styler, bool isFixFormat) {
+        Accessor &styler, bool isFixFormat) {
 	//
 	// bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
 	// Do not know how to fold the comment at the moment.
@@ -297,35 +304,51 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
 	unsigned int endPos = startPos + length;
 	int visibleChars = 0;
 	int lineCurrent = styler.GetLine(startPos);
-	int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
-	int levelCurrent = levelPrev;
+	int levelCurrent;
+	bool isPrevLine;
+	if (lineCurrent > 0) {
+		lineCurrent--;
+		startPos = styler.LineStart(lineCurrent);
+		levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+		isPrevLine = true;
+	} else {
+		levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+		isPrevLine = false;
+	}
 	char chNext = styler[startPos];
-	char chNextNonBlank;
 	int styleNext = styler.StyleAt(startPos);
 	int style = initStyle;
+	int levelDeltaNext = 0;
 	/***************************************/
 	int lastStart = 0;
 	char prevWord[32] = "";
-	char Label[6] = "";
-	// Variables for do label folding.
-	static int doLabels[100];
-	static int posLabel=-1;
 	/***************************************/
 	for (unsigned int i = startPos; i < endPos; i++) {
 		char ch = chNext;
 		chNext = styler.SafeGetCharAt(i + 1);
-		chNextNonBlank = chNext;
+		char chNextNonBlank = chNext;
+		bool nextEOL = false;
+		if (IsALineEnd(chNextNonBlank)) {
+			nextEOL = true;
+		}
 		unsigned int j=i+1;
 		while(IsABlank(chNextNonBlank) && j<endPos) {
 			j ++ ;
 			chNextNonBlank = styler.SafeGetCharAt(j);
+			if (IsALineEnd(chNextNonBlank)) {
+				nextEOL = true;
+			}
+		}
+		if (!nextEOL && j == endPos) {
+			nextEOL = true;
 		}
 		int stylePrev = style;
 		style = styleNext;
 		styleNext = styler.StyleAt(i + 1);
 		bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
 		//
-		if (((isFixFormat && stylePrev == SCE_F_CONTINUATION) || stylePrev == SCE_F_DEFAULT || stylePrev == SCE_F_OPERATOR) && (style == SCE_F_WORD || style == SCE_F_LABEL)) {
+		if (((isFixFormat && stylePrev == SCE_F_CONTINUATION) || stylePrev == SCE_F_DEFAULT
+			|| stylePrev == SCE_F_OPERATOR) && (style == SCE_F_WORD || style == SCE_F_LABEL)) {
 			// Store last word and label start point.
 			lastStart = i;
 		}
@@ -339,7 +362,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
 				}
 				s[k] = '\0';
 				// Handle the forall and where statement and structure.
-				if (strcmp(s, "forall") == 0 || strcmp(s, "where") == 0) {
+				if (strcmp(s, "forall") == 0 || (strcmp(s, "where") == 0 && strcmp(prevWord, "else") != 0)) {
 					if (strcmp(prevWord, "end") != 0) {
 						j = i + 1;
 						char chBrace = '(', chSeek = ')', ch1 = styler.SafeGetCharAt(j);
@@ -362,22 +385,25 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
 								if (depth == 0) break;
 							}
 						}
+						int tmpLineCurrent = lineCurrent;
 						while (j<endPos) {
 							j++;
 							chAtPos = styler.SafeGetCharAt(j);
 							styAtPos = styler.StyleAt(j);
-							if (styAtPos == SCE_F_COMMENT || IsABlank(chAtPos)) continue;
+							if (!IsALineEnd(chAtPos) && (styAtPos == SCE_F_COMMENT || IsABlank(chAtPos))) continue;
 							if (isFixFormat) {
 								if (!IsALineEnd(chAtPos)) {
 									break;
 								} else {
-									if (lineCurrent < styler.GetLine(styler.Length()-1)) {
-										j = styler.LineStart(lineCurrent+1);
-										if (styler.StyleAt(j+5) == SCE_F_CONTINUATION) {
+									if (tmpLineCurrent < styler.GetLine(styler.Length()-1)) {
+										tmpLineCurrent++;
+										j = styler.LineStart(tmpLineCurrent);
+										if (styler.StyleAt(j+5) == SCE_F_CONTINUATION
+											&& !IsABlank(styler.SafeGetCharAt(j+5)) && styler.SafeGetCharAt(j+5) != '0') {
 											j += 5;
 											continue;
 										} else {
-											levelCurrent++;
+											levelDeltaNext++;
 											break;
 										}
 									}
@@ -387,7 +413,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
 									j = GetContinuedPos(j+1, styler);
 									continue;
 								} else if (IsALineEnd(chAtPos)) {
-									levelCurrent ++;
+									levelDeltaNext++;
 									break;
 								} else {
 									break;
@@ -396,61 +422,64 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
 						}
 					}
 				} else {
-					levelCurrent += classifyFoldPointFortran(s, prevWord, chNextNonBlank);
-					// Store the do Labels into array
-					if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) {
-						unsigned int k = 0;
-						for (i=j; (i<j+5 && i<endPos); i++) {
-							ch = styler.SafeGetCharAt(i);
-							if (IsADigit(ch))
-								Label[k++] = ch;
-							else
-								break;
+					int wordLevelDelta = classifyFoldPointFortran(s, prevWord, chNextNonBlank);
+					levelDeltaNext += wordLevelDelta;
+					if (((strcmp(s, "else") == 0) && (nextEOL || chNextNonBlank == '!')) ||
+						(strcmp(prevWord, "else") == 0 && strcmp(s, "where") == 0) || strcmp(s, "elsewhere") == 0) {
+						if (!isPrevLine) {
+							levelCurrent--;
+						}
+						levelDeltaNext++;
+					} else if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) {
+						if (!isPrevLine) {
+							levelCurrent--;
+						}
+					} else if ((strcmp(prevWord, "select") == 0 && strcmp(s, "case") == 0) || strcmp(s, "selectcase") == 0 ||
+							   (strcmp(prevWord, "select") == 0 && strcmp(s, "type") == 0) || strcmp(s, "selecttype") == 0) {
+						levelDeltaNext += 2;
+					} else if ((strcmp(s, "case") == 0 && chNextNonBlank == '(') || (strcmp(prevWord, "case") == 0 && strcmp(s, "default") == 0) ||
+							   (strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0) ||
+							   (strcmp(prevWord, "class") == 0 && strcmp(s, "is") == 0) ||
+							   (strcmp(prevWord, "class") == 0 && strcmp(s, "default") == 0) ) {
+						if (!isPrevLine) {
+							levelCurrent--;
 						}
-						Label[k] = '\0';
-						posLabel ++;
-						doLabels[posLabel] = atoi(Label);
+						levelDeltaNext++;
+					} else if ((strcmp(prevWord, "end") == 0 && strcmp(s, "select") == 0) || strcmp(s, "endselect") == 0) {
+						levelDeltaNext -= 2;
+					}
+
+					// There are multiple forms of "do" loop. The older form with a label "do 100 i=1,10" would require matching
+					// labels to ensure the folding level does not decrease too far when labels are used for other purposes.
+					// Since this is difficult, do-label constructs are not folded.
+					if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) {
+						// Remove delta for do-label
+						levelDeltaNext -= wordLevelDelta;
 					}
 				}
 				strcpy(prevWord, s);
 			}
-		} else if (style == SCE_F_LABEL) {
-			if(IsADigit(ch) && !IsADigit(chNext)) {
-				for(j = 0; ( j < 5 ) && ( j < i-lastStart+1 ); j++) {
-					ch = styler.SafeGetCharAt(lastStart + j);
-					if (IsADigit(ch) && styler.StyleAt(lastStart+j) == SCE_F_LABEL)
-						Label[j] = ch;
-					else
-						break;
-				}
-				Label[j] = '\0';
-				while (doLabels[posLabel] == atoi(Label) && posLabel > -1) {
-					levelCurrent--;
-					posLabel--;
-				}
-			}
 		}
 		if (atEOL) {
-			int lev = levelPrev;
+			int lev = levelCurrent;
 			if (visibleChars == 0 && foldCompact)
 				lev |= SC_FOLDLEVELWHITEFLAG;
-			if ((levelCurrent > levelPrev) && (visibleChars > 0))
+			if ((levelDeltaNext > 0) && (visibleChars > 0))
 				lev |= SC_FOLDLEVELHEADERFLAG;
-			if (lev != styler.LevelAt(lineCurrent)) {
+			if (lev != styler.LevelAt(lineCurrent))
 				styler.SetLevel(lineCurrent, lev);
-			}
+
 			lineCurrent++;
-			levelPrev = levelCurrent;
+			levelCurrent += levelDeltaNext;
+			levelDeltaNext = 0;
 			visibleChars = 0;
 			strcpy(prevWord, "");
+			isPrevLine = false;
 		}
 		/***************************************/
 		if (!isspacechar(ch)) visibleChars++;
 	}
 	/***************************************/
-	// Fill in the real level of the next line, keeping the current flags as they will be filled in later
-	int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
-	styler.SetLevel(lineCurrent, levelPrev | flagsNext);
 }
 /***************************************/
 static const char * const FortranWordLists[] = {
@@ -461,22 +490,22 @@ static const char * const FortranWordLists[] = {
 };
 /***************************************/
 static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
-                            Accessor &styler) {
+        Accessor &styler) {
 	ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false);
 }
 /***************************************/
 static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
-                            Accessor &styler) {
+        Accessor &styler) {
 	ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true);
 }
 /***************************************/
 static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle,
-		WordList *[], Accessor &styler) {
+        WordList *[], Accessor &styler) {
 	FoldFortranDoc(startPos, length, initStyle,styler, false);
 }
 /***************************************/
 static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle,
-		WordList *[], Accessor &styler) {
+        WordList *[], Accessor &styler) {
 	FoldFortranDoc(startPos, length, initStyle,styler, true);
 }
 /***************************************/


Modified: scintilla/lexers/LexHTML.cxx
29 files changed, 15 insertions(+), 14 deletions(-)
===================================================================
@@ -16,6 +16,7 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
+#include "StringCopy.h"
 #include "WordList.h"
 #include "LexAccessor.h"
 #include "Accessor.h"
@@ -339,9 +340,9 @@ static void classifyWordHTJS(unsigned int start, unsigned int end,
 static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
 	char chAttr = SCE_HB_IDENTIFIER;
 	bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
-	if (wordIsNumber)
+	if (wordIsNumber) {
 		chAttr = SCE_HB_NUMBER;
-	else {
+	} else {
 		char s[100];
 		GetTextSegment(styler, start, end, s, sizeof(s));
 		if (keywords.InList(s)) {
@@ -385,9 +386,9 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key
 static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
 	char chAttr = SCE_HPHP_DEFAULT;
 	bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1]));
-	if (wordIsNumber)
+	if (wordIsNumber) {
 		chAttr = SCE_HPHP_NUMBER;
-	else {
+	} else {
 		char s[100];
 		GetTextSegment(styler, start, end, s, sizeof(s));
 		if (keywords.InList(s))
@@ -823,14 +824,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 		if (isMako && ch == '#' && chNext == '#') {
 			makoComment = 1;
 		}
-		
+
 		// handle end of Mako comment line
 		else if (isMako && makoComment && (ch == '\r' || ch == '\n')) {
 			makoComment = 0;
 			styler.ColourTo(i, SCE_HP_COMMENTLINE);
 			state = SCE_HP_DEFAULT;
 		}
-		
+
 		// Allow falling through to mako handling code if newline is going to end a block
 		if (((ch == '\r' && chNext != '\n') || (ch == '\n')) &&
 			(!isMako || (0 != strcmp(makoBlockType, "%")))) {
@@ -929,9 +930,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 															 (ch == '$' && chNext == '{') ||
 															 (ch == '<' && chNext == '/' && chNext2 == '%'))) {
 			if (ch == '%' || ch == '/')
-				strcpy(makoBlockType, "%");
+				StringCopy(makoBlockType, "%");
 			else if (ch == '$')
-				strcpy(makoBlockType, "{");
+				StringCopy(makoBlockType, "{");
 			else if (chNext == '/')
 				GetNextWord(styler, i+3, makoBlockType, sizeof(makoBlockType));
 			else
@@ -1000,9 +1001,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 		// handle the start Django template code
 		else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' ||  chNext == '{'))) {
 			if (chNext == '%')
-				strcpy(djangoBlockType, "%");
+				StringCopy(djangoBlockType, "%");
 			else
-				strcpy(djangoBlockType, "{");
+				StringCopy(djangoBlockType, "{");
 			styler.ColourTo(i - 1, StateToPrint);
 			beforePreProc = state;
 			if (inScriptType == eNonHtmlScript)
@@ -1917,7 +1918,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 					state = SCE_HPHP_COMMENTLINE;
 				} else if (ch == '\"') {
 					state = SCE_HPHP_HSTRING;
-					strcpy(phpStringDelimiter, "\"");
+					StringCopy(phpStringDelimiter, "\"");
 				} else if (styler.Match(i, "<<<")) {
 					bool isSimpleString = false;
 					i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString);
@@ -1927,7 +1928,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 					}
 				} else if (ch == '\'') {
 					state = SCE_HPHP_SIMPLESTRING;
-					strcpy(phpStringDelimiter, "\'");
+					StringCopy(phpStringDelimiter, "\'");
 				} else if (ch == '$' && IsPhpWordStart(chNext)) {
 					state = SCE_HPHP_VARIABLE;
 				} else if (IsOperator(ch)) {
@@ -2047,7 +2048,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 				state = SCE_HPHP_COMMENTLINE;
 			} else if (ch == '\"') {
 				state = SCE_HPHP_HSTRING;
-				strcpy(phpStringDelimiter, "\"");
+				StringCopy(phpStringDelimiter, "\"");
 			} else if (styler.Match(i, "<<<")) {
 				bool isSimpleString = false;
 				i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString);
@@ -2057,7 +2058,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
 				}
 			} else if (ch == '\'') {
 				state = SCE_HPHP_SIMPLESTRING;
-				strcpy(phpStringDelimiter, "\'");
+				StringCopy(phpStringDelimiter, "\'");
 			} else if (ch == '$' && IsPhpWordStart(chNext)) {
 				state = SCE_HPHP_VARIABLE;
 			} else if (IsOperator(ch)) {


Modified: scintilla/lexers/LexMarkdown.cxx
8 files changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -118,10 +118,11 @@ static bool AtTermStart(StyleContext &sc) {
 }
 
 static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
-    int c, count = 1;
+    int count = 1;
     unsigned int i = 0;
-    while (++i) {
-        c = sc.GetRelative(i);
+    for (;;) {
+        ++i;
+        int c = sc.GetRelative(i);
         if (c == sc.ch)
             ++count;
         // hit a terminating character
@@ -140,7 +141,6 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
             }
         }
     }
-    return false;
 }
 
 static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle,


Modified: scintilla/lexers/LexMatlab.cxx
13 files changed, 9 insertions(+), 4 deletions(-)
===================================================================
@@ -57,7 +57,8 @@ static bool IsOctaveComment(Accessor &styler, int pos, int len) {
 static void ColouriseMatlabOctaveDoc(
             unsigned int startPos, int length, int initStyle,
             WordList *keywordlists[], Accessor &styler,
-            bool (*IsCommentChar)(int)) {
+            bool (*IsCommentChar)(int),
+            bool ismatlab) {
 
 	WordList &keywords = *keywordlists[0];
 
@@ -199,7 +200,11 @@ static void ColouriseMatlabOctaveDoc(
 				styler.SetLineState(curLine, commentDepth);
 				sc.SetState(SCE_MATLAB_COMMENT);
 			} else if (sc.ch == '!' && sc.chNext != '=' ) {
-				sc.SetState(SCE_MATLAB_COMMAND);
+				if(ismatlab) {
+					sc.SetState(SCE_MATLAB_COMMAND);
+				} else {
+					sc.SetState(SCE_MATLAB_OPERATOR);
+				}
 			} else if (sc.ch == '\'') {
 				if (transpose) {
 					sc.SetState(SCE_MATLAB_OPERATOR);
@@ -229,12 +234,12 @@ static void ColouriseMatlabOctaveDoc(
 
 static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
                                WordList *keywordlists[], Accessor &styler) {
-	ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar);
+	ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar, true);
 }
 
 static void ColouriseOctaveDoc(unsigned int startPos, int length, int initStyle,
                                WordList *keywordlists[], Accessor &styler) {
-	ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar);
+	ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar, false);
 }
 
 static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,


Modified: scintilla/lexers/LexOthers.cxx
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -1037,8 +1037,9 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
 						!CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||
 						!CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
 						state = stMsVc;
-					} else
+					} else {
 						state = stUnrecognized;
+					}
 				} else {
 					state = stUnrecognized;
 				}


Modified: scintilla/lexers/LexPerl.cxx
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1185,7 +1185,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
 				}
 				switch (HereDoc.Quote) {
 				case '\'':
-					st_new = SCE_PL_HERE_Q ;
+					st_new = SCE_PL_HERE_Q;
 					break;
 				case '"' :
 					st_new = SCE_PL_HERE_QQ;


Modified: scintilla/lexers/LexSQL.cxx
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -643,7 +643,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
 			break;
 		}
 	}
-	
+
 	int levelNext = levelCurrent;
 	char chNext = styler[startPos];
 	int styleNext = styler.StyleAt(startPos);


Modified: scintilla/lexers/LexTxt2tags.cxx
8 files changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -78,10 +78,11 @@ static bool HasPrevLineContent(StyleContext &sc) {
 
 // Separator line
 static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
-    int c, count = 1;
+    int count = 1;
     unsigned int i = 0;
-    while (++i) {
-        c = sc.GetRelative(i);
+    for (;;) {
+        ++i;
+        int c = sc.GetRelative(i);
         if (c == sc.ch)
             ++count;
         // hit a terminating character
@@ -100,7 +101,6 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
             }
         }
     }
-    return false;
 }
 
 static void ColorizeTxt2tagsDoc(unsigned int startPos, int length, int initStyle,


Modified: scintilla/lexers/LexVHDL.cxx
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -51,7 +51,7 @@ static inline bool IsAWordStart(const int ch) {
 }
 
 /***************************************/
-inline bool IsABlank(unsigned int ch) {
+static inline bool IsABlank(unsigned int ch) {
     return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
 }
 


Modified: scintilla/lexlib/Accessor.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -12,7 +12,7 @@
 namespace Scintilla {
 #endif
 
-enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
+enum { wsSpace=1, wsTab=2, wsSpaceTab=4, wsInconsistent=8 };
 
 class Accessor;
 class WordList;


Modified: scintilla/lexlib/CharacterCategory.cxx
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -9,6 +9,7 @@
 
 #include <algorithm>
 
+#include "StringCopy.h"
 #include "CharacterCategory.h"
 
 #ifdef SCI_NAMESPACE
@@ -3275,7 +3276,7 @@ const int catRanges[] = {
 
 const int maxUnicode = 0x10ffff;
 const int maskCategory = 0x1F;
-const int nRanges = sizeof(catRanges) / sizeof(catRanges[0]);
+const int nRanges = ELEMENTS(catRanges);
 
 }
 


Modified: scintilla/lexlib/LexAccessor.h
7 files changed, 3 insertions(+), 4 deletions(-)
===================================================================
@@ -53,13 +53,13 @@ class LexAccessor {
 	}
 
 public:
-	LexAccessor(IDocument *pAccess_) :
+	explicit LexAccessor(IDocument *pAccess_) :
 		pAccess(pAccess_), startPos(extremePosition), endPos(0),
-		codePage(pAccess->CodePage()), 
+		codePage(pAccess->CodePage()),
 		encodingType(enc8bit),
 		lenDoc(pAccess->Length()),
 		mask(127), validLen(0), chFlags(0), chWhile(0),
-		startSeg(0), startPosStyling(0), 
+		startSeg(0), startPosStyling(0),
 		documentVersion(pAccess->Version()) {
 		switch (codePage) {
 		case 65001:
@@ -139,7 +139,6 @@ class LexAccessor {
 		return lenDoc;
 	}
 	void Flush() {
-		startPos = extremePosition;
 		if (validLen > 0) {
 			pAccess->SetStyles(validLen, styleBuf);
 			startPosStyling += validLen;


Modified: scintilla/lexlib/LexerModule.cxx
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -79,7 +79,7 @@ const char *LexerModule::GetWordListDescription(int index) const {
 		return "";
 	} else {
 		return wordListDescriptions[index];
- 	}
+	}
 }
 
 int LexerModule::GetStyleBitsNeeded() const {


Modified: scintilla/lexlib/LexerSimple.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -17,7 +17,7 @@ class LexerSimple : public LexerBase {
 	const LexerModule *module;
 	std::string wordLists;
 public:
-	LexerSimple(const LexerModule *module_);
+	explicit LexerSimple(const LexerModule *module_);
 	const char * SCI_METHOD DescribeWordListSets();
 	void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
 	void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);


Modified: scintilla/lexlib/PropSetSimple.cxx
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -61,7 +61,7 @@ void PropSetSimple::Set(const char *keyVal) {
 		endVal++;
 	const char *eqAt = strchr(keyVal, '=');
 	if (eqAt) {
-		Set(keyVal, eqAt + 1, static_cast<int>(eqAt-keyVal), 
+		Set(keyVal, eqAt + 1, static_cast<int>(eqAt-keyVal),
 			static_cast<int>(endVal - eqAt - 1));
 	} else if (*keyVal) {	// No '=' so assume '=1'
 		Set(keyVal, "1", static_cast<int>(endVal-keyVal), 1);
@@ -146,7 +146,7 @@ int PropSetSimple::GetExpanded(const char *key, char *result) const {
 	ExpandAllInPlace(*this, val, 100, VarChain(key));
 	const int n = static_cast<int>(val.size());
 	if (result) {
-		strcpy(result, val.c_str());
+		memcpy(result, val.c_str(), n+1);
 	}
 	return n;	// Not including NUL
 }


Modified: scintilla/lexlib/SparseState.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -38,7 +38,7 @@ class SparseState {
 	}
 
 public:
-	SparseState(int positionFirst_=-1) {
+	explicit SparseState(int positionFirst_=-1) {
 		positionFirst = positionFirst_;
 	}
 	void Set(int position, T value) {


Modified: scintilla/lexlib/StringCopy.h
36 files changed, 36 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,36 @@
+// Scintilla source code edit control
+/** @file StringCopy.h
+ ** Safe string copy function which always NUL terminates.
+ ** ELEMENTS macro for determining array sizes.
+ **/
+// Copyright 2013 by Neil Hodgson <neilh at scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef STRINGCOPY_H
+#define STRINGCOPY_H
+
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
+// Safer version of string copy functions like strcpy, wcsncpy, etc.
+// Instantiate over fixed length strings of both char and wchar_t.
+// May truncate if source doesn't fit into dest with room for NUL.
+
+template <typename T, size_t count>
+void StringCopy(T (&dest)[count], const T* source) {
+	for (size_t i=0; i<count; i++) {
+		dest[i] = source[i];
+		if (!source[i])
+			break;
+	}
+	dest[count-1] = 0;
+}
+
+#define ELEMENTS(a) (sizeof(a) / sizeof(a[0]))
+
+#ifdef SCI_NAMESPACE
+}
+#endif
+
+#endif


Modified: scintilla/lexlib/StyleContext.h
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -28,7 +28,7 @@ class StyleContext {
 	IDocumentWithLineEnd *multiByteAccess;
 	unsigned int endPos;
 	unsigned int lengthDocument;
-	
+
 	// Used for optimizing GetRelativeCharacter
 	unsigned int posRelative;
 	unsigned int currentPosLastRelative;
@@ -43,7 +43,7 @@ class StyleContext {
 			chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+width, 0));
 			widthNext = 1;
 		}
-		// End of line determined from line end position, allowing CR, LF, 
+		// End of line determined from line end position, allowing CR, LF,
 		// CRLF and Unicode line ends as set by document.
 		if (currentLine < lineDocEnd)
 			atLineEnd = static_cast<int>(currentPos) >= (lineStartNext-1);


Modified: scintilla/lexlib/SubStyles.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -20,7 +20,7 @@ class WordClassifier {
 
 public:
 
-	WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) {
+	explicit WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) {
 	}
 
 	void Allocate(int firstStyle_, int lenStyles_) {


Modified: scintilla/lexlib/WordList.cxx
10 files changed, 6 insertions(+), 4 deletions(-)
===================================================================
@@ -13,6 +13,7 @@
 
 #include <algorithm>
 
+#include "StringCopy.h"
 #include "WordList.h"
 
 #ifdef SCI_NAMESPACE
@@ -70,7 +71,7 @@ WordList::WordList(bool onlyLineEnds_) :
 	words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {
 }
 
-WordList::~WordList() { 
+WordList::~WordList() {
 	Clear();
 }
 
@@ -122,15 +123,16 @@ static void SortWordList(char **words, unsigned int len) {
 
 void WordList::Set(const char *s) {
 	Clear();
-	list = new char[strlen(s) + 1];
-	strcpy(list, s);
+	const size_t lenS = strlen(s) + 1;
+	list = new char[lenS];
+	memcpy(list, s, lenS);
 	words = ArrayFromWordList(list, &len, onlyLineEnds);
 #ifdef _MSC_VER
 	std::sort(words, words + len, cmpWords);
 #else
 	SortWordList(words, len);
 #endif
-	for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
+	for (unsigned int k = 0; k < ELEMENTS(starts); k++)
 		starts[k] = -1;
 	for (int l = len - 1; l >= 0; l--) {
 		unsigned char indexChar = words[l][0];


Modified: scintilla/lexlib/WordList.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -22,7 +22,7 @@ class WordList {
 	bool onlyLineEnds;	///< Delimited by any white space or only line ends
 	int starts[256];
 public:
-	WordList(bool onlyLineEnds_ = false);
+	explicit WordList(bool onlyLineEnds_ = false);
 	~WordList();
 	operator bool() const;
 	bool operator!=(const WordList &other) const;


Modified: scintilla/scintilla_changes.patch
8 files changed, 5 insertions(+), 3 deletions(-)
===================================================================
@@ -28,10 +28,10 @@ diff -Naur scintilla_orig/gtk/scintilla-marshal.c scintilla/gtk/scintilla-marsha
  {
    typedef void (*GMarshalFunc_VOID__INT_POINTER) (gpointer     data1,
 diff --git b/scintilla/src/Catalogue.cxx a/scintilla/src/Catalogue.cxx
-index e728f34..85116a5 100644
-+++ scintilla/src/Catalogue.cxx
+index 41d5d54..70ce3bc 100644
 --- scintilla/src/Catalogue.cxx
-@@ -76,112 +76,48 @@ int Scintilla_LinkLexers() {
++++ scintilla/src/Catalogue.cxx
+@@ -76,114 +76,48 @@ int Scintilla_LinkLexers() {
  
  //++Autogenerated -- run scripts/LexGen.py to regenerate
  //**\(\tLINK_LEXER(\*);\n\)
@@ -39,6 +39,7 @@ index e728f34..85116a5 100644
  	LINK_LEXER(lmAbaqus);
  	LINK_LEXER(lmAda);
 -	LINK_LEXER(lmAPDL);
+-	LINK_LEXER(lmAs);
  	LINK_LEXER(lmAsm);
 -	LINK_LEXER(lmAsn1);
 -	LINK_LEXER(lmASY);
@@ -63,6 +64,7 @@ index e728f34..85116a5 100644
  	LINK_LEXER(lmCss);
  	LINK_LEXER(lmD);
  	LINK_LEXER(lmDiff);
+-	LINK_LEXER(lmDMAP);
 -	LINK_LEXER(lmECL);
 -	LINK_LEXER(lmEiffel);
 -	LINK_LEXER(lmEiffelkw);


Modified: scintilla/src/AutoComplete.cxx
14 files changed, 5 insertions(+), 9 deletions(-)
===================================================================
@@ -16,9 +16,9 @@
 
 #include "Platform.h"
 
+#include "Scintilla.h"
 #include "CharacterSet.h"
 #include "AutoComplete.h"
-#include "Scintilla.h"
 
 #ifdef SCI_NAMESPACE
 using namespace Scintilla;
@@ -41,8 +41,6 @@ AutoComplete::AutoComplete() :
 	heightLBDefault(100),
 	autoSort(SC_ORDER_PRESORTED) {
 	lb = ListBox::Allocate();
-	stopChars[0] = '\0';
-	fillUpChars[0] = '\0';
 }
 
 AutoComplete::~AutoComplete() {
@@ -71,21 +69,19 @@ void AutoComplete::Start(Window &parent, int ctrlID,
 }
 
 void AutoComplete::SetStopChars(const char *stopChars_) {
-	strncpy(stopChars, stopChars_, sizeof(stopChars));
-	stopChars[sizeof(stopChars) - 1] = '\0';
+	stopChars = stopChars_;
 }
 
 bool AutoComplete::IsStopChar(char ch) {
-	return ch && strchr(stopChars, ch);
+	return ch && (stopChars.find(ch) != std::string::npos);
 }
 
 void AutoComplete::SetFillUpChars(const char *fillUpChars_) {
-	strncpy(fillUpChars, fillUpChars_, sizeof(fillUpChars));
-	fillUpChars[sizeof(fillUpChars) - 1] = '\0';
+	fillUpChars = fillUpChars_;
 }
 
 bool AutoComplete::IsFillUpChar(char ch) {
-	return ch && strchr(fillUpChars, ch);
+	return ch && (fillUpChars.find(ch) != std::string::npos);
 }
 
 void AutoComplete::SetSeparator(char separator_) {


Modified: scintilla/src/AutoComplete.h
6 files changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -16,8 +16,8 @@ namespace Scintilla {
  */
 class AutoComplete {
 	bool active;
-	char stopChars[256];
-	char fillUpChars[256];
+	std::string stopChars;
+	std::string fillUpChars;
 	char separator;
 	char typesep; // Type seperator
 	enum { maxItemLen=1000 };
@@ -71,7 +71,7 @@ class AutoComplete {
 
 	/// The list string contains a sequence of words separated by the separator character
 	void SetList(const char *list);
-	
+
 	/// Return the position of the currently selected list item
 	int GetSelection() const;
 


Modified: scintilla/src/CallTip.cxx
8 files changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -14,6 +14,8 @@
 #include "Platform.h"
 
 #include "Scintilla.h"
+
+#include "StringCopy.h"
 #include "CallTip.h"
 
 #ifdef SCI_NAMESPACE
@@ -125,16 +127,14 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
     						Point(centreX + halfWidth, centreY + halfWidth / 2),
     						Point(centreX, centreY - halfWidth + halfWidth / 2),
 						};
-						surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
-                 						colourBG, colourBG);
+						surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
 					} else {            // Down arrow
 						Point pts[] = {
     						Point(centreX - halfWidth, centreY - halfWidth / 2),
     						Point(centreX + halfWidth, centreY - halfWidth / 2),
     						Point(centreX, centreY + halfWidth - halfWidth / 2),
 						};
-						surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
-                 						colourBG, colourBG);
+						surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
 					}
 				}
 				xEnd = rcClient.right;


Modified: scintilla/src/CaseConvert.cxx
12 files changed, 8 insertions(+), 4 deletions(-)
===================================================================
@@ -13,6 +13,7 @@
 #include <vector>
 #include <algorithm>
 
+#include "StringCopy.h"
 #include "CaseConvert.h"
 #include "UniConversion.h"
 #include "UnicodeFromUTF8.h"
@@ -367,6 +368,9 @@ class CaseConverter : public ICaseConverter {
 	enum { maxConversionLength=6 };
 	struct ConversionString {
 		char conversion[maxConversionLength+1];
+		ConversionString() {
+			conversion[0] = '\0';
+		}
 	};
 	// Conversions are initially store in a vector of structs but then decomposed into
 	// parallel arrays as that is about 10% faster to search.
@@ -374,7 +378,7 @@ class CaseConverter : public ICaseConverter {
 		int character;
 		ConversionString conversion;
 		CharacterConversion(int character_=0, const char *conversion_="") : character(character_) {
-			strcpy(conversion.conversion, conversion_);
+			StringCopy(conversion.conversion, conversion_);
 		}
 		bool operator<(const CharacterConversion &other) const {
 			return character < other.character;
@@ -505,17 +509,17 @@ void AddSymmetric(enum CaseConversion conversion, int lower,int upper) {
 
 void SetupConversions(enum CaseConversion conversion) {
 	// First initialize for the symmetric ranges
-	for (size_t i=0; i<sizeof(symmetricCaseConversionRanges)/sizeof(symmetricCaseConversionRanges[0]);) {
+	for (size_t i=0; i<ELEMENTS(symmetricCaseConversionRanges);) {
 		int lower = symmetricCaseConversionRanges[i++];
 		int upper = symmetricCaseConversionRanges[i++];
 		int length = symmetricCaseConversionRanges[i++];
 		int pitch = symmetricCaseConversionRanges[i++];
-		for (int j=0;j<length*pitch;j+=pitch) {
+		for (int j=0; j<length*pitch; j+=pitch) {
 			AddSymmetric(conversion, lower+j, upper+j);
 		}
 	}
 	// Add the symmetric singletons
-	for (size_t i=0; i<sizeof(symmetricCaseConversions)/sizeof(symmetricCaseConversions[0]);) {
+	for (size_t i=0; i<ELEMENTS(symmetricCaseConversions);) {
 		int lower = symmetricCaseConversions[i++];
 		int upper = symmetricCaseConversions[i++];
 		AddSymmetric(conversion, lower, upper);


Modified: scintilla/src/CellBuffer.cxx
4 files changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -190,6 +190,10 @@ const char *UndoHistory::AppendAction(actionType at, int position, const char *d
 			}
 			// See if current action can be coalesced into previous action
 			// Will work if both are inserts or deletes and position is same
+#if defined(_MSC_VER) && defined(_PREFAST_)
+			// Visual Studio 2013 Code Analysis wrongly believes actions can be NULL at its next reference
+			__analysis_assume(actions);
+#endif
 			if (currentAction == savePoint) {
 				currentAction++;
 			} else if (!actions[currentAction].mayCoalesce) {


Modified: scintilla/src/CellBuffer.h
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -17,8 +17,8 @@ class PerLine {
 public:
 	virtual ~PerLine() {}
 	virtual void Init()=0;
-	virtual void InsertLine(int)=0;
-	virtual void RemoveLine(int)=0;
+	virtual void InsertLine(int line)=0;
+	virtual void RemoveLine(int line)=0;
 };
 
 /**


Modified: scintilla/src/Decoration.h
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -17,7 +17,7 @@ class Decoration {
 	RunStyles rs;
 	int indicator;
 
-	Decoration(int indicator_);
+	explicit Decoration(int indicator_);
 	~Decoration();
 
 	bool Empty() const;


Modified: scintilla/src/Document.cxx
8 files changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -955,7 +955,7 @@ bool Document::InsertString(int position, const char *s, int insertLength) {
 int SCI_METHOD Document::AddData(char *data, int length) {
 	try {
 		int position = Length();
-		InsertString(position,data, length);
+		InsertString(position, data, length);
 	} catch (std::bad_alloc &) {
 		return SC_STATUS_BADALLOC;
 	} catch (...) {
@@ -1892,7 +1892,7 @@ void SCI_METHOD Document::DecorationFillRange(int position, int value, int fillL
 
 bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
 	WatcherWithUserData wwud(watcher, userData);
-	std::vector<WatcherWithUserData>::iterator it = 
+	std::vector<WatcherWithUserData>::iterator it =
 		std::find(watchers.begin(), watchers.end(), wwud);
 	if (it != watchers.end())
 		return false;
@@ -1901,7 +1901,7 @@ bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
 }
 
 bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) {
-	std::vector<WatcherWithUserData>::iterator it = 
+	std::vector<WatcherWithUserData>::iterator it =
 		std::find(watchers.begin(), watchers.end(), WatcherWithUserData(watcher, userData));
 	if (it != watchers.end()) {
 		watchers.erase(it);
@@ -2103,7 +2103,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
  */
 class BuiltinRegex : public RegexSearchBase {
 public:
-	BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {}
+	explicit BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {}
 
 	virtual ~BuiltinRegex() {
 	}


Modified: scintilla/src/Document.h
14 files changed, 7 insertions(+), 7 deletions(-)
===================================================================
@@ -32,7 +32,7 @@ class Range {
 	Position start;
 	Position end;
 
-	Range(Position pos=0) :
+	explicit Range(Position pos=0) :
 		start(pos), end(pos) {
 	}
 	Range(Position start_, Position end_) :
@@ -165,7 +165,7 @@ class LexInterface {
 	ILexer *instance;
 	bool performingStyle;	///< Prevent reentrance
 public:
-	LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) {
+	explicit LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) {
 	}
 	virtual ~LexInterface() {
 	}
@@ -443,12 +443,12 @@ class UndoGroup {
  */
 class DocModification {
 public:
-  	int modificationType;
+	int modificationType;
 	int position;
- 	int length;
- 	int linesAdded;	/**< Negative if lines deleted. */
- 	const char *text;	/**< Only valid for changes to text, not for changes to style. */
- 	int line;
+	int length;
+	int linesAdded;	/**< Negative if lines deleted. */
+	const char *text;	/**< Only valid for changes to text, not for changes to style. */
+	int line;
 	int foldLevelNow;
 	int foldLevelPrev;
 	int annotationLinesAdded;


Modified: scintilla/src/Editor.cxx
400 files changed, 210 insertions(+), 190 deletions(-)
===================================================================
@@ -23,6 +23,7 @@
 #include "ILexer.h"
 #include "Scintilla.h"
 
+#include "StringCopy.h"
 #include "SplitVector.h"
 #include "Partitioning.h"
 #include "RunStyles.h"
@@ -87,6 +88,10 @@ Timer::Timer() :
 Idler::Idler() :
 		state(false), idlerID(0) {}
 
+static int RoundXYPosition(XYPOSITION xyPos) {
+	return int(xyPos+0.5);
+}
+
 static inline bool IsControlCharacter(int ch) {
 	// iscntrl returns true for lots of chars > 127 which are displayable
 	return ch >= 0 && ch < ' ';
@@ -250,7 +255,7 @@ void Editor::SetRepresentations() {
 		"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
 		"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US"
 	};
-	for (size_t j=0; j < (sizeof(reps) / sizeof(reps[0])); j++) {
+	for (size_t j=0; j < ELEMENTS(reps); j++) {
 		char c[2] = { static_cast<char>(j), 0 };
 		reprs.SetRepresentation(c, reps[j]);
 	}
@@ -264,10 +269,12 @@ void Editor::SetRepresentations() {
 			"DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA",
 			"SOS", "SGCI", "SCI", "CSI", "ST", "OSC", "PM", "APC"
 		};
-		for (size_t j=0; j < (sizeof(repsC1) / sizeof(repsC1[0])); j++) {
+		for (size_t j=0; j < ELEMENTS(repsC1); j++) {
 			char c1[3] = { '\xc2',  static_cast<char>(0x80+j), 0 };
 			reprs.SetRepresentation(c1, repsC1[j]);
 		}
+		reprs.SetRepresentation("\xe2\x80\xa8", "LS");
+		reprs.SetRepresentation("\xe2\x80\xa9", "PS");
 	}
 
 	// UTF-8 invalid bytes
@@ -381,6 +388,10 @@ PRectangle Editor::GetClientRectangle() {
 	return wMain.GetClientPosition();
 }
 
+PRectangle Editor::GetClientDrawingRectangle() {
+	return GetClientRectangle();
+}
+
 PRectangle Editor::GetTextRectangle() {
 	PRectangle rc = GetClientRectangle();
 	rc.left += vs.textStart;
@@ -426,7 +437,7 @@ const char *ControlCharacterString(unsigned char ch) {
 		"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
 		"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US"
 	};
-	if (ch < (sizeof(reps) / sizeof(reps[0]))) {
+	if (ch < ELEMENTS(reps)) {
 		return reps[ch];
 	} else {
 		return "BAD";
@@ -476,36 +487,17 @@ Point Editor::LocationFromPosition(SelectionPosition pos) {
 	RefreshStyleData();
 	if (pos.Position() == INVALID_POSITION)
 		return pt;
-	int line = pdoc->LineFromPosition(pos.Position());
-	int lineVisible = cs.DisplayFromDoc(line);
+	const int line = pdoc->LineFromPosition(pos.Position());
+	const int lineVisible = cs.DisplayFromDoc(line);
 	//Platform::DebugPrintf("line=%d\n", line);
 	AutoSurface surface(this);
 	AutoLineLayout ll(llc, RetrieveLineLayout(line));
 	if (surface && ll) {
-		// -1 because of adding in for visible lines in following loop.
-		pt.y = (lineVisible - topLine - 1) * vs.lineHeight;
-		pt.x = 0;
-		unsigned int posLineStart = pdoc->LineStart(line);
+		const int posLineStart = pdoc->LineStart(line);
 		LayoutLine(line, surface, vs, ll, wrapWidth);
-		int posInLine = pos.Position() - posLineStart;
-		// In case of very long line put x at arbitrary large position
-		if (posInLine > ll->maxLineLength) {
-			pt.x = ll->positions[ll->maxLineLength] - ll->positions[ll->LineStart(ll->lines)];
-		}
-
-		for (int subLine = 0; subLine < ll->lines; subLine++) {
-			if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine + 1))) {
-				pt.x = ll->positions[posInLine] - ll->positions[ll->LineStart(subLine)];
-				if (ll->wrapIndent != 0) {
-					int lineStart = ll->LineStart(subLine);
-					if (lineStart != 0)	// Wrapped
-						pt.x += ll->wrapIndent;
-				}
-			}
-			if (posInLine >= ll->LineStart(subLine)) {
-				pt.y += vs.lineHeight;
-			}
-		}
+		const int posInLine = pos.Position() - posLineStart;
+		pt = ll->PointFromPosition(posInLine, vs.lineHeight);
+		pt.y += (lineVisible - topLine) * vs.lineHeight;
 		pt.x += vs.textStart - xOffset;
 	}
 	pt.x += pos.VirtualSpace() * vs.styles[ll->EndLineStyle()].spaceWidth;
@@ -557,58 +549,44 @@ SelectionPosition Editor::SPositionFromLocation(Point pt, bool canReturnInvalid,
 	int visibleLine = floor(pt.y / vs.lineHeight);
 	if (!canReturnInvalid && (visibleLine < 0))
 		visibleLine = 0;
-	int lineDoc = cs.DocFromDisplay(visibleLine);
+	const int lineDoc = cs.DocFromDisplay(visibleLine);
 	if (canReturnInvalid && (lineDoc < 0))
 		return SelectionPosition(INVALID_POSITION);
 	if (lineDoc >= pdoc->LinesTotal())
 		return SelectionPosition(canReturnInvalid ? INVALID_POSITION : pdoc->Length());
-	unsigned int posLineStart = pdoc->LineStart(lineDoc@@ Diff output truncated at 100000 characters. @@

--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list