From 36d9d13df4ade300aa97525cc0ffa1d199f264df Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Sun, 14 Jun 2020 10:19:36 +0200 Subject: [PATCH] fix theme usage --- src/components/textinput.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/textinput.rs b/src/components/textinput.rs index ff1cfade..01f992d8 100644 --- a/src/components/textinput.rs +++ b/src/components/textinput.rs @@ -105,18 +105,21 @@ impl DrawableComponent for TextInputComponent { ) -> Result<()> { if self.visible { let mut txt: Vec = Vec::new(); + if self.msg.is_empty() { txt.push(Text::styled( self.default_msg.as_str(), self.theme.text(false, false), )); } else { + let style = self.theme.text(true, false); + // the portion of the text before the cursor is added // if the cursor is not at the first character if self.cursor_position > 0 { txt.push(Text::styled( &self.msg[..self.cursor_position], - Style::default(), + style, )); } @@ -128,7 +131,7 @@ impl DrawableComponent for TextInputComponent { // a whitespace is used to underline " " }, - Style::default().modifier(Modifier::UNDERLINED), + style.modifier(Modifier::UNDERLINED), )); // the final portion of the text is added if there is @@ -137,7 +140,7 @@ impl DrawableComponent for TextInputComponent { if pos < self.msg.len() { txt.push(Text::styled( &self.msg[pos..], - Style::default(), + style, )); } }