diff finch/libgnt/gntentry.c @ 15959:efbced3f38ac

Update the tab completion a little bit. The binding for suggest-show will perform suggest-next if the suggest-dropdown is already showing. If there's just one suggestion, then complete with that suggestion.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 29 Mar 2007 01:26:24 +0000
parents 0e3a8505ebbe
children c31328dba5c2
line wrap: on
line diff
--- a/finch/libgnt/gntentry.c	Wed Mar 28 05:37:29 2007 +0000
+++ b/finch/libgnt/gntentry.c	Thu Mar 29 01:26:24 2007 +0000
@@ -16,6 +16,7 @@
 
 static GntWidgetClass *parent_class = NULL;
 
+static gboolean gnt_entry_key_pressed(GntWidget *widget, const char *text);
 static void gnt_entry_set_text_internal(GntEntry *entry, const char *text);
 
 static void
@@ -321,7 +322,15 @@
 static gboolean
 suggest_show(GntBindable *bind, GList *null)
 {
-	return show_suggest_dropdown(GNT_ENTRY(bind));
+	GntEntry *entry = GNT_ENTRY(bind);
+	if (entry->ddown) {
+		if (g_list_length(GNT_TREE(entry->ddown)->list) == 1)
+			gnt_entry_key_pressed(GNT_WIDGET(entry), "\r");
+		else
+			gnt_bindable_perform_action_named(GNT_BINDABLE(entry->ddown), "move-down");
+		return TRUE;
+	}
+	return show_suggest_dropdown(entry);
 }
 
 static gboolean