release 1.12.1
[descalc.git] / 28_undo.pm
1 # key bindings for DCT, by Shiar
2
3 # 1.10.1 200410150045 - set initial value to prevent crash when no undos set
4 # 1.10.0 200410150000 - single-level undo from main
5
6 use strict;
7 use warnings;
8
9 my $undo = [];
10
11 push @{$hook{preaction}}, sub {
12         $undo = [@stack] if $_[0]>=0;  # type>=0 for stack-modifying operations
13 }; # preaction
14
15 $action{undo}  = [-1, sub { ($undo, @stack) = ([@stack], @$undo) }]; # undo/redo
16
17 return {
18         author  => "Shiar",
19         title   => "simple undo",
20         version => "1.10.1",
21 };
22