[PR #4463] [MERGED] changed line display to be calculated with runewidth #58200

Closed
opened 2026-04-29 13:01:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/4463
Author: @joshyan1
Created: 5/16/2024
Status: Merged
Merged: 5/16/2024
Merged by: @joshyan1

Base: mainHead: jyan/line-display


📝 Commits (5)

📊 Changes

1 file changed (+12 additions, -5 deletions)

View changed files

📝 cmd/cmd.go (+12 -5)

📄 Description

Calculates line length using runewidth instead of len(string) as len(string) produces the number of bytes in that string (often resulting in an incorrect calculation of display length for multi-width runes). Now cuts lines accordingly for multi-byte characters (Russian, latin, etc) as well as word-wraps for multi-width characters (Chinese, Japanese, Korean)

Old Russian:
Screenshot 2024-05-15 at 5 05 42 PM

New: Russian
Screenshot 2024-05-15 at 5 01 21 PM

Old: Chinese
Screenshot 2024-05-15 at 5 10 09 PM

New: Chinese
Screenshot 2024-05-15 at 5 15 12 PM


🔄 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/4463 **Author:** [@joshyan1](https://github.com/joshyan1) **Created:** 5/16/2024 **Status:** ✅ Merged **Merged:** 5/16/2024 **Merged by:** [@joshyan1](https://github.com/joshyan1) **Base:** `main` ← **Head:** `jyan/line-display` --- ### 📝 Commits (5) - [`17b1e81`](https://github.com/ollama/ollama/commit/17b1e81ca13bc386be182fdc93d59d50e978fb85) fixed width and word count for double spacing - [`c9e584f`](https://github.com/ollama/ollama/commit/c9e584fb9009faff2b1f2e38b4c7ab86a7d150b1) updated double-width display - [`799aa98`](https://github.com/ollama/ollama/commit/799aa9883cd9d33b44e7ab64540093a9a4e3cbab) go fmt'd cmd.go - [`26bfc1c`](https://github.com/ollama/ollama/commit/26bfc1c443ce178fa009747b2cf83ad9876d5a6a) go fmt'd cmd.go - [`3d90156`](https://github.com/ollama/ollama/commit/3d90156e997dd5daec727152f0cc85f26cc91342) removed comment ### 📊 Changes **1 file changed** (+12 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+12 -5) </details> ### 📄 Description Calculates line length using `runewidth` instead of `len(string)` as `len(string)` produces the number of bytes in that string (often resulting in an incorrect calculation of display length for multi-width runes). Now cuts lines accordingly for multi-byte characters (Russian, latin, etc) as well as word-wraps for multi-width characters (Chinese, Japanese, Korean) Old Russian: <img width="560" alt="Screenshot 2024-05-15 at 5 05 42 PM" src="https://github.com/ollama/ollama/assets/76125168/50bda24b-7fff-4cc9-8e85-6f1b4f006a65"> New: Russian <img width="555" alt="Screenshot 2024-05-15 at 5 01 21 PM" src="https://github.com/ollama/ollama/assets/76125168/a664d1f0-c321-4993-bad7-2c2e066e6a10"> Old: Chinese <img width="576" alt="Screenshot 2024-05-15 at 5 10 09 PM" src="https://github.com/ollama/ollama/assets/76125168/5d47f924-9467-4f3b-ba1d-515072f875f3"> New: Chinese <img width="572" alt="Screenshot 2024-05-15 at 5 15 12 PM" src="https://github.com/ollama/ollama/assets/76125168/275e39dd-c89f-4545-9323-0aba1c8060e2"> --- <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-29 13:01:12 -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#58200