From eiwe at reliantsecurity.com Mon Apr 12 17:10:13 2010 From: eiwe at reliantsecurity.com (Eiwe Lingefors) Date: Mon, 12 Apr 2010 13:10:13 -0400 (EDT) Subject: [Vimprobable-users] Testing Message-ID: Test -- Eiwe Lingefors Chief Security Architect From eiwe at reliantsecurity.com Mon Apr 12 17:19:57 2010 From: eiwe at reliantsecurity.com (Eiwe Lingefors) Date: Mon, 12 Apr 2010 13:19:57 -0400 (EDT) Subject: [Vimprobable-users] Testing Message-ID: Test -- Eiwe Lingefors Chief Security Architect From akosmin at reliantsec.net Wed Apr 14 17:13:42 2010 From: akosmin at reliantsec.net (Adam Kosmin) Date: Wed, 14 Apr 2010 13:13:42 -0400 Subject: [Vimprobable-users] Hello Message-ID: <20100414171342.GD767@windowsrefund.info> /me waves From hannes at yllr.net Thu Apr 15 08:34:05 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Thu, 15 Apr 2010 10:34:05 +0200 Subject: [Vimprobable-users] Hello In-Reply-To: <20100414171342.GD767@windowsrefund.info> References: <20100414171342.GD767@windowsrefund.info> Message-ID: <20100415083404.GC21598@laptop2> Hello Adam! On Wed, Apr 14, 2010 at 01:13:42PM -0400, Adam Kosmin wrote: > /me waves Welcome to the list! To answer the question nagging you in the back of your head: You can use git log to see the changes between the versions ;) Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From akosmin at reliantsec.net Thu Apr 15 15:48:29 2010 From: akosmin at reliantsec.net (Adam Kosmin) Date: Thu, 15 Apr 2010 11:48:29 -0400 Subject: [Vimprobable-users] Hello In-Reply-To: <20100415083404.GC21598@laptop2> References: <20100414171342.GD767@windowsrefund.info> <20100415083404.GC21598@laptop2> Message-ID: <20100415154829.GA4808@windowsrefund.info> Words by Hannes Sch?ller [Thu, Apr 15, 2010 at 10:34:05AM +0200]: >Hello Adam! > >On Wed, Apr 14, 2010 at 01:13:42PM -0400, Adam Kosmin wrote: >> /me waves > >Welcome to the list! To answer the question nagging you in the back of >your head: You can use git log to see the changes between the versions >;) > >Hannes Hannes, Would it be possible to publish tarballs? I often find myself on machines where the git binary does not support -b Best, Adam >_______________________________________________ >Vimprobable-users mailing list >Vimprobable-users at vimprobable.org >http://vimprobable.org/mailman/listinfo/vimprobable-users -- Adam Kosmin Senior Security Engineer Reliant Security (212) 917-2200 x1275 "Don't take the name of root in vain." - /usr/src/linux/README From hannes at yllr.net Thu Apr 15 17:50:20 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Thu, 15 Apr 2010 19:50:20 +0200 Subject: [Vimprobable-users] Tarballs In-Reply-To: <20100415154829.GA4808@windowsrefund.info> References: <20100414171342.GD767@windowsrefund.info> <20100415083404.GC21598@laptop2> <20100415154829.GA4808@windowsrefund.info> Message-ID: <20100415195020.77e24f12@workstation> Adam Kosmin wrote: > Words by Hannes Sch?ller [Thu, Apr 15, 2010 at 10:34:05AM +0200]: > >Hello Adam! > > > >On Wed, Apr 14, 2010 at 01:13:42PM -0400, Adam Kosmin wrote: > >> /me waves > > > >Welcome to the list! To answer the question nagging you in the back > >of your head: You can use git log to see the changes between the > > Would it be possible to publish tarballs? I often find myself on > machines where the git binary does not support -b Hmm... Eiwe, do you think you could set up a cron job on the webserver which exports each branch into some static tarball each night or so? Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From rnestler at hsr.ch Wed Apr 21 22:25:03 2010 From: rnestler at hsr.ch (Raphael Nestler) Date: Thu, 22 Apr 2010 00:25:03 +0200 Subject: [Vimprobable-users] gt/gT patch for better tabbed integration Message-ID: <20100421222503.GA8664@tuxpad.hsr.ch> Hi vimprobable-users Attached you will find a "quick&dirty" solution for a better integration of vimprobable in tabbed. My target was to change between tabs with 'gt' and 'gT'. To achieve this I call the "xdotool" which sends the needed keystrokes to tabbed. The reason I haven't implemented this functionality in tabbed itself is, that the meaning of gt/gT is mode dependant. I.e. you don't want to change tabs with gt when you're in input-mode. I think there should be better ways to send something back to tabbed then via the "xdotool", anyway I'm looking forward to receive some feedback on this patch. Regards, Raphael -------------- next part -------------- diff --git a/config.h b/config.h index cad493e..5816875 100644 --- a/config.h +++ b/config.h @@ -103,6 +103,8 @@ static Key keys[] = { { 0, GDK_q, GDK_9, quickmark, { .s = "9" } }, { 0, 0, GDK_0, scroll, {ScrollJumpTo | DirectionLeft} }, { GDK_SHIFT_MASK, 0, GDK_dollar, scroll, {ScrollJumpTo | DirectionRight} }, + { 0, GDK_g, GDK_t, tab, { .s = "xdotool key --window %s ctrl+shift+l" }}, + { GDK_SHIFT_MASK, GDK_g, GDK_T, tab, { .s = "xdotool key --window %s ctrl+shift+h" }}, { 0, GDK_g, GDK_g, scroll, {ScrollJumpTo | DirectionTop} }, { GDK_SHIFT_MASK, 0, GDK_G, scroll, {ScrollJumpTo | DirectionBottom} }, { 0, 0, GDK_h, scroll, {ScrollMove | DirectionLeft | UnitLine} }, diff --git a/main.c b/main.c index a14359d..8cd616f 100644 --- a/main.c +++ b/main.c @@ -63,6 +63,7 @@ static gboolean yank(const Arg *arg); static gboolean view_source(const Arg * arg); static gboolean zoom(const Arg *arg); static gboolean quickmark(const Arg *arg); +static gboolean tab(const Arg *arg); static void update_url(const char *uri); static void update_state(void); @@ -1184,6 +1185,20 @@ quickmark(const Arg *a) { else { return false; } } +gboolean +tab(const Arg *a) { + if(embed) + { + char buf[100]; + snprintf(buf, sizeof(buf), a->s, winid ); + if(system(buf) == 0) + return true; + else + return false; + } + return true; +} + gboolean toggle_plugins(const Arg *arg) { static gboolean plugins; From akosmin at reliantsec.net Wed Apr 21 22:32:50 2010 From: akosmin at reliantsec.net (Adam Kosmin) Date: Wed, 21 Apr 2010 18:32:50 -0400 Subject: [Vimprobable-users] gt/gT patch for better tabbed integration In-Reply-To: <20100421222503.GA8664@tuxpad.hsr.ch> References: <20100421222503.GA8664@tuxpad.hsr.ch> Message-ID: <20100421223250.GI7305@windowsrefund.info> Hello Ralph, I have no feedback since I bind my tab movements to ctrl+n and ctrl+p Regardless, I just wanted to say hello and welcome you to the list. Best, Adam From andrej.gelenberg at udo.edu Thu Apr 22 21:04:18 2010 From: andrej.gelenberg at udo.edu (andrej.gelenberg at udo.edu) Date: Thu, 22 Apr 2010 23:04:18 +0200 Subject: [Vimprobable-users] Small fix for Makefile Message-ID: Hi, here small fix, which fix compile issue, if -Wl,--as-needed is in LDFLAGS. Regards, Andrej -------------- next part -------------- >From b032ecd89d6e7ef5aaf342951f3fc9b26579cd66 Mon Sep 17 00:00:00 2001 From: Andrej Gelenberg Date: Thu, 22 Apr 2010 21:55:37 +0200 Subject: [PATCH] Fix bug whith -Wl,--as-needed in LDFLAGS Signed-off-by: Andrej Gelenberg --- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index 1d707c3..82a3f4b 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ hintingmode.h: input_hinting_mode.js perl ./js-merge-helper.pl $(TARGET): $(OBJ) - $(CC) $(LDFLAGS) $^ -o $@ + $(CC) $^ $(LDFLAGS) -o $@ .PHONY: clean install uninstall clean: -- 1.7.0.5 From hannes at yllr.net Fri Apr 23 06:41:50 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Fri, 23 Apr 2010 08:41:50 +0200 Subject: [Vimprobable-users] gt/gT patch for better tabbed integration In-Reply-To: <20100421222503.GA8664@tuxpad.hsr.ch> References: <20100421222503.GA8664@tuxpad.hsr.ch> Message-ID: <20100423084150.29e0e0ee@workstation> Hi! > Attached you will find a "quick&dirty" solution for a better > integration of vimprobable in tabbed. First of all, I think this is a very good idea, because this way, it respects the browser's current mode setting. Second, I don't think the keystroke you're sending to tabbed is correct; by default, the combination to switch tabs is ctrl+l/ctrl+h (i.e. without shift), isn't it? Third, the dependency on xdotool is probable a little unfortunate. I don't know of a better way, though. Ideally, we would communicate with tabbed directly, but there is no interface for that in tabbed (yet) as far as I know. So does anyone have an idea concerning the third point? If not, I'll just merge the patch the way it is and we have to add a note about that dependency to the documentation. Hannes From hannes at yllr.net Fri Apr 23 06:44:55 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Fri, 23 Apr 2010 08:44:55 +0200 Subject: [Vimprobable-users] Small fix for Makefile In-Reply-To: References: Message-ID: <20100423084455.51db634d@workstation> > here small fix, which fix compile issue, if -Wl,--as-needed is in > LDFLAGS. Thanks, Andrej, patch applied! Hannes From matto at matto.nl Fri Apr 23 12:16:16 2010 From: matto at matto.nl (matto fransen) Date: Fri, 23 Apr 2010 14:16:16 +0200 Subject: [Vimprobable-users] gt/gT patch for better tabbed integration In-Reply-To: <20100423084150.29e0e0ee@workstation> References: <20100421222503.GA8664@tuxpad.hsr.ch> <20100423084150.29e0e0ee@workstation> Message-ID: Hi, 2010/4/23 Hannes Sch?ller : > Second, I don't think the keystroke you're sending to tabbed is > correct; by default, the combination to switch tabs is ctrl+l/ctrl+h > (i.e. without shift), isn't it? Vimperator uses gt and gT too. Cheers, Matto From albert.chang at gmx.com Fri Apr 23 18:51:32 2010 From: albert.chang at gmx.com (Albert Chang) Date: Fri, 23 Apr 2010 14:51:32 -0400 Subject: [Vimprobable-users] Hinting feature bugged? Message-ID: <20100423190757.316980@gmx.com> ?Hey, Hinting doesn't seem to work 100% in version 2. For example, if I press f, and I want to go to the 11th hint,I type 11, and would expect it to go to 11, but it goes to 1 instead. It also doesn't seem to follow text very well. For example, if there's a link that says "Artwork and Screenshots," I know through vimperator, typing "fart" should bring me to where I want to go. But it doesn't get highlighted after I type the 'a.' Sometimes it still goes to where I want to, others it doesn't. For example, at the bottom of the vimprobable.org page, if I type "fcon" in vimperator, it brings me to Conkerer's page. However in vimprobable, it doesn't even highlight it. Lastly, when I do an ixquick/startpage search and go to the next page, instead it searches for javascript since the links aren't actual urls. Best regards, Albert Chang -------------- next part -------------- An HTML attachment was scrubbed... URL: From hannes at yllr.net Fri Apr 23 22:18:08 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Sat, 24 Apr 2010 00:18:08 +0200 Subject: [Vimprobable-users] Hinting feature bugged? In-Reply-To: <20100423190757.316980@gmx.com> References: <20100423190757.316980@gmx.com> Message-ID: <20100423221740.GA30354@laptop2> Hello Albert! > Hinting doesn't seem to work 100% in version 2. For example, if I > press f, and I want to go to the 11th hint,I type 11, and would expect > it to go to 11, but it goes to 1 instead. Can you show us an example page where this happens? > It also doesn't seem to follow text very well. For example, if there's > a link that says "Artwork and Screenshots," I know through vimperator, > typing "fart" should bring me to where I want to go. But it doesn't > get highlighted after I type the 'a.' Sometimes it still goes to where > I want to, others it doesn't. For example, at the bottom of the > vimprobable.org page, if I type "fcon" in vimperator, it brings me to > Conkerer's page. However in vimprobable, it doesn't even highlight it. That's because 'a' is not the same as 'A' and 'c' is not the same as 'C'. > Lastly, when I do an ixquick/startpage search and go to the next page, > instead it searches for javascript since the links aren't actual urls. Eh? Not sure I understand that. If I search for something on Ixquick and then follow the "Next" button via hint, it takes me to the next page. How does Javascript come into this? Hannes From albert.chang at gmx.com Fri Apr 23 22:36:54 2010 From: albert.chang at gmx.com (Albert Chang) Date: Fri, 23 Apr 2010 18:36:54 -0400 Subject: [Vimprobable-users] Hinting feature bugged? Message-ID: <20100423223655.316950@gmx.com> Oh, nevermind about the hinting issue. ixquick/startpage uses javascript for the page numbers and next button. For example, if you look at page 2 or whatever, it links "javascript;;" and the next button is "javascript:document.nextform.submit()" If I try to follow the numbers, it searches javascript, as if I'm used the command ":open javascript" Likewise, if I follow the next button, it brings me to the unable to load page. It says the url is http://javascript:document.nextform.submit() So I thought maybe I somehow disabled javascript. I typed w, even though I'm using version 2, to see if it would make a difference, but it didn't. > ----- Original Message ----- > From: Hannes Schüller > Sent: 04/23/10 06:18 PM > To: vimprobable-users at vimprobable.org > Subject: Re: [Vimprobable-users] Hinting feature bugged? > Hello Albert! > Hinting doesn't seem to work 100% in version 2. For example, if I > press f, and I want to go to the 11th hint,I type 11, and would expect > it to go to 11, but it goes to 1 instead. Can you show us an example page where this happens? > It also doesn't seem to follow text very well. For example, if there's > a link that says "Artwork and Screenshots," I know through vimperator, > typing "fart" should bring me to where I want to go. But it doesn't > get highlighted after I type the 'a.' Sometimes it still goes to where > I want to, others it doesn't. For example, at the bottom of the > vimprobable.org page, if I type "fcon" in vimperator, it brings me to > Conkerer's page. However in vimprobable, it doesn't even highlight it. That's because 'a' is not the same as 'A' and 'c' is not the same as 'C'. > Lastly, when I do an ixquick/startpage search and go to the next page, > instead it searches for javascript since the links aren't actual urls. Eh? Not sure I understand that. If I search for something on Ixquick and then follow the "Next" button via hint, it takes me to the next page. How does Javascript come into this? Hannes _______________________________________________ Vimprobable-users mailing list Vimprobable-users at vimprobable.org http://vimprobable.org/mailman/listinfo/vimprobable-users From hannes at yllr.net Sat Apr 24 20:55:39 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sat, 24 Apr 2010 22:55:39 +0200 Subject: [Vimprobable-users] Hinting feature bugged? In-Reply-To: <20100423223655.316950@gmx.com> References: <20100423223655.316950@gmx.com> Message-ID: <20100424225539.66a3378d@workstation> > ixquick/startpage uses javascript for the page numbers and next > button. For example, if you look at page 2 or whatever, it links > "javascript;;" and the next button is > "javascript:document.nextform.submit()" > > If I try to follow the numbers, it searches javascript, as if I'm > used the command ":open javascript" > > Likewise, if I follow the next button, it brings me to the unable to > load page. It says the url is > http://javascript:document.nextform.submit() Ah, I see what you mean. The site works fine with JavaScript disabled, by the way. Definitely an issue to fix, though. Hannes From albert.chang at gmx.com Sat Apr 24 21:02:52 2010 From: albert.chang at gmx.com (Albert Chang) Date: Sat, 24 Apr 2010 17:02:52 -0400 Subject: [Vimprobable-users] Hinting feature bugged? Message-ID: <20100424210252.316960@gmx.com> Is there a way to disable javascript on the fly with version 2? Or do I have to compile a separate version for that? > ----- Original Message ----- > From: Hannes Schüller > Sent: 04/24/10 04:55 PM > To: vimprobable-users at vimprobable.org > Subject: Re: [Vimprobable-users] Hinting feature bugged? > > ixquick/startpage uses javascript for the page numbers and next > button. For example, if you look at page 2 or whatever, it links > "javascript;;" and the next button is > "javascript:document.nextform.submit()" > > If I try to follow the numbers, it searches javascript, as if I'm > used the command ":open javascript" > > Likewise, if I follow the next button, it brings me to the unable to > load page. It says the url is > http://javascript:document.nextform.submit() Ah, I see what you mean. The site works fine with JavaScript disabled, by the way. Definitely an issue to fix, though. Hannes _______________________________________________ Vimprobable-users mailing list Vimprobable-users at vimprobable.org http://vimprobable.org/mailman/listinfo/vimprobable-users From hannes at yllr.net Sat Apr 24 21:14:01 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sat, 24 Apr 2010 23:14:01 +0200 Subject: [Vimprobable-users] Hinting feature bugged? In-Reply-To: <20100424210252.316960@gmx.com> References: <20100424210252.316960@gmx.com> Message-ID: <20100424231401.35772f73@workstation> > Is there a way to disable javascript on the fly with version 2? :set scripts off From thomas at xteddy.org Tue Apr 27 11:31:53 2010 From: thomas at xteddy.org (Thomas Adam) Date: Tue, 27 Apr 2010 12:31:53 +0100 Subject: [Vimprobable-users] [PATCH] Treat "about:" as a valid URL. Message-ID: I often like to open a blank page when I load my browser -- and typically do this with "about:blank". Doing this with vimprobable though made it do a web search for "about:blank" because of the order of precedence in the code. This patch fixes that by allowing any old "about:$FOO" specifier. Thomas Adam (1): Allow for about:config as a valid URL. main.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) From thomas at xteddy.org Tue Apr 27 11:32:07 2010 From: thomas at xteddy.org (Thomas Adam) Date: Tue, 27 Apr 2010 12:32:07 +0100 Subject: [Vimprobable-users] [PATCH] Allow for about:config as a valid URL. Message-ID: Treat "about:" as a special case within vimprobable2, so that about:blank and friends are treated as dummy values, rather than trying to look them up as a search parameters to a defined search engine. --- main.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index e1efb70..a280d45 100644 --- a/main.c +++ b/main.c @@ -989,6 +989,13 @@ open(const Arg *arg) { else if (arg->i == TargetCurrent) { len = strlen(arg->s); new = NULL, p = strchr(arg->s, ' '); + + if (strstr(arg->s, "about:")) + { + new = g_strdup(arg->s); + goto load_page; + } + if (p) /* check for search engines */ for (i = 0; i < LENGTH(searchengines); i++) if (!strncmp(arg->s, searchengines[i].handle, p - arg->s)) { @@ -1020,6 +1027,7 @@ open(const Arg *arg) { memcpy(&new[sizeof("http://") - 1], arg->s, len + 1); } } +load_page: webkit_web_view_load_uri(webview, new); g_free(new); } else -- 1.7.1.dirty From thomas at xteddy.org Tue Apr 27 20:32:28 2010 From: thomas at xteddy.org (Thomas Adam) Date: Tue, 27 Apr 2010 21:32:28 +0100 Subject: [Vimprobable-users] [PATCH 0/3]: Rework main.c:open() Message-ID: <20100427203226.GA2831@shuttle.home> Hi -- I previously sent out a patch to add in "about:*" -- but the rest of the code surrounding that annoyed me. So I've rewritten it, using some glib calls instead, which makes things a little neater, and slightly more readable. Seems to work OK, but a review would be welcome in case I've made a complete mess of it somewhere a long the line. :) Kindly, -- Thomas Adam -- "It was the cruelest game I've ever played and it's played inside my head." -- "Hush The Warmth", Gorky's Zygotic Mynci. From thomas at xteddy.org Tue Apr 27 20:35:38 2010 From: thomas at xteddy.org (Thomas Adam) Date: Tue, 27 Apr 2010 21:35:38 +0100 Subject: [Vimprobable-users] [PATCH 1/3]: Include glib header files. Message-ID: <20100427203523.GB2831@shuttle.home> We need glib's header files so we can make use of most of the g_* functions. --- includes.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/includes.h b/includes.h index fe7d9bf..fa9c192 100644 --- a/includes.h +++ b/includes.h @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include #include -- 1.6.6.196.g1f735 From thomas at xteddy.org Tue Apr 27 20:37:22 2010 From: thomas at xteddy.org (Thomas Adam) Date: Tue, 27 Apr 2010 21:37:22 +0100 Subject: [Vimprobable-users] [PATCH 2/3] Define MAX_URI_LENGTH for lenth of URI. Message-ID: <20100427203714.GC2831@shuttle.home> When interpolating a URI to open in vimprobable, define the absolute limit we expect. This isn't perfect, but for a URI which might contain GET parameters, this size should be sufficient. --- vimprobable.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/vimprobable.h b/vimprobable.h index f9da924..1ba7d55 100644 --- a/vimprobable.h +++ b/vimprobable.h @@ -147,3 +147,6 @@ struct map_pair { #define MOUSE_BUTTON_3 3 #define MOUSE_BUTTON_4 4 #define MOUSE_BUTTON_5 5 + +/* Maximum URL length we accept. */ +#define MAX_URI_LENGTH 8192 -- 1.6.6.196.g1f735 From thomas at xteddy.org Tue Apr 27 20:39:15 2010 From: thomas at xteddy.org (Thomas Adam) Date: Tue, 27 Apr 2010 21:39:15 +0100 Subject: [Vimprobable-users] [PATCH 3/3] Refactor open() Message-ID: <20100427203913.GD2831@shuttle.home> This makes use of some common g_* functions to make the code easier to read. Also, add in an explictly defined order of precedence when opening a URI, and allow for "about:config" and friends. --- main.c | 129 +++++++++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 87 insertions(+), 42 deletions(-) diff --git a/main.c b/main.c index e1efb70..29d4561 100644 --- a/main.c +++ b/main.c @@ -968,9 +968,12 @@ number(const Arg *arg) { gboolean open(const Arg *arg) { char *argv[6]; - char *s = arg->s, *p, *new; + char *search_string, *url_string; Arg a = { .i = NavigationReload }; - int len, i; + int i; + + search_string = NULL; + url_string = NULL; if (embed) { argv[0] = *args; @@ -984,48 +987,90 @@ open(const Arg *arg) { argv[2] = NULL; } - if (!arg->s) + if (!arg->s) { navigate(&a); - else if (arg->i == TargetCurrent) { - len = strlen(arg->s); - new = NULL, p = strchr(arg->s, ' '); - if (p) /* check for search engines */ - for (i = 0; i < LENGTH(searchengines); i++) - if (!strncmp(arg->s, searchengines[i].handle, p - arg->s)) { - p = soup_uri_encode(++p, "&"); - new = g_strdup_printf(searchengines[i].uri, p); - g_free(p); - break; - } - if (!new) { - if (len > 3 && strstr(arg->s, "://")) { /* valid url? */ - p = new = g_malloc(len + 1); - while(*s != '\0') { /* strip whitespaces */ - if (*s != ' ') - *(p++) = *s; - ++s; - } - *p = '\0'; - } else if (strcspn(arg->s, "/") == 0 || strcspn(arg->s, "./") == 0) { /* prepend "file://" */ - new = g_malloc(sizeof("file://") + len); - strcpy(new, "file://"); - memcpy(&new[sizeof("file://") - 1], arg->s, len + 1); - } else if (p || !strchr(arg->s, '.')) { /* whitespaces or no dot? */ - p = soup_uri_encode(arg->s, "&"); - new = g_strdup_printf(defsearch->uri, p); - g_free(p); - } else { /* prepend "http://" */ - new = g_malloc(sizeof("http://") + len); - strcpy(new, "http://"); - memcpy(&new[sizeof("http://") - 1], arg->s, len + 1); - } - } - webkit_web_view_load_uri(webview, new); - g_free(new); - } else - g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); + return TRUE; + } + + url_string = g_strdup(arg->s); + + if (arg->i == TargetCurrent) { + /* Then we have a set order of precedence that we should follow. + * + * 1. If a URI begins with "about:", just treat is nothing for now -- + * it will be possible to expand on it later, if there's a need for + * "about:config" for example. + * + * 2. Match against search engines. + * + * 3. If it looks like a valid URL, load it. + * + * 4. Work out if it's a file, and load that. + * + * 5. Finally, assume it's a valid URI and load it. + */ + + /* about: handling. */ + if (g_str_has_prefix(arg->s, "about:")) + goto load_uri; + + /* Search engine handling. */ + if ((search_string = strchr(arg->s, ' ')) != NULL) { + for (i = 0; i < LENGTH(searchengines); i++) + { + if (!strncmp(arg->s, searchengines[i].handle, + (search_string - arg->s))) { + search_string = soup_uri_encode( + ++search_string, "&"); + url_string = g_strdup_printf( + searchengines[i].uri, search_string); + + g_free(search_string); + + break; + } + } + } + + /* If it's a "valid" URI, load it. */ + if (g_strrstr(url_string, "://")) + goto load_uri; + + /* Check if we mean file:// or not here. */ + /* XXX: Handle relative paths: "../../foo.html" for instance. */ + if (g_str_has_prefix(arg->s, "/") || + g_str_has_prefix(arg->s, "./")) { + g_snprintf(url_string, MAX_URI_LENGTH, + "file://%s", arg->s); + goto load_uri; + } + + if (!url_string || !strchr(arg->s, '.')) { + search_string = soup_uri_encode(arg->s, "&"); + url_string = g_strdup_printf(defsearch->uri, search_string); + + g_free(search_string); + + goto load_uri; + } + + /* Default to http:// */ + if (!g_str_has_prefix(arg->s, "http://")) { + g_snprintf(url_string, MAX_URI_LENGTH, + "http://%s", arg->s); + goto load_uri; + } + } else { + g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL); + + return TRUE; + } + +load_uri: + webkit_web_view_load_uri(webview, url_string); return TRUE; -} + } gboolean yank(const Arg *arg) { -- 1.6.6.196.g1f735 From hannes at yllr.net Tue Apr 27 21:19:10 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Tue, 27 Apr 2010 23:19:10 +0200 Subject: [Vimprobable-users] [PATCH] Treat "about:" as a valid URL. In-Reply-To: References: Message-ID: <20100427231910.11284488@workstation> Hello Thomas! Thomas Adam wrote: > I often like to open a blank page when I load my browser -- and > typically do this with "about:blank". Doing this with vimprobable > though made it do a web search for "about:blank" because of the order > of precedence in the code. I'm not sure we really need a dedicated namespace just to duplicate the "blank page" behaviour of another browser. Setting the home page to a blank file will do the trick just fine. And implementation-wise: goto? Seriously? Don't get me wrong. I don't oppose the introduction of a "browser-internal" namespace of URLs. However, I do think there should be a real use defined for it first. Hannes From thomas at xteddy.org Tue Apr 27 21:22:42 2010 From: thomas at xteddy.org (Thomas Adam) Date: Tue, 27 Apr 2010 22:22:42 +0100 Subject: [Vimprobable-users] [PATCH] Treat "about:" as a valid URL. In-Reply-To: <20100427231910.11284488@workstation> References: <20100427231910.11284488@workstation> Message-ID: <20100427212241.GE2831@shuttle.home> On Tue, Apr 27, 2010 at 11:19:10PM +0200, Hannes Sch??ller wrote: > Hello Thomas! > > Thomas Adam wrote: > > I often like to open a blank page when I load my browser -- and > > typically do this with "about:blank". Doing this with vimprobable > > though made it do a web search for "about:blank" because of the order > > of precedence in the code. > > I'm not sure we really need a dedicated namespace just to duplicate the > "blank page" behaviour of another browser. Setting the home page to a > blank file will do the trick just fine. And implementation-wise: goto? > Seriously? Heh -- it's a common idiom with BSD-code. > Don't get me wrong. I don't oppose the introduction of a > "browser-internal" namespace of URLs. However, I do think there should > be a real use defined for it first. Well, it was more a case of "about:blank is fairly common that I would have expected it to do just that -- nothing. But yes, I could equally have gone to the trouble of pointing the homepage to some blank file, but then the onous is me to ensure it's there all the time. -- Thomas Adam -- "It was the cruelest game I've ever played and it's played inside my head." -- "Hush The Warmth", Gorky's Zygotic Mynci.