summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-01-08 22:49:59 +0100
committerDimitri Sokolyuk <demon@dim13.org>2017-01-08 22:49:59 +0100
commit0add289317bf4acca0992f9cf2df71e937227873 (patch)
tree1ab11dfc2069f4dca616316d82506d8cb66e5984
parentb39131316fb68bb1f596bdad77909c6ac45b72b6 (diff)
Less magic
-rw-r--r--tek.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/tek.go b/tek.go
index 95773a9..38ee8d9 100644
--- a/tek.go
+++ b/tek.go
@@ -5,6 +5,12 @@ import (
"os"
)
+const (
+ FF = 12
+ ESC = 27
+ GS = 29
+)
+
type Out struct {
io.Writer
hx, hy, lx, ly, eb byte
@@ -13,7 +19,7 @@ type Out struct {
}
func (o *Out) escString(s string) {
- o.Write([]byte{27})
+ o.Write([]byte{ESC})
o.Write([]byte(s))
}
@@ -33,24 +39,25 @@ func NewOut(w io.Writer) *Out {
func (o Out) Enable() {
if o.xterm {
o.escString("[?38h")
- o.writeByte(27, 12) // Tek Page
+ o.writeByte(ESC, FF) // Tek Page
+ o.writeByte(ESC, '`') // solid lines
}
}
func (o Out) Disable() {
if o.xterm {
//o.escString("[?38l")
- o.writeByte(31) // Text mode
- o.writeByte(27, 3) // VT Page
+ o.writeByte(31) // Text mode
+ o.writeByte(ESC, 3) // VT Page
}
}
func (o Out) PenUp() {
- o.writeByte(29, 7)
+ o.writeByte(GS, 7)
}
func (o Out) PenDown() {
- o.writeByte(29)
+ o.writeByte(GS)
}
func limit(val, max int) int {