3 ## Implements a single undo list for the Sup instance
5 ## The basic idea is to keep a list of lambdas to undo
6 ## things. When an action is called (such as 'archive'),
7 ## a lambda is registered with UndoManager that will
8 ## undo the archival action
17 def register desc, *actions, &b
18 actions = [*actions.flatten]
20 raise ArgumentError, "need at least one action" unless actions.length > 0
21 @@actionlist.push :desc => desc, :actions => actions
25 unless @@actionlist.empty?
26 actionset = @@actionlist.pop
27 actionset[:actions].each { |action| action.call }
28 BufferManager.flash "undid #{actionset[:desc]}"
30 BufferManager.flash "nothing more to undo!"