Fix last newline getting lost in applyPatch
Created by: eseliger
Closes #13498 (closed)
We didn't keep the last newline around due to the Join
, making the \n\n
at the end of the diff be \n
, which leads to being interpreted as "POSIX EOF", rather than "one more line plz", which lead to one too few lines being highlighted and hence the out of bounds error happened.
This only happens for double newlines, because otherwise it would be somecontent
rather than somecontent\n
, which isn't a valid line
in POSIX terms, but can still be interpreted as "line without newline", and hence the rendering worked (although erroneously).