FOR REVIEW ONLY: Reduce number of editor refreshes

@jasonsanjose 

This is essentially a workaround for #2728. It seems that opening files with long lines in CodeMirror v3 has gotten slower. To reduce the impact of this, we avoid refreshing multiple times in cases where it's not necessary.

This seems potentially a bit risky, so I'd like to get some eyes on it and discuss it before merging it.