NAME
FLTK::TextBuffer -
Description
Functions
append
$buffer->remove( $start, $end )
appendfile
my $status = $textbuffer->appendfile( $file, $bufferlen );
-
Appends the contents of a
$file
to the end of the buffer. Optionally, a second$bufferlen
argument is passed which can limit the amount of data brought in from the$file
.On error, the return value is
2
. Otherwise, the return value is0
.
my $status = $buffer->loadfile( file )
canUndo
my $status = $buffer->insertfle( $file, $position )
character
my $char = $textbuffer->character( $pos );
-
Returns the character at buffer position
$pos
. Positions start at0
.
my $txt = $buffer->text_range( $start, $end )
character_width
my $output = $textbuffer->character_width( $char, $indent, $tabDist, $nullSubsChar );
-
Returns the length in displayed characters of
$char
expanded for display. If the buffer for which the character width is being measured is doing null substitution, <$nullSubsChar> should be passed as that character.Optional parameters include:
my $width = $buffer->count_displayed_characters( $lineStartPos, $targetPos )
copy
$textbuffer->copy( $from_buffer, $from_start, $from_end, $to_pos );
-
Copy the characters between
$from_start
and$from_end
in$from_buffer
, and inserts the string into your object at$to_pos
.
my ($okay, $cursorPosition) = $buffer->undo( )
count_displayed_characters
my $width = $textbuffer->count_displayed_characters( $lineStartPos, $targetPos );
-
Count the number of displayed characters between buffer position
$linestartpos
and$targetpos
. Displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded.
my $width = $buffer->count_displayed_characters_utf( $lineStartPos, $targetPos )
count_displayed_characters_utf
my $width = $textbuffer->count_displayed_characters_utf( $lineStartPos, $targetPos );
-
Count the number of displayed characters between buffer position
$linestartpos
and$targetpos
. Displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded.This method is utf8-aware.
my $width = $buffer->skip_displayed_characters( $startPos, $nChars )
count_lines
my $lines = $textbuffer->count_lines( $startPos, $endPos );
-
Count the number of newlines between
$startPos
and$endPos
in a buffer. The character at position$endPos
is not counted.
my $lines = $buffer->skip_lines( $startPos, $nLines )
expand_character
my $output = $textbuffer->expand_character( $character, $indent, $tabDist, $nullSubsChar );
-
Expand a single character from the text buffer into it's screen representation (which may be several characters for a tab or a control code).
Optional parameters include:
my $output = $buffer->expand_character( $position, $indent )
my $output = $textbuffer->expand_character( $position, $indent );
-
Get a character from the text buffer expanded into it's screen representation (which may be several characters for a tab or a control code).
Optional parameters include:
my $width = $buffer->character_width( $char, $indent, $tabDist, $nullSubsChar )
insert
$buffer->append( $text )
insertfile
my $status = $textbuffer->insertfile( $file, $position, $bufferlen );
-
Inserts the contents of a
$file
at the given$position
. Optionally, a third$bufferlen
argument is passed which can limit the amount of data brought in from the$file
.On error, the return value is
2
. Otherwise, the return value is0
.
my $status = $buffer->appendfile( $file )
length
my $txt = $buffer->text( )
loadfile
my $status = $textbuffer->loadfile( $file, $bufferlen );
-
Loads the contents of a
$file
to fill the buffer (current content is replaced). Optionally, a second$bufferlen
argument is passed which can limit the amount of data brought in from the$file
.On error, the return value is
2
. Otherwise, the return value is0
.
my $status = $buffer->outputfile( $file, $start, $end )
new
my $buffer = $textbuffer->new( $requested_size );
-
Creates an empty text buffer of pre-determined size. Use this to avoid unnecessary re-allocation if you know exactly how much the buffer will need to hold.
Usage
my $buffer = FLTK::TextBuffer->new( $requested_size );
my $buffer_2 = FLTK::TextBuffer->new( 1027 * 256 );
my $buffer_3 = FLTK::TextBuffer->new( );
outputfile
my $status = $textbuffer->outputfile( $file, $start, $end, $bufferlen );
-
Saves the contents of the buffer to a
$file
starting with the data at the$start
position through the$end
. Optionally, a fourth$bufferlen
a rgument is passed which can limit the amount of data written to the$file
.On error, the return value is
2
. Otherwise, the return value is0
.
my $status = $buffer->savefile( $file )
remove
$textbuffer->remove( $start, $end );
-
Deletes the text between
$start
and$end
character positions. Positions are0
(zero) based and the range does not include the character pointed to by$end
.
$buffer->replace( $start, $end, $text )
replace
$textbuffer->replace( $start, $end, $text );
-
Deletes the characters between
$start
and$end
, and inserts the string$text
in their place.
$to_buffer->copy( $from_buffer, $from_start, $from_end, $to_pos )
rewind_lines
my $lines = $textbuffer->rewind_lines( $startPos, $nLines );
-
Finds the position of the first character of the line
$nLines
backwards from$startPos
(not counting the character pointed to by$startPos
if that is a newline).$nlines == 0
means find the beginning of the line.
savefile
my $status = $textbuffer->savefile( $file, $bufferlen );
-
Saves the contents of the buffer to a
$file
. Optionally, a second$bufferlen
argument is passed which can limit the amount of data written to the$file
.On error, the return value is
2
. Otherwise, the return value is0
.
my $output = $buffer->expand_character( $character, $indent, $tabDist, $nullSubsChar )
skip_displayed_characters
my $width = $textbuffer->skip_displayed_characters( $startPos, $nChars );
-
Count forward from buffer position
$startPos
in displayed characters. Displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded.
my $width = $buffer->skip_displayed_characters_utf( $startPos, $nChars )
skip_displayed_characters_utf
my $width = $textbuffer->skip_displayed_characters_utf( $startPos, $nChars );
-
Count forward from buffer position
$startPos
in displayed characters. Displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded.This method is utf8-aware.
my $lines = $buffer->count_lines( $startPos, $endPos )
skip_lines
my $lines = $textbuffer->skip_lines( $startPos, $nLines );
-
Finds the first character of the line
$nLines
forward from$startPos
in a buffer and returns its position.
my $lines = $buffer->rewind_lines( $startPos, $nLines )
text
$buffer->text( $txt )
my $char = $buffer->character( $pos )
text_in_rectangle
my $txt = $textbuffer->text_in_rectangle( $start, $end, $rectStart, $rectEnd );
-
Returns a copy of the text between
$start
and$end
character positions. Positions are0
(zero) based and the range does not include the character pointed to by$end
.
$buffer->insert( $pos, $text )
text_range
my $txt = $textbuffer->text_range( $start, $end );
-
Returns a copy of the text between
$start
and$end
character positions. Positions are0
(zero) based and the range does not include the character pointed to by$end
.
my $txt = $buffer->text_in_rectangle( $start, $end, $rectStart, $rectEnd )
undo
my @return = $textbuffer->undo( );
-
Removes text according to the undo variables or inserts text from the undo buffer.
The return value is a list of integers indicating is the process was successful and the current
$cursorPosition
after this change.
$buffer->canUndo( $flag )
Constructor
Methods
my $length = $buffer->length( )
Author
Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
License and Legal
Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.org>
This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.
When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.
56 POD Errors
The following errors were encountered while parsing the POD:
- Around line 26:
You forgot a '=back' before '=head2'
- Around line 30:
=back without =over
- Around line 49:
You forgot a '=back' before '=head2'
- Around line 53:
=back without =over
- Around line 68:
You forgot a '=back' before '=head2'
- Around line 72:
=back without =over
- Around line 87:
You forgot a '=back' before '=head2'
- Around line 91:
=back without =over
- Around line 127:
You forgot a '=back' before '=head2'
- Around line 131:
=back without =over
- Around line 147:
You forgot a '=back' before '=head2'
- Around line 151:
=back without =over
- Around line 169:
You forgot a '=back' before '=head2'
- Around line 173:
=back without =over
- Around line 193:
You forgot a '=back' before '=head2'
- Around line 197:
=back without =over
- Around line 213:
You forgot a '=back' before '=head2'
- Around line 217:
=back without =over
- Around line 248:
You forgot a '=back' before '=head2'
- Around line 252:
'=item' outside of any '=over'
- Around line 271:
You forgot a '=back' before '=head2'
- Around line 275:
=back without =over
- Around line 290:
You forgot a '=back' before '=head2'
- Around line 294:
=back without =over
- Around line 313:
You forgot a '=back' before '=head2'
- Around line 317:
=back without =over
- Around line 328:
You forgot a '=back' before '=head2'
- Around line 333:
=back without =over
- Around line 352:
You forgot a '=back' before '=head2'
- Around line 356:
=back without =over
- Around line 369:
You forgot a '=back' before '=head2'
- Around line 381:
=back without =over
- Around line 400:
You forgot a '=back' before '=head2'
- Around line 404:
=back without =over
- Around line 421:
You forgot a '=back' before '=head2'
- Around line 425:
=back without =over
- Around line 441:
You forgot a '=back' before '=head2'
- Around line 445:
=back without =over
- Around line 504:
You forgot a '=back' before '=head2'
- Around line 508:
=back without =over
- Around line 525:
You forgot a '=back' before '=head2'
- Around line 529:
=back without =over
- Around line 548:
You forgot a '=back' before '=head2'
- Around line 552:
=back without =over
- Around line 568:
You forgot a '=back' before '=head2'
- Around line 572:
=back without =over
- Around line 583:
You forgot a '=back' before '=head2'
- Around line 587:
'=item' outside of any '=over'
- Around line 595:
You forgot a '=back' before '=head2'
- Around line 599:
=back without =over
- Around line 616:
You forgot a '=back' before '=head2'
- Around line 620:
=back without =over
- Around line 637:
You forgot a '=back' before '=head2'
- Around line 641:
=back without =over
- Around line 660:
You forgot a '=back' before '=head2'
- Around line 664:
=back without =over