diff --git a/schala-repl/src/repl/response.rs b/schala-repl/src/repl/response.rs index d48fc02..b5423fc 100644 --- a/schala-repl/src/repl/response.rs +++ b/schala-repl/src/repl/response.rs @@ -1,5 +1,6 @@ use colored::*; use std::fmt; +use std::fmt::Write; use super::ReplOptions; use crate::language::{ DebugAsk, ComputationResponse}; @@ -12,10 +13,15 @@ pub struct ReplResponse { impl fmt::Display for ReplResponse { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut buf = String::new(); if let Some(ref label) = self.label { - write!(f, "({})", label).unwrap(); + write!(buf, "({})", label).unwrap(); } - write!(f, "=> {}", self.text) + write!(buf, "=> {}", self.text).unwrap(); + write!(f, "{}", match self.color { + Some(c) => buf.color(c), + None => buf.normal() + }) } }