0xMiden / 0xMiden/miden-formatting
PrettyPrint for str and split join the first two lines together
- Dominant language
- Rust
- Stars
- 0
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Multi-line text is currently joined with the newline in the wrong position by both `PrettyPrint for str` and `Document::split()`.
File evidence:
- `formatting/src/prettier/mod.rs` reduces `self.lines().map(text)` with `other + doc + nl()`.
- `formatting/src/prettier/document.rs` uses the same pattern in `split()`.
Because `Iterator::reduce` combines the accumulated document with the next line, appending `nl()` after the next document delays each separator by one line and leaves an extra trailing newline. For example, rendering `"a\nb\nc"` joins the first two lines together instead of preserving the line breaks.
Expected behavior: line separators should be placed between adjacent lines, so multi-line text renders as the original lines without merging the first two lines or appending an extra newline.
Contributor guide
Assessment
This issue has not been assessed yet.