Fixed reseted prefixLength for the hints.
authorDaniel Carl <danielcarl@gmx.de>
Sat, 22 Dec 2012 15:58:03 +0000 (16:58 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Sat, 22 Dec 2012 15:58:03 +0000 (16:58 +0100)
The prefixLength was set back to zero on call of hints_clear so that hinting
with chars didn't work properly. Now the prefixLength is alway given as
parameter to the function hints_create.

src/hints.c

index 2760977..a160240 100644 (file)
@@ -115,12 +115,8 @@ void hints_create(const gchar* input, guint mode, const guint prefixLength)
     Window* win;
 
     hints_clear();
-    hints->mode = mode;
-
-    /* don't overwrite if zero */
-    if (prefixLength) {
-        hints->prefixLength = prefixLength;
-    }
+    hints->mode         = mode;
+    hints->prefixLength = prefixLength;
 
     doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(vp.gui.webview));
     if (!doc) {
@@ -151,7 +147,7 @@ void hints_update(const gulong num)
 
     if (num == 0) {
         /* recreate the hints */
-        hints_create(NULL, hints->mode, 0);
+        hints_create(NULL, hints->mode, hints->prefixLength);
         return;
     }
 
@@ -514,7 +510,7 @@ static gboolean hints_changed_callback(GtkEditable *entry, gpointer data)
     const gchar* text = GET_TEXT();
 
     /* skip hinting prefixes like '.', ',', ';y' ... */
-    hints_create(text + vp.hints.prefixLength, vp.hints.mode, 0);
+    hints_create(text + vp.hints.prefixLength, vp.hints.mode, vp.hints.prefixLength);
 
     return TRUE;
 }