logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

"Tickit::Widget::Scroller::Item::Text" - add static text to a Scroller

Author

       Paul Evans <leonerd@leonerd.org.uk>

perl v5.38.2                                       2024-08-10             Tickit::Widget:...ler::Item::Text(3pm)

Constructor

new
          $item = Tickit::Widget::Scroller::Item::Text->new( $text, %opts );

       Constructs a new text item, containing the given string of text. Once constructed, the item is immutable.

       The following options are recognised in %opts:

       indent => INT
           If the text item needs to wrap, indent the second and subsequent lines by this amount. Does not apply
           to the first line.

       margin_left => INT
       margin_right => INT
           Sinceversion0.30.

           A  number  of columns to leave blank at the left and right edge of the item.  This applies outside of
           any additional space added by "indent".

       margin => INT
           Sinceversion0.30.

           Shortcut to setting both "margin_left" and "margin_right" to the same value.

       pen => Tickit::Pen
           A pen to set for rendering the item, including erasing its background. This will  not  be  set  while
           erasing area required for its margin.

Description

       This implementation of Tickit::Widget::Scroller::Item displays a simple static piece of text. It will be
       wrapped on whitespace (characters matching the "/\s/" regexp pattern).

Methods

chunks
          @chunks = $item->chunks;

       Returns  the  chunks  of  text displayed by this item. Each chunk is represented by an ARRAY reference of
       three fields, giving the text string, its width in columns, and various options

          [ $text, $width, %opts ]

       Recognised options are:

       pen => Tickit::Pen
               Pen to render the chunk with.

       linebreak => BOOL
               If true, force a linebreak after this chunk; the next one starts on the following line.

Name

       "Tickit::Widget::Scroller::Item::Text" - add static text to a Scroller

Synopsis

          use Tickit::Widget::Scroller;
          use Tickit::Widget::Scroller::Item::Text;

          my $scroller = Tickit::Widget::Scroller->new;

          $scroller->push(
             Tickit::Widget::Scroller::Item::Text->new( "Hello world" )
          );

See Also