From 1ff146d3c256782ad976913739a3fef7b57b3fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 24 Oct 2014 23:39:37 +0200 Subject: Make command prompt available in visual modes --- editor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'editor.c') 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); } -- cgit v1.2.3