feat(tui): read Zed editor context from state db (#24352)

This commit is contained in:
Kit Langton
2026-04-25 14:10:58 -04:00
committed by GitHub
parent 3bc0c36ace
commit 625aca49de
3 changed files with 221 additions and 6 deletions

View File

@@ -0,0 +1,9 @@
import { expect, test } from "bun:test"
import { offsetToPosition } from "../../../src/cli/cmd/tui/context/editor-zed"
test("offsetToPosition converts Zed offsets to 1-based editor positions", () => {
expect(offsetToPosition("one\ntwo\nthree", 0)).toEqual({ line: 1, character: 1 })
expect(offsetToPosition("one\ntwo\nthree", 4)).toEqual({ line: 2, character: 1 })
expect(offsetToPosition("one\ntwo\nthree", 6)).toEqual({ line: 2, character: 3 })
expect(offsetToPosition("one\ntwo\nthree", 100)).toEqual({ line: 3, character: 6 })
})