Permalink
Browse files

Added horizontal scrolling

  • Loading branch information...
1 parent c604277 commit c8d787503df45f3234aa58f3f44ad80edbe8770f @duckinator committed Sep 25, 2009
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/ghinfo.rb
View
11 lib/ghinfo.rb
@@ -27,7 +27,6 @@ def fetch_projects(username="")
def display_projects(username="")
x_left = 0
- x_right = size['cols']-2
y_top = 0
y_bottom = size['lines']-3
@text = ''
@@ -50,7 +49,6 @@ def display_projects(username="")
line " Repository: #{repo['url']}"
line " Forks: #{repo['forks']}"
line " Open Issues: #{repo['open_issues']}"
- line
}
@text_ex = @text.split("\n")
@@ -77,9 +75,12 @@ def display_projects(username="")
y_top = @text_ex.length - size['lines'] + 3
end
y_bottom = size['lines'] - 4 + y_top
- puts
- puts "=" * size['cols']
- puts @text_ex[y_top..y_bottom]
+ puts "\n#{("=" * size['cols'])}"
+ x_right = x_left+size['cols']-2
+ (y_top..y_bottom).each { |x|
+ str = @text_ex[x]
+ puts str[x_left..x_right]
+ }
puts "=" * size['cols']
print "Lines #{y_top+1}-#{y_bottom+1} of #{@text_ex.length} lines"
char = get_character

0 comments on commit c8d7875

Please sign in to comment.