From e7cb69fe4b392e96b4fa33af2ea0e77a90387370 Mon Sep 17 00:00:00 2001 From: Rekketstone Date: Thu, 16 Jan 2025 07:34:29 -0700 Subject: [PATCH] Simple handling for autocomplete and bash history As long as you are using bash it will always work, not sure for fish and other shells so I'll leave it to the user to experiment soon, I'll add another thing to the config.h to do so. --- cowterm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cowterm.c b/cowterm.c index 2aaca80..b9f8014 100644 --- a/cowterm.c +++ b/cowterm.c @@ -767,15 +767,23 @@ static void key_press_cb(XKeyEvent *event, void *data) { } if (keysym == XK_Return || keysym == XK_KP_Enter) { - write(*master, "\r", 1); + write(*master, "\r", 1); // Shell handles return } else if (keysym == XK_BackSpace) { - write(*master, "\b", 1); + write(*master, "\b", 1); // Shell handles backspace } else if (keysym == XK_Left) { write(*master, "\033[D", 3); needs_refresh = 1; } else if (keysym == XK_Right) { write(*master, "\033[C", 3); needs_refresh = 1; + } else if (keysym == XK_Up) { // Go up through history + write(*master, "\033[A", 3); + needs_refresh = 1; + } else if (keysym == XK_Down) { // Go down through history + write(*master, "\033[B", 3); + needs_refresh = 1; + } else if (keysym == XK_Tab) { + write(*master, "\t", 1); // Shell handles autocomplete } else if (len > 0) { write(*master, buf, len); }