diff options
| author | Louis Burda <quent.burda@gmail.com> | 2021-12-01 00:31:01 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2021-12-20 15:31:03 +0100 |
| commit | d68d0f39ab7675745e7d177f6774736f7ec58783 (patch) | |
| tree | 9f0cf6732517619e370186f288be172eead73fb0 /history.h | |
| parent | 02141177f8055a2d0edace481d631adbcb4b4c47 (diff) | |
| download | tmus-d68d0f39ab7675745e7d177f6774736f7ec58783.tar.gz tmus-d68d0f39ab7675745e7d177f6774736f7ec58783.zip | |
Replace readline with own implementation for integration
Diffstat (limited to 'history.h')
| -rw-r--r-- | history.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/history.h b/history.h new file mode 100644 index 0000000..dda356f --- /dev/null +++ b/history.h @@ -0,0 +1,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); |
