[Bug]: Zsh integration removes WezTerm's OSC 133 input marker when the PTY proxy is inactive
What did you expect to happen?
I use WezTerm's Zsh shell integration, which marks prompts, command input, and command output with OSC 133 semantic zones.
When Atuin's PTY proxy does not own the current terminal, I expected Atuin to leave OSC 133 markers from another shell integration unchanged. In particular, WezTerm's OSC 133;B marker should remain in PROMPT so that entered commands are classified as Input zones.
What happened?
After updating Atuin from 18.15.2 to 18.19.0, WezTerm stopped detecting Input semantic zones. Output zones still work. I checked the Zsh integration in 18.20.0, 18.20.1, 18.21.0, 18.22.0, and the current main branch; the same marker removal is still present.
Atuin's generated Zsh integration runs _atuin_precmd after WezTerm's __wezterm_semantic_precmd. _atuin_precmd calls __atuin_osc133_wrap_prompt, which removes OSC 133;A and OSC 133;B from PROMPT and RPROMPT:
__atuin_prompt="${__atuin_prompt//$__atuin_osc133_prompt_start/}"
__atuin_prompt="${__atuin_prompt//$__atuin_osc133_prompt_end/}"
__atuin_rprompt="${__atuin_rprompt//$__atuin_osc133_prompt_start/}"
__atuin_rprompt="${__atuin_rprompt//$__atuin_osc133_prompt_end/}"In Atuin 18.22.0, the markers are added back only when Atuin determines that its PTY proxy owns the current terminal:
if [[ "${__atuin_pty_proxy_owns_tty:-0}" = 1 ]]; then
PROMPT="${__atuin_osc133_prompt_start}${__atuin_prompt}"
RPROMPT="${__atuin_rprompt}${__atuin_osc133_prompt_end}"
else
[[ "$__atuin_orig_prompt" == "$__atuin_prompt" ]] || PROMPT="$__atuin_prompt"
[[ "$__atuin_orig_rprompt" == "$__atuin_rprompt" ]] || RPROMPT="$__atuin_rprompt"
fiWithout an active Atuin PTY proxy, __atuin_pty_proxy_owns_tty is 0. Since removing WezTerm's marker changes the prompt, the else branch writes the stripped prompt back to PROMPT.
The 18.22.0 change from #4079, "Make PTY proxy aware of other PTYs," does not fix this case. That change detects whether Atuin is directly attached to its own proxy rather than running through another PTY such as tmux or screen. It changes how the active proxy is detected, but the prompt wrapper still removes markers when the proxy is inactive.
My precmd hook order is:
prompt_starship_precmd
__wezterm_semantic_precmd
__wezterm_user_vars_precmd
__wezterm_osc7
_atuin_precmdBecause _atuin_precmd runs after WezTerm's hook, the final prompt no longer contains OSC 133;B. WezTerm then classifies the entered command as part of the Prompt zone:
type=Prompt text="<rendered prompt>\nprint -r -- wezterm-zone-test"
input=0
output=2Before Atuin removes the marker, or with the workaround below, the command is classified correctly:
type=Prompt text="<rendered prompt>"
type=Input text="print -r -- wezterm-zone-test"
type=Output text="wezterm-zone-test"
input=1Steps to reproduce
- Enable WezTerm's Zsh shell integration.
- Enable Atuin's Zsh integration.
- Leave Atuin's PTY proxy disabled or otherwise inactive.
- Start a new Zsh session in WezTerm.
- Run a command.
- Inspect the zones with this WezTerm Lua callback:
wezterm.action_callback(function(_, pane)
wezterm.log_info("input zones: " .. #pane:get_semantic_zones("Input"))
end)The result is input zones: 0.
The prompt mutation can also be seen by inspecting PROMPT before and after _atuin_precmd runs.
Workaround
Re-emitting OSC 133;B from zle-line-init restores the input zones:
if [[ "${TERM_PROGRAM-}" == "WezTerm" ]]; then
autoload -Uz add-zle-hook-widget
_wezterm_mark_input_zone() {
printf '\e]133;B\a'
}
add-zle-hook-widget line-init _wezterm_mark_input_zone
fiPossible fix
When Atuin's PTY proxy does not own the current terminal, the prompt wrapper should avoid removing OSC 133 markers emitted by another shell integration.
Environment
- Reproduced with Atuin 18.19.0; confirmed in the generated Zsh integration through 18.22.0 and current
main - Shell: Zsh 5.9.2
- Terminal: WezTerm
- OS: macOS
ATUIN_PTY_PROXY_ACTIVE: unset
Atuin doctor output
{
"atuin": {
"version": "18.19.0",
"commit": "NO_GIT",
"sync": {
"auth_state": "Self-hosted (authenticated)",
"auto_sync": true,
"last_sync": "2026-09-15 13:17:19.330932 +00:00:00"
},
"sqlite_version": "3.46.0",
"daemon_enabled": true
},
"shell": {
"name": "zsh",
"default": "zsh",
"plugins": [
"atuin"
],
"preexec": "built-in"
},
"system": {
"os": "Darwin",
"arch": "arm64",
"version": "26.6.2",
"disks": [
{
"name": "Macintosh HD",
"filesystem": "apfs"
},
{
"name": "Macintosh HD",
"filesystem": "apfs"
},
{
"name": "Vial",
"filesystem": "apfs"
}
]
}
}Code of Conduct
- I agree to follow this project's Code of Conduct
Source: atuinsh/atuin