CheckableChunk: result of find_covered_spans() seems to be off-by-one
KuabeM opened this issue · comments
Describe the bug
The result of chunk.find_covered_spans(range)
seems to report spans which do not fit properly. Since this method only performs loop-ups in the source_mapping
, the bug is likely to be located inside the construction of the source_mapping
. See TODO
in src/reflow/mod.rs:146
for an example.
Maybe that leading char is never retained and it's not even supposed to be retained. But as far as I understood, in the checker it's being kept. One possibility is that until now, we never looked at leading whitespaces since we only cared about actual words. In the end, we may need to handle that case in the reflow
module.
To Reproduce
Steps to reproduce the behaviour:
- checkout branch
bernhard-reflow-rebased
- remove lines
148-152
insrc/reflow/mod.rs
- run
cargo spellcheck reflow demo/src/nested/mod.rs
- First line of rewrapped comments is missing a whitespaces.
Expected behavior
No need to adjust span.start.column
in order to preserve whitespace.
Screenshots
Please complete the following information:
- System: Arch Linux
- Obtained: git
- Version: branch #121
Additional context
That was just a misuse of slicing a string, it's not a bug.