Sha256: 02d842f6e1d9960f0eaed69c22b0cc7ea8c7ead9a3491d0c3535726810f58d9a
Contents?: true
Size: 941 Bytes
Versions: 3
Compression:
Stored size: 941 Bytes
Contents
module Ruco class Editor attr_reader :file delegate :view, :selection, :text_in_selection, :color_mask, :selecting, :move, :cursor, :resize, :delete_line, :to => :text_area def initialize(file, options) @file = file content = (File.exist?(@file) ? File.read(@file) : '') @text_area = TextArea.new(content, options) @modified = false end def find(text) index = text_area.content.index(text, text_area.cursor_index+1) || text_area.cursor_index move :to, *text_area.position_for_index(index) end def reset;end def insert(text) @modified = true text_area.insert(text) end def delete(*args) text_area.delete(*args) @modified = true end def modified? @modified end def save File.open(@file,'w'){|f| f.write(text_area.content) } @modified = false end private attr_reader :text_area end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruco-0.0.25 | lib/ruco/editor.rb |
ruco-0.0.24 | lib/ruco/editor.rb |
ruco-0.0.23 | lib/ruco/editor.rb |