binds/submap: fix submap enter bind == bind inside submap (#14856)

* Only process submap bindings if its the same on press

Move the check below the pattern match and check if the key was pressed

Address comment: Remove {}

Remove the new submap check and replace the old one

* tests/keybinds: add additional submap testcase

This tests for cases where the keybind to enter the submap is also bound inside it

---------

Co-authored-by: 0xdeadcode-arch <code.akshat.thukral@gmail.com>
This commit is contained in:
BENDI
2026-06-07 12:26:02 +02:00
committed by Vaxry
co-authored by 0xdeadcode-arch
parent b9e7d097a2
commit 3ef4e0dc4d
3 changed files with 10 additions and 1 deletions
+8
View File
@@ -459,6 +459,14 @@ SUBTEST(submap) {
press(KEY_P);
EXPECT_CONTAINS(getFromSocket("/submap"), "default");
// submap 1 with identical keybind bound inside it
press(KEY_U, MOD_META);
EXPECT_CONTAINS(getFromSocket("/submap"), "submap1");
press(KEY_U, MOD_META);
EXPECT_CONTAINS(getFromSocket("/submap"), "submap3");
press(KEY_O);
Tests::waitUntilWindowsN(4);
EXPECT_CONTAINS(getFromSocket("/submap"), "default");
Tests::killAllWindows();
}
+1
View File
@@ -201,6 +201,7 @@ hl.bind(mainMod .. " + u", hl.dsp.submap("submap1"))
hl.define_submap("submap1", function()
hl.bind("u", hl.dsp.submap("submap2"))
hl.bind(mainMod .. " + u", hl.dsp.submap("submap3"))
hl.bind("i", hl.dsp.submap("submap3"))
hl.bind("o", hl.dsp.exec_cmd(terminal))
hl.bind("p", hl.dsp.submap("reset"))
+1 -1
View File
@@ -613,7 +613,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
if (!k->locked && g_pSessionLockManager->isSessionLocked())
continue;
if (!IGNORECONDITIONS && ((modmask != k->modmask && !k->ignoreMods) || (k->submap.name != Config::Actions::state()->m_currentSubmap && !k->submapUniversal) || k->shadowed))
if (!IGNORECONDITIONS && ((modmask != k->modmask && !k->ignoreMods) || ((k->submap.name != key.submapAtPress.name) && !k->submapUniversal) || k->shadowed))
continue;
if (device) {