X-Git-Url: http://git.shiar.net/descalc.git/blobdiff_plain/b2aba05a22d1f4036008c2d12874ddc9eb98edc0..7d9af85556b0e64c70e3641764b7b49a306723f3:/28_undo.pm diff --git a/28_undo.pm b/28_undo.pm new file mode 100644 index 0000000..8a80fc7 --- /dev/null +++ b/28_undo.pm @@ -0,0 +1,22 @@ +# key bindings for DCT, by Shiar + +# 1.10.1 200410150000 - single-level undo from main +# .2 200410150045 - set initial value to prevent crash when no undos set + +use strict; +use warnings; + +my $undo = []; + +push @{$hook{preaction}}, sub { + $undo = [@stack] if $_[0]>=0; # type>=0 for stack-modifying operations +}; # preaction + +$action{undo} = [-1, sub { ($undo, @stack) = ([@stack], @$undo) }]; # undo/redo + +return { + author => "Shiar", + title => "simple undo", + version => "1.10.2", +}; +