Remove selected text before input or paste from clipboard. Thanks to nikk9 <dev.nul@mail.ru> for the original patch. Signed-off-by: Ilia Maslakov <il.smind@gmail.com>