Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/glide/browser/base/content/browser-commands.mts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ class GlideCommandsClass {
return;
}

const labels = Strings.generate_prefix_free_codes(Hinting.ALPHABET, hints.length, Hinting.ALPHABET_COST_MAP);
const hint_keys = GlideBrowser.api.keymaps.list("hint").map((k) => k.lhs);
const hint_alphabet = hint_keys.length
? Hinting.ALPHABET.filter((k) => !hint_keys.includes(k))
: Hinting.ALPHABET;
const labels = Strings.generate_prefix_free_codes(hint_alphabet, hints.length, Hinting.ALPHABET_COST_MAP);

for (let i = 0; i < hints.length; i++) {
const hint = hints[i]!;
Expand Down
17 changes: 17 additions & 0 deletions src/glide/browser/base/content/test/hints/browser_hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,20 @@ add_task(async function test_expandable_content_can_be_hinted() {
is(is_open, true, "<details> content should be open after activating the hint");
});
});

add_task(async function test_hint_keymaps_are_ignored() {
await GlideTestUtils.reload_config(function _() {
glide.keymaps.set("hint", "f", "keys <esc>");
glide.keymaps.set("normal", "j", "config_edit");
});

await BrowserTestUtils.withNewTab(FILE, async _browser => {
await keys("f");
await wait_for_hints();
const hints = GlideCommands.get_active_hints();
notok(hints.find(hint => hint.label === "f"), "'f' is hidden when mapped in hint mode");
ok(hints.find(hint => hint.label === "j"), "'j' is not mapped in hint mode");

await keys("<esc>");
});
});