From 8b5dab508800c08a11a255280798bd4b245e0818 Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Tue, 23 Jan 2024 17:20:29 -0600 Subject: Disable CBN for now. --- src/commands/discocaml.rs | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/commands/discocaml.rs b/src/commands/discocaml.rs index 712a846..8451d82 100644 --- a/src/commands/discocaml.rs +++ b/src/commands/discocaml.rs @@ -274,7 +274,7 @@ where Ok(()) } DiscocamlResponse::Error(err) => { - let err = anyhow!("got an error from discocaml: `{}`", err); + let err = anyhow!("got an error from discocaml: `{}`", escape_code(&err)); respond_with_error(&err, send).await; Err(err) } @@ -353,8 +353,7 @@ async fn run_dot(dot: &str) -> Result { } fn escape_code(s: &str) -> String { - // TODO - s.to_string() + s.replace("`", "\\`") } fn expr_response_message( @@ -375,24 +374,36 @@ fn expr_response_message( .button(CreateButton::new(format!("discocaml-draw-tree/{}", rowid)).label("Draw Tree")) .button( CreateButton::new(format!("discocaml-step-cbv/{}", rowid)) - .label("Step (CBV)") - .disabled(!expr.has_redex), - ) - .button( - CreateButton::new(format!("discocaml-step-cbn/{}", rowid)) - .label("Step (CBN)") + .label("Step") .disabled(!expr.has_redex), ) .button( CreateButton::new(format!("discocaml-run-cbv/{}", rowid)) - .label("Run (CBV)") - .disabled(!expr.has_redex), - ) - .button( - CreateButton::new(format!("discocaml-run-cbn/{}", rowid)) - .label("Run (CBN)") + .label("Run") .disabled(!expr.has_redex), ) + /* + .button( + CreateButton::new(format!("discocaml-step-cbv/{}", rowid)) + .label("Step (CBV)") + .disabled(!expr.has_redex), + ) + .button( + CreateButton::new(format!("discocaml-step-cbn/{}", rowid)) + .label("Step (CBN)") + .disabled(!expr.has_redex), + ) + .button( + CreateButton::new(format!("discocaml-run-cbv/{}", rowid)) + .label("Run (CBV)") + .disabled(!expr.has_redex), + ) + .button( + CreateButton::new(format!("discocaml-run-cbn/{}", rowid)) + .label("Run (CBN)") + .disabled(!expr.has_redex), + ) + */ } pub async fn handle_command( -- cgit v1.2.3