Sha256: 55d26749724a826a799abf18161a43e1053433ed6bdfd0aa2bfa62392b9c43d0
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module Ruco class Editor attr_reader :file attr_reader :text_area private :text_area delegate :view, :selection, :text_in_selection, :color_mask, :selecting, :move, :cursor, :resize, :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) return unless start = text_area.content.index(text, text_area.index_for_position+1) finish = start + text.size move(:to_index, finish) selecting{ move(:to_index, start) } end def reset;end def insert(text) text_area.insert(text) @modified = true end def delete(*args) text_area.delete(*args) @modified = true end def delete_line(*args) text_area.delete_line(*args) @modified = true end def modified? @modified end def save File.open(@file,'w'){|f| f.write(text_area.content) } @modified = false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruco-0.0.26 | lib/ruco/editor.rb |