Skip to content

Output blinks/disappears in Ghostty when using zsh shell plugin #3144

@jbotwell

Description

@jbotwell

Problem

When using the forge zsh shell plugin in Ghostty terminal, LLM response output "blinks" and disappears. Thinking traces are briefly visible, but the actual response text flashes on screen then vanishes. The TUI (forge without arguments) works fine — this only affects the zsh plugin path.

Environment

  • Terminal: Ghostty
  • Shell: zsh
  • OS: Linux (NixOS)
  • Other terminals tested: GNOME Console — works correctly

Root Cause

The issue is in _forge_reset() (shell-plugin/lib/helpers.zsh:85-92):

function _forge_reset() {
  BUFFER=""
  CURSOR=0
  zle -I
  zle reset-prompt
}

After _forge_exec_interactive writes forge output directly to /dev/tty, zle reset-prompt redraws the prompt at zle's tracked cursor position — which is above the forge output. This causes the prompt to overwrite the response text, making it appear to blink and vanish.

Thinking traces survive because they scroll above the overwrite zone; the actual response at the bottom gets clobbered.

This appears to be Ghostty-specific. Ghostty is one of the terminals where OSC 133 semantic markers are auto-enabled (context.zsh:41). These markers may interact with Ghostty's cursor/scroll handling in a way that amplifies the overwrite behavior.

Workaround

Overriding _forge_reset after loading the forge plugin in .zshrc:

# After eval "$(forge zsh plugin)"
function _forge_reset() {
  BUFFER=""
  CURSOR=0
  zle .accept-line
}

zle .accept-line submits the now-empty buffer normally, printing a newline and drawing a fresh prompt at the bottom of the output (after forge's response), instead of redrawing in-place.

Suggested Fix

Consider replacing zle reset-prompt with zle .accept-line in _forge_reset() in shell-plugin/lib/helpers.zsh. Alternatively, investigate whether OSC 133 markers in Ghostty are causing unexpected cursor repositioning that makes reset-prompt destructive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity: highSignificant impact; core functionality is impaired.type: bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions