config: fix gesture dispatcher parsing with whitespaces (#11784)

* config: fix gesture dispatcher parsing with whitespaces

Some dispatcher functions (e.g., `moveFocusTo`) expect the given string to be
stripped of whitepsaces.

This fixes `gesture` line parsing: rather than calling dispatcher functions
with the original string, we reuse words parsed by `CConstVarList` and join
them with a comma.

* tests/gestures: Add a test for `movecursortocorner`
This commit is contained in:
Nikolai Nechaev 2025-09-26 22:49:07 +09:00 committed by GitHub
parent d8f615751a
commit 4f3dd1ddb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 8 deletions

View file

@ -146,6 +146,16 @@ static bool test() {
EXPECT(Tests::windowCount(), 0);
// This test ensures that `movecursortocorner`, which expects
// a single-character direction argument, is parsed correctly.
Tests::spawnKitty();
OK(getFromSocket("/dispatch movecursortocorner 0"));
const std::string cursorPos1 = getFromSocket("/cursorpos");
OK(getFromSocket("/dispatch plugin:test:gesture left,4"));
const std::string cursorPos2 = getFromSocket("/cursorpos");
// The cursor should have moved because of the gesture
EXPECT(cursorPos1 != cursorPos2, true);
// kill all
NLog::log("{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();