(input: string)
| 301 | |
| 302 | // Handles bracketed paste: \e[200~ (start) and \e[201~ (end) sequences |
| 303 | private handleBracketedPaste(input: string): boolean { |
| 304 | // Modern terminals wrap pasted content in escape sequences |
| 305 | if (input === "\u001b[200~") { |
| 306 | // Clear any pending rapid input timer to avoid conflicts |
| 307 | if (this._rapidInputTimer) { |
| 308 | clearTimeout(this._rapidInputTimer); |
| 309 | this._rapidInputTimer = null; |
| 310 | } |
| 311 | this._inPasteMode = true; |
| 312 | this._pasteBuffer = ""; |
| 313 | return true; |
| 314 | } |
| 315 | |
| 316 | if (input === "\u001b[201~") { |
| 317 | this._inPasteMode = false; |
| 318 | |
| 319 | if (this._pasteBuffer.length > COLLAPSE_SIZE) { |
| 320 | const placeholder = this.createPlaceholder(this._pasteBuffer); |
| 321 | this._pasteMap.set(placeholder, this._pasteBuffer); |
| 322 | this.insertText(placeholder); |
| 323 | } else { |
| 324 | this.insertText(this._pasteBuffer); |
| 325 | } |
| 326 | |
| 327 | this._pasteBuffer = ""; |
| 328 | return true; |
| 329 | } |
| 330 | |
| 331 | return false; |
| 332 | } |
| 333 | |
| 334 | // Fallback paste detection: detects rapid chunks by timing and size RAPID_INPUT_THRESHOLD |
| 335 | private handleRapidInput(input: string): boolean { |
no test coverage detected