summaryrefslogtreecommitdiffstats
path: root/history.h
blob: dda356fef6fa5987bf7e3ab5c81ee612a005772a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once 

#include "link.h"

#include "wchar.h"

#define HISTORY_MAX 100

struct inputln {
	wchar_t *buf;
	int len, cap;
	int cur;

	struct link link;
};

struct history {
	struct link list;
	struct inputln *cmd, *query;
};

void history_init(struct history *history);
void history_free(struct history *history);

void history_submit(struct history *history);

void history_prev(struct history *history);
void history_next(struct history *history);

void history_add(struct history *history, struct inputln *line);
void history_pop(struct inputln *line);

struct inputln *inputln_init(void);
void inputln_free(struct inputln *ln);

void inputln_left(struct inputln *line);
void inputln_right(struct inputln *line);

void inputln_addch(struct inputln *line, wchar_t c);
void inputln_del(struct inputln *line, int n);