For #7075, don't delete the last line if the selection ends right at the beginning

Note that this is a fix in master. I haven't looked at the fix in cmv4 yet - it might be different.