Merged
Conversation
Contributor
Author
|
Test results (macOS, local build): Manual test with a long line: Line breaks at word boundaries as expected. When a single word exceeds width (e.g. a long URL), it falls back to character wrapping. |
keith-hall
requested changes
Feb 23, 2026
Collaborator
keith-hall
left a comment
There was a problem hiding this comment.
Hi, thanks for your contribution. Let's add some tests to prove that word wrapping works as expected and prevent accidental regressions in future.
It would also be great if we can update the manpage and shell completions with the new option. I have asked Copilot to do that before with good results. But if you don't want to, we can always apply those changes separately later.
- Add integration tests for word wrapping: basic word boundary breaking, fallback to character wrapping for long words, line numbers, and short lines that fit without wrapping - Update manpage to document the new 'word' wrapping mode - Update bash, fish, zsh, and PowerShell completions with 'word' option - Avoid unnecessary clone of line_buf when word wrap is disabled
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.
Adds a
wordoption to--wrapthat breaks lines at word boundaries (whitespace) instead of mid-character. When a single word exceeds the terminal width, it falls back to character wrapping so nothing gets lost.Usage:
bat --wrap=word file.rsCloses #2751