Module: StdCmd::Undo

Defined in:
lib/command-set/standard-commands.rb

Constant Summary collapse

@@set =
nil

Class Method Summary collapse

Class Method Details

.define_commandsObject



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/command-set/standard-commands.rb', line 95

def self.define_commands
  return @@set ||= Command::CommandSet.define_commands do
    mode_command("undo") do
      doesnt_undo
      action do
        command=subject.undo_stack.get_undo
        command.undo
      end

      subject_methods :undo_stack

      document <<-EOH
    Undoes the most recently used command, if possible.
    EOH
    end

    mode_command("redo") do
      doesnt_undo
      action do
        command=subject.undo_stack.get_redo
        command.execute
      end

      document <<-EOH
    Redoes the most recently used command, if possible.
    EOH
    end
  end  
end