mirror of
https://github.com/zaphar/sheetsui.git
synced 2025-07-23 05:19:48 -04:00
chore: renames and other housekeeping
This commit is contained in:
parent
fa5c2c2d58
commit
76b4d46222
@ -5,7 +5,7 @@ use slice_utils::{Measured, Peekable, Seekable, Span, StrCursor};
|
|||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum Cmd<'a> {
|
pub enum Cmd<'a> {
|
||||||
Write(Option<&'a str>),
|
Write(Option<&'a str>),
|
||||||
InsertRow(usize),
|
InsertRows(usize),
|
||||||
InsertColumns(usize),
|
InsertColumns(usize),
|
||||||
RenameSheet(Option<usize>, &'a str),
|
RenameSheet(Option<usize>, &'a str),
|
||||||
NewSheet(Option<&'a str>),
|
NewSheet(Option<&'a str>),
|
||||||
@ -155,7 +155,7 @@ fn try_consume_insert_row<'cmd, 'i: 'cmd>(
|
|||||||
return Err("Invalid command: Did you mean to type `insert-rows <arg>`?");
|
return Err("Invalid command: Did you mean to type `insert-rows <arg>`?");
|
||||||
}
|
}
|
||||||
let arg = input.span(0..).trim();
|
let arg = input.span(0..).trim();
|
||||||
return Ok(Some(Cmd::InsertRow(if arg.is_empty() {
|
return Ok(Some(Cmd::InsertRows(if arg.is_empty() {
|
||||||
1
|
1
|
||||||
} else {
|
} else {
|
||||||
if let Ok(count) = arg.parse() {
|
if let Ok(count) = arg.parse() {
|
||||||
|
@ -425,7 +425,7 @@ impl<'ws> Workspace<'ws> {
|
|||||||
self.book.evaluate();
|
self.book.evaluate();
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
Ok(Some(Cmd::InsertRow(count))) => {
|
Ok(Some(Cmd::InsertRows(count))) => {
|
||||||
self.book.insert_rows(self.book.location.row, count)?;
|
self.book.insert_rows(self.book.location.row, count)?;
|
||||||
self.book.evaluate();
|
self.book.evaluate();
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
@ -35,7 +35,7 @@ fn test_insert_rows_cmd() {
|
|||||||
let output = result.unwrap();
|
let output = result.unwrap();
|
||||||
assert!(output.is_some());
|
assert!(output.is_some());
|
||||||
let cmd = output.unwrap();
|
let cmd = output.unwrap();
|
||||||
assert_eq!(cmd, Cmd::InsertRow(1));
|
assert_eq!(cmd, Cmd::InsertRows(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -46,7 +46,7 @@ fn test_insert_rows_cmd_short() {
|
|||||||
let output = result.unwrap();
|
let output = result.unwrap();
|
||||||
assert!(output.is_some());
|
assert!(output.is_some());
|
||||||
let cmd = output.unwrap();
|
let cmd = output.unwrap();
|
||||||
assert_eq!(cmd, Cmd::InsertRow(1));
|
assert_eq!(cmd, Cmd::InsertRows(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user