code: function resetInput(cm, typing) {
      if (cm.display.contextMenuPending) return;
      var minimal, selected, doc = cm.doc;
      if (cm.somethingSelected()) {
        cm.display.prevInput = "";
        var range = doc.sel.primary();
        minimal = hasCopyEvent &&
          (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);
        var content = minimal ? "-" : selected || cm.getSelection();
        cm.display.input.value = content;
        if (cm.state.focused) selectInput(cm.display.input);
        if (ie && ie_version >= 9) cm.display.inputHasSelection = content;
      } else if (!typing) {
        cm.display.prevInput = cm.display.input.value = "";
        if (ie && ie_version >= 9) cm.display.inputHasSelection = null;
      }
      cm.display.inaccurateSelection = minimal;
    }
docs: Reset the input to correspond to the selection (or to be empty, when not typing and nothing is selected)