summaryrefslogtreecommitdiffstats
path: root/src/history.h
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-12-20 16:25:43 +0100
committerLouis Burda <quent.burda@gmail.com>2021-12-20 16:25:43 +0100
commitf07580d31d1148c4a1811c36b09ca0ad50d9576b (patch)
tree05a8fbb44af81f3b5937df80c5af3305ec3ed3c9 /src/history.h
parentfaee8e9c6db45c6adacfc5113d55927f92e8bf29 (diff)
downloadtmus-f07580d31d1148c4a1811c36b09ca0ad50d9576b.tar.gz
tmus-f07580d31d1148c4a1811c36b09ca0ad50d9576b.zip
Restructured repository and added automatic make dependency generation
Diffstat (limited to 'src/history.h')
-rw-r--r--src/history.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/history.h b/src/history.h
new file mode 100644
index 0000000..bbf4faa
--- /dev/null
+++ b/src/history.h
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "list.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);
+
+void inputln_copy(struct inputln *dst, struct inputln *src);
+void inputln_replace(struct inputln *line, const wchar_t *str);