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-b9f4589650daunstable
parent
5eed9deb2d
commit
e1559b1ab4
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue