.TP
.BI [ N "]command-hist-prev, [" N "]command-hist-next"
Prints the previous or next cammand from history into inputbox. If there is
-already text in the input box this will be used to get history items.
+already text in the input box this will be used to get history items. A
+command is not a internal command, but every string entered into inputbox that
+begins with \fI[:/?]\fP. So the history contains real commands and search queries.
+.br
+Note that the history distinguishes between '/query' and '?query' what's not
+what the vim editor does.
.SS Misc
.TP
.BI [ N "]search-forward, [" N "]search-backward"
static void vp_inputbox_activate_cb(GtkEntry *entry, gpointer user_data)
{
const char* text;
- char* command = NULL;
+ gboolean hist_save = FALSE;
+ char* command = NULL;
guint16 length = gtk_entry_get_text_length(entry);
Gui* gui = &vp.gui;
* content of inputbox */
command = g_strdup((text));
+ Arg a;
switch (*text) {
case '/':
case '?':
- {
- Arg a = {*text == '/' ? VP_SEARCH_FORWARD : VP_SEARCH_BACKWARD, (command + 1)};
- command_search(&a);
- }
+ a.i = *text == '/' ? VP_SEARCH_FORWARD : VP_SEARCH_BACKWARD;
+ a.s = (command + 1);
+ command_search(&a);
+ hist_save = TRUE;
break;
case ':':
completion_clean();
vp_process_input((command + 1));
-
- /* save the command together with the first char in history */
- history_append(command);
-
+ hist_save = TRUE;
break;
}
+
+ if (hist_save) {
+ /* save the command in history */
+ history_append(command);
+ }
g_free(command);
}