Sha256: 2d52952ff5d5eaa24f990f9343f14aad4ea14fa580809c7eb783adea974c957a

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 Bytes

Contents

module TerminalNotes
    class InfoBar < Widget
        HEIGHT = 3

        def initialize(config: {}, parent:, &block)
            super(parent: parent, title: "", height: HEIGHT,
                  y: (parent.size[:lines] - HEIGHT), border: false)

            @get_context = block
            draw
        end

        def draw
            super do
                context = @get_context.call
                title = "Mode: #{context[:mode].to_s.capitalize}"

                cursor = Cursor.new(x: (@parent.size[:columns] - title.size) / 2,
                                    y: 0)
                @window.move_cursor(cursor)
                @window.draw_string(title)
            end
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terminal-notes-0.0.1 lib/terminal-notes/info_bar.rb