-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Don't break line after footnote symbol in commit messages #4912
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
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
|
Thanks for the fast response! This works if the footnotes are separated by a newline However, when you try to put them all together without newline breaks, the same issue occurs |
|
In your second example, it seems that you were trying to separate the 2nd and 3rd footnote by a space rather than a newline, and I'm not sure why you are expecting this to work. I only consider footnote symbols at the start of a (hard-wrapped) line, so your (It would be easy to change the logic so that it also considers footnote symbols at the beginning of soft-wrapped lines, but honestly I don't see why it should, and it seems conceptually wrong to me.) In your first example, you are using two newlines after the 2nd footnote; that's why you get the blank line. If you use a single newline (like you do after the first footnote), you get the desired result: |
|
Lets try a different example. When I have the following in my commit message created in a different editor (VIM in my case) When I edit the commit in lazygit (press |
|
@pbstrein Ah interesting. This is not so much a bug in the soft-wrapping algorithm, but a deficiency of the soft-unwrapping that we do when rewording. To explain: when you reword a commit, we run an algorithm that tries to remove as many hard line breaks as it can. This is important so that when you then add or delete a word at the beginning of a paragraph, it nicely reflows the text as if you had initially typed it. What this algorithm does is that it looks at every hard line break in the text, tries to replace it with a space, and checks whether the text up to that point still wraps the same way. If it does, it keeps the space instead of the newline. Which means that in your example the algorithm replaced the hard line break at the end of the The ideal fix would be to make the unwrapping algorithm smarter so that it doesn't replace the I pushed a commit in case you want to test it again. |
|
I tested that with a few commits over the last day, and works! Thanks! What's the next step for getting this merged? I did some review of the code and lgtm, but I'm unfamiliar with the codebase, so I don't have the full context of where this fits / alternatives to accomplish the same goal. |
Doing this as a proper PR in gocui, which I just did (see jesseduffield/gocui#85), and then bumping the gocui dependency here, which I will do right now. Thanks for testing! |
b599dfc to
f7609f7
Compare
The main change here is jesseduffield/gocui#85, which avoids breaking lines after footnote symbols in commit messages (e.g. [1]). [1]: https://www.example.com/this-is-a-really-long-url-that-lazy-git-automatically-wraps-and-is-an-issue
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
f7609f7 to
ef92e30
Compare
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.55.1` -> `v0.56.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary> ### [`v0.56.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.56.0) [Compare Source](jesseduffield/lazygit@v0.55.1...v0.56.0) <!-- Release notes generated using configuration in .github/release.yml at v0.56.0 --> #### What's Changed ##### Enhancements 🔥 - Don't break line after footnote symbol in commit messages by [@​stefanhaller](https://github.com/stefanhaller) in [#​4912](jesseduffield/lazygit#4912) - Give better visual feedback when checking out the previous branch by [@​stefanhaller](https://github.com/stefanhaller) in [#​4929](jesseduffield/lazygit#4929) - Add merge menu with conflict resolver by [@​lmnek](https://github.com/lmnek) in [#​4889](jesseduffield/lazygit#4889) - When entering a commit in path filtering mode, select the filtered path by [@​stefanhaller](https://github.com/stefanhaller) in [#​4942](jesseduffield/lazygit#4942) - Document a workaround for using custom pagers on Windows by [@​stefanhaller](https://github.com/stefanhaller) in [#​4941](jesseduffield/lazygit#4941) - Show "Log (x of y)" in the title bar when there is more than one branch log command by [@​stefanhaller](https://github.com/stefanhaller) in [#​4943](jesseduffield/lazygit#4943) - Support multiple pagers by [@​stefanhaller](https://github.com/stefanhaller) in [#​4953](jesseduffield/lazygit#4953) - Add config option gui.skipSwitchWorktreeOnCheckoutWarning by [@​stefanhaller](https://github.com/stefanhaller) in [#​4964](jesseduffield/lazygit#4964) - Add no-ff merge option by [@​stefanhaller](https://github.com/stefanhaller) in [#​4966](jesseduffield/lazygit#4966) ##### Fixes 🔧 - Don't log the git rev-list command that we use for IsBranchMerged by [@​stefanhaller](https://github.com/stefanhaller) in [#​4896](jesseduffield/lazygit#4896) - Hide the cursor when the password prompt is showing by [@​stefanhaller](https://github.com/stefanhaller) in [#​4878](jesseduffield/lazygit#4878) - Update Merge conflicts menu keybinding to use p instead of k by [@​zingazzi](https://github.com/zingazzi) in [#​4934](jesseduffield/lazygit#4934) - Update diff of conflicted file in the main view after conflicts have been resolved by [@​stefanhaller](https://github.com/stefanhaller) in [#​4945](jesseduffield/lazygit#4945) - Don't depend on en\_US locale to be installed by [@​stefanhaller](https://github.com/stefanhaller) in [#​4949](jesseduffield/lazygit#4949) - Fix dropping submodule changes from a commit by [@​stefanhaller](https://github.com/stefanhaller) in [#​4937](jesseduffield/lazygit#4937) - Fix support for Git copy status when status.renames=copies by [@​kapral18](https://github.com/kapral18) in [#​4892](jesseduffield/lazygit#4892) - When pasting multi-line text into a prompt, don't treat the line feeds as "confirm" by [@​stefanhaller](https://github.com/stefanhaller) in [#​4955](jesseduffield/lazygit#4955) - Offer to force-delete a worktree if it contains submodules by [@​stefanhaller](https://github.com/stefanhaller) in [#​4959](jesseduffield/lazygit#4959) - Fix window arrangement when a popup or the search prompt is open by [@​stefanhaller](https://github.com/stefanhaller) in [#​4961](jesseduffield/lazygit#4961) - Fix lazygit getting unresponsive when pasting commits that become empty by [@​stefanhaller](https://github.com/stefanhaller) in [#​4958](jesseduffield/lazygit#4958) - Show a better error message if the temp directory is not writeable by [@​stefanhaller](https://github.com/stefanhaller) in [#​4968](jesseduffield/lazygit#4968) - Avoid auto-stashing when only submodules are out of date by [@​stefanhaller](https://github.com/stefanhaller) in [#​4969](jesseduffield/lazygit#4969) - Use a PTY when using external diff command from git config by [@​brandondong](https://github.com/brandondong) in [#​4983](jesseduffield/lazygit#4983) - Fix fixup's false filename detection in hunks containing dashed lines by [@​abobov](https://github.com/abobov) in [#​5004](jesseduffield/lazygit#5004) ##### Maintenance ⚙️ - Make running with --debug and running integration tests work when built with go 1.25 by [@​stefanhaller](https://github.com/stefanhaller) in [#​4910](jesseduffield/lazygit#4910) - Update go to 1.25 by [@​kyu08](https://github.com/kyu08) in [#​4844](jesseduffield/lazygit#4844) - feat(nix): add comprehensive Nix flake by [@​doprz](https://github.com/doprz) in [#​4826](jesseduffield/lazygit#4826) - Fix normalisedSelectedNodes function by [@​stefanhaller](https://github.com/stefanhaller) in [#​4920](jesseduffield/lazygit#4920) - Add `synchronize` event to the hooks of "Check Required Labels" by [@​kyu08](https://github.com/kyu08) in [#​4974](jesseduffield/lazygit#4974) - Use ignore directive to ignore test files not to be passes to gofumpt by [@​kyu08](https://github.com/kyu08) in [#​4936](jesseduffield/lazygit#4936) ##### Docs 📖 - Fix MoveCommitsToNewBranch description typo by [@​deventon](https://github.com/deventon) in [#​4867](jesseduffield/lazygit#4867) - Wrap long lines in comments in Config.md by [@​stefanhaller](https://github.com/stefanhaller) in [#​4951](jesseduffield/lazygit#4951) - Fix keybinding cheatsheets with regard to pipe characters in key or description by [@​stefanhaller](https://github.com/stefanhaller) in [#​5007](jesseduffield/lazygit#5007) ##### I18n 🌎 - Update translations from Crowdin by [@​stefanhaller](https://github.com/stefanhaller) in [#​5005](jesseduffield/lazygit#5005) #### New Contributors - [@​deventon](https://github.com/deventon) made their first contribution in [#​4867](jesseduffield/lazygit#4867) - [@​zingazzi](https://github.com/zingazzi) made their first contribution in [#​4934](jesseduffield/lazygit#4934) - [@​doprz](https://github.com/doprz) made their first contribution in [#​4826](jesseduffield/lazygit#4826) - [@​lmnek](https://github.com/lmnek) made their first contribution in [#​4889](jesseduffield/lazygit#4889) - [@​kapral18](https://github.com/kapral18) made their first contribution in [#​4892](jesseduffield/lazygit#4892) - [@​abobov](https://github.com/abobov) made their first contribution in [#​5004](jesseduffield/lazygit#5004) **Full Changelog**: <jesseduffield/lazygit@v0.55.1...v0.56.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNjkuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE2OS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Addresses #4900.