Handle invisibles at the token level to fix char width measurement

- [x] Get cursor position working correctly
- [ ] Fix specs

Fixes #3188