<commit_before>require 'curses'

module BlinkenWindow::Shifters

  class TerminalShifter
    include Curses

    attr_reader :maxx, :maxy, :width, :height

    def initialize(maxx, maxy, width=8, height=4)
      @maxx, @maxy, @width, @height = maxx, maxy, width, height
      init_screen
    end

    def push(matrix)
      matrix.size.times do |row|
        matrix[row].size.times do |col|
          window = windows[row][col]
          window.bkgd(matrix[row][col] == 1 ? '@' : ' ')
          window.refresh
        end
      end
    end

    def windows
      @windows ||= (0...maxy).to_a.collect do |row|
        (0...maxx).to_a.collect do |col|
          window = Curses::Window.new(height, width , row * height , col * (width + 1))
          window.box(?|, ?-)
          window
        end
      end
    end
  end

end<commit_msg>Enable input capabilities for terminal shifter<commit_after>require 'curses'

module BlinkenWindow::Shifters

  class TerminalShifter
    include Curses

    attr_reader :maxx, :maxy, :width, :height

    def initialize(maxx, maxy, width=8, height=4)
      @maxx, @maxy, @width, @height = maxx, maxy, width, height
      init_screen
      nonl
      cbreak
      noecho
    end

    def push(matrix)
      matrix.size.times do |row|
        matrix[row].size.times do |col|
          window = windows[row][col]
          window.bkgd(matrix[row][col] == 1 ? '@' : ' ')
          window.refresh
        end
      end
    end

    def windows
      @windows ||= (0...maxy).to_a.collect do |row|
        (0...maxx).to_a.collect do |col|
          window = Curses::Window.new(height, width , row * height , col * (width + 1))
          window.box(?|, ?-)
          window
        end
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.12629161882893225, 'fraction_numerical': 0.006888633754305396, 'mean_word_length': 2.0418848167539267, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2132908', 'n_tokens_mistral': 600, 'n_tokens_neox': 578, 'n_words': 143}