Skip to content

Fix Pure prompt redraw markers - #12

Merged
lawrencecchen merged 1 commit into
mainfrom
task-nightly-pure-prompt-followup
Mar 13, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
task-nightly-pure-prompt-followup

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Mar 13, 2026 •

Copy link
Copy Markdown

Restores the redraw-safe OSC 133 marker split for zsh prompt redraws and keeps Pure-style hidden-CR prompts from duplicating the preprompt row.

Validation happened from the parent cmux worktree with the existing Pure redraw regressions and a live tagged cmux repro.


Summary by cubic

Fixes Pure-style prompt redraws by using redraw-safe OSC 133 markers so zsh prompts don’t duplicate the preprompt line. Adds a zle-line-init fallback to emit semantic markers if PS1 is regenerated, and keeps click-to-move disabled when cursor-click-to-move=false.

  • Bug Fixes
    • Use in-band OSC 133;P markers and skip k=s after Pure’s hidden CR to prevent duplicate redraw boundaries on multiline prompts.
    • Emit OSC 133;P;k=i and OSC 133;B at zle-line-init when PS1 lacks our markers, while still honoring cursor-click-to-move=false.

Written for commit 404a3f1. Summary will update on new commits.

Summary by CodeRabbit

  • Shell Integration
    • Improved zsh shell prompt initialization with better handling of multiline prompts containing explicit newlines
    • Enhanced semantic markers for terminal integration that persist even when other plugins modify the shell prompt
    • Adjusted marker behavior during async shell operations to improve responsiveness
    • Refined prompt handling to maintain compatibility with complex configurations

@coderabbitai

coderabbitai Bot commented Mar 13, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba70b36a-0bcd-4587-bb5b-aa26fc59314c

📥 Commits

Reviewing files that changed from the base of the PR and between 1b008f5 and 404a3f1.

📒 Files selected for processing (1)
  • src/shell-integration/zsh/ghostty-integration

📝 Walkthrough

Walkthrough

Updates the zsh Ghostty shell integration to use new semantic prompt markers based on OSC 133 sequences, introduces a line-init hook function for marker emission, and enhances multiline prompt handling with updated marker semantics.

Changes

Cohort / File(s) Summary
Zsh Shell Integration Marker Scheme Update
src/shell-integration/zsh/ghostty-integration
Replaces mark1/mark2 scheme with markA (OSC 133 P) and introduces _ghostty_zle_line_init hook to emit semantic markers at line initialization. Adjusts multiline prompt handling to work with new OSC 133-based markers and updates PS1/PS2 substitutions in precmd/preexec paths. Adds conditional fresh-line marker emission during async redraws and preserves existing shell integrations (path, sudo, ssh) with updated marker semantics.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 The markers shimmer, bright and bold,
OSC 133 stories to be told,
Line-init hooks skip into place,
Ghostty prompts with style and grace! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task-nightly-pure-prompt-followup
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lawrencecchen
lawrencecchen force-pushed the task-nightly-pure-prompt-followup branch from 51cad05 to 404a3f1 Compare March 13, 2026 12:48
@lawrencecchen
lawrencecchen merged commit b9989c1 into main Mar 13, 2026
39 of 41 checks passed
@lawrencecchen
lawrencecchen deleted the task-nightly-pure-prompt-followup branch March 13, 2026 12:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51cad05140

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +159 to +160
if [[ $PS1 == *$'\n%{\r%}'* ]]; then
:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve k=s marking for multiline Pure-derived prompts

The new if [[ $PS1 == *$'\n%{\r%}'* ]]; then : branch skips continuation-mark insertion for the entire prompt whenever that hidden-CR pattern appears, so any prompt that uses Pure’s \n%{\r%} trick and has additional newline-separated segments will lose k=s markers on those later lines. In those setups, Ghostty no longer receives explicit continuation boundaries for the extra prompt rows, which can break prompt redraw/click-to-move behavior for multiline prompts.

Useful? React with 👍 / 👎.

ianblenke pushed a commit to ianblenke/ghostty that referenced this pull request Mar 31, 2026
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.

1 participant