mirror of
https://github.com/mudler/luet.git
synced 2025-09-06 01:30:29 +00:00
update vendor
This commit is contained in:
45
vendor/github.com/atomicgo/cursor/area.go
generated
vendored
Normal file
45
vendor/github.com/atomicgo/cursor/area.go
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
package cursor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Area displays content which can be updated on the fly.
|
||||
// You can use this to create live output, charts, dropdowns, etc.
|
||||
type Area struct {
|
||||
height int
|
||||
}
|
||||
|
||||
// NewArea returns a new Area.
|
||||
func NewArea() Area {
|
||||
return Area{}
|
||||
}
|
||||
|
||||
// Clear clears the content of the Area.
|
||||
func (area *Area) Clear() {
|
||||
Bottom()
|
||||
if area.height > 0 {
|
||||
ClearLinesUp(area.height)
|
||||
}
|
||||
}
|
||||
|
||||
// Update overwrites the content of the Area.
|
||||
func (area *Area) Update(content string) {
|
||||
area.Clear()
|
||||
lines := strings.Split(content, "\n")
|
||||
if runtime.GOOS == "windows" {
|
||||
for _, line := range lines {
|
||||
fmt.Print(line)
|
||||
StartOfLineDown(1)
|
||||
}
|
||||
} else {
|
||||
for _, line := range lines {
|
||||
fmt.Println(line)
|
||||
}
|
||||
}
|
||||
height = 0
|
||||
|
||||
area.height = len(lines)
|
||||
}
|
Reference in New Issue
Block a user