Correctly handle operation from "/" directory
Correctly handle operation from "/" directory

Prior to this commit, operation from the root directory was broken
because given paths like:

  /foo
  /bar

These were scanned as:

  oo
  ar

Instead of:

  foo
  bar

The cause is actually the trailing "/" in "/". The same bug would occur
if @path were ever something like "/foo/" or "/bar/" rather than "/foo"
or "/bar" (although in practice this never occurs because the callers
always pass in paths without trailing slashes).

For example, given a directory "/foo" and file "/foo/bar", our prefix
length is 4, and "/foo/bar"[5..-1] yields the desired "bar".

If directory is passed in as "/foo/" then our prefix length ends up
being 5 and we would incorrectly do "/foo/bar"[6..-1], which would yield
"ar".

Likewise directory "/" and file "/foo" yields prefix length 1, and we do
"/foo"[2..-1] and get "oo".

Stripping the trailing slash before calculating the prefix length fixes
both cases. "/" becomes "", our prefix length is now 1, and our string
"/foo"[1..-1] yields the desired "foo".

This commit fixes the bug mentioned in commit 38837a8.

Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>

yrro/command-t,supriyantomaftuh/command-t,nkpart/command-t,wincent/command-t,tmeusburger/Command-T,1234-/command-t,simichaels/dotfiles,lencioni/command-t,akitaonrails/Command-T,yrro/command-t,mtimkovich/command-t,simichaels/dotfiles,wincent/command-t,asoltys/command-t,besarthoxhaj/command-t,vrkansagara/command-t,tmeusburger/Command-T,lencioni/command-t,nkpart/command-t,asoltys/command-t,vrkansagara/command-t,supriyantomaftuh/command-t,wincent/command-t,akitaonrails/Command-T,tmeusburger/Command-T,nkpart/command-t,asoltys/command-t,akitaonrails/Command-T,1234-/command-t,mtimkovich/command-t,besarthoxhaj/command-t