Skip to content

fix(spinner): replace indicatif with custom terminal-safe spinner implementation#3178

Merged
amitksingh1490 merged 4 commits intomainfrom
fix-ghosty-resize-issue
Apr 27, 2026
Merged

fix(spinner): replace indicatif with custom terminal-safe spinner implementation#3178
amitksingh1490 merged 4 commits intomainfrom
fix-ghosty-resize-issue

Conversation

@amitksingh1490
Copy link
Copy Markdown
Contributor

@amitksingh1490 amitksingh1490 commented Apr 27, 2026

Summary

Replace indicatif with a custom spinner implementation and add proper OSC 133 semantic marker emission for ZLE-dispatched commands to fix scrollback artifacts in Ghostty and Warp Terminal.

Context

The indicatif spinner library uses ANSI escape sequences on stderr that leave artifacts in terminal scrollback buffers — especially noticeable in Ghostty during window resize/reflow. Additionally, ZLE-dispatched Forge commands (commit, suggest, edit) bypass the normal preexec/precmd hooks, so they were not emitting the OSC 133 markers that Ghostty relies on to distinguish prompts from command output.

This also adds WarpTerminal to the list of terminals with known OSC 133 support.

Changes

  • Custom spinner: Replaced indicatif with a purpose-built SpinnerManager that uses direct ANSI control via eprintln and terminal_size for width-aware output. The custom implementation avoids the indicatif artifacts in scrollback and properly cleans up spinner lines.
  • OSC 133 markers for ZLE commands: Added _forge_osc133_emit calls at the start ("B" + "C") and end ("D" + "A") of all ZLE-dispatched command paths in dispatcher.zsh. Previously only the edit action had markers; now every action (commit, suggest, clone, etc.) properly wraps its output.
  • WarpTerminal detection: Added WarpTerminal to the OSC 133 support list in context.zsh alongside WezTerm, iTerm.app, and vscode.
  • Type safety: Added 'static lifetime bounds to ConsoleWriter generic parameters across streaming types for thread safety.

Use Cases

  • Ghostty users: No more garbled scrollback or prompt artifacts on window resize after running Forge commands
  • Warp Terminal users: Semantic markers enable Warp's prompt-aware features (like click-to-navigate output blocks)
  • All users: Cleaner terminal output without indicatif's ANSI residue in scrollback

Testing

# Run unit tests
cargo test -p forge_spinner
cargo test -p forge_main

# Test OSC 133 emission in ZLE
# In Ghostty or Warp:
# 1. Type "forge " and press Alt+Enter (ZLE)
# 2. Check that OSC 133 sequences appear correctly
# 3. Verify window resize doesn't garble the prompt

# Run the ZSH plugin generator test
cargo test -p forge_main -- test_generated_plugin_wraps_zle_commands_with_osc133_markers

Links

  • Previous work: OSC 133 integration for context capture (context.zsh)

fixes #3144
fixes #2893

@github-actions github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Apr 27, 2026
@amitksingh1490 amitksingh1490 force-pushed the fix-ghosty-resize-issue branch from 79f2000 to da9ca2f Compare April 27, 2026 11:42
@amitksingh1490 amitksingh1490 merged commit 5916db2 into main Apr 27, 2026
14 checks passed
@amitksingh1490 amitksingh1490 deleted the fix-ghosty-resize-issue branch April 27, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

1 participant