The name is for your own use only. I use the name as a tab title but you could ignore it and just pass null too.
Adds an empty line.
This is what writeln actually calls.
Adds a line by components without affecting scrollback.
Clears the scrollback buffer.
Writing into the scrollback buffer can be done with the same normal functions.
Draws the current state into the given terminal inside the given bounding box.
Default event handling for this widget. Call this only after drawing it into a rectangle and only if the event ought to be dispatched to it (which you determine however you want; you could dispatch all events to it, or perhaps filter some out too)
Scrolling controls.
Given a size, how far would you have to scroll back to get to the top?
Scrolling controls.
Writing into the scrollback buffer can be done with the same normal functions.
Property to control the current scrollback position. 0 = latest message at bottom of screen.
This is an internal helper for its scrollback buffer.
You can construct these to get more control over specifics including setting RGB colors.
This is the color it uses to clear the screen.
This is the color it uses to clear the screen.
A flag you can set and process on your own. All the library does with it is set it to false when it handles an event, otherwise you can do whatever you want with it.
The coordinates of the last drawInto
A string you can set and process on your own. The library only sets it from the constructor, then leaves it alone.
The coordinates of the last drawInto
The coordinates of the last drawInto
I originally wrote this to support my irc client and some of the features are geared toward helping with that (for example, name and demandsAttention), but the main thrust is to support either tabs or sub-sections of the terminal having their own output that can be displayed and scrolled back independently while integrating with some larger application.
Committed to git on August 4, 2015.
Cleaned up and documented on May 25, 2021.
The ScrollbackBuffer is a writable in-memory terminal that can be drawn to a real Terminal and maintain some internal position state by handling events. It is your responsibility to draw it (using the drawInto method) and dispatch events to its handleEvent method (if you want to, you can also just call the methods yourself).