Navigation: ZoomIn fails when the first child says nothing (silent or invisible)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 65/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
调研方向
Start from do_navigate_command_string and apply_navigation_rules in the Rust navigation code, especially the LOOP_LIMIT retry loop for ZoomIn/ZoomInAll. Reproduce with the silent-separator example from the issue, then try switching the retry command to MoveNext and confirm ZoomIn lands on the next spoken node. Run cargo test and check the Enhanced-mode ZoomIn cases; done means the example speaks "x plus 1" and silent-node failures drop without regressing other navigation commands.
由索引模型根据 Issue 内容生成。
描述
ZoomIn and ZoomInAll fail if they land on a node that produces no speech, such as an invisible separator with :silent:
<math><mi intent=":silent">⁣</mi><mi>x</mi><mo>+</mo><mn>1</mn></math>
Reading gives "x plus 1", but ZoomIn gives "Internal error: Navigation exceeded limit of number of times no speech generated" (MathCAT Demo: "Error in Navigation"). The same happens with a plain <mi>⁣</mi>, and in every language.
This matters for LaTeX: the spanish-mathml-intent package puts these silent separators in most of its output. In its 579 test formulas (tagged PDFs, mathml-SE), ZoomIn fails in 480 of them in Enhanced mode.
The cause: when a command produces no speech, do_navigate_command_string retries the same command. ZoomIn from a leaf stays on that leaf, so all three tries say nothing. A possible fix is to retry with MoveNext after ZoomIn/ZoomInAll:
for loop_count in 0..LOOP_LIMIT {
- let (speech, done) = apply_navigation_rules(mathml, nav_command, &rules, &mut rules_with_context, &mut nav_state, loop_count)?;
+ // If zooming in landed on a node that says nothing (e.g., a silent invisible separator), move on to the next node
+ let command = if loop_count > 0 && (nav_command == "ZoomIn" || nav_command == "ZoomInAll") {"MoveNext"} else {nav_command};
+ if command != nav_command {
+ rules_with_context.get_context().set_variable("NavCommand", command);
+ }
+ let (speech, done) = apply_navigation_rules(mathml, command, &rules, &mut rules_with_context, &mut nav_state, loop_count)?;
With this change, the example zooms in to "x plus 1" (the next node at that level), cargo test passes, and the failures in Enhanced mode drop from 480 to 44. Forty of those are examples that are completely silenced on purpose, so there is nothing to say. Maybe you prefer to skip silent nodes in the navigation rules instead; this is only a suggestion.
- 主要语言
- Rust
- 星标
- 131
- 派生
- 97
- 平均合并
- 21 小时 45 分钟
- 30 天内合并 PR
- 95
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
daisy/MathCAT 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 84/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
相似的 Issue
-
area:schema documentation
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
ElectronicWave/Elemental#252 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
dekobon/big-code-analysis#1887 ·
维护者通常 1 天内回复
-
Shell中文符号输入异常未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复