fix(tui): consolidate developer tools controls (#42088)

This commit is contained in:
Kit Langton 2026-08-12 13:23:14 -04:00 committed by GitHub
parent 17cae23dce
commit 723f5e0028
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 11 deletions

View file

@ -429,6 +429,7 @@ export function DevToolsBar() {
function BarItem(props: ParentProps<{ active: boolean; onClick: () => void }>) {
const theme = useTheme()
const renderer = useRenderer()
const [hovered, setHovered] = createSignal(false)
return (
<box
position="relative"
@ -437,7 +438,15 @@ function BarItem(props: ParentProps<{ active: boolean; onClick: () => void }>) {
flexDirection="row"
paddingLeft={1}
paddingRight={1}
backgroundColor={props.active ? theme.background.action.primary.focused : undefined}
backgroundColor={
props.active
? theme.background.action.primary.focused
: hovered()
? theme.background.action.primary.hovered
: undefined
}
onMouseOver={() => setHovered(true)}
onMouseOut={() => setHovered(false)}
onMouseUp={() => {
if (renderer.getSelection()?.getSelectedText()) return
props.onClick()

View file

@ -283,7 +283,7 @@ export const settings: Setting[] = [
keywords: ["selection", "clipboard"],
},
{
title: "DevTools",
title: "Developer tools",
category: "Debug",
path: ["debug", "devtools"],
default: false,
@ -291,15 +291,6 @@ export const settings: Setting[] = [
labels: ["off", "on"],
keywords: ["debug bar", "developer tools"],
},
{
title: "Turn token usage",
category: "Debug",
path: ["debug", "turn_tokens"],
default: false,
values: [false, true, "verbose"],
labels: ["off", "on", "verbose"],
keywords: ["tokens", "usage", "debug"],
},
]
export function settingID(setting: Setting) {

View file

@ -180,6 +180,11 @@ test("uses ctrl+z for input undo when terminal suspend is unavailable", () => {
expect(overridden.keybinds.get("input.undo")).toMatchObject([{ key: "ctrl+u" }])
})
test("keeps turn token usage inside developer tools", () => {
expect(settings.find((setting) => setting.path.join(".") === "debug.devtools")?.title).toBe("Developer tools")
expect(settings.some((setting) => setting.path.join(".") === "debug.turn_tokens")).toBe(false)
})
test("provides config and its host interface", async () => {
const config = resolve({}, { terminalSuspend: true })
let current = {}