Skip to content

Include prompts in terminal block copy#10181

Open
gabrimatic wants to merge 3 commits into
warpdotdev:masterfrom
gabrimatic:gabrimatic/copy-block-includes-prompt
Open

Include prompts in terminal block copy#10181
gabrimatic wants to merge 3 commits into
warpdotdev:masterfrom
gabrimatic:gabrimatic/copy-block-includes-prompt

Conversation

@gabrimatic
Copy link
Copy Markdown
Contributor

@gabrimatic gabrimatic commented May 5, 2026

Description

  • Updates the terminal block Copy action to preserve the existing command + output behavior when the block uses Warp's built-in prompt.
  • Includes the shell prompt and right prompt when the copied block was captured with a custom PS1 prompt.
  • Reuses the block model's grid ordering for PS1 blocks so prompt, command, right prompt, and output stay in block-selection order.
  • Adds regression coverage for both prompt modes, including integration coverage through the block context-menu Copy action.

Linked Issue

Screenshots / Videos

Linux/Xvfb renderer recordings from the integration copy flow:

Warp prompt (HonorPS1=false):
Warp prompt copy frame
Short video: pr10181-warp-prompt-copy.mp4

PS1 prompt (HonorPS1=true):
PS1 copy frame
Short video: pr10181-ps1-copy.mp4

Testing

  • cargo fmt --check
  • git diff --check
  • cargo nextest run -p warp test_command_and_output_to_string
  • WARP_SHELL_PATH=/bin/zsh cargo run -p integration -- test_copy_block_command_and_output_honor_ps1_disabled
  • WARP_SHELL_PATH=/bin/zsh cargo run -p integration -- test_copy_block_command_and_output_honor_ps1_enabled
  • WARP_SHELL_PATH=/bin/zsh cargo test -p integration test_copy_block_command_and_output -- --nocapture
  • Linux/Xvfb renderer recording: WARP_INTEGRATION_TEST_VIDEO=1 WGPU_BACKEND=vulkan WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1 WARP_SHELL_PATH=/bin/zsh cargo test -p integration test_copy_block_command_and_output -- --nocapture --test-threads=1

@cla-bot cla-bot Bot added the cla-signed label May 5, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 5, 2026

@gabrimatic

I'm starting a first review of this pull request.

I reviewed this pull request and requested human review from: @warpdotdev/oss-maintainers.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 5, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR changes the block copy path to serialize the full block via the block model's grid ordering, so prompts, commands, right prompts, and output are copied consistently with block selection behavior.

Concerns

  • No blocking correctness, security, or error-handling concerns found in the annotated diff.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot requested review from a team and lucieleblanc and removed request for a team May 5, 2026 19:59
@gabrimatic gabrimatic force-pushed the gabrimatic/copy-block-includes-prompt branch from c4e13eb to a23865f Compare May 8, 2026 01:21
Copy link
Copy Markdown
Contributor

@lucieleblanc lucieleblanc left a comment

Choose a reason for hiding this comment

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

Hi @gabrimatic, thank you for the PR!

The "copy" action hasn't included the shell prompt or right prompt since March 2022; this isn't a regression. That said, we did recently migrate settings to a file, which may have inadvertently switched your shell prompt back from a custom PS1 to Warp's built-in prompt. Could switching back to PS1 be what you're looking for?

Otherwise, I'd prefer to gate this change on the user's prompt selection; if the user is using a custom PS1, including their prompt in the "copy" action seems reasonable. Otherwise, if they're using the built-in prompt, we should preserve the existing behavior and only include the command + output in the "copy" action.

Please do include a screen recording to demonstrate you've tested this feature locally!

@gabrimatic
Copy link
Copy Markdown
Contributor Author

Hi @lucieleblanc, thanks for the review. I updated this to gate the behavior on the block prompt mode:

  • built-in Warp prompt: Copy keeps the existing command + output behavior
  • custom PS1 prompt: Copy includes the shell prompt, right prompt, command, and output

I also added focused coverage for both prompt modes and re-ran:

  • cargo fmt --check
  • cargo nextest run -p warp test_command_and_output_to_string
  • cargo nextest run -p warp test_copy_blocks

I still need to add the short local screen recording you asked for; I will follow up with that separately.

@gabrimatic
Copy link
Copy Markdown
Contributor Author

@lucieleblanc follow-up from the local built app at 44b53cf.

I verified the copy behavior in both prompt modes. The clipboard contents were:

Built-in Warp prompt:

printf 'WARP_PROMPT_OUTPUT\n'
WARP_PROMPT_OUTPUT

Shell prompt / PS1:

soroush@Mini ~ % printf 'PS1_NEW_TAB_OUTPUT\n'
PS1_NEW_TAB_OUTPUT

I also checked the prompt-switch path: after switching to PS1, the next PS1-captured block includes the shell prompt as expected, while an already-started block keeps the previous block prompt mode. That matches this patch using each block's honor_ps1 value.

I am not calling this ready for re-review yet because the requested screen recording is still not attached. I will add that separately once I can capture it cleanly.

@gabrimatic
Copy link
Copy Markdown
Contributor Author

@lucieleblanc I pushed one more commit (d3dd1ef) with integration coverage for the exact block Copy path in both prompt modes:

  • built-in Warp prompt: context-menu Copy asserts clipboard is command + output
  • Shell prompt / PS1: context-menu Copy asserts clipboard is prompt + command + output

I ran:

  • WARP_SHELL_PATH=/bin/zsh cargo run -p integration -- test_copy_block_command_and_output_honor_ps1_disabled
  • WARP_SHELL_PATH=/bin/zsh cargo run -p integration -- test_copy_block_command_and_output_honor_ps1_enabled
  • WARP_SHELL_PATH=/bin/zsh cargo test -p integration test_copy_block_command_and_output -- --nocapture

This is in addition to the focused model tests. The requested screen recording is still pending, so I am leaving the PR marked as not ready for re-review until that is attached.

@gabrimatic
Copy link
Copy Markdown
Contributor Author

@lucieleblanc I added the requested visual evidence to the PR body.

Warp prompt (HonorPS1=false):

PS1 prompt (HonorPS1=true):

These were captured from the Linux/Xvfb renderer-recorded integration run at d3dd1ef. The run exercises the block context-menu Copy action in both modes and passed:

  • built-in Warp prompt: Copy asserts clipboard is command + output
  • shell prompt / PS1: Copy asserts clipboard is prompt + command + output
  • WARP_INTEGRATION_TEST_VIDEO=1 WGPU_BACKEND=vulkan WARPUI_USE_REAL_DISPLAY_IN_INTEGRATION_TESTS=1 WARP_SHELL_PATH=/bin/zsh cargo test -p integration test_copy_block_command_and_output -- --nocapture --test-threads=1 passed 2/2

Ready for re-review.

@gabrimatic gabrimatic force-pushed the gabrimatic/copy-block-includes-prompt branch from d3dd1ef to 14227a0 Compare May 9, 2026 20:57
@gabrimatic
Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 10, 2026

@gabrimatic

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @warpdotdev/oss-maintainers.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR updates the block context-menu Copy action so custom PS1 blocks copy prompt, command, right prompt, and output in the block model's grid order while preserving the existing command-plus-output behavior for Warp's built-in prompt. The added unit and integration coverage exercises both prompt modes through the model helper and UI copy flow.

Concerns

  • None.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot requested review from a team and peicodes and removed request for a team May 10, 2026 23:13
@peicodes peicodes removed their request for review May 12, 2026 15:58
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Hi @gabrimatic — a reviewer requested changes on this PR and it hasn't had activity from you in 25 days. When you get a chance, please push updates or reply to the review so a reviewer can take another look. Without activity, this PR will be automatically closed after 30 days of inactivity.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

Hi @gabrimatic — final reminder: a reviewer requested changes on this PR and it has been inactive for 26 days. It will be automatically closed in about 4 day(s) unless you push updates or reply. Maintainers can apply the no-autoclose label to keep it open.

@gabrimatic gabrimatic force-pushed the gabrimatic/copy-block-includes-prompt branch from 14227a0 to 9fdc68a Compare June 6, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Regression] Three-dots → Copy excludes terminal prompt line from block

2 participants