Tickit...::Text(3pm)

πŸ“¦
version 0.33 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– Tickit::Widget::Scroller::Item::Text πŸ’–

okay bestie, so this is the Tickit::Widget::Scroller::Item::Text page from the User Contributed Perl Documentation, and it's literally just about dropping some static text into a Scroller. no cap. ✨


🌸 NAME 🌸

Tickit::Widget::Scroller::Item::Text β€” the way this module's whole job is adding static text to a Scroller and it does it flawlessly. πŸ’…


πŸ¦‹ 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" )
);

like… that's it. that's the whole vibe. push some text, slay. πŸ”₯


✨ DESCRIPTION ✨

so this is an implementation of Tickit::Widget::Scroller::Item that displays a simple static piece of text. it's giving "set it and forget it" honestly.

and it gets wrapped on whitespace β€” meaning characters matching the /\s/ regexp pattern. so it'll break your lines at the spaces, not mid-word. iconic behaviour tbh. πŸŽ€


🧚 CONSTRUCTOR 🧚

new

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

constructs a new text item holding the given string of text. and listen β€” once it's constructed, the item is immutable. it's not changing for anybody, periodt. πŸ‘‘

these are the options it recognises in %opts:

  • indent => INT β€” if the text item needs to wrap, this indents the second and subsequent lines by this amount. ngl it does not apply to the first line, only the follow-ups. πŸ’«
  • margin_left => INT β€” since version 0.30. a number of columns to leave blank at the left edge of the item. this applies outside of any extra space that indent adds. 🫢
  • margin_right => INT β€” since version 0.30. same energy as margin_left but for the right edge. a number of columns to leave blank there. and yeah, this also applies outside of whatever indent added. πŸ’–
  • margin => INT β€” since version 0.30. this is the shortcut, bestie β€” it just sets both margin_left and margin_right to the same value at once. two birds, one adorable line of code. 🐦
  • pen => Tickit::Pen β€” a pen to set for rendering the item, and that includes erasing its background. heads up though: it will not be set while erasing the area required for its margin. ⭐

πŸ’… 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 β€” the text string, its width in columns, and various options:

[ $text, $width, %opts ]

the recognised options are:

  • pen => Tickit::Pen β€” the pen to render the chunk with. πŸ–ŠοΈ
  • linebreak => BOOL β€” if this is true, it forces a linebreak after this chunk, so the next one starts on the following line. lowkey dramatic of it but okay. 😌

🌈 AUTHOR 🌈

Paul Evans <leonerd@leonerd.org.uk>


and that's the whole page, bestie!! πŸ₯° it's from the User Contributed Perl Documentation, generated with perl v5.38.2 on 2024-08-10. go forth and push text into your scrollers. you're gonna eat. πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from