class
TermBuf::Region
- TermBuf::Region
- Reference
- Object
Overview
A rectangle of the buffer that scrolls as a unit, optionally keeping the rows that scroll off it.
Scrollback capacity defaults to zero, which is the classic curses model: what scrolls away is gone. Give a region a capacity and it keeps that many rows of history, so a log pane gets scrollback without the application reimplementing it.
Defined in:
termbuf/core/region.crConstructors
Instance Method Summary
-
#bounds : Rect
The rectangle the region covers.
-
#bounds=(bounds : Rect) : Rect
Moves or resizes the region.
-
#clear_scrollback : Nil
Throws away the history and returns the view to the live rows.
-
#history(distance : Int32) : Array(Cell) | Nil
The scrolled-off row distance rows above the live content, where one is the most recent.
-
#push_scrollback(row : Slice(Cell)) : Nil
Keeps a row that has scrolled off the top.
-
#scrollback : Deque(Array(Cell))
Rows that have scrolled off the top, oldest first.
-
#scrollback_capacity : Int32
How many scrolled-off rows to keep.
-
#scrolled_back? : Bool
Whether the region is showing history rather than live content.
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
-
#view_offset : Int32
How far back through the scrollback the region is being viewed: zero shows live content, one shows the most recently scrolled-off row at the top, and so on.
-
#view_offset=(value : Int32) : Int32
Scrolls the view back by value rows, clamped to what scrollback holds.
Constructor Detail
Instance Method Detail
Moves or resizes the region.
What the screen-wide region a default cursor lives in needs when the window changes size. A region an application placed itself keeps the rectangle it was given; the buffer does not move regions about.
The scrolled-off row distance rows above the live content, where one is
the most recent. nil once the request runs past what is kept.
Keeps a row that has scrolled off the top. The slice is copied, so the caller is free to overwrite it immediately.
Rows that have scrolled off the top, oldest first.
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>
How far back through the scrollback the region is being viewed: zero shows live content, one shows the most recently scrolled-off row at the top, and so on.
Scrolls the view back by value rows, clamped to what scrollback holds.