fix(input): preserve tab characters in pasted content (#3045)

* fix(input): preserve tab characters in pasted content

Tab-separated data pasted from spreadsheets (e.g. Excel) was silently
lost through three interception layers: stripUnsafeCharacters filtered
tab as a C0 control char, TextInput consumed tab for autocomplete, and
InputPrompt consumed tab for suggestion acceptance.

- Add tab (0x09) to the preserve list in stripUnsafeCharacters
- Skip tab→autocomplete interception when key.paste is true
- Skip tab→suggestion-accept in InputPrompt when key.paste is true

* test: skip flaky AskUserQuestionDialog test on Windows

The "shows unanswered questions as (not answered) in Submit tab" test
fails intermittently on Windows CI due to arrow key navigation timing
issues in the ink test renderer.
This commit is contained in:
tanzhenxin 2026-04-11 13:02:39 +08:00 committed by GitHub
parent 6f693f1b71
commit 285a627886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 28 deletions

View file

@ -719,6 +719,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
// because ACCEPT_SUGGESTION also matches Enter which must fall through to SUBMIT.
if (
key.name === 'tab' &&
!key.paste &&
!key.shift &&
buffer.text.length === 0 &&
!completion.showSuggestions &&
@ -758,7 +759,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
}
}
if (keyMatchers[Command.ACCEPT_SUGGESTION](key)) {
if (keyMatchers[Command.ACCEPT_SUGGESTION](key) && !key.paste) {
if (completion.suggestions.length > 0) {
const targetIndex =
completion.activeSuggestionIndex === -1