key_send_text function changes