review this PR for me https://github.com/JanDeDobbeleer/oh-my-posh/pull/7360
- User
review this PR for me https://github.com/JanDeDobbeleer/oh-my-posh/pull/7360
Assistant
Order matches signature correctly. Now let's check how
MultilineKeepPromptis read/threaded inprompt.MultilineKeepPromptin extra.go — need to verify it's the segment's actual config value, not a stray package-level var.Assistant
Good — that path is already generic and just calls
ExtraPrompt(prompt.Secondary), consistent with the PR's diff. That confirms my main finding is isolated to the zsh script logic.Assistant
- User
Add a commen tusing the writing clearly skills
Assistant
Here's the comment I'd post, written per the skill (active voice, concrete, no filler):
_omp_is_buffer_complete()checks the buffer with:zsh -n <<EOF $PREBUFFER$BUFFER EOFThe heredoc terminator is the literal word
EOF. If the buffer itself contains a line readingEOF— for example, the user is typing their owncat <<EOF ... EOFheredoc — the outer heredoc ends there, andzsh -nonly sees the truncated prefix. A genuinely incomplete command (say, one ending in a trailing\) can then be misreported as complete, because the part that would reveal the incompleteness got cut off.I confirmed the truncation with a bash reproduction of the same POSIX heredoc rule: a buffer ending in
\(incomplete) was reported "complete" once an embeddedEOFline truncated it.Effect: the keep-prompt loop can exit early and hand off to the transient prompt while the user is still mid-command — the exact bug this PR fixes, just triggered a different way.
Suggested fix: use a delimiter that can't collide with user input (e.g., a randomly generated marker), or skip heredocs and pipe the buffer instead: .
- User
there are em dahses here?
Assistant
You're right, I missed those. Let me fix them.
Assistant
Here's the corrected version with the em dashes restructured out:
_omp_is_buffer_complete()checks the buffer with:zsh -n <<EOF $PREBUFFER$BUFFER EOFThe heredoc terminator is the literal word
EOF. If the buffer itself contains a line readingEOF(say, the user is typing their owncat <<EOF ... EOFheredoc), the outer heredoc ends there, andzsh -nonly sees the truncated prefix. A genuinely incomplete command, one ending in a trailing\for instance, can then be misreported as complete, because the part that would reveal the incompleteness got cut off.I confirmed the truncation with a bash reproduction of the same POSIX heredoc rule: a buffer ending in
\(incomplete) was reported "complete" once an embeddedEOFline truncated it.Effect: the keep-prompt loop can exit early and hand off to the transient prompt while the user is still mid-command. That's the exact bug this PR fixes, just triggered a different way.
Suggested fix: use a delimiter that can't collide with user input, such as a randomly generated marker, or skip heredocs and pipe the buffer instead:
print -r -- "$PREBUFFER$BUFFER" | zsh -n -.- User
yes
Assistant
Posted: comment on PR #7360.