class TTY::Pager::BasicPager::PageCursor

Tracks page cursor

@api private

Attributes

page_num[R]

Public Class Methods

new(height) click to toggle source
# File lib/tty/pager/basic.rb, line 97
def initialize(height)
  @height = height
  reset
end

Public Instance Methods

down_by(count) click to toggle source

Move coursor down the page by count

@param [Integer] count

@api public

# File lib/tty/pager/basic.rb, line 120
def down_by(count)
  @lines_left -= count
end
next_page() click to toggle source

Move cursor to the next page

@api public

# File lib/tty/pager/basic.rb, line 110
def next_page
  @page_num += 1
  @lines_left = @height
end
page_break?() click to toggle source

Check if time to break a page

@return [Boolean]

@api private

# File lib/tty/pager/basic.rb, line 129
def page_break?
  @lines_left.zero?
end
reset() click to toggle source
# File lib/tty/pager/basic.rb, line 102
def reset
  @page_num = 1
  @lines_left = @height
end