summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-03-14 19:23:07 -0300
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-04-29 23:43:26 -0300
commit71362b6e74b5d1bff6f6df38eb91965fa4398661 (patch)
treec1c19a0181832189e0d2f12348a1cf8f8c4ab8c0
parentb7cc31b3648b91de02d91f87cff405e561f5d080 (diff)
downloadhighline-71362b6e74b5d1bff6f6df38eb91965fa4398661.tar.gz
Paginate only when page_at defined
-rw-r--r--lib/highline/paginator.rb2
-rw-r--r--lib/highline/statement.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/highline/paginator.rb b/lib/highline/paginator.rb
index 3c296a3..098ca48 100644
--- a/lib/highline/paginator.rb
+++ b/lib/highline/paginator.rb
@@ -17,6 +17,8 @@ class HighLine
# instead. This is to support any special handling for the final sequence.
#
def page_print(text)
+ return text unless highline.page_at
+
lines = text.scan(/[^\n]*\n?/)
while lines.size > highline.page_at
highline.puts lines.slice!(0...highline.page_at).join
diff --git a/lib/highline/statement.rb b/lib/highline/statement.rb
index 24dca78..4278d6f 100644
--- a/lib/highline/statement.rb
+++ b/lib/highline/statement.rb
@@ -29,7 +29,7 @@ class HighLine::Statement
statement = render_template
statement = Wrapper.wrap(statement, highline.wrap_at)
- statement = Paginator.new(highline).page_print(statement) unless highline.page_at.nil?
+ statement = Paginator.new(highline).page_print(statement)
# 'statement' is encoded in US-ASCII when using ruby 1.9.3(-p551)
# 'indentation' is correctly encoded (same as default_external encoding)