From 4e60bd39282651d83d7b431239225b1371419b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 25 Sep 2014 17:23:20 +0200 Subject: Exit command prompt if last character is deleted --- vis.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 4f59622..eaba6b8 100644 --- a/vis.c +++ b/vis.c @@ -422,6 +422,8 @@ static void prompt_enter(const Arg *arg); /* cycle through past user inputs */ static void prompt_up(const Arg *arg); static void prompt_down(const Arg *arg); +/* exit command mode if the last char is deleted */ +static void prompt_backspace(const Arg *arg); /* blocks to read 3 consecutive digits and inserts the corresponding byte value */ static void insert_verbatim(const Arg *arg); /* scroll window content according to arg->i which can be either PAGE, PAGE_HALF, @@ -875,6 +877,15 @@ static void prompt_down(const Arg *arg) { } +static void prompt_backspace(const Arg *arg) { + char *cmd = editor_prompt_get(vis); + if (!cmd || !*cmd) + prompt_enter(NULL); + else + window_backspace_key(vis->win->win); + free(cmd); +} + static void insert_verbatim(const Arg *arg) { int value = 0; for (int i = 0; i < 3; i++) { -- cgit v1.2.3