MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / moveWordBackwards

Method moveWordBackwards

packages/pi-tui/src/components/editor.ts:1935–1955  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1933 }
1934
1935 private moveWordBackwards(): void {
1936 this.lastAction = null;
1937 const currentLine = this.state.lines[this.state.cursorLine] || "";
1938
1939 // If at start of line, move to end of previous line
1940 if (this.state.cursorCol === 0) {
1941 if (this.state.cursorLine > 0) {
1942 this.state.cursorLine--;
1943 const prevLine = this.state.lines[this.state.cursorLine] || "";
1944 this.setCursorCol(prevLine.length);
1945 }
1946 return;
1947 }
1948
1949 this.setCursorCol(
1950 findWordBackward(currentLine, this.state.cursorCol, {
1951 segment: (text) => this.segment(text, "word"),
1952 isAtomicSegment: isPasteMarker,
1953 }),
1954 );
1955 }
1956
1957 /**
1958 * Yank (paste) the most recent kill ring entry at cursor position.

Callers 2

handleInputMethod · 0.95
deleteWordBackwardsMethod · 0.95

Calls 3

setCursorColMethod · 0.95
segmentMethod · 0.95
findWordBackwardFunction · 0.90

Tested by

no test coverage detected