From a04191ecc9138aa1b1a7cfdba0971af3e50ace8d Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Fri, 28 Jul 2017 11:49:00 +0000 Subject: [PATCH] Implement attributes for Curses::React::Nodes::TextLine --- lib/curses/react/nodes/text_line.rb | 2 ++ lib/style.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/curses/react/nodes/text_line.rb b/lib/curses/react/nodes/text_line.rb index 6471108..364eefb 100644 --- a/lib/curses/react/nodes/text_line.rb +++ b/lib/curses/react/nodes/text_line.rb @@ -17,8 +17,10 @@ module Curses def draw return if props[:text].nil? + @window.attron props[:attr] if props[:attr] setpos props[:x], props[:y] addstr props[:text].ljustetc props[:width] + @window.attroff props[:attr] if props[:attr] end def setpos(x, y) diff --git a/lib/style.rb b/lib/style.rb index 7ce4da0..e34cdc2 100644 --- a/lib/style.rb +++ b/lib/style.rb @@ -127,8 +127,6 @@ class Style window.attroff message_error_attr end -private - def logo_attr Curses.color_pair(logo_id) | Curses::A_BOLD end @@ -185,6 +183,8 @@ private Curses.color_pair message_error_id end +private + def logo_id @logo_id ||= self.class.counter end