Skip to content

fix: remove the shared indentation of the commit body - #91

Merged
petertriho merged 1 commit into
mainfrom
fix/commit-body-indentation
Nov 2, 2026
Merged

petertriho merged 1 commit into
mainfrom
fix/commit-body-indentation

Conversation

@petertriho

Copy link
Copy Markdown
Owner

4fe8024 already fixed the lost newlines of #54: the parser reads the full output of git log instead of the plenary lines that it joined without a separator.

This PR fixes the indentation that was left. The trim of the body removed the indentation of the first line only, so an indented body showed ## what and then ## how. The parser now removes the indentation that all lines with text share, as textwrap.dedent of Python does.

  • A test runs git with the body of the issue and checks the documentation of the item.
  • The fuzz test of the parser checks the dedent against a reference that uses line lists.
  • make ci passes. make bench-compare against main shows 0 regressions.

Fixes #54.

Issue #54 showed the body of a commit on one line in the preview. The
plenary job gave the lines of `git log`, and the parser joined them
without a separator. 4fe8024 replaced plenary with vim.system, so the
parser now reads the full output and keeps the newlines.

The parser still trimmed the whole body, so the first line lost its
indentation and the other lines kept theirs. A body that is indented
as a whole, as in the issue, showed `## what` and then `  ## how`.

The parser now removes the indentation that all lines with text
share, as textwrap.dedent of Python does. Lines with only whitespace
do not count, and they become empty. A tab and a space do not match.
A body without a shared indentation is trimmed as before. When the
first line is not indented, the parser takes the old path without a
copy or a split.

A test runs git with the body of the issue and checks the
documentation of the item. The fuzz test of the parser now also
checks the dedent against a reference that uses line lists.

Fixes #54.
@petertriho
petertriho merged commit 843d94d into main Nov 2, 2026
7 checks passed
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.

[feature-request]: improving the select commit preview

1 participant