Reset the zoomlevel to the default value.
.SS Command-History
.TP
-.BI [ N "]command-hist-prev [" PREFIX "], [" N "]command-hist-next [" PREFIX ]
-Prints the previous or next cammand from history into inputbox. If \fIPREFIX\fP
-is given, this will be used as prefix for the inserted command, else the
-default ':' will be used.
-If there is already text in the input box this will be used to get previous
-history items.
+.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.
.SS Misc
.TP
.BI [ N "]search-forward, [" N "]search-backward"
{"zoominfull", command_zoom, {COMMAND_ZOOM_IN | COMMAND_ZOOM_FULL}},
{"zoomoutfull", command_zoom, {COMMAND_ZOOM_OUT | COMMAND_ZOOM_FULL}},
{"zoomreset", command_zoom, {COMMAND_ZOOM_RESET}},
- {"command-hist-next", command_history, {VP_SEARCH_FORWARD, ":"}},
- {"command-hist-prev", command_history, {VP_SEARCH_BACKWARD, ":"}},
+ {"command-hist-next", command_history, {VP_SEARCH_FORWARD}},
+ {"command-hist-prev", command_history, {VP_SEARCH_BACKWARD}},
};
static void command_write_input(const char* str);
gboolean command_history(const Arg* arg)
{
- char* msg = NULL;
const int count = vp.state.count ? vp.state.count : 1;
const gint step = count * (arg->i == VP_SEARCH_BACKWARD ? -1 : 1);
const char* entry = history_get(step);
if (!entry) {
return FALSE;
}
- msg = g_strconcat(arg->s, entry, NULL);
- command_write_input(msg);
- g_free(msg);
+ command_write_input(entry);
return TRUE;
}
/* get the search prefix only on start of history search */
if (!vp.state.history_prefix) {
- const char* text = GET_TEXT();
- /* TODO at the moment we skip only the first char of input box but
- * maybe we'll have history items that have a longer or no prefix */
- OVERWRITE_STRING(vp.state.history_prefix, (text + 1));
+ OVERWRITE_STRING(vp.state.history_prefix, GET_TEXT());
}
for (GList* l = core.behave.history; l; l = l->next) {
/* duplicate the content because this may change for example if
* :set varName? is used the text is changed to the new printed
* content of inputbox */
- command = g_strdup((text + 1));
+ command = g_strdup((text));
switch (*text) {
case '/':
case '?':
{
- Arg a = {*text == '/' ? VP_SEARCH_FORWARD : VP_SEARCH_BACKWARD, command};
+ Arg a = {*text == '/' ? VP_SEARCH_FORWARD : VP_SEARCH_BACKWARD, (command + 1)};
command_search(&a);
}
break;
case ':':
completion_clean();
- vp_process_input(command);
+ vp_process_input((command + 1));
- /* save the command in history */
+ /* save the command together with the first char in history */
history_append(command);
break;