Editor: fix select all

Prevent scrolling to the end of the document after triggering select
all.

Fixes: QTCREATORBUG-26736
Change-Id: I744dddee87ac16ae2399d37483552fc6b535df46
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2022-01-04 12:17:20 +01:00
parent ec07bf8f7c
commit 02535d6bf8

View File

@@ -7237,9 +7237,10 @@ void TextEditorWidget::cut()
void TextEditorWidget::selectAll() void TextEditorWidget::selectAll()
{ {
QTextCursor c = textCursor(); QPlainTextEdit::selectAll();
c.select(QTextCursor::Document); // Directly update the internal multi text cursor here to prevent calling setTextCursor.
doSetTextCursor(c); // This would indirectly makes sure the cursor is visible which is not desired for select all.
const_cast<MultiTextCursor &>(d->m_cursors).setCursors({QPlainTextEdit::textCursor()});
} }
void TextEditorWidget::copy() void TextEditorWidget::copy()