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

Closed
opened 2026-04-12 23:31:22 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/ollama/ollama/pull/4463

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/ollama/ollama/pull/4463 **State:** closed **Merged:** Yes --- 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">
GiteaMirror added the pull-request label 2026-04-12 23:31:22 -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#11503