Re: [Vimprobable-users] [Patches] New hint modes
Vimprobable is a lean web browser optimised for full keyboard control
Brought to you by:
hanness
|
From: Hans-Peter D. <hpd...@gm...> - 2011-10-04 22:10:53
|
Hi,
On 14:38 Sat 01 Oct , Hannes Schüller wrote:
> Hi,
>
> this is the next iteration of my patch for additional hinting modes. It
> includes the following functionality:
>
> - ;s to save a link's destination
> - ;y to yank its destination location
> - ;o to open its location in the current window
> - ;t or ;w to open its location in a new window
> - ;O to generate an :open with hint's URL (like O)
> - ;T or ;W to generate a :tabopen with hint's URL (like T)
>
> Meaning: I took the semicolon hint modes from Vimperator which make
> sense in our own setup.
Seems to work fine, nice work!
Just a small suggestion:
> + { 0, 0, GDK_semicolon, input, {.s = ";"} },
> + { GDK_SHIFT_MASK, 0, GDK_semicolon, input, {.s = ";"} },
[...]
> + case ';':
> + a.s = NULL;
> + switch (text[1]) {
> + case 's':
> + a.s = g_strconcat("hints.createHints('", text + 2, "', 's');", NULL);
> + break;
> + case 'y':
> + a.s = g_strconcat("hints.createHints('", text + 2, "', 'y');", NULL);
> + break;
> + case 'o':
> + a.s = g_strconcat("hints.createHints('", text + 2, "', 'f');", NULL);
> + break;
> + case 't': case 'w':
> + a.s = g_strconcat("hints.createHints('", text + 2, "', 'F');", NULL);
> + break;
> + case 'O': case 'T': case 'W':
> + a.s = g_strconcat("hints.createHints('", text + 2, "', 'O');", NULL);
> + break;
> + }
> + break;
I don't really like hardcoded key bindings, it should be possible for the
user to change them. I propose a solution along the lines of:
{ 0, GDK_semicolon, GDK_s, input, {.s = ";s"} }
This would make the key binding completely configurable while allowing
us to keep the internal ";s" logic. Unfortunately "input" is (AFAIK)
currently not mappable, which means that you still can't change these
bindings from vimprobablerc. That could easily be implemented, though.
One problem of this approach is, that what the user types and what gets
inserted into the input box could differ, e.g. if she mapped ";f" to
input(";s"). That probably doesn't conform to the Principle Of Least
Surprise ;)
Regards,
HP
|