lib/ruco/text_field.rb in ruco-0.0.5 vs lib/ruco/text_field.rb in ruco-0.0.6
- old
+ new
@@ -1,40 +1,15 @@
module Ruco
- class TextField
+ class TextField < TextArea
def initialize(options)
- @options = options
- @content = ''
- @column = 0
+ super('', options.merge(:lines => 1))
end
- def insert(text)
- @content += text
- move(0, text.size)
- end
-
- def delete(count)
- if count > 0
- @content.slice!(@column, count)
- else
- delete_start = [@column - count.abs, 0].max
- @content[delete_start...@column] = ''
- @column = delete_start
- end
- end
-
def view
- @content
+ super.gsub("\n",'')
end
def value
- @content
- end
-
- def move(line, column)
- @column = [[@column + column, 0].max, @content.size].min
- end
-
- def cursor
- [0, @column]
+ content.gsub("\n",'')
end
end
end
\ No newline at end of file