-
Notifications
You must be signed in to change notification settings - Fork 43
Exclude commit trailers from line wrapping #97
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
Conversation
This brings in jesseduffield/gocui#97 ("Exclude commit trailers from line wrapping").
c100b6d to
4d58a88
Compare
sogladev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot Strings.builder was a thing when writing. This is much nicer.
I tested the changes in jesseduffield/lazygit#5230, and it works as expected
Closing my PR (jesseduffield/lazygit#5217) as it's no longer needed
| return | ||
| } | ||
|
|
||
| if len(chr) != 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is minor, but footnotes are also all ASCII, and the same optimization can be used to skip some regex checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, but that would actually make it worse. I added a bit of benchmark data (587285e) for this, and adding the check to the footnote matcher increases the benchmark time by a couple of microseconds.
I need to keep the check for the trailer matcher though, because it's needed for correctness, since I access the bytes of the string a few lines below, so I first need to make sure it's really one byte.
4d58a88 to
30a4af5
Compare
|
@sogladev Thanks for the review! Merging. |
This is calling contentToCells for every key press. As we are going to make changes to that function in this branch, we want to make sure that we don't cause a terrible performance regression with our changes. On my machine, one benchmark iteration takes 150μs, which is already a lot less than I had expected.
Line-wrapping a commit trailer that contains a very long email address results in a broken trailer (trailers do support being split into several lines, but this requires continuation lines to start with a space, like in RFC-822 message headers). To avoid this, simply never wrap commit trailers. It's a bit questionable that we hard-code this behavior in TextArea, which is meant to be a general-purpose widget; but we know we only use it in lazygit's commit message panel, so don't bother making this configurable for now. Benchmark time increases from 150μs to 165μs on my machine, which is still more than acceptable.
30a4af5 to
8029be2
Compare
This brings in jesseduffield/gocui#97 ("Exclude commit trailers from line wrapping").
Bump gocui, which brings in jesseduffield/gocui#97. #Fixes #5216.
Line-wrapping a commit trailer that contains a very long email address results
in a broken trailer (trailers do support being split into several lines, but
this requires continuation lines to start with a space, like in RFC-822 message
headers). To avoid this, simply never wrap commit trailers.
It's a bit questionable that we hard-code this behavior in TextArea, which is
meant to be a general-purpose widget; but we know we only use it in lazygit's
commit message panel, so don't bother making this configurable for now.
Fixes jesseduffield/lazygit#5216.