Fixed crash when tabbing on an empty line, and added test