Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix --wrap=word leaking a leading space onto the continuation line#3832

Open
upuddu wants to merge 2 commits into
sharkdp:mastersharkdp/bat:masterfrom
upuddu:fix/word-wrap-leading-spaceupuddu/bat:fix/word-wrap-leading-spaceCopy head branch name to clipboard
Open

Fix --wrap=word leaking a leading space onto the continuation line#3832
upuddu wants to merge 2 commits into
sharkdp:mastersharkdp/bat:masterfrom
upuddu:fix/word-wrap-leading-spaceupuddu/bat:fix/word-wrap-leading-spaceCopy head branch name to clipboard

Conversation

@upuddu

@upuddu upuddu commented Jul 7, 2026

Copy link
Copy Markdown

When a word ends exactly at the terminal width, the separating whitespace is the character that triggers the wrap, and it was being pushed onto the next visual line as a spurious leading space. This consumes that whitespace when it triggers the wrap.

upuddu added 2 commits July 7, 2026 12:55
When a word ended exactly at the terminal width, the separating
whitespace was the character that triggered the wrap. The buffered
word was emitted correctly, but the triggering space was then pushed
onto the next visual line, producing a spurious leading space.

Consume the separating whitespace when it triggers the wrap.
@keith-hall
keith-hall enabled auto-merge July 7, 2026 19:34
@upuddu

upuddu commented Jul 8, 2026

Copy link
Copy Markdown
Author

Heads-up: the two red checks here (cargo audit and the all-jobs gate that depends on it) are not caused by this PR. cargo audit is flagging newly-published RustSec advisories in transitive deps — crossbeam-epoch 0.9.18 (RUSTSEC-2026-0204), quick-xml 0.39.4 (RUSTSEC-2026-0194/0195), etc. Those versions are pinned in master's Cargo.lock, so master fails the same audit today. This PR only changes src/printer.rs, a test, and the changelog — no dependency or Cargo.lock changes. Fixing it means a repo-wide dependency bump or an .cargo/audit.toml ignore update, which seems better handled separately. Happy to rebase once that lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.