Skip to content

Make copy selection report failure without selection - #1166

Open
catlover-bot wants to merge 1 commit into
nushell:mainfrom
catlover-bot:fix-until-copy-selection
Open

Make copy selection report failure without selection#1166
catlover-bot wants to merge 1 commit into
nushell:mainfrom
catlover-bot:fix-until-copy-selection

Conversation

@catlover-bot

Copy link
Copy Markdown

Summary

Make CopySelection and CopySelectionSystem report whether they actually had a selection to copy, and propagate that status through ReedlineEvent::Edit so UntilFound can continue when there is no active selection.

This follows the direction discussed in #876 of making edit operations explicit about their success/failure state. This PR intentionally limits that behavior to the two copy-selection commands; broader edit-command status semantics and ExecuteHostCommand are out of scope.

Observable behavior changes only for UntilFound chains containing CopySelection or CopySelectionSystem.

Before

ReedlineEvent::Edit was always treated as Handled, even when CopySelection or CopySelectionSystem had no active selection. As a result, an UntilFound chain stopped at the copy command and never tried a fallback event such as CtrlC.

After

CopySelection and CopySelectionSystem return failure when no selection is active. ReedlineEvent::Edit converts that result to EventStatus::Inapplicable, allowing UntilFound to try the next event. When a selection exists, the copy command remains handled and the chain stops as before.

Regression tests cover both copy commands with and without an active selection.

Additional notes

Addresses the CopySelection / CopySelectionSystem portion of #876.

Validation performed locally:

  • cargo fmt --all -- --check
  • cargo clippy --locked --all-targets --all-features
  • cargo test --all --all-features -- --test-threads=1 (1528 passed, 1 ignored; doctests: 30 passed)
  • git diff --check

A local cargo nextest run --all --all-features hang was observed in deferred-completion tests. The same class of tty cursor-query hang is being addressed separately in #1156, and the affected test passes immediately under cargo test --all-features.

@catlover-bot
catlover-bot marked this pull request as ready for review August 18, 2026 10:08
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