From 3afbbefd9baad3413ecadd1d7b804e4f02c33a55 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 16 Sep 2011 09:20:01 +0000 Subject: [PATCH] Configure filename completer for edit and write commands --- src/main.cc | 9 +++++---- 1 file 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> keymap int main() { init_ncurses(); - - command_manager.register_command(std::vector{ "e", "edit" }, edit); + command_manager.register_command(std::vector{ "e", "edit" }, edit, + PerArgumentCommandCompleter{ complete_filename }); command_manager.register_command(std::vector{ "q", "quit" }, quit); - command_manager.register_command(std::vector{ "w", "write" }, write_buffer); + command_manager.register_command(std::vector{ "w", "write" }, write_buffer, + PerArgumentCommandCompleter{ complete_filename }); command_manager.register_command(std::vector{ "b", "buffer" }, show_buffer); try