From e71ae89a1b3a1c8e0f2372575b5997d8e38f9242 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 21 Feb 2024 20:20:20 +0100 Subject: quad --- src/i_events.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/i_events.go') diff --git a/src/i_events.go b/src/i_events.go index 3767fa9..7bbda68 100644 --- a/src/i_events.go +++ b/src/i_events.go @@ -494,14 +494,33 @@ func i_events(data *HardData) { case INSERT_MODE: if event.Key() == tcell.KeyEscape || event.Key() == tcell.KeyCtrlC { + ui.s.HideCursor() data.ui.mode = NORMAL_MODE + data.insert = nil + ui.buff = "" + } else if event.Key() == tcell.KeyEnter { + if ui.buff == "" { + ui.s.HideCursor() + data.ui.mode = NORMAL_MODE + data.insert = nil + ui.buff = "" + break + } + ui.s.HideCursor() + data.insert = &HostNode{} + data.insert.Name = ui.buff + ui.buff = "" + } else { + i_readline(event, data) } + // TODO: reset data.insert to nil on validate case MKDIR_MODE: if event.Key() == tcell.KeyEscape || event.Key() == tcell.KeyCtrlC { ui.s.HideCursor() ui.buff = "" ui.mode = NORMAL_MODE + data.insert = nil } else if event.Key() == tcell.KeyEnter { i_mkdir(data, ui) ui.s.HideCursor() -- cgit v1.2.3