lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Commit message length warning

Open GMkonan opened this issue 2 years ago • 1 comments

Really simple implementation of a simple warning for when you commit message pass a certain number, from this issue:

  • #1552

If someone wants any changes in what I did feel free to point out, I thought about adding commitLengthWarning to CommitLengthConfig but I'm not sure since they are related but are not exact the same thing (one is the counter and the other is an effect in the actual message).

Thank you!

GMkonan avatar Jun 23 '22 22:06 GMkonan

I'm quite unsure about how this should work and would like a second opinion. Right now ALL the text turns red when you pass the amount of chars specified, but comes back to normal when you go to another line, so you have a warning that is based on each line but the text color doesn't persist for each line.

Is this the best way or should the text persist? And if it needs to persist, is there any already made way to change the line color and not all text?

GMkonan avatar Jul 06 '22 22:07 GMkonan

I'm quite unsure about how this should work and would like a second opinion.

My vision for this feature is to have each line validated separately, with any text past the threshold either turning a different color, or, ideally, autowrapping (maybe have a setting overflow with possible values warn, wrap, and ignore). It would also be nice if the length counter in the corner would display the current line length, either in addition to, or instead of, the total message length.

For example, the commit message

Hello world, this is the subject

This is a long body that will wrap over the 72 character limit on the
next line. When this happens it would be great for it to have some sort of warning

With overflow: warn: ( = cursor position)

┌─Commit message─────────────────────────────────────────────────────────────────────── 82 / 186 ─────┐
│ Hello world, this is the subject                                                                    │
│                                                                                                     │
│ This is a long body that will wrap over the 72 character limit on the                               │
│ next line. When this happens it would be great for it to have some sort of warning█                 │
│                                                                         ^^^^^^^^^^-this text is red │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

With overflow: wrap:

┌─Commit message─────────────────────────────────────────── 10 / 186 ─────┐
│ Hello world, this is the subject                                        │
│                                                                         │
│ This is a long body that will wrap over the 72 character limit on the   │
│ next line. When this happens it would be great for it to have some sort |
│ of warning█                                                             │
└─────────────────────────────────────────────────────────────────────────┘

However I recognize that this is an ideal form for me, and will be harder to implement. If possible it would be amazing for my productivity, but I'd settle for anything that gives me an indication of the line length (maybe a vertical ruler, even turning the whole text/line red would technically work, just wouldn't be ideal).

simon-abbott avatar Oct 13 '22 23:10 simon-abbott

Closing as obsolete, now that we have #3173.

stefanhaller avatar Mar 29 '24 13:03 stefanhaller