Reduce duplication in use of inputHistory.

Replaces repeated patterns for clearing and appending to the input history with single function calls. This would be worth doing for its own sake to make the code simpler, but it has the side benefit that it gives a way to "hook" pushInput for monitoring/tracing if anybody ever wants to do something like that.
Preserve input history across rebuild in editor.
Merge pull request #233 from JoeOsborn/refactor-inputhistory

Reduce duplication in use of inputHistory.