diff options
Diffstat (limited to 'src/lisp')
-rw-r--r-- | src/lisp/eval.rs | 2 | ||||
-rw-r--r-- | src/lisp/expr.rs | 2 | ||||
-rw-r--r-- | src/lisp/prelude.rs | 13 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/lisp/eval.rs b/src/lisp/eval.rs index 6ffff23..f7f918a 100644 --- a/src/lisp/eval.rs +++ b/src/lisp/eval.rs | |||
@@ -4,7 +4,7 @@ use crate::{ | |||
4 | error::{EvalError, LispError}, | 4 | error::{EvalError, LispError}, |
5 | expr::{Arity, Ident, LispExpr, LispFunction}, | 5 | expr::{Arity, Ident, LispExpr, LispFunction}, |
6 | number::LispNumber, | 6 | number::LispNumber, |
7 | EnvList, Environment, | 7 | Environment, |
8 | }, | 8 | }, |
9 | }; | 9 | }; |
10 | 10 | ||
diff --git a/src/lisp/expr.rs b/src/lisp/expr.rs index 9ef9f65..8fd794e 100644 --- a/src/lisp/expr.rs +++ b/src/lisp/expr.rs | |||
@@ -5,7 +5,7 @@ use crate::lisp::{ | |||
5 | error::{EvalError, LispError}, | 5 | error::{EvalError, LispError}, |
6 | eval::lookup_extended, | 6 | eval::lookup_extended, |
7 | number::LispNumber, | 7 | number::LispNumber, |
8 | EnvList, Environment, | 8 | EnvList, |
9 | }; | 9 | }; |
10 | 10 | ||
11 | #[derive(Debug, Copy, PartialEq, Clone)] | 11 | #[derive(Debug, Copy, PartialEq, Clone)] |
diff --git a/src/lisp/prelude.rs b/src/lisp/prelude.rs index d2a6ae6..bdaf639 100644 --- a/src/lisp/prelude.rs +++ b/src/lisp/prelude.rs | |||
@@ -9,7 +9,7 @@ use crate::{ | |||
9 | primitive, | 9 | primitive, |
10 | }; | 10 | }; |
11 | 11 | ||
12 | use std::{convert::TryInto, fs::File, io::Write, path::PathBuf}; | 12 | use std::{convert::TryInto, fs::File, io::Write}; |
13 | 13 | ||
14 | use log::info; | 14 | use log::info; |
15 | 15 | ||
@@ -196,13 +196,18 @@ pub fn new_env() -> Environment { | |||
196 | 196 | ||
197 | primitive!(env, Arity::Atmost(1), "brush", |args, app| { | 197 | primitive!(env, Arity::Atmost(1), "brush", |args, app| { |
198 | info!("brush {}", &args[0]); | 198 | info!("brush {}", &args[0]); |
199 | let old_size = if matches!(app.brush, Brush::Line { .. } | Brush::Circle { .. }) { | ||
200 | app.brush.size().unwrap() | ||
201 | } else { | ||
202 | 0 | ||
203 | }; | ||
199 | if let [LispExpr::Quote(kind, _)] = args { | 204 | if let [LispExpr::Quote(kind, _)] = args { |
200 | if is_ident(kind) { | 205 | if is_ident(kind) { |
201 | match (&**kind).as_ref() { | 206 | match (&**kind).as_ref() { |
202 | "fill" => app.brush = Brush::Fill, | 207 | "fill" => app.brush = Brush::Fill, |
203 | "circle" => app.brush = Brush::new(), | 208 | "circle" => app.brush = Brush::new(old_size), |
204 | "line" => app.brush = Brush::line(0, false), | 209 | "line" => app.brush = Brush::line(old_size, false), |
205 | "line-extend" => app.brush = Brush::line(0, true), | 210 | "line-extend" => app.brush = Brush::line(old_size, true), |
206 | _ => return Err(EvalError::CustomInternal("unknown brush type").into()), | 211 | _ => return Err(EvalError::CustomInternal("unknown brush type").into()), |
207 | } | 212 | } |
208 | } | 213 | } |