diff -ur scintilla-ORIG\include\Scintilla.h scintilla\include\Scintilla.h
--- scintilla-ORIG\include\Scintilla.h	Wed Oct 27 10:45:10 2010
+++ scintilla\include\Scintilla.h	Sat Oct 30 13:34:26 2010
@@ -124,6 +124,7 @@
 #define SC_MARK_LEFTRECT 27
 #define SC_MARK_AVAILABLE 28
 #define SC_MARK_UNDERLINE 29
+#define SC_MARK_BACKFORE 3030
 #define SC_MARK_CHARACTER 10000
 #define SC_MARKNUM_FOLDEREND 25
 #define SC_MARKNUM_FOLDEROPENMID 26
@@ -166,6 +167,7 @@
 #define STYLE_CONTROLCHAR 36
 #define STYLE_INDENTGUIDE 37
 #define STYLE_CALLTIP 38
+#define STYLE_AUTOCOMPLETION 39
 #define STYLE_LASTPREDEFINED 39
 #define STYLE_MAX 255
 #define SC_CHARSET_ANSI 0
diff -ur scintilla-ORIG\src\AutoComplete.cxx scintilla\src\AutoComplete.cxx
--- scintilla-ORIG\src\AutoComplete.cxx	Wed Oct 27 10:45:10 2010
+++ scintilla\src\AutoComplete.cxx	Sat Oct 30 13:34:26 2010
@@ -132,7 +132,7 @@
 	char item[maxItemLen];
 	int start = 0; // lower bound of the api array block to search
 	int end = lb->Length() - 1; // upper bound of the api array block to search
-	while ((start <= end) && (location == -1)) { // Binary searching loop
+	while (lenWord && (start <= end) && (location == -1)) { // Binary searching loop
 		int pivot = (start + end) / 2;
 		lb->GetValue(pivot, item, maxItemLen);
 		int cond;
diff -ur scintilla-ORIG\src\Editor.cxx scintilla\src\Editor.cxx
--- scintilla-ORIG\src\Editor.cxx	Wed Oct 27 10:45:10 2010
+++ scintilla\src\Editor.cxx	Sat Oct 30 13:34:26 2010
@@ -114,6 +114,7 @@
 	printColourMode = SC_PRINT_NORMAL;
 	printWrapState = eWrapWord;
 	cursorMode = SC_CURSORNORMAL;
+	reverseArrowInMargin = false;
 	controlCharSymbol = 0;	/* Draw the control characters */
 
 	hasFocus = false;
@@ -2619,7 +2620,8 @@
 	if (!overrideBackground) {
 		int marks = pdoc->GetMark(line);
 		for (int markBit = 0; (markBit < 32) && marks; markBit++) {
-			if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) &&
+			if ((marks & 1) && ((vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) ||
+				(vsDraw.markers[markBit].markType == SC_MARK_BACKFORE)) &&
 			        (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
 				background = vsDraw.markers[markBit].back.allocated;
 				overrideBackground = true;
@@ -2839,6 +2841,15 @@
 				if (vsDraw.hotspotForegroundSet)
 					textFore = vsDraw.hotspotForeground.allocated;
 			}
+
+			marks = pdoc->GetMark(line);
+			for (markBit = 0; (markBit < 32) && marks; markBit++) {
+				if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKFORE)) {
+					textFore = vsDraw.markers[markBit].fore.allocated;
+				}
+				marks >>= 1;
+			}
+
 			const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc);
 			if (inSelection && (vsDraw.selforeset)) {
 				textFore = (inSelection == 1) ? vsDraw.selforeground.allocated : vsDraw.selAdditionalForeground.allocated;
@@ -3050,7 +3061,8 @@
 	}
 	marks = pdoc->GetMark(line);
 	for (markBit = 0; (markBit < 32) && marks; markBit++) {
-		if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) {
+		if ((marks & 1) && ((vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) ||
+			(vsDraw.markers[markBit].markType == SC_MARK_BACKFORE))) {
 			SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
 		} else if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE)) {
 			PRectangle rcUnderline = rcSegment;
@@ -6151,7 +6163,7 @@
 	} else {
 		if (vs.fixedColumnWidth > 0) {	// There is a margin
 			if (PointInSelMargin(pt)) {
-				DisplayCursor(Window::cursorReverseArrow);
+				DisplayCursor(reverseArrowInMargin ? Window::cursorReverseArrow : Window::cursorArrow);
 				SetHotSpotRange(NULL);
 				return; 	// No need to test for selection
 			}
diff -ur scintilla-ORIG\src\Editor.h scintilla\src\Editor.h
--- scintilla-ORIG\src\Editor.h	Wed Oct 27 10:45:10 2010
+++ scintilla\src\Editor.h	Sat Oct 30 13:34:26 2010
@@ -137,6 +137,7 @@
 	int printColourMode;
 	int printWrapState;
 	int cursorMode;
+	bool reverseArrowInMargin;
 	int controlCharSymbol;
 
 	bool hasFocus;
diff -ur scintilla-ORIG\src\LineMarker.cxx scintilla\src\LineMarker.cxx
--- scintilla-ORIG\src\LineMarker.cxx	Wed Oct 27 10:45:10 2010
+++ scintilla\src\LineMarker.cxx	Sat Oct 30 13:34:26 2010
@@ -155,7 +155,8 @@
 		surface->RectangleDraw(rcSmall, fore.allocated, back.allocated);
 
 	} else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND ||
-		markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) {
+		markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE ||
+		markType == SC_MARK_BACKFORE) {
 		// An invisible marker so don't draw anything
 
 	} else if (markType == SC_MARK_VLINE) {
diff -ur scintilla-ORIG\src\ScintillaBase.cxx scintilla\src\ScintillaBase.cxx
--- scintilla-ORIG\src\ScintillaBase.cxx	Wed Oct 27 10:45:10 2010
+++ scintilla\src\ScintillaBase.cxx	Sat Oct 30 13:34:26 2010
@@ -220,7 +220,7 @@
 		}
 	}
 	ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(),
-				lenEntered, vs.lineHeight, IsUnicodeMode());
+				lenEntered, vs.styles[STYLE_AUTOCOMPLETION].lineHeight, IsUnicodeMode());
 
 	PRectangle rcClient = GetClientRectangle();
 	Point pt = LocationFromPosition(sel.MainCaret() - lenEntered);
@@ -250,8 +250,8 @@
 	rcac.right = rcac.left + widthLB;
 	rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom);
 	ac.lb->SetPositionRelative(rcac, wMain);
-	ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
-	unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
+	ac.lb->SetFont(vs.styles[STYLE_AUTOCOMPLETION].font);
+	unsigned int aveCharWidth = vs.styles[STYLE_AUTOCOMPLETION].aveCharWidth;
 	ac.lb->SetAverageCharWidth(aveCharWidth);
 	ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
 
@@ -275,9 +275,7 @@
 	rcList.bottom = rcList.top + heightAlloced;
 	ac.lb->SetPositionRelative(rcList, wMain);
 	ac.Show(true);
-	if (lenEntered != 0) {
-		AutoCompleteMoveToCurrentWord();
-	}
+	AutoCompleteMoveToCurrentWord();
 }
 
 void ScintillaBase::AutoCompleteCancel() {
@@ -299,7 +297,10 @@
 	char wordCurrent[1000];
 	int i;
 	int startWord = ac.posStart - ac.startLen;
-	for (i = startWord; i < sel.MainCaret() && i - startWord < 1000; i++)
+	int endWord = sel.MainCaret();
+	//if (ac.selectRestOfWord)
+		endWord = pdoc->ExtendWordSelect(endWord, 1, true);
+	for (i = startWord; i < endWord && i - startWord < 1000; i++)
 		wordCurrent[i - startWord] = pdoc->CharAt(i);
 	wordCurrent[Platform::Minimum(i - startWord, 999)] = '\0';
 	ac.Select(wordCurrent);
diff -ur scintilla-ORIG\src\ViewStyle.cxx scintilla\src\ViewStyle.cxx
--- scintilla-ORIG\src\ViewStyle.cxx	Wed Oct 27 10:45:10 2010
+++ scintilla\src\ViewStyle.cxx	Sat Oct 30 13:34:26 2010
@@ -301,9 +301,9 @@
 	for (unsigned int i=0; i<stylesSize; i++) {
 		if (i != STYLE_DEFAULT) {
 			styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT], extraFontFlag);
-			if (maxAscent < styles[i].ascent)
+			if (maxAscent < styles[i].ascent && i != STYLE_AUTOCOMPLETION)
 				maxAscent = styles[i].ascent;
-			if (maxDescent < styles[i].descent)
+			if (maxDescent < styles[i].descent && i != STYLE_AUTOCOMPLETION)
 				maxDescent = styles[i].descent;
 		}
 		if (styles[i].IsProtected()) {
diff -ur scintilla-ORIG\win32\PlatWin.cxx scintilla\win32\PlatWin.cxx
--- scintilla-ORIG\win32\PlatWin.cxx	Wed Oct 27 10:45:10 2010
+++ scintilla\win32\PlatWin.cxx	Sat Oct 30 13:34:26 2010
@@ -1367,7 +1367,7 @@
 };
 
 const Point ListBoxX::ItemInset(0, 0);
-const Point ListBoxX::TextInset(2, 0);
+const Point ListBoxX::TextInset(2, 1);
 const Point ListBoxX::ImageInset(1, 0);
 
 ListBox *ListBox::Allocate() {
diff -ur scintilla-ORIG\win32\ScintillaWin.cxx scintilla\win32\ScintillaWin.cxx
--- scintilla-ORIG\win32\ScintillaWin.cxx	Wed Oct 27 10:45:10 2010
+++ scintilla\win32\ScintillaWin.cxx	Sat Oct 30 13:34:26 2010
@@ -697,7 +697,9 @@
 
 		case WM_TIMER:
 			if (wParam == standardTimerID && timer.ticking) {
-				Tick();
+				HWND capWnd = ::GetCapture();
+				if (!capWnd || capWnd == MainHWND())
+					Tick();
 			} else if (wParam == idleTimerID && idler.state) {
 				SendMessage(MainHWND(), SC_WIN_IDLE, 0, 1);
 			} else {
@@ -784,7 +786,7 @@
 					::GetCursorPos(&pt);
 					::ScreenToClient(MainHWND(), &pt);
 					if (PointInSelMargin(Point(pt.x, pt.y))) {
-						DisplayCursor(Window::cursorReverseArrow);
+						DisplayCursor(reverseArrowInMargin ? Window::cursorReverseArrow : Window::cursorArrow);
 					} else if (PointInSelection(Point(pt.x, pt.y)) && !SelectionEmpty()) {
 						DisplayCursor(Window::cursorArrow);
 					} else if (PointIsHotspot(Point(pt.x, pt.y))) {
@@ -883,6 +885,7 @@
 					!(::IsChild(wThis, wOther) || (wOther == wCT))) {
 					SetFocusState(false);
 					DestroySystemCaret();
+					SetTicking(false);
 				}
 			}
 			//RealizeWindowPalette(true);
