richedit: Move implementation of EM_GETTEXTRANGE to its own function.