Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert hard newlines instead of wrapping long lines #52

Closed
ebassi opened this issue Jan 13, 2022 · 8 comments · Fixed by #56
Closed

Insert hard newlines instead of wrapping long lines #52

ebassi opened this issue Jan 13, 2022 · 8 comments · Fixed by #56

Comments

@ebassi
Copy link

ebassi commented Jan 13, 2022

Commit should not put the entire commit message on as few lines as possible: it makes reading commit messages harder than necessary on the command line.

If the user specifies a hard limit for the length of each line, the commit message should be following that size. This should be possible by iterating over the text using Pango, and finding where words wrap.

@sonnyp
Copy link
Owner

sonnyp commented Jan 13, 2022

Nice to see you here / on Commit :)

If the user specifies a hard limit for the length of each line

Not sure if you're talking about the current setting but there is no hard limit - just a "hint" for the subject line. The goal is not to wrap but to help the user knowing when it exceeds the max length on Github/Gitlab/...

See https://robertcooper.me/post/git-commit-messages#subject-line-less-than-or-equal-to-72-characters-in-length

What you are talking about would be a new setting for https://robertcooper.me/post/git-commit-messages#body-line-length-limited-to-80-characters correct ?

If so - here is what I can do

  • Clarify what the current limit is about
  • Add a new setting for commit body max line length

@ebassi
Copy link
Author

ebassi commented Jan 13, 2022

What you are talking about would be a new setting for https://robertcooper.me/post/git-commit-messages#body-line-length-limited-to-80-characters correct ?

Yes. Basically, right now the commit message is just wrapped in the UI by the text input; the underlying content is a single line. While some people do use this style, it's kind of broken on the CLI. Additionally, it messes up any formatting.

  • Clarify what the current limit is about

It would probably help; I mostly gleaned it was about the commit subject because it was set to 50 characters, but it's not overly clear.

  • Add a new setting for commit body max line length

This would, indeed, be the thing I'm asking.

@sonnyp
Copy link
Owner

sonnyp commented Jan 15, 2022

This should be possible by iterating over the text using Pango, and finding where words wrap.

Could you elaborate a little or link to documentation / example?

@bilelmoussaoui
Copy link

I came here to report the same issue, I got tricked by the small window until I noticed the very long line commit on gitlab

@sonnyp
Copy link
Owner

sonnyp commented Mar 3, 2022

@bilelmoussaoui any chance you can share that commit url - I want to make sure we are talking about the same thing

sonnyp added a commit that referenced this issue Mar 17, 2022
sonnyp added a commit that referenced this issue Mar 17, 2022
@sonnyp
Copy link
Owner

sonnyp commented Mar 17, 2022

After playing around with TextView/Pango I realized that given the commit body is usually only descriptive sentences - it should be fine to display a different wrapping than what commit ends up saving; so I've done that in #56

Follow ups: #57 and #58

sonnyp added a commit that referenced this issue Mar 17, 2022
sonnyp added a commit that referenced this issue Mar 17, 2022
sonnyp added a commit that referenced this issue Mar 17, 2022
sonnyp added a commit that referenced this issue Mar 17, 2022
sonnyp added a commit that referenced this issue Mar 17, 2022
sonnyp added a commit that referenced this issue Mar 17, 2022
sonnyp added a commit that referenced this issue Mar 17, 2022
sonnyp added a commit that referenced this issue Mar 17, 2022
@sonnyp
Copy link
Owner

sonnyp commented Mar 20, 2022

Fixed in v3.1.0

Please let me know how it works for you.

If the window is smaller than the requested wrap width (72) then Commit will soft wrap at 72 on save.

If the window is bigger, wrap is disabled and a ruler / right margn is displayed

Screenshot from 2022-03-20 10-38-39

Screenshot from 2022-03-20 11-16-45

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 a pull request may close this issue.

3 participants