gcode-preview - v3.0.0-alpha.4
    Preparing search index...
    • Splits a streamed chunk into the lines that are complete and the partial line to carry into the next chunk.

      Parameters

      • tail: string

        Partial line left over from the previous chunk

      • chunk: string

        Newly read chunk of G-code text

      Returns { complete: string; tail: string }

      complete, ready to parse, and the new tail

      The returned tail excludes the newline itself, so prepending it to the next chunk never fabricates an empty line at a chunk boundary.

      A chunk containing no newline at all keeps its historical behaviour: it is split before its last character. That is a known quirk, preserved here so this helper changes nothing but the boundary newline.