Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Commit 4f385e6

Browse files
committed
Re-query selection state in onContextMenu
Issue #2369
1 parent 4e24624 commit 4f385e6

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

lib/codemirror.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,15 +3087,14 @@
30873087
focusInput(cm);
30883088
resetInput(cm);
30893089
// Adds "Select all" to context menu in FF
3090-
var hasSelection = cm.somethingSelected();
3091-
if (!hasSelection) display.input.value = display.prevInput = " ";
3090+
if (!cm.somethingSelected()) display.input.value = display.prevInput = " ";
30923091

30933092
// Select-all will be greyed out if there's nothing to select, so
30943093
// this adds a zero-width space so that we can later check whether
30953094
// it got selected.
30963095
function prepareSelectAllHack() {
30973096
if (display.input.selectionStart != null) {
3098-
var extval = display.input.value = "\u200b" + (hasSelection ? display.input.value : "");
3097+
var extval = display.input.value = "\u200b" + (cm.somethingSelected() ? display.input.value : "");
30993098
display.prevInput = "\u200b";
31003099
display.input.selectionStart = 1; display.input.selectionEnd = extval.length;
31013100
}

0 commit comments

Comments
 (0)