forgecode icon indicating copy to clipboard operation
forgecode copied to clipboard

fix(zsh): stop the prompt redraw from clobbering action output

Open bogdanr opened this issue 5 months ago • 4 comments

Fixes #3468.

The zsh integration clips the last lines of a response on kitty + p10k. _forge_reset runs after the output is already on the tty, but ZLE still has the cursor on the old prompt row, so zle reset-prompt redraws the prompt over it and the response looks cut off.

Buffer is always empty in _forge_reset, so accepting the empty line gives a clean prompt below the output:

function _forge_reset() {
  BUFFER=""
  CURSOR=0
  zle .accept-line
}

Left the other reset-prompt callers (suggest/commit-preview/completion) as-is since they populate the buffer and redraw in place.

Same root cause as #3144/#2893; #3178 fixed the spinner but not this path. Tested on kitty + Powerlevel10k, and suggest/commit/completion still behave.

bogdanr avatar Jun 08 '26 05:06 bogdanr

@bogdanr Text is still getting clipped.

Screenshot 2026-06-08 at 4 25 33 PM

tusharmath avatar Jun 08 '26 10:06 tusharmath

Updated the branch with the follow-up fix.

The previous change avoided reset-prompt at the end, but the old prompt/RPROMPT could still stay active while Forge was writing output. With long wrapped output, that could still make the last row look clipped.

This version clears and invalidates the active ZLE prompt before Forge writes output, then the final reset moves to a clean line without calling accept-line, so p10k/RPROMPT doesn’t repaint over the last output row.

Retested with the same reverse-text case and it looks good now. a

bogdanr avatar Jun 08 '26 12:06 bogdanr

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 08 '26 13:06 CLAassistant

Action required: PR inactive for 5 days. Status update or closure in 10 days.

github-actions[bot] avatar Jun 16 '26 05:06 github-actions[bot]

PR closed after 10 days of inactivity.

github-actions[bot] avatar Jun 26 '26 23:06 github-actions[bot]