GeezerVison is showing github.com — fix(app): prefer cmd+k for command palette (#18731) · junmediatek/opencode@0f5626d
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/app/e2e/actions.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -175,9 +175,9 @@ export async function runTerminal(page: Page, input: { cmd: string; token: strin | 175 | 175 | await expect.poll(() => terminalHas(page, { term, token: input.token }), { timeout }).toBe(true) | 176 | 176 | } | 177 | 177 |
| 178 | | -export async function openPalette(page: Page) { | | 178 | +export async function openPalette(page: Page, key = "K") { | 179 | 179 | await defocus(page) | 180 | | - await page.keyboard.press(`${modKey}+P`) | | 180 | + await page.keyboard.press(`${modKey}+${key}`) | 181 | 181 |
| 182 | 182 | const dialog = page.getByRole("dialog") | 183 | 183 | await expect(dialog).toBeVisible() | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/e2e/app/palette.spec.ts +10-1Lines changed: 10 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { test, expect } from "../fixtures" | 2 | | -import { openPalette } from "../actions" | | 2 | +import { closeDialog, openPalette } from "../actions" | 3 | 3 |
| 4 | 4 | test("search palette opens and closes", async ({ page, gotoSession }) => { | 5 | 5 | await gotoSession() | @@ -9,3 +9,12 @@ test("search palette opens and closes", async ({ page, gotoSession }) => { | 9 | 9 | await page.keyboard.press("Escape") | 10 | 10 | await expect(dialog).toHaveCount(0) | 11 | 11 | }) | | 12 | + | | 13 | +test("search palette also opens with cmd+p", async ({ page, gotoSession }) => { | | 14 | + await gotoSession() | | 15 | + | | 16 | + const dialog = await openPalette(page, "P") | | 17 | + | | 18 | + await closeDialog(page, dialog) | | 19 | + await expect(dialog).toHaveCount(0) | | 20 | +}) |
Collapse file Copy file name to clipboardExpand all lines: packages/app/e2e/settings/settings-keybinds.spec.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -241,7 +241,7 @@ test("changing file open keybind works", async ({ page, gotoSession }) => { | 241 | 241 | await expect(keybindButton).toBeVisible() | 242 | 242 |
| 243 | 243 | const initialKeybind = await keybindButton.textContent() | 244 | | - expect(initialKeybind).toContain("P") | | 244 | + expect(initialKeybind).toContain("K") | 245 | 245 |
| 246 | 246 | await keybindButton.click() | 247 | 247 | await expect(keybindButton).toHaveText(/press/i) | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/context/command-keybind.test.ts +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,4 +40,11 @@ describe("command keybind helpers", () => { | 40 | 40 | expect(display.includes("Alt") || display.includes("⌥")).toBe(true) | 41 | 41 | expect(formatKeybind("none")).toBe("") | 42 | 42 | }) | | 43 | + | | 44 | + test("formatKeybind prefers the first combo", () => { | | 45 | + const display = formatKeybind("mod+k,mod+p") | | 46 | + | | 47 | + expect(display.includes("K") || display.includes("k")).toBe(true) | | 48 | + expect(display.includes("P") || display.includes("p")).toBe(false) | | 49 | + }) | 43 | 50 | }) |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/pages/session/use-session-commands.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -255,7 +255,7 @@ export const useSessionCommands = (actions: SessionCommandContext) => { | 255 | 255 | id: "file.open", | 256 | 256 | title: language.t("command.file.open"), | 257 | 257 | description: language.t("palette.search.placeholder"), | 258 | | - keybind: "mod+p", | | 258 | + keybind: "mod+k,mod+p", | 259 | 259 | slash: "open", | 260 | 260 | onSelect: () => dialog.show(() => <DialogSelectFile onOpenFile={showAllFiles} />), | 261 | 261 | }), | |
|