vrapper/vrapper — pull request #22 by keforbes (2011-12-04 04:00:36+00:00)
Title: Fix delete and yank on last line of a file

This is a hack, there's no doubt about that. However, it appears to work in all of my testing. Plus, all the unit tests still pass. I'm submitting this as a Pull Request to give people a chance to reject it.

I changed StartEndTextRange so it doesn't grab the previous newline when it hits the end of the file. If this was for the YankOperation, I now manually append a newline (since there wasn't one at the end of the file). If this was for the DeleteOperation, I move the range back one character to grab the previous newline (so we don't leave behind a blank line). That's the part that is a hack. I assume that since we're in LINES mode, the previous character must be a newline. I think that assumption should always be true. I should probably test it on a Windows system though in case \r\n throws things off.