<commit_before>module Zgomot::UI
  WIDTH = 80
  COLOR_GREEN = Curses::COLOR_GREEN
  COLOR_BLACK = Curses::COLOR_BLACK
  COLOR_WHITE = Curses::COLOR_WHITE
  COLOR_YELLOW = Curses::COLOR_YELLOW
  COLOR_CYAN = Curses::COLOR_CYAN
  COLOR_RED = Curses::COLOR_RED
  COLOR_MAGENTA = Curses::COLOR_MAGENTA
  class Window
    class << self
      def init_curses
        Curses.noecho
        Curses.init_screen
        Curses.start_color
        Curses.curs_set(0)
        Curses.init_pair(COLOR_GREEN,COLOR_GREEN,COLOR_BLACK)
        Curses.init_pair(COLOR_WHITE,COLOR_WHITE,COLOR_BLACK)
        Curses.init_pair(COLOR_YELLOW,COLOR_YELLOW,COLOR_BLACK)
        Curses.init_pair(COLOR_CYAN,COLOR_CYAN,COLOR_BLACK)
        Curses.init_pair(COLOR_RED,COLOR_RED,COLOR_BLACK)
        Curses.init_pair(COLOR_MAGENTA,COLOR_MAGENTA,COLOR_BLACK)
      end
      def dash
        init_curses
        win = Curses::Window.new(0, WIDTH, 0, 0)
        str_win = Globals.new(win)
        win.refresh
        loop do
          case win.getch
          #when Curses::Key::UP then ttt.move(0,-1)
          #when Curses::Key::DOWN then ttt.move(0,1)
          when ?q
            win.close
            Curses.close_screen
            break
          end
        end
      end
    end
  end
  class Globals
    HEIGHT = 10
    attr_reader :window
    def initialize(parent_window)
      @window = parent_window.subwin(HEIGHT, WIDTH, 0, 0) 
      TextWithValue.new(window, 'TESTING', 'VALUE', COLOR_GREEN, 20, 0, 0)
      window.refresh
    end
  end
  class Str
    HEIGHT = 16
    attr_reader :window
    TOP = Globals::HEIGHT
    def initialize(parent_window)
      @window = parent_window.subwin(HEIGHT, WIDTH, 0, 0)
    end
  end
  class CC
    HEIGHT = Curses.lines - Globals::HEIGHT - Str::HEIGHT
    TOP = Str::HEIGHT + Globals::HEIGHT
    def initialize(parent_window)
    end
  end
  class TextWithValue
    attr_reader :text, :value, :window, :color
    def initialize(parent_window, text, value, color, width, top, left)
      @color = color
      @window = parent_window.subwin(1, width, top, left)
      @window.attron(Curses.color_pair(color)|Curses::A_NORMAL) {
        @window << "#{text}: #{value}"
      }
    end
    private
      def value=(value)
        @window.clear
        @window.attron(Curses.color_pair(color)|Curses::A_NORMAL) {
          @window << "#{text}: #{value}"
        }
      end
  end
  class TextRow
    attr_reader :windows, :color
    def initialize(parent_window, values, color, top)
      @color = color
      @windows = values.reduce([]) do|ws, v|
                   w = parent_window.subwin(1, WIDTH, top, 0)
                   w.attron(Curses.color_pair(color)|Curses::A_NORMAL) {w << v}
                   ws << w
                 end
    end
    private
      def row=(values)
        @windows.each do |w|
          w.clear
          w.attron(Curses.color_pair(color)|Curses::A_NORMAL) {w << v.shift}
        end
      end
  end
  class Title
    def initialize(parent_window, title)

    end
  end
end

<commit_msg>title and globasl are staring to work<commit_after>module Zgomot::UI
  WIDTH = 80
  COLOR_GREEN = Curses::COLOR_GREEN
  COLOR_BLACK = Curses::COLOR_BLACK
  COLOR_WHITE = Curses::COLOR_WHITE
  COLOR_YELLOW = Curses::COLOR_YELLOW
  COLOR_CYAN = Curses::COLOR_CYAN
  COLOR_RED = Curses::COLOR_RED
  COLOR_MAGENTA = Curses::COLOR_MAGENTA
  def self.set_color(window, color, &blk)
    window.attron(Curses.color_pair(color)|Curses::A_NORMAL, &blk)
  end
  class Window
    class << self
      def init_curses
        Curses.noecho
        Curses.init_screen
        Curses.start_color
        Curses.curs_set(0)
        Curses.init_pair(COLOR_GREEN,COLOR_GREEN,COLOR_BLACK)
        Curses.init_pair(COLOR_WHITE,COLOR_WHITE,COLOR_BLACK)
        Curses.init_pair(COLOR_YELLOW,COLOR_YELLOW,COLOR_BLACK)
        Curses.init_pair(COLOR_CYAN,COLOR_CYAN,COLOR_BLACK)
        Curses.init_pair(COLOR_RED,COLOR_RED,COLOR_BLACK)
        Curses.init_pair(COLOR_MAGENTA,COLOR_MAGENTA,COLOR_BLACK)
      end
      def dash
        init_curses
        win = Curses::Window.new(0, WIDTH, 0, 0)
        str_win = GlobalsWindow.new(win)
        win.refresh
        loop do
          case win.getch
          #when Curses::Key::UP then ttt.move(0,-1)
          #when Curses::Key::DOWN then ttt.move(0,1)
          when ?q
            win.close
            Curses.close_screen
            break
          end
        end
      end
    end
  end
  class GlobalsWindow
    HEIGHT = 4
    attr_reader :window, :title, :input, :output, :clock
    def initialize(parent_window)
      @window = parent_window.subwin(HEIGHT, WIDTH, 0, 0)
      @title = Title.new(window, 'zgomot', COLOR_WHITE, 0, COLOR_MAGENTA)
      @input = TextWithValue.new(window, 'Input', 'VALUE', COLOR_WHITE, 26, 3, 0)
      @output = TextWithValue.new(window, 'Output', 'VALUE', COLOR_WHITE, 26, 3, 26)
      @clock = Text.new(window, '00.0', COLOR_WHITE, 10, 3, WIDTH-10)
      window.refresh
    end
  end
  class StrWindow
    HEIGHT = 16
    attr_reader :window
    TOP = GlobalsWindow::HEIGHT
    def initialize(parent_window)
      @window = parent_window.subwin(HEIGHT, WIDTH, 0, 0)
    end
  end
  class CCWindow
    HEIGHT = Curses.lines - GlobalsWindow::HEIGHT - StrWindow::HEIGHT
    TOP = StrWindow::HEIGHT + GlobalsWindow::HEIGHT
    def initialize(parent_window)
    end
  end
  class Text
    attr_reader :text, :window, :color
    def initialize(parent_window, text, color, width, top, left)
      @color = color
      @window = parent_window.subwin(1, width, top, left)
      Zgomot::UI.set_color(window, color) {window << text}
    end
    def text=(text)
      @window.clear
      Zgomot::UI.set_color(window, color) {window << text}
    end
  end
   class TextWithValue
    attr_reader :text, :value, :window, :color
    def initialize(parent_window, text, value, color, width, top, left)
      @color = color
      @window = parent_window.subwin(1, width, top, left)
      Zgomot::UI.set_color(window, color) {
        @window << "#{text}: #{value}"
      }
    end
    def value=(value)
      @window.clear
      Zgomot::UI.set_color(window, color) {
        @window << "#{text}: #{value}"
      }
    end
  end
  class TextRow
    attr_reader :windows, :color
    def initialize(parent_window, values, color, top)
      @color = color
      @windows = values.reduce([]) do|wins, (v, w)|
                   win = parent_window.subwin(1, w, top, 0)
                   set_color(win. color){win << v}
                   wins << win
                 end
    end
    def row=(values)
      @windows.each do |w|
        w.clear
        w.attron(Curses.color_pair(color)|Curses::A_NORMAL) {w << v.shift}
      end
    end
  end
  class Title
    attr_reader :window, :title, :color
    def initialize(parent_window, text, color, top, text_color = nil)
      text_color ||= color
      @color = color
      @window = parent_window.subwin(3, WIDTH, 0, top)
      Zgomot::UI.set_color(window, color){window.box(?|, ?-)}
      title_len = text.length
      @title = window.subwin(1, title_len, 1, (WIDTH - title_len)/2)
      Zgomot::UI.set_color(title, text_color){title << text}
    end
  end
end


{'fraction_non_alphanumeric': 0.10745065332221296, 'fraction_numerical': 0.009591326105087573, 'mean_word_length': 2.5252327290543852, 'pattern_counts': {'":': 0, '<': 33, '<?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': '6683138', 'n_tokens_mistral': 2621, 'n_tokens_neox': 2531, 'n_words': 518}