Description
There is an inconsistency in the wrap_preserving_code function in src/lib.rs around lines 319-322. The final flush operation trims trailing spaces using trim_end(), while the earlier loop behavior does not trim trailing spaces.
Current Code
let trimmed = current.trim_end();
if !trimmed.is_empty() {
lines.push(trimmed.to_string());
}
Expected Behavior
The final flush should mirror the earlier loop behavior by not trimming trailing spaces:
if !current.is_empty() {
lines.push(current);
}
Impact
This inconsistency could lead to different handling of trailing spaces at line boundaries, potentially affecting the preservation of whitespace in wrapped text.
References
Reported by: leynos
Description
There is an inconsistency in the
wrap_preserving_codefunction insrc/lib.rsaround lines 319-322. The final flush operation trims trailing spaces usingtrim_end(), while the earlier loop behavior does not trim trailing spaces.Current Code
Expected Behavior
The final flush should mirror the earlier loop behavior by not trimming trailing spaces:
Impact
This inconsistency could lead to different handling of trailing spaces at line boundaries, potentially affecting the preservation of whitespace in wrapped text.
References
Reported by: leynos