commit 7713f882586a4f55e600e3e8e1b412da4e335bf4 parent b9ecf2f3bde5a52addcd5113f4ab95091b6749a7 Author: cfillion <cfillion@users.noreply.github.com> Date: Mon, 2 May 2016 02:33:45 -0400 manager: remember selection when reloading the list Diffstat:
M | src/manager.cpp | | | 15 | +++++++++++++-- |
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/manager.cpp b/src/manager.cpp @@ -170,11 +170,22 @@ void Manager::onContextMenu(HWND target, const int x, const int y) void Manager::refresh() { InhibitControl lock(m_list); + + const vector<int> selection = m_list->selection(); + vector<string> selected(selection.size()); + for(size_t i = 0; i < selection.size(); i++) + selected[i] = m_list->row(selection[i])[0]; + m_list->clear(); for(const Remote &remote : *m_config->remotes()) { - if(!m_uninstall.count(remote)) - m_list->addRow(makeRow(remote)); + if(m_uninstall.count(remote)) + continue; + + const int index = m_list->addRow(makeRow(remote)); + + if(find(selected.begin(), selected.end(), remote.name()) != selected.end()) + m_list->select(index); } m_list->sort();