Fix text wrapping in commit message editors (#31030)

Don't hard wrap interactively; instead, soft wrap in `Bounded` mode
(editor width or 72 chars, whichever is smaller), and then hard wrap
before sending the commit message to git.

This also makes the soft wrap mode and width for commit messages
configurable in language settings.

Previously we didn't support soft wrap modes other than `EditorWidth` in
auto-height editors; I tried to add support for this by analogy with
code that was already there, and it seems to work pretty well.

Closes #27508

Release Notes:

- Fixed confusing wrapping behavior in commit message editors.
This commit is contained in:
Cole Miller 2025-05-26 09:11:56 -04:00 committed by GitHub
parent a58c48f629
commit f2601ce52c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 396 additions and 376 deletions

View file

@ -1431,7 +1431,9 @@
"language_servers": ["erlang-ls", "!elp", "..."]
},
"Git Commit": {
"allow_rewrap": "anywhere"
"allow_rewrap": "anywhere",
"preferred_line_length": 72,
"soft_wrap": "bounded"
},
"Go": {
"code_actions_on_format": {