Oh shoot, this doesn't produce the same result as the current implementation.
I completely forgot about metadata, with this implementation all files given new names are new files, so they have new file metadata. Owner and permissions may change, but specifically the execute bit won't be carried over from the original file. So shell scripts or Python scripts or similar will no longer run until the user manually re-adds the execute.
With the current implementation the metadata is preserved depending on the type of saving in use, the "safe" file save mode will not preserve the metadata but the others will.
Sorry @konsolebox we probably should stick to the existing implementation.