Minor improvement about undo/redo for bridge creation

When a new bridge is created, an undo command is created for that.
When undo the action and redo it, all terminals are bridged to a new
bridge instead of the first one, who continue to exist but is now
empty and 'lost' because he will never be reused.
In addition of that, if a more recent undo command (we call it undo2)
use this bridge,
there is a unknown behavior, because the status of the bridge is not the
same as when the undo2  was created.
This commit is contained in:
joshua
2022-01-27 20:00:46 +01:00
parent d114b097bf
commit a31bd6eb0d
2 changed files with 9 additions and 2 deletions

View File

@@ -36,8 +36,14 @@ void BridgeTerminalsCommand::undo()
void BridgeTerminalsCommand::redo()
{
if (m_strip) {
m_strip->setBridge(m_real_terminal_vector);
if (m_strip)
{
if (m_bridge) {
m_strip->setBridge(m_bridge, m_real_terminal_vector);
} else {
m_strip->setBridge(m_real_terminal_vector);
m_bridge = m_strip->isBridged(m_real_terminal_vector.first());
}
}
}