Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
make linewrap still work when the terminal width has changed (#1350)
Patrick Devine2113c9d31aea
diff --git a/cmd/cmd.go b/cmd/cmd.goindex e0172b101..df0d90c8c 100644--- a/cmd/cmd.go+++ b/cmd/cmd.go@@ -521,9 +521,17 @@ func generate(cmd *cobra.Command, opts generateOptions) error {latest = response- if opts.WordWrap {+ termWidth, _, _ = term.GetSize(int(os.Stdout.Fd()))+ if opts.WordWrap && termWidth >= 10 {for _, ch := range response.Response {if currentLineLength+1 > termWidth-5 {+ if len(wordBuffer) > termWidth-10 {+ fmt.Printf("%s%c", wordBuffer, ch)+ wordBuffer = ""+ currentLineLength = 0+ continue+ }+// backtrack the length of the last word and clear to the end of the linefmt.Printf("\x1b[%dD\x1b[K\n", len(wordBuffer))fmt.Printf("%s%c", wordBuffer, ch)@@ -543,7 +551,10 @@ func generate(cmd *cobra.Command, opts generateOptions) error {}}} else {- fmt.Print(response.Response)+ fmt.Printf("%s%s", wordBuffer, response.Response)+ if len(wordBuffer) > 0 {+ wordBuffer = ""+ }}return nil