diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-08-30 21:14:28 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-08-30 21:14:28 +0200 |
| commit | 1ca502d23de987de52eaf4ea698b6bd006a3e5bc (patch) | |
| tree | 9147e238cecedf3fa5caf7d25d807fe15e1183a1 /src/commands.cc | |
| parent | 78d4675c24672634478decb39734e905fdc11fe5 (diff) | |
More useable menu implementation on ncurses
Diffstat (limited to 'src/commands.cc')
| -rw-r--r-- | src/commands.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/commands.cc b/src/commands.cc index 2dbd8b45..4e09568a 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -699,6 +699,8 @@ public: bool has_key_left() const { return m_pos < m_keys.size(); } + int menu(const memoryview<String>& choices) { return 0; } + private: const KeyList& m_keys; size_t m_pos; @@ -761,16 +763,11 @@ void menu(const CommandParameters& params, Context& context) return; } - std::ostringstream oss; + std::vector<String> choices; for (int i = 0; i < count; i += 2) - { - oss << i/2 + 1 << "[" << parser[i] << "] "; - } - oss << "(empty cancels): "; + choices.push_back(parser[i]); - String choice = context.client().prompt(oss.str(), context, - complete_nothing); - int i = str_to_int(choice); + int i = context.client().menu(choices); if (i > 0 and i < (count / 2) + 1) CommandManager::instance().execute(parser[(i-1)*2+1], context); |
