From 21884765557a35b6c1b8d77c22b96e660bb42b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 20 Jan 2014 00:05:00 +0100 Subject: [PATCH] TextEditor: Correct line up/down on first/last line. * Move to beginning of first line, or end of last line respectively. --- src/apps/haiku-depot/textview/TextEditor.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/apps/haiku-depot/textview/TextEditor.cpp b/src/apps/haiku-depot/textview/TextEditor.cpp index 9d9f4cd952..f1ce5a331c 100644 --- a/src/apps/haiku-depot/textview/TextEditor.cpp +++ b/src/apps/haiku-depot/textview/TextEditor.cpp @@ -134,7 +134,7 @@ TextEditor::SetCharacterStyle(::CharacterStyle style) fStyleAtCaret = style; - if (fSelection.Caret() != fSelection.Anchor()) { + if (HasSelection()) { // TODO: Apply style to selection range } } @@ -368,8 +368,14 @@ TextEditor::SelectionLength() const void TextEditor::_MoveToLine(int32 lineIndex, bool select) { - if (lineIndex < 0 || lineIndex >= fLayout->CountLines()) + if (lineIndex < 0) { + _SetCaretOffset(0, false, select, true); return; + } + if (lineIndex >= fLayout->CountLines()) { + _SetCaretOffset(fDocument->Length(), false, select, true); + return; + } float x1; float y1;