Skip to content

Commit 36d9d13

Browse files
author
Stephan Dilly
committed
fix theme usage
1 parent fcb474b commit 36d9d13

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/textinput.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,21 @@ impl DrawableComponent for TextInputComponent {
105105
) -> Result<()> {
106106
if self.visible {
107107
let mut txt: Vec<tui::widgets::Text> = Vec::new();
108+
108109
if self.msg.is_empty() {
109110
txt.push(Text::styled(
110111
self.default_msg.as_str(),
111112
self.theme.text(false, false),
112113
));
113114
} else {
115+
let style = self.theme.text(true, false);
116+
114117
// the portion of the text before the cursor is added
115118
// if the cursor is not at the first character
116119
if self.cursor_position > 0 {
117120
txt.push(Text::styled(
118121
&self.msg[..self.cursor_position],
119-
Style::default(),
122+
style,
120123
));
121124
}
122125

@@ -128,7 +131,7 @@ impl DrawableComponent for TextInputComponent {
128131
// a whitespace is used to underline
129132
" "
130133
},
131-
Style::default().modifier(Modifier::UNDERLINED),
134+
style.modifier(Modifier::UNDERLINED),
132135
));
133136

134137
// the final portion of the text is added if there is
@@ -137,7 +140,7 @@ impl DrawableComponent for TextInputComponent {
137140
if pos < self.msg.len() {
138141
txt.push(Text::styled(
139142
&self.msg[pos..],
140-
Style::default(),
143+
style,
141144
));
142145
}
143146
}

0 commit comments

Comments
 (0)