NCursesClient::show_menu: stop displaying counts in front of items

This commit is contained in:
Maxime Coste 2012-09-11 14:30:32 +02:00
parent 859e907396
commit eac68f09a4
2 changed files with 2 additions and 6 deletions

View File

@ -224,16 +224,14 @@ void NCursesClient::menu_show(const memoryview<String>& choices)
{ {
assert(m_menu == nullptr); assert(m_menu == nullptr);
m_choices = std::vector<String>(choices.begin(), choices.end()); m_choices = std::vector<String>(choices.begin(), choices.end());
for (int i = 0; i < m_choices.size(); ++i)
m_counts.push_back(int_to_str(i+1));
CharCount longest = 0; CharCount longest = 0;
for (int i = 0; i < m_choices.size(); ++i) for (int i = 0; i < m_choices.size(); ++i)
{ {
m_items.push_back(new_item(m_counts[i].c_str(), m_choices[i].c_str())); m_items.push_back(new_item(m_choices[i].c_str(), ""));
longest = std::max(longest, m_choices[i].length()); longest = std::max(longest, m_choices[i].length());
} }
m_items.push_back(nullptr); m_items.push_back(nullptr);
longest += m_counts.back().length() + 2; longest += 1;
int max_x,max_y; int max_x,max_y;
getmaxyx(stdscr, max_y, max_x); getmaxyx(stdscr, max_y, max_x);
@ -276,7 +274,6 @@ void NCursesClient::menu_hide()
free_item(item); free_item(item);
m_menu = nullptr; m_menu = nullptr;
m_items.clear(); m_items.clear();
m_counts.clear();
refresh(); refresh();
} }

View File

@ -29,7 +29,6 @@ public:
private: private:
MENU* m_menu; MENU* m_menu;
std::vector<ITEM*> m_items; std::vector<ITEM*> m_items;
std::vector<String> m_counts;
std::vector<String> m_choices; std::vector<String> m_choices;
int m_menu_fg; int m_menu_fg;