fixes #77, Pressing end of line on the last line, goes to the wrong
location. Added a test to check for this issue.