Make the backend count lines in a portable manner

- Data.Text doesn't handle CR only line breaks which it seems excel macosx still uses