fix #47
All checks were successful
Test Rust project / test (ubuntu-latest, stable) (push) Successful in 43s
All checks were successful
Test Rust project / test (ubuntu-latest, stable) (push) Successful in 43s
This commit is contained in:
@@ -353,7 +353,7 @@ fn copy_paste_y_locked_var() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn issue_47() {
|
fn copy_paste_var_in_function() {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
app.grid.set_cell("A0", 4.to_string());
|
app.grid.set_cell("A0", 4.to_string());
|
||||||
Mode::process_key(&mut app, 'j');
|
Mode::process_key(&mut app, 'j');
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ impl CellType {
|
|||||||
CellType::Equation(eq) => {
|
CellType::Equation(eq) => {
|
||||||
// Populate the context
|
// Populate the context
|
||||||
let ctx = ExtractionContext::new();
|
let ctx = ExtractionContext::new();
|
||||||
let _ = eval_with_context(eq, &ctx);
|
let _ = eval_with_context(&eq[1..], &ctx);
|
||||||
|
|
||||||
let mut equation = eq.clone();
|
let mut equation = eq.clone();
|
||||||
// translate standard vars A0 -> A1
|
// translate standard vars A0 -> A1
|
||||||
|
|||||||
@@ -276,11 +276,19 @@ impl ExtractionContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn dump_vars(&self) -> Vec<String> {
|
pub fn dump_vars(&self) -> Vec<String> {
|
||||||
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)]
|
#[allow(dead_code)]
|
||||||
pub fn dump_fns(&self) -> Vec<String> {
|
pub fn dump_fns(&self) -> Vec<String> {
|
||||||
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 {
|
} else {
|
||||||
panic!("The RwLock should always be write-able")
|
panic!("The RwLock should always be write-able")
|
||||||
}
|
}
|
||||||
// Ok(Value::Int(1))
|
Ok(Value::Int(1))
|
||||||
unimplemented!("Extracting function identifier not implemented yet")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn are_builtin_functions_disabled(&self) -> bool {
|
fn are_builtin_functions_disabled(&self) -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user