diff --git a/lib/codemirror.js b/lib/codemirror.js
index <HASH>..<HASH> 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -1793,9 +1793,9 @@
 
   function resetInput(cm, user) {
     var minimal, selected, doc = cm.doc;
-    var range = doc.sel.primary();
-    if (!range.empty()) {
+    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();
Fix resetInput to not confuse readInput when prim sel is empty but secondary is not

Closes #<I>
Closes #<I>
Closes #<I>