diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2011-09-16 09:20:01 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2011-09-16 09:20:01 +0000 |
| commit | 3afbbefd9baad3413ecadd1d7b804e4f02c33a55 (patch) | |
| tree | 82ce54c8ce65e966d5ed49486cd8efc01e515e13 /src | |
| parent | 63191f1900fe805db49654605ffe4eba9fc547b9 (diff) | |
Configure filename completer for edit and write commands
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.cc b/src/main.cc index 4f71abdb..4a7bfd17 100644 --- a/src/main.cc +++ b/src/main.cc @@ -144,7 +144,7 @@ std::string prompt(const std::string& text, { if (current_completion == -1) { - completions = completer(result, result.length()); + completions = completer(result, cursor_pos); if (completions.candidates.empty()) break; @@ -359,10 +359,11 @@ std::unordered_map<char, std::function<void (Window& window, int count)>> keymap int main() { init_ncurses(); - - command_manager.register_command(std::vector<std::string>{ "e", "edit" }, edit); + command_manager.register_command(std::vector<std::string>{ "e", "edit" }, edit, + PerArgumentCommandCompleter{ complete_filename }); command_manager.register_command(std::vector<std::string>{ "q", "quit" }, quit); - command_manager.register_command(std::vector<std::string>{ "w", "write" }, write_buffer); + command_manager.register_command(std::vector<std::string>{ "w", "write" }, write_buffer, + PerArgumentCommandCompleter{ complete_filename }); command_manager.register_command(std::vector<std::string>{ "b", "buffer" }, show_buffer); try |
