summaryrefslogtreecommitdiff
path: root/vendor/github.com/buger/goterm/terminal.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/buger/goterm/terminal.go')
-rw-r--r--vendor/github.com/buger/goterm/terminal.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/vendor/github.com/buger/goterm/terminal.go b/vendor/github.com/buger/goterm/terminal.go
index 6b45c78bc..7c4dfa70f 100644
--- a/vendor/github.com/buger/goterm/terminal.go
+++ b/vendor/github.com/buger/goterm/terminal.go
@@ -27,7 +27,7 @@ const RESET = "\033[0m"
// Reset to default color
const RESET_COLOR = "\033[32m"
-// Return curor to start of line and clean it
+// Return cursor to start of line and clean it
const RESET_LINE = "\r\033[K"
// List of possible colors
@@ -68,10 +68,10 @@ type winsize struct {
}
// Global screen buffer
-// Its not recommented write to buffer dirrectly, use package Print,Printf,Println fucntions instead.
+// Its not recommended write to buffer dirrectly, use package Print,Printf,Println fucntions instead.
var Screen *bytes.Buffer = new(bytes.Buffer)
-// Get relative or absolute coorditantes
+// Get relative or absolute coordinates
// To get relative, set PCT flag to number:
//
// // Get 10% of total width to `x` and 20 to y
@@ -113,7 +113,7 @@ func Clear() {
// Move cursor to given position
func MoveCursor(x int, y int) {
- fmt.Fprintf(Screen, "\033[%d;%dH", x, y)
+ fmt.Fprintf(Screen, "\033[%d;%dH", y, x)
}
// Move cursor up relative the current position
@@ -148,7 +148,7 @@ func MoveTo(str string, x int, y int) (out string) {
// Return carrier to start of line
func ResetLine(str string) (out string) {
return applyTransform(str, func(idx int, line string) string {
- return fmt.Sprintf(RESET_LINE, line)
+ return fmt.Sprintf("%s%s", RESET_LINE, line)
})
}
@@ -215,12 +215,12 @@ func CurrentHeight() int {
// Flush buffer and ensure that it will not overflow screen
func Flush() {
- for idx, str := range strings.Split(Screen.String(), "\n") {
+ for idx, str := range strings.SplitAfter(Screen.String(), "\n") {
if idx > Height() {
return
}
- Output.WriteString(str + "\n")
+ Output.WriteString(str)
}
Output.Flush()