fix: print newline on ctrlc

pull/38/head
sammy 2021-04-16 10:27:11 -04:00
parent 2089d71ed2
commit e2c775a89d
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 3 additions and 1 deletions

View File

@ -98,8 +98,10 @@ func main() {
for { for {
running = false running = false
hl.SetPrompt(fmtPrompt()) hl.SetPrompt(fmtPrompt())
input, err := hl.Read() input, err := hl.Read()
if err == io.EOF { if err == io.EOF {
// Exit if user presses ^D (ctrl + d) // Exit if user presses ^D (ctrl + d)
fmt.Println("") fmt.Println("")
@ -111,7 +113,7 @@ func main() {
} }
input = strings.TrimSpace(input) input = strings.TrimSpace(input)
if len(input) == 0 { continue } if len(input) == 0 { fmt.Print("\n"); continue }
if strings.HasSuffix(input, "\\") { if strings.HasSuffix(input, "\\") {
for { for {