Keep track of filenames when performing automatic registration.

This means that the history widget is now ‘fully’ functional!
Also updated test case accordingly.