hover style change

This commit is contained in:
Dongdong Zhou 2022-09-28 22:04:20 +01:00
parent cdc6abbade
commit 8f1243ceef
2 changed files with 6 additions and 7 deletions

View File

@ -172,6 +172,7 @@ fn collect_diagnostics(
// Build up the text for all the diagnostics
let mut content = RichTextBuilder::new();
content.set_line_height(1.5);
for diagnostic in diagnostics {
content.push(&diagnostic.message);

View File

@ -328,8 +328,7 @@ fn layout(
let diagnostic_text_metrics =
self.active_diagnostic_layout.layout_metrics();
diagnostic_text_metrics.size.height
+ data.config.editor.line_height() as f64 * 1.5
diagnostic_text_metrics.size.height + Hover::STARTING_Y * 3.0
};
Size::new(
@ -348,7 +347,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
let line_height = data.config.editor.line_height() as f64;
let rect = ctx.region().bounding_box();
let mut diagnostic_origin = Point::new(Self::STARTING_X, Self::STARTING_Y);
let diagnostic_origin = Point::new(Self::STARTING_X, Self::STARTING_Y);
ctx.fill(
rect,
@ -360,14 +359,13 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
let height = if self.active_diagnostic_layout.size().is_empty() {
0.0
} else {
diagnostic_origin.y += line_height * 0.5;
let diagnostic_text_metrics =
self.active_diagnostic_layout.layout_metrics();
let line = {
let x0 = rect.x0 + side_margin;
let y = diagnostic_text_metrics.size.height + line_height * 1.5;
let y =
diagnostic_text_metrics.size.height + Hover::STARTING_Y * 3.0;
let x1 = rect.x1 - side_margin;
Line::new(Point::new(x0, y), Point::new(x1, y))
};
@ -380,7 +378,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
self.active_diagnostic_layout.draw(ctx, diagnostic_origin);
diagnostic_text_metrics.size.height + line_height
diagnostic_text_metrics.size.height + Hover::STARTING_Y * 3.0
};
let doc_origin = diagnostic_origin + (0.0, height);