From 23186f9bf4a5b72aeedf085da24d499c8e747f19 Mon Sep 17 00:00:00 2001 From: Steve Daulton Date: Wed, 20 Jan 2016 23:56:57 +0000 Subject: [PATCH] Fix for bug 440 --- src/Tags.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/Tags.cpp b/src/Tags.cpp index 272784d6e..e17dd0e80 100644 --- a/src/Tags.cpp +++ b/src/Tags.cpp @@ -436,10 +436,6 @@ void Tags::SetTag(const wxString & name, const wxString & value) // Didn't find the tag if (iter == mXref.end()) { - // Intention was to delete so no need to add it - if (value.IsEmpty()) { - return; - } // Add a new tag mXref[key] = name; @@ -447,13 +443,6 @@ void Tags::SetTag(const wxString & name, const wxString & value) return; } - // Intention was to delete - if (value.IsEmpty()) { - mMap.erase(iter->second); - mXref.erase(iter); - return; - } - // Update the value mMap[iter->second] = value; } @@ -876,6 +865,7 @@ bool TagsEditor::TransferDataToWindow() size_t i; wxString n; wxString v; + TagMap popTagMap; // Disable redrawing until we're done mGrid->BeginBatch(); @@ -901,16 +891,17 @@ bool TagsEditor::TransferDataToWindow() mGrid->SetReadOnly(i, 1); } - mLocal.SetTag(labelmap[i].name, wxEmptyString); + popTagMap[ labelmap[i].name ] = mGrid->GetCellValue(i, 1); } // Populate the rest for (bool cont = mLocal.GetFirst(n, v); cont; cont = mLocal.GetNext(n, v)) { - mGrid->AppendRows(); - - mGrid->SetCellValue(i, 0, n); - mGrid->SetCellValue(i, 1, v); - i++; + if ( popTagMap.find(n) == popTagMap.end() ) { + mGrid->AppendRows(); + mGrid->SetCellValue(i, 0, n); + mGrid->SetCellValue(i, 1, v); + i++; + } } // Add an extra one to help with initial sizing and to show it can be done @@ -921,6 +912,8 @@ bool TagsEditor::TransferDataToWindow() // Set the editors SetEditors(); + Layout(); + Fit(); return true; }