feat(tui): add cursor style configuration (#32295)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
This commit is contained in:
@@ -31,13 +31,20 @@ test("validates config constraints", () => {
|
||||
prompt: { max_height: 10, max_width: "auto" },
|
||||
scroll_speed: 0.001,
|
||||
diff_style: "stacked",
|
||||
cursor: { blinking: false },
|
||||
plugin: ["example-plugin"],
|
||||
}),
|
||||
).toMatchObject({ leader_timeout: 250, attention: { volume: 1 }, diff_style: "stacked" })
|
||||
).toMatchObject({
|
||||
leader_timeout: 250,
|
||||
attention: { volume: 1 },
|
||||
diff_style: "stacked",
|
||||
cursor: { blinking: false },
|
||||
})
|
||||
expect(() => decodeInfo({ leader_timeout: 0 })).toThrow()
|
||||
expect(() => decodeInfo({ attention: { volume: 1.1 } })).toThrow()
|
||||
expect(() => decodeInfo({ prompt: { max_width: 0 } })).toThrow()
|
||||
expect(() => decodeInfo({ scroll_speed: 0 })).toThrow()
|
||||
expect(() => decodeInfo({ cursor: { style: "beam" } })).toThrow()
|
||||
expect(decodeInfo({ attention: { sounds: { unknown: "sound.wav" } } })).toEqual({ attention: { sounds: {} } })
|
||||
})
|
||||
|
||||
@@ -56,6 +63,7 @@ test("resolves host-neutral defaults", () => {
|
||||
expect(config.mouse).toBe(true)
|
||||
expect(config.keybinds.has("terminal.suspend")).toBe(true)
|
||||
expect(config.keybinds.has("session.list")).toBe(true)
|
||||
expect(config.cursor).toBeUndefined()
|
||||
})
|
||||
|
||||
test("resolves overrides without mutating input", () => {
|
||||
@@ -72,10 +80,17 @@ test("resolves overrides without mutating input", () => {
|
||||
sounds: { question: "/sounds/question.wav" },
|
||||
},
|
||||
keybinds: { session_list: "ctrl+l" },
|
||||
cursor: { blinking: false },
|
||||
}
|
||||
const config = resolve(input, { terminalSuspend: true })
|
||||
|
||||
expect(config).toMatchObject({ theme: "custom", mouse: false, leader_timeout: 750, attention: input.attention })
|
||||
expect(config).toMatchObject({
|
||||
theme: "custom",
|
||||
mouse: false,
|
||||
leader_timeout: 750,
|
||||
attention: input.attention,
|
||||
cursor: { style: "block", blinking: false },
|
||||
})
|
||||
expect(config.keybinds.get("session.list")).toHaveLength(1)
|
||||
expect(input.keybinds).toEqual({ session_list: "ctrl+l" })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user