@@ -273,7 +273,7 @@ def initialize(prompt, prompt_char = '>', histfile = nil, framework = nil)
273
273
# a design problem in the Readline module and depends on the
274
274
# Readline.basic_word_break_characters variable being set to \x00
275
275
#
276
- def tab_complete ( str , previous_words = [ ] )
276
+ def tab_complete ( str )
277
277
# Check trailing whitespace so we can tell 'x' from 'x '
278
278
str_match = str . match ( /\s +$/ )
279
279
str_trail = ( str_match . nil? ) ? '' : str_match [ 0 ]
@@ -288,13 +288,13 @@ def tab_complete(str, previous_words = [])
288
288
self . tab_words = str_words
289
289
290
290
# Pop the last word and pass it to the real method
291
- tab_complete_stub ( self . tab_words . pop , previous_words )
291
+ tab_complete_stub ( self . tab_words . pop )
292
292
end
293
293
294
294
# Performs tab completion of a command, if supported
295
295
# Current words can be found in self.tab_words
296
296
#
297
- def tab_complete_stub ( str , previous_words = [ ] )
297
+ def tab_complete_stub ( str )
298
298
items = [ ]
299
299
300
300
return nil if not str
@@ -339,9 +339,9 @@ def tab_complete_stub(str, previous_words = [])
339
339
# Match based on the partial word
340
340
items . find_all { |e |
341
341
e =~ /^#{ str } /
342
- # Prepend the rest of the command, and all previous_words (or it all gets replaced!)
342
+ # Prepend the rest of the command (or it all gets replaced!)
343
343
} . map { |e |
344
- ( previous_words + tab_words ) . push ( e ) . join ( ' ' )
344
+ tab_words . dup . push ( e ) . join ( ' ' )
345
345
}
346
346
end
347
347
0 commit comments