From cf46f3449458f2ded7f2fc508a1dbea72d48e19a Mon Sep 17 00:00:00 2001 From: supersurviveur Date: Mon, 27 May 2024 22:31:46 +0200 Subject: [PATCH] Fix rendering issue --- src/decorations/decorations.ts | 6 +++++- typst-math-rust/coverage.sh | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/decorations/decorations.ts b/src/decorations/decorations.ts index 8e1c535..37d105e 100644 --- a/src/decorations/decorations.ts +++ b/src/decorations/decorations.ts @@ -119,6 +119,10 @@ export class Decorations { let parsed = getWASM().parse_document(this.activeEditor.document.getText() as string, this.edition_state.edited_range?.start.line || -1, this.edition_state.edited_range?.end.line || -1, this.renderingMode, this.renderOutsideMath, this.renderSpaces, this.blacklistedSymbols, this.customSymbols); + // If edit_end is zero, entire doc was reparsed, remove all symbols + if (parsed.edit_end_line === 0 && parsed.edit_end_column === 0) { + this.edition_state.reload_type = -1; + } // If edited lines aren't defined, we clear all ranges // If they are defined, remove symbols whiwh were rendered again, and trnaslate ones after the edition if (this.edition_state.reload_type < 0) { @@ -150,7 +154,7 @@ export class Decorations { // Remove ones that are in the reparsed range or outside the document let document = this.activeEditor?.document; this.allDecorations[t].ranges = this.allDecorations[t].ranges.filter(range => { - return !strictIntersection(reparsed_range, range.range) && document.lineAt(document.lineCount -1).range.end.isAfterOrEqual(range.range.end); + return !strictIntersection(reparsed_range, range.range) && document.lineAt(document.lineCount - 1).range.end.isAfterOrEqual(range.range.end); }); } } diff --git a/typst-math-rust/coverage.sh b/typst-math-rust/coverage.sh index 8d378cd..609ed12 100755 --- a/typst-math-rust/coverage.sh +++ b/typst-math-rust/coverage.sh @@ -1,15 +1,15 @@ #!/bin/sh # Generate profile files -RUSTFLAGS="-C instrument-coverage" cargo test --tests +RUSTFLAGS="-C instrument-coverage -Z coverage-options=branch" cargo +nightly test --tests cargo profdata -- merge -sparse default_*.profraw -o typst-math.profdata # Get binary names FILES=$( \ for file in \ $( \ - RUSTFLAGS="-C instrument-coverage" \ - cargo test --tests --no-run --message-format=json \ + RUSTFLAGS="-C instrument-coverage -Z coverage-options=branch" \ + cargo +nightly test --tests --no-run --message-format=json \ | jq -r "select(.profile.test == true) | .filenames[]" \ | grep -v dSYM - \ ); \