Skip to content

Git commit hard and soft wrap not respected #44748

@willma-andela

Description

@willma-andela

Reproduction steps

There are two closely related issues here regarding hard and soft wrapping in the editor and the git panel that do not behave as documented

preferred_line_length not respected in the editor

When using the editor to edit a commit message, the text soft wraps at the correct number of characters, but once I save the commit and check my git log, I can see that it did not hard wrap at that character count. The docs state

You can configure how Zed hard wraps commit messages with the preferred-line-length setting of the "Git Commit" language. The default is 72

Reproduction
  • Make a change to a file and run git commit -a in your terminal. Zed opens with the ability to edit the commit message
  • Type more that 72 characters. Zed correctly soft wraps at 72 characters
  • Save and exit and run git log in your terminal and you'll see that the commit message is not hard wrapped at 72 chars.

soft_wrap not respected in the git panel

The docs state

The Git Panel also allows configuring the soft_wrap setting to adjust how commit messages display while you are typing them in the Git Panel. The default setting is editor_width, however, none, preferred_line_length, and bounded are also options.

But when set to preferred_line_length, it still wraps to editor_width

Reproduction
  • Make a change to a file and open the git panel
  • Make the panel very wider (wider than 72 chars)
  • Type a commit message in the panel that's longer than 72 chars. It does not soft wrap at 72 chars.

Current vs. Expected behavior

Editor soft wraps correctly at 72 chars:

Image

Actual commit message is not hard wrapped:

Image

Sidebar Panel editor does not soft wrap:

Image

But commit is correctly hard wrapped

Image

Floating panel correctly soft wraps

Image

Zed version and system specs

Zed: v0.211.6 (Zed)
OS: macOS 15.7.2
Memory: 64 GiB
Architecture: aarch64

Attach Zed log file

Relevant Zed settings

settings.json
  "languages": {
    "Git Commit": {
      "soft_wrap": "preferred_line_length",
      "preferred_line_length": 72
    },
    ...
  }

Relevant Keymap

No response

(for AI issues) Model provider details

No response

If you are using WSL on Windows, what flavor of Linux are you using?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:editorFeedback for code editing, formatting, editor iterations, etcarea:integrations/gitGit integration feedbackarea:settingsFeedback for preferences, configuration, etcfrequency:alwaysBug that happens for everyone on every platform no matter how they use Zedpriority:P3Papercuts, minor issues with a clear workaround, cosmetic bugs

    Type

    No fields configured for Bug.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions