TextEditor: Correct line up/down on first/last line.

* Move to beginning of first line, or end of last line respectively.
This commit is contained in:
Stephan Aßmus
2014-01-20 00:50:37 +01:00
parent e809325835
commit 2188476555
+8 -2
View File
@@ -134,7 +134,7 @@ TextEditor::SetCharacterStyle(::CharacterStyle style)
fStyleAtCaret = style; fStyleAtCaret = style;
if (fSelection.Caret() != fSelection.Anchor()) { if (HasSelection()) {
// TODO: Apply style to selection range // TODO: Apply style to selection range
} }
} }
@@ -368,8 +368,14 @@ TextEditor::SelectionLength() const
void void
TextEditor::_MoveToLine(int32 lineIndex, bool select) TextEditor::_MoveToLine(int32 lineIndex, bool select)
{ {
if (lineIndex < 0 || lineIndex >= fLayout->CountLines()) if (lineIndex < 0) {
_SetCaretOffset(0, false, select, true);
return; return;
}
if (lineIndex >= fLayout->CountLines()) {
_SetCaretOffset(fDocument->Length(), false, select, true);
return;
}
float x1; float x1;
float y1; float y1;