From 38f6c349e1d8dcc0db441db49752fcb49360f691 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 9 Jan 2013 21:41:24 +0200 Subject: [PATCH] TextEditor: Keep cursor in beginning of line on moveLineUpDown Moving it to line end scrolls right with long lines Change-Id: I1fb0cb072a6c57b7e7e53b258567f6842b845fb0 Reviewed-by: David Schulz --- src/plugins/texteditor/basetexteditor.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index cc22935149f..dbc908ac3c2 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -1138,8 +1138,10 @@ void BaseTextEditorWidget::moveLineUpDown(bool up) int end = move.position(); if (hasSelection) { + move.setPosition(end); + move.setPosition(start, QTextCursor::KeepAnchor); + } else { move.setPosition(start); - move.setPosition(end, QTextCursor::KeepAnchor); } //update positions of affectedMarkers