mirror of
https://github.com/zaphar/sheetsui.git
synced 2025-07-23 13:29:48 -04:00
Compare commits
1 Commits
e984d7324c
...
41b67ebd60
Author | SHA1 | Date | |
---|---|---|---|
41b67ebd60 |
@ -652,7 +652,6 @@ impl<'ws> Workspace<'ws> {
|
||||
match key.code {
|
||||
KeyCode::Esc => {
|
||||
self.state.reset_n_prefix();
|
||||
self.state.char_queue.clear();
|
||||
}
|
||||
KeyCode::Char(d) if d.is_ascii_digit() => {
|
||||
self.handle_numeric_prefix(d);
|
||||
@ -728,6 +727,12 @@ impl<'ws> Workspace<'ws> {
|
||||
Ok(())
|
||||
})?;
|
||||
}
|
||||
KeyCode::Char('s')
|
||||
if key.modifiers == KeyModifiers::HYPER
|
||||
|| key.modifiers == KeyModifiers::SUPER =>
|
||||
{
|
||||
self.save_file()?;
|
||||
}
|
||||
KeyCode::Char('l') if key.modifiers == KeyModifiers::CONTROL => {
|
||||
self.run_with_prefix(|ws: &mut Workspace<'_>| -> Result<()> {
|
||||
let Address { row: _, col } = &ws.book.location;
|
||||
|
@ -563,82 +563,3 @@ fn test_traditional_copy_paste_rendered() {
|
||||
"3",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_cell() {
|
||||
let mut ws =
|
||||
Workspace::new_empty("en", "America/New_York").expect("Failed to get empty workbook");
|
||||
ws.book.edit_current_cell("foo")
|
||||
.expect("failed to edit cell");
|
||||
ws.book.evaluate();
|
||||
assert_eq!("foo", ws.book.get_current_cell_contents().expect("failed to get cell contents"));
|
||||
InputScript::default()
|
||||
.add_char('d')
|
||||
.run(&mut ws)
|
||||
.expect("Failed to run input script");
|
||||
assert_eq!("", ws.book.get_current_cell_contents().expect("failed to get cell contents"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_cell_all() {
|
||||
let mut ws =
|
||||
Workspace::new_empty("en", "America/New_York").expect("Failed to get empty workbook");
|
||||
ws.book.edit_current_cell("foo")
|
||||
.expect("failed to edit cell");
|
||||
ws.book.evaluate();
|
||||
assert_eq!("foo", ws.book.get_current_cell_contents().expect("failed to get cell contents"));
|
||||
InputScript::default()
|
||||
.add_char('D')
|
||||
.run(&mut ws)
|
||||
.expect("Failed to run input script");
|
||||
assert_eq!("", ws.book.get_current_cell_contents().expect("failed to get cell contents"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sheet_navigation() {
|
||||
let mut ws =
|
||||
Workspace::new_empty("en", "America/New_York").expect("Failed to get empty workbook");
|
||||
ws.book.new_sheet(Some("sheet 2")).expect("Failed to set sheet name");
|
||||
ws.book.new_sheet(Some("sheet 3")).expect("Failed to set sheet name");
|
||||
ws.book.new_sheet(Some("sheet 4")).expect("Failed to set sheet name");
|
||||
InputScript::default()
|
||||
.add_modified_char('n', KeyModifiers::CONTROL)
|
||||
.add_modified_char('n', KeyModifiers::CONTROL)
|
||||
.run(&mut ws)
|
||||
.expect("Failed to run input script");
|
||||
assert_eq!("sheet 3", ws.book.get_sheet_name().expect("Failed to get sheet name"));
|
||||
InputScript::default()
|
||||
.add_modified_char('p', KeyModifiers::CONTROL)
|
||||
.run(&mut ws)
|
||||
.expect("Failed to run input script");
|
||||
assert_eq!("sheet 2", ws.book.get_sheet_name().expect("Failed to get sheet name"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sheet_column_sizing() {
|
||||
let mut ws =
|
||||
Workspace::new_empty("en", "America/New_York").expect("Failed to get empty workbook");
|
||||
InputScript::default()
|
||||
.add_char('3')
|
||||
.add_modified_char('l', KeyModifiers::CONTROL)
|
||||
.run(&mut ws)
|
||||
.expect("Failed to run input script");
|
||||
assert_eq!(28, ws.book.get_col_size(1).expect("Failed to get column size"));
|
||||
InputScript::default()
|
||||
.add_char('1')
|
||||
.add_modified_char('h', KeyModifiers::CONTROL)
|
||||
.run(&mut ws)
|
||||
.expect("Failed to run input script");
|
||||
assert_eq!(27, ws.book.get_col_size(1).expect("Failed to get column size"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_quit() {
|
||||
let mut ws =
|
||||
Workspace::new_empty("en", "America/New_York").expect("Failed to get empty workbook");
|
||||
let result = InputScript::default()
|
||||
.add_char('q')
|
||||
.run(&mut ws)
|
||||
.expect("Failed to run input script");
|
||||
assert!(result.is_some());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user