Skip to content

Auto-wrap breaks long co author string #5216

Closed
jesseduffield/gocui
#97

Description

@sogladev

Describe the bug

With default config git.commit.autoWrapCommitMessage and autoWrapWidth: 72
a long co-author is formatted incorrectly. This causes the trailer to be invalid.

✅ Correct (39 characters)

Co-authored-by: John Doe <john@doe.com>

When a co-author is a long string .e.g, John Doe <xxxxxxxxxxxxxxxxxxxxxxxx@yyyyyyyyyyyyyyyyyy.com>

❌ Wrong (74 characters)

Co-authored-by: John Doe
<xxxxxxxxxxxxxxxxxxxxxxxx@yyyyyyyyyyyyyyyyyy.com>

As per https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#updating-gocui

I edited gocui in the lazygit/vendor for testing, but raising an issue to see if I should continue this to the gocui repo?

To Reproduce

Steps to reproduce the behavior:

with default config.yml

git:
  commit:
    autoWrapCommitMessage: true
    autoWrapWidth: 72
  1. Go to the Commit summary
  2. Commit Menu
  3. Add co-author
  4. Input a long Name <Email> .e.g, John Doe <xxxxxxxxxxxxxxxxxxxxxxxx@yyyyyyyyyyyyyyyyyy.com>
  5. See Commit description displays an invalid Co-authored-by key

Expected behavior

Option A: correctly format a trailer with a leading space

Co-authored-by: John Doe
 <xxxxxxxxxxxxxxxxxxxxxxxx@yyyyyyyyyyyyyyyyyy.com>

Option B: skip formatting of trailers

Co-authored-by: John Doe <xxxxxxxxxxxxxxxxxxxxxxxx@yyyyyyyyyyyyyyyyyy.com>

This option is most similar to skipping the formatting of footnotes, e.g.,[1]: https://www.example.com

Screenshots

demo repo with 3 commits: https://github.com/sogladev/coauthor-test/commits/main/

Version info:

discovered on

commit=, build date=, build source=unknown, version=0.58.0, os=linux, arch=amd64, git version=2.52.0

confirmed on 19605ad

Terminal info:

konsole 25.12.1

Additional context

https://git-scm.com/docs/git-interpret-trailers

When reading trailers, there can be no whitespace before or inside the <key>, but any number of regular space and tab characters are allowed between the <key> and the separator. There can be whitespaces before, inside or after the <value>. The <value> may be split over multiple lines with each subsequent line starting with at least one whitespace, like the "folding" in RFC 822. Example:

key: This is a very long value, with spaces and
  newlines in it.

Activity

  1. stefanhaller commented on Jan 19, 2026

    @stefanhaller
    Collaborator

    Thanks. A few thoughts:

    • I'm not sure adding a separate trailerMatcher is needed. There's quite a bit of code duplication with the footNoteMatcher, and unifying them into one might be better to avoid that (with a single regex that matches both). The only question is what to do about the little performance optimization in addCharacter, but to be honest I'm not sure that's needed at all; I only added it because it was easy, I admit I didn't measure performance. (We should before taking it out.)
    • Co-authored-by: is the only trailer we currently support adding, but there are feature requests for allowing to easily add others; and you can always type trailers manually (or reword a commit that already contains some), so I wonder if we should support a few more of the most common ones.

    As per https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#updating-gocui

    That documentation is slightly out of date (there no longer is an awesome branch in gocui), but apart from that the recommendation still holds: open a PR here, changing the files in the vendor directory, and worry about making a gocui PR only once we're done reviewing it here.

  2. added a commit that references this issue on Jan 25, 2026
    9f44caa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions