aboutsummaryrefslogtreecommitdiff
path: root/editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'editor.c')
-rw-r--r--editor.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/editor.c b/editor.c
index 477e069..b1e42a3 100644
--- a/editor.c
+++ b/editor.c
@@ -511,15 +511,17 @@ static void editor_prompt_move(Prompt *prompt, int x, int y) {
editor_window_move(prompt->win, x + title_width, y);
}
-void editor_prompt_show(Editor *ed, const char *title) {
+void editor_prompt_show(Editor *ed, const char *title, const char *text) {
Prompt *prompt = ed->prompt;
if (prompt->active)
return;
prompt->active = true;
prompt->editor = ed->win;
- ed->win = prompt->win;
free(prompt->title);
prompt->title = strdup(title);
+ text_insert(prompt->win->text, 0, text, strlen(text));
+ window_cursor_to(prompt->win->win, text_size(prompt->win->text));
+ ed->win = prompt->win;
editor_resize(ed, ed->width, ed->height);
}