Skip to content

Support CRLF detection in WSL #1751

Open

Description

@brandonskiser

Files on Windows use \r\n as the line ending whereas POSIX systems use \n.

This poses a problem when editing Windows files from WSL - in the fs_read tool, we only send the content joined by \n. This causes context-mismatch issues with the model whenever it attempts to make changes, since it is not expecting line endings to contain a \r prefix.

Instead, we should detect what line endings to use (\r\n vs \n) when editing a file since it is possible to edit Windows based files that use \r\n while in WSL.

Activity

  1. Scarmonit commented on Oct 30, 2025

    @Scarmonit

    This is a great opportunity to enhance cross-platform compatibility. I'd be happy to investigate implementing a line ending detection mechanism. The approach could involve:

    1. Detecting the existing line ending style in the file (\r\n vs \n)
    2. Preserving that style when writing back changes via fs_write
    3. Adding tests for both Windows and POSIX line ending scenarios

    Would this align with the expected solution? I can start working on a PR if this direction makes sense.

  2. voidstackloop commented on Sep 13, 2026

    @voidstackloop

    I’m investigating a focused fix that preserves each file’s existing LF/CRLF style at the shared read/write boundary, with regression coverage for both endings. I found no linked implementation PR; I’ll keep the change scoped to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions