Summary
When ask_user is called with candidates=[] (no choices, user types
freely), _drain_ask_user_events still creates a ChoiceList widget
with only a "直接输入文字..." option. This widget calls .focus() on
mount, stealing keyboard focus from the text input.
v3 (tui_v3.py) already has this guard (dfab299). v2 is missing it.
Fix
Check candidates early, return if empty. 0 net line change, walrus operator.
PR: https://github.com/ChaiRZy/GenericAgent/pull/new/fix/v2-ask-user-empty-candidates
Summary
When
ask_useris called withcandidates=[](no choices, user typesfreely),
_drain_ask_user_eventsstill creates a ChoiceList widgetwith only a "直接输入文字..." option. This widget calls
.focus()onmount, stealing keyboard focus from the text input.
v3 (tui_v3.py) already has this guard (dfab299). v2 is missing it.
Fix
Check candidates early, return if empty. 0 net line change, walrus operator.
PR: https://github.com/ChaiRZy/GenericAgent/pull/new/fix/v2-ask-user-empty-candidates