]> git.cworth.org Git - sup/commitdiff
bugfix: mod by zero in completino mode
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 8 Dec 2007 22:51:26 +0000 (22:51 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 8 Dec 2007 22:51:26 +0000 (22:51 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@750 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/modes/completion-mode.rb

index 638c64e1e523625eda7495b14682ec157afcb385..3cb2fad74dae6d56045cf5b041f9b421ad7290c1 100644 (file)
@@ -28,7 +28,7 @@ private
   def update_lines
     width = buffer.content_width
     max_length = @list.max_of { |s| s.length }
-    num_per = buffer.content_width / (max_length + INTERSTITIAL.length)
+    num_per = [1, buffer.content_width / (max_length + INTERSTITIAL.length)].max
     @lines = [@header].compact
     @list.each_with_index do |s, i|
       if @prefix_len