NAME

Text::Editor::Vip::Selection - Selection Range

SYNOPSIS

use Text::Editor::Vip::Selection
$selection = new Text::Editor::Vip::Selection()

$selection->IsEmpty() ;
...

DESCRIPTION

This class handles the boundaries of a selection and provides helper sub to manipulate the selection.

MEMBER FUNCTIONS

new

Crete a selection object .

Setup

Setup a newly created object. This sub is private and shouldn't be used directely.

Clone

Returns a copy of the object.

IsEmpty

Returns 1 (one) if the selection boundaries are the same.

Retuns 0 (zero) if the object defined a non empty selection.

Clear

Resets, the selection boundaries. The selection will be empty after calling this sub.

Set

Sets the selection boundaries. Four arguments are expected:

  • A start line

  • A start character

  • An end line

  • An end character

SetAnchor

Sets the selection anchor. Two arguments are expected:

  • An anchor line

  • An anchor character

GetAnchor

Returns the anchor position.

SetLine

This sub set the other boundary of a selection. The other booundary being set by SetAnchor.

Two arguments are expected:

  • A line

  • A character

GetLine

Returns the other boundarie of a selection.

GetBoundaries

Returns the boundaries of a selection as a list consisting of

  • selection start line

  • selection start character

  • selection end line

  • selection end character

the selection start line will always be lower or equal to the selection end line. The selection anchoring is handled automatically.

GetStartLine

Gets the selection start line.

GetStartCharacter

Gets the selection start character.

GetEndLine

Gets the selection end line.

GetEndCharacter

Gets the selection end character.

IsCharacterSelected

Given a line and character indexes, this sub returns 'true' if the given character is within the selection boundaries. It otherwise returns 'false'.

IsLineSelected

Given a line index, this sub returns 'true' if the given line is completely selected. It otherwise returns 'false'.

AUTHOR

Khemir Nadim ibn Hamouda
CPAN ID: NKH
mailto:nadim@khemir.net
http:// no web site

COPYRIGHT

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.