diff --git a/src/highlight.rs b/src/highlight.rs index cec8f2d..c827855 100644 --- a/src/highlight.rs +++ b/src/highlight.rs @@ -94,10 +94,11 @@ pub struct LineHighlighter<'a> { cursor_at_end: bool, cursor_style: Style, tab_len: u8, + mask: Option, } impl<'a> LineHighlighter<'a> { - pub fn new(line: &'a str, cursor_style: Style, tab_len: u8) -> Self { + pub fn new(line: &'a str, cursor_style: Style, tab_len: u8, mask: Option) -> Self { Self { line, spans: vec![], @@ -106,6 +107,7 @@ impl<'a> LineHighlighter<'a> { cursor_at_end: false, cursor_style, tab_len, + mask, } } @@ -136,7 +138,7 @@ impl<'a> LineHighlighter<'a> { } } - pub fn into_spans(self, mask: Option) -> Spans<'a> { + pub fn into_spans(self) -> Spans<'a> { let Self { line, mut spans, @@ -145,6 +147,7 @@ impl<'a> LineHighlighter<'a> { style_begin, cursor_style, cursor_at_end, + mask, } = self; if boundaries.is_empty() { diff --git a/src/textarea.rs b/src/textarea.rs index 213ced1..0505a3c 100644 --- a/src/textarea.rs +++ b/src/textarea.rs @@ -1011,7 +1011,7 @@ impl<'a> TextArea<'a> { } pub(crate) fn line_spans<'b>(&'b self, line: &'b str, row: usize, lnum_len: u8) -> Spans<'b> { - let mut hl = LineHighlighter::new(line, self.cursor_style, self.tab_len); + let mut hl = LineHighlighter::new(line, self.cursor_style, self.tab_len, self.mask); if let Some(style) = self.line_number_style { hl.line_number(row, lnum_len, style); @@ -1026,7 +1026,7 @@ impl<'a> TextArea<'a> { hl.search(matches, self.search.style); } - hl.into_spans(self.mask) + hl.into_spans() } /// Build a tui-rs widget to render the current state of the textarea. The widget instance returned from this