summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2018-02-14 12:02:56 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2018-02-16 06:48:05 +0000
commit11a6f000be5c3f3ce6864ccd667ddadeafe0de21 (patch)
tree6669542ce3e3ceb7c942695aa1d95c020dad30ac /src/plugins
parentb795cc152c01e6ca937954c7b99f71e3a324b6ff (diff)
downloadqt-creator-11a6f000be5c3f3ce6864ccd667ddadeafe0de21.tar.gz
Fix horizontal scrolling in sidebyside diff editor
Fix horizontal scrolling in sidebyside diff editor when doing text search. Change-Id: I6b52ee50544ef6005b8b79b87b9289dbc7f99dbf Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/diffeditor/sidebysidediffeditorwidget.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
index f42acfe8da..fb1fe91e64 100644
--- a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
+++ b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
@@ -1080,38 +1080,56 @@ void SideBySideDiffEditorWidget::slotRightContextMenuRequested(QMenu *menu,
void SideBySideDiffEditorWidget::leftVSliderChanged()
{
+ if (m_controller.m_ignoreCurrentIndexChange)
+ return;
+
m_rightEditor->verticalScrollBar()->setValue(m_leftEditor->verticalScrollBar()->value());
}
void SideBySideDiffEditorWidget::rightVSliderChanged()
{
+ if (m_controller.m_ignoreCurrentIndexChange)
+ return;
+
m_leftEditor->verticalScrollBar()->setValue(m_rightEditor->verticalScrollBar()->value());
}
void SideBySideDiffEditorWidget::leftHSliderChanged()
{
+ if (m_controller.m_ignoreCurrentIndexChange)
+ return;
+
if (m_horizontalSync)
m_rightEditor->horizontalScrollBar()->setValue(m_leftEditor->horizontalScrollBar()->value());
}
void SideBySideDiffEditorWidget::rightHSliderChanged()
{
+ if (m_controller.m_ignoreCurrentIndexChange)
+ return;
+
if (m_horizontalSync)
m_leftEditor->horizontalScrollBar()->setValue(m_rightEditor->horizontalScrollBar()->value());
}
void SideBySideDiffEditorWidget::leftCursorPositionChanged()
{
+ if (m_controller.m_ignoreCurrentIndexChange)
+ return;
+
+ handlePositionChange(m_leftEditor, m_rightEditor);
leftVSliderChanged();
leftHSliderChanged();
- handlePositionChange(m_leftEditor, m_rightEditor);
}
void SideBySideDiffEditorWidget::rightCursorPositionChanged()
{
+ if (m_controller.m_ignoreCurrentIndexChange)
+ return;
+
+ handlePositionChange(m_rightEditor, m_leftEditor);
rightVSliderChanged();
rightHSliderChanged();
- handlePositionChange(m_rightEditor, m_leftEditor);
}
void SideBySideDiffEditorWidget::handlePositionChange(SideDiffEditorWidget *source, SideDiffEditorWidget *dest)
@@ -1129,6 +1147,8 @@ void SideBySideDiffEditorWidget::handlePositionChange(SideDiffEditorWidget *sour
void SideBySideDiffEditorWidget::syncCursor(SideDiffEditorWidget *source, SideDiffEditorWidget *dest)
{
+ const int oldHSliderPos = dest->horizontalScrollBar()->value();
+
const QTextCursor sourceCursor = source->textCursor();
const int sourceLine = sourceCursor.blockNumber();
const int sourceColumn = sourceCursor.positionInBlock();
@@ -1139,6 +1159,7 @@ void SideBySideDiffEditorWidget::syncCursor(SideDiffEditorWidget *source, SideDi
destCursor.setPosition(destPosition);
dest->setTextCursor(destCursor);
+ dest->horizontalScrollBar()->setValue(oldHSliderPos);
}
} // namespace Internal