added the fields for drawing the hyperlinks

This commit is contained in:
Mikayla Maki 2022-09-22 23:04:49 -07:00
parent 5cd56584b4
commit 0584b2f5f0
2 changed files with 45 additions and 14 deletions

View file

@ -237,7 +237,7 @@ impl TerminalElement {
//Layout current cell text
{
let cell_text = &cell.c.to_string();
if cell_text != " " {
if !is_blank(&cell) {
let cell_style = TerminalElement::cell_style(
&cell,
fg,
@ -257,8 +257,8 @@ impl TerminalElement {
Point::new(line_index as i32, cell.point.column.0 as i32),
layout_cell,
))
}
};
};
}
}
if cur_rect.is_some() {
@ -308,7 +308,7 @@ impl TerminalElement {
let flags = indexed.cell.flags;
let fg = convert_color(&fg, &style.colors, modal);
let underline = flags
let mut underline = flags
.intersects(Flags::ALL_UNDERLINES)
.then(|| Underline {
color: Some(fg),
@ -317,6 +317,13 @@ impl TerminalElement {
})
.unwrap_or_default();
if indexed.cell.hyperlink().is_some() {
underline.squiggly = true;
if underline.thickness == OrderedFloat(0.) {
underline.thickness = OrderedFloat(1.);
}
}
let mut properties = Properties::new();
if indexed
.flags
@ -569,6 +576,7 @@ impl Element for TerminalElement {
cursor_char,
selection,
cursor,
last_hovered_hyperlink,
..
} = &terminal_handle.read(cx).last_content;
@ -824,6 +832,29 @@ impl Element for TerminalElement {
}
}
fn is_blank(cell: &IndexedCell) -> bool {
if cell.c != ' ' {
return false;
}
if cell.bg != AnsiColor::Named(NamedColor::Background) {
return false;
}
if cell.hyperlink().is_some() {
return false;
}
if cell
.flags
.intersects(Flags::ALL_UNDERLINES | Flags::INVERSE | Flags::STRIKEOUT)
{
return false;
}
return true;
}
fn to_highlighted_range_lines(
range: &RangeInclusive<Point>,
layout: &LayoutState,