wip: different keybinds for bold and italic

This commit is contained in:
Jeremy Wall 2025-02-27 18:45:42 -05:00
parent 4623a911f4
commit 621c35d7c4
3 changed files with 6 additions and 6 deletions

Binary file not shown.

View File

@ -669,12 +669,12 @@ impl<'ws> Workspace<'ws> {
self.state.reset_n_prefix(); self.state.reset_n_prefix();
self.state.char_queue.clear(); self.state.char_queue.clear();
} }
KeyCode::Char('b') if key.modifiers.contains(KeyModifiers::CONTROL) => { KeyCode::Char('B') => {
let address = self.book.location.clone(); let address = self.book.location.clone();
let style = self.book.get_cell_style(self.book.current_sheet, &address).map(|s| s.font.b); let style = self.book.get_cell_style(self.book.current_sheet, &address).map(|s| s.font.b);
self.toggle_bool_style(style, "font.b", &address)?; self.toggle_bool_style(style, "font.b", &address)?;
} }
KeyCode::Char('i') if key.modifiers.contains(KeyModifiers::CONTROL) => { KeyCode::Char('I') => {
let address = self.book.location.clone(); let address = self.book.location.clone();
let style = self.book.get_cell_style(self.book.current_sheet, &address).map(|s| s.font.i); let style = self.book.get_cell_style(self.book.current_sheet, &address).map(|s| s.font.i);
self.toggle_bool_style(style, "font.i", &address)?; self.toggle_bool_style(style, "font.i", &address)?;

View File

@ -1291,7 +1291,7 @@ fn test_bold_text() {
.expect("Failed to get style"); .expect("Failed to get style");
assert!(!before_style.font.b); assert!(!before_style.font.b);
script() script()
.ctrl('b') .char('B')
.run(&mut ws) .run(&mut ws)
.expect("Unable to run script"); .expect("Unable to run script");
let style = ws let style = ws
@ -1300,7 +1300,7 @@ fn test_bold_text() {
.expect("Failed to get style"); .expect("Failed to get style");
assert!(style.font.b); assert!(style.font.b);
script() script()
.ctrl('b') .char('B')
.run(&mut ws) .run(&mut ws)
.expect("Unable to run script"); .expect("Unable to run script");
assert!(!before_style.font.b); assert!(!before_style.font.b);
@ -1315,7 +1315,7 @@ fn test_italic_text() {
.expect("Failed to get style"); .expect("Failed to get style");
assert!(!before_style.font.i); assert!(!before_style.font.i);
script() script()
.ctrl('i') .char('I')
.run(&mut ws) .run(&mut ws)
.expect("Unable to run script"); .expect("Unable to run script");
let style = ws let style = ws
@ -1324,7 +1324,7 @@ fn test_italic_text() {
.expect("Failed to get style"); .expect("Failed to get style");
assert!(style.font.i); assert!(style.font.i);
script() script()
.ctrl('i') .char('I')
.run(&mut ws) .run(&mut ws)
.expect("Unable to run script"); .expect("Unable to run script");
assert!(!before_style.font.i); assert!(!before_style.font.i);