public void UpdateCaretPosition()
{
Log("UpdateCaretPosition");
if (textArea.TextEditorProperties.CaretLine) {
textArea.Invalidate();
} else {
if (caretImplementation.RequireRedrawOnPositionChange) {
textArea.UpdateLine(oldLine);
if (line != oldLine)
textArea.UpdateLine(line);
} else {
if (textArea.MotherTextAreaControl.TextEditorProperties.LineViewerStyle == LineViewerStyle.FullRow && oldLine != line) {
textArea.UpdateLine(oldLine);
textArea.UpdateLine(line);
}
}
}
oldLine = line;
if (hidden || textArea.MotherTextEditorControl.IsInUpdate) {
outstandingUpdate = true;
return;
} else {
outstandingUpdate = false;
}
ValidateCaretPos();
int lineNr = this.line;
int xpos = textArea.TextView.GetDrawingXPos(lineNr, this.column);
//LineSegment lineSegment = textArea.Document.GetLineSegment(lineNr);
Point pos = ScreenPosition;
if (xpos >= 0) {
CreateCaret();
bool success = caretImplementation.SetPosition(pos.X, pos.Y);
if (!success) {
caretImplementation.Destroy();
caretCreated = false;
UpdateCaretPosition();
}
} else {
caretImplementation.Destroy();
}
// set the input method editor location
if (ime == null) {
ime = new Ime(textArea.Handle, textArea.Document.TextEditorProperties.Font);
} else {
ime.HWnd = textArea.Handle;
ime.Font = textArea.Document.TextEditorProperties.Font;
}
ime.SetIMEWindowLocation(pos.X, pos.Y);
currentPos = pos;
}