Edit tool messes with whitespace / line endings in Windows #3958

Open
opened 2026-02-16 17:42:05 -05:00 by yindo · 4 comments
Owner

Originally created by @twoloox-rao on GitHub (Dec 29, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

System:

  • Windows 11 with Powershell and Git Bash
  • Opencode v1.0.207
  • CRLF line endings per default

Editing files with Opencode always messes with whitespace and line endings in files in Windows.

I understand that Opencode uses Git Bash by default, which potentially might be the cause of the issue. Unix line endings are LF, whereas windows/dos uses CRLF.

Originally created by @twoloox-rao on GitHub (Dec 29, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description System: - Windows 11 with Powershell and Git Bash - Opencode v1.0.207 - CRLF line endings per default Editing files with Opencode always messes with whitespace and line endings in files in Windows. I understand that Opencode uses Git Bash by default, which potentially might be the cause of the issue. Unix line endings are LF, whereas windows/dos uses CRLF.
yindo added the windowsbug labels 2026-02-16 17:42:05 -05:00
Author
Owner

@twoloox-rao commented on GitHub (Dec 29, 2025):

Maybe related to #5557

@twoloox-rao commented on GitHub (Dec 29, 2025): Maybe related to #5557
Author
Owner

@github-actions[bot] commented on GitHub (Dec 29, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #631: General Windows Support (umbrella issue tracking all Windows-related problems)
  • #3545: LLMs editing files not handling newline characters properly (similar line ending handling issue)
  • #2904: File editing failures with character encoding (related to file content handling during edits)
  • #4374: File system operations fail on Windows (Edit and write tool failures on Windows 11)
  • #3548: Editing files producing unexpected content (file content corruption during editing)
  • #3343: Line handling issues in Windows Terminal and PowerShell (related to line ending on Windows)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 29, 2025): This issue might be a duplicate of existing issues. Please check: - #631: General Windows Support (umbrella issue tracking all Windows-related problems) - #3545: LLMs editing files not handling newline characters properly (similar line ending handling issue) - #2904: File editing failures with character encoding (related to file content handling during edits) - #4374: File system operations fail on Windows (Edit and write tool failures on Windows 11) - #3548: Editing files producing unexpected content (file content corruption during editing) - #3343: Line handling issues in Windows Terminal and PowerShell (related to line ending on Windows) Feel free to ignore if none of these address your specific case.
Author
Owner

@pschiel commented on GitHub (Jan 28, 2026):

set core.autocrlf=false , other git bash issues are fixed in #6763

@pschiel commented on GitHub (Jan 28, 2026): set `core.autocrlf=false` , other git bash issues are fixed in #6763
Author
Owner

@twoloox-rao commented on GitHub (Feb 2, 2026):

In case core.autocrlf=false is not possible due to team policies or whatever, I just asked my models to build me new tools in opencode crlf-write and crlf-edit after asking it to check for issues with the native tools in my win11 setup. The I disabled the native tools and enabled the new ones. Works well for me.

@twoloox-rao commented on GitHub (Feb 2, 2026): In case `core.autocrlf=false` is not possible due to team policies or whatever, I just asked my models to build me new tools in opencode `crlf-write` and `crlf-edit` after asking it to check for issues with the native tools in my win11 setup. The I disabled the native tools and enabled the new ones. Works well for me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3958