bakkeby / dmenu-flexipatch

A dmenu build with preprocessor directives to decide which patches to include during build time
MIT License
183 stars 78 forks source link

instant patch doesn't work #21

Closed tienbuigia closed 1 month ago

tienbuigia commented 1 year ago

It works if I run it like this echo -ne "alskdjf\nlaksdjf\n" | dmenu

If I select a link, it doesn't work echo -ne "alskdjf\nlaksdjf\nhttps://examples.xyz" | dmenu

dmenu_run doesn't work as well.

This isn't just flexipatch but in vanilla version as well. at least mine (version = 5.2; patches: dmenu-caseinsensitive-5.0.diff dmenu-fuzzymatch-4.9.diff dmenu-highlight-20201211-fcdc159.diff dmenu-xresources-4.9.diff).

bakkeby commented 1 year ago

Perhaps it works, just not the way you think it should work?

As per https://tools.suckless.org/dmenu/patches/instant/ we have:

Adds an flag which will cause dmenu to select an item immediately if there is one matching option left.

The patch adds a new command line option -n.

So if we try the command of:

echo -ne "alskdjf\nlaksdjf\nhttps://examples.xyz" | dmenu -n

and you hit h then it should immediately return with https://examples.xyz because none of the other options contain that letter leaving the URL as the remaining option.

bakkeby commented 1 year ago

There could be some patch incompatibility between the instant patch and the fuzzymatch patch, will have a closer look.

bakkeby commented 1 year ago

So when patching this manually we need to take into account these lines added to the match function:

+   if(instant && matches && matches==matchend && !lsubstr) {
+       puts(matches->text);
+       cleanup();
+       exit(0);
+   }

ref. https://tools.suckless.org/dmenu/patches/instant/dmenu-instant-4.7.diff

and add something similar to the fuzzymatch function introduced by the fuzzymatch patch.

ref. https://tools.suckless.org/dmenu/patches/fuzzymatch/dmenu-fuzzymatch-4.9.diff

bakkeby commented 1 month ago

Going to close this down now. Checked this on both dmenu-flexipatch and my personal build and the instant patch seemed to behave as intended.