mainloop.go
func MainLoop() {
	RefreshScreen()

	eventQueue := make(chan term.Event)
	go func() {
		for {
			eventQueue <- term.PollEvent()
		}
	}()

	for {
		RefreshScreen()

		select {
		case ev := <-eventQueue:
			switch ev.Type {
			case term.EventError:
				panic(ev.Err)
			default:
				ProcessEvent(termboxEventToLocal(ev))
			}
		case cmd := <-loop.channel:
			if cmd.Type == EventQuit {
				return
			}
			ProcessEvent(cmd)
		}
	}
}
func MainLoop() {
	RefreshScreen()

	eventQueue := make(chan term.Event)
	go func() {
		for {
			eventQueue <- term.PollEvent()
		}
	}()

	for {
		RefreshScreen()

		select {
		case ev := <-eventQueue:
			switch ev.Type {
			case term.EventError:
				panic(ev.Err)
			default:
				ProcessEvent(termboxEventToLocal(ev))
			}
		case cmd := <-loop.channel:
			if cmd.Type == EventQuit {
				return
			}
			ProcessEvent(cmd)
		}
	}
}
// MainLoop starts the main application event loop