(e)
| 1881 | return coordsChar(x - offL.left, y - offL.top); |
| 1882 | } |
| 1883 | function onContextMenu(e) { |
| 1884 | var pos = posFromMouse(e), scrollPos = scroller.scrollTop; |
| 1885 | if (!pos || window.opera) return; // Opera is difficult. |
| 1886 | if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to)) |
| 1887 | operation(setCursor)(pos.line, pos.ch); |
| 1888 | |
| 1889 | var oldCSS = input.style.cssText; |
| 1890 | inputDiv.style.position = "absolute"; |
| 1891 | input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + |
| 1892 | "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " + |
| 1893 | "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; |
| 1894 | leaveInputAlone = true; |
| 1895 | var val = input.value = getSelection(); |
| 1896 | focusInput(); |
| 1897 | selectInput(input); |
| 1898 | function rehide() { |
| 1899 | var newVal = splitLines(input.value).join("\n"); |
| 1900 | if (newVal != val) operation(replaceSelection)(newVal, "end"); |
| 1901 | inputDiv.style.position = "relative"; |
| 1902 | input.style.cssText = oldCSS; |
| 1903 | if (ie_lt9) scroller.scrollTop = scrollPos; |
| 1904 | leaveInputAlone = false; |
| 1905 | resetInput(true); |
| 1906 | slowPoll(); |
| 1907 | } |
| 1908 | |
| 1909 | if (gecko) { |
| 1910 | e_stop(e); |
| 1911 | var mouseup = connect(window, "mouseup", function() { |
| 1912 | mouseup(); |
| 1913 | setTimeout(rehide, 20); |
| 1914 | }, true); |
| 1915 | } else { |
| 1916 | setTimeout(rehide, 50); |
| 1917 | } |
| 1918 | } |
| 1919 | |
| 1920 | // Cursor-blinking |
| 1921 | function restartBlink() { |
no test coverage detected