class Textbringer::InsertAction

Public Class Methods

new(buffer, location, string) click to toggle source
Calls superclass method Textbringer::UndoableAction::new
# File lib/textbringer/buffer.rb, line 1681
def initialize(buffer, location, string)
  super(buffer, location)
  @string = string
  @copied = false
end

Public Instance Methods

merge(s) click to toggle source
# File lib/textbringer/buffer.rb, line 1697
def merge(s)
  unless @copied
    @string = @string.dup
    @copied = true
  end
  @string.concat(s)
end
redo() click to toggle source
# File lib/textbringer/buffer.rb, line 1692
def redo
  @buffer.goto_char(@location)
  @buffer.insert(@string)
end
undo() click to toggle source
# File lib/textbringer/buffer.rb, line 1687
def undo
  @buffer.goto_char(@location)
  @buffer.delete_region(@location, @location + @string.bytesize)
end