Permalink
Browse files

Fixed #77: echo "{a,b}" -> "a b" is printed.

  • Loading branch information...
1 parent 7a53539 commit 833feff04e2f5d132d032138ca6d967bd005f24f @zetamatta committed Jul 13, 2015
Showing with 9 additions and 0 deletions.
  1. +9 −0 nyagos.d/brace.lua
View
@@ -6,6 +6,12 @@ nyagos.filter = function(cmdline)
cmdline = cmdline_
end
end
+ local save={}
+ cmdline = cmdline:gsub("((['\"])[^%2]*%2)", function(s,_)
+ local i=#save+1
+ save[i] = s
+ return '\a('..i..')'
+ end)
repeat
local last = true
cmdline = cmdline:gsub("(%S*)(%b{})(%S*)", function(left,mid,right)
@@ -33,5 +39,8 @@ nyagos.filter = function(cmdline)
end
end)
until last
+ cmdline = cmdline:gsub("\a%((%d+)%)",function(s)
+ return save[s+0]
+ end)
return cmdline
end

0 comments on commit 833feff

Please sign in to comment.