From 9815c1004046ece1e4bc9b529a52e6fb31b6ee1a Mon Sep 17 00:00:00 2001 From: "Tobias P.L Wennberg" Date: Sun, 12 Jan 2025 14:54:16 +0100 Subject: [PATCH] Fixed input, you can now typ D --- input_parser/input_parser.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/input_parser/input_parser.go b/input_parser/input_parser.go index 7905846..4f5322f 100644 --- a/input_parser/input_parser.go +++ b/input_parser/input_parser.go @@ -87,20 +87,24 @@ func input_str(env *environment.Env) string { case 4: // ^D input = "exit" goto loop_exit - case 65: // UPP - if history_index > 0 { - history_index-- - input = env.History[history_index] + case 27: // UPP + if r, _, _ := reader.ReadRune(); r != 91 { + break } - case 66: // DOWN - if history_index < len(env.History)-1 { - history_index++ - input = env.History[history_index] - } else { - input = "" + if r, _, _ := reader.ReadRune(); r == 65 { // UPP + if history_index > 0 { + history_index-- + input = env.History[history_index] + } + } + if r, _, _ := reader.ReadRune(); r != 66 { //DOWN + if history_index < len(env.History)-1 { + history_index++ + input = env.History[history_index] + } else { + input = "" + } } - case 67: // LEFT - case 68: // RIGHT case 127: //packspace if len(input) > 0 { input = input[:len(input)-1]