Add shell command support

This commit is contained in:
Zachary Yedidia
2019-01-10 16:37:05 -05:00
parent 103527f38f
commit 16038c388e
9 changed files with 186 additions and 36 deletions

View File

@@ -18,6 +18,7 @@ import (
// same time too.
var Screen tcell.Screen
var lock sync.Mutex
var DrawChan chan bool
func Lock() {
lock.Lock()
@@ -27,21 +28,24 @@ func Unlock() {
lock.Unlock()
}
var screenWasNil bool
func Redraw() {
DrawChan <- true
}
// TempFini shuts the screen down temporarily
func TempFini() {
screenWasNil = Screen == nil
func TempFini() bool {
screenWasNil := Screen == nil
if !screenWasNil {
Lock()
Screen.Fini()
Lock()
Screen = nil
}
return screenWasNil
}
// TempStart restarts the screen after it was temporarily disabled
func TempStart() {
func TempStart(screenWasNil bool) {
if !screenWasNil {
Init()
Unlock()
@@ -50,6 +54,8 @@ func TempStart() {
// Init creates and initializes the tcell screen
func Init() {
DrawChan = make(chan bool)
// Should we enable true color?
truecolor := os.Getenv("MICRO_TRUECOLOR") == "1"