SF.net SVN: geany: [753] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Mon Aug 21 17:22:08 UTC 2006


Revision: 753
Author:   eht16
Date:     2006-08-21 10:21:50 -0700 (Mon, 21 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=753&view=rev

Log Message:
-----------
Updated Scintilla to version 1.71.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/scintilla/Converter.h
    trunk/scintilla/Editor.cxx
    trunk/scintilla/LexCPP.cxx
    trunk/scintilla/LexPerl.cxx
    trunk/scintilla/PlatGTK.cxx
    trunk/scintilla/PropSet.cxx
    trunk/scintilla/ScintillaGTK.cxx
    trunk/scintilla/StyleContext.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/ChangeLog	2006-08-21 17:21:50 UTC (rev 753)
@@ -3,6 +3,7 @@
  * src/images.c, src/notebook.c:
    Applied patch from Củ Văn Chuối to enlarge the tab close icon. This
    should fix some display issues.
+ * scintilla/*: Updated Scintilla to version 1.71.
 
 
 2006-08-20  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/scintilla/Converter.h
===================================================================
--- trunk/scintilla/Converter.h	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/scintilla/Converter.h	2006-08-21 17:21:50 UTC (rev 753)
@@ -23,6 +23,16 @@
  */
 class Converter {
 	ConverterHandle iconvh;
+	void OpenHandle(const char *fullDestination, const char *charSetSource) {
+#if GTK_MAJOR_VERSION >= 2
+		iconvh = g_iconv_open(fullDestination, charSetSource);
+#else
+		iconvh = iconv_open(fullDestination, charSetSource);
+#endif
+	}
+	bool Succeeded() const {
+		return iconvh != iconvhBad;
+	}
 public:
 	Converter() {
 		iconvh = iconvhBad;
@@ -35,25 +45,26 @@
 		Close();
 	}
 	operator bool() const {
-		return iconvh != iconvhBad;
+		return Succeeded();
 	}
 	void Open(const char *charSetDestination, const char *charSetSource, bool transliterations=true) {
 		Close();
 		if (*charSetSource) {
-			char fullDest[200];
-			strcpy(fullDest, charSetDestination);
+			// Try allowing approximate transliterations
 			if (transliterations) {
+				char fullDest[200];
+				strcpy(fullDest, charSetDestination);
 				strcat(fullDest, "//TRANSLIT");
+				OpenHandle(fullDest, charSetSource);
 			}
-#if GTK_MAJOR_VERSION >= 2
-			iconvh = g_iconv_open(fullDest, charSetSource);
-#else
-			iconvh = iconv_open(fullDest, charSetSource);
-#endif
+			if (!Succeeded()) {
+				// Transliterations failed so try basic name
+				OpenHandle(charSetDestination, charSetSource);
+			}
 		}
 	}
 	void Close() {
-		if (iconvh != iconvhBad) {
+		if (Succeeded()) {
 #if GTK_MAJOR_VERSION >= 2
 			g_iconv_close(iconvh);
 #else
@@ -63,7 +74,7 @@
 		}
 	}
 	size_t Convert(char** src, size_t *srcleft, char **dst, size_t *dstleft) const {
-		if (iconvh == iconvhBad) {
+		if (!Succeeded()) {
 			return (size_t)(-1);
 		} else {
 #if GTK_MAJOR_VERSION >= 2

Modified: trunk/scintilla/Editor.cxx
===================================================================
--- trunk/scintilla/Editor.cxx	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/scintilla/Editor.cxx	2006-08-21 17:21:50 UTC (rev 753)
@@ -3612,9 +3612,11 @@
 	NotifyParent(scn);
 }
 
-void Editor::NotifyDoubleClick(Point, bool) {
+void Editor::NotifyDoubleClick(Point pt, bool) {
 	SCNotification scn = {0};
 	scn.nmhdr.code = SCN_DOUBLECLICK;
+	scn.line = LineFromLocation(pt);
+	scn.position = PositionFromLocationClose(pt);
 	NotifyParent(scn);
 }
 

Modified: trunk/scintilla/LexCPP.cxx
===================================================================
--- trunk/scintilla/LexCPP.cxx	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/scintilla/LexCPP.cxx	2006-08-21 17:21:50 UTC (rev 753)
@@ -20,28 +20,45 @@
 #include "Scintilla.h"
 #include "SciLexer.h"
 
-#define KEYWORD_BOXHEADER 1
-#define KEYWORD_FOLDCONTRACTED 2
+#define SET_LOWER "abcdefghijklmnopqrstuvwxyz"
+#define SET_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define SET_DIGITS "0123456789"
 
-static bool IsOKBeforeRE(int ch) {
-	return (ch == '(') || (ch == '=') || (ch == ',');
-}
+class SetOfCharacters {
+	int size;
+	bool valueAfter;
+	bool *bset;
+public:
+	SetOfCharacters(const char *setOfCharacters, int size_=0x80, bool valueAfter_=false) {
+		size = size_;
+		valueAfter = valueAfter_;
+		bset = new bool[size];
+		for (int i=0; i < size; i++) {
+			bset[i] = false;
+		}
+		for (const char *cp=setOfCharacters; *cp; cp++) {
+			int val = static_cast<unsigned char>(*cp);
+			PLATFORM_ASSERT(val >= 0);
+			PLATFORM_ASSERT(val < size);
+			bset[val] = true;
+		}
+	}
+	~SetOfCharacters() {
+		delete []bset;
+		bset = 0;
+		size = 0;
+	}
+	void Add(int val) {
+		PLATFORM_ASSERT(val >= 0);
+		PLATFORM_ASSERT(val < size);
+		bset[val] = true;
+	}
+	bool Contains(int val) {
+		PLATFORM_ASSERT(val >= 0);
+		return (val < size) ? bset[val] : valueAfter;
+	}
+};
 
-static inline bool IsAWordChar(int ch) {
-	return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
-}
-
-static inline bool IsAWordStart(int ch) {
-	return (ch < 0x80) && (isalpha(ch) || ch == '_');
-}
-
-static inline bool IsADoxygenChar(int ch) {
-	return (ch < 0x80 && islower(ch)) || ch == '$' || ch == '@' ||
-		ch == '\\' || ch == '&' || ch == '<' ||
-		ch == '>' || ch == '#' || ch == '{' ||
-		ch == '}' || ch == '[' || ch == ']';
-}
-
 static bool IsSpaceEquiv(int state) {
 	return (state <= SCE_C_COMMENTDOC) ||
 		// including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
@@ -59,6 +76,17 @@
 
 	bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
 
+	SetOfCharacters setOKBeforeRE("(=,");
+
+	SetOfCharacters setDoxygen("$@\\&<>#{}[]" SET_LOWER);
+
+	SetOfCharacters setWordStart("_" SET_LOWER SET_UPPER, 0x80, true);
+	SetOfCharacters setWord("._" SET_LOWER SET_UPPER SET_DIGITS, 0x80, true);
+	if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
+		setWordStart.Add('$');
+		setWord.Add('$');
+	}
+
 	int chPrevNonWhite = ' ';
 	int visibleChars = 0;
 	bool lastWordWasUUID = false;
@@ -97,7 +125,7 @@
 
 		if (sc.atLineStart) {
 			if (sc.state == SCE_C_STRING) {
-				// Prevent SCE_C_STRINGEOL from leaking back to previous line which 
+				// Prevent SCE_C_STRINGEOL from leaking back to previous line which
 				// ends with a line continuation by locking in the state upto this position.
 				sc.SetState(SCE_C_STRING);
 			}
@@ -126,12 +154,12 @@
 				break;
 			case SCE_C_NUMBER:
 				// We accept almost anything because of hex. and number suffixes
-				if (!IsAWordChar(sc.ch)) {
+				if (!setWord.Contains(sc.ch)) {
 					sc.SetState(SCE_C_DEFAULT);
 				}
 				break;
 			case SCE_C_IDENTIFIER:
-				if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
+				if (!setWord.Contains(sc.ch) || (sc.ch == '.')) {
 					char s[1000];
 					if (caseSensitive) {
 						sc.GetCurrent(s, sizeof(s));
@@ -201,14 +229,14 @@
 					sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
 					sc.Forward();
 					sc.ForwardSetState(SCE_C_DEFAULT);
-				} else if (!IsADoxygenChar(sc.ch)) {
+				} else if (!setDoxygen.Contains(sc.ch)) {
 					char s[100];
 					if (caseSensitive) {
 						sc.GetCurrent(s, sizeof(s));
 					} else {
 						sc.GetCurrentLowered(s, sizeof(s));
 					}
-					if (!isspace(sc.ch) || !keywords3.InList(s + 1)) {
+					if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) {
 						sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
 					}
 					sc.SetState(styleBeforeDCKeyword);
@@ -283,7 +311,7 @@
 				} else {
 					sc.SetState(SCE_C_NUMBER);
 				}
-			} else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
+			} else if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) {
 				if (lastWordWasUUID) {
 					sc.SetState(SCE_C_UUID);
 					lastWordWasUUID = false;
@@ -303,7 +331,7 @@
 					sc.SetState(SCE_C_COMMENTLINEDOC);
 				else
 					sc.SetState(SCE_C_COMMENTLINE);
-			} else if (sc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
+			} else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite)) {
 				sc.SetState(SCE_C_REGEX);	// JavaScript's RegEx
 			} else if (sc.ch == '\"') {
 				sc.SetState(SCE_C_STRING);
@@ -428,7 +456,7 @@
 			levelMinCurrent = levelCurrent;
 			visibleChars = 0;
 		}
-		if (!isspacechar(ch))
+		if (!IsASpace(ch))
 			visibleChars++;
 	}
 }

Modified: trunk/scintilla/LexPerl.cxx
===================================================================
--- trunk/scintilla/LexPerl.cxx	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/scintilla/LexPerl.cxx	2006-08-21 17:21:50 UTC (rev 753)
@@ -68,14 +68,22 @@
 	return keywords.InList(s);
 }
 
+// Note: as lexer uses chars, UTF-8 bytes are considered as <0 values
+// Note: iswordchar() was used in only one place in LexPerl, it is
+// unnecessary as '.' is processed as the concatenation operator, so
+// only isWordStart() is used in LexPerl
+
+static inline bool isWordStart(char ch) {
+	return !isascii(ch) || isalnum(ch) || ch == '_';
+}
+
 static inline bool isEndVar(char ch) {
-	return !isalnum(ch) && ch != '#' && ch != '$' &&
+	return isascii(ch) && !isalnum(ch) && ch != '#' && ch != '$' &&
 	       ch != '_' && ch != '\'';
 }
 
-
 static inline bool isNonQuote(char ch) {
-	return isalnum(ch) || ch == '_';
+	return !isascii(ch) || isalnum(ch) || ch == '_';
 }
 
 static inline char actualNumStyle(int numberStyle) {
@@ -284,7 +292,7 @@
 		}
 
 		if (state == SCE_PL_DEFAULT) {
-			if (isdigit(ch) || (isdigit(chNext) &&
+			if ((isascii(ch) && isdigit(ch)) || (isascii(chNext) && isdigit(chNext) &&
 				(ch == '.' || ch == 'v'))) {
 				state = SCE_PL_NUMBER;
                 backflag = BACK_NONE;
@@ -295,7 +303,7 @@
 						numState = PERLNUM_HEX;
 					} else if (chNext == 'b') {
                         numState = PERLNUM_BINARY;
-                    } else if (isdigit(chNext)) {
+                    } else if (isascii(chNext) && isdigit(chNext)) {
                         numState = PERLNUM_OCTAL;
                     }
                     if (numState != PERLNUM_DECIMAL) {
@@ -306,7 +314,7 @@
 				} else if (ch == 'v') {	// vector
 					numState = PERLNUM_V_VECTOR;
 				}
-			} else if (iswordstart(ch)) {
+			} else if (isWordStart(ch)) {
                 // if immediately prefixed by '::', always a bareword
                 state = SCE_PL_WORD;
                 if (chPrev == ':' && styler.SafeGetCharAt(i - 2) == ':') {
@@ -338,7 +346,7 @@
 					Quote.New(1);
                     kw++;
 				} else if (ch == 'x' && (chNext == '=' ||	// repetition
-                           (chNext != '_' && !isalnum(chNext)) ||
+                           !isWordStart(chNext) ||
                            (isdigit(chPrev) && isdigit(chNext)))) {
                     state = SCE_PL_OPERATOR;
                 }
@@ -347,7 +355,7 @@
                 // otherwise it is always a bareword and we skip a lot of scanning
                 // note: keywords assumed to be limited to [_a-zA-Z] only
                 if (state == SCE_PL_WORD) {
-                    while (iswordstart(styler.SafeGetCharAt(kw))) kw++;
+                    while (isWordStart(styler.SafeGetCharAt(kw))) kw++;
                     if (!isPerlKeyword(styler.GetStartSegment(), kw, keywords, styler)) {
                         state = SCE_PL_IDENTIFIER;
                     }
@@ -371,7 +379,7 @@
                         if (ch2 == '{' && !moreback) {
                             // {bareword: possible variable spec
                             brace = true;
-                        } else if ((ch2 == '&')
+                        } else if ((ch2 == '&' && styler.SafeGetCharAt(j - 1) != '&')
                                 // &bareword: subroutine call
                                 || (ch2 == '>' && styler.SafeGetCharAt(j - 1) == '-')
                                 // ->bareword: part of variable spec
@@ -403,7 +411,7 @@
                 backflag = BACK_NONE;
                 // an identifier or bareword
                 if (state == SCE_PL_IDENTIFIER) {
-                    if ((!iswordchar(chNext) && chNext != '\'')
+                    if ((!isWordStart(chNext) && chNext != '\'')
                         || (chNext == '.' && chNext2 == '.')) {
                         // We need that if length of word == 1!
                         // This test is copied from the SCE_PL_WORD handler.
@@ -462,7 +470,8 @@
 					styler.ColourTo(i, SCE_PL_SCALAR);
 				} else {
 					state = SCE_PL_SCALAR;
-					if (chNext == '`' && chNext2 == '`') {
+					if ((chNext == '`' && chNext2 == '`')
+                     || (chNext == ':' && chNext2 == ':')) {
 						i += 2;
 						ch = styler.SafeGetCharAt(i);
 						chNext = styler.SafeGetCharAt(i + 1);
@@ -474,9 +483,14 @@
 				}
                 backflag = BACK_NONE;
 			} else if (ch == '@') {
-				if (isalpha(chNext) || chNext == '#' || chNext == '$'
+				if (!isascii(chNext) || isalpha(chNext) || chNext == '#' || chNext == '$'
 					|| chNext == '_' || chNext == '+' || chNext == '-') {
 					state = SCE_PL_ARRAY;
+                } else if (chNext == ':' && chNext2 == ':') {
+                    state = SCE_PL_ARRAY;
+                    i += 2;
+                    ch = styler.SafeGetCharAt(i);
+                    chNext = styler.SafeGetCharAt(i + 1);
 				} else if (chNext != '{' && chNext != '[') {
 					styler.ColourTo(i, SCE_PL_ARRAY);
 				} else {
@@ -484,12 +498,17 @@
 				}
                 backflag = BACK_NONE;
 			} else if (ch == '%') {
-				if (isalpha(chNext) || chNext == '#' || chNext == '$'
+				if (!isascii(chNext) || isalpha(chNext) || chNext == '#' || chNext == '$'
                     || chNext == '_' || chNext == '!' || chNext == '^') {
 					state = SCE_PL_HASH;
                     i++;
                     ch = chNext;
                     chNext = chNext2;
+                } else if (chNext == ':' && chNext2 == ':') {
+                    state = SCE_PL_HASH;
+                    i += 2;
+                    ch = styler.SafeGetCharAt(i);
+                    chNext = styler.SafeGetCharAt(i + 1);
 				} else if (chNext == '{') {
 					styler.ColourTo(i, SCE_PL_HASH);
 				} else {
@@ -500,8 +519,13 @@
                 char strch[2];
                 strch[0] = chNext;
                 strch[1] = '\0';
-				if (isalpha(chNext) || chNext == '_' ||
-                    NULL != strstr("^/|,\\\";#%^:?<>)[]", strch)) {
+                if (chNext == ':' && chNext2 == ':') {
+                    state = SCE_PL_SYMBOLTABLE;
+                    i += 2;
+                    ch = styler.SafeGetCharAt(i);
+                    chNext = styler.SafeGetCharAt(i + 1);
+				} else if (!isascii(chNext) || isalpha(chNext) || chNext == '_'
+                        || NULL != strstr("^/|,\\\";#%^:?<>)[]", strch)) {
 					state = SCE_PL_SYMBOLTABLE;
                     i++;
                     ch = chNext;
@@ -748,9 +772,9 @@
 				if (!isdigit(chNext)) {
 					goto numAtEnd;
 				}
-			} else if (isalnum(ch)) {
+			} else if (!isascii(ch) || isalnum(ch)) {
 				if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) {
-					if (isalpha(ch)) {
+					if (!isascii(ch) || isalpha(ch)) {
 						if (dotCount == 0) { // change to word
 							state = SCE_PL_IDENTIFIER;
 						} else { // vector then word
@@ -765,7 +789,7 @@
 							ch = chNext;
 							chNext = chNext2;
 						}
-					} else if (!isdigit(ch)) { // number then word
+					} else if (!isascii(ch) || !isdigit(ch)) { // number then word
 						goto numAtEnd;
 					}
 				} else if (numState == PERLNUM_FLOAT) {
@@ -798,7 +822,7 @@
 				goto restartLexer;
 			}
 		} else if (state == SCE_PL_IDENTIFIER) {
-			if (!iswordstart(chNext) && chNext != '\'') {
+			if (!isWordStart(chNext) && chNext != '\'') {
 				styler.ColourTo(i, SCE_PL_IDENTIFIER);
 				state = SCE_PL_DEFAULT;
 				ch = ' ';
@@ -994,7 +1018,7 @@
 						}
 					} else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
 						Quote.Count++;
-					} else if (!isalpha(chNext)) {
+					} else if (!isascii(chNext) || !isalpha(chNext)) {
 						if (Quote.Rep <= 0) {
 							styler.ColourTo(i, state);
 							state = SCE_PL_DEFAULT;
@@ -1028,7 +1052,7 @@
 						if (isspacechar(ch)) {
 							// Keep going
 						}
-						else if (isalnum(ch)) {
+						else if (!isascii(ch) || isalnum(ch)) {
 							styler.ColourTo(i, state);
 							state = SCE_PL_DEFAULT;
 							ch = ' ';
@@ -1040,7 +1064,7 @@
 						if (Quote.Count == 0) {
 							Quote.Rep--;
 						}
-						if (!isalpha(chNext)) {
+						if (!isascii(chNext) || !isalpha(chNext)) {
 							if (Quote.Rep <= 0) {
 								styler.ColourTo(i, state);
 								state = SCE_PL_DEFAULT;
@@ -1052,7 +1076,7 @@
 						}
 					} else if (ch == Quote.Up /*&& chPrev != '\\'*/) {
 						Quote.Count++;
-					} else if (!isalpha(chNext)) {
+					} else if (!isascii(chNext) || !isalpha(chNext)) {
 						if (Quote.Rep <= 0) {
 							styler.ColourTo(i, state);
 							state = SCE_PL_DEFAULT;

Modified: trunk/scintilla/PlatGTK.cxx
===================================================================
--- trunk/scintilla/PlatGTK.cxx	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/scintilla/PlatGTK.cxx	2006-08-21 17:21:50 UTC (rev 753)
@@ -319,7 +319,7 @@
 	case SC_CHARSET_VIETNAMESE:
 		return "*-*";
 	case SC_CHARSET_THAI:
-		return "*-1";
+		return "iso8859-11";
 	case SC_CHARSET_8859_15:
 		return "iso8859-15";
 	default:
@@ -781,7 +781,7 @@
 	case SC_CHARSET_VIETNAMESE:
 		return "";
 	case SC_CHARSET_THAI:
-		return "ISO-8859-1";
+		return "ISO-8859-11";
 	case SC_CHARSET_8859_15:
 		return "ISO-8859-15";
 	default:

Modified: trunk/scintilla/PropSet.cxx
===================================================================
--- trunk/scintilla/PropSet.cxx	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/scintilla/PropSet.cxx	2006-08-21 17:21:50 UTC (rev 753)
@@ -825,12 +825,12 @@
 	memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
 }
 
-int cmpString(const void *a1, const void *a2) {
+extern "C" int cmpString(const void *a1, const void *a2) {
 	// Can't work out the correct incantation to use modern casts here
 	return strcmp(*(char**)(a1), *(char**)(a2));
 }
 
-int cmpStringNoCase(const void *a1, const void *a2) {
+extern "C" int cmpStringNoCase(const void *a1, const void *a2) {
 	// Can't work out the correct incantation to use modern casts here
 	return CompareCaseInsensitive(*(char**)(a1), *(char**)(a2));
 }

Modified: trunk/scintilla/ScintillaGTK.cxx
===================================================================
--- trunk/scintilla/ScintillaGTK.cxx	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/scintilla/ScintillaGTK.cxx	2006-08-21 17:21:50 UTC (rev 753)
@@ -800,7 +800,7 @@
 }
 
 #ifdef USE_CONVERTER
-static char *ConvertText(int *lenResult, char *s, size_t len, const char *charSetDest, 
+static char *ConvertText(int *lenResult, char *s, size_t len, const char *charSetDest,
 	const char *charSetSource, bool transliterations) {
 	*lenResult = 0;
 	char *destForm = 0;
@@ -1150,10 +1150,16 @@
 	if (horizEndPreferred < 0)
 		horizEndPreferred = 0;
 	unsigned int pageWidth = rcText.Width();
+	unsigned int pageIncrement = pageWidth / 3;
+	unsigned int charWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
 	if (GTK_ADJUSTMENT(adjustmenth)->upper != horizEndPreferred ||
-	        GTK_ADJUSTMENT(adjustmenth)->page_size != pageWidth) {
+	        GTK_ADJUSTMENT(adjustmenth)->page_size != pageWidth ||
+	        GTK_ADJUSTMENT(adjustmenth)->page_increment != pageIncrement ||
+	        GTK_ADJUSTMENT(adjustmenth)->step_increment != charWidth) {
 		GTK_ADJUSTMENT(adjustmenth)->upper = horizEndPreferred;
+		GTK_ADJUSTMENT(adjustmenth)->step_increment = charWidth;
 		GTK_ADJUSTMENT(adjustmenth)->page_size = pageWidth;
+		GTK_ADJUSTMENT(adjustmenth)->page_increment = pageIncrement;
 		gtk_adjustment_changed(GTK_ADJUSTMENT(adjustmenth));
 		modified = true;
 	}
@@ -1227,8 +1233,6 @@
 		if (key < 256) {
 			NotifyKey(key, modifiers);
 			return 0;
-			//~ AddChar(key);
-			//~ return 1;
 		} else {
 			// Pass up to container in case it is an accelerator
 			NotifyKey(key, modifiers);
@@ -1744,13 +1748,13 @@
 			return FALSE;
 		}
 	} else if (event->button == 4) {
-		// Wheel scrolling up (only xwin gtk does it this way)
+		// Wheel scrolling up (only GTK 1.x does it this way)
 		if (ctrl)
 			SetAdjustmentValue(adjustmenth, (xOffset / 2) - 6);
 		else
 			SetAdjustmentValue(adjustmentv, topLine - 3);
 	} else if (event->button == 5) {
-		// Wheel scrolling down (only xwin gtk does it this way)
+		// Wheel scrolling down (only GTK 1.x does it this way)
 		if (ctrl)
 			SetAdjustmentValue(adjustmenth, (xOffset / 2) + 6);
 		else
@@ -1790,8 +1794,8 @@
 	return FALSE;
 }
 
-// win32gtk has a special wheel mouse event for whatever reason and doesn't
-// use the button4/5 trick used under X windows.
+// win32gtk and GTK >= 2 use SCROLL_* events instead of passing the
+// button4/5/6/7 events to the GTK app
 #if PLAT_GTK_WIN32 || (GTK_MAJOR_VERSION >= 2)
 gint ScintillaGTK::ScrollEvent(GtkWidget *widget,
                                GdkEventScroll *event) {
@@ -1821,7 +1825,7 @@
 			cLineScroll = 4;
 		sciThis->wheelMouseIntensity = cLineScroll;
 	}
-	if (event->direction == GDK_SCROLL_UP) {
+	if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_LEFT) {
 		cLineScroll *= -1;
 	}
 	g_get_current_time(&sciThis->lastWheelMouseTime);
@@ -1837,21 +1841,23 @@
 		return FALSE;
 	}
 
+    // Horizontal scrolling
+	if (event->direction == GDK_SCROLL_LEFT || event->direction == GDK_SCROLL_RIGHT) {
+		sciThis->HorizontalScrollTo(sciThis->xOffset + cLineScroll);
+
 	// Text font size zoom
-	if (event->state & GDK_CONTROL_MASK) {
+	} else if (event->state & GDK_CONTROL_MASK) {
 		if (cLineScroll < 0) {
 			sciThis->KeyCommand(SCI_ZOOMIN);
-			return TRUE;
 		} else {
 			sciThis->KeyCommand(SCI_ZOOMOUT);
-			return TRUE;
 		}
 
 	// Regular scrolling
 	} else {
 		sciThis->ScrollTo(sciThis->topLine + cLineScroll);
-		return TRUE;
 	}
+	return TRUE;
 }
 #endif
 

Modified: trunk/scintilla/StyleContext.h
===================================================================
--- trunk/scintilla/StyleContext.h	2006-08-21 17:07:44 UTC (rev 752)
+++ trunk/scintilla/StyleContext.h	2006-08-21 17:21:50 UTC (rev 753)
@@ -107,16 +107,16 @@
 		return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n));
 	}
 	bool Match(char ch0) {
-		return ch == ch0;
+		return ch == static_cast<unsigned char>(ch0);
 	}
 	bool Match(char ch0, char ch1) {
-		return (ch == ch0) && (chNext == ch1);
+		return (ch == static_cast<unsigned char>(ch0)) && (chNext == static_cast<unsigned char>(ch1));
 	}
 	bool Match(const char *s) {
-		if (ch != *s)
+		if (ch != static_cast<unsigned char>(*s))
 			return false;
 		s++;
-		if (chNext != *s)
+		if (chNext != static_cast<unsigned char>(*s))
 			return false;
 		s++;
 		for (int n=2; *s; n++) {
@@ -127,14 +127,14 @@
 		return true;
 	}
 	bool MatchIgnoreCase(const char *s) {
-		if (tolower(ch) != *s)
+		if (tolower(ch) != static_cast<unsigned char>(*s))
 			return false;
 		s++;
-		if (tolower(chNext) != *s)
+		if (tolower(chNext) != static_cast<unsigned char>(*s))
 			return false;
 		s++;
 		for (int n=2; *s; n++) {
-			if (*s !=
+			if (static_cast<unsigned char>(*s) !=
 				tolower(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n))))
 				return false;
 			s++;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list