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.
