()
| 1620 | } |
| 1621 | |
| 1622 | private deleteToEndOfLine(): void { |
| 1623 | this.exitHistoryBrowsing(); |
| 1624 | |
| 1625 | const currentLine = this.state.lines[this.state.cursorLine] || ""; |
| 1626 | |
| 1627 | if (this.state.cursorCol < currentLine.length) { |
| 1628 | this.pushUndoSnapshot(); |
| 1629 | |
| 1630 | // Calculate text to be deleted and save to kill ring (forward deletion = append) |
| 1631 | const deletedText = currentLine.slice(this.state.cursorCol); |
| 1632 | this.killRing.push(deletedText, { prepend: false, accumulate: this.lastAction === "kill" }); |
| 1633 | this.lastAction = "kill"; |
| 1634 | |
| 1635 | // Delete from cursor to end of line |
| 1636 | this.state.lines[this.state.cursorLine] = currentLine.slice(0, this.state.cursorCol); |
| 1637 | } else if (this.state.cursorLine < this.state.lines.length - 1) { |
| 1638 | this.pushUndoSnapshot(); |
| 1639 | |
| 1640 | // At end of line - merge with next line, treating newline as deleted text |
| 1641 | this.killRing.push("\n", { prepend: false, accumulate: this.lastAction === "kill" }); |
| 1642 | this.lastAction = "kill"; |
| 1643 | |
| 1644 | const nextLine = this.state.lines[this.state.cursorLine + 1] || ""; |
| 1645 | this.state.lines[this.state.cursorLine] = currentLine + nextLine; |
| 1646 | this.state.lines.splice(this.state.cursorLine + 1, 1); |
| 1647 | } |
| 1648 | |
| 1649 | if (this.onChange) { |
| 1650 | this.onChange(this.getText()); |
| 1651 | } |
| 1652 | } |
| 1653 | |
| 1654 | private deleteWordBackwards(): void { |
| 1655 | this.exitHistoryBrowsing(); |
no test coverage detected