{"action":"created","issue":{"url":"https://api.github.com/repos/mridgers/clink/issues/329","labels_url":"https://api.github.com/repos/mridgers/clink/issues/329/labels{/name}","comments_url":"https://api.github.com/repos/mridgers/clink/issues/329/comments","events_url":"https://api.github.com/repos/mridgers/clink/issues/329/events","html_url":"https://github.com/mridgers/clink/issues/329","id":94777625,"number":329,"title":"Question ?","user":{"login":"melck","id":813889,"avatar_url":"https://avatars.githubusercontent.com/u/813889?v=3","gravatar_id":"","url":"https://api.github.com/users/melck","html_url":"https://github.com/melck","followers_url":"https://api.github.com/users/melck/followers","following_url":"https://api.github.com/users/melck/following{/other_user}","gists_url":"https://api.github.com/users/melck/gists{/gist_id}","starred_url":"https://api.github.com/users/melck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melck/subscriptions","organizations_url":"https://api.github.com/users/melck/orgs","repos_url":"https://api.github.com/users/melck/repos","events_url":"https://api.github.com/users/melck/events{/privacy}","received_events_url":"https://api.github.com/users/melck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-13T18:07:45Z","updated_at":"2015-07-18T20:59:41Z","closed_at":null,"body":"hi,\r\n\r\nI'm trying to create a match generator who autocomplete folder like ide done (ex atom sublime). I developed a command program made with nodejs to search directories.\r\nI want to rewrite output line but i don't know how to do it with lua (maybe impossible). Do u have a solution even a ugly way to rewrite ouput with lua ?\r\n\r\nex: \"ws pro test\" would become \"ws project-test\"\r\n\r\n```Lua\r\nfunction ws_match_generator(text, first, last)\r\n\tfound_matches = false\r\n\tif rl_state.line_buffer:find(\"^ws \") then\r\n\t\tclink.match_display_filter = ws_display_filter\r\n\t\tfound_matches = true\r\n\t\t\r\n\t\tlocal matches = {}\r\n\t\tlocal i = 1\r\n\t\tlocal fragment = rl_state.line_buffer:match('^ws%s+(.*)')\r\n\t\tfor line in io.popen(\"find-project search \\\"\" .. fragment .. \"\\\"\"):lines() do\r\n\t\t\tmatches[i] = line\r\n\t\t\ti = i + 1\r\n\t\tend\r\n\r\n\t\tif (#matches == 1) then\r\n\t\t\t-- it's here that i want to rewrite output line\r\n\t\t\trl_state.line_buffer:gsub('^(.*)', matches[1]);\r\n\t\telseif (#matches > 1) then\r\n\t\t\tfor i= 0, #matches do\r\n\t\t\t\tclink.add_match(matches[i])\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\r\n    return found_matches\r\nend\r\n```\r\n\r\nPS: sorry for my poor english :)"},"comment":{"url":"https://api.github.com/repos/mridgers/clink/issues/comments/122596809","html_url":"https://github.com/mridgers/clink/issues/329#issuecomment-122596809","issue_url":"https://api.github.com/repos/mridgers/clink/issues/329","id":122596809,"user":{"login":"mridgers","id":1431672,"avatar_url":"https://avatars.githubusercontent.com/u/1431672?v=3","gravatar_id":"","url":"https://api.github.com/users/mridgers","html_url":"https://github.com/mridgers","followers_url":"https://api.github.com/users/mridgers/followers","following_url":"https://api.github.com/users/mridgers/following{/other_user}","gists_url":"https://api.github.com/users/mridgers/gists{/gist_id}","starred_url":"https://api.github.com/users/mridgers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mridgers/subscriptions","organizations_url":"https://api.github.com/users/mridgers/orgs","repos_url":"https://api.github.com/users/mridgers/repos","events_url":"https://api.github.com/users/mridgers/events{/privacy}","received_events_url":"https://api.github.com/users/mridgers/received_events","type":"User","site_admin":false},"created_at":"2015-07-18T20:59:41Z","updated_at":"2015-07-18T20:59:41Z","body":">maybe be the next syntax could answer to my issue ?\r\nCorrect. The quote character will mean that the 'project abc' will be considered as a single word to be completed.\r\n\r\n>I have another problem to use my command, how can i force order of multiple matches ?\r\nI'm sure I fully understand what you mean? It isn't possible to reorder words on a line from Lua for the reasons I mentioned before. Clink's Lua-base framework is just for generating matches for the word under the cursor - it isn't possible to rewrite the line being edited."}}