S&R: Make one transaction for the whole replace to speed up things
and get all the replacements in one "undo"
Differential Revision: https://phabricator.kde.org/D16838