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