Thread: [Vimprobable-users] [patch] to escape auto focused inputs on page load
Vimprobable is a lean web browser optimised for full keyboard control
Brought to you by:
hanness
From: Matt C. <je...@gm...> - 2012-01-20 19:28:32
Attachments:
input_focus_clear.patch
|
Hello all, Patch for hinting.js file, not sure if anyone else will find it useful but it escapes auto-focused input fields (such as on google.com) which mess up the current vimprobable2 mode detection (focused input without being in insert mode). -Matt |
From: Hannes S. <ha...@yl...> - 2012-01-20 19:40:13
Attachments:
signature.asc
|
Hello Matt! Matt Carter <je...@gm...> wrote: > Patch for hinting.js file, not sure if anyone else will find it useful > but it escapes auto-focused input fields (such as on google.com) which > mess up the current vimprobable2 mode detection (focused input without > being in insert mode). This is an interesting one. I think there are two options, out of which this is one. The other way would be to actually go to INSERT mode automatically if a form element is focused (which would mean re-introducing focus watchers in some limited way). Everyone - which behaviour is preferable? Hannes |
From: Hans-Peter D. <hpd...@gm...> - 2012-01-20 22:07:22
|
On 20:40 Fri 20 Jan , Hannes Schüller wrote: > Hello Matt! > > Matt Carter <je...@gm...> wrote: > > Patch for hinting.js file, not sure if anyone else will find it useful > > but it escapes auto-focused input fields (such as on google.com) which > > mess up the current vimprobable2 mode detection (focused input without > > being in insert mode). > > This is an interesting one. I think there are two options, out of which > this is one. The other way would be to actually go to INSERT mode > automatically if a form element is focused (which would mean > re-introducing focus watchers in some limited way). > > Everyone - which behaviour is preferable? I don't really know. But I think Hut is right, it should be consistent with the cursor. Interestingly, Pentadactyl and Vimperator seem to differ on this one. Pentadactyl doesn't focus the input field and Vimperator does. -- HP |
From: Jason R. <jas...@gm...> - 2012-01-20 22:23:38
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 21/01/12 11:08, Hans-Peter Deifel wrote: > On 20:40 Fri 20 Jan , Hannes Schüller wrote: >> Hello Matt! >> >> Matt Carter <je...@gm...> wrote: >>> Patch for hinting.js file, not sure if anyone else will find it useful >>> but it escapes auto-focused input fields (such as on google.com) which >>> mess up the current vimprobable2 mode detection (focused input without >>> being in insert mode). >> >> This is an interesting one. I think there are two options, out of which >> this is one. The other way would be to actually go to INSERT mode >> automatically if a form element is focused (which would mean >> re-introducing focus watchers in some limited way). >> >> Everyone - which behaviour is preferable? > > I don't really know. But I think Hut is right, it should be consistent > with the cursor. > Agreed. /J -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQEcBAEBAgAGBQJPGelhAAoJEEReUuqxvU5AM+UH/0wn4t0kkBqkGlGlkj9keNvr SSZdcJah3pQMoIJG5nIeAJmCqun72ud3N0HnxA9GOcNLlOrvEa1l5FtvA01LKk7p zk+CIVnvkbWZE0qEbVIVlBzYvLBOavB4q8O/4PI2ws+TSaERu/oyobW8qS9W75ze M7aru40T63AGJocylBlNL4XWoEWxXU6HZpFysW9w5H2cRdb4/GTeHTeVCMBfC3Cu wIHsW2PDGqVc+Ae2X0btbFEk9pMY8Vu8/vKB0HnzE4JIUfXT72fE79C+7/ZQilY2 UNzgHPPk2eVmoM/05soUiabT3UMYFtlB4xeR0mSLLPcJyVlRjWAKtaz63bnbMzQ= =tA5M -----END PGP SIGNATURE----- |
From: Hut <hu...@la...> - 2012-01-20 21:19:13
|
> Hello Matt! > > Matt Carter <je...@gm...> wrote: > > Patch for hinting.js file, not sure if anyone else will find it useful > > but it escapes auto-focused input fields (such as on google.com) which > > mess up the current vimprobable2 mode detection (focused input without > > being in insert mode). > > This is an interesting one. I think there are two options, out of which > this is one. The other way would be to actually go to INSERT mode > automatically if a form element is focused (which would mean > re-introducing focus watchers in some limited way). > > Everyone - which behaviour is preferable? > > Hannes > I still don't get why we need an INSERT mode at all. I would prefer that all keys are passed to the input field if and only if the cursor in that field is visible/blinking. Now you can be in the INSERT mode without a blinking cursor and you can have a blinking cursor without being in INSERT mode. This makes no sense to me, I would've already changed it if I knew how. Regards, Hut |
From: Hannes S. <ha...@yl...> - 2012-01-20 21:27:14
Attachments:
signature.asc
|
Hut <hu...@la...> wrote: > > Matt Carter <je...@gm...> wrote: > > > Patch for hinting.js file, not sure if anyone else will find it > > > useful but it escapes auto-focused input fields (such as on > > > google.com) which mess up the current vimprobable2 mode detection > > > (focused input without being in insert mode). > > > > This is an interesting one. I think there are two options, out of > > which this is one. The other way would be to actually go to INSERT > > mode automatically if a form element is focused (which would mean > > re-introducing focus watchers in some limited way). > > > > Everyone - which behaviour is preferable? > > I still don't get why we need an INSERT mode at all. I would prefer > that all keys are passed to the input field if and only if the cursor > in that field is visible/blinking. So this is a vote for option 2. Hannes |
From: Matt C. <je...@gm...> - 2012-01-20 21:56:22
|
I personally hate the auto focus of input fields (even on non-vimprobable2 browsers when using Space to scroll down page) as it interrupts my navigation method (keyboard) unless I specifically want to enter the input field (by using hints or gi on vimprobable2). Would adding focus watchers be more or less resource intensive than escaping all inputs on page load? My patch could probably be tweaked so it doesn't do a full 1000 ms timeout (in local testing it seems like 500 may be plenty if not too much). On 1/20/12, Hannes Schüller <ha...@yl...> wrote: > Hut <hu...@la...> wrote: >> > Matt Carter <je...@gm...> wrote: >> > > Patch for hinting.js file, not sure if anyone else will find it >> > > useful but it escapes auto-focused input fields (such as on >> > > google.com) which mess up the current vimprobable2 mode detection >> > > (focused input without being in insert mode). >> > >> > This is an interesting one. I think there are two options, out of >> > which this is one. The other way would be to actually go to INSERT >> > mode automatically if a form element is focused (which would mean >> > re-introducing focus watchers in some limited way). >> > >> > Everyone - which behaviour is preferable? >> >> I still don't get why we need an INSERT mode at all. I would prefer >> that all keys are passed to the input field if and only if the cursor >> in that field is visible/blinking. > > So this is a vote for option 2. > > Hannes > |
From: Hannes S. <ha...@yl...> - 2012-01-20 22:06:57
Attachments:
signature.asc
|
Matt Carter <je...@gm...> wrote: > I personally hate the auto focus of input fields [...] > > Would adding focus watchers be more or less resource intensive than > escaping all inputs on page load? It would give control to the website (as other browsers do it), i.e. focus the specified input field and enter INPUT mode. Personally, I agree that this is intrusive and annoying, but again, this is how the website intended it and how other browsers handle it. Your patch, on the other hand, gives control to the user. Might be preferable since we generally *do* strive to give as much power to the user as possible. Hannes |
From: Matthew C. <je...@gm...> - 2012-01-21 04:07:55
Attachments:
escape_input_on_load.patch
|
Hello all, I believe I have a much better version of patch attached (and someone who knows more of vimprobable2 could probably write it even better). I removed the change to hinting.js as behavior was not consistent if the page took more than 1000ms to render and instead added to the webview_load_finished_cb, where behavior seems much more consistent. Find patch attached. -Matt On Fri, Jan 20, 2012 at 11:06:54PM +0100, Hannes Schüller wrote: > Matt Carter <je...@gm...> wrote: > > I personally hate the auto focus of input fields [...] > > > > Would adding focus watchers be more or less resource intensive than > > escaping all inputs on page load? > > It would give control to the website (as other browsers do it), i.e. > focus the specified input field and enter INPUT mode. Personally, I > agree that this is intrusive and annoying, but again, this is how the > website intended it and how other browsers handle it. > > Your patch, on the other hand, gives control to the user. Might be > preferable since we generally *do* strive to give as much power to the > user as possible. > > Hannes > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Vimprobable-users mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vimprobable-users -- Matthew Carter je...@gm... |
From: Daniel C. <dan...@gm...> - 2012-02-11 21:59:18
Attachments:
signature.asc
|
Hi! On Fri, Jan 20, 2012 at 11:06:54PM +0100, Hannes Schüller wrote: > Matt Carter <je...@gm...> wrote: > > I personally hate the auto focus of input fields [...] > > > > Would adding focus watchers be more or less resource intensive than > > escaping all inputs on page load? > > It would give control to the website (as other browsers do it), i.e. > focus the specified input field and enter INPUT mode. Personally, I > agree that this is intrusive and annoying, but again, this is how the > website intended it and how other browsers handle it. > > Your patch, on the other hand, gives control to the user. Might be > preferable since we generally *do* strive to give as much power to the > user as possible. > > Hannes I also don't like the auto focus of input fields and would like to give the user the control about it. At work I'm forced to use a proprietary tracking system which make intensive use of frames and javascript. Sometimes I got pages that force vimprobable to insert mode and also <ESC> doesn't help because some scripts force vimprobable back to insert mode so that no navigation shortcut or 'q' works. I know that this is more a mistake of the used page, but it shows also that the auto focus feature can make vimprobable unusable in some cases. Daniel |
From: Alexander A. <al....@gm...> - 2012-01-21 06:56:39
|
On 20:40 Fri 20 Jan , Hannes Schüller wrote: > Matt Carter <je...@gm...> wrote: > > Patch for hinting.js file, not sure if anyone else will find it useful > > but it escapes auto-focused input fields (such as on google.com) which > > mess up the current vimprobable2 mode detection (focused input without > > being in insert mode). Thank You. Auto-focus input fields is annoying. > This is an interesting one. I think there are two options, out of which > this is one. The other way would be to actually go to INSERT mode > automatically if a form element is focused (which would mean > re-introducing focus watchers in some limited way). > > Everyone - which behaviour is preferable? I prefer first, because it's more predictable and confortable for me. |
From: Matthew C. <je...@gm...> - 2012-01-21 07:21:01
Attachments:
ddgo_and_escip.patch
escape_input_on_load.patch
|
Hello all, My best patch set to date. These two patches do the following: Add toggleable option: set escapeinput=[true|false] With true (default) the following new behavior happens: Any auto-focused inputs are immediately escaped on page load (done inside main.c so it no longer relies on a javascript call). With false the new behavior above is ignored. In both modes, vimprobable2 will now correctly see focused fields and change to "insert mode" so you can type in the highlighted field (finally no more being stuck in an insert box without being in "insert mode"). This also works with any unique website features which put the user into an input box (such as duckduckgo.com's bang syntax box to the right of main search bar) and will properly convert to "insert mode". Lastly, I set the default search engine to duckduckgo (also changed default command bar color to a darker theme). Hannes, hopefully this saved you some work. With these changes I have hopefully resolved some annoyances of vimprobable2 for all. Next up I want to add password saving (possibly just unsecure/plaintext). Has this been done in the past and discarded due to fattening up the code? Also how do I get my name added to LICENSE? :) Thanks, -Matthew Carter On Sat, Jan 21, 2012 at 12:56:29PM +0600, Alexander Aksarin wrote: > On 20:40 Fri 20 Jan , Hannes Schüller wrote: > > Matt Carter <je...@gm...> wrote: > > > Patch for hinting.js file, not sure if anyone else will find it useful > > > but it escapes auto-focused input fields (such as on google.com) which > > > mess up the current vimprobable2 mode detection (focused input without > > > being in insert mode). > Thank You. Auto-focus input fields is annoying. > > > This is an interesting one. I think there are two options, out of which > > this is one. The other way would be to actually go to INSERT mode > > automatically if a form element is focused (which would mean > > re-introducing focus watchers in some limited way). > > > > Everyone - which behaviour is preferable? > I prefer first, because it's more predictable and confortable for me. > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Vimprobable-users mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vimprobable-users -- Matthew Carter je...@gm... |
From: Matthew C. <je...@gm...> - 2012-01-22 18:58:05
Attachments:
escape_input_on_load_v2.patch
|
Hello all, Further testing shows a bug when changing modes that was causing PASS-THROUGH mode to be set when mousing over certain links (not sure how - I guess my lazy coding). I have rewritten the problematic statement and attached is the good patch file for main.c (the old config.h patch file should still be good). Let me know of any bugs you may find if you do try this out. Thanks, -Matt On Sat, Jan 21, 2012 at 02:20:48AM -0500, Matthew Carter wrote: > Hello all, > > My best patch set to date. > > These two patches do the following: > > Add toggleable option: > > set escapeinput=[true|false] > > With true (default) the following new behavior happens: > > Any auto-focused inputs are immediately escaped on page load (done > inside main.c so it no longer relies on a javascript call). > > With false the new behavior above is ignored. > > In both modes, vimprobable2 will now correctly see focused fields > and change to "insert mode" so you can type in the highlighted field > (finally no more being stuck in an insert box without being in "insert > mode"). > > This also works with any unique website features which put the user into an > input box (such as duckduckgo.com's bang syntax box to the right of main > search bar) and will properly convert to "insert mode". > > Lastly, > > I set the default search engine to duckduckgo (also changed default > command bar color to a darker theme). > > Hannes, hopefully this saved you some work. With these changes I have > hopefully resolved some annoyances of vimprobable2 for all. > > Next up I want to add password saving (possibly just unsecure/plaintext). > Has this been done in the past and discarded due to fattening up the code? > > Also how do I get my name added to LICENSE? :) > > Thanks, > -Matthew Carter > > On Sat, Jan 21, 2012 at 12:56:29PM +0600, Alexander Aksarin wrote: > > On 20:40 Fri 20 Jan , Hannes Schüller wrote: > > > Matt Carter <je...@gm...> wrote: > > > > Patch for hinting.js file, not sure if anyone else will find it useful > > > > but it escapes auto-focused input fields (such as on google.com) which > > > > mess up the current vimprobable2 mode detection (focused input without > > > > being in insert mode). > > Thank You. Auto-focus input fields is annoying. > > > > > This is an interesting one. I think there are two options, out of which > > > this is one. The other way would be to actually go to INSERT mode > > > automatically if a form element is focused (which would mean > > > re-introducing focus watchers in some limited way). > > > > > > Everyone - which behaviour is preferable? > > I prefer first, because it's more predictable and confortable for me. > > > > ------------------------------------------------------------------------------ > > Try before you buy = See our experts in action! > > The most comprehensive online learning library for Microsoft developers > > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > > Metro Style Apps, more. Free future releases when you subscribe now! > > http://p.sf.net/sfu/learndevnow-dev2 > > _______________________________________________ > > Vimprobable-users mailing list > > Vim...@li... > > https://lists.sourceforge.net/lists/listinfo/vimprobable-users > > -- > Matthew Carter > je...@gm... > diff --git a/config.h b/config.h > index b2f8e78..0e8ef4f 100644 > --- a/config.h > +++ b/config.h > @@ -28,8 +28,8 @@ char sslcolor[MAX_SETTING_SIZE] = "#000000"; /* color for sta > > /* normal, warning, error */ > static const char *urlboxfont[] = { "monospace normal 8", "monospace normal 8", "monospace bold 8"}; > -static const char *urlboxcolor[] = { NULL, "#ff0000", "#ffffff" }; > -static const char *urlboxbgcolor[] = { NULL, NULL, "#ff0000" }; > +static const char *urlboxcolor[] = { "#ffffff", "#ff0000", "#ffffff" }; > +static const char *urlboxbgcolor[] = { "#222222", NULL, "#ff0000" }; > > /* normal, error */ > static const char *completionfont[] = { "monospace normal 8", "monospace bold 8" }; > @@ -82,13 +82,14 @@ gboolean complete_case_sensitive = TRUE; > > /* search engines */ > static Searchengine searchengines[] = { > + { "d", "http://duckduckgo.com/?q=%s" }, > { "i", "http://ixquick.com/do/metasearch.pl?query=%s" }, > { "s", "https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw=%s" }, > { "w", "https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Special%%3ASearch&search=%s&go=Go" }, > { "wd", "https://secure.wikimedia.org/wikipedia/de/w/index.php?title=Special%%3ASearch&search=%s&go=Go" }, > }; > > -static char defaultsearch[MAX_SETTING_SIZE] = "i"; > +static char defaultsearch[MAX_SETTING_SIZE] = "d"; > > /* command mapping */ > Command commands[COMMANDSIZE] = { > @@ -185,4 +186,5 @@ static Setting browsersettings[] = { > { "statusbar", NULL, "", FALSE, TRUE, FALSE, FALSE }, > { "inputbox", NULL, "", FALSE, TRUE, FALSE, FALSE }, > { "completioncase", NULL, "", FALSE, TRUE, FALSE, FALSE }, > + { "escapeinput", NULL, "", FALSE, TRUE, FALSE, FALSE }, > }; > diff --git a/main.c b/main.c > index f106245..fe21823 100644 > --- a/main.c > +++ b/main.c > @@ -6,6 +6,7 @@ > (c) 2010-2011 by Thomas Adam > (c) 2011 by Albert Kim > (c) 2011 by Daniel Carl > + (c) 2012 by Matthew Carter > see LICENSE file > */ > > @@ -141,6 +142,8 @@ static char followTarget[8] = ""; > char *error_msg = NULL; > char *config_base = NULL; > > +static gboolean escape_input_on_load = TRUE; > + > GList *activeDownloads; > > #include "config.h" > @@ -214,6 +217,14 @@ webview_load_committed_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointe > > void > webview_load_finished_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointer user_data) { > + if(escape_input_on_load) { > + Arg a = { .i = Silent, .s = g_strdup("hints.clearFocus();") }; > + script(&a); > + g_free(a.s); > + a.i = ModeNormal; > + a.s = NULL; > + set(&a); > + } > if (HISTORY_MAX_ENTRIES > 0) > history(); > update_state(); > @@ -638,7 +649,16 @@ notify_event_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { > Arg a = { .i = ModeNormal }; > set(&a); > } > - } > + } else { > + gchar *value = NULL, *message = NULL; > + jsapi_evaluate_script("window.getSelection().focusNode", &value, &message); > + Arg a; > + if(!strcmp(value, "[object HTMLFormElement]")) > + a.i = ModeInsert; > + g_free(value); > + g_free(message); > + set(&a); > + } > return FALSE; > } > > @@ -1921,7 +1941,9 @@ process_set_line(char *line) { > gtk_widget_set_visible(GTK_WIDGET(statusbar), boolval); > } else if (strlen(my_pair.what) == 8 && strncmp("inputbox", my_pair.what, 8) == 0) { > gtk_widget_set_visible(inputbox, boolval); > - } > + } else if (strlen(my_pair.what) == 11 && strncmp("escapeinput", my_pair.what, 11) == 0) { > + escape_input_on_load = boolval; > + } > > /* reload page? */ > if (browsersettings[i].reload) -- Matthew Carter je...@gm... |
From: Hannes S. <ha...@yl...> - 2012-02-28 11:39:49
Attachments:
signature.asc
|
Merged this version (minus the configuration changes) and added man page documentation. Matthew Carter <je...@gm...> wrote: > Also how do I get my name added to LICENSE? :) Done :) Hannes |
From: Hannes S. <ha...@yl...> - 2012-02-28 14:07:44
Attachments:
signature.asc
|
By the way, not that it really concerns me (having Javascript disabled anyway), but these focus events are still quite annoying. For example: - Open a website with such a focus event - While the site is still loading, launch a command (e.g. / or :) - Wait for the site to finish loading With the current code, the browser will first focus the input bar (due to the user command), then the site will grab focus for its prefered input element and then, the browser will take focus away from that again. However, then, nothing is focused when it really *should* be the input bar. The much cleaner (and, to be honest, only really sane) solution would be to prevent the site from executing its malicious focus stealing in the first place. No idea how to achieve this, though. Hannes |