summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/vimb.14
-rw-r--r--src/normal.c17
2 files changed, 20 insertions, 1 deletions
diff --git a/doc/vimb.1 b/doc/vimb.1
index 9305f45..9861af4 100644
--- a/doc/vimb.1
+++ b/doc/vimb.1
@@ -95,6 +95,10 @@ Start Command Mode and print `:' to the input box.
Set cursor to the first editable element in the page and switch to Input
Mode.
.TP
+.B i
+Set cursor to the last focused element in the page and switch to Input Mode.
+If no element was focused before the first element is focused like with `gi'.
+.TP
.B CTRL\-Z
Switch Vimb into Pass-Through Mode.
.TP
diff --git a/src/normal.c b/src/normal.c
index 62a51f8..fa4c7d6 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -56,6 +56,7 @@ static VbResult normal_clear_input(Client *c, const NormalCmdInfo *info);
static VbResult normal_descent(Client *c, const NormalCmdInfo *info);
static VbResult normal_ex(Client *c, const NormalCmdInfo *info);
static VbResult normal_fire(Client *c, const NormalCmdInfo *info);
+static VbResult normal_focus_last_active(Client *c, const NormalCmdInfo *info);
static VbResult normal_g_cmd(Client *c, const NormalCmdInfo *info);
static VbResult normal_hint(Client *c, const NormalCmdInfo *info);
static VbResult normal_do_hint(Client *c, const char *prompt);
@@ -186,7 +187,7 @@ static struct {
/* f 0x66 */ {normal_ex},
/* g 0x67 */ {normal_g_cmd},
/* h 0x68 */ {normal_scroll},
-/* i 0x69 */ {NULL},
+/* i 0x69 */ {normal_focus_last_active},
/* j 0x6a */ {normal_scroll},
/* k 0x6b */ {normal_scroll},
/* l 0x6c */ {normal_scroll},
@@ -443,6 +444,20 @@ static VbResult normal_fire(Client *c, const NormalCmdInfo *info)
return RESULT_ERROR;
}
+static VbResult normal_focus_last_active(Client *c, const NormalCmdInfo *info)
+{
+ GVariant *variant;
+ gboolean focused;
+
+ variant = ext_proxy_eval_script_sync(c, "vimb_input_mode_element.focus();");
+ g_variant_get(variant, "(bs)", &focused);
+ if (!focused) {
+ ext_proxy_focus_input(c);
+ }
+
+ return RESULT_ERROR;
+}
+
static VbResult normal_g_cmd(Client *c, const NormalCmdInfo *info)
{
Arg a;