aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/diffeditor/sidebysidediffeditorwidget.cpp')
-rw-r--r--src/plugins/diffeditor/sidebysidediffeditorwidget.cpp39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
index f42acfe8da..81942a9a66 100644
--- a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
+++ b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp
@@ -1059,59 +1059,79 @@ void SideBySideDiffEditorWidget::slotRightJumpToOriginalFileRequested(
}
void SideBySideDiffEditorWidget::slotLeftContextMenuRequested(QMenu *menu,
- int diffFileIndex,
+ int fileIndex,
int chunkIndex)
{
menu->addSeparator();
- m_controller.addCodePasterAction(menu);
- m_controller.addApplyAction(menu, diffFileIndex, chunkIndex);
+ m_controller.addCodePasterAction(menu, fileIndex, chunkIndex);
+ m_controller.addApplyAction(menu, fileIndex, chunkIndex);
+ m_controller.addExtraActions(menu, fileIndex, chunkIndex);
}
void SideBySideDiffEditorWidget::slotRightContextMenuRequested(QMenu *menu,
- int diffFileIndex,
+ int fileIndex,
int chunkIndex)
{
menu->addSeparator();
- m_controller.addCodePasterAction(menu);
- m_controller.addRevertAction(menu, diffFileIndex, chunkIndex);
+ m_controller.addCodePasterAction(menu, fileIndex, chunkIndex);
+ m_controller.addRevertAction(menu, fileIndex, chunkIndex);
+ m_controller.addExtraActions(menu, fileIndex, chunkIndex);
}
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 +1149,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 +1161,7 @@ void SideBySideDiffEditorWidget::syncCursor(SideDiffEditorWidget *source, SideDi
destCursor.setPosition(destPosition);
dest->setTextCursor(destCursor);
+ dest->horizontalScrollBar()->setValue(oldHSliderPos);
}
} // namespace Internal