Merge pull request #2990 from ollama/mxyng/default-term-size

fix: default terminal width, height
This commit is contained in:
Michael Yang 2024-03-08 15:20:54 -08:00 committed by GitHub
commit 8e0ef931d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,10 +19,9 @@ type Buffer struct {
func NewBuffer(prompt *Prompt) (*Buffer, error) {
fd := int(os.Stdout.Fd())
width, height, err := term.GetSize(fd)
if err != nil {
fmt.Println("Error getting size:", err)
return nil, err
width, height := 80, 24
if termWidth, termHeight, err := term.GetSize(fd); err == nil {
width, height = termWidth, termHeight
}
lwidth := width - len(prompt.prompt())