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

Function positionCursor

packages/pi-tui/test/editor.test.ts:3317–3325  ·  view source on GitHub ↗
(editor: Editor, line: number, col: number)

Source from the content-addressed store, hash-verified

3315 describe("Sticky column", () => {
3316 // Helper: position cursor at a specific line and column
3317 function positionCursor(editor: Editor, line: number, col: number): void {
3318 // Go to line 0 first
3319 for (let i = 0; i < 20; i++) editor.handleInput("\x1b[A");
3320 // Go to target line
3321 for (let i = 0; i < line; i++) editor.handleInput("\x1b[B");
3322 // Go to target col
3323 editor.handleInput("\x01"); // Ctrl+A
3324 for (let i = 0; i < col; i++) editor.handleInput("\x1b[C");
3325 }
3326
3327 it("preserves target column when moving up through a shorter line", () => {
3328 const editor = new Editor(createTestTUI(), defaultEditorTheme);

Callers 1

editor.test.tsFile · 0.85

Calls 1

handleInputMethod · 0.65

Tested by

no test coverage detected