From 9ea3d61aaa741a775d1bc69d8b8ecb91e710f8e0 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 12 Oct 2021 13:42:19 +0200 Subject: [PATCH] VCS: update the text cursor of VcsBaseEditorWidget TextEditorWidget::slotCursorPositionChanged makes sure that the multi text cursor in the TextEditorWidget reflects all changes of the QPlainTextEdit cursor. Fixes: QTCREATORBUG-26360 Change-Id: I43d612c6f85fedbf45179898e044b516a93a3ed8 Reviewed-by: Orgad Shaneh --- src/plugins/vcsbase/vcsbaseeditor.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index d24b96dd5f8..1989b03181e 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -958,18 +958,19 @@ void VcsBaseEditorWidget::slotCursorPositionChanged() // Adapt entries combo to new position // if the cursor goes across a file line. const int newCursorLine = textCursor().blockNumber(); - if (newCursorLine == d->m_cursorLine) - return; - // Which section does it belong to? - d->m_cursorLine = newCursorLine; - const int section = sectionOfLine(d->m_cursorLine, d->m_entrySections); - if (section != -1) { - QComboBox *entriesComboBox = d->entriesComboBox(); - if (entriesComboBox->currentIndex() != section) { - QSignalBlocker blocker(entriesComboBox); - entriesComboBox->setCurrentIndex(section); + if (newCursorLine != d->m_cursorLine) { + // Which section does it belong to? + d->m_cursorLine = newCursorLine; + const int section = sectionOfLine(d->m_cursorLine, d->m_entrySections); + if (section != -1) { + QComboBox *entriesComboBox = d->entriesComboBox(); + if (entriesComboBox->currentIndex() != section) { + QSignalBlocker blocker(entriesComboBox); + entriesComboBox->setCurrentIndex(section); + } } } + TextEditorWidget::slotCursorPositionChanged(); } void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e)