(data: string)
| 675 | } |
| 676 | |
| 677 | handleInput(data: string): void { |
| 678 | const kb = getKeybindings(); |
| 679 | |
| 680 | // Handle character jump mode (awaiting next character to jump to) |
| 681 | if (this.jumpMode !== null) { |
| 682 | // Cancel if the hotkey is pressed again |
| 683 | if (kb.matches(data, "tui.editor.jumpForward") || kb.matches(data, "tui.editor.jumpBackward")) { |
| 684 | this.jumpMode = null; |
| 685 | return; |
| 686 | } |
| 687 | |
| 688 | const printable = decodePrintableKey(data) ?? (data.charCodeAt(0) >= 32 ? data : undefined); |
| 689 | if (printable !== undefined) { |
| 690 | // Printable character - perform the jump |
| 691 | const direction = this.jumpMode; |
| 692 | this.jumpMode = null; |
| 693 | this.jumpToChar(printable, direction); |
| 694 | return; |
| 695 | } |
| 696 | |
| 697 | // Control character - cancel and fall through to normal handling |
| 698 | this.jumpMode = null; |
| 699 | } |
| 700 | |
| 701 | // Handle bracketed paste mode |
| 702 | if (data.includes("\x1b[200~")) { |
| 703 | this.isInPaste = true; |
| 704 | this.pasteBuffer = ""; |
| 705 | this.pasteBurst.reset(); |
| 706 | data = data.replace("\x1b[200~", ""); |
| 707 | } |
| 708 | |
| 709 | if (this.isInPaste) { |
| 710 | this.pasteBuffer += data; |
| 711 | const endIndex = this.pasteBuffer.indexOf("\x1b[201~"); |
| 712 | if (endIndex !== -1) { |
| 713 | const pasteContent = this.pasteBuffer.substring(0, endIndex); |
| 714 | if (pasteContent.length > 0) { |
| 715 | this.handlePaste(pasteContent); |
| 716 | } |
| 717 | this.isInPaste = false; |
| 718 | const remaining = this.pasteBuffer.substring(endIndex + 6); |
| 719 | this.pasteBuffer = ""; |
| 720 | this.pasteBurst.reset(); |
| 721 | if (remaining.length > 0) { |
| 722 | this.handleInput(remaining); |
| 723 | } |
| 724 | return; |
| 725 | } |
| 726 | return; |
| 727 | } |
| 728 | |
| 729 | const isEnterKey = data !== "\n" && kb.matches(data, "tui.input.submit"); |
| 730 | const charCode = data.charCodeAt(0); |
| 731 | const printableForBurst = decodePrintableKey(data) ?? |
| 732 | (data.length === 1 && charCode >= 32 && charCode !== 0x7f ? data : undefined); |
| 733 | if (!this.disablePasteBurst && !isEnterKey && printableForBurst === undefined) { |
| 734 | this.pasteBurst.reset(); |
nothing calls this directly
no test coverage detected