terminal fix hack

This commit is contained in:
Cynthia Foxwell 2023-08-18 00:12:13 -06:00
parent 1e45d360b4
commit 5f4bad3634

View file

@ -148,11 +148,15 @@ func main() {
keyboard.Listen(func(key keys.Key) (stop bool, err error) { keyboard.Listen(func(key keys.Key) (stop bool, err error) {
if !state.IsInPrompt() { if !state.IsInPrompt() {
if key.Code == keys.CtrlC { if key.Code == keys.CtrlC {
term.Restore(int(os.Stdin.Fd()), oldState)
commands.QuitCommand() commands.QuitCommand()
return true, nil return true, nil
} else { } else {
command, has := commands.GetCommand(key.String()) command, has := commands.GetCommand(key.String())
if has { if has {
if key.String() == "q" {
term.Restore(int(os.Stdin.Fd()), oldState)
}
command.Run() command.Run()
} else { } else {
commands.SendMode() commands.SendMode()