aboutsummaryrefslogtreecommitdiff
path: root/src/scintilla.patch
blob: bcd054b1274d1b520d83cbfbae94b87410830882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
diff -r 5693714a8b0b src/Catalogue.cxx
--- a/src/Catalogue.cxx	Fri Dec 06 16:19:52 2013 +1100
+++ b/src/Catalogue.cxx	Sun Dec 15 21:21:20 2013 -0500
@@ -74,6 +74,7 @@
 // Shorten the code that declares a lexer and ensures it is linked in by calling a method.
 #define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer);
 
+#if 0
 //++Autogenerated -- run scripts/LexGen.py to regenerate
 //**\(\tLINK_LEXER(\*);\n\)
 	LINK_LEXER(lmA68k);
@@ -187,6 +188,8 @@
 	LINK_LEXER(lmYAML);
 
 //--Autogenerated -- end of automatically generated section
+#endif
+	LINK_LEXER(lmLPeg);
 
 	return 1;
 }
diff -r 326449de45d0 gtk/ScintillaGTK.cxx
--- a/gtk/ScintillaGTK.cxx	Thu Sep 25 09:48:50 2014 +1000
+++ b/gtk/ScintillaGTK.cxx	Tue Oct 07 12:28:16 2014 -0400
@@ -1563,6 +1563,13 @@
 		len--;	// Forget the extra '\0'
 #endif
 
+#if PLAT_GTK_WIN32
+  // Win32 includes an ending '\0' byte in 'len' for clipboard text from
+  // external applications; ignore it.
+  if (len > 0 && data[len - 1] == '\0')
+    len--;
+#endif
+
 	std::string dest(data, len);
 	if (selectionTypeData == GDK_TARGET_STRING) {
 		if (IsUnicodeMode()) {
diff -r 01c4696a39a9 src/Editor.cxx
--- a/src/Editor.cxx	Tue Sep 30 09:58:13 2014 +1000
+++ b/src/Editor.cxx	Wed Oct 22 13:22:55 2014 -0400
@@ -112,6 +112,7 @@
 	mouseDownCaptures = true;
 
 	lastClickTime = 0;
+	doubleClickCloseThreshold = Point(3, 3);
 	dwellDelay = SC_TIME_FOREVER;
 	ticksToDwell = SC_TIME_FOREVER;
 	dwelling = false;
@@ -3757,10 +3758,10 @@
 	EnsureCaretVisible();
 }
 
-static bool Close(Point pt1, Point pt2) {
-	if (abs(pt1.x - pt2.x) > 3)
+static bool Close(Point pt1, Point pt2, Point threshold) {
+	if (abs(pt1.x - pt2.x) > threshold.x)
 		return false;
-	if (abs(pt1.y - pt2.y) > 3)
+	if (abs(pt1.y - pt2.y) > threshold.y)
 		return false;
 	return true;
 }
@@ -4116,7 +4117,7 @@
 	if (shift && !inSelMargin) {
 		SetSelection(newPos);
 	}
-	if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick)) {
+	if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick, doubleClickCloseThreshold)) {
 		//Platform::DebugPrintf("Double click %d %d = %d\n", curTime, lastClickTime, curTime - lastClickTime);
 		SetMouseCapture(true);
 		if (FineTickerAvailable()) {
diff -r 01c4696a39a9 src/Editor.h
--- a/src/Editor.h	Tue Sep 30 09:58:13 2014 +1000
+++ b/src/Editor.h	Wed Oct 22 13:22:55 2014 -0400
@@ -203,6 +203,7 @@
 
 	Point lastClick;
 	unsigned int lastClickTime;
+	Point doubleClickCloseThreshold;
 	int dwellDelay;
 	int ticksToDwell;
 	bool dwelling;
diff -r 326449de45d0 src/EditView.cxx
--- a/src/EditView.cxx	Thu Sep 25 09:48:50 2014 +1000
+++ b/src/EditView.cxx	Sat Nov 08 21:00:02 2014 -0500
@@ -185,6 +185,9 @@
 	pixmapIndentGuideHighlight = 0;
 	llc.SetLevel(LineLayoutCache::llcCaret);
 	posCache.SetSize(0x400);
+	tabArrowHeight = 4;
+	customDrawTabArrow = NULL;
+	customDrawWrapMarker = NULL;
 }
 
 EditView::~EditView() {
@@ -927,7 +930,11 @@
 			rcPlace.right = rcLine.right;
 			rcPlace.left = rcPlace.right - vsDraw.aveCharWidth;
 		}
-		DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
+		if (customDrawWrapMarker == NULL) {
+			DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
+		} else {
+			customDrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
+		}
 	}
 }
 
@@ -1201,7 +1208,7 @@
 }
 
 static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll,
-	int xStart, PRectangle rcLine, ColourOptional background) {
+	int xStart, PRectangle rcLine, ColourOptional background, DrawWrapMarkerFn customDrawWrapMarker) {
 	// default bgnd here..
 	surface->FillRectangle(rcLine, background.isSet ? background :
 		vsDraw.styles[STYLE_DEFAULT].back);
@@ -1219,7 +1226,11 @@
 		else
 			rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
 
-		DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
+		if (customDrawWrapMarker == NULL) {
+			DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
+		} else {
+			customDrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
+		}
 	}
 }
 
@@ -1463,9 +1474,12 @@
 							if (vsDraw.whitespaceColours.fore.isSet)
 								textFore = vsDraw.whitespaceColours.fore;
 							surface->PenColour(textFore);
-							PRectangle rcTab(rcSegment.left + 1, rcSegment.top + 4,
+							PRectangle rcTab(rcSegment.left + 1, rcSegment.top + tabArrowHeight,
 								rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent);
-							DrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2));
+							if (customDrawTabArrow == NULL)
+								DrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2));
+							else
+								customDrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2));
 						}
 					}
 				} else {
@@ -1632,7 +1646,7 @@
 
 	if ((ll->wrapIndent != 0) && (subLine > 0)) {
 		if (phase & drawBack) {
-			DrawWrapIndentAndMarker(surface, vsDraw, ll, xStart, rcLine, background);
+			DrawWrapIndentAndMarker(surface, vsDraw, ll, xStart, rcLine, background, customDrawWrapMarker);
 		}
 		xStart += static_cast<int>(ll->wrapIndent);
 	}
diff -r 326449de45d0 src/EditView.h
--- a/src/EditView.h	Thu Sep 25 09:48:50 2014 +1000
+++ b/src/EditView.h	Sat Nov 08 21:00:02 2014 -0500
@@ -42,6 +42,8 @@
 void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText,
 	const StyledText &st, size_t start, size_t length, DrawPhase phase);
 
+typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid);
+
 /**
 * EditView draws the main text area.
 */
@@ -78,6 +80,14 @@
 	LineLayoutCache llc;
 	PositionCache posCache;
 
+	int tabArrowHeight; // draw arrow heads this many pixels above/below line midpoint
+	/** Some platforms, notably PLAT_CURSES, do not support Scintilla's native
+	 * DrawTabArrow function for drawing tab characters. Allow those platforms to
+	 * override it instead of creating a new method in the Surface class that
+	 * existing platforms must implement as empty. */
+	DrawTabArrowFn customDrawTabArrow;
+	DrawWrapMarkerFn customDrawWrapMarker;
+
 	EditView();
 	virtual ~EditView();
 
diff -r 326449de45d0 src/MarginView.cxx
--- a/src/MarginView.cxx	Thu Sep 25 09:48:50 2014 +1000
+++ b/src/MarginView.cxx	Sat Nov 08 21:00:02 2014 -0500
@@ -102,6 +102,8 @@
 	pixmapSelMargin = 0;
 	pixmapSelPattern = 0;
 	pixmapSelPatternOffset1 = 0;
+	wrapMarkerPaddingRight = 3;
+	customDrawWrapMarker = NULL;
 }
 
 void MarginView::DropGraphics(bool freeObjects) {
@@ -391,9 +393,13 @@
 							rcNumber.top + vs.maxAscent, number, static_cast<int>(strlen(number)), drawAll);
 					} else if (vs.wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) {
 						PRectangle rcWrapMarker = rcMarker;
-						rcWrapMarker.right -= 3;
+						rcWrapMarker.right -= wrapMarkerPaddingRight;
 						rcWrapMarker.left = rcWrapMarker.right - vs.styles[STYLE_LINENUMBER].aveCharWidth;
-						DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore);
+						if (customDrawWrapMarker == NULL) {
+							DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore);
+						} else {
+							customDrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore);
+						}
 					}
 				} else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) {
 					if (firstSubLine) {
diff -r 326449de45d0 src/MarginView.h
--- a/src/MarginView.h	Thu Sep 25 09:48:50 2014 +1000
+++ b/src/MarginView.h	Sat Nov 08 21:00:02 2014 -0500
@@ -14,6 +14,8 @@
 
 void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);
 
+typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);
+
 /**
 * MarginView draws the margins.
 */
@@ -25,6 +27,13 @@
 	// Highlight current folding block
 	HighlightDelimiter highlightDelimiter;
 
+	int wrapMarkerPaddingRight; // right-most pixel padding of wrap markers
+	/** Some platforms, notably PLAT_CURSES, do not support Scintilla's native
+	 * DrawWrapMarker function for drawing wrap markers. Allow those platforms to
+	 * override it instead of creating a new method in the Surface class that
+	 * existing platforms must implement as empty. */
+	DrawWrapMarkerFn customDrawWrapMarker;
+
 	MarginView();
 
 	void DropGraphics(bool freeObjects);
diff -r 326449de45d0 src/LineMarker.cxx
--- a/src/LineMarker.cxx	Thu Sep 25 09:48:50 2014 +1000
+++ b/src/LineMarker.cxx	Sun Nov 09 00:50:17 2014 -0500
@@ -72,6 +72,11 @@
 }
 
 void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const {
+	if (customDraw != NULL) {
+		customDraw(surface, rcWhole, fontForCharacter, tFold, marginStyle, this);
+		return;
+	}
+
 	ColourDesired colourHead = back;
 	ColourDesired colourBody = back;
 	ColourDesired colourTail = back;
diff -r 326449de45d0 src/LineMarker.h
--- a/src/LineMarker.h	Thu Sep 25 09:48:50 2014 +1000
+++ b/src/LineMarker.h	Sun Nov 09 00:50:17 2014 -0500
@@ -12,6 +12,8 @@
 namespace Scintilla {
 #endif
 
+typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker);
+
 /**
  */
 class LineMarker {
@@ -25,6 +27,11 @@
 	int alpha;
 	XPM *pxpm;
 	RGBAImage *image;
+	/** Some platforms, notably PLAT_CURSES, do not support Scintilla's native
+	 * Draw function for drawing line markers. Allow those platforms to override
+	 * it instead of creating a new method(s) in the Surface class that existing
+	 * platforms must implement as empty. */
+	DrawLineMarkerFn customDraw;
 	LineMarker() {
 		markType = SC_MARK_CIRCLE;
 		fore = ColourDesired(0,0,0);
@@ -33,6 +40,7 @@
 		alpha = SC_ALPHA_NOALPHA;
 		pxpm = NULL;
 		image = NULL;
+		customDraw = NULL;
 	}
 	LineMarker(const LineMarker &) {
 		// Defined to avoid pxpm being blindly copied, not as a complete copy constructor
@@ -43,6 +51,7 @@
 		alpha = SC_ALPHA_NOALPHA;
 		pxpm = NULL;
 		image = NULL;
+		customDraw = NULL;
 	}
 	~LineMarker() {
 		delete pxpm;
@@ -60,6 +69,7 @@
 			pxpm = NULL;
 			delete image;
 			image = NULL;
+			customDraw = NULL;
 		}
 		return *this;
 	}