修复 tui v3 输入框被菜单状态卡住#649
Open
YangChen-pro wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 针对 TUI v3 中“输入框被菜单模态状态卡住”的问题,增加了菜单状态清理、初始化失败兜底与按键入口健康检查,确保菜单坏状态不会继续拦截输入,从而恢复正常输入体验。
Changes:
- 在打开新菜单前主动清理可能遗留的旧菜单模态状态,避免状态泄漏。
- 菜单过滤初始化失败时自动关闭菜单并重绘,避免输入通道被阻塞。
- 在按键入口增加菜单状态健康检查,发现坏状态时自动关闭菜单,让当前字符回到普通输入框。
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2845
to
+2851
| try: | ||
| self._menu_apply_filter() # 设 _menu_options + _menu_map(初始 query 为空 → 全量) | ||
| except Exception: | ||
| # Defensive fallback: malformed menu data must not block typing. | ||
| self._close_menu() | ||
| self._render_live() | ||
| return |
Comment on lines
5575
to
5579
| for ch in text: | ||
| if self._menu_active and not self._menu_state_ok(): | ||
| self._close_menu() | ||
| self._render_live() | ||
| o = ord(ch) |
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.
变更说明
验证