Skip to content

[6236] 修复列表内插入表格后缺少插入列选项 - #4769

Merged
PinkMagicFly merged 1 commit into
mainfrom
pigmagicfly/6236/list-table-insert-column-options
Nov 3, 2026
Merged

PinkMagicFly merged 1 commit into
mainfrom
pigmagicfly/6236/list-table-insert-column-options

Conversation

@PinkMagicFly

Copy link
Copy Markdown
Contributor

概述

修复在有序列表、无序列表或描述列表中插入表格后,表格焦点工具栏及上下文菜单中缺失插入列(向左插入列、向右插入列)和删除列(向左删除列、向右删除列)选项的缺陷,并恢复快捷键在表格内的列操作行为。

对应任务文档 PR:LiiiLabs/dev-agent#356

根因与修改

  1. 焦点工具栏与焦点菜单修复:

    • 在历史任务 221_10(PR [221_10] 列表结构的结构化插入和删除 #3277,commit 0449b7c)中,为了防止一维垂直的列表项出现左右插入按钮,将 focus-insert-icons 与 focus-insert-menu 中的水平操作包裹在 (assuming (not (list-structured-insert-context?)) ...) 中。
    • 但因为表格被包含在列表容器中且前文有 (item) 标记,list-structured-insert-context? 全局误判为真,导致列表内表格丢失全部列插入与删除按钮。
    • 本次修改将该门控条件改为 (assuming (structured-horizontal? t) ...):由于当前被编辑对象 t 为表格时 structured-horizontal? 为真,表格展现完整的列操作按钮;列表纯文本项 structured-horizontal? 为假,不展现列按钮,既有规范保持不变。
  2. 列表插入上下文判定守卫:

    • 在 generic-edit.scm 的 list-structured-insert-context? 中增加 (not (table-markup-context? (focus-tree))) 守卫条件。
    • 当焦点处于表格内部时,明确不属于列表插入语境,防止 generic-kbd.scm 将表格内部的列删除快捷键(Option+Delete / Option+Backspace)重映射为行删除。
  3. 单元测试:

    • 在 TeXmacs/progs/generic/test/generic-test.scm 中增加 test-structured-horizontal 测试,覆盖表格与列表项的水平/垂直特性及表格上下文断言。

验证

  • xmake b stem 编译通过。
  • xmake r generic-test 运行通过(13 correct, 0 failed)。
  • gf fmt --changed-since=main 格式化通过。

@da-liii da-liii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PinkMagicFly
PinkMagicFly merged commit eedacdc into main Nov 3, 2026
3 of 4 checks passed
@PinkMagicFly
PinkMagicFly deleted the pigmagicfly/6236/list-table-insert-column-options branch November 3, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants