Permalink
Browse files

• Make completion work on empty and completely fixed paths.

  I.e. `dir['<TAB>` will now complete all entries of `dir`, and `dir['subdir/<TAB>` will now complete all entries under `dir['subdir']`.
  • Loading branch information...
1 parent 1bb2d9a commit 6a77b0002678ef81045ac5dccba9b98017041a06 @mkhl mkhl committed Jan 22, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/rush/shell.rb
View
@@ -108,7 +108,7 @@ def print_result(res)
def path_parts(input) # :nodoc:
case input
- when /((?:@{1,2}|\$|)\w+(?:\[[^\]]+\])*)([\[\/])(['"])([^\3]+)$/
+ when /((?:@{1,2}|\$|)\w+(?:\[[^\]]+\])*)([\[\/])(['"])([^\3]*)$/
$~.to_a.slice(1, 4).push($~.pre_match)
else
[ nil, nil, nil, nil, nil ]
@@ -129,7 +129,7 @@ def completion_proc
possible_var, accessor, quote, partial_path, pre = path_parts(input)
if possible_var
original_var, fixed_path = possible_var, ''
- if /^(.+\/)([^\/]+)$/ === partial_path
+ if /^(.+\/)([^\/]*)$/ === partial_path
fixed_path, partial_path = $~.captures
possible_var += "['#{fixed_path}']"
end

0 comments on commit 6a77b00

Please sign in to comment.