Skip to content

fix: render tabs in commit messages as spaces - #3039

Open
costajohnt wants to merge 1 commit into
gitui-org:masterfrom
costajohnt:fix/3036-commit-message-tabs
Open

costajohnt wants to merge 1 commit into
gitui-org:masterfrom
costajohnt:fix/3036-commit-message-tabs

Conversation

@costajohnt

Copy link
Copy Markdown

This Pull Request fixes/closes #3036.

On v0.28.1 a tab in a commit message reaches the terminal, moves the cursor to the next tab stop, and ratatui loses track of what's on screen, so the commit list row comes out scrambled and old text is left behind. On current master ratatui 0.30 strips the control character instead, so PR:\t123 shows as PR:123. This converts tabs to spaces with the existing string_utils::tabs_to_spaces, the same way the diff and blame views already do.

It changes the following:

  • commit details view: subject and body (wrap_commit_details), with a unit test
  • commit list entries (LogEntry::from), which covers the revlog, stash list and file history
  • compare view subject and the "Files at ..." title in the revision files view
  • the commit/amend popup is left alone, since that text is edited and written back as the commit message

Checked with a scratch repo committed with $'subj\twith tab\n\nPR:\t299119', opened in a 120x30 terminal:

Build Commit list row Details pane
v0.28.1 subjubj witab subj with tab / PR: 299119
master subjwith tab subjwith tab / PR:299119
this branch subj with tab subj with tab / PR: 299119

I followed the checklist:

  • I added unittests
  • I ran make check without errors (ran its steps individually: cargo fmt -- --check, cargo clippy --workspace --all-features, cargo test --workspace (320 passed) and cargo deny check are clean; I don't have cargo-nextest or cargo-sort installed, and no Cargo.toml changed)
  • I tested the overall application
  • I added an appropriate item to the changelog

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.

Tabs aren't properly displayed in commit messages

1 participant