terminal: strikethrough text (#7507)
#7363 added support for rendering strikethrough text, so now we can handle this case in the terminal. Should close: #7434 Before:  After:  Release Notes: - Fixed rendering strikethrough text inside the terminal #7434
This commit is contained in:
parent
f55aba51ec
commit
6cdd7796c3
1 changed files with 10 additions and 3 deletions
|
@ -4,8 +4,8 @@ use gpui::{
|
||||||
ElementContext, ElementId, FocusHandle, Font, FontStyle, FontWeight, HighlightStyle, Hsla,
|
ElementContext, ElementId, FocusHandle, Font, FontStyle, FontWeight, HighlightStyle, Hsla,
|
||||||
InputHandler, InteractiveBounds, InteractiveElement, InteractiveElementState, Interactivity,
|
InputHandler, InteractiveBounds, InteractiveElement, InteractiveElementState, Interactivity,
|
||||||
IntoElement, LayoutId, Model, ModelContext, ModifiersChangedEvent, MouseButton, MouseMoveEvent,
|
IntoElement, LayoutId, Model, ModelContext, ModifiersChangedEvent, MouseButton, MouseMoveEvent,
|
||||||
Pixels, Point, ShapedLine, StatefulInteractiveElement, Styled, TextRun, TextStyle,
|
Pixels, Point, ShapedLine, StatefulInteractiveElement, StrikethroughStyle, Styled, TextRun,
|
||||||
UnderlineStyle, WeakView, WhiteSpace, WindowContext, WindowTextSystem,
|
TextStyle, UnderlineStyle, WeakView, WhiteSpace, WindowContext, WindowTextSystem,
|
||||||
};
|
};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use language::CursorShape;
|
use language::CursorShape;
|
||||||
|
@ -340,6 +340,13 @@ impl TerminalElement {
|
||||||
wavy: flags.contains(Flags::UNDERCURL),
|
wavy: flags.contains(Flags::UNDERCURL),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let strikethrough = flags
|
||||||
|
.intersects(Flags::STRIKEOUT)
|
||||||
|
.then(|| StrikethroughStyle {
|
||||||
|
color: Some(fg),
|
||||||
|
thickness: Pixels::from(1.0),
|
||||||
|
});
|
||||||
|
|
||||||
let weight = if flags.intersects(Flags::BOLD | Flags::DIM_BOLD) {
|
let weight = if flags.intersects(Flags::BOLD | Flags::DIM_BOLD) {
|
||||||
FontWeight::BOLD
|
FontWeight::BOLD
|
||||||
} else {
|
} else {
|
||||||
|
@ -362,7 +369,7 @@ impl TerminalElement {
|
||||||
..text_style.font()
|
..text_style.font()
|
||||||
},
|
},
|
||||||
underline,
|
underline,
|
||||||
strikethrough: None,
|
strikethrough,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some((style, range)) = hyperlink {
|
if let Some((style, range)) = hyperlink {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue