c = g_hash_table_lookup(vp.behave.commands, name);
if (!c) {
vp_echo(VP_MSG_ERROR, TRUE, "Command '%s' not found", name);
+ vp_set_mode(VP_MODE_NORMAL, FALSE);
+
return FALSE;
}
a.i = c->arg.i;
const int len = g_list_length(state->history);
char* message = NULL;
const int count = state->count ? state->count : 1;
-
+
if (!len) {
return FALSE;
}
} else {
state->history_pointer = (len + state->history_pointer + count) % len;
}
-
+
const char* command = (char*)g_list_nth_data(state->history, state->history_pointer);
message = g_strconcat(arg->s, command, NULL);
command_write_input(message);
static void vp_inputbox_activate_cb(GtkEntry *entry, gpointer user_data)
{
- gboolean success = FALSE;
const char *text;
guint16 length = gtk_entry_get_text_length(entry);
Gui* gui = &vp.gui;
case ':':
completion_clean();
- success = vp_process_input((text + 1));
- if (!success) {
- /* switch to normal mode after running command without success the
- * mode after success is set by command_run to the value defined
- * for the command */
- vp_set_mode(VP_MODE_NORMAL, FALSE);
- }
+ vp_process_input((text + 1));
+
/* save the command in history */
history_append((text + 1));