[Xfce4-commits] <midori:master> Fix keyboard navigation in suggestions

Christian Dywan noreply at xfce.org
Tue Jan 10 02:20:02 CET 2012


Updating branch refs/heads/master
         to 3d5d2f47661b0d82eec35a679acfe329522562ab (commit)
       from 696b377b32263f6e0e7f04f5f9d9221e5cfceef2 (commit)

commit 3d5d2f47661b0d82eec35a679acfe329522562ab
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Sat Jan 7 22:55:18 2012 -0400

    Fix keyboard navigation in suggestions

 extensions/formhistory/formhistory-frontend.h      |    2 +-
 extensions/formhistory/formhistory-gdom-frontend.c |   10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/extensions/formhistory/formhistory-frontend.h b/extensions/formhistory/formhistory-frontend.h
index ee91971..3f7469f 100644
--- a/extensions/formhistory/formhistory-frontend.h
+++ b/extensions/formhistory/formhistory-frontend.h
@@ -35,7 +35,7 @@ typedef struct
     GtkWidget* popup;
     GtkWidget* root;
     gchar* oldkeyword;
-    guint selection_index;
+    glong selection_index;
     #else
     gchar* jsforms;
     #endif
diff --git a/extensions/formhistory/formhistory-gdom-frontend.c b/extensions/formhistory/formhistory-gdom-frontend.c
index 18efd82..2912347 100644
--- a/extensions/formhistory/formhistory-gdom-frontend.c
+++ b/extensions/formhistory/formhistory-gdom-frontend.c
@@ -272,16 +272,18 @@ formhistory_editbox_key_pressed_cb (WebKitDOMElement* element,
             matches = gtk_tree_model_iter_n_children (priv->completion_model, NULL);
             if (key == 38)
             {
-                if (priv->selection_index == -1)
+                if (priv->selection_index <= 0)
                     priv->selection_index = matches - 1;
                 else
-                    priv->selection_index = MAX (priv->selection_index - 1, 1);
+                    priv->selection_index = MAX (priv->selection_index - 1, 0);
             }
             else
             {
-                priv->selection_index = MIN (priv->selection_index + 1, matches -1);
+                if (priv->selection_index == matches - 1)
+                    priv->selection_index = 0;
+                else
+                    priv->selection_index = MIN (priv->selection_index + 1, matches -1);
             }
-
             path = gtk_tree_path_new_from_indices (priv->selection_index, -1);
             gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->treeview), path, NULL, FALSE);
             formhistory_suggestion_set (path, priv);


More information about the Xfce4-commits mailing list