Padre::Wx::Editor - Padre document editor object
Padre::Wx::Editor implements the Scintilla-based document editor for Padre. It implements the majority of functionality relating to visualisation and navigation of documents.
Look at a given position in the editor if there is a brace (according to the setting editor_braces) before or after, and return the information about the context It always look first at the character after the position.
Params: pos - the cursor position in the editor [defaults to cursor position) : int Return: undef if no brace, otherwise [brace, actual_pos, is_after, is_opening] where: brace - the brace char at actual_pos actual_pos - the actual position where the brace has been found is_after - true iff the brace is after the cursor : boolean is_opening - true iff only the brace is an opening one Examples: |{} => should find the { : [0,{,1,1] {|} => should find the } : [1,},1,0] {| } => should find the { : [0,{,0,1]
Tell if a character is a brace, and if it is an opening or a closing one
Params: char - a character : string Return: int : 0 if this is not a brace, an odd value if it is an opening brace and an even one for a closing brace
Find the position of to the matching brace if any. If the cursor is inside the braces the destination will be inside too, same it is outside.
Params: pos - the cursor position in the editor [defaults to cursor position) : int Return: matching_pos - the matching position, or undef if none
Move the cursor to the matching brace if any. If the cursor is inside the braces the destination will be inside too, same it is outside.
Params: pos - the cursor position in the editor [defaults to cursor position) : int
Select to the matching opening or closing brace. If the cursor is inside the braces the destination will be inside too, same it is outside.
my $line_number = $editor->find_line( 123, "sub foo {" );
The find_line method locates a line in a document using a line number and the content of the line.
find_line
It is intended for use in situations where a search function has determined that a particular line is of interest, but the document may have changed in the time since the original search was made.
Starting at the suggested line, it will locate the line containing the text which is the closest to line provided. If no text is provided the method acts as a simple pass-through.
Returns an integer line number guaranteed to exist in the document, or undef if the hint text could not be found anywhere in the document.
undef
my $position = $editor->position($untrusted);
The position method is used to clean parameters that are supposed to refer to a position within the editor. It takes what should be an numeric document position, constrains the value to the actual position range of the document, and removes any fractional characters.
position
This method should generally be used when doing something to a document somewhere in it preferable aborting that functionality completely.
Returns an integer character position guaranteed to exist in the document.
my $line = $editor->line($untrusted);
The line method is used to clean parameters that are supposed to refer to a line within the editor. It takes what should be an numeric document line, constrains the value to the actual line range of the document, and removes any fractional characters.
line
Returns an integer line number guaranteed to exist in the document.
my $chars = Padre::Wx::Editor->clipboard_length;
The clipboard_length method returns the number of characters of text currently in the clipboard, if any.
clipboard_length
Returns an integer number of characters, or zero if the clipboard is empty or contains non-text data.
Copyright 2008-2013 The Padre development team as listed in Padre.pm.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install Padre, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Padre
CPAN shell
perl -MCPAN -e shell install Padre
For more information on module installation, please visit the detailed CPAN module installation guide.