summaryrefslogtreecommitdiff
path: root/library/src/text/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-12 23:25:54 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-12 23:46:26 +0100
commitbf59c08a0a601eeac4354c505cab15e65601c8e8 (patch)
tree2ba3230c77960acf5d55ee34065a5028d1c45d5d /library/src/text/mod.rs
parentd9ce194fe71076314955dd25896f64d48bccd6e5 (diff)
New interaction model
Diffstat (limited to 'library/src/text/mod.rs')
-rw-r--r--library/src/text/mod.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/library/src/text/mod.rs b/library/src/text/mod.rs
index c2a67547..8484ff57 100644
--- a/library/src/text/mod.rs
+++ b/library/src/text/mod.rs
@@ -410,20 +410,26 @@ impl Fold for FontFeatures {
#[derive(Debug, Clone, Hash)]
pub struct SpaceNode;
-#[node]
+#[node(Behave)]
impl SpaceNode {
fn construct(_: &mut Vm, _: &mut Args) -> SourceResult<Content> {
Ok(Self.pack())
}
}
+impl Behave for SpaceNode {
+ fn behaviour(&self) -> Behaviour {
+ Behaviour::Weak(2)
+ }
+}
+
/// A line break.
#[derive(Debug, Clone, Hash)]
pub struct LinebreakNode {
pub justify: bool,
}
-#[node]
+#[node(Behave)]
impl LinebreakNode {
fn construct(_: &mut Vm, args: &mut Args) -> SourceResult<Content> {
let justify = args.named("justify")?.unwrap_or(false);
@@ -431,6 +437,12 @@ impl LinebreakNode {
}
}
+impl Behave for LinebreakNode {
+ fn behaviour(&self) -> Behaviour {
+ Behaviour::Destructive
+ }
+}
+
/// A smart quote.
#[derive(Debug, Clone, Hash)]
pub struct SmartQuoteNode {