()
| 1052 | // supported or compatible enough yet to rely on.) |
| 1053 | var prevInput = ""; |
| 1054 | function readInput() { |
| 1055 | if (leaveInputAlone || !focused || hasSelection(input) || options.readOnly) return false; |
| 1056 | var text = input.value; |
| 1057 | if (text == prevInput) return false; |
| 1058 | shiftSelecting = null; |
| 1059 | var same = 0, l = Math.min(prevInput.length, text.length); |
| 1060 | while (same < l && prevInput[same] == text[same]) ++same; |
| 1061 | if (same < prevInput.length) |
| 1062 | sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)}; |
| 1063 | else if (overwrite && posEq(sel.from, sel.to)) |
| 1064 | sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))}; |
| 1065 | replaceSelection(text.slice(same), "end"); |
| 1066 | if (text.length > 1000) { input.value = prevInput = ""; } |
| 1067 | else prevInput = text; |
| 1068 | return true; |
| 1069 | } |
| 1070 | function resetInput(user) { |
| 1071 | if (!posEq(sel.from, sel.to)) { |
| 1072 | prevInput = ""; |
no test coverage detected