summaryrefslogtreecommitdiff
path: root/shed.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@x1-nano.kaivo.local>2023-04-01 22:46:34 -0400
committerJakob Kaivo <jkk@x1-nano.kaivo.local>2023-04-01 22:46:34 -0400
commit23e9c66180b95e5b1ba03ae739c04ebefa183e05 (patch)
tree91dd9ac0d4270208b770bbc85766d5918c8e2d5a /shed.c
parent73611cd92215d478a549a6c869450376efc26393 (diff)
begin work on command history (need to fix so it doesn't clear screen)
Diffstat (limited to 'shed.c')
-rw-r--r--shed.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/shed.c b/shed.c
index c010cb1..2cf1b54 100644
--- a/shed.c
+++ b/shed.c
@@ -22,13 +22,23 @@ struct shed *shed(struct shed *e)
if (e->cur == NULL) {
e->cur = calloc(1, sizeof(*e->cur));
if (e->cur == NULL) {
+ /* FIXME */
return e;
}
e->handle = shed_handle_non_vi;
+ e->head = e->cur;
+ e->tail = e->cur;
+ } else {
+ e->tail->next = calloc(1, sizeof(*e->cur));
+ if (e->tail->next == NULL) {
+ /* FIXME */
+ return e;
+ }
+ e->tail->next->prev = e->tail;
+ e->tail = e->tail->next;
+ e->cur = e->tail;
}
- memset(e->cur, '\0', sizeof(*e->cur));
-
struct termios original_tio;
if (tcgetattr(STDIN_FILENO, &original_tio) != 0) {
e->cur = NULL;