gilo/gilo.go
Timothy Warren 5f81aa90a1
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good
Remove cleanup function that complicated debuging
2023-10-04 15:09:04 -04:00

32 lines
566 B
Go

package main
import (
"os"
"timshome.page/gilo/editor"
"timshome.page/gilo/terminal"
)
func main() {
// Go to proper raw mode, but restore canonical mode at exit
oldState := terminal.RawOn()
defer terminal.RawOff(oldState)
e := editor.NewEditor()
// If there is an argument passed, open it as a file to edit
if len(os.Args) >= 2 && os.Args[1] != "" {
e.Open(os.Args[1])
}
e.SetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find")
// The input loop
for {
e.RefreshScreen()
if e.ProcessKeypress() == false {
break
}
}
}