summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/completion.c2
-rw-r--r--src/config.h5
-rw-r--r--src/main.c3
-rw-r--r--src/main.h4
4 files changed, 6 insertions, 8 deletions
diff --git a/src/completion.c b/src/completion.c
index 5f94cc2..99321ef 100644
--- a/src/completion.c
+++ b/src/completion.c
@@ -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);
}
diff --git a/src/config.h b/src/config.h
index 9e39796..6601d37 100644
--- a/src/config.h
+++ b/src/config.h
@@ -27,11 +27,6 @@
#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[] = {
diff --git a/src/main.c b/src/main.c
index 3905791..efcfe64 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);
}
diff --git a/src/main.h b/src/main.h
index 464b371..99a9c4d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -55,6 +55,10 @@
#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, ""))