summaryrefslogtreecommitdiff
path: root/src/main/cmds.c
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2024-11-12 20:34:51 +0100
committerAlbert Cervin <albert@acervin.com>2024-11-12 20:34:51 +0100
commit98b060b8aa93e27908148b145731e3f4b770d1a8 (patch)
tree4e3ae371c10ea7c7a1940023ca87f78c63be109e /src/main/cmds.c
parent5ef45ab88f853f4eed273bc7341f3208fda0423c (diff)
downloaddged-98b060b8aa93e27908148b145731e3f4b770d1a8.tar.gz
dged-98b060b8aa93e27908148b145731e3f4b770d1a8.tar.xz
dged-98b060b8aa93e27908148b145731e3f4b770d1a8.zip
Add completion to write_file
Diffstat (limited to 'src/main/cmds.c')
-rw-r--r--src/main/cmds.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/cmds.c b/src/main/cmds.c
index 40983a2..fdd1d87 100644
--- a/src/main/cmds.c
+++ b/src/main/cmds.c
@@ -57,10 +57,20 @@ static int32_t exit_editor(struct command_ctx ctx, int argc,
return 0;
}
+static void write_file_comp_inserted(void) { minibuffer_execute(); }
+
static int32_t write_file(struct command_ctx ctx, int argc,
const char *argv[]) {
const char *pth = NULL;
if (argc == 0) {
+ struct completion_provider providers[] = {path_provider()};
+ enable_completion(minibuffer_buffer(),
+ ((struct completion_trigger){
+ .kind = CompletionTrigger_Input,
+ .data.input =
+ (struct completion_trigger_input){
+ .nchars = 0, .trigger_initially = false}}),
+ providers, 1, write_file_comp_inserted);
return minibuffer_prompt(ctx, "write to file: ");
}