Issuing a ‘(deactivate-mark)’ right before the line (and (not unread-command-events) solves the problem but I don't know if it has any unwanted side effects or if it's a good way to go about it. By the way this bug also affects Emacs 28.1. Best, Andrea