Save the selection for text field types (source/normal)

Also refactored this to be more readable, less repetitive
Refactor parts that weren't DRY, loading all state again