[PR #13839] [MERGED] cmd: handle Enter key pressed during model loading, render multiline better #14414

Closed
opened 2026-04-13 00:53:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13839
Author: @ParthSareen
Created: 1/22/2026
Status: Merged
Merged: 1/23/2026
Merged by: @ParthSareen

Base: mainHead: parth/fix-multiline-inputs-v2


📝 Commits (1)

  • 79b51b9 fix: handle Enter key pressed during model loading

📊 Changes

2 files changed (+38 additions, -9 deletions)

View changed files

📝 cmd/interactive.go (+1 -0)
📝 readline/readline.go (+37 -9)

📄 Description

When users type and press Enter while a model is loading (terminal in cooked mode), the newline character is buffered as \n (LF). In raw mode, Enter sends \r (CR) while Ctrl+J sends \n. This caused buffered Enter keystrokes to be misinterpreted as Ctrl+J, incorrectly triggering multiline input mode instead of submitting the message.

This change detects when we're processing buffered input from cooked mode by checking if there's additional data in the read buffer after each character read. When draining such input, \n is treated as submit rather than multiline.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13839 **Author:** [@ParthSareen](https://github.com/ParthSareen) **Created:** 1/22/2026 **Status:** ✅ Merged **Merged:** 1/23/2026 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `parth/fix-multiline-inputs-v2` --- ### 📝 Commits (1) - [`79b51b9`](https://github.com/ollama/ollama/commit/79b51b9f2e4e60f588c8e616262fbaaddad4399b) fix: handle Enter key pressed during model loading ### 📊 Changes **2 files changed** (+38 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `cmd/interactive.go` (+1 -0) 📝 `readline/readline.go` (+37 -9) </details> ### 📄 Description When users type and press Enter while a model is loading (terminal in cooked mode), the newline character is buffered as \n (LF). In raw mode, Enter sends \r (CR) while Ctrl+J sends \n. This caused buffered Enter keystrokes to be misinterpreted as Ctrl+J, incorrectly triggering multiline input mode instead of submitting the message. This change detects when we're processing buffered input from cooked mode by checking if there's additional data in the read buffer after each character read. When draining such input, \n is treated as submit rather than multiline. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 00:53:23 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#14414