Skip to content

Commit

Permalink
Merge pull request ollama#2990 from ollama/mxyng/default-term-size
Browse files Browse the repository at this point in the history
fix: default terminal width, height
  • Loading branch information
mxyng authored Mar 8, 2024
2 parents 280da44 + b1e74d4 commit 8e0ef93
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions readline/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 8e0ef93

Please sign in to comment.