|
|
@ -3,11 +3,10 @@ |
|
|
|
package mop |
|
|
|
package mop |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
|
|
|
|
"github.com/michaeldv/just" |
|
|
|
|
|
|
|
"github.com/nsf/termbox-go" |
|
|
|
|
|
|
|
"regexp" |
|
|
|
"regexp" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
|
|
|
|
"github.com/michaeldv/just" |
|
|
|
|
|
|
|
"github.com/nsf/termbox-go" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// Can combine attributes and a single color using bitwise OR.
|
|
|
|
// Can combine attributes and a single color using bitwise OR.
|
|
|
@ -37,24 +36,6 @@ func Draw(stocks string) { |
|
|
|
drawScreen(Format(message)) |
|
|
|
drawScreen(Format(message)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
func Refresh(profile string) { |
|
|
|
|
|
|
|
loop: |
|
|
|
|
|
|
|
for { |
|
|
|
|
|
|
|
switch ev := termbox.PollEvent(); ev.Type { |
|
|
|
|
|
|
|
case termbox.EventKey: |
|
|
|
|
|
|
|
if ev.Key == termbox.KeyEsc { |
|
|
|
|
|
|
|
break loop |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case termbox.EventResize: |
|
|
|
|
|
|
|
// Draw(profile)
|
|
|
|
|
|
|
|
// x, y := termbox.Size()
|
|
|
|
|
|
|
|
str := fmt.Sprintf("(%d:%d)", ev.Width, ev.Height) |
|
|
|
|
|
|
|
drawScreen(str + ": <red>Hello world</red>, how <white>are</white> <blue>you?</blue>") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Return regular expression that matches all possible color tags, i.e.
|
|
|
|
// Return regular expression that matches all possible color tags, i.e.
|
|
|
|
// </?black>|</?red>| ... |</?white>
|
|
|
|
// </?black>|</?red>| ... |</?white>
|
|
|
@ -121,3 +102,7 @@ func drawScreen(str string) { |
|
|
|
} |
|
|
|
} |
|
|
|
termbox.Flush() |
|
|
|
termbox.Flush() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func DrawScreen(str string) { |
|
|
|
|
|
|
|
drawScreen(str) |
|
|
|
|
|
|
|
} |
|
|
|