<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">## Terminal::UI

A framework for building terminal interfaces.

## Example

Create a box in full screen with some text in it, wait for a key, then exit:

    use Terminal::UI 'ui';
    ui.setup(:1pane);
    ui.pane.put("Hello world.");
    ui.get-key;
    ui.shutdown;

    笊披武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶風
    笊践ello world.  笊�
    笊�              笊�
    笊壺武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶幅

## Example 2

Make a screen split with a line in the middle, with scrollable text on the top
and bottom, and a selected row in the top box.  The arrow keys (or j,k) move
the selected line up and down.  Tab switches to the other box.

    use Terminal::UI 'ui';
    ui.setup(:2panes);
    ui.panes[0].put("$_") for 1..10;
    ui.panes[1].put("$_") for &lt;hello world&gt;;
    ui.interact;
    ui.shutdown;

    笊披武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶風
    笊�8             笊�  &lt;- selected in green, scrollable
    笊�9             笊�
    笊�10            笊�
    笊溪楳笏笏笏笏笏笏笏笏笏笏笏笏笏笊｢
    笊蘇ello         笊�  &lt;- selected in grey.
    笊層orld         笊�
    笊壺武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶幅

## Example 3

Like example 2, but also -- pressing Enter in the top box
will some text about add the currently selected row to the
bottom box:

    ui.setup(:2panes);
    ui.panes[0].put("$_") for 1..10;

    ui.panes[0].on: select =&gt; -&gt; :$raw, :$meta {
      ui.panes[1].put("you chose $raw!")
    }

    ui.interact;
    ui.shutdown;

    笊披武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶風
    笊�8             笊�  &lt;- press Enter, and窶ｦ
    笊�9             笊�
    笊�10            笊�
    笊溪楳笏笏笏笏笏笏笏笏笏笏笏笏笏笊｢
    笊惣ou chose 8!  笊�  &lt;- 窶ｦthis appears!
    笊�              笊�
    笊壺武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶武笊絶幅


## Features and design goals

* Easy to quickly make a console interface with custom behavior, but practical defaults.

* Scrolling with some optimization, such as using ANSI scroll region escape sequences.

* Thread safe.  Concurrency friendly.  Unicode compatibile.

* Dynamic geometry calculation, for smart handling of window resizing.

## More examples

See the [eg](https://git.sr.ht/~bduggan/raku-terminal-ui/tree/master/item/eg/) directory.

## See also

[https://blog.matatu.org/terminal-ui](https://blog.matatu.org/terminal-ui)

## Description

The best place for documentation is the
[examples](https://git.sr.ht/~bduggan/raku-terminal-ui/tree/master/item/eg/) directory.

There is also reference documentation with links to the source code -- see
[Terminal::UI](https://git.sr.ht/~bduggan/raku-terminal-ui/tree/master/item/lib/Terminal/UI.md).  Other classes
with documentation are:

* [Terminal::UI::Screen](https://git.sr.ht/~bduggan/raku-terminal-ui/tree/master/item/lib/Terminal/UI/Screen.md)
* [Terminal::UI::Frame](https://git.sr.ht/~bduggan/raku-terminal-ui/tree/master/item/lib/Terminal/UI/Frame.md)
* [Terminal::UI::Pane](https://git.sr.ht/~bduggan/raku-terminal-ui/tree/master/item/lib/Terminal/UI/Pane.md)
* [Terminal::UI::Style](https://git.sr.ht/~bduggan/raku-terminal-ui/tree/master/item/lib/Terminal/UI/Style.md)
* [Terminal::UI::Input](https://git.sr.ht/~bduggan/raku-terminal-ui/tree/master/item/lib/Terminal/UI/Input.md)

## BUGS

Probably!

If you find some bugs, or just have something to say, feel free to contact the author, or
reach out on the mailing list:

  https://lists.sr.ht/~bduggan/raku-terminal-ui

## Author

Brian Duggan (bduggan at matatu.org)

</pre></body></html>