diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-10-01 14:32:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-01 12:32:27 +0000 |
| commit | 04df1264ef086bc90e7109fceed0b9b2680040f8 (patch) | |
| tree | a0b55942f9b121279184fba91fb5339518bd264c /crates/typst-ide/src | |
| parent | 9a71e7263df35f06a1057c2bc52ac7fc8f1dff10 (diff) | |
Fix duration formatting precision (#5082)
Diffstat (limited to 'crates/typst-ide/src')
| -rw-r--r-- | crates/typst-ide/src/tooltip.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/typst-ide/src/tooltip.rs b/crates/typst-ide/src/tooltip.rs index 02fb3ec6..532cda39 100644 --- a/crates/typst-ide/src/tooltip.rs +++ b/crates/typst-ide/src/tooltip.rs @@ -8,7 +8,7 @@ use typst::foundations::{repr, Capturer, CastInfo, Repr, Value}; use typst::layout::Length; use typst::model::Document; use typst::syntax::{ast, LinkedNode, Side, Source, SyntaxKind}; -use typst::utils::{round_2, Numeric}; +use typst::utils::{round_with_precision, Numeric}; use typst::World; use crate::{analyze_expr, analyze_labels, plain_docs_sentence, summarize_font_family}; @@ -142,10 +142,10 @@ fn length_tooltip(length: Length) -> Option<Tooltip> { length.em.is_zero().then(|| { Tooltip::Code(eco_format!( "{}pt = {}mm = {}cm = {}in", - round_2(length.abs.to_pt()), - round_2(length.abs.to_mm()), - round_2(length.abs.to_cm()), - round_2(length.abs.to_inches()) + round_with_precision(length.abs.to_pt(), 2), + round_with_precision(length.abs.to_mm(), 2), + round_with_precision(length.abs.to_cm(), 2), + round_with_precision(length.abs.to_inches(), 2), )) }) } |
