--- a/scintilla/src/CallTip.cxx
+++ b/scintilla/src/CallTip.cxx
@@ -17,9 +17,6 @@
 #ifdef SCI_NAMESPACE
 using namespace Scintilla;
 #endif
-
-static const int insetX = 5;    // text inset in x from calltip border
-static const int widthArrow = 14;
 
 CallTip::CallTip() {
 	wCallTip = 0;
@@ -35,6 +32,11 @@
 	tabSize = 0;
 	above = false;
 	useStyleCallTip = false;    // for backwards compatibility
+
+	insetX = 5;
+	widthArrow = 14;
+	borderHeight = 2; // Extra line for border and an empty line at top and bottom.
+	verticalOffset = 1;
 
 #ifdef __APPLE__
 	// proper apple colours for the default
@@ -284,15 +286,15 @@
 	}
 	lineHeight = surfaceMeasure->Height(font);
 
-	// Extra line for border and an empty line at top and bottom. The returned
+	// The returned
 	// rectangle is aligned to the right edge of the last arrow encountered in
 	// the tip text, else to the tip text left edge.
-	int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + 2 + 2;
+	int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + borderHeight * 2;
 	delete surfaceMeasure;
 	if (above) {
-		return PRectangle(pt.x - offsetMain, pt.y - 1 - height, pt.x + width - offsetMain, pt.y - 1);
+		return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset);
 	} else {
-		return PRectangle(pt.x - offsetMain, pt.y + 1 + textHeight, pt.x + width - offsetMain, pt.y + 1 + textHeight + height);
+		return PRectangle(pt.x - offsetMain, pt.y + verticalOffset + textHeight, pt.x + width - offsetMain, pt.y + verticalOffset + textHeight + height);
 	}
 }
 
@@ -307,7 +309,7 @@
 	// Avoid flashing by checking something has really changed
 	if ((start != startHighlight) || (end != endHighlight)) {
 		startHighlight = start;
-		endHighlight = end;
+		endHighlight = (end > start) ? end : start;
 		if (wCallTip.Created()) {
 			wCallTip.InvalidateAll();
 		}