diff --git a/src/ui/windows/market_tab.cpp b/src/ui/windows/market_tab.cpp index 7a1fafa..ed70044 100644 --- a/src/ui/windows/market_tab.cpp +++ b/src/ui/windows/market_tab.cpp @@ -628,7 +628,7 @@ static void RenderPortfolioEditor(App* app) ImGui::PopID(); } if (delRow >= 0) { - commitIfNeeded(); // persist edits to the current group first + // Operates on the stored entries; any uncommitted working edits are discarded. auto es = settings->getPortfolioEntries(); if (delRow < (int)es.size()) { es.erase(es.begin() + delRow); @@ -638,13 +638,15 @@ static void RenderPortfolioEditor(App* app) else if (delRow == s_pf_sel) s_pf_sel = std::min(delRow, (int)es.size() - 1); PortfolioBeginEdit(app, s_pf_sel); } - } else if (clickedSel != -999) { commitIfNeeded(); PortfolioBeginEdit(app, clickedSel); } + } else if (clickedSel != -999) { + PortfolioBeginEdit(app, clickedSel); // switching groups discards uncommitted edits + } } ImGui::EndChild(); ImGui::Dummy(ImVec2(0, Layout::spacingSm())); // Add immediately creates a persisted "Untitled" group and selects it for editing. if (ImGui::Button(TR("portfolio_add_entry"), ImVec2(masterW, addH))) { - commitIfNeeded(); + // Adding switches to a new group; uncommitted edits to the current one are discarded. auto es = settings->getPortfolioEntries(); config::Settings::PortfolioEntry ne; ne.label = TR("portfolio_untitled");