NAME

TUI::Drivers::ScreenCharacter - character value type for screen cells

SYNOPSIS

use TUI::Drivers;

my $ch = TScreenCharacter->new(
  text => 'A',
);

my $text = $ch->getText;

DESCRIPTION

TScreenCharacter represents the text stored in a single screen cell.

A cell may contain:

  • A single-byte ASCII or extended ASCII character.

  • A UTF-8 character or character sequence occupying one or two screen columns.

  • A special wide-character trail marker representing the trailing cell of a wide character.

The stored text always contains a visible character, unless the value represents a wide-character trail marker. Zero-width Unicode characters may therefore only appear as part of a character sequence attached to a visible base character.

Wide-character trail markers are internal placeholders used to represent the additional screen cell occupied by a wide character. They do not contribute visible text of their own.

Applications may construct and manipulate TScreenCharacter values directly, but screen text is usually written through the functions provided by TText.

CONSTRUCTOR

new

Creates a new character value.

Construct an empty value:

my $ch = TScreenCharacter->new();

Construct from text:

my $ch = TScreenCharacter->new(
  text => 'A',
);

Construct a wide-character trail placeholder:

my $trail = TScreenCharacter->new(
  text => "\0",
);

METHODS

appendZeroWidthChar

$self->appendZeroWidthChar($text);

Appends a zero-width Unicode character sequence to the stored text.

The resulting value continues to represent a single screen cell and must still contain at least one visible character.

assign

$self->assign($other);

Copies the contents of another TScreenCharacter into the current one.

clone

my $cch = $self->clone();

Returns a new TScreenCharacter object that is a copy of the current one.

getText

my $ch = $self->getText();

Returns the stored text.

isWide

my $bool = $self->isWide();

Returns true if the stored text does not occupy exactly one screen column.

isWideCharTrail

my $bool = $self->isWideCharTrail();

Returns true if the value represents a wide-character trail placeholder.

SEE ALSO

TScreenCell, TColorAttr

AUTHORS

  • magiblot <magiblot@hotmail.com> (original cell char design)

  • J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

COPYRIGHT AND LICENSE

Copyright (c) 2019-2026 the "AUTHORS" listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).