NAME

Text::Editor::Vip::Buffer::DoUndoRedo - non optional plugin for a Text::Editor::Vip::Buffer

DESCRIPTION

The do, undo, redo functionality of Text::Editor::Vip::Buffer is implemented by this package. This package automatically extends a Text::Editor::Vip::Buffer when a Text::Editor::Vip::Buffer instance is created.

This package manipulated the data structures used to implement a do, undo and redo functionality. Text::Editor::Vip uses perl as it building block to implement such functionality. Perl "scripts" are the base for implementing this functionality.

MEMBER FUNCTIONS

IncrementUndoStackLevel

Increments the do and undo prefix for the perl "scripts' used to implement do and undo.

DecrementUndoStackLevel

Decrements the do and undo prefix for the perl "scripts' used to implement do and undo.

PushUndoStep

Adds a do "script" to the do command list and an undo "script" to the undo command list. The scripts are prepended with the prefixes defined by IncrementUndoStackLevel and DecrementUndoStackLevel

Undo

Undoes the commands the commands that have been executed on a buffer.

$buffer->Undo(1) ; # undoes one high level command

GetDoPosition

Gets the current index of the do command list. This index can be later passes to GetUndoScript to get a selected amount of undo commands.

This index can also be used to get a selected amound of do commands to implement a macro facility.

my $start_position = $buffer->GetDoPosition() ;

$buffer->DoLotsOfStuff() ;
$buffer->DoEvenMoreStuff() ;

# get scripts that would undo everything since we got the do position
$undo = $buffer->GetUndoScript($start_position) ;

# get scripts that correspond sto what has been done since we got the do position
$do = $buffer->GetDoScript($start_position) ;

GetUndoScript

This sub is given a start and and end index. those indexes are used to retrieve undo commands.

If not arguments are passed, the start index will be set to zero (first undo command) and the last available undo command. Thus returning a list of all the commands in the undo stack.

See GetDoPosition

GetUndoCommandList

This sub is given a start and and end index. those indexes are used to retrieve undo commands.

If not arguments are passed, the start index will be set to zero (first undo command) and the last available undo command. Thus returning a list of all the commands in the undo stack.

See GetDoPosition

GetDoScript

This sub is given a start and and end index. those indexes are used to retrieve do commands.

If not arguments are passed, the start index will be set to zero (first do command) and the last available do command. Thus returning a list of all the commands in the do stack.

See GetDoPosition

GetDoCommandList

This sub is given a start and and end index. those indexes are used to retrieve do commands.

If not arguments are passed, the start index will be set to zero (first do command) and the last available do command. Thus returning a list of all the commands in the do stack.

See GetDoPosition

Redo

Redoes the commands that have been undone.

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.