summaryrefslogtreecommitdiff
path: root/editor.h
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-31 13:31:21 -0700
committercflip <cflip@cflip.net>2023-01-31 14:00:17 -0700
commit1b8261071ef3ad3b8d1c2db6e712b0e590c563b3 (patch)
treeca7e8528b37ccd1d7748b5c70582239b506f8b6a /editor.h
parent264c4186ed8e3d2e3275a6514c8714903036cb26 (diff)
Reimplement editor_prompt and 'Save as' using the new prompt modeHEADmaster
Now there there is a new way to prompt for text, we can reimplement the long abandoned editor_prompt function and use it to allow saving to new files. The new editor_prompt function takes a callback that will be called after the user presses enter on the prompt.
Diffstat (limited to 'editor.h')
-rw-r--r--editor.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/editor.h b/editor.h
index e530956..2c64013 100644
--- a/editor.h
+++ b/editor.h
@@ -36,11 +36,14 @@ struct editor_state {
struct textbuf cmdline;
};
+typedef void (*prompt_callback_t)(struct editor_state*, char*, size_t);
+
void init_editor(struct editor_state* editor);
void editor_set_status_message(struct editor_state* editor, const char* format, ...);
-char* editor_prompt(struct editor_state* editor, char* prompt, void (*callback)(struct editor_state*, char*, int));
+void editor_prompt(struct editor_state* editor, char* prompt, prompt_callback_t callback);
void editor_run_command(struct editor_state *editor);
+void editor_try_save(struct editor_state *editor);
void editor_try_quit(struct editor_state *editor);
void editor_move_left(struct editor_state *);