فهرست منبع

default terminal width, height

Michael Yang 1 سال پیش
والد
کامیت
b1e74d4fda
1فایلهای تغییر یافته به همراه3 افزوده شده و 4 حذف شده
  1. 3 4
      readline/buffer.go

+ 3 - 4
readline/buffer.go

@@ -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())