Remade from selecttext's new source code, some problems with height not quite being enough