terminal-setup: contradictory message when run from Windows Terminal
Description
Running /terminal-setup from Windows Terminal produces a contradictory message:
Terminal setup cannot be run from windows-terminal.
This command configures a convenient Shift+Enter shortcut for multi-line prompts.
To set up the shortcut (optional):
1. Exit tmux/screen temporarily
2. Run /terminal-setup directly in one of these terminals:
• Windows: Windows Terminal
…
The first line says it cannot be run from Windows Terminal, then the recovery instructions list Windows Terminal as a recommended target.
Expected behaviour
Either:
- The detection should recognise Windows Terminal correctly and proceed with setup, or
- The error message should not list Windows Terminal as a recommended target if it genuinely isn't supported.
Root cause analysis
The terminal detection elsewhere in Claude Code correctly uses $WT_SESSION to identify Windows Terminal (see #27868, #19541). However, /terminal-setup appears to rely on $TERM_PROGRAM, which Windows Terminal does not set:
$ echo "$TERM_PROGRAM"
# empty
$ echo "$WT_SESSION"
b9ebf46d-1ad8-4234-83a4-4f54d44a99e8 # present
Because $TERM_PROGRAM is empty, the command fails to identify the terminal and reports it as unsupported — even though $WT_SESSION confirms it is Windows Terminal.
Manual workaround
The Shift+Enter binding can be configured manually in Windows Terminal's settings.json. Adding this to actions:
{
"command": {
"action": "sendInput",
"input": "\^[[13;2u"
},
"id": "User.sendInput.shiftEnter",
"keys": "shift+enter"
}
Windows Terminal auto-normalises this into its newer split schema: the command definition stays in actions and the key assignment moves to keybindings. This is confirmed working.
Suggested fix
Have /terminal-setup check $WT_SESSION (in addition to or before $TERM_PROGRAM) when identifying Windows Terminal, consistent with the detection logic used elsewhere in the codebase.
Environment
- Windows 11 Enterprise (ARM64, Snapdragon X Elite)
- Windows Terminal (default shell: PowerShell Core)
- Claude Code v2.1.86
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗