From 2a0416c2efc3222b922e4a07414c9382e5cd3300 Mon Sep 17 00:00:00 2001 From: AXeonV <2607343351@qq.com> Date: Fri, 13 Feb 2026 16:21:58 +0800 Subject: [PATCH 1/6] disable table line resizing in math environments --- src/Edit/Interface/edit_interface.cpp | 8 ++++++++ src/Edit/Interface/edit_mouse.cpp | 15 +++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Edit/Interface/edit_interface.cpp b/src/Edit/Interface/edit_interface.cpp index 66bd4d305d..c65af55272 100644 --- a/src/Edit/Interface/edit_interface.cpp +++ b/src/Edit/Interface/edit_interface.cpp @@ -1195,6 +1195,14 @@ edit_interface_rep::is_true_table (path p) { is_compound (qt, "alignat") || is_compound (qt, "alignat*") || is_compound (qt, "flalign") || is_compound (qt, "flalign*")) return false; + if (is_compound (qt, "cases") || is_compound (qt, "choice") || + is_compound (qt, "det") || is_compound (qt, "stack") || + is_compound (qt, "array") || is_compound (qt, "array*") || + is_compound (qt, "matrix") || is_compound (qt, "matrix*") || + is_compound (qt, "bmatrix") || is_compound (qt, "Bmatrix") || + is_compound (qt, "pmatrix") || is_compound (qt, "vmatrix") || + is_compound (qt, "Vmatrix") || is_compound (qt, "smallmatrix")) + return false; } return true; } diff --git a/src/Edit/Interface/edit_mouse.cpp b/src/Edit/Interface/edit_mouse.cpp index ed686b7b2b..faead8d20a 100644 --- a/src/Edit/Interface/edit_mouse.cpp +++ b/src/Edit/Interface/edit_mouse.cpp @@ -571,7 +571,8 @@ edit_interface_rep::table_line_hit (SI x, SI y, table_hit& hit) { hit.second_size= as_int (r[5]); hit.fp = as_path (as_string (r[8])); - if (is_nil (hit.fp) || hit.index <= 0) return false; + if (is_nil (hit.fp) || hit.index <= 0 || !is_true_table (hit.fp)) + return false; return true; } @@ -822,13 +823,11 @@ edit_interface_rep::mouse_any (string type, SI x, SI y, int mods, time_t t, int hovering_table= 0; if (type == "move" || type == "dragging-left" || type == "dragging-right") { - rectangles rs; - tree r= eb->message (tree ("table-loc?"), x, y, rs); - if (is_func (r, TUPLE) && r[0] == "table-loc") { - string orient= as_string (r[1]); - if (orient == "cell") hovering_table= -1; - else if (orient == "row") hovering_table= 1; - else if (orient == "col") hovering_table= 2; + table_hit hit; + if (table_line_hit (x, y, hit)) { + if (hit.orient == "cell") hovering_table= -1; + else if (hit.orient == "row") hovering_table= 1; + else if (hit.orient == "col") hovering_table= 2; } } bool hovering_hlink= false; From 4a062644e935ba75d8a0d9944710d8452f630f0a Mon Sep 17 00:00:00 2001 From: AXeonV <2607343351@qq.com> Date: Fri, 13 Feb 2026 16:22:34 +0800 Subject: [PATCH 2/6] add devel/201_84.md --- devel/201_84.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 devel/201_84.md diff --git a/devel/201_84.md b/devel/201_84.md new file mode 100644 index 0000000000..ac6be44c02 --- /dev/null +++ b/devel/201_84.md @@ -0,0 +1,14 @@ +# [201_84] 默认关闭矩阵等数学环境的格线拖拽 + +## 如何测试 +1. 插入任意样式的正常表格(大表格、小表格除外),格线应该可以正常拖拽 +2. 插入`matrix`、`bmatrix`、`Bmatrix`、`det`、`choice`、`stack`等数学环境,格线应该不支持拖拽 +3. 插入`align`、`eqnarray`、`gather`、`multline`、`alignat`、`flalign`等数学环境,格线也应该不支持拖拽 + +## 2026/2/13 +### What +在诸多以表格为底层数据模型的数学环境下,很多组件在编辑时,格线不应支持拖拽 + +### How +1. 在`edit_interface_rep::is_true_table`中,增加对诸多数学环境的判断 +2. 在`edit_mouse::table_line_hit`中,增加对`is_true_table`的判断,以保障鼠标悬浮的变形和拖动被`table_line_hit`时禁用 \ No newline at end of file From 663d34b27696fb850ae6cd6eca35bd251cddc87c Mon Sep 17 00:00:00 2001 From: AXeonV <2607343351@qq.com> Date: Fri, 13 Feb 2026 16:40:03 +0800 Subject: [PATCH 3/6] wip --- devel/201_84.md | 3 ++- src/Edit/Interface/edit_mouse.cpp | 9 ++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/devel/201_84.md b/devel/201_84.md index ac6be44c02..93e98cf15b 100644 --- a/devel/201_84.md +++ b/devel/201_84.md @@ -11,4 +11,5 @@ ### How 1. 在`edit_interface_rep::is_true_table`中,增加对诸多数学环境的判断 -2. 在`edit_mouse::table_line_hit`中,增加对`is_true_table`的判断,以保障鼠标悬浮的变形和拖动被`table_line_hit`时禁用 \ No newline at end of file +2. 在`edit_mouse::table_line_hit`中,增加对`is_true_table`的判断,以保障鼠标悬浮的变形和拖动被`table_line_hit`时禁用 +3. 清除`hovering_table=-1`这个没有必要的情况分支 \ No newline at end of file diff --git a/src/Edit/Interface/edit_mouse.cpp b/src/Edit/Interface/edit_mouse.cpp index faead8d20a..a378f1bb61 100644 --- a/src/Edit/Interface/edit_mouse.cpp +++ b/src/Edit/Interface/edit_mouse.cpp @@ -906,13 +906,8 @@ edit_interface_rep::mouse_any (string type, SI x, SI y, int mods, time_t t, if (handle_cursor != "") set_cursor_style (handle_cursor); else set_cursor_style ("size_all"); } - else if (hovering_table) { - if (hovering_table == -1) { - set_cursor_style ("normal"); - // draw table resizing handles - } - else set_cursor_style (hovering_table == 1 ? "size_ver" : "size_hor"); - } + else if (hovering_table) + set_cursor_style (hovering_table == 1 ? "size_ver" : "size_hor"); else if (hovering_hlink) set_cursor_style ("pointing_hand"); else if (hovering_image) { set_cursor_style ("pointing_hand"); From c60d6cb0258b745fe917cd999c8a163c68acc590 Mon Sep 17 00:00:00 2001 From: AXeonV <2607343351@qq.com> Date: Thu, 5 Mar 2026 14:41:36 +0800 Subject: [PATCH 4/6] add reverse to achieve --- src/Edit/Interface/edit_mouse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Edit/Interface/edit_mouse.cpp b/src/Edit/Interface/edit_mouse.cpp index a378f1bb61..2893b99719 100644 --- a/src/Edit/Interface/edit_mouse.cpp +++ b/src/Edit/Interface/edit_mouse.cpp @@ -571,7 +571,7 @@ edit_interface_rep::table_line_hit (SI x, SI y, table_hit& hit) { hit.second_size= as_int (r[5]); hit.fp = as_path (as_string (r[8])); - if (is_nil (hit.fp) || hit.index <= 0 || !is_true_table (hit.fp)) + if (is_nil (hit.fp) || hit.index <= 0 || !is_true_table (reverse (hit.fp))) return false; return true; } From b1a3a7298c3f9ed2cfa30a8cf5cdf46b50570e08 Mon Sep 17 00:00:00 2001 From: AXeonV <2607343351@qq.com> Date: Thu, 5 Mar 2026 14:46:23 +0800 Subject: [PATCH 5/6] fix md file --- devel/{201_84.md => 201_89.md} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename devel/{201_84.md => 201_89.md} (67%) diff --git a/devel/201_84.md b/devel/201_89.md similarity index 67% rename from devel/201_84.md rename to devel/201_89.md index 93e98cf15b..700e6f69c3 100644 --- a/devel/201_84.md +++ b/devel/201_89.md @@ -1,4 +1,4 @@ -# [201_84] 默认关闭矩阵等数学环境的格线拖拽 +# [201_89] 默认关闭矩阵等数学环境的格线拖拽 ## 如何测试 1. 插入任意样式的正常表格(大表格、小表格除外),格线应该可以正常拖拽 @@ -12,4 +12,7 @@ ### How 1. 在`edit_interface_rep::is_true_table`中,增加对诸多数学环境的判断 2. 在`edit_mouse::table_line_hit`中,增加对`is_true_table`的判断,以保障鼠标悬浮的变形和拖动被`table_line_hit`时禁用 -3. 清除`hovering_table=-1`这个没有必要的情况分支 \ No newline at end of file +3. 清除`hovering_table=-1`这个没有必要的情况分支 + +## Attention +`!is_true_table (reverse (hit.fp))`,这里一定要用`reverse (hit.fp)`,而不是`hit.fp`,因为在`edit_interface_rep::is_true_table`中获取的ip是反向的,需要转换为通用向上查找的正向路径 \ No newline at end of file From d4c39d3cef386819fd23c75b0a9a179d3f036a3b Mon Sep 17 00:00:00 2001 From: AXeonV <2607343351@qq.com> Date: Thu, 5 Mar 2026 14:50:19 +0800 Subject: [PATCH 6/6] update 201_89.md --- devel/201_89.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devel/201_89.md b/devel/201_89.md index 700e6f69c3..f52d07496b 100644 --- a/devel/201_89.md +++ b/devel/201_89.md @@ -15,4 +15,4 @@ 3. 清除`hovering_table=-1`这个没有必要的情况分支 ## Attention -`!is_true_table (reverse (hit.fp))`,这里一定要用`reverse (hit.fp)`,而不是`hit.fp`,因为在`edit_interface_rep::is_true_table`中获取的ip是反向的,需要转换为通用向上查找的正向路径 \ No newline at end of file +`!is_true_table (reverse (hit.fp))`,这里一定要用`reverse (hit.fp)`,而不是`hit.fp`,因为在`eb->message`中获取的ip是反向路径,需要转换为通用向上查找的正向路径 \ No newline at end of file