ethangreen-dev / lovely-injector

A runtime lua injector for games built with LÖVE
MIT License
78 stars 11 forks source link

Newline handling #52

Closed english5040 closed 1 month ago

english5040 commented 5 months ago

Currently a lot of lovely patches have broken indentation due to how newlines are handled: in pattern patches, after .split() on a payload containing a trailing newline, the empty string after that newline is returned, and indent is prepended to that empty string. In addition, regex patches sometimes have strange behavior with newlines.

We should be consistent and use split_inclusive and Rope::raw_lines() everywhere.

ethangreen-dev commented 4 months ago

Should be an easy enough fix for the pattern patch, but Regex will be a bit more tricky without something to test against.