opencode
opencode copied to clipboard
Issue 2016: edits change windows line endings to linux endings
https://github.com/sst/opencode/issues/2016
normalizedNewString is self-explanatory, but the LineTrimmedReplacer change makes sure an edit doesn't remove \r from the last line.
Also, I took the liberty of making LineTrimmedReplacer slightly more concise; it was not necessary. The important part is:
if (matchString.endsWith("\r")) { matchString = matchString.slice(0, -1) }
@thdxr It's a nice fix of an annoying problem. Can you please consider it?