refactor history to use history_entries list

this allows access to the global history even when a using /window history
named or /set window_history on, and you want to recall something from one
of the other windows' histories.

usage (default): ctrl+up/down
This commit is contained in:
ailin-nemui 2017-10-06 14:58:47 +02:00
commit 1fd285dccf
4 changed files with 183 additions and 27 deletions

View file

@ -6,12 +6,19 @@
typedef struct {
char *name;
GList *list, *pos;
GList *pos;
int lines;
int refcount;
int redo:1;
} HISTORY_REC;
typedef struct {
const char *text;
HISTORY_REC *history;
time_t time;
} HISTORY_ENTRY_REC;
HISTORY_REC *command_history_find(HISTORY_REC *history);
HISTORY_REC *command_history_find_name(const char *name);
@ -22,8 +29,15 @@ void command_history_deinit(void);
void command_history_add(HISTORY_REC *history, const char *text);
GList *command_history_list_last(HISTORY_REC *history);
GList *command_history_list_first(HISTORY_REC *history);
GList *command_history_list_prev(HISTORY_REC *history, GList *pos);
GList *command_history_list_next(HISTORY_REC *history, GList *pos);
const char *command_history_prev(WINDOW_REC *window, const char *text);
const char *command_history_next(WINDOW_REC *window, const char *text);
const char *command_global_history_prev(WINDOW_REC *window, const char *text);
const char *command_global_history_next(WINDOW_REC *window, const char *text);
void command_history_clear_pos(WINDOW_REC *window);