Write history only when in darkroom mode.

Continued work ofr 6ebf97c.
Fix issue when duplicating image from lighttable.