textview: Fix cursor/anchor mixup when retrieving surrounding text Closes #6460 See merge request GNOME/gtk!6929