vimprobable-users Mailing List for Vimprobable (Page 18)
Vimprobable is a lean web browser optimised for full keyboard control
Brought to you by:
hanness
You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(77) |
Sep
(44) |
Oct
(43) |
Nov
(38) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(40) |
Feb
(18) |
Mar
(12) |
Apr
(25) |
May
(12) |
Jun
(13) |
Jul
(17) |
Aug
(3) |
Sep
(20) |
Oct
(42) |
Nov
(9) |
Dec
(2) |
2013 |
Jan
(9) |
Feb
(29) |
Mar
(9) |
Apr
(7) |
May
(38) |
Jun
|
Jul
(7) |
Aug
|
Sep
(5) |
Oct
(10) |
Nov
(11) |
Dec
(1) |
2014 |
Jan
(16) |
Feb
(18) |
Mar
(11) |
Apr
(5) |
May
(13) |
Jun
(5) |
Jul
(5) |
Aug
(7) |
Sep
(30) |
Oct
|
Nov
|
Dec
(26) |
2015 |
Jan
(5) |
Feb
(19) |
Mar
(8) |
Apr
(15) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(16) |
Dec
(10) |
2016 |
Jan
|
Feb
(1) |
Mar
(14) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Hannes S. <ha...@yl...> - 2012-08-16 20:32:46
|
Hi, following an issue report on IRC, I figured it was time for a new release, merging some mature patches. - Opening new windows through Javascript (Hannes Schueller, ticket #6) - New configuration for setting default window size (Morgan Howe) - Handling of XEmbed winids given in hexadecimal format (Matto Fransen) The other open patches will be merged as their issues are worked out (meaning: I really need to work on some more). Hannes |
From: Hannes S. <ha...@yl...> - 2012-08-16 20:05:07
|
Morgan Howe writes: > I've created a simple patch to allow setting the default window size > in the vimprobablerc. I don't know if this is how you would prefer to > handle this issue or not, but it works for me. Please CC me as I am > not subscribed to this list. Patch merged. Thank you! Hannes |
From: Hannes S. <ha...@yl...> - 2012-08-16 19:57:39
|
Hannes Schüller writes: > Hans-Peter Deifel writes: >> I haven't read the documentation for this, but doesn't "new_view" have >> to be destroyed somewhere? Otherwise you'll be leaking memory. > > Here is a revised version of the patch (also with decent comments). This version has been merged. Hannes |
From: Jason R. <jas...@gm...> - 2012-07-22 20:59:04
|
On 22/07/12 at 03:16pm, Hannes Schüller wrote: > Agreed. My plan for this patch is this: > > - Have the editor command defined in a way like the external protocol > handlers are (whether this will need to be run through :set will need > to be decided; I'd say it's a fairly static setting). FWIW, I haven't touched the external protocol handler since setting it up; I imagine the same would apply to $editor, I wouldn't expect to change it at runtime. Cheers, /J -- http://jasonwryan.com/ [GnuPG Key: B1BD4E40] |
From: Hannes S. <ha...@yl...> - 2012-07-22 13:17:31
|
Agreed. My plan for this patch is this: - Have the editor command defined in a way like the external protocol handlers are (whether this will need to be run through :set will need to be decided; I'd say it's a fairly static setting). - Use asynchronous spawning; otherwise, some calls will return immediately (after sending the open command to the actual editor) and the browser will think editing is already done. This has to be avoided. Those are the issues I still see right now. Hannes |
From: Daniel C. <dan...@gm...> - 2012-07-22 13:02:44
|
Hi Hannes! This patch is nice! But out of the reasons that also Matthew Carter mentioned this doesn't work if the EDITOR is vim and vimprobable is started via dmenu or as shortcut from tabbed. Until today I expected only cli tools to evaluate the EDITOR environment variable and I set it to vim. For a grafically tool like vimprobable I would preferable launch a grafical editor like gvim. But I'm averse to change the EDITOR to gvim, because I use many tools on cli that evaluates also the EDITOR variable and I don't want them to open gvim. Wouldn't it be a compromise to have a configuration for the editor in vimprobablerc and on runtime to set the editor in a way like: set editor="gvim %s"? This would allow the user to easily change the editor and also to launch a cli editor in a way like 'set editor="urxvt -e vim %s"'? If the configuration isn't set a fallback to the $EDITOR would be nice or we set the default value to 'vim' or better 'vi' (is posix conform an on most systems aliased to vim) which should be a good choice for a browser that aims to apply the usage paradigms from vim to a grafically browser. Daniel |
From: Hannes S. <ha...@yl...> - 2012-07-20 18:39:07
|
Raphael Nestler writes: > > I took a look at the per site settings patch, but it didn't apply to > > master cleanly: > > Applying: moving all internal flags into a new global struct of the type > VSettings > > vimprobable/.git/rebase-apply/patch:415: space before tab in indent. > > strncat(temp, file_url, 1); > > vimprobable/.git/rebase-apply/patch:416: space before tab in indent. > > file_url++; > > error: patch failed: config.h:1 > > error: config.h: patch does not apply > > Patch failed at 0001 moving all internal flags into a new global struct of > the type VSettings > > When you have resolved this problem run "git am --resolved". > > If you would prefer to skip this patch, instead run "git am --skip". > > To restore the original branch and stop patching run "git am --abort". > > > > Am I doing something wrong? Or should the patches be rebased to current > master first? > > Never mind that, I saw there is a branch per-site-settings in the > git://git.code.sf.net/p/vimprobable/code repository There is, yes :) Don't worry too much about it for now, though. That patch needs some structural rethinking while yours seems to be welcomed unanimously. You asked for this feedback before continuing - I'd say you got it, everybody's looking forward to it! Hannes |
From: Raphael N. <rne...@hs...> - 2012-07-20 18:30:49
|
> > I took a look at the per site settings patch, but it didn't apply to > master cleanly: > Applying: moving all internal flags into a new global struct of the type VSettings > vimprobable/.git/rebase-apply/patch:415: space before tab in indent. > strncat(temp, file_url, 1); > vimprobable/.git/rebase-apply/patch:416: space before tab in indent. > file_url++; > error: patch failed: config.h:1 > error: config.h: patch does not apply > Patch failed at 0001 moving all internal flags into a new global struct of the type VSettings > When you have resolved this problem run "git am --resolved". > If you would prefer to skip this patch, instead run "git am --skip". > To restore the original branch and stop patching run "git am --abort". > > Am I doing something wrong? Or should the patches be rebased to current master first? Never mind that, I saw there is a branch per-site-settings in the git://git.code.sf.net/p/vimprobable/code repository |
From: Raphael N. <rne...@hs...> - 2012-07-20 17:53:08
|
On Wed, Jul 18, 2012 at 10:15:13PM +0200, Hannes Schüller wrote: > Hello Raphael! > > Raphael Nestler writes: > > I this patch series adds some changes to the browsersettings code. I > > think using a single enum instead of three different booleans is much > > more intuitive. > > It probably is, yes. > > > To be able to use the give_feedback() function I needed to set focus > > to the webview widget, otherwise it wouldn't show anything. I consider > > this a bug, since it also doesn't show anything when entering an > > invalid setting. > > Hm, well, let's say it is an unwanted side-effect. give_feedback() > simply points to echo(). The check there whether the input field is > focused makes perfect sense in my opinion, because otherwise, it might > just overwrite what the user is typing. After confirming a command line, > I agree that feedback should be activated, though. So we need to remove focus from the input field as soon as the command line gets confirmed. Shouldn't this happen automatically by Gtk anyway? > > > The third patch saves the value for boolean settings into the .var field of > > the setting. I need to do this as well for integer settings, but I wanted to > > receive some feedback on the patch in general first. I also thought about > > using > > something like: > > struct { > > ESetingsType type; > > union value { > > char *s; > > int i; > > gboolean b; > > }; > > } > > for the settings to not be forced to save every value as a string. > > I don't know if you're aware, but for the "per site settings" patch, I > made all settings into strings internally intentionally. I don't like > this much, but this seemed to be the easiest way to avoid the code to be > specific for each individual case. Would be interesting to consolidate > with your approach. I took a look at the per site settings patch, but it didn't apply to master cleanly: Applying: moving all internal flags into a new global struct of the type VSettings vimprobable/.git/rebase-apply/patch:415: space before tab in indent. strncat(temp, file_url, 1); vimprobable/.git/rebase-apply/patch:416: space before tab in indent. file_url++; error: patch failed: config.h:1 error: config.h: patch does not apply Patch failed at 0001 moving all internal flags into a new global struct of the type VSettings When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". Am I doing something wrong? Or should the patches be rebased to current master first? Raphael |
From: Raphael N. <rne...@hs...> - 2012-07-20 17:10:26
|
On Thu, Jul 19, 2012 at 11:08:33PM +0200, Daniel Carl wrote: > Raphael Nestler <rne...@hs...> wrote: > > Give the ability to see settings. A command like :set useragent will > > show something like useragent = Vimprobable2/1.03 > > This is a very nice feature I like in vim an wanted it for vimprobable too. I was also used to it from vim and it annoyed me to look into the source to see the default value for an option. Thats why I implemented it. Raphael |
From: Daniel C. <dan...@gm...> - 2012-07-19 21:08:43
|
Raphael Nestler <rne...@hs...> wrote: > Give the ability to see settings. A command like :set useragent will > show something like useragent = Vimprobable2/1.03 This is a very nice feature I like in vim an wanted it for vimprobable too. Daniel |
From: Daniel C. <dan...@gm...> - 2012-07-19 20:58:55
|
Hannes Schüller <ha...@yl...> wrote: > Hello Morgan! > > Morgan Howe writes: > > I've created a simple patch to allow setting the default window size > > in the vimprobablerc. > > Hm, we seem to be getting dangerously close to window manager territory > here. I could see some use for the purpose of testing websites at exact > resolutions, though. Does anyone have an opinion? I use a tailing window manager and the default window size sould not matter. I'm not familiar with the none tailing window managers, but is there a use case where the default window size should be configurable via vimprobablerc? In my opinion it's quite enough to put the default window dimensions into config.h to allow everyone to choose it depending on its system. But I'm not averse to have the possibility to set it in vimprobablerc, even though I don't have any use for that feature. Daniel |
From: Andraž 'r. L. <ru...@co...> - 2012-07-19 18:48:18
|
:2012-07-19T20:27:Hannes Schüller: > Hello Morgan! > > Morgan Howe writes: > > I've created a simple patch to allow setting the default window size > > in the vimprobablerc. > > Hm, we seem to be getting dangerously close to window manager territory > here. I could see some use for the purpose of testing websites at exact > resolutions, though. Does anyone have an opinion? I like having such a setting myself. -- Andraž 'ruskie' Levstik Source Mage GNU/Linux mage Re-Alpine Coordinator http://sourceforge.net/projects/re-alpine/ Geek/Hacker/Tinker Don't forget: the future is now. It's just not widely distributed yet. |
From: Hannes S. <ha...@yl...> - 2012-07-19 18:27:24
|
Hello Morgan! Morgan Howe writes: > I've created a simple patch to allow setting the default window size > in the vimprobablerc. Hm, we seem to be getting dangerously close to window manager territory here. I could see some use for the purpose of testing websites at exact resolutions, though. Does anyone have an opinion? Hannes |
From: Morgan H. <mt...@gm...> - 2012-07-19 06:19:25
|
Hi, I've created a simple patch to allow setting the default window size in the vimprobablerc. I don't know if this is how you would prefer to handle this issue or not, but it works for me. Please CC me as I am not subscribed to this list. Regards, Morgan |
From: Hannes S. <ha...@yl...> - 2012-07-18 20:14:57
|
Hello Raphael! Raphael Nestler writes: > I this patch series adds some changes to the browsersettings code. I > think using a single enum instead of three different booleans is much > more intuitive. It probably is, yes. > To be able to use the give_feedback() function I needed to set focus > to the webview widget, otherwise it wouldn't show anything. I consider > this a bug, since it also doesn't show anything when entering an > invalid setting. Hm, well, let's say it is an unwanted side-effect. give_feedback() simply points to echo(). The check there whether the input field is focused makes perfect sense in my opinion, because otherwise, it might just overwrite what the user is typing. After confirming a command line, I agree that feedback should be activated, though. > The third patch saves the value for boolean settings into the .var field of > the setting. I need to do this as well for integer settings, but I wanted to > receive some feedback on the patch in general first. I also thought about > using > something like: > struct { > ESetingsType type; > union value { > char *s; > int i; > gboolean b; > }; > } > for the settings to not be forced to save every value as a string. I don't know if you're aware, but for the "per site settings" patch, I made all settings into strings internally intentionally. I don't like this much, but this seemed to be the easiest way to avoid the code to be specific for each individual case. Would be interesting to consolidate with your approach. Hannes |
From: Raphael N. <rne...@hs...> - 2012-07-18 19:23:45
|
Give the ability to see settings. A command like :set useragent will show something like useragent = Vimprobable2/1.03 --- main.c | 10 ++++++++-- 1 Datei geändert, 8 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-) diff --git a/main.c b/main.c index 0fbe472..56d3dc1 100644 --- a/main.c +++ b/main.c @@ -1894,8 +1894,14 @@ process_set_line(char *line) { for (i = 0; i < listlen; i++) { if (strlen(browsersettings[i].name) == strlen(my_pair.what) && strncmp(browsersettings[i].name, my_pair.what, strlen(my_pair.what)) == 0) { /* mandatory argument not provided */ - if (strlen(my_pair.value) == 0) - return FALSE; + if (strlen(my_pair.value) == 0) { + /* workaround: give_feedback() doesn't show anything if inputbar has user focus */ + gtk_widget_grab_focus(GTK_WIDGET(webview)); + char* info = g_strdup_printf("%s = %s", browsersettings[i].name, browsersettings[i].var); + give_feedback(info); + g_free(info); + return TRUE; + } /* process qmark? */ if (strlen(my_pair.what) == 5 && strncmp("qmark", my_pair.what, 5) == 0) { return (process_save_qmark(my_pair.value, webview)); -- 1.7.11.2 |
From: Raphael N. <rne...@hs...> - 2012-07-18 19:19:21
|
For boolean settings the var field is always null. So we set it to on or off respectively, so it can be displayed probably. --- main.c | 5 ++++- 1 Datei geändert, 4 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/main.c b/main.c index 56d3dc1..0fdc845 100644 --- a/main.c +++ b/main.c @@ -1910,8 +1910,10 @@ process_set_line(char *line) { if (browsersettings[i].type == SettingBool) { if (strncmp(my_pair.value, "on", 2) == 0 || strncmp(my_pair.value, "true", 4) == 0 || strncmp(my_pair.value, "ON", 2) == 0 || strncmp(my_pair.value, "TRUE", 4) == 0) { boolval = TRUE; + browsersettings[i].var = "on"; } else if (strncmp(my_pair.value, "off", 3) == 0 || strncmp(my_pair.value, "false", 5) == 0 || strncmp(my_pair.value, "OFF", 3) == 0 || strncmp(my_pair.value, "FALSE", 5) == 0) { boolval = FALSE; + browsersettings[i].var = "off"; } else { return FALSE; } @@ -1921,7 +1923,8 @@ process_set_line(char *line) { return FALSE; } } - if (browsersettings[i].var != NULL) { + else if (browsersettings[i].type == SettingString || + browsersettings[i].type == SettingColourval) { strncpy(browsersettings[i].var, my_pair.value, MAX_SETTING_SIZE); if (strlen(my_pair.value) > MAX_SETTING_SIZE - 1) { /* in this case, \0 will not have been copied */ -- 1.7.11.2 |
From: Raphael N. <rne...@hs...> - 2012-07-18 19:19:21
|
Hi there I this patch series adds some changes to the browsersettings code. I think using a single enum instead of three different booleans is much more intuitive. To be able to use the give_feedback() function I needed to set focus to the webview widget, otherwise it wouldn't show anything. I consider this a bug, since it also doesn't show anything when entering an invalid setting. The third patch saves the value for boolean settings into the .var field of the setting. I need to do this as well for integer settings, but I wanted to receive some feedback on the patch in general first. I also thought about using something like: struct { ESetingsType type; union value { char *s; int i; gboolean b; }; } for the settings to not be forced to save every value as a string. Raphael Raphael Nestler (3): Use enum instead of booleans for setting type Show setting on set command without value Set setting values also for booleans config.h | 80 +++++++++++++++++++++++++++++------------------------------ main.c | 23 +++++++++++------ vimprobable.h | 11 +++++--- 3 Dateien geändert, 64 Zeilen hinzugefügt(+), 50 Zeilen entfernt(-) -- 1.7.11.2 |
From: Raphael N. <rne...@hs...> - 2012-07-18 19:19:20
|
Since settings have only one type it makes more sense to use an enum instead of three different booleans in the Settings struct. Its also easier to add other setting types when using an enum. Finally one could use a switch statement instead of if/else if constructs. --- config.h | 80 +++++++++++++++++++++++++++++------------------------------ main.c | 8 +++--- vimprobable.h | 11 +++++--- 3 Dateien geändert, 52 Zeilen hinzugefügt(+), 47 Zeilen entfernt(-) diff --git a/config.h b/config.h index 7916a10..c7897c6 100644 --- a/config.h +++ b/config.h @@ -168,44 +168,44 @@ static Mouse mouse[] = { /* settings (arguments of :set command) */ static Setting browsersettings[] = { - /* public name, internal variable webkit setting integer value? boolean value? colour value? reload page? */ - { "useragent", useragent, "user-agent", FALSE, FALSE, FALSE, FALSE }, - { "scripts", NULL, "enable-scripts", FALSE, TRUE, FALSE, FALSE }, - { "plugins", NULL, "enable-plugins", FALSE, TRUE, FALSE, FALSE }, - { "pagecache", NULL, "enable-page-cache", FALSE, TRUE, FALSE, FALSE }, - { "java", NULL, "enable-java-applet", FALSE, TRUE, FALSE, FALSE }, - { "images", NULL, "auto-load-images", FALSE, TRUE, FALSE, FALSE }, - { "shrinkimages", NULL, "auto-shrink-images", FALSE, TRUE, FALSE, FALSE }, - { "cursivefont", NULL, "cursive-font-family", FALSE, FALSE, FALSE, FALSE }, - { "defaultencoding", NULL, "default-encoding", FALSE, FALSE, FALSE, FALSE }, - { "defaultfont", NULL, "default-font-family", FALSE, FALSE, FALSE, FALSE }, - { "fontsize", NULL, "default-font-size", TRUE, FALSE, FALSE, FALSE }, - { "monofontsize", NULL, "default-monospace-font-size", TRUE, FALSE, FALSE, FALSE }, - { "caret", NULL, "enable-caret-browsing", FALSE, TRUE, FALSE, FALSE }, - { "fantasyfont", NULL, "fantasy-font-family", FALSE, FALSE, FALSE, FALSE }, - { "minimumfontsize", NULL, "minimum-font-size", TRUE, FALSE, FALSE, FALSE }, - { "monofont", NULL, "monospace-font-family", FALSE, FALSE, FALSE, FALSE }, - { "backgrounds", NULL, "print-backgrounds", FALSE, TRUE, FALSE, FALSE }, - { "sansfont", NULL, "sans-serif-font-family", FALSE, FALSE, FALSE, FALSE }, - { "seriffont", NULL, "serif-font-family", FALSE, FALSE, FALSE, FALSE }, - { "stylesheet", NULL, "user-stylesheet-uri", FALSE, FALSE, FALSE, FALSE }, - { "resizetextareas", NULL, "resizable-text-areas", FALSE, TRUE, FALSE, FALSE }, - { "webinspector", NULL, "enable-developer-extras", FALSE, TRUE, FALSE, FALSE }, - - { "homepage", startpage, "", FALSE, FALSE, FALSE, FALSE }, - { "statusbgcolor", statusbgcolor, "", FALSE, FALSE, TRUE, TRUE }, - { "statuscolor", statuscolor, "", FALSE, FALSE, TRUE, TRUE }, - { "sslbgcolor", sslbgcolor, "", FALSE, FALSE, TRUE, TRUE }, - { "sslcolor", sslcolor, "", FALSE, FALSE, TRUE, TRUE }, - { "acceptlanguage", acceptlanguage, "", FALSE, FALSE, FALSE, FALSE }, - { "defaultsearch", defaultsearch, "", FALSE, FALSE, FALSE, FALSE }, - { "qmark", NULL, "", FALSE, FALSE, FALSE, FALSE }, - { "proxy", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "scrollbars", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "statusbar", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "inputbox", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "completioncase", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "escapeinput", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "strictssl", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "cabundle", ca_bundle, "", FALSE, FALSE, FALSE, FALSE }, + /* public name, internal variable webkit setting setting type? reload page? */ + { "useragent", useragent, "user-agent", SettingString, FALSE }, + { "scripts", NULL, "enable-scripts", SettingBool, FALSE }, + { "plugins", NULL, "enable-plugins", SettingBool, FALSE }, + { "pagecache", NULL, "enable-page-cache", SettingBool, FALSE }, + { "java", NULL, "enable-java-applet", SettingBool, FALSE }, + { "images", NULL, "auto-load-images", SettingBool, FALSE }, + { "shrinkimages", NULL, "auto-shrink-images", SettingBool, FALSE }, + { "cursivefont", NULL, "cursive-font-family", SettingString, FALSE }, + { "defaultencoding", NULL, "default-encoding", SettingString, FALSE }, + { "defaultfont", NULL, "default-font-family", SettingString, FALSE }, + { "fontsize", NULL, "default-font-size", SettingInt, FALSE }, + { "monofontsize", NULL, "default-monospace-font-size", SettingInt, FALSE }, + { "caret", NULL, "enable-caret-browsing", SettingBool, FALSE }, + { "fantasyfont", NULL, "fantasy-font-family", SettingString, FALSE }, + { "minimumfontsize", NULL, "minimum-font-size", SettingInt, FALSE }, + { "monofont", NULL, "monospace-font-family", SettingString, FALSE }, + { "backgrounds", NULL, "print-backgrounds", SettingBool, FALSE }, + { "sansfont", NULL, "sans-serif-font-family", SettingString, FALSE }, + { "seriffont", NULL, "serif-font-family", SettingString, FALSE }, + { "stylesheet", NULL, "user-stylesheet-uri", SettingString, FALSE }, + { "resizetextareas", NULL, "resizable-text-areas", SettingBool, FALSE }, + { "webinspector", NULL, "enable-developer-extras", SettingBool, FALSE }, + + { "homepage", startpage, "", SettingString, FALSE }, + { "statusbgcolor", statusbgcolor, "", SettingColourval, TRUE }, + { "statuscolor", statuscolor, "", SettingColourval, TRUE }, + { "sslbgcolor", sslbgcolor, "", SettingColourval, TRUE }, + { "sslcolor", sslcolor, "", SettingColourval, TRUE }, + { "acceptlanguage", acceptlanguage, "", SettingString, FALSE }, + { "defaultsearch", defaultsearch, "", SettingString, FALSE }, + { "qmark", NULL, "", SettingString, FALSE }, + { "proxy", NULL, "", SettingBool, FALSE }, + { "scrollbars", NULL, "", SettingBool, FALSE }, + { "statusbar", NULL, "", SettingBool, FALSE }, + { "inputbox", NULL, "", SettingBool, FALSE }, + { "completioncase", NULL, "", SettingBool, FALSE }, + { "escapeinput", NULL, "", SettingBool, FALSE }, + { "strictssl", NULL, "", SettingBool, FALSE }, + { "cabundle", ca_bundle, "", SettingString, FALSE }, }; diff --git a/main.c b/main.c index 20a9925..0fbe472 100644 --- a/main.c +++ b/main.c @@ -1901,7 +1901,7 @@ process_set_line(char *line) { return (process_save_qmark(my_pair.value, webview)); } /* interpret boolean values */ - if (browsersettings[i].boolval) { + if (browsersettings[i].type == SettingBool) { if (strncmp(my_pair.value, "on", 2) == 0 || strncmp(my_pair.value, "true", 4) == 0 || strncmp(my_pair.value, "ON", 2) == 0 || strncmp(my_pair.value, "TRUE", 4) == 0) { boolval = TRUE; } else if (strncmp(my_pair.value, "off", 3) == 0 || strncmp(my_pair.value, "false", 5) == 0 || strncmp(my_pair.value, "OFF", 3) == 0 || strncmp(my_pair.value, "FALSE", 5) == 0) { @@ -1909,7 +1909,7 @@ process_set_line(char *line) { } else { return FALSE; } - } else if (browsersettings[i].colourval) { + } else if (browsersettings[i].type == SettingColourval) { /* interpret as hexadecimal colour */ if (!parse_colour(my_pair.value)) { return FALSE; @@ -1927,9 +1927,9 @@ process_set_line(char *line) { } if (strlen(browsersettings[i].webkit) > 0) { /* activate appropriate webkit setting */ - if (browsersettings[i].boolval) { + if (browsersettings[i].type == SettingBool) { g_object_set((GObject*)settings, browsersettings[i].webkit, boolval, NULL); - } else if (browsersettings[i].intval) { + } else if (browsersettings[i].type == SettingInt) { g_object_set((GObject*)settings, browsersettings[i].webkit, atoi(my_pair.value), NULL); } else { g_object_set((GObject*)settings, browsersettings[i].webkit, my_pair.value, NULL); diff --git a/vimprobable.h b/vimprobable.h index 5a6c2df..fdfab8b 100644 --- a/vimprobable.h +++ b/vimprobable.h @@ -117,13 +117,18 @@ typedef struct { const Arg arg; } Mouse; +typedef enum { + SettingInt, + SettingBool, + SettingColourval, + SettingString +}ESettingType; + typedef struct { char *name; char (*var); char *webkit; - gboolean intval; - gboolean boolval; - gboolean colourval; + ESettingType type; gboolean reload; } Setting; -- 1.7.11.2 |
From: Hannes S. <ha...@yl...> - 2012-06-30 08:26:09
|
Hannes Schüller writes: > Jason Ryan writes: >> On 30/06/12 at 12:15am, Matthew Carter wrote: >> > Initial testing on Arch Linux (up to date). >> > >> > Code failed to compile, required changing the following on 1825: >> > >> > time_t id = time() >> > >> > to >> > >> > time_t id = time(NULL) >> > >> > Not sure if that is specific to my machine or what. >> > >> Confirmed here. > > Please use the second version of the patch which should address this. The joke's on me, of course. For some reason, I seem to have attached the same patch twice yesterday. Sorry. This is the mysterious "second version". Hannes |
From: Hannes S. <ha...@yl...> - 2012-06-30 08:12:33
|
Jason Ryan writes: > On 30/06/12 at 12:15am, Matthew Carter wrote: > > Initial testing on Arch Linux (up to date). > > > > Code failed to compile, required changing the following on 1825: > > > > time_t id = time() > > > > to > > > > time_t id = time(NULL) > > > > Not sure if that is specific to my machine or what. > > > Confirmed here. Please use the second version of the patch which should address this. Hannes |
From: Jason R. <jas...@gm...> - 2012-06-30 04:53:06
|
On 30/06/12 at 12:15am, Matthew Carter wrote: > Hi all, > > Initial testing on Arch Linux (up to date). > > Code failed to compile, required changing the following on 1825: > > time_t id = time() > > to > > time_t id = time(NULL) > > Not sure if that is specific to my machine or what. > Confirmed here. > Test results with 'vim' as $EDITOR: > > Calling vimprobable2 from the CLI causes it to properly pull up vim and > take the text into the input after saving with :x > > Calling from a menu (dmenu) does nothing (no terminal is brought up with > vim loaded). > Also confirmed, although I start the browser from a keybind in dwm > Test results with 'gvim' as $EDITOR: > > Editor pulls up fine in both cases, however text is never sent back to > the input field. I changed $EDITOR to leafpad and it worked as expected only after saving the file to /tmp Also, this functionality is very cool - thanks Hannes. /J -- http://jasonwryan.com/ [GnuPG Key: B1BD4E40] |
From: Matthew C. <je...@gm...> - 2012-06-30 04:16:04
|
Hi all, Initial testing on Arch Linux (up to date). Code failed to compile, required changing the following on 1825: time_t id = time() to time_t id = time(NULL) Not sure if that is specific to my machine or what. Test results with 'vim' as $EDITOR: Calling vimprobable2 from the CLI causes it to properly pull up vim and take the text into the input after saving with :x Calling from a menu (dmenu) does nothing (no terminal is brought up with vim loaded). Test results with 'gvim' as $EDITOR: Editor pulls up fine in both cases, however text is never sent back to the input field. -Matt On Fri, Jun 29, 2012 at 07:32:21PM +0200, Hannes Schüller wrote: > Sorry, here is already another one: This escapes quotation marks > correctly (hopefully). It supersedes the previous patch. > > Hannes > > diff --git a/keymap.h b/keymap.h > index 7ba5d0b..86aea55 100644 > --- a/keymap.h > +++ b/keymap.h > @@ -114,6 +114,9 @@ Key keys[] = { > { 0, GDK_semicolon, GDK_T, input, {.s = ";T"} }, > { 0, GDK_semicolon, GDK_W, input, {.s = ";W"} }, > > + /* this needs to be a binding using CTRL for obvious reasons */ > + { GDK_CONTROL_MASK, 0, GDK_t, open_editor,{} }, > + > { 0, GDK_VoidSymbol, GDK_Escape, set, {ModeNormal} }, > { GDK_CONTROL_MASK, GDK_VoidSymbol, GDK_bracketleft,set, {ModeNormal} }, > { GDK_CONTROL_MASK, 0, GDK_z, set, {ModePassThrough} }, > diff --git a/main.c b/main.c > index 20a9925..810455c 100644 > --- a/main.c > +++ b/main.c > @@ -59,6 +59,7 @@ static gboolean complete(const Arg *arg); > static gboolean descend(const Arg *arg); > gboolean echo(const Arg *arg); > static gboolean focus_input(const Arg *arg); > +static gboolean open_editor(const Arg *arg); > static gboolean input(const Arg *arg); > static gboolean navigate(const Arg *arg); > static gboolean number(const Arg *arg); > @@ -419,6 +420,9 @@ webview_keypress_cb(WebKitWebView *webview, GdkEventKey *event) { > g_free(a.s); > a.i = ModeNormal; > return set(&a); > + } else if (CLEAN(event->state) & GDK_CONTROL_MASK) { > + /* keybindings of non-printable characters */ > + if (process_keypress(event) == TRUE) return TRUE; > } > case ModePassThrough: > if (IS_ESCAPE(event)) { > @@ -1809,6 +1813,112 @@ view_source(const Arg * arg) { > } > > static gboolean > +open_editor(const Arg *arg) { > + char *editor, *type, *text = NULL, *tempfile, *argv[2], s[255] = "", idstr[64] = ""; > + FILE *fp; > + gboolean success; > + GString *new_text = g_string_new(""); > + time_t id = time(); > + gchar *value = NULL, *message = NULL, *tag = NULL, *command = NULL; > + > + /* check if $EDITOR is set */ > + if (getenv("EDITOR")) > + editor = g_strdup_printf("%s", getenv("EDITOR")); > + else > + return FALSE; > + > + /* check if active element is suitable for text editing */ > + jsapi_evaluate_script("document.activeElement.tagName", &value, &message); > + if (value == NULL) > + return FALSE; > + tag = g_strdup(value); > + if (strcmp(tag, "INPUT") == 0) { > + /* extra check: type == text */ > + jsapi_evaluate_script("document.activeElement.type", &value, &message); > + if (strcmp(value, "text") != 0) { > + g_free(value); > + g_free(message); > + return FALSE; > + } > + } else if (strcmp(tag, "TEXTAREA") != 0) { > + g_free(value); > + g_free(message); > + return FALSE; > + } > + jsapi_evaluate_script("document.activeElement.value", &value, &message); > + text = g_strdup(value); > + if (text == NULL) { > + g_free(value); > + g_free(message); > + return FALSE; > + } > + > + /* write text into temporary file */ > + tempfile = g_strdup_printf(TEMPFILE); > + sprintf(idstr, "%d", id); > + tempfile = g_strconcat(tempfile, ".", idstr); > + fp = fopen(tempfile, "w"); > + if (fp == NULL) { > + g_free(value); > + g_free(message); > + g_free(text); > + return FALSE; > + } > + if (fputs(text, fp) < 0) { > + g_free(value); > + g_free(message); > + g_free(text); > + return FALSE; > + } > + fclose(fp); > + g_free(text); > + > + /* spawn editor */ > + command = g_strconcat(editor, " ", tempfile, NULL); > + success = g_spawn_command_line_sync(command, NULL, NULL, NULL, NULL); > + if (!success) { > + g_free(value); > + g_free(message); > + return FALSE; > + } > + > + /* re-read the new contents of the file and put it into the HTML element */ > + if (!access(tempfile, R_OK) == 0) { > + g_free(value); > + g_free(message); > + return FALSE; > + } > + fp = fopen(tempfile, "r"); > + if (fp == NULL) { > + g_free(value); > + g_free(message); > + return FALSE; > + } > + jsapi_evaluate_script("document.activeElement.value = '';", &value, &message); > + new_text = g_string_append(new_text, "\""); > + while (fgets(s, 254, fp)) { > + if (s[strlen(s)-1] == '\n') { > + /* encode line breaks into the string as Javascript does not like actual line breaks */ > + new_text = g_string_append_len(new_text, s, strlen(s) - 1); > + new_text = g_string_append(new_text, "\\n"); > + } else { > + new_text = g_string_append(new_text, s); > + } > + } > + new_text = g_string_append(new_text, "\""); > + fclose(fp); > + jsapi_evaluate_script(g_strconcat("document.activeElement.value = ", new_text->str, ";", NULL), &value, &message); > + > + /* done */ > + g_string_free(new_text, TRUE); > + g_free(value); > + g_free(message); > + g_free(tag); > + remove(tempfile); > + return TRUE; > +} > + > +static gboolean > focus_input(const Arg *arg) { > static Arg a; > > diff --git a/vimprobable.h b/vimprobable.h > index 5a6c2df..e2c647e 100644 > --- a/vimprobable.h > +++ b/vimprobable.h > @@ -181,6 +181,9 @@ enum ConfigFileError { > #define HISTORY_STORAGE_FILENAME "%s/vimprobable/history", config_base > #define CLOSED_URL_FILENAME "%s/vimprobable/closed", config_base > > +/* external editor - temporary file */ > +#define TEMPFILE "/tmp/vimprobable_edit" > + > /* Command size */ > #define COMMANDSIZE 1024 > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Vimprobable-users mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vimprobable-users -- Matthew Carter je...@gm... |
From: Hannes S. <ha...@yl...> - 2012-06-29 17:32:09
|
Sorry, here is already another one: This escapes quotation marks correctly (hopefully). It supersedes the previous patch. Hannes |