[GH-ISSUE #251] WordWrap fails to break long words #194

Closed
opened 2026-03-04 01:02:52 +03:00 by kerem · 4 comments
Owner

Originally created by @carldunham on GitHub (Mar 18, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/251

eg

msg := "123456789012345678901234567890"
fmt.Printf("wrapping %s: %#v", msg, tview.WordWrap(msg, 10))

results in

wrapping 123456789012345678901234567890: []string{"12345678901", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}

The function docs don't actually mention breaking up words, but the code is trying to do something with it. Suggest that the above should result in

wrapping 123456789012345678901234567890: []string{"1234567890", "1234567890", "1234567890"}

Thanks!

Originally created by @carldunham on GitHub (Mar 18, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/251 eg ``` msg := "123456789012345678901234567890" fmt.Printf("wrapping %s: %#v", msg, tview.WordWrap(msg, 10)) ``` results in ``` wrapping 123456789012345678901234567890: []string{"12345678901", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"} ``` The function docs don't actually mention breaking up words, but the code is trying to do something with it. Suggest that the above should result in ``` wrapping 123456789012345678901234567890: []string{"1234567890", "1234567890", "1234567890"} ``` Thanks!
kerem closed this issue 2026-03-04 01:02:53 +03:00
Author
Owner

@rivo commented on GitHub (Apr 5, 2019):

Thanks. Yeah, that seems to be wrong. I'll fix it but it will need to wait a bit because I'll be offline for the next three weeks.

<!-- gh-comment-id:480428364 --> @rivo commented on GitHub (Apr 5, 2019): Thanks. Yeah, that seems to be wrong. I'll fix it but it will need to wait a bit because I'll be offline for the next three weeks.
Author
Owner

@rivo commented on GitHub (Jun 29, 2019):

I believe I was able to fix it. This is way more difficult than it seems at first.

<!-- gh-comment-id:506982498 --> @rivo commented on GitHub (Jun 29, 2019): I believe I was able to fix it. This is way more difficult than it seems at first.
Author
Owner

@carldunham commented on GitHub (Jun 29, 2019):

Awesome. Yeah, word-wrapping is a lot harder than it seems. Why Knuth took all those years off from writing his books to write TeX 😃

<!-- gh-comment-id:506986419 --> @carldunham commented on GitHub (Jun 29, 2019): Awesome. Yeah, word-wrapping is a lot harder than it seems. Why Knuth took all those years off from writing his books to write TeX 😃
Author
Owner

@rivo commented on GitHub (Jun 29, 2019):

Haha! Right. I actually think that the current version won't be the last. Once rivo/uniseg#2 is implemented, I'll have to review my code here (and probably completely rewrite it again).

<!-- gh-comment-id:506987613 --> @rivo commented on GitHub (Jun 29, 2019): Haha! Right. I actually think that the current version won't be the last. Once rivo/uniseg#2 is implemented, I'll have to review my code here (and probably completely rewrite it again).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#194
No description provided.