Clean-up multi-instance after pasting history from another image.

We really want to have the multi_priority starting from 0 and increasing
one by one for every multi-instance history items just pasted from
another image.

As done for style items in the other pull-request but here for history items.