parent
b84778e44c
commit
65f189309e
|
@ -22,7 +22,7 @@ func main() {
|
||||||
tui.PrintString("Got %s", c)
|
tui.PrintString("Got %s", c)
|
||||||
tui.GetString("...")
|
tui.GetString("...")
|
||||||
|
|
||||||
tui.PrintLine()
|
tui.PrintHLine()
|
||||||
tui.GetString("What would you like? ")
|
tui.GetString("What would you like? ")
|
||||||
|
|
||||||
tui.Clear()
|
tui.Clear()
|
||||||
|
|
2
menu.go
2
menu.go
|
@ -27,7 +27,7 @@ func GetMenu(
|
||||||
PrintString("│")
|
PrintString("│")
|
||||||
}
|
}
|
||||||
|
|
||||||
w, _ := termSize()
|
w, _ := WindowSize()
|
||||||
valWidth := w - keyWidth - 5
|
valWidth := w - keyWidth - 5
|
||||||
|
|
||||||
for i := 0; i < len(items); i += 2 {
|
for i := 0; i < len(items); i += 2 {
|
||||||
|
|
12
output.go
12
output.go
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
// Clear clears the screen.
|
// Clear clears the screen.
|
||||||
func Clear() {
|
func Clear() {
|
||||||
_, h := termSize()
|
_, h := WindowSize()
|
||||||
buf := make([]byte, 2*h)
|
buf := make([]byte, 2*h)
|
||||||
for i := range buf {
|
for i := range buf {
|
||||||
buf[i] = '\n'
|
buf[i] = '\n'
|
||||||
|
@ -15,9 +15,9 @@ func Clear() {
|
||||||
mustWrite(buf)
|
mustWrite(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Line prints a line across the screen followed by a newline.
|
// PrintHLine prints a line across the screen followed by a newline.
|
||||||
func PrintLine() {
|
func PrintHLine() {
|
||||||
w, _ := termSize()
|
w, _ := WindowSize()
|
||||||
|
|
||||||
runes := make([]rune, w)
|
runes := make([]rune, w)
|
||||||
for i := range runes {
|
for i := range runes {
|
||||||
|
@ -38,7 +38,7 @@ func PrintBoxed(s string, args ...interface{}) {
|
||||||
s = fmt.Sprintf(s, args...)
|
s = fmt.Sprintf(s, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
w, _ := termSize()
|
w, _ := WindowSize()
|
||||||
|
|
||||||
lines, textWidth := wrapText(s, w-4)
|
lines, textWidth := wrapText(s, w-4)
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ func PrintTextWithPrefix(prefix, s string, args ...interface{}) {
|
||||||
}
|
}
|
||||||
indent := len([]rune(prefix))
|
indent := len([]rune(prefix))
|
||||||
//sIndent := strings.Repeat(" ", indent)
|
//sIndent := strings.Repeat(" ", indent)
|
||||||
w, _ := termSize()
|
w, _ := WindowSize()
|
||||||
lines, _ := wrapText(s, w-1-indent)
|
lines, _ := wrapText(s, w-1-indent)
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
PrintString(prefix + line)
|
PrintString(prefix + line)
|
||||||
|
|
Reference in New Issue