Skip to content

fix(ghostel): support ghostel >= 0.22.0 (ghostel--copy-mode-active removed) - #142

Open
dsdshcym wants to merge 1 commit into
stevemolitor:mainfrom
dsdshcym:fix/ghostel-input-mode-compat
Open

fix(ghostel): support ghostel >= 0.22.0 (ghostel--copy-mode-active removed)#142
dsdshcym wants to merge 1 commit into
stevemolitor:mainfrom
dsdshcym:fix/ghostel-input-mode-compat

Conversation

@dsdshcym

Copy link
Copy Markdown

Problem

After upgrading ghostel past commit bdd2b85 (v0.22.0, "Add eat-style input modes"), claude-code buffers are stuck at 80 columns wide.

Root cause

ghostel bdd2b85 removed ghostel--copy-mode-active and replaced it with ghostel--input-mode. The three ghostel backend methods still referenced the old variable.

When claude-code--adjust-window-size-advice fires during window resize, it calls claude-code--term-in-read-only-pghostel--copy-mode-activevoid-variable error. This error is silently swallowed by Emacs's C-level window resize callback, causing the advice to return nil and suppress SIGWINCH.

Without SIGWINCH, Claude Code's PTY is never notified of the correct terminal width and stays at the 80-column fallback set at spawn time. (The buffer is not yet displayed in any window when ghostel-exec is called, so it falls back to 80×24.)

Note: ghostel's libghostty internal model does resize correctly — only Claude Code's PTY signal is suppressed, so output wraps at 80 columns even in a wider window.

What changed in ghostel

Old (< 0.22.0) New (>= 0.22.0)
ghostel--copy-mode-active (bool) ghostel--input-mode (symbol: semi-char/char/emacs/copy/line)
ghostel-copy-mode-exit ghostel-readonly-exit

Fix

  • Extract claude-code--ghostel-in-copy-mode-p helper that detects the API version at runtime
  • New API: (memq ghostel--input-mode '(copy emacs)) (>= 0.22.0)
  • Old API fallback: (bound-and-true-p ghostel--copy-mode-active) (< 0.22.0)
  • ghostel-copy-mode-exitghostel-readonly-exit with fboundp guard for backward compat

Test plan

  • Launch claude-code with ghostel >= 0.22.0 — buffer should use full window width (not 80 cols)
  • Copy mode (ghostel-copy-mode) still works (read-only detection correct)
  • Exiting copy mode works and restores keymap
  • Verify still works with old ghostel (< 0.22.0) via bound-and-true-p / fboundp guards

🤖 Generated with Claude Code

…mode-active with ghostel--input-mode

ghostel commit bdd2b85 ("Add eat-style input modes") removed `ghostel--copy-mode-active`
and replaced it with `ghostel--input-mode`.  The three ghostel backend methods that
referenced the old variable caused a `void-variable` error when called against new ghostel.

This error was silently swallowed by Emacs's C-level window resize callback, causing
`claude-code--adjust-window-size-advice` to return nil and suppress SIGWINCH.  As a
result, Claude Code's PTY was never notified of the correct terminal width and stayed at
the 80-column fallback set at spawn time (the buffer is not yet displayed in any window
when `ghostel-exec` is called, so it falls back to 80×24).

Fix: extract `claude-code--ghostel-in-copy-mode-p` helper that checks for
`ghostel--input-mode` first (>= 0.22.0: `(memq ghostel--input-mode '(copy emacs))`)
and falls back to `(bound-and-true-p ghostel--copy-mode-active)` for older ghostel.
Also handle `ghostel-copy-mode-exit` → `ghostel-readonly-exit` rename with an `fboundp`
guard so both old and new ghostel work.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dustinfarris

Copy link
Copy Markdown

@stevemolitor does this look ok to you? should it be a breaking change like #136?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants