code: function onCursorActivity(cm) {
          var state = cm.state.foldGutter;
          var vp = cm.getViewport();
          window.clearTimeout(state.changeUpdate);
          state.changeUpdate = window.setTimeout(function () {
              //need to render the entire visible viewport to remove fold marks rendered from previous selections if any
              updateInViewport(cm, vp.from, vp.to);
          }, 400);
      }
docs: Triggered when the cursor moves in the editor and used to detect text selection changes
  in the editor.
  @param {!CodeMirror} cm the CodeMirror instance for the active editor