Permalink
Browse files

small fix to check if response is nil when closing out of autocomplet…

…e window
  • Loading branch information...
1 parent fb180d7 commit 6c6f7aae2514305915a224a4b6b81525bb8feaa2 @malkomalko committed Nov 19, 2009
Showing with 9 additions and 5 deletions.
  1. +9 −5 Support/lib/autocomplete.rb
@@ -34,15 +34,19 @@ def initialize(current_word)
if @previous_line.gsub(' ','').size > 0
setup(@previous_line.gsub('[','').gsub(']','').gsub(' ',''), classes_for_regex, data)
response = show_dialog(nib,@choices)
- response_for_snippet = response.gsub(/(\(\w+\)\w+)/).each_with_index do |result, i|
- result = "${#{i+1}:#{result}}"
+ if !response.nil?
+ response_for_snippet = response.gsub(/(\(\w+\)\w+)/).each_with_index do |result, i|
+ result = "${#{i+1}:#{result}}"
+ end
+ print "#{e_sn(@previous_line)}#{response_for_snippet}];\n$0"
end
- print "#{e_sn(@previous_line)}#{response_for_snippet}];\n$0"
end
elsif !@choices.nil?
response = show_dialog(nib,@choices)
- response_for_snippet = response.gsub(/(\(\w+\)\w+)/).each_with_index do |result, i|
- result = "${#{i+1}:#{result}}"
+ if !response.nil?
+ response_for_snippet = response.gsub(/(\(\w+\)\w+)/).each_with_index do |result, i|
+ result = "${#{i+1}:#{result}}"
+ end
end
print response_for_snippet unless response_for_snippet.nil?
end

0 comments on commit 6c6f7aa

Please sign in to comment.