Write completion content direct to inputbox (#38).
authorDaniel Carl <danielcarl@gmx.de>
Thu, 4 Jul 2013 21:51:48 +0000 (23:51 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 4 Jul 2013 21:51:48 +0000 (23:51 +0200)
This prevent the cropping of completed content which leads to the new
generation of completion which in fact does only find a single item.

src/completion.c
src/config.h
src/main.c
src/main.h

index 5f94cc2..99321ef 100644 (file)
@@ -271,7 +271,7 @@ static gboolean tree_selection_func(GtkTreeSelection *selection,
             comp.text = g_strdup_printf("%s%s", comp.prefix, value);
         }
         /* print the text also into inputbox */
-        vb_echo_force(VB_MSG_NORMAL, false, "%s", comp.text);
+        PUT_TEXT(comp.text);
         g_free(value);
     }
 
index 9e39796..6601d37 100644 (file)
 #define MESSAGE_TIMEOUT             5
 const unsigned int SETTING_MAX_CONNS          = 25;
 const unsigned int SETTING_MAX_CONNS_PER_HOST = 5;
-
-/* number of chars in inputbox - if completion or stepping through history
- * print values longer this value, the cursor will be placed to the beginning
- * so that the command part will be visible */
-const unsigned int INPUT_LENGTH  = 120;
 const unsigned int MAXIMUM_HINTS = 500;
 
 const char *default_config[] = {
index 3905791..efcfe64 100644 (file)
@@ -589,8 +589,7 @@ static void inputbox_print(gboolean force, const MessageType type, gboolean hide
         vb.state.input_type = type;
         vb_update_input_style();
     }
-    gtk_entry_set_text(GTK_ENTRY(vb.gui.inputbox), message);
-    gtk_editable_set_position(GTK_EDITABLE(vb.gui.inputbox), strlen(message) > INPUT_LENGTH ? 0 : -1);
+    PUT_TEXT(message);
     if (hide) {
         g_timeout_add_seconds(MESSAGE_TIMEOUT, (GSourceFunc)hide_message, NULL);
     }
index 464b371..99a9c4d 100644 (file)
 #endif
 
 #define GET_TEXT() (gtk_entry_get_text(GTK_ENTRY(vb.gui.inputbox)))
+#define PUT_TEXT(x) { \
+    gtk_entry_set_text(GTK_ENTRY(vb.gui.inputbox), x); \
+    gtk_editable_set_position(GTK_EDITABLE(vb.gui.inputbox), -1); \
+}
 #define GET_URI() (webkit_web_view_get_uri(vb.gui.webview))
 #define CLEAN_MODE(mode) ((mode) & ~(VB_MODE_COMPLETE | VB_MODE_SEARCH | VB_MODE_HINTING))
 #define CLEAR_INPUT() (vb_echo(VB_MSG_NORMAL, ""))