Padre::Wx::Editor(3) Padre document editor object

DESCRIPTION

Padre::Wx::Editor implements the Scintilla-based document editor for Padre. It implements the majority of functionality relating to visualisation and navigation of documents.

METHODS

get_brace_info

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]

get_brace_type

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_matching_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

goto_matching_brace

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_matching_brace

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.

        Params:
                pos - the cursor position in the editor [defaults to cursor position) : int

find_line

  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.

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.

position

  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.

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.

line

  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.

This method should generally be used when doing something to a document somewhere in it preferable aborting that functionality completely.

Returns an integer line number guaranteed to exist in the document.

clipboard_length

  my $chars = Padre::Wx::Editor->clipboard_length;

The "clipboard_length" method returns the number of characters of text currently in the clipboard, if any.

Returns an integer number of characters, or zero if the clipboard is empty or contains non-text data.

COPYRIGHT & LICENSE

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.