fix:use of undefined this/scope

Fixes #83 by wrapping the `codeMirror.refresh` call in a function.