diff --git a/conkeror/markam.js b/conkeror/markam.js index 8c7c2f1..f06b307 100644 --- a/conkeror/markam.js +++ b/conkeror/markam.js @@ -93,11 +93,20 @@ function markam_complete(input, pos, conservative) let str = input.substring(0, pos); var data = "", error = "", ret = []; - var result = yield shell_command( - markam_program + " --script", - $fds = [{ output: async_binary_string_writer("") }, - { input: async_binary_reader(function (s) data += s || "") }, - { input: async_binary_reader(function (s) error += s || "") }]); + var result = 0; + + if (str == "") + result = yield shell_command( + markam_program + " --script", + $fds = [{ output: async_binary_string_writer("") }, + { input: async_binary_reader(function (s) data += s || "") }, + { input: async_binary_reader(function (s) error += s || "") }]); + else + result = yield shell_command_with_argument( + markam_program + " --script search {}", str, + $fds = [{ output: async_binary_string_writer("") }, + { input: async_binary_reader(function (s) data += s || "") }, + { input: async_binary_reader(function (s) error += s || "") }]); if (result != 0 || error != "") throw new interactive_exception("result: " + result + @@ -110,7 +119,6 @@ function markam_complete(input, pos, conservative) let c = { count: ret.length, get_string: function (i) ret[i][0], get_description: function (i) ret[i][1], - // get_value: function (i) ret[i][2], get_input_state: function (i) [ret[i][2]] }; yield co_return(c); }