From 6319cc3927f341ae4d968f9d35295e4b67a75ee6 Mon Sep 17 00:00:00 2001 From: mgt Date: Sat, 19 Aug 2023 12:14:33 +0800 Subject: [PATCH] enable partial rendering --- src/main.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 701e0930..b640a25b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,11 +2,13 @@ mod actor; mod args; use clap::Parser; +use futures::SinkExt; use hyper::http::Error; use hyper::service::{make_service_fn, service_fn}; use log::{error, info}; use serde::{Deserialize, Serialize}; +use tokio_tungstenite::tungstenite::Message; use std::collections::HashMap; use typst::geom::Point; @@ -135,7 +137,7 @@ async fn main() { let arguments = CliArguments::parse(); info!("Arguments: {:#?}", arguments); let command = CompileSettings::with_arguments(arguments.clone()); - let _enable_partial_rendering = arguments.enable_partial_rendering; + let enable_partial_rendering = arguments.enable_partial_rendering; let entry = if command.input.is_absolute() { command.input.clone() } else { @@ -213,7 +215,12 @@ async fn main() { let src_to_doc_rx = src_to_doc_jump.0.subscribe(); let world_tx = world_tx.clone(); let doc_watch_rx = doc_watch_rx.clone(); - let conn = accept_connection(stream).await; + let mut conn = accept_connection(stream).await; + if enable_partial_rendering { + conn.send(Message::Binary("partial-rendering,true".into())) + .await + .unwrap(); + } let actor::webview::Channels { svg, render_full } = actor::webview::WebviewActor::set_up_channels(); let render_tx = render_full.0.clone();