Add selection text to canvas

[ci skip]
Reorg'd some code for speed and lint