Incremental writer emits LF for a rewritten block or separator in a CRLF document
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 78/100
Línea de trabajo
Start in crates/pampa/src/writers/incremental.rs, especially write_block_to_string and compute_separator; compare their freshly generated text with copied text on a CRLF input. The issue gives a reproduction shape and a suggested approach: detect the original document’s line endings and preserve them for rewritten blocks and synthesized separators. Done when the output keeps CRLF throughout after a block rewrite, while existing inline splicing still works.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Reproduction
At tag v0.37.0 (and on main at a37801fe4), on a CRLF (\r\n) document, make an edit that forces the incremental writer to rewrite a block from scratch rather than copy or splice it (for example, appending a brand-new paragraph with no original counterpart, or editing a paragraph in a way the inline-splice safety check rejects). Compute quarto_ast_reconcile::compute_reconciliation(&original, &edited) and call pampa::writers::incremental::incremental_write.
Minimal shape:
First paragraph.\r\n\r\nLast paragraph.\r\n
(all \r\n). After an edit that forces a block-level rewrite, the rewritten block and the separator immediately around it come out with \n instead of \r\n, while the rest of the file keeps \r\n.
A simpler case — editing a word in place inside a CRLF paragraph, where the result is handled by inline splicing rather than a full block rewrite — keeps \r\n correctly, because splicing copies bytes from the original rather than writing fresh text.
Observed vs expected
Observed: a rewritten block, and the separators the incremental writer has to synthesize around it (rather than copy from the original gap), use bare \n, producing a document with mixed line endings.
Expected: a rewritten block and its separators use the same line-ending convention as the rest of the document.
Cause
The standard QMD writer (crates/pampa/src/writers/qmd.rs) always emits bare \n — reasonably so, since most callers want platform-independent output. The incremental writer calls that standard writer whenever it has to rewrite a block from scratch (write_block_to_string in crates/pampa/src/writers/incremental.rs), and falls back to a literal "\n" separator in compute_separator whenever it can't copy the original gap verbatim (one of the two adjacent entries is a rewrite). Neither function looks at the original document's line-ending convention.
Suggested fix
Detect the document's line-ending convention once from original_qmd (e.g. "does it contain \r\n"), and when a block must be rewritten or a separator must be synthesized, convert/emit \r\n instead of \n in that case. The standard writer itself does not need to change — only the incremental writer's own freshly-generated text.
- Lenguaje dominante
- Rust
- Estrellas
- 302
- Forks
- 22
- Merge medio
- 5 h 8 min
- PR fusionados (30 d)
- 220
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de quarto-dev/q2
-
`q2 render` ignores `NO_COLOR` and prints colour codes and hyperlinks in its diagnosticsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
quarto-dev/q2#1135 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
quarto-dev/q2#1133 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
quarto-dev/q2#1103 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
quarto-dev/q2#1095 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
quarto-dev/q2#1031 ·
Los mantenedores suelen responder en 1 día
Todos los issues de quarto-dev/q2
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
area:cli kind:docs prio:low
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
DecapodLabs/decapod#1626 · 1 comentario ·
Los mantenedores suelen responder en 1 día