Prevent sdcv from interpreting search term starting with dash as an option (#7134)

reviewable/pr7135/r2
Markismus 3 years ago committed by GitHub
parent 8991ec1372
commit 67ca9c35f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -746,7 +746,7 @@ function ReaderDictionary:startSdcv(word, dict_names, fuzzy_search)
break -- don't do any more lookup on additional dict_dirs
end
local args = {"./sdcv", "--utf8-input", "--utf8-output", "--json-output", "--non-interactive", "--data-dir", dict_dir, word}
local args = {"./sdcv", "--utf8-input", "--utf8-output", "--json-output", "--non-interactive", "--data-dir", dict_dir}
if not fuzzy_search then
table.insert(args, "--exact-search")
end
@ -756,6 +756,8 @@ function ReaderDictionary:startSdcv(word, dict_names, fuzzy_search)
table.insert(args, opt)
end
end
table.insert(args, "--") -- prevent word starting with a "-" to be interpreted as a sdcv option
table.insert(args, word)
local cmd = util.shell_escape(args)
-- cmd = "sleep 7 ; " .. cmd -- uncomment to simulate long lookup time

Loading…
Cancel
Save