Fix selection being drawn over cursor

Closes #2237