Fixes #408. Trims leads spaces, adds trailing space, prevents line wipe when tab completing is done

git-svn-id: file:///home/svn/framework3/trunk@7284 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2009-10-26 20:33:55 +00:00
parent 5eed9deb2d
commit e1559b1ab4
1 changed files with 11 additions and 0 deletions

View File

@ -138,16 +138,27 @@ module Readline
RbReadline.rl_attempted_completion_over = true
# Remove leading spaces
text.gsub!(/^\s+/, '')
case_fold = @completion_case_fold
ary = proc.call(text)
if ary.class != Array
ary = Array(ary)
else
ary.compact!
ary.uniq!
end
ary.delete('')
matches = ary.length
return nil if (matches == 0)
if(matches == 1)
ary[0] = ary[0].strip + " "
end
result = Array.new(matches+2)
for i in 0 ... matches
result[i+1] = ary[i].dup