diff --git a/README.md b/README.md index ee8cbfb..73a225a 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,12 @@ *New* Spreadsheet Calculator Improved +![Screenshot](readme/screenshot.png) + Based loosely off sc-im (spreadsheet calculator improvised), which has dumb keybinds and not many features. +[Checkout a demo file](readme/demo.nscim), download, then open with `neoscim demo.nscim`. + ## Keybinds ### Normal mode diff --git a/readme/demo.nscim b/readme/demo.nscim new file mode 100644 index 0000000..ab48685 --- /dev/null +++ b/readme/demo.nscim @@ -0,0 +1,21 @@ +,,, +Most of vim's movement works here as well,,, +,,, +,i,, +j,Movement,l, +,j,, +,,, +,"insert text with r, i, or a",, +,,, +1,,, +1,Text can overflow cells,, +1,But may get cut off if it's too long,,10 +1,,,If it reaches another cell +1,,, +Total:,=sum(A:A),Sum A:A, +,=math::log2(B14),Do math on the output of another function, +,,, +,,, +,,11,Number. +,,=C18+1,Referencing the number and adding 1 +,,,Copying the cell down will translate the reference diff --git a/readme/screenshot.png b/readme/screenshot.png new file mode 100644 index 0000000..9506f2f Binary files /dev/null and b/readme/screenshot.png differ diff --git a/src/app/clipboard.rs b/src/app/clipboard.rs index 7dbab49..c056f37 100644 --- a/src/app/clipboard.rs +++ b/src/app/clipboard.rs @@ -367,3 +367,21 @@ fn copy_paste_var_in_function() { let a = app.grid.get_cell("A2").as_ref().expect("Should've been set by paste"); assert_eq!(a.to_string(), "=math::log2(A1)"); } + +#[test] +fn copy_paste_range_in_function() { + let mut app = App::new(); + app.grid.set_cell("A0", 1.to_string()); + app.grid.set_cell("A1", 1.to_string()); + app.grid.set_cell("A2", 1.to_string()); + + app.grid.set_cell("B0", "=sum(A:A)".to_string()); + app.grid.mv_cursor_to(1, 0); + app.mode = super::mode::Mode::Chord(Chord::new('y')); + Mode::process_key(&mut app, 'y'); + Mode::process_key(&mut app, 'l'); + Mode::process_key(&mut app, 'p'); + + let a = app.grid.get_cell("C0").as_ref().expect("Should've been set by paste"); + assert_eq!(a.to_string(), "=sum(B:B)"); +}