replace-rectangle shortcut and save scratch buffer