Fix text selection and cursor position when text is justified

Text selection and cursor position are not correct when text is justified.
See: https://monosnap.com/file/q1zlqOQN0WLpCG416HYfKDtO4GtOdo.

The bug is due to the whitespace width not being taken into account when rendering the cursor and selection.
This pull request fixes it.