Bug1382 again: Don't dirty undo stack exporting with no tag change

This commit is contained in:
Paul Licameli 2016-06-23 23:11:53 -04:00
parent 5a121bbbd8
commit 79eeb03a50
1 changed files with 27 additions and 9 deletions

View File

@ -460,17 +460,35 @@ void Tags::SetTag(const wxString & name, const wxString & value)
// Look it up
TagMap::iterator iter = mXref.find(key);
// Didn't find the tag
if (iter == mXref.end()) {
// Add a NEW tag
mXref[key] = name;
mMap[name] = value;
return;
if (value.IsEmpty()) {
// Erase the tag
if (iter == mXref.end())
// nothing to do
;
else {
mMap.erase(iter->second);
mXref.erase(iter);
}
}
else {
if (iter == mXref.end()) {
// Didn't find the tag
// Update the value
mMap[iter->second] = value;
// Add a NEW tag
mXref[key] = name;
mMap[name] = value;
}
else if (!iter->second.IsSameAs(name)) {
// Watch out for case differences!
mMap[name] = value;
mMap.erase(iter->second);
iter->second = name;
}
else {
// Update the value
mMap[iter->second] = value;
}
}
}
void Tags::SetTag(const wxString & name, const int & value)