Menu

#2501 Document::ConvertLineEnds() does not convert all line-ends

Bug
closed-fixed
nobody
1
2026-03-25
2026-03-09
No

Issue: Document::ConvertLineEnds() uses a fixed length calculated at the start of the iteration. Because the document grows when inserting CRLF characters, the loop terminates before reaching the new end of the document. This leaves trailing line endings unconverted (e.g., remaining as LF when converting to CRLF).

Discussion

  • Zufu Liu

    Zufu Liu - 2026-03-09
    • labels: --> Scintilla, EOL
     
  • Zufu Liu

    Zufu Liu - 2026-03-10

    I think simplest fix is just using

    for (Sci::Position pos = 0; pos < LengthNoExcept(); pos++)
    

    complex fix is update length = LengthNoExcept(); at end of DeleteChars() / InsertString() block.

     
    👍
    1
  • Rainer Kottenhoff

    For complex update a --length; resp ++length; at end of DeleteChars() / InsertString() block would work too, since delete/insert char length is 1.
    pos < LengthNoExcept() is more elegant and comparable fast.

     
  • Neil Hodgson

    Neil Hodgson - 2026-03-10
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2026-03-10

    This was a regression in [0cf8bf].

    Committed fix with [614b4c],

     

    Related

    Commit: [0cf8bf]
    Commit: [614b4c]

  • Neil Hodgson

    Neil Hodgson - 2026-03-25
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB