NAME
TCellChar - character value type for screen cells
SYNOPSIS
use TUI::Drivers;
my $ch = TCellChar->new(
text => 'A',
);
my $text = $ch->getText;
DESCRIPTION
TCellChar 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 TCellChar 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 = TCellChar->new();
Construct from text:
my $ch = TCellChar->new(
text => 'A',
);
Construct a wide-character trail placeholder:
my $trail = TCellChar->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.
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.
moveChar
$self->moveChar($ch);
Replaces the stored text with a single-byte character.
moveMultiByteChar
$self->moveMultiByteChar($text);
Replaces the stored text with a UTF-8 character or character sequence.
The resulting value may occupy one or two screen columns.
moveWideCharTrail
$self->moveWideCharTrail();
Replaces the stored text with a special wide-character trail marker.
This value is used internally as the trailing cell occupied by a wide character.
size
my $bytes = $self->size();
Returns the length of the stored text.
SEE ALSO
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).