Skip to content

Commit

Permalink
fix formatting when exiting ollama run
Browse files Browse the repository at this point in the history
  • Loading branch information
jmorganca committed Oct 28, 2023
1 parent 57a58db commit 9ec16f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ func generateInteractive(cmd *cobra.Command, model string) error {
line, err := scanner.Readline()
switch {
case errors.Is(err, io.EOF):
fmt.Println()
return nil
case errors.Is(err, readline.ErrInterrupt):
if line == "" {
Expand Down
7 changes: 4 additions & 3 deletions readline/readline.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ func (i *Instance) Readline() (string, error) {
}

r, err := i.Terminal.Read()
if err != nil {
return "", io.EOF
}

if buf.IsEmpty() {
fmt.Print(ClearToEOL)
}

if err != nil {
return "", io.EOF
}

if escex {
escex = false

Expand Down

0 comments on commit 9ec16f0

Please sign in to comment.