Store single-line deltas as .text instead of .lines in undo history

Stores single-line delta content as .text instead of .lines in undo
history. This is done without modifying the original delta object in
case the caller still retains a handle to the original.
Treat deltas with empty ranges as NOOPs