Scroll Text Example
Demonstrates scrolling long text content within a fixed viewport.
Sometimes text exceeds the available space. The Paragraph widget supports a scroll parameter to simulate a viewport, allowing users to pan vertically and horizontally.
Features Demonstrated
-
Vertical Scrolling: Moving through lines of text.
-
Horizontal Scrolling: Panning across long, unwrapped lines.
-
State Management: tracking
scroll_xandscroll_yoffsets in the application state.
Hotkeys
-
Arrows (β/β): Scroll Vertically (
scroll) -
Arrows (β/β): Scroll Horizontally (
scroll) -
q: Quit
Usage
ruby examples/widget_scroll_text/app.rb
Learning Outcomes
Use this example if you need toβ¦
-
Build a log viewer.
-
Create a βterms and conditionsβ scrollbox.
-
Display code snippets that might be wider than the terminal.
