summaryrefslogtreecommitdiff
path: root/src/library/spacing.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-07-29 18:09:51 +0200
committerLaurenz <laurmaedje@gmail.com>2020-07-29 18:09:51 +0200
commitbbcdeb128cce04cd95714b7bc7af5a23a7e38bd2 (patch)
treee0a1620d335982669cd7671cbd71df46d100e9ea /src/library/spacing.rs
parentf34ba3dcda182d9b9c14cc94fdb48810bf18bef0 (diff)
Move, rename and switch some things (boring) 🚚
- Problems -> Diagnostics - Position -> Pos - offset_spans -> Offset trait - Size -> Length (and some more size types renamed) - Paper into its own module - scope::Parser -> parsing::CallParser - Create `Decorations` alias - Remove lots of double newlines - Switch from f32 to f64
Diffstat (limited to 'src/library/spacing.rs')
-rw-r--r--src/library/spacing.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/library/spacing.rs b/src/library/spacing.rs
index adca20af..5ae25a92 100644
--- a/src/library/spacing.rs
+++ b/src/library/spacing.rs
@@ -1,10 +1,9 @@
-use crate::size::FSize;
+use crate::length::ScaleLength;
use crate::layout::SpacingKind;
use super::*;
use self::ContentKind::*;
-
function! {
/// `line.break`, `n`: Ends the current line.
#[derive(Debug, Default, Clone, PartialEq)]
@@ -41,7 +40,7 @@ function! {
pub struct ContentSpacingFunc {
body: Option<SyntaxModel>,
content: ContentKind,
- spacing: Option<f32>,
+ spacing: Option<f64>,
}
type Meta = ContentKind;
@@ -50,9 +49,9 @@ function! {
ContentSpacingFunc {
body: body!(opt: body, state, f),
content: meta,
- spacing: header.args.pos.get::<f64>(&mut f.problems)
- .map(|num| num as f32)
- .or_missing(&mut f.problems, header.name.span, "spacing"),
+ spacing: header.args.pos.get::<f64>(&mut f.diagnostics)
+ .map(|num| num as f64)
+ .or_missing(&mut f.diagnostics, header.name.span, "spacing"),
}
}
@@ -79,7 +78,7 @@ function! {
/// `spacing`, `h`, `v`: Adds spacing along an axis.
#[derive(Debug, Clone, PartialEq)]
pub struct SpacingFunc {
- spacing: Option<(AxisKey, FSize)>,
+ spacing: Option<(AxisKey, ScaleLength)>,
}
type Meta = Option<SpecificAxis>;
@@ -88,11 +87,11 @@ function! {
body!(nope: body, f);
SpacingFunc {
spacing: if let Some(axis) = meta {
- header.args.pos.get::<FSize>(&mut f.problems)
+ header.args.pos.get::<ScaleLength>(&mut f.diagnostics)
.map(|s| (AxisKey::Specific(axis), s))
} else {
- header.args.key.get_with_key::<AxisKey, FSize>(&mut f.problems)
- }.or_missing(&mut f.problems, header.name.span, "spacing"),
+ header.args.key.get_with_key::<AxisKey, ScaleLength>(&mut f.diagnostics)
+ }.or_missing(&mut f.diagnostics, header.name.span, "spacing"),
}
}