Sha256: 646daf1ccd175f8e972902221985519798db8693683be30043367199a601f047
Contents?: true
Size: 859 Bytes
Versions: 4
Compression:
Stored size: 859 Bytes
Contents
# -*- coding: utf-8 -*- module RubyAnything class TextWindow < BaseWindow attr_accessor :items_window def initialize(parent, opt = {}) super(parent, opt) end def text @text ||= Text.new end def update; draw_at! 0 end def view_collection; [ text.to_s ] end def on_input(ch) # require 'logger' # @logger ||= Logger.new('/tmp/ch.txt') # @logger.info ch case ch when *KEYS[:left] left when *KEYS[:right] right when *KEYS[:backspace] backspace when String insert ch end end def backspace cursor.left text.delete cursor.x @parent.filter text.to_s update end def insert(ch) text.insert cursor.x, ch cursor.right @parent.filter text.to_s update end end end
Version data entries
4 entries across 4 versions & 1 rubygems