From hpdeifel at gmx.de Sun May 1 14:32:24 2011 From: hpdeifel at gmx.de (Hans-Peter Deifel) Date: Sun, 1 May 2011 16:32:24 +0200 Subject: [Vimprobable-users] [PATCH] Don't open a new window when ctrl+left-clicking on empty space Message-ID: <1304260344-7836-1-git-send-email-hpdeifel@gmx.de> Control+LMB opens a link in a new window, but it did also create an empty window, when the cursor was not over a link. --- config.h | 8 ++++---- main.c | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config.h b/config.h index 04af99c..77c2188 100644 --- a/config.h +++ b/config.h @@ -138,10 +138,10 @@ Command commands[COMMANDSIZE] = { you can use MOUSE_BUTTON_1 to MOUSE_BUTTON_5 */ static Mouse mouse[] = { - /* modmask, modkey, button, function, argument */ - { 0, 0, MOUSE_BUTTON_2, paste, {TargetCurrent | ClipboardPrimary | ClipboardGTK, rememberedURI} }, - { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_2, paste, {TargetNew | ClipboardPrimary | ClipboardGTK} }, - { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_1, open_arg, {TargetNew, rememberedURI} }, + /* modmask, modkey, button, function, argument */ + { 0, 0, MOUSE_BUTTON_2, paste, {TargetCurrent | ClipboardPrimary | ClipboardGTK, rememberedURI} }, + { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_2, paste, {TargetNew | ClipboardPrimary | ClipboardGTK} }, + { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_1, open_remembered, {TargetNew} }, }; /* settings (arguments of :set command) */ diff --git a/main.c b/main.c index 4a1caf8..5fcec4d 100644 --- a/main.c +++ b/main.c @@ -60,6 +60,7 @@ static gboolean input(const Arg *arg); static gboolean navigate(const Arg *arg); static gboolean number(const Arg *arg); static gboolean open_arg(const Arg *arg); +static gboolean open_remembered(const Arg *arg); static gboolean paste(const Arg *arg); static gboolean quickmark(const Arg *arg); static gboolean quit(const Arg *arg); @@ -1142,6 +1143,17 @@ open_arg(const Arg *arg) { } gboolean +open_remembered(const Arg *arg) +{ + Arg a = {arg->i, rememberedURI}; + + if (strcmp(rememberedURI, "")) { + open_arg(&a); + } + return TRUE; +} + +gboolean yank(const Arg *arg) { const char *url, *feedback; -- 1.7.3.4 From tyler at monkeypox.org Tue May 3 03:57:45 2011 From: tyler at monkeypox.org (R. Tyler Croy) Date: Mon, 2 May 2011 20:57:45 -0700 Subject: [Vimprobable-users] [PATCH 00/13] New Way to Handle Hinting In-Reply-To: <20110326114430.3806fb28@workstation> References: <1295005150-16318-1-git-send-email-alkim1234@gmail.com> <20110326114430.3806fb28@workstation> Message-ID: <20110503035745.GJ14883@kiwi.local> On Sat, 26 Mar 2011, Hannes Sch?ller wrote: > So, any news on this? I've brought this up to date with the most recent tip of the upstream vimprobable2 branch: The hints are mighty fast! What's left to be done before we can get this into a release of vimprobable2 :) Cheers - R. Tyler Croy -------------------------------------- Code: http://github.com/rtyler Chatter: http://identi.ca/agentdero http://twitter.com/agentdero -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Tue May 3 08:18:37 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Tue, 3 May 2011 10:18:37 +0200 Subject: [Vimprobable-users] [PATCH 00/13] New Way to Handle Hinting In-Reply-To: <20110503035745.GJ14883@kiwi.local> References: <1295005150-16318-1-git-send-email-alkim1234@gmail.com> <20110326114430.3806fb28@workstation> <20110503035745.GJ14883@kiwi.local> Message-ID: <20110503101837.3e3afcbd@workstation> "R. Tyler Croy" wrote: > On Sat, 26 Mar 2011, Hannes Sch?ller wrote: > > So, any news on this? > > I've brought this up to date with the most recent tip of the upstream > vimprobable2 branch: > Great! > The hints are mighty fast! What's left to be done before we can get > this into a release of vimprobable2 :) As mentioned on IRC, I don't think it's a lot: http://vimprobable.org/pipermail/vimprobable-users/2011-January/000559.html http://vimprobable.org/pipermail/vimprobable-users/2011-January/000560.html http://vimprobable.org/pipermail/vimprobable-users/2011-January/000572.html Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Sun May 8 20:17:56 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 8 May 2011 22:17:56 +0200 Subject: [Vimprobable-users] [PATCH 0/5] Configurable search engines In-Reply-To: <20110429220039.GA18329@deepsilver> References: <1302620915-28950-1-git-send-email-hpdeifel@gmx.de> <20110426223721.0cec72e3@workstation> <20110429220039.GA18329@deepsilver> Message-ID: <20110508221756.35cc2a7c@workstation> Hi! Hans-Peter Deifel wrote: > On 22:37 Tue 26 Apr , Hannes Sch?ller wrote: > > - The function find_uri_for_searchengine uses the insecure strcmp > > function. Please first check that the length is identical and then > > use strncmp. > > I don't think that > > int len1 = strlen(str1), len2 = strlen(str2); > return len1 == len2 && !strncmp(str1, str2, len1); > > is more secure than > > return !strcmp(str1, str2); > > because strlen also just uses the 0-byte to determine the length of > the string. The question is: Can you guarantee that both these strings are actually NULL terminated? Since the source is a user provided configuration file, I doubt you can. You are assuming well-formedness of the configuration file which I'd consider risky. Not even feeding those strings into some comparison function, because the string lengths didn't match anyway is certainly a good idea to prevent any bugs in the implementation from being reached at all. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Mon May 9 14:48:24 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Mon, 9 May 2011 16:48:24 +0200 Subject: [Vimprobable-users] [Patch] Allow toggling of status bar & input box Message-ID: <20110509164824.15f6aaad@workstation> Hi, since this has been requested quite regularly, here is a small patch allowing the user to show and hide the status bar and input box. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: toggle_bars.patch Type: text/x-patch Size: 3234 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From alkim1234 at gmail.com Mon May 23 03:46:49 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:49 -0700 Subject: [Vimprobable-users] [PATCH 00/18] New Way to Handle Hinting In-Reply-To: <20110503101837.3e3afcbd@workstation> References: <20110503101837.3e3afcbd@workstation> Message-ID: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Sorry, this took such a long to release, but here's a new reroll to the new hinting system. I changed the hinting system so that it uses the inputbox instead of by keeping track of each new keypress. There are two primary advantages to this: 1. The code becomes a lot simpler because GtkEntry takes care of the whole unicode bit, and all we have to do is take care of updating the hints. 2. This allows for people to use their IMs to follow hints. 3. You can delete letters in hint mode using backspace. 4. You can delete numbers in hint mode using ctrl+shift+backspace. Albert Kim (18): Added backquote as a synonym to start following hints. Uses inputbox_keypress_cb to find hints. Specified "current" for following hints. Make hints go away if input is cleared. Pressing ~ now sets up so that hints open up in background. Added proper handling of numbers into new hinting system. Changed 'f' and 'F' keys to use new hinting mode. Changed to reset count when quitting hintmode. Made script() free arg->s where applicatable. Removed code dealing with old hintmode. Made check for whether keyval is digit shorter. Used numval instead of keyval to calculate new count. Fixed bug with not being able to press enter to follow single digit hints. Removed compile time warning about count_buf not being used. Changed hint mode start key from ` to period. Changed code to implement period as new follow key Numbers wouldn't open hints in new window. Fixed. Removal of last number in hint mode possible. keymap.h | 7 ++- main.c | 213 ++++++++++++++++++++----------------------------------------- 2 files changed, 75 insertions(+), 145 deletions(-) -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:50 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:50 -0700 Subject: [Vimprobable-users] [PATCH 01/18] Added backquote as a synonym to start following hints. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-2-git-send-email-alkim1234@gmail.com> --- keymap.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/keymap.h b/keymap.h index 0e894fd..28320e4 100644 --- a/keymap.h +++ b/keymap.h @@ -101,6 +101,8 @@ Key keys[] = { { 0, 0, GDK_KP_Divide, input, {.s = "/"} }, { GDK_SHIFT_MASK, 0, GDK_question, input, {.s = "?"} }, + { 0, 0, GDK_quoteleft, input, {.s = "`"} }, + { 0, GDK_VoidSymbol, GDK_Escape, set, {ModeNormal} }, { GDK_CONTROL_MASK, GDK_VoidSymbol, GDK_bracketleft,set, {ModeNormal} }, { GDK_CONTROL_MASK, 0, GDK_z, set, {ModePassThrough} }, -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:51 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:51 -0700 Subject: [Vimprobable-users] [PATCH 02/18] Uses inputbox_keypress_cb to find hints. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-3-git-send-email-alkim1234@gmail.com> When, '`' is the first character of the inputbox, vimiprobable now uses the inputbox to find hints. This allows for a cleaner way to handle international characters and also allows for users to use their IM to type international characters. --- main.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index 4a1caf8..30e3221 100644 --- a/main.c +++ b/main.c @@ -697,6 +697,7 @@ static gboolean inputbox_keyrelease_cb(GtkEntry *entry, GdkEventKey *event) { } static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { + Arg a; char *text = (char*)gtk_entry_get_text(GTK_ENTRY(entry)); guint16 length = gtk_entry_get_text_length(GTK_ENTRY(entry)); gboolean forward = FALSE; @@ -713,6 +714,17 @@ static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { webkit_web_view_unmark_text_matches(webview); webkit_web_view_search_text(webview, &text[1], searchoptions & CaseSensitive, forward, searchoptions & Wrapping); return TRUE; + } else if (gtk_widget_is_focus(GTK_WIDGET(entry)) && length > 1 && + (text[0] == '`')) { + a.i = Silent; + a.s = "vimprobable_cleanup()"; + script(&a); + a.i = Silent; + a.s = g_strconcat("vimprobable_show_hints('", text + 1, "')", NULL); + script(&a); + free(a.s); + update_state(); + return TRUE; } return FALSE; -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:52 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:52 -0700 Subject: [Vimprobable-users] [PATCH 03/18] Specified "current" for following hints. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-4-git-send-email-alkim1234@gmail.com> Also, made sure all hints are highlighted if nothing has been typed yet. --- main.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/main.c b/main.c index 30e3221..8d580f6 100644 --- a/main.c +++ b/main.c @@ -714,15 +714,17 @@ static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { webkit_web_view_unmark_text_matches(webview); webkit_web_view_search_text(webview, &text[1], searchoptions & CaseSensitive, forward, searchoptions & Wrapping); return TRUE; - } else if (gtk_widget_is_focus(GTK_WIDGET(entry)) && length > 1 && + } else if (gtk_widget_is_focus(GTK_WIDGET(entry)) && length >= 1 && (text[0] == '`')) { a.i = Silent; a.s = "vimprobable_cleanup()"; script(&a); + a.i = Silent; a.s = g_strconcat("vimprobable_show_hints('", text + 1, "')", NULL); script(&a); free(a.s); + update_state(); return TRUE; } @@ -1027,6 +1029,7 @@ input(const Arg *arg) { count = 0; const char *url; int index = Info; + Arg a; update_state(); @@ -1043,6 +1046,16 @@ input(const Arg *arg) { gtk_editable_insert_text(GTK_EDITABLE(inputbox), url, -1, &pos); gtk_widget_grab_focus(inputbox); gtk_editable_set_position(GTK_EDITABLE(inputbox), -1); + + if (arg->s[0] == '`') { + memset(followTarget, 0, 0); + strncpy(followTarget, "current", 8); + a.i = Silent; + a.s = "vimprobable_show_hints()"; + script(&a); + update_state(); + } + return TRUE; } -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:53 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:53 -0700 Subject: [Vimprobable-users] [PATCH 04/18] Make hints go away if input is cleared. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-5-git-send-email-alkim1234@gmail.com> Basically, now the existence of followTarget is what sets hint mode on or off. If followTarget is either ("current" or "new"), when inputbox's length becomes 0, vimprobable_clear is called. followTarget is set once the user sets inputbox to have '`' as the first character. --- main.c | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index 8d580f6..94283fb 100644 --- a/main.c +++ b/main.c @@ -725,8 +725,12 @@ static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { script(&a); free(a.s); - update_state(); return TRUE; + } else if (length == 0 && followTarget[0]) { + memset(followTarget, 0, 8); + a.i = Silent; + a.s = "vimprobable_clear()"; + script(&a); } return FALSE; @@ -1039,23 +1043,22 @@ input(const Arg *arg) { */ set_widget_font_and_color(inputbox, urlboxfont[index], urlboxbgcolor[index], urlboxcolor[index]); - /* to avoid things like :open URL :open URL2 or :open :open URL */ - gtk_entry_set_text(GTK_ENTRY(inputbox), ""); - gtk_editable_insert_text(GTK_EDITABLE(inputbox), arg->s, -1, &pos); - if (arg->i & InsertCurrentURL && (url = webkit_web_view_get_uri(webview))) - gtk_editable_insert_text(GTK_EDITABLE(inputbox), url, -1, &pos); - gtk_widget_grab_focus(inputbox); - gtk_editable_set_position(GTK_EDITABLE(inputbox), -1); - if (arg->s[0] == '`') { memset(followTarget, 0, 0); strncpy(followTarget, "current", 8); a.i = Silent; a.s = "vimprobable_show_hints()"; script(&a); - update_state(); } + /* to avoid things like :open URL :open URL2 or :open :open URL */ + gtk_entry_set_text(GTK_ENTRY(inputbox), ""); + gtk_editable_insert_text(GTK_EDITABLE(inputbox), arg->s, -1, &pos); + if (arg->i & InsertCurrentURL && (url = webkit_web_view_get_uri(webview))) + gtk_editable_insert_text(GTK_EDITABLE(inputbox), url, -1, &pos); + gtk_widget_grab_focus(inputbox); + gtk_editable_set_position(GTK_EDITABLE(inputbox), -1); + return TRUE; } -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:54 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:54 -0700 Subject: [Vimprobable-users] [PATCH 05/18] Pressing ~ now sets up so that hints open up in background. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-6-git-send-email-alkim1234@gmail.com> --- keymap.h | 1 + main.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/keymap.h b/keymap.h index 28320e4..17216bf 100644 --- a/keymap.h +++ b/keymap.h @@ -102,6 +102,7 @@ Key keys[] = { { GDK_SHIFT_MASK, 0, GDK_question, input, {.s = "?"} }, { 0, 0, GDK_quoteleft, input, {.s = "`"} }, + { GDK_SHIFT_MASK, 0, GDK_asciitilde, input, {.s = "~"} }, { 0, GDK_VoidSymbol, GDK_Escape, set, {ModeNormal} }, { GDK_CONTROL_MASK, GDK_VoidSymbol, GDK_bracketleft,set, {ModeNormal} }, diff --git a/main.c b/main.c index 94283fb..90d4206 100644 --- a/main.c +++ b/main.c @@ -715,7 +715,7 @@ static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { webkit_web_view_search_text(webview, &text[1], searchoptions & CaseSensitive, forward, searchoptions & Wrapping); return TRUE; } else if (gtk_widget_is_focus(GTK_WIDGET(entry)) && length >= 1 && - (text[0] == '`')) { + (text[0] == '`' || text[0] == '~')) { a.i = Silent; a.s = "vimprobable_cleanup()"; script(&a); @@ -1043,9 +1043,9 @@ input(const Arg *arg) { */ set_widget_font_and_color(inputbox, urlboxfont[index], urlboxbgcolor[index], urlboxcolor[index]); - if (arg->s[0] == '`') { + if (arg->s[0] == '`' || arg->s[0] == '~') { memset(followTarget, 0, 0); - strncpy(followTarget, "current", 8); + strncpy(followTarget, arg->s[0] == '`' ? "current" : "new", 8); a.i = Silent; a.s = "vimprobable_show_hints()"; script(&a); -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:55 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:55 -0700 Subject: [Vimprobable-users] [PATCH 06/18] Added proper handling of numbers into new hinting system. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-7-git-send-email-alkim1234@gmail.com> --- main.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index 90d4206..8d37de7 100644 --- a/main.c +++ b/main.c @@ -630,6 +630,7 @@ inputbox_activate_cb(GtkEntry *entry, gpointer user_data) { gboolean inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { Arg a; + char count_buf[BUFFERSIZE]; switch (event->keyval) { case GDK_bracketleft: @@ -657,6 +658,24 @@ inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { return complete(&a); break; } + + if (followTarget[0] && ((event->keyval >= GDK_1 && event->keyval <= GDK_9) + || (event->keyval >= GDK_KP_1 && event->keyval <= GDK_KP_9) + || ((event->keyval == GDK_0 || event->keyval == GDK_KP_0) && count))) { + /* allow a zero as non-first number */ + if (event->keyval >= GDK_KP_0 && event->keyval <= GDK_KP_9) + count = (count ? count * 10 : 0) + (event->keyval - GDK_KP_0); + else + count = (count ? count * 10 : 0) + (event->keyval - GDK_0); + snprintf(count_buf, BUFFERSIZE, "%d", count); + a.i = Silent; + a.s = g_strconcat("vimprobable_update_hints(", count_buf, ")", NULL); + script(&a); + update_state(); + g_free(a.s); + return TRUE; + } + return FALSE; } -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:56 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:56 -0700 Subject: [Vimprobable-users] [PATCH 07/18] Changed 'f' and 'F' keys to use new hinting mode. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-8-git-send-email-alkim1234@gmail.com> --- keymap.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keymap.h b/keymap.h index 17216bf..25d7c2c 100644 --- a/keymap.h +++ b/keymap.h @@ -108,8 +108,8 @@ Key keys[] = { { GDK_CONTROL_MASK, GDK_VoidSymbol, GDK_bracketleft,set, {ModeNormal} }, { GDK_CONTROL_MASK, 0, GDK_z, set, {ModePassThrough} }, { GDK_CONTROL_MASK, 0, GDK_v, set, {ModeSendKey} }, - { 0, 0, GDK_f, set, { .i = ModeHints, .s = "current" } }, - { GDK_SHIFT_MASK, 0, GDK_F, set, { .i = ModeHints, .s = "new" } }, + { 0, 0, GDK_f, input, {.s = "`"} }, + { GDK_SHIFT_MASK, 0, GDK_F, input, {.s = "~"} }, { 0, GDK_g, GDK_i, focus_input,{} }, { 0, 0, GDK_u, revive, {} }, -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:57 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:57 -0700 Subject: [Vimprobable-users] [PATCH 08/18] Changed to reset count when quitting hintmode. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-9-git-send-email-alkim1234@gmail.com> Also calls update_state after count is reset. --- main.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index 8d37de7..b1f28aa 100644 --- a/main.c +++ b/main.c @@ -750,6 +750,8 @@ static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { a.i = Silent; a.s = "vimprobable_clear()"; script(&a); + count = 0; + update_state(); } return FALSE; -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:58 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:58 -0700 Subject: [Vimprobable-users] [PATCH 09/18] Made script() free arg->s where applicatable. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-10-git-send-email-alkim1234@gmail.com> --- main.c | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index b1f28aa..883b90b 100644 --- a/main.c +++ b/main.c @@ -197,7 +197,7 @@ ascii_bar(int total, int state, char *string) { void webview_load_committed_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointer user_data) { - Arg a = { .i = Silent, .s = JS_SETUP_HINTS }; + Arg a = { .i = Silent, .s = g_strdup(JS_SETUP_HINTS) }; const char *uri = webkit_web_view_get_uri(webview); update_url(uri); @@ -206,7 +206,7 @@ webview_load_committed_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointe void webview_load_finished_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointer user_data) { - Arg a = { .i = Silent, .s = JS_SETUP_INPUT_FOCUS }; + Arg a = { .i = Silent, .s = g_strdup(JS_SETUP_INPUT_FOCUS) }; if (HISTORY_MAX_ENTRIES > 0) history(); @@ -672,7 +672,6 @@ inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { a.s = g_strconcat("vimprobable_update_hints(", count_buf, ")", NULL); script(&a); update_state(); - g_free(a.s); return TRUE; } @@ -736,19 +735,18 @@ static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { } else if (gtk_widget_is_focus(GTK_WIDGET(entry)) && length >= 1 && (text[0] == '`' || text[0] == '~')) { a.i = Silent; - a.s = "vimprobable_cleanup()"; + a.s = g_strdup("vimprobable_cleanup()"); script(&a); a.i = Silent; a.s = g_strconcat("vimprobable_show_hints('", text + 1, "')", NULL); script(&a); - free(a.s); return TRUE; } else if (length == 0 && followTarget[0]) { memset(followTarget, 0, 8); a.i = Silent; - a.s = "vimprobable_clear()"; + a.s = g_strdup("vimprobable_clear()"); script(&a); count = 0; update_state(); @@ -1068,7 +1066,7 @@ input(const Arg *arg) { memset(followTarget, 0, 0); strncpy(followTarget, arg->s[0] == '`' ? "current" : "new", 8); a.i = Silent; - a.s = "vimprobable_show_hints()"; + a.s = g_strdup("vimprobable_show_hints()"); script(&a); } @@ -1346,7 +1344,7 @@ set(const Arg *arg) { memset(followTarget, 0, 8); strncpy(followTarget, arg->s, 8); a.i = Silent; - a.s = "vimprobable_show_hints()"; + a.s = g_strdup("vimprobable_show_hints()"); script(&a); break; default: @@ -1429,6 +1427,8 @@ script(const Arg *arg) { jsapi_evaluate_script(arg->s, &value, &message); if (message) { set_error(message); + if (arg->s) + g_free(arg->s); return FALSE; } if (arg->i != Silent && value) { @@ -1459,6 +1459,8 @@ script(const Arg *arg) { open_arg(&a); } } + if (arg->s) + g_free(arg->s); g_free(value); return TRUE; } -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:46:59 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:46:59 -0700 Subject: [Vimprobable-users] [PATCH 10/18] Removed code dealing with old hintmode. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-11-git-send-email-alkim1234@gmail.com> --- main.c | 140 +--------------------------------------------------------------- 1 files changed, 1 insertions(+), 139 deletions(-) diff --git a/main.c b/main.c index 883b90b..33d675a 100644 --- a/main.c +++ b/main.c @@ -132,9 +132,6 @@ static char *configfile = NULL; static char *winid = NULL; static char rememberedURI[1024] = ""; -static char inputKey[5]; -static char inputBuffer[65] = ""; -static char chars[65] = "0000000000000000000000000000000000000000000000000000000000000000\n"; static char followTarget[8] = ""; char *error_msg = NULL; @@ -345,7 +342,6 @@ webview_keypress_cb(WebKitWebView *webview, GdkEventKey *event) { switch (mode) { case ModeNormal: if (CLEAN(event->state) == 0) { - memset(inputBuffer, 0, 65); if (IS_ESCAPE(event)) { a.i = Info; a.s = g_strdup(""); @@ -384,127 +380,6 @@ webview_keypress_cb(WebKitWebView *webview, GdkEventKey *event) { echo(&a); set(&a); break; - case ModeHints: - if (IS_ESCAPE(event)) { - a.i = Silent; - a.s = "vimprobable_clear()"; - script(&a); - a.i = ModeNormal; - count = 0; - strncpy(chars, "0000000000000000000000000000000000000000000000000000000000000000\0", 65); - return set(&a); - } else if (CLEAN(event->state) == 0 && ((event->keyval >= GDK_1 && event->keyval <= GDK_9) - || (event->keyval >= GDK_KP_1 && event->keyval <= GDK_KP_9) - || ((event->keyval == GDK_0 || event->keyval == GDK_KP_0) && count))) { - /* allow a zero as non-first number */ - if (event->keyval >= GDK_KP_0 && event->keyval <= GDK_KP_9) - count = (count ? count * 10 : 0) + (event->keyval - GDK_KP_0); - else - count = (count ? count * 10 : 0) + (event->keyval - GDK_0); - memset(inputBuffer, 0, 65); - sprintf(inputBuffer, "%d", count); - a.s = g_strconcat("vimprobable_update_hints(", inputBuffer, ")", NULL); - a.i = Silent; - memset(inputBuffer, 0, 65); - strncpy(chars, "0000000000000000000000000000000000000000000000000000000000000000\0", 65); - script(&a); - update_state(); - return TRUE; - } else if ((CLEAN(event->state) == 0 && (event->keyval >= GDK_a && event->keyval <= GDK_z)) - || (CLEAN(event->state) == GDK_SHIFT_MASK && (event->keyval >= GDK_A && event->keyval <= GDK_Z)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_space && event->keyval <= GDK_slash)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_colon && event->keyval <= GDK_at)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_braceleft && event->keyval <= GDK_umacron)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_Babovedot && event->keyval <= GDK_ycircumflex)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_OE && event->keyval <= GDK_Ydiaeresis)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_overline && event->keyval <= GDK_semivoicedsound)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_Farsi_0 && event->keyval <= GDK_Arabic_9)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_Arabic_semicolon && event->keyval <= GDK_Arabic_sukun)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_Arabic_madda_above && event->keyval <= GDK_Arabic_heh_goal)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_Cyrillic_GHE_bar && event->keyval <= GDK_Cyrillic_u_macron)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_Serbian_dje && event->keyval <= GDK_Korean_Won)) - || ((CLEAN(event->state) == 0 || CLEAN(event->state) == GDK_SHIFT_MASK) && (event->keyval >= GDK_Armenian_ligature_ew && event->keyval <= GDK_braille_dots_12345678))) { - /* update hints by link text */ - if (strlen(inputBuffer) < 65) { - memset(inputKey, 0, 5); - /* support multibyte characters */ - sprintf(inputKey, "%C", event->keyval); - strncat(inputBuffer, inputKey, 64 - strlen(inputBuffer)); - /* remember the number of bytes of each character */ - for (count = 0; count < 64; count++) { - if (strncmp((chars + count), "0", 1) == 0) { - sprintf(inputKey, "%d", (int)strlen(inputKey)); - strncpy((chars + count), inputKey, 1); - break; - } - } - memset(inputKey, 0, 5); - count = 0; - a.i = Silent; - a.s = "vimprobable_cleanup()"; - script(&a); - a.s = g_strconcat("vimprobable_show_hints('", inputBuffer, "')", NULL); - a.i = Silent; - script(&a); - update_state(); - } - return TRUE; - } else if (CLEAN(event->state) == 0 && (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) && count) { - memset(inputBuffer, 0, 65); - sprintf(inputBuffer, "%d", count); - a.s = g_strconcat("vimprobable_fire(", inputBuffer, ")", NULL); - a.i = Silent; - script(&a); - memset(inputBuffer, 0, 65); - count = 0; - strncpy(chars, "0000000000000000000000000000000000000000000000000000000000000000\0", 65); - update_state(); - return TRUE; - } else if (CLEAN(event->state) == 0 && event->keyval == GDK_BackSpace) { - if (count > 9) { - count /= 10; - memset(inputBuffer, 0, 65); - sprintf(inputBuffer, "%d", count); - a.s = g_strconcat("vimprobable_update_hints(", inputBuffer, ")", NULL); - a.i = Silent; - memset(inputBuffer, 0, 65); - script(&a); - update_state(); - } else if (count > 0) { - count = 0; - memset(inputBuffer, 0, 65); - a.i = Silent; - a.s = "vimprobable_cleanup()"; - script(&a); - a.s = g_strconcat("vimprobable_show_hints()", NULL); - a.i = Silent; - script(&a); - update_state(); - } else if (strlen(inputBuffer) > 0) { - a.i = Silent; - a.s = "vimprobable_cleanup()"; - script(&a); - /* check how many bytes the last character uses */ - for (count = 0; count < 64; count++) { - if (strncmp((chars + count), "0", 1) == 0) { - break; - } - } - memset(inputKey, 0, 5); - strncpy(inputKey, (chars + count - 1), 1); - strncpy((chars + count - 1), "0", 1); - count = atoi(inputKey); - /* remove the appropriate number of bytes from the string */ - strncpy((inputBuffer + strlen(inputBuffer) - count), "\0", 1); - count = 0; - a.s = g_strconcat("vimprobable_show_hints('", inputBuffer, "')", NULL); - a.i = Silent; - script(&a); - update_state(); - } - return TRUE; - } - break; } return FALSE; } @@ -667,9 +542,8 @@ inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { count = (count ? count * 10 : 0) + (event->keyval - GDK_KP_0); else count = (count ? count * 10 : 0) + (event->keyval - GDK_0); - snprintf(count_buf, BUFFERSIZE, "%d", count); a.i = Silent; - a.s = g_strconcat("vimprobable_update_hints(", count_buf, ")", NULL); + a.s = g_strdup_printf("vimprobable_update_hints(%d)", count); script(&a); update_state(); return TRUE; @@ -1340,13 +1214,6 @@ set(const Arg *arg) { a.s = g_strdup("-- INSERT --"); echo(&a); break; - case ModeHints: - memset(followTarget, 0, 8); - strncpy(followTarget, arg->s, 8); - a.i = Silent; - a.s = g_strdup("vimprobable_show_hints()"); - script(&a); - break; default: return TRUE; } @@ -1439,15 +1306,11 @@ script(const Arg *arg) { if (value) { if (strncmp(value, "fire;", 5) == 0) { count = 0; - strncpy(chars, "0000000000000000000000000000000000000000000000000000000000000000", 64); - memset(inputBuffer, 0, 65); a.s = g_strconcat("vimprobable_fire(", (value + 5), ")", NULL); a.i = Silent; script(&a); } else if (strncmp(value, "open;", 5) == 0) { count = 0; - strncpy(chars, "0000000000000000000000000000000000000000000000000000000000000000", 64); - memset(inputBuffer, 0, 65); a.i = ModeNormal; set(&a); if (strncmp(followTarget, "new", 3) == 0) @@ -2011,7 +1874,6 @@ update_state() { /* count, modkey and input buffer */ g_string_append_printf(status, "%.0d", count); if (current_modkey) g_string_append_c(status, current_modkey); - if (inputBuffer[0]) g_string_append_printf(status, " %s", inputBuffer); /* the number of active downloads */ if (activeDownloads) { -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:47:00 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:47:00 -0700 Subject: [Vimprobable-users] [PATCH 11/18] Made check for whether keyval is digit shorter. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-12-git-send-email-alkim1234@gmail.com> --- main.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 33d675a..3824d99 100644 --- a/main.c +++ b/main.c @@ -505,6 +505,7 @@ inputbox_activate_cb(GtkEntry *entry, gpointer user_data) { gboolean inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { Arg a; + int numval; char count_buf[BUFFERSIZE]; switch (event->keyval) { @@ -534,9 +535,8 @@ inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { break; } - if (followTarget[0] && ((event->keyval >= GDK_1 && event->keyval <= GDK_9) - || (event->keyval >= GDK_KP_1 && event->keyval <= GDK_KP_9) - || ((event->keyval == GDK_0 || event->keyval == GDK_KP_0) && count))) { + numval = g_unichar_digit_value((gunichar) gdk_keyval_to_unicode(event->keyval)); + if (followTarget[0] && ((numval >= 1 && numval <= 9) || (numval == 0 && count))) { /* allow a zero as non-first number */ if (event->keyval >= GDK_KP_0 && event->keyval <= GDK_KP_9) count = (count ? count * 10 : 0) + (event->keyval - GDK_KP_0); -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:47:01 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:47:01 -0700 Subject: [Vimprobable-users] [PATCH 12/18] Used numval instead of keyval to calculate new count. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-13-git-send-email-alkim1234@gmail.com> --- main.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 3824d99..9893c23 100644 --- a/main.c +++ b/main.c @@ -538,10 +538,7 @@ inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { numval = g_unichar_digit_value((gunichar) gdk_keyval_to_unicode(event->keyval)); if (followTarget[0] && ((numval >= 1 && numval <= 9) || (numval == 0 && count))) { /* allow a zero as non-first number */ - if (event->keyval >= GDK_KP_0 && event->keyval <= GDK_KP_9) - count = (count ? count * 10 : 0) + (event->keyval - GDK_KP_0); - else - count = (count ? count * 10 : 0) + (event->keyval - GDK_0); + count = (count ? count * 10 : 0) + numval; a.i = Silent; a.s = g_strdup_printf("vimprobable_update_hints(%d)", count); script(&a); -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:47:02 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:47:02 -0700 Subject: [Vimprobable-users] [PATCH 13/18] Fixed bug with not being able to press enter to follow single digit hints. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-14-git-send-email-alkim1234@gmail.com> --- main.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 9893c23..b9c902b 100644 --- a/main.c +++ b/main.c @@ -446,10 +446,10 @@ inputbox_activate_cb(GtkEntry *entry, gpointer user_data) { a.i = HideCompletion; complete(&a); - if (length < 2) + if (length == 0) return; text = (char*)gtk_entry_get_text(entry); - if (text[0] == ':') { + if (length > 1 && text[0] == ':') { for (i = 0; i < LENGTH(commands); i++) { if (commands[i].cmd == NULL) break; @@ -480,7 +480,7 @@ inputbox_activate_cb(GtkEntry *entry, gpointer user_data) { } echo(&a); } - } else if ((forward = text[0] == '/') || text[0] == '?') { + } else if (length > 1 && ((forward = text[0] == '/') || text[0] == '?')) { webkit_web_view_unmark_text_matches(webview); #ifdef ENABLE_MATCH_HIGHLITING webkit_web_view_mark_text_matches(webview, &text[1], FALSE, 0); @@ -495,6 +495,11 @@ inputbox_activate_cb(GtkEntry *entry, gpointer user_data) { search_direction = forward; search_handle = g_strdup(&text[1]); #endif + } else if (count && (text[0] == '`' || text[0] == '~')) { + a.i = Silent; + a.s = g_strdup_printf("vimprobable_fire(%d)", count); + script(&a); + update_state(); } else return; if (!echo_active) -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:47:03 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:47:03 -0700 Subject: [Vimprobable-users] [PATCH 14/18] Removed compile time warning about count_buf not being used. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-15-git-send-email-alkim1234@gmail.com> --- main.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/main.c b/main.c index b9c902b..72cd1c2 100644 --- a/main.c +++ b/main.c @@ -511,7 +511,6 @@ gboolean inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { Arg a; int numval; - char count_buf[BUFFERSIZE]; switch (event->keyval) { case GDK_bracketleft: -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:47:04 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:47:04 -0700 Subject: [Vimprobable-users] [PATCH 15/18] Changed hint mode start key from ` to period. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-16-git-send-email-alkim1234@gmail.com> Also changed key to follow in new window from ~ to comma. --- keymap.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/keymap.h b/keymap.h index 25d7c2c..6bb2757 100644 --- a/keymap.h +++ b/keymap.h @@ -101,15 +101,15 @@ Key keys[] = { { 0, 0, GDK_KP_Divide, input, {.s = "/"} }, { GDK_SHIFT_MASK, 0, GDK_question, input, {.s = "?"} }, - { 0, 0, GDK_quoteleft, input, {.s = "`"} }, - { GDK_SHIFT_MASK, 0, GDK_asciitilde, input, {.s = "~"} }, + { 0, 0, GDK_period, input, {.s = "."} }, + { 0, 0, GDK_comma, input, {.s = ","} }, { 0, GDK_VoidSymbol, GDK_Escape, set, {ModeNormal} }, { GDK_CONTROL_MASK, GDK_VoidSymbol, GDK_bracketleft,set, {ModeNormal} }, { GDK_CONTROL_MASK, 0, GDK_z, set, {ModePassThrough} }, { GDK_CONTROL_MASK, 0, GDK_v, set, {ModeSendKey} }, - { 0, 0, GDK_f, input, {.s = "`"} }, - { GDK_SHIFT_MASK, 0, GDK_F, input, {.s = "~"} }, + { 0, 0, GDK_f, input, {.s = "."} }, + { GDK_SHIFT_MASK, 0, GDK_F, input, {.s = ","} }, { 0, GDK_g, GDK_i, focus_input,{} }, { 0, 0, GDK_u, revive, {} }, -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:47:05 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:47:05 -0700 Subject: [Vimprobable-users] [PATCH 16/18] Changed code to implement period as new follow key In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-17-git-send-email-alkim1234@gmail.com> The code has been updated to reflect the change from ` to period as the key that starts hintmode. Basically, we now check for either a comma or period, instead of ` or ~, at the beginning of inputbox to see if we're in hint mode. --- main.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 72cd1c2..d20c7c0 100644 --- a/main.c +++ b/main.c @@ -495,7 +495,7 @@ inputbox_activate_cb(GtkEntry *entry, gpointer user_data) { search_direction = forward; search_handle = g_strdup(&text[1]); #endif - } else if (count && (text[0] == '`' || text[0] == '~')) { + } else if (count && (text[0] == '.' || text[0] == ',')) { a.i = Silent; a.s = g_strdup_printf("vimprobable_fire(%d)", count); script(&a); @@ -608,7 +608,7 @@ static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { webkit_web_view_search_text(webview, &text[1], searchoptions & CaseSensitive, forward, searchoptions & Wrapping); return TRUE; } else if (gtk_widget_is_focus(GTK_WIDGET(entry)) && length >= 1 && - (text[0] == '`' || text[0] == '~')) { + (text[0] == '.' || text[0] == ',')) { a.i = Silent; a.s = g_strdup("vimprobable_cleanup()"); script(&a); @@ -937,9 +937,9 @@ input(const Arg *arg) { */ set_widget_font_and_color(inputbox, urlboxfont[index], urlboxbgcolor[index], urlboxcolor[index]); - if (arg->s[0] == '`' || arg->s[0] == '~') { + if (arg->s[0] == '.' || arg->s[0] == ',') { memset(followTarget, 0, 0); - strncpy(followTarget, arg->s[0] == '`' ? "current" : "new", 8); + strncpy(followTarget, arg->s[0] == '.' ? "current" : "new", 8); a.i = Silent; a.s = g_strdup("vimprobable_show_hints()"); script(&a); -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:47:06 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:47:06 -0700 Subject: [Vimprobable-users] [PATCH 17/18] Numbers wouldn't open hints in new window. Fixed. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-18-git-send-email-alkim1234@gmail.com> There was a problem with relying on followTarget to see whether vimprobable was in hint mode. This was caused because within script(), inputbox_changed_cb would be called, and inputbox_changed_cb memset followTarget, so hints would always be followed in same window when using numbers. Now, followTarget is only memset before "current" or "new" is assigned to it, and mode is set to ModeHints to signify vimprobable is hints mode. Fixed bug where numbers won't open background hint in background --- main.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index d20c7c0..2be03b8 100644 --- a/main.c +++ b/main.c @@ -540,7 +540,7 @@ inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { } numval = g_unichar_digit_value((gunichar) gdk_keyval_to_unicode(event->keyval)); - if (followTarget[0] && ((numval >= 1 && numval <= 9) || (numval == 0 && count))) { + if (mode == ModeHints && ((numval >= 1 && numval <= 9) || (numval == 0 && count))) { /* allow a zero as non-first number */ count = (count ? count * 10 : 0) + numval; a.i = Silent; @@ -619,7 +619,7 @@ static gboolean inputbox_changed_cb(GtkEditable *entry, gpointer user_data) { return TRUE; } else if (length == 0 && followTarget[0]) { - memset(followTarget, 0, 8); + mode = ModeNormal; a.i = Silent; a.s = g_strdup("vimprobable_clear()"); script(&a); @@ -938,7 +938,8 @@ input(const Arg *arg) { set_widget_font_and_color(inputbox, urlboxfont[index], urlboxbgcolor[index], urlboxcolor[index]); if (arg->s[0] == '.' || arg->s[0] == ',') { - memset(followTarget, 0, 0); + mode = ModeHints; + memset(followTarget, 0, 8); strncpy(followTarget, arg->s[0] == '.' ? "current" : "new", 8); a.i = Silent; a.s = g_strdup("vimprobable_show_hints()"); @@ -1318,7 +1319,6 @@ script(const Arg *arg) { a.i = TargetNew; else a.i = TargetCurrent; - memset(followTarget, 0, 8); a.s = (value + 5); open_arg(&a); } -- 1.7.5.1 From alkim1234 at gmail.com Mon May 23 03:47:07 2011 From: alkim1234 at gmail.com (Albert Kim) Date: Sun, 22 May 2011 20:47:07 -0700 Subject: [Vimprobable-users] [PATCH 18/18] Removal of last number in hint mode possible. In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <1306122427-10597-19-git-send-email-alkim1234@gmail.com> You can now remove the last number from hint mode using Ctrl+Shift+Backspace. --- main.c | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 2be03b8..73a12ea 100644 --- a/main.c +++ b/main.c @@ -539,15 +539,28 @@ inputbox_keypress_cb(GtkEntry *entry, GdkEventKey *event) { break; } - numval = g_unichar_digit_value((gunichar) gdk_keyval_to_unicode(event->keyval)); - if (mode == ModeHints && ((numval >= 1 && numval <= 9) || (numval == 0 && count))) { - /* allow a zero as non-first number */ - count = (count ? count * 10 : 0) + numval; - a.i = Silent; - a.s = g_strdup_printf("vimprobable_update_hints(%d)", count); - script(&a); - update_state(); - return TRUE; + if (mode == ModeHints) { + if ((CLEAN(event->state) & GDK_SHIFT_MASK) && + (CLEAN(event->state) & GDK_CONTROL_MASK) && + (event->keyval == GDK_BackSpace)) { + count /= 10; + a.i = Silent; + a.s = g_strdup_printf("vimprobable_update_hints(%d)", count); + script(&a); + update_state(); + return TRUE; + } + + numval = g_unichar_digit_value((gunichar) gdk_keyval_to_unicode(event->keyval)); + if ((numval >= 1 && numval <= 9) || (numval == 0 && count)) { + /* allow a zero as non-first number */ + count = (count ? count * 10 : 0) + numval; + a.i = Silent; + a.s = g_strdup_printf("vimprobable_update_hints(%d)", count); + script(&a); + update_state(); + return TRUE; + } } return FALSE; -- 1.7.5.1 From hannes at yllr.net Mon May 23 15:58:38 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Mon, 23 May 2011 17:58:38 +0200 Subject: [Vimprobable-users] [PATCH 00/18] New Way to Handle Hinting In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <20110523175838.15d3dc15@workstation> Looking very good at first glance, thanks a lot! Please give me a few days for final, intensive testing. As this is quite a big change of a very central function, I want to be as certain as possible there is no regression or unexpected behaviour. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From yako.conrad.peter at googlemail.com Mon May 23 20:26:10 2011 From: yako.conrad.peter at googlemail.com (Peter Conrad) Date: Mon, 23 May 2011 22:26:10 +0200 Subject: [Vimprobable-users] Cannot enter ex-mode by a non-standard keyboard Message-ID: Hello everybody, first, I'm completely new to Vimprobable. I discovered it today and I felt quite amazed. I tried searching the archive but couldn't find anything related to my problem. The problem is that I am not able to enter the ex-mode by my keyboard layout. I'm using the NEO layout which is an Dvorak-inspired layout optimized for German. It uses six layers where most punctuation marks and programming-relevant symbols (therefore the slash and the colon, too) can be found on layer 3 which is accessible by the former 'caps lock' key. This never caused problems in any application and, for instance, VIM is working very fine with it. However, in Vimprobable I could not use it to enter ex-mode or search in a page. It worked fine when I switched back to standard layout and once I entered the ex-mode it will accept any typed character, but the only way to get into it without switching is using a shortcut like 'o' and then erasing the command after the colon. I think you would agree that this is not really an acceptable solution, and therefore I'm asking you for help. I tried looking into the source myself but I'm unfortunately not that much into programming yet so if you got any solution, I would highly appreciate it. If that's of any help, my modifier key identifies with ISO_Level3_Shift. You can get an overview of NEO under http://www.neo-layout.org/ (in German) and also find the related xkbmap in the download section there. I hope that I'm not asking for too much. Regards, Peter From hannes at yllr.net Mon May 23 20:47:05 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Mon, 23 May 2011 22:47:05 +0200 Subject: [Vimprobable-users] Cannot enter ex-mode by a non-standard keyboard In-Reply-To: References: Message-ID: <20110523224705.5f12bbe0@workstation> Hi! Peter Conrad wrote: > The problem is that I am not able to enter the ex-mode by > my keyboard layout. I'm using the NEO layout which is an > Dvorak-inspired layout optimized for German. > > If that's of any help, my modifier key identifies with > ISO_Level3_Shift. Could you try changing the appropriate keybinding? The line to change should read: { GDK_SHIFT_MASK, 0, GDK_colon, input, {.s = ":" } }, It can be found in keymap.h (Vimprobable2) or config.h (Vimprobable1). Replace GDK_SHIFT_MASK with GDK_ISO_Level3_Shift. If that doesn't help, open xev and note the keycodes it prints to your terminal when you press the appropriate keys to produce a colon. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From yako.conrad.peter at googlemail.com Wed May 25 19:35:56 2011 From: yako.conrad.peter at googlemail.com (Peter Conrad) Date: Wed, 25 May 2011 21:35:56 +0200 Subject: [Vimprobable-users] Cannot enter ex-mode by a non-standard keyboard In-Reply-To: <20110523224705.5f12bbe0@workstation> References: <20110523224705.5f12bbe0@workstation> Message-ID: <20110525213556.7b245c83@googlemail.com> Hi, > Could you try changing the appropriate keybinding? The line to change > should read: > > { GDK_SHIFT_MASK, 0, GDK_colon, input, {.s = ":" } }, > > It can be found in keymap.h (Vimprobable2) or config.h (Vimprobable1). > Replace GDK_SHIFT_MASK with GDK_ISO_Level3_Shift. GDK_ISO_Level3_Shift itself didn't work. However after doing some research and experimenting around with it, I found out that the correct name was GDK_MOD5_MASK. So thanks to your help I could solve it and now I'm gonna enjoy using Vimprobable ;-) Thanks very much! Peter From hannes at yllr.net Wed May 25 21:12:52 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Wed, 25 May 2011 23:12:52 +0200 Subject: [Vimprobable-users] Cannot enter ex-mode by a non-standard keyboard In-Reply-To: <20110525213556.7b245c83@googlemail.com> References: <20110523224705.5f12bbe0@workstation> <20110525213556.7b245c83@googlemail.com> Message-ID: <20110525231252.6394c6a3@workstation> Hi! Peter Conrad wrote: > > Could you try changing the appropriate keybinding? The line to > > change should read: > > > > { GDK_SHIFT_MASK, 0, GDK_colon, input, {.s = ":" } }, > > > > It can be found in keymap.h (Vimprobable2) or config.h > > (Vimprobable1). Replace GDK_SHIFT_MASK with GDK_ISO_Level3_Shift. > > GDK_ISO_Level3_Shift itself didn't work. > However after doing some research and experimenting around with it, I > found out that the correct name was GDK_MOD5_MASK. > So thanks to your help I could solve it and now I'm gonna enjoy > using Vimprobable ;-) > Thanks very much! Glad to hear it! Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Fri May 27 15:28:43 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Fri, 27 May 2011 17:28:43 +0200 Subject: [Vimprobable-users] [PATCH] Don't open a new window when ctrl+left-clicking on empty space In-Reply-To: <1304260344-7836-1-git-send-email-hpdeifel@gmx.de> References: <1304260344-7836-1-git-send-email-hpdeifel@gmx.de> Message-ID: <20110527172843.45546a17@workstation> Applied, thank you! -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Fri May 27 15:30:26 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Fri, 27 May 2011 17:30:26 +0200 Subject: [Vimprobable-users] [PATCH] Add coding style note to PATCHES In-Reply-To: <20110228003225.GA24458@debian.ttn6tadam> References: <20110228003225.GA24458@debian.ttn6tadam> Message-ID: <20110527173026.4ddc7327@workstation> Added -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Fri May 27 15:52:29 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Fri, 27 May 2011 17:52:29 +0200 Subject: [Vimprobable-users] [PATCH 00/18] New Way to Handle Hinting In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <20110527175229.5013a8d7@workstation> Hi! I found one issue which I can't really figure out yet, but nevertheless, it's a reproducable crash: - Go to a website with a text input field (e.g. http://www.vimprobable.org/mailman/listinfo/vimprobable-users) - Activate a text input field (the browser should now be in INSERT mode) - Press escape - the browser crashes Any ideas what could be causing this? Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Fri May 27 15:55:04 2011 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Fri, 27 May 2011 17:55:04 +0200 Subject: [Vimprobable-users] [PATCH 00/18] New Way to Handle Hinting In-Reply-To: <1306122427-10597-1-git-send-email-alkim1234@gmail.com> References: <20110503101837.3e3afcbd@workstation> <1306122427-10597-1-git-send-email-alkim1234@gmail.com> Message-ID: <20110527175504.2f067477@workstation> Sending another mail, because I would like to keep these two issues separate: It is my distinct impression that after applying this patch series, it takes longer for the hinting mode to work. What I mean is: While loading a website, in the current release version, I can press f pretty much immediately when the page starts appearing and it'll all work as intended. In your version, however, pressing f too early will put the browser into HINT mode internally, but the hints won't appear on the page. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From jtimrod at yahoo.com Mon May 30 15:44:59 2011 From: jtimrod at yahoo.com (Jason Timrod) Date: Mon, 30 May 2011 13:44:59 -0700 (PDT) Subject: [Vimprobable-users] [PATCH V2 01/10] Allow for :set downloadpath In-Reply-To: <20110219102559.35ec13f2@workstation> References: <20110217030715.GA13695@debian.ttn6tadam> <20110219102559.35ec13f2@workstation> Message-ID: <18447.75248.qm@web121006.mail.ne1.yahoo.com> hi, what happened with this series? is it under development? ?i am really interested in it Jason ----- Original Message ----- From: Hannes Sch?ller To: vimprobable-users at vimprobable.org Cc: Sent: Saturday, February 19, 2011 9:25 AM Subject: Re: [Vimprobable-users] [PATCH V2 01/10] Allow for :set downloadpath Thomas Adam wrote: > --- a/config.h > +++ b/config.h > @@ -176,4 +176,5 @@ static Setting browsersettings[] = { >? ? ? { "proxy",? ? ? ? ? NULL,? ? ? ? ? ? ? "",? ? ? ? ? ? ? ? ? ? ? ? ? ? FALSE,? ? ? ? ? TRUE,? ? ? ? ? ? FALSE,? ? ? ? ? FALSE? }, >? ? ? { "scrollbars",? ? ? NULL,? ? ? ? ? ? ? "",? ? ? ? ? ? ? ? ? ? ? ? ? ? FALSE,? ? ? ? ? TRUE,? ? ? ? ? ? FALSE,? ? ? ? ? FALSE? }, >? ? ? { "completioncase",? NULL,? ? ? ? ? ? ? "",? ? ? ? ? ? ? ? ? ? ? ? ? ? FALSE,? ? ? ? ? TRUE,? ? ? ? ? ? FALSE,? ? ? ? ? FALSE? }, > +? ? { "downloadpath",? ? NULL,? ? ? ? ? ? ? "",? ? ? ? ? ? ? ? ? ? ? ? ? ? FALSE,? ? ? ? ? FALSE,? ? ? ? ? FALSE,? ? ? ? ? FALSE? }, Again, I believe this should be +? ? { "downloadpath",? ? downloadpath,? ? ? "",? ? ? ? ? ? ? ? ? ? ? ? ? ? FALSE,? ? ? ? ? FALSE,? ? ? ? ? FALSE,? ? ? ? ? FALSE? }, unless you've got a good reason not to include the internal variable there for automatic handling. > @@ -191,6 +193,39 @@ ascii_bar(int total, int state, char *string) { >? } >? #endif >? > +/* Check validity of specified dl_path, either through :set, or more > + * explicitly at the time of download. > + */ > +void > +set_download_path(char *dl_path) > +{ > +??? struct stat dir; > + > +??? /* TA:? XXX - check for write permissions as well? */ I think that would indeed make sense. > +??? if (dl_path == NULL || (stat(dl_path, &dir) == -1)) > +??? { > +??? ??? { > +??? ??? ??? char *temp_dl_path = g_strdup_printf(DOWNLOADS_PATH); Mixing declarations and code. > +??? ??? ??? give_feedback(g_strdup_printf("Download path \"%s\" doesn't exist, using: " > +??? ??? ??? ??? ? ? ? "\"%s\"", (dl_path == NULL) ? "" : dl_path, > +??? ??? ??? ??? ? ? ? temp_dl_path)); > + > +??? ??? ??? g_free(temp_dl_path); > +??? ??? } > +??? ??? downloadpath = g_strdup_printf(DOWNLOADS_PATH); This error handling *could* be the reason for not using the automated handling, but if so, that should be worth an explanatory comment at the very least. It should also be considered to handle this the other way around: Use the automatic handling, but overwrite it again with the default in case the desired path doesn't exist. > + > +??? ??? return; > +??? } > +??? downloadpath = g_strdup(dl_path); > + > +??? /* TA: XXX - use SAFEFREE macro when it's merged. */ > +??? g_free(dl_path); Apparantely, you believe there is still something to do here. > @@ -269,11 +304,18 @@ webview_download_cb(WebKitWebView *webview, WebKitDownload *download, gpointer u >? ? ? uint32_t size; >? ? ? Arg a; >? > +? ? /* If there's no path to download the file, let set_download_path() decide > +? ? * for us what the default should be.? This is why the parameter is NULL > +? ? * here. > +? ? */ > +? ? if (downloadpath == NULL || strlen(downloadpath) == 0) > +??? ? ? set_download_path(NULL); When can this case occur? It's good that you catch it, but I'm curious about the condition leading to this. _______________________________________________ Vimprobable-users mailing list Vimprobable-users at vimprobable.org http://vimprobable.org/mailman/listinfo/vimprobable-users