forked from qt-creator/qt-creator
Editor: fix gotoLine for non existing columns
If TextEditorWidget::gotoLine is called with a column greater than the line length jump to the block end instead of stepping into the next line. Fixes: QTCREATORBUG-32592 Change-Id: I70f8ab09de92000ec228c27320671d12f8fa79e6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -3493,7 +3493,9 @@ void TextEditorWidget::gotoLine(int line, int column, bool centerLine, bool anim
|
||||
const QTextBlock &block = document()->findBlockByNumber(blockNumber);
|
||||
if (block.isValid()) {
|
||||
QTextCursor cursor(block);
|
||||
if (column > 0) {
|
||||
if (column >= block.length()) {
|
||||
cursor.movePosition(QTextCursor::EndOfBlock);
|
||||
} else if (column > 0) {
|
||||
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, column);
|
||||
} else {
|
||||
int pos = cursor.position();
|
||||
|
Reference in New Issue
Block a user