Yes, thank you.
Now i have new problem. maybe it's even a bug.
If I define prompt in this way:
data Songs = Songs
instance XPrompt Songs where
ššš showXPrompt Songsš = "Song: "
songsPrompt :: XPConfig -> X ()
songsPrompt c = do
ššš cmds <- io $ getSongs
ššš mkXPrompt Songs c (mkComplFunFromList' cmds) (\s -> spawn "mpc play")
getSongs = return ["Nigthwish - 1", "Nightwish - 2"]
(Notice song names)
Then i call this prompt and hit <tab> twice to select second "song", and i get this in prompt:
"Song: Nightwish - Nightwish - 1"
if i hit tab more, i get:
"Song: Nightwish - Nightwish - Nightwish - Nightwish - 1"
But if remove spaces:
getSongs = return ["Nigthwish-1", "Nightwish-2"]
Everything works fine.
This behaviour is made on purpose? Or it's my mistake somewhere? )
Thank you.
As far as I know, you'd have to define a custom completion function÷ÌÁÄÉÍÉÒ óÉÄÏÒÅÎËÏ wrote:
> Hi
>
> I wrote my custom prompts for selecting playlists and songs in mpd and
> used mkComplFunFromList to make completion function.
> What is the easiest way to enable partial matching of input against
> completion list. I mean so that compare was like
> select .. from ... where ... like '%input%'
> ?
>
> Thank you.
instead of creating it with mkComplFunFromList. So something like this
should work:
infixCompl _ [] = return []
infixCompl l s = return $ filter (s `isInfixOf`) l
That would create a function that returns all the matches in the list
if, the input string occurs in the element.
_______________________________________________
xmonad mailing list
xmonad@haskell.org
http://www.haskell.org/mailman/listinfo/xmonad