Fix the command completion.
1 files changed, 22 insertions(+), 6 deletions(-)

M hgcomplete.lua
M hgcomplete.lua +22 -6
@@ 35,18 35,34 @@ function unknown_files()
   return files
 end
 
+-- print("")
 -- print("SCRIPT PARAMETERS:")
 -- print("amount of parameters: " .. #arg)
 -- for a,b in pairs(arg)
 -- do
---   print(a .. ":" .. b)
+--    print(a .. ":" .. b)
 -- end
 
-possible_params = { "add", "clone", "commit", "push", "pull", "revert", "rm", "init" }
+possible_params = {
+  "add", "branch",
+  "clone",
+  "commit",
+  "export",
+  "fold",
+  "heads",
+  "merge",
+  "status",
+  "push",
+  "pull",
+  "revert",
+  "rm",
+  "init" }
 
--- print("arg: " .. arg[#arg])
-
-argument_table = string.split(arg[#arg], " ")
+arg_copy = arg[#arg]
+if string.sub(arg_copy, 1, 1) == "\"" and string.sub(arg_copy, string.len(arg_copy)) == "\"" then
+  arg_copy = string.sub(arg_copy, 2, #arg_copy - 1)
+end
+argument_table = string.split(arg_copy, " ")
 
 if #argument_table < 2 then
   -- print "all arguments:"

          
@@ 76,7 92,7 @@ possibilities = {}
 --   print(a .. ":" .. b .."|")
 -- end
 
-if #arg == 4 and #argument_table == 2 then
+if #arg == 4 and #argument_table == 2 and string.sub(arg_copy, string.len(arg_copy)) ~= " " then
   for i,p in pairs(possible_params)
   do
     if string.sub(p, 1, string.len(argument_table[2])) == argument_table[2] then