Move mainLoop without C-z to windows-specific file

This commit is contained in:
Yufan Lou 2016-05-06 04:59:09 +08:00
parent c05b306cf6
commit 6710b98ca9
2 changed files with 24 additions and 21 deletions

View File

@ -17,27 +17,6 @@ var databaseFile string
var db *bolt.DB
var memBolt *BoltDB
func mainLoop(memBolt *BoltDB, style Style) {
screens := defaultScreensForData(memBolt)
displayScreen := screens[BrowserScreenIndex]
layoutAndDrawScreen(displayScreen, style)
for {
event := termbox.PollEvent()
if event.Type == termbox.EventKey {
newScreenIndex := displayScreen.handleKeyEvent(event)
if newScreenIndex < len(screens) {
displayScreen = screens[newScreenIndex]
layoutAndDrawScreen(displayScreen, style)
} else {
break
}
}
if event.Type == termbox.EventResize {
layoutAndDrawScreen(displayScreen, style)
}
}
}
func main() {
var err error

24
mainloop_windows.go Normal file
View File

@ -0,0 +1,24 @@
package main
import "github.com/nsf/termbox-go"
func mainLoop(memBolt *BoltDB, style Style) {
screens := defaultScreensForData(memBolt)
displayScreen := screens[BrowserScreenIndex]
layoutAndDrawScreen(displayScreen, style)
for {
event := termbox.PollEvent()
if event.Type == termbox.EventKey {
newScreenIndex := displayScreen.handleKeyEvent(event)
if newScreenIndex < len(screens) {
displayScreen = screens[newScreenIndex]
layoutAndDrawScreen(displayScreen, style)
} else {
break
}
}
if event.Type == termbox.EventResize {
layoutAndDrawScreen(displayScreen, style)
}
}
}