mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
When pressing line down, the command line wasn't saved to history.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@653 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
9870fbe92e
commit
ecb334b6cc
@ -32,7 +32,7 @@ static GList *cmdhist, *histpos;
|
|||||||
static int histlines;
|
static int histlines;
|
||||||
static int window_history;
|
static int window_history;
|
||||||
|
|
||||||
void command_history_add(WINDOW_REC *window, const char *text, int prepend)
|
void command_history_add(WINDOW_REC *window, const char *text)
|
||||||
{
|
{
|
||||||
GList **pcmdhist, *link;
|
GList **pcmdhist, *link;
|
||||||
int *phistlines;
|
int *phistlines;
|
||||||
@ -58,9 +58,6 @@ void command_history_add(WINDOW_REC *window, const char *text, int prepend)
|
|||||||
g_list_free_1(link);
|
g_list_free_1(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prepend)
|
|
||||||
*pcmdhist = g_list_prepend(*pcmdhist, g_strdup(text));
|
|
||||||
else
|
|
||||||
*pcmdhist = g_list_append(*pcmdhist, g_strdup(text));
|
*pcmdhist = g_list_append(*pcmdhist, g_strdup(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +76,7 @@ const char *command_history_prev(WINDOW_REC *window, const char *text)
|
|||||||
if (*text != '\0' &&
|
if (*text != '\0' &&
|
||||||
(pos == NULL || strcmp(pos->data, text) != 0)) {
|
(pos == NULL || strcmp(pos->data, text) != 0)) {
|
||||||
/* save the old entry to history */
|
/* save the old entry to history */
|
||||||
command_history_add(window, text, FALSE);
|
command_history_add(window, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *phistpos == NULL ? "" : (*phistpos)->data;
|
return *phistpos == NULL ? "" : (*phistpos)->data;
|
||||||
@ -92,15 +89,14 @@ const char *command_history_next(WINDOW_REC *window, const char *text)
|
|||||||
phistpos = window_history ? &window->histpos : &histpos;
|
phistpos = window_history ? &window->histpos : &histpos;
|
||||||
|
|
||||||
pos = *phistpos;
|
pos = *phistpos;
|
||||||
if (*phistpos == NULL)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
|
if (pos != NULL)
|
||||||
*phistpos = (*phistpos)->next;
|
*phistpos = (*phistpos)->next;
|
||||||
|
|
||||||
if (*text != '\0' &&
|
if (*text != '\0' &&
|
||||||
(pos == NULL || strcmp(pos->data, text) != 0)) {
|
(pos == NULL || strcmp(pos->data, text) != 0)) {
|
||||||
/* save the old entry to history */
|
/* save the old entry to history */
|
||||||
command_history_add(window, text, TRUE);
|
command_history_add(window, text);
|
||||||
}
|
}
|
||||||
return *phistpos == NULL ? "" : (*phistpos)->data;
|
return *phistpos == NULL ? "" : (*phistpos)->data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user