git://git.iain.cx/iain
/
pstop.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Sensibly format rows with table name on the right.
[pstop.git]
/
screen
/
screen.go
diff --git
a/screen/screen.go
b/screen/screen.go
index
c29c6ba
..
4d40793
100644
(file)
--- a/
screen/screen.go
+++ b/
screen/screen.go
@@
-33,7
+33,7
@@
func (s *TermboxScreen) BoldPrintAt(x int, y int, text string) {
// clear the screen
func (s *TermboxScreen) Clear() {
// clear the screen
func (s *TermboxScreen) Clear() {
- termbox.Clear(termbox.Color
White, termbox.ColorBlack
)
+ termbox.Clear(termbox.Color
Default, termbox.ColorDefault
)
}
// close the screen
}
// close the screen
@@
-83,7
+83,7
@@
func (s *TermboxScreen) Initialise() {
s.fg = termbox.ColorDefault
s.bg = termbox.ColorDefault
s.fg = termbox.ColorDefault
s.bg = termbox.ColorDefault
- s.SetSize(
termbox.Size()
)
+ s.SetSize(
termbox.Size()
)
}
// print the characters but don't print them outside the screen
}
// print the characters but don't print them outside the screen
@@
-98,6
+98,14
@@
func (s *TermboxScreen) PrintAt(x int, y int, text string) {
s.Flush()
}
s.Flush()
}
+// Clear EOL
+func (s *TermboxScreen) ClearLine(x int, y int) {
+ for i := x; i < s.width; i++ {
+ termbox.SetCell(i, y, ' ', termbox.ColorDefault, termbox.ColorDefault)
+ }
+ s.Flush()
+}
+
// set the screen size
func (s *TermboxScreen) SetSize(width, height int) {
// if we get bigger then clear out the bottom line
// set the screen size
func (s *TermboxScreen) SetSize(width, height int) {
// if we get bigger then clear out the bottom line
@@
-114,3
+122,15
@@
func (s *TermboxScreen) SetSize(width, height int) {
func (s *TermboxScreen) Size() (int, int) {
return s.width, s.height
}
func (s *TermboxScreen) Size() (int, int) {
return s.width, s.height
}
+
+// create a channel for termbox.Events and run a poller to send
+// these events to the channel. Return the channel.
+func (s TermboxScreen) TermBoxChan() chan termbox.Event {
+ termboxChan := make(chan termbox.Event)
+ go func() {
+ for {
+ termboxChan <- termbox.PollEvent()
+ }
+ }()
+ return termboxChan
+}