mirror of
https://github.com/zaphar/sheetsui.git
synced 2025-07-23 21:39:51 -04:00
wip: styling: bold text
This commit is contained in:
parent
b5e0362a4e
commit
c3f84b10ad
1
result
Normal file
1
result
Normal file
@ -0,0 +1 @@
|
||||
/nix/store/mvnsm5ndvx4psah2d3y6yd2vwkypy9m7-sheetui-0.1.0
|
@ -343,12 +343,6 @@ impl Book {
|
||||
sheet: u32,
|
||||
col_idx: usize,
|
||||
) -> Result<()> {
|
||||
// TODO(jeremy): This is a little hacky and the underlying model
|
||||
// supports a better mechanism but UserModel doesn't support it yet.
|
||||
// https://github.com/ironcalc/IronCalc/issues/273
|
||||
// https://github.com/ironcalc/IronCalc/pull/276 is the coming fix.
|
||||
// NOTE(jwall): Because of the number of cells required to modify
|
||||
// this is crazy slow
|
||||
let area = self.get_col_range(sheet, col_idx);
|
||||
self.set_cell_style(style, &area)?;
|
||||
Ok(())
|
||||
@ -373,10 +367,6 @@ impl Book {
|
||||
sheet: u32,
|
||||
row_idx: usize,
|
||||
) -> Result<()> {
|
||||
// TODO(jeremy): This is a little hacky and the underlying model
|
||||
// supports a better mechanism but UserModel doesn't support it yet.
|
||||
// https://github.com/ironcalc/IronCalc/issues/273
|
||||
// https://github.com/ironcalc/IronCalc/pull/276 is the coming fix.
|
||||
let area = self.get_row_range(sheet, row_idx);
|
||||
self.set_cell_style(style, &area)?;
|
||||
Ok(())
|
||||
|
@ -831,6 +831,18 @@ impl<'ws> Workspace<'ws> {
|
||||
self.state.char_queue.push('g');
|
||||
}
|
||||
}
|
||||
KeyCode::Char('b') => {
|
||||
let address = self.book.location.clone();
|
||||
self.book.set_cell_style(
|
||||
&[("font.b", "true")],
|
||||
&Area {
|
||||
sheet: self.book.current_sheet,
|
||||
row: address.row as i32,
|
||||
column: address.col as i32,
|
||||
width: 1,
|
||||
height: 1,
|
||||
})?;
|
||||
}
|
||||
_ => {
|
||||
// noop
|
||||
self.state.char_queue.clear();
|
||||
|
@ -1272,6 +1272,24 @@ fn test_color_col() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_bold_text() {
|
||||
let mut ws = new_workspace();
|
||||
let before_style = ws
|
||||
.book
|
||||
.get_cell_style(0, &Address { row: 1, col: 1 })
|
||||
.expect("Failed to get style");
|
||||
assert!(!before_style.font.b);
|
||||
script()
|
||||
.char('b')
|
||||
.run(&mut ws)
|
||||
.expect("Unable to run script");
|
||||
let style = ws
|
||||
.book
|
||||
.get_cell_style(0, &Address { row: 1, col: 1 })
|
||||
.expect("Failed to get style");
|
||||
assert!(style.font.b);
|
||||
}
|
||||
|
||||
fn new_workspace<'a>() -> Workspace<'a> {
|
||||
Workspace::new_empty("en", "America/New_York").expect("Failed to get empty workbook")
|
||||
|
Loading…
x
Reference in New Issue
Block a user