git: Preserve whitespaces in commit messages - #43478
Conversation
|
Thanks for opening a PR! However, I think we might want to try a different approach to this. Note that re: #42476 we already have support for "rewrap prefixes" that support things like markdown lists (added in #33702). These prefixes should be respected by the normal editor rewrap, without that |
|
Likely the buffer for the commit is not getting recognized neither as Markdown nor as Git Commit. Before creating this PR, I've tried playing around with the settings for Git Commit language without any success. |
|
I've further tried to play around with the settings. A very foolproof setting I tried was to enable display whitespaces, but nothing happened in the git commit buffer. This proves that the language settings, as for git commit language as for markdown, are not even getting applied, as the buffer is not recognized at all as a language. Furthermore, the whitespaces are preserved yes, but only in instances where multiple For example as soon as I press the commit button becomes but if I introduce multiple pressing commit maintains the format It definitely deserves further investigation, as this bug undoubtedly disrupts the workflow of people accustomed to providing commit messages spanning multiple lines with bullet points/lists. |
Closes #42476
Release Notes:
What Changed:
commit_rewrapmethod to the Editor that maintains intentional spacing in commit messagesTechnical Details:
commit_rewrap()method ineditor.rswithpreserve_existing_whitespace: trueoptioncommit_rewrap()instead of standardrewrap()when formatting commit messagesmaintained during the rewrap operation
Impact:
Files Modified:
crates/editor/src/editor.rs- Addedcommit_rewrap()methodcrates/git_ui/src/git_panel.rs- Updated to use new rewrap method