Skip to content

Commit

Permalink
implement double string separation
Browse files Browse the repository at this point in the history
  • Loading branch information
lytex committed Jul 15, 2023
1 parent 64046ec commit c4c8f65
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lua/telescope-live-grep-args/actions/tokenize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ return function(opts)
end
end

function permutations(a)
local function permutations(a)
-- call with coroutine.wrap()
return wrap(function()
permgen(a)
end)
end

function removeDuplicates(tbl)
local function removeDuplicates(tbl)
local newTbl = {}
local seen = {}
for _, value in ipairs(tbl) do
Expand All @@ -54,8 +54,12 @@ return function(opts)
prompt = vim.trim(prompt)
end
local tokens = {}
-- TODO interpret two spaces or more as a literal space

-- Pretty sure nobody will use this as part of the prompt!
local unique_string = "<!token_separator!>"
prompt = prompt:gsub("%s%s+", unique_string)
for token in prompt:gmatch("%S+") do
token = token:gsub(unique_string, " ")
table.insert(tokens, token)
end

Expand Down

0 comments on commit c4c8f65

Please sign in to comment.