diff --git a/logger/logger.go b/logger/logger.go index 2612b89..77b9099 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -39,7 +39,7 @@ var CB = color.New(color.FgCyan, color.Bold).SprintFunc() var RB = color.New(color.FgRed, color.Bold).SprintFunc() var YB = color.New(color.FgYellow, color.Bold).SprintFunc() -var R = color.New(color.FgRed).SprintFunc() +var HR = color.New(color.FgHiRed).SprintFunc() var C = color.New(color.FgCyan).SprintFunc() var colors = map[string]color.Attribute{ diff --git a/main.go b/main.go index dc10459..91f9988 100644 --- a/main.go +++ b/main.go @@ -96,8 +96,8 @@ func main() { // The extremely fancy custom terminal thing func scanConsole(srv *server.Server) { var command string + var b [1]byte for { - var b [1]byte os.Stdin.Read(b[:]) switch b[0] { @@ -109,7 +109,7 @@ func scanConsole(srv *server.Server) { cmd := srv.GetCommandGraph().FindCommand(args[0]) if cmd == nil { - fmt.Printf("\r> %s", logger.R(command)) + fmt.Printf("\r> %s", logger.HR(command)) } else { if len(args) > 1 { fmt.Printf("\r> %s %s", args[0], logger.C(strings.Join(args[1:], " "))) @@ -126,8 +126,11 @@ func scanConsole(srv *server.Server) { fmt.Print("> ") srv.ConsoleCommand("stop") case 13: // enter - run the command and clear it - fmt.Print("\r> \n\r") command = strings.TrimSpace(command) + if command == "" { + continue + } + fmt.Print("\r> \n\r") args := strings.Split(command, " ") cmd := srv.GetCommandGraph().FindCommand(args[0]) @@ -148,7 +151,7 @@ func scanConsole(srv *server.Server) { cmd := srv.GetCommandGraph().FindCommand(args[0]) if cmd == nil { - fmt.Printf("\r> %s", logger.R(command)) + fmt.Printf("\r> %s", logger.HR(command)) } else { if len(args) > 1 { fmt.Printf("\r> %s %s", args[0], logger.C(strings.Join(args[1:], " ")))