Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Expansion bug with braces and spaces



There seems to be some issue with expansion of brace alternatives when there's a space in the filename. First noticed when I had a bunch of poorly named downloads:

$ ls -1 Download/bug\ \(*
Download/bug (1).patch
Download/bug (2).patch
...etc...
Download/bug (17).patch
Download/bug (18).patch

And I wanted to see the differences between two of them:
$ diff -ur Download/bug\ \({1<Tab>
$ diff -ur Download/bug\ {\(1

(hitting tab again made it worse)
$ diff -ur Download/bug\ {\(1<Tab>
$ diff -ur Download/bug\{ \(1

(but not again, since the file no longer exists)
$ diff -ur Download/bug\{ \(1<Tab>


A more minimal example:

$ bindkey "^I" expand-or-complete

$ mkdir /tmp/brace-bug
$ touch /tmp/brace-bug/file\ {abcd,abce}

# this one's weird, but still okay:
$ print -l /tmp/brace-bug/file\ ab{<Tab>
$ print -l /tmp/brace-bug/file\ a{bc

# this one's not okay, since it's now quoting the brace:
$ print -l /tmp/brace-bug/file\ {a<Tab>
$ print -l /tmp/brace-bug/file\{ abc

--
Best,
Ben



Messages sorted by: Reverse Date, Date, Thread, Author