diff --git a/apps/ely-table/src/data.rs b/apps/ely-table/src/data.rs index b9203f1..4db68a9 100644 --- a/apps/ely-table/src/data.rs +++ b/apps/ely-table/src/data.rs @@ -397,6 +397,7 @@ impl Book { book.dialog = Some(Dialog::Column { tab: id, column, + row, entries: filter.entries, picked, }); @@ -413,12 +414,15 @@ impl Book { let Some(Dialog::Column { tab, column, + row, entries, picked, }) = self.dialog.take() else { return; }; + // The kernel filters the cursor's range: go to the button. + self.run_in(Some(tab), "cell.goto", &[&sheet::address(column, row)], cx); match sort { Some(rising) => { let key = SortKey { diff --git a/apps/ely-table/src/dialog.rs b/apps/ely-table/src/dialog.rs index 24afa0a..4aa0d88 100644 --- a/apps/ely-table/src/dialog.rs +++ b/apps/ely-table/src/dialog.rs @@ -94,6 +94,8 @@ pub enum Dialog { Column { tab: u64, column: u32, + /// The button's row: its cell names the filtered range. + row: u32, entries: Vec, picked: Vec, }, diff --git a/apps/ely-table/src/tests/data.rs b/apps/ely-table/src/tests/data.rs index 9346dd8..b606320 100644 --- a/apps/ely-table/src/tests/data.rs +++ b/apps/ely-table/src/tests/data.rs @@ -300,3 +300,41 @@ fn the_panel_reads_number_formats_and_find_counts_cells() { .is_some_and(|finder| finder.all.len() == 3) }); } + +/// Two blocks: keys in A, other numbers in C. +const BLOCKS: &str = r#" + + + KL + 39 + 17 + 28 + +"#; + +#[test] +fn a_column_button_sorts_its_own_block_not_the_cursors() { + let dir = tempfile::tempdir().expect("a temp dir"); + let mut cx = TestAppContext::single(); + let Some((_window, book)) = book(&mut cx, dir.path()) else { + eprintln!("SKIP: no LOK build"); + return; + }; + update(&mut cx, &book, |book, cx| { + book.new_from_text("blocks.fods", BLOCKS, cx) + }); + settle(&cx, |app| sheet_names(app, &book) == ["S"]); + run(&mut cx, &book, "cell.goto", &["A1"]); + run(&mut cx, &book, "data.autofilter", &[]); + run(&mut cx, &book, "cell.goto", &["C3"]); + let id = cx.update(|app| book.read(app).core.active.expect("a tab")); + update(&mut cx, &book, |book, cx| { + book.ask_column(id, &Request::Filter { column: 0, row: 0 }, cx) + }); + asked(&cx, &book, |dialog| matches!(dialog, Dialog::Column { .. })); + update(&mut cx, &book, |book, cx| book.column_asked(Some(true), cx)); + assert_eq!(cells(&mut cx, &book, "A2:A4"), "1\n2\n3"); + assert_eq!(cells(&mut cx, &book, "C2:C4"), "9\n7\n8"); +} diff --git a/tasks/BUGS.md b/tasks/BUGS.md index 3cd79bf..e45637b 100644 --- a/tasks/BUGS.md +++ b/tasks/BUGS.md @@ -15,7 +15,7 @@ - [x] T-05 文档尺寸按内核像素取整,表尾被裁 — 内核尺寸按其测量时的比例换到当前比例(加载即设比例、缩放即改比例并重测、迟到的测量也换算);R1–R4 缩放后未重测、表尾锚点被截、连续缩放迟到、首次测量无比例与文件超行;R5 PASS - [x] T-06 滚轮向下被内核平铺区卡住 — 表格的可滚范围先行两屏、止于表尾;R1 PASS - [x] T-07 表头点选、行高列宽拖动是“按编号的命令”,而每次点击与拖选都推进修订,紧接着的表头操作被当作过期拒绝 — 行列号不再算作按编号的命令;R1 PASS -- [ ] T-08 自动筛选的列菜单对光标所在的表而不是按钮所在的表筛选、排序 +- [x] T-08 自动筛选的列菜单对光标所在的表而不是按钮所在的表筛选、排序 — 先把光标移到按钮所在格再排序或筛选;R1 PASS - [ ] T-09 导入文本文件时整文件的 UTF-8 校验在界面线程跑 - [ ] T-10 CSV 导入对话框开着时打开任何别的对话框,待导入的文件静默消失 - [ ] T-11 对话框比其标签活得久:导出、定义名称、重命名不可见却“开着”,挡住导入;名称表的“转到”激活已关闭的标签 diff --git a/tasks/reviews/T-08-r1.md b/tasks/reviews/T-08-r1.md new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/tasks/reviews/T-08-r1.md @@ -0,0 +1 @@ +PASS