Skip to content

Commit 923bf9b

Browse files
committed
Disable input polling when the context menu kludge is active
It can, if the selection is changed in that narrow window, cause bogus deletion of the selection. Issue #3273
1 parent 9b8fb65 commit 923bf9b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/codemirror.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,9 +1389,11 @@
13891389
// possible when it is clear that nothing happened. hasSelection
13901390
// will be the case when there is a lot of text in the textarea,
13911391
// in which case reading its value would be expensive.
1392-
if (!cm.state.focused || (hasSelection(input) && !prevInput) ||
1392+
if (this.contextMenuPending || !cm.state.focused ||
1393+
(hasSelection(input) && !prevInput) ||
13931394
isReadOnly(cm) || cm.options.disableInput || cm.state.keySeq)
13941395
return false;
1396+
13951397
// See paste handler for more on the fakedLastChar kludge
13961398
if (cm.state.pasteIncoming && cm.state.fakedLastChar) {
13971399
input.value = input.value.substring(0, input.value.length - 1);

0 commit comments

Comments
 (0)