Wrap todo descriptions at word boundaries in sidebar#1643
Merged
rumpl merged 1 commit intodocker:mainfrom Feb 9, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Review Summary
Found 1 issue in the changed code that should be addressed:
High Severity
- Negative maxDescWidth when terminal width is very small: The calculation on line 64 can produce negative values when
c.width < prefixWidth, causing word wrapping to be completely bypassed.
The word wrapping logic itself looks good for normal cases, but needs defensive handling for edge cases where the component width becomes smaller than the icon prefix width.
Replace truncation with word-aware wrapping so that todo items in the sidebar display their full description regardless of sidebar width. Long descriptions wrap onto subsequent lines, indented to align with the text after the icon prefix, and line breaks prefer word boundaries over splitting mid-word. Assisted-By: cagent Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
krissetto
approved these changes
Feb 9, 2026
Contributor
krissetto
left a comment
There was a problem hiding this comment.
maybe we could also add some minimal visual separation between the todos 🤔 will give it a look
Member
Author
|
Adding separation will make it even more vertical, idk |
Contributor
|
true, but maybe even todos should have a title and content if they are that long though, these in the example are more like full blown tasks than simple todos.. but anyway stuff for separate PRs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace truncation with word-aware wrapping so that todo items in the sidebar display their full description regardless of sidebar width.
Long descriptions wrap onto subsequent lines, indented to align with the text after the icon prefix, and line breaks prefer word boundaries over splitting mid-word.
Changes
pkg/tui/components/toolcommon/truncate.go— NewWrapLinesWordsfunction that wraps at word boundaries, falling back to rune-level splitting for words exceeding the available width.pkg/tui/components/tool/todotool/sidebar.go— UseWrapLinesWordsinstead ofTruncateTextso todo descriptions wrap fully with proper indentation on continuation lines.pkg/tui/components/toolcommon/common_test.go— Tests forWrapLinesWordscovering normal wrapping, long words, multi-line input, edge cases, and unicode/CJK.