()
| 853 | } |
| 854 | |
| 855 | deleteToLineStart(): { cursor: Cursor; killed: string } { |
| 856 | // If cursor is right after a newline (at start of line), delete just that |
| 857 | // newline — symmetric with deleteToLineEnd's newline handling. This lets |
| 858 | // repeated ctrl+u clear across lines. |
| 859 | if (this.offset > 0 && this.text[this.offset - 1] === '\n') { |
| 860 | return { cursor: this.left().modifyText(this), killed: '\n' } |
| 861 | } |
| 862 | |
| 863 | // Use startOfLine() so that at column 0 of a wrapped visual line, |
| 864 | // the cursor moves to the previous visual line's start instead of |
| 865 | // getting stuck. |
| 866 | const startCursor = this.startOfLine() |
| 867 | const killed = this.text.slice(startCursor.offset, this.offset) |
| 868 | return { cursor: startCursor.modifyText(this), killed } |
| 869 | } |
| 870 | |
| 871 | deleteToLineEnd(): { cursor: Cursor; killed: string } { |
| 872 | // If cursor is on a newline character, delete just that character |
no test coverage detected