Skip to content

Commit 0e65486

Browse files
committed
Fix focus state confusion in drag handler
Issue #6480
1 parent 12512d3 commit 0e65486

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mode/clike/clike.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
8282
state.tokenize = tokenString(ch);
8383
return state.tokenize(stream, state);
8484
}
85-
if (isPunctuationChar.test(ch)) {
86-
curPunc = ch;
87-
return null;
88-
}
8985
if (numberStart.test(ch)) {
9086
stream.backUp(1)
9187
if (stream.match(number)) return "number"
9288
stream.next()
9389
}
90+
if (isPunctuationChar.test(ch)) {
91+
curPunc = ch;
92+
return null;
93+
}
9494
if (ch == "/") {
9595
if (stream.eat("*")) {
9696
state.tokenize = tokenComment;

src/edit/mouse_events.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ function leftButtonStartDrag(cm, event, pos, behavior) {
149149
let dragEnd = operation(cm, e => {
150150
if (webkit) display.scroller.draggable = false
151151
cm.state.draggingText = false
152-
if (cm.state.delayingBlurEvent) delayBlurEvent(cm)
152+
if (cm.state.delayingBlurEvent) {
153+
if (cm.hasFocus()) cm.state.delayingBlurEvent = false
154+
else delayBlurEvent(cm)
155+
}
153156
off(display.wrapper.ownerDocument, "mouseup", dragEnd)
154157
off(display.wrapper.ownerDocument, "mousemove", mouseMove)
155158
off(display.scroller, "dragstart", dragStart)

0 commit comments

Comments
 (0)