Skip to content

Commit

Permalink
chore: include template updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Jun 7, 2023
1 parent 4e3693f commit 465b330
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
19 changes: 2 additions & 17 deletions area.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cursor

import (
"fmt"
"runtime"
"strings"
)

Expand All @@ -28,22 +27,8 @@ func (area *Area) Clear() {
// Update overwrites the content of the Area.
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)
StartOfLineDown(1)
}
} else {
for _, line := range lines {
fmt.Println(line)
}
}
fmt.Println(content)
height = 0

area.height = len(lines)
area.height = len(strings.Split(content, "\n"))
}
2 changes: 1 addition & 1 deletion cursor_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func Hide() {
_, _, _ = procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&cci)))
}

// ClearLine clears the current line and moves the cursor to it's start position.
// ClearLine clears the current line and moves the cursor to its start position.
func ClearLine() {
handle := syscall.Handle(target.Fd())

Expand Down

0 comments on commit 465b330

Please sign in to comment.