(e)
| 351 | } |
| 352 | |
| 353 | function onMouseDown(e) { |
| 354 | setShift(e_prop(e, "shiftKey")); |
| 355 | // Check whether this is a click in a widget |
| 356 | for (var n = e_target(e); n != wrapper; n = n.parentNode) |
| 357 | if (n.parentNode == code && n != mover) return; |
| 358 | |
| 359 | // See if this is a click in the gutter |
| 360 | for (var n = e_target(e); n != wrapper; n = n.parentNode) |
| 361 | if (n.parentNode == gutterText) { |
| 362 | if (options.onGutterClick) |
| 363 | options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e); |
| 364 | return e_preventDefault(e); |
| 365 | } |
| 366 | |
| 367 | var start = posFromMouse(e); |
| 368 | |
| 369 | switch (e_button(e)) { |
| 370 | case 3: |
| 371 | if (gecko && !mac) onContextMenu(e); |
| 372 | return; |
| 373 | case 2: |
| 374 | if (start) setCursor(start.line, start.ch, true); |
| 375 | setTimeout(focusInput, 20); |
| 376 | return; |
| 377 | } |
| 378 | // For button 1, if it was clicked inside the editor |
| 379 | // (posFromMouse returning non-null), we have to adjust the |
| 380 | // selection. |
| 381 | if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;} |
| 382 | |
| 383 | if (!focused) onFocus(); |
| 384 | |
| 385 | var now = +new Date; |
| 386 | if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) { |
| 387 | e_preventDefault(e); |
| 388 | setTimeout(focusInput, 20); |
| 389 | return selectLine(start.line); |
| 390 | } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) { |
| 391 | lastDoubleClick = {time: now, pos: start}; |
| 392 | e_preventDefault(e); |
| 393 | return selectWordAt(start); |
| 394 | } else { lastClick = {time: now, pos: start}; } |
| 395 | |
| 396 | var last = start, going; |
| 397 | if (options.dragDrop && dragAndDrop && !options.readOnly && !posEq(sel.from, sel.to) && |
| 398 | !posLess(start, sel.from) && !posLess(sel.to, start)) { |
| 399 | // Let the drag handler handle this. |
| 400 | if (webkit) lineSpace.draggable = true; |
| 401 | function dragEnd(e2) { |
| 402 | if (webkit) lineSpace.draggable = false; |
| 403 | draggingText = false; |
| 404 | up(); drop(); |
| 405 | if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { |
| 406 | e_preventDefault(e2); |
| 407 | setCursor(start.line, start.ch, true); |
| 408 | focusInput(); |
| 409 | } |
| 410 | } |
nothing calls this directly
no test coverage detected