Fixed bug with highlighting text in either textbox

The different autoapplied tags were above the "sel" tag. Raising the
"sel" tag fixed the bug.
Further work on link insertion functionality

The link insertion functions will do different things depending on
whether there was a range of characters selected when starting the link.

If the characters were selected, it will apply the link tag to the
characters.
If there was nothing selected, it will simply insert the
name of the linked note, with the link tag applied, at the insert cursot