From 0d448b0d2802a044a77f5546ecd98efb5045adca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 10 Sep 2014 14:47:48 +0200 Subject: Add a few comments about the subtleties of mode switching --- vis.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index ec8279c..ab6529d 100644 --- a/vis.c +++ b/vis.c @@ -498,7 +498,8 @@ static void operator(const Arg *arg) { action_do(&action); return; } - + /* switch to operator mode inorder to make operator options and + * text-object available */ switchmode(&(const Arg){ .i = VIS_MODE_OPERATOR }); if (action.op == op) { /* hacky way to handle double operators i.e. things like @@ -587,6 +588,10 @@ static void prompt(const Arg *arg) { static void prompt_enter(const Arg *arg) { char *s = editor_prompt_get(vis); + /* it is important to switch to normal mode, which hides the prompt and + * more importantly resets vis->win to the currently focused editor + * window *before* anything is executed which depends on vis->win. + */ switchmode(&(const Arg){ .i = VIS_MODE_NORMAL }); switch (vis->prompt->title[0]) { case '/': -- cgit v1.2.3