textedit: fixed bug where deleting a blank line causes a crash

We were painting outside the OnPaint event. That is not a good idea,
and has undefined behaviour.
textedit: minor optimisation in DEL key handling

If we know the current line is empty, we can simply delete that line,
without having to worry about concatenation with the next line.