Fix wxCommandProcessor::IsDirty() result after undoing everything after save.
IsDirty() returned false when all commands were undone after saving even though it clearly should have returned true in this case. Fix this and add comments explaining what happens in this method. Closes #2862. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70460 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -330,12 +330,26 @@ void wxCommandProcessor::ClearCommands()
|
|||||||
|
|
||||||
bool wxCommandProcessor::IsDirty() const
|
bool wxCommandProcessor::IsDirty() const
|
||||||
{
|
{
|
||||||
if ( !m_currentCommand )
|
if ( m_commands.empty() )
|
||||||
|
{
|
||||||
|
// If we have never been modified, we can't be dirty.
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !m_lastSavedCommand )
|
if ( !m_lastSavedCommand )
|
||||||
|
{
|
||||||
|
// If we have been modified but have never been saved, we're dirty.
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return m_lastSavedCommand != m_currentCommand;
|
if ( !m_currentCommand )
|
||||||
|
{
|
||||||
|
// This only happens if all commands were undone after saving the
|
||||||
|
// document: we're dirty then.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finally if both iterators are valid, we may just compare them.
|
||||||
|
return m_currentCommand != m_lastSavedCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user