Commit 5683a2e7a8

5683a2e7a897c9f2585f1f5f22c0fb567f019d68

parent: afe892c7fe

Unregistered key

Ulyssa <git@ulyssa.dev> · 2023-01-26 01:03 UTC

Blank lines in table cells of selected message should be highlighted (#23)

Layout: unified · split

src/message/html.rs +1 −1
@@ -198,7 +198,7 @@ impl Table {
198 }) 198 })
199 .collect(); 199 .collect();
200 200
201 let joined = join_cell_text(cells, Span::styled(line::VERTICAL, style)); 201 let joined = join_cell_text(cells, Span::styled(line::VERTICAL, style), style);
202 text.lines.extend(joined.lines); 202 text.lines.extend(joined.lines);
203 203
204 nrows += 1; 204 nrows += 1;
src/util.rs +2 −2
@@ -125,7 +125,7 @@ pub fn space_text(width: usize, style: Style) -> Text<'static> {
125 space_span(width, style).into() 125 space_span(width, style).into()
126} 126}
127 127
128pub fn join_cell_text<'a>(texts: Vec<(Text<'a>, usize)>, join: Span<'a>) -> Text<'a> { 128pub fn join_cell_text<'a>(texts: Vec<(Text<'a>, usize)>, join: Span<'a>, style: Style) -> Text<'a> {
129 let height = texts.iter().map(|t| t.0.height()).max().unwrap_or(0); 129 let height = texts.iter().map(|t| t.0.height()).max().unwrap_or(0);
130 let mut text = Text { lines: vec![Spans(vec![join.clone()]); height] }; 130 let mut text = Text { lines: vec![Spans(vec![join.clone()]); height] };
131 131
@@ -134,7 +134,7 @@ pub fn join_cell_text<'a>(texts: Vec<(Text<'a>, usize)>, join: Span<'a>) -> Text
134 if let Some(spans) = t.lines.get_mut(i) { 134 if let Some(spans) = t.lines.get_mut(i) {
135 text.lines[i].0.append(&mut spans.0); 135 text.lines[i].0.append(&mut spans.0);
136 } else { 136 } else {
137 text.lines[i].0.push(space_span(w, Style::default())); 137 text.lines[i].0.push(space_span(w, style));
138 } 138 }
139 139
140 text.lines[i].0.push(join.clone()); 140 text.lines[i].0.push(join.clone());