summaryrefslogtreecommitdiff
path: root/src/exec/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-25 01:16:38 +0200
committerLaurenz <laurmaedje@gmail.com>2021-07-25 01:16:38 +0200
commitec5384c97f24c3e6d8284926fd3e415f47fe2b04 (patch)
treeae95815628fd9ae9f765453a6a4b8729b26943ab /src/exec/mod.rs
parentdcfbf95220300a7866b6d03953fb4d29511cd6fa (diff)
State-based monospace handling
Diffstat (limited to 'src/exec/mod.rs')
-rw-r--r--src/exec/mod.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/exec/mod.rs b/src/exec/mod.rs
index d61e0793..76857b44 100644
--- a/src/exec/mod.rs
+++ b/src/exec/mod.rs
@@ -7,7 +7,6 @@ pub use context::*;
pub use state::*;
use std::fmt::Write;
-use std::rc::Rc;
use crate::diag::Pass;
use crate::eco::EcoString;
@@ -75,10 +74,7 @@ impl Exec for RawNode {
ctx.parbreak();
}
- let snapshot = Rc::clone(&ctx.state.font);
- ctx.set_monospace();
- ctx.push_text(&self.text);
- ctx.state.font = snapshot;
+ ctx.push_monospace_text(&self.text);
if self.block {
ctx.parbreak();
@@ -143,14 +139,9 @@ impl Exec for Value {
Value::Str(v) => ctx.push_text(v),
Value::Template(v) => v.exec(ctx),
Value::Error => {}
- other => {
- // For values which can't be shown "naturally", we print
- // the representation in monospace.
- let prev = Rc::clone(&ctx.state.font.families);
- ctx.set_monospace();
- ctx.push_text(pretty(other));
- ctx.state.font_mut().families = prev;
- }
+ // For values which can't be shown "naturally", we print the
+ // representation in monospace.
+ other => ctx.push_monospace_text(pretty(other)),
}
}
}