changeset 991:185e6a74517d

Slight code redundancy reduction.
author zas_
date Sun, 24 Aug 2008 14:33:03 +0000
parents 070bfc3591bc
children 8c9de89423b8
files src/ui_tabcomp.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui_tabcomp.c	Sun Aug 24 14:14:37 2008 +0000
+++ b/src/ui_tabcomp.c	Sun Aug 24 14:33:03 2008 +0000
@@ -142,10 +142,9 @@
 	g_free(td);
 }
 
-static gint tab_completion_emit_enter_signal(TabCompData *td)
+static gchar *tab_completion_get_text(TabCompData *td)
 {
 	gchar *text;
-	if (!td->enter_func) return FALSE;
 
 	text = g_strdup(gtk_entry_get_text(GTK_ENTRY(td->entry)));
 
@@ -156,6 +155,15 @@
 		g_free(t);
 		}
 
+	return text;
+}
+
+static gint tab_completion_emit_enter_signal(TabCompData *td)
+{
+	gchar *text;
+	if (!td->enter_func) return FALSE;
+
+	text = tab_completion_get_text(td);
 	td->enter_func(text, td->enter_data);
 	g_free(text);
 
@@ -167,15 +175,7 @@
 	gchar *text;
 	if (!td->tab_func) return;
 
-	text = g_strdup(gtk_entry_get_text(GTK_ENTRY(td->entry)));
-
-	if (text[0] == '~')
-		{
-		gchar *t = text;
-		text = expand_tilde(text);
-		g_free(t);
-		}
-
+	text = tab_completion_get_text(td);
 	td->tab_func(text, td->tab_data);
 	g_free(text);
 }