Sha256: 5242b1d827d57f8bb9468049fdb9e791cf36bb5bedc0d08eda7ee3925ba2391e

Contents?: true

Size: 783 Bytes

Versions: 1

Compression:

Stored size: 783 Bytes

Contents

require 'amun/windows/base'
require 'amun/buffer'

module Amun
  module Windows
    # a line that is rendered by default at the end on the screen
    # takes the whole width of screen
    # should be linked to \*messages\* memory buffer and display new messages
    # in the buffer text
    class EchoArea < Base
      def initialize(size)
        super(size)
        @last_messages_size = 0
      end

      def render
        curses_window.erase
        curses_window << message
        curses_window.refresh
        update_last_messages_size
      end

      private

      def message
        Buffer.messages[@last_messages_size..-1].strip.lines.last
      end

      def update_last_messages_size
        @last_messages_size = Buffer.messages.length
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amun-0.2.0 lib/amun/windows/echo_area.rb