From 285d2efdc68193cb3ad5ee7f2524d31750dabf16 Mon Sep 17 00:00:00 2001 From: Albert Kim Date: Sun, 22 May 2011 20:46:55 -0700 Subject: [PATCH] Added proper handling of numbers into new hinting system. --- main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/main.c b/main.c index 6dccb72..0dd346a 100644 --- a/main.c +++ b/main.c @@ -604,6 +604,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: @@ -631,6 +632,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; } -- 2.11.4.GIT