another key_send_text refactoring