Fix selection after step undo and step redo

This commit is contained in:
manongjohn 2022-04-06 13:45:48 -04:00
parent ef13990c6b
commit 672bc53513

View file

@ -410,6 +410,12 @@ void StepUndo::redo() const {
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged(); TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
TApp::instance()->getCurrentScene()->setDirtyFlag(true); TApp::instance()->getCurrentScene()->setDirtyFlag(true);
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection)
cellSelection->selectCells(m_r0, m_c0, (m_r0 + (m_rowsCount * m_step) - 1),
m_c1);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -433,6 +439,11 @@ void StepUndo::undo() const {
} }
app->getCurrentXsheet()->notifyXsheetChanged(); app->getCurrentXsheet()->notifyXsheetChanged();
app->getCurrentScene()->setDirtyFlag(true); app->getCurrentScene()->setDirtyFlag(true);
TCellSelection *cellSelection = dynamic_cast<TCellSelection *>(
TApp::instance()->getCurrentSelection()->getSelection());
if (cellSelection)
cellSelection->selectCells(m_r0, m_c0, (m_r0 + (m_rowsCount - 1)), m_c1);
} }
} // namespace } // namespace
@ -447,7 +458,6 @@ void TCellSelection::stepCells(int step) {
TUndoManager::manager()->add(undo); TUndoManager::manager()->add(undo);
undo->redo(); undo->redo();
m_range.m_r1 += (step - 1) * m_range.getRowCount();
} }
//********************************************************************************* //*********************************************************************************