[PR #847] [MERGED] new readline library #36232

Closed
opened 2026-04-22 20:55:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/847
Author: @pdevine
Created: 10/19/2023
Status: Merged
Merged: 10/25/2023
Merged by: @pdevine

Base: mainHead: readline


📝 Commits (10+)

  • 63e526b new readline library
  • 3668466 add multiline
  • e811e03 add history + fix issue with flickering
  • 51deafd remove homedir comment
  • bb2068e allow moving left/right by a word
  • b8723d8 fix clearscreen for some terminals
  • 79b9ecd add tabs as 8 spaces
  • de9dad7 address comments
  • 4628ac9 handle meta keys
  • 62c89b4 replace cursore save/restore with relative positioning

📊 Changes

11 files changed (+972 additions, -86 deletions)

View changed files

📝 cmd/cmd.go (+11 -78)
📝 go.mod (+2 -1)
📝 go.sum (+4 -7)
readline/buffer.go (+370 -0)
readline/errors.go (+17 -0)
readline/history.go (+152 -0)
readline/readline.go (+254 -0)
readline/term.go (+35 -0)
readline/term_bsd.go (+24 -0)
readline/term_linux.go (+26 -0)
readline/types.go (+77 -0)

📄 Description

This is simplified version of the readline library which cuts out a lot of the complexity of the version that we were using. There's still a few things to add like "history" and getting the multi-line prompts working correctly, but most (many?) things should be more or less working, including:

  • Each of the Ctrl-? chars (Ctrl-d, Ctrl-k, Ctrl-c, Ctrl-u, Ctrl-a, Ctrl-e, Ctrl-l, etc.)
  • Line wrap with backspace/arrow keys
  • Entering/exiting raw mode

Would love some feedback if people could try it out.


🔄 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/847 **Author:** [@pdevine](https://github.com/pdevine) **Created:** 10/19/2023 **Status:** ✅ Merged **Merged:** 10/25/2023 **Merged by:** [@pdevine](https://github.com/pdevine) **Base:** `main` ← **Head:** `readline` --- ### 📝 Commits (10+) - [`63e526b`](https://github.com/ollama/ollama/commit/63e526b8a332bfe57bf1b349f2149836c6c6e9e5) new readline library - [`3668466`](https://github.com/ollama/ollama/commit/36684667688ff669035e6cda597271c5a832eab0) add multiline - [`e811e03`](https://github.com/ollama/ollama/commit/e811e036a2a773a5249606e732e79367cb7d117a) add history + fix issue with flickering - [`51deafd`](https://github.com/ollama/ollama/commit/51deafd9df0de236d573ede0b9add9de678c7771) remove homedir comment - [`bb2068e`](https://github.com/ollama/ollama/commit/bb2068e90bb454f0878612a32b742ecef4982866) allow moving left/right by a word - [`b8723d8`](https://github.com/ollama/ollama/commit/b8723d8bb3dbec4967d0cc8ffabbb05773e3ab26) fix clearscreen for some terminals - [`79b9ecd`](https://github.com/ollama/ollama/commit/79b9ecdd0a62ec65361db4b3f653462fc7b1f120) add tabs as 8 spaces - [`de9dad7`](https://github.com/ollama/ollama/commit/de9dad78a8ceabccef4fca09ed5a837b0617d69f) address comments - [`4628ac9`](https://github.com/ollama/ollama/commit/4628ac9a3f261ba43f1c7f734826664c9f1f8718) handle meta keys - [`62c89b4`](https://github.com/ollama/ollama/commit/62c89b489b6e8f29d2ae8cde66cedcb373c79dcc) replace cursore save/restore with relative positioning ### 📊 Changes **11 files changed** (+972 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+11 -78) 📝 `go.mod` (+2 -1) 📝 `go.sum` (+4 -7) ➕ `readline/buffer.go` (+370 -0) ➕ `readline/errors.go` (+17 -0) ➕ `readline/history.go` (+152 -0) ➕ `readline/readline.go` (+254 -0) ➕ `readline/term.go` (+35 -0) ➕ `readline/term_bsd.go` (+24 -0) ➕ `readline/term_linux.go` (+26 -0) ➕ `readline/types.go` (+77 -0) </details> ### 📄 Description This is simplified version of the readline library which cuts out a lot of the complexity of the version that we were using. There's still a few things to add like "history" and getting the multi-line prompts working correctly, but most (many?) things should be more or less working, including: * Each of the Ctrl-? chars (Ctrl-d, Ctrl-k, Ctrl-c, Ctrl-u, Ctrl-a, Ctrl-e, Ctrl-l, etc.) * Line wrap with backspace/arrow keys * Entering/exiting raw mode Would love some feedback if people could try it out. --- <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-22 20:55:41 -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#36232