From 8448b5ecc07695eea404bb77a9f62dcecae5415a Mon Sep 17 00:00:00 2001 From: MarvinJWendt Date: Sun, 5 Jun 2022 02:13:04 +0200 Subject: [PATCH 1/2] fixed #9 --- area.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/area.go b/area.go index 76d9916..e8cd72d 100644 --- a/area.go +++ b/area.go @@ -29,6 +29,10 @@ func (area *Area) Clear() { func (area *Area) Update(content string) { area.Clear() lines := strings.Split(content, "\n") + + fmt.Println(strings.Repeat("\n", len(lines)-1)) // This appends space if the terminal is at the bottom + Up(len(lines)) + if runtime.GOOS == "windows" { for _, line := range lines { fmt.Print(line) From 5d45bc57aa17b02b0402f27a8e3cedc079161244 Mon Sep 17 00:00:00 2001 From: MarvinJWendt Date: Sun, 5 Jun 2022 00:14:00 +0000 Subject: [PATCH 2/2] docs: autoupdate --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c9d6d60..26adb51 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ func Hide() ``` Hide the cursor. Don't forget to show the cursor at least at the end of your application with Show. Otherwise the user might have a terminal with a -permanently hidden cursor, until he reopens the terminal. +permanently hidden cursor, until they reopen the terminal. #### func HorizontalAbsolute @@ -173,7 +173,8 @@ position. ```go func SetTarget(w Writer) ``` -SetTarget allows for any arbitrary Writer to be used +SetTarget allows for any arbitrary io.Writer to be used for cursor movement +(will not work on Windows). #### func Show @@ -182,7 +183,7 @@ func Show() ``` Show the cursor if it was hidden previously. Don't forget to show the cursor at least at the end of your application. Otherwise the user might have a terminal -with a permanently hidden cursor, until he reopens the terminal. +with a permanently hidden cursor, until they reopen the terminal. #### func StartOfLine