()
| 852 | // supported or compatible enough yet to rely on.) |
| 853 | var prevInput = ""; |
| 854 | function readInput() { |
| 855 | if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false; |
| 856 | var text = input.value; |
| 857 | if (text == prevInput) return false; |
| 858 | shiftSelecting = null; |
| 859 | var same = 0, l = Math.min(prevInput.length, text.length); |
| 860 | while (same < l && prevInput[same] == text[same]) ++same; |
| 861 | if (same < prevInput.length) |
| 862 | sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)}; |
| 863 | else if (overwrite && posEq(sel.from, sel.to)) |
| 864 | sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))}; |
| 865 | replaceSelection(text.slice(same), "end"); |
| 866 | if (text.length > 1000) { input.value = prevInput = ""; } |
| 867 | else prevInput = text; |
| 868 | return true; |
| 869 | } |
| 870 | function resetInput(user) { |
| 871 | if (!posEq(sel.from, sel.to)) { |
| 872 | prevInput = ""; |
no test coverage detected