diff --git a/src/app/clipboard.rs b/src/app/clipboard.rs index 62bcee9..7dbab49 100644 --- a/src/app/clipboard.rs +++ b/src/app/clipboard.rs @@ -353,7 +353,7 @@ fn copy_paste_y_locked_var() { } #[test] -fn issue_47() { +fn copy_paste_var_in_function() { let mut app = App::new(); app.grid.set_cell("A0", 4.to_string()); Mode::process_key(&mut app, 'j'); diff --git a/src/app/logic/cell.rs b/src/app/logic/cell.rs index ff10cbb..ecc2af5 100644 --- a/src/app/logic/cell.rs +++ b/src/app/logic/cell.rs @@ -63,7 +63,7 @@ impl CellType { CellType::Equation(eq) => { // Populate the context let ctx = ExtractionContext::new(); - let _ = eval_with_context(eq, &ctx); + let _ = eval_with_context(&eq[1..], &ctx); let mut equation = eq.clone(); // translate standard vars A0 -> A1 diff --git a/src/app/logic/ctx.rs b/src/app/logic/ctx.rs index df4c927..b41c773 100644 --- a/src/app/logic/ctx.rs +++ b/src/app/logic/ctx.rs @@ -276,11 +276,19 @@ impl ExtractionContext { } } pub fn dump_vars(&self) -> Vec { - if let Ok(r) = self.var_registry.read() { r.clone() } else { Vec::new() } + if let Ok(r) = self.var_registry.read() { + r.clone() + } else { + Vec::new() + } } #[allow(dead_code)] pub fn dump_fns(&self) -> Vec { - if let Ok(r) = self.fn_registry.read() { r.clone() } else { Vec::new() } + if let Ok(r) = self.fn_registry.read() { + r.clone() + } else { + Vec::new() + } } } @@ -308,8 +316,7 @@ impl Context for ExtractionContext { } else { panic!("The RwLock should always be write-able") } - // Ok(Value::Int(1)) - unimplemented!("Extracting function identifier not implemented yet") + Ok(Value::Int(1)) } fn are_builtin_functions_disabled(&self) -> bool {