Rich-Harris / magic-string

Manipulate strings like a wizard
MIT License
2.37k stars 113 forks source link

fix: handle last empty line correctly when using update/overwrite #274

Closed dummdidumm closed 8 months ago

dummdidumm commented 9 months ago

When the string passed to update or overwrite ends with a new line, the mappings will contain two entries for column zero. This happens because the loop does not bail if the last line is empty, filling two lines with the same mapping. This commit fixes that. Fixes #273