Repository navigation
[6118] 修复插入空 document 节点导致编辑器崩溃问题 - #4721
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题背景
在插入子节点数为 0 的空 document 节点时,C++
edit_text_rep::insert_tree处理is_document分支破坏了 buffer 树结构或产生负索引越界,导致编辑器抛出Throwing concat expected/invalid modification并挂死崩溃;在 OCR 处理流程中,空串或纯空白文本也会经ocr-insert-text-by-cursor触发该问题及产生多余回车。改动内容
src/Edit/Modify/edit_text.cpp中,为insert_tree的is_document(t)分支头部增加if (N (t) == 0) return;保护。TeXmacs/plugins/ocr/progs/ocr/ocr-insert.scm中,修改ocr-insert-text-by-cursor,遇到空串或纯空白文本直接返回#f。TeXmacs/tests/6118.scm测试用例,覆盖空 document 节点插入及 OCR 空文本拦截。