diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-11-28 18:37:29 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-11-28 20:09:14 +0100 |
| commit | 30e9673fdb22905df853ef07b3826fa19b28831c (patch) | |
| tree | 1b5fba8cdd110228df92972660eab026ab1e879a /vis.c | |
| parent | d6a2d5bea9364dfecefecef084671b2c7fc1dc8a (diff) | |
| download | vis-30e9673fdb22905df853ef07b3826fa19b28831c.tar.gz vis-30e9673fdb22905df853ef07b3826fa19b28831c.tar.xz | |
vis: improve switching to prompt mode
A call to vis_prompt_show will now automatically switch to prompt
mode. Within the prompt leave/enter handlers the focused window
(vis->win) will still point to the document window not the one
referring to the prompt.
The selection marks '< and '> are now only updated when a visual
mode is left.
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -462,9 +462,10 @@ void vis_prompt_show(Vis *vis, const char *title, const char *text) { if (vis->prompt_window) return; vis->prompt_window = vis->win; - vis->win = vis->prompt; vis->prompt_type = title[0]; vis->ui->prompt(vis->ui, title, text); + vis_mode_switch(vis, VIS_MODE_PROMPT); + vis->win = vis->prompt; } void vis_prompt_hide(Vis *vis) { @@ -544,7 +545,7 @@ static void action_do(Vis *vis, Action *a) { View *view = win->view; if (a->op == &ops[VIS_OP_FILTER] && !vis->mode->visual) - vis_mode_switch(vis, VIS_MODE_VISUAL); + vis_mode_switch(vis, VIS_MODE_VISUAL_LINE); if (a->count < 1) a->count = 1; @@ -671,11 +672,10 @@ static void action_do(Vis *vis, Action *a) { vis_mode_switch(vis, VIS_MODE_REPLACE); } else if (a->op == &ops[VIS_OP_FILTER]) { if (a->arg.s) { - if (vis_cmd(vis, a->arg.s)) - vis_mode_switch(vis, VIS_MODE_NORMAL); + vis_mode_switch(vis, VIS_MODE_NORMAL); + vis_cmd(vis, a->arg.s); } else { vis_prompt_show(vis, ":", "'<,'>!"); - vis_mode_switch(vis, VIS_MODE_PROMPT); } } else if (vis->mode == &vis_modes[VIS_MODE_OPERATOR]) { mode_set(vis, vis->mode_prev); |
