aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/actions.rs
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-06 15:36:35 +0200
committerGitHub <noreply@github.com>2026-09-06 15:36:35 +0200
commit5a64e8da4551990367dd26d77cf3b654dfa27a73 (patch)
treed7eaf5f4143cb7b0d34bfe73dd3d1ea315fa6c1a /src/client/shell/actions.rs
parente366a05f03b6e37549c7a1744c3551553017c541 (diff)
fix: consume failed selection copies without interrupting agents (#3681)
Diffstat (limited to 'src/client/shell/actions.rs')
-rw-r--r--src/client/shell/actions.rs46
1 files changed, 4 insertions, 42 deletions
diff --git a/src/client/shell/actions.rs b/src/client/shell/actions.rs
index f99d8f3a..e62d75ff 100644
--- a/src/client/shell/actions.rs
+++ b/src/client/shell/actions.rs
@@ -248,14 +248,6 @@ impl ClientShellState {
}
pub(super) fn request_selection_copy(&mut self, outcome: &mut ClientShellInput) {
- self.request_selection_copy_with_fallback(outcome, None);
- }
-
- pub(super) fn request_selection_copy_with_fallback(
- &mut self,
- outcome: &mut ClientShellInput,
- fallback_key: Option<crate::input::TerminalKey>,
- ) {
let Some(selection) = self.selection.as_ref() else {
return;
};
@@ -266,27 +258,6 @@ impl ClientShellState {
.and_then(|surface| surface.panes.iter().find(|pane| pane.pane_id == pane_id))
.map(|pane| pane.content_revision);
let (anchor, cursor) = selection.ordered_cells();
- let fallback = fallback_key.and_then(|key| {
- let press = ClientPaneInputEvent::from_terminal_key(key.clone())?;
- let tracks_release = matches!(
- &press,
- ClientPaneInputEvent::Key {
- tracks_release: true,
- ..
- }
- );
- let mut message =
- super::target_event_message(ClientInputTarget::Pane(pane_id.clone()), press);
- if tracks_release {
- let release = ClientPaneInputEvent::from_terminal_key(
- key.with_kind(crossterm::event::KeyEventKind::Release),
- )?;
- if let ClientMessage::ClientShellPaneInput { events, .. } = &mut message {
- events.push(release);
- }
- }
- Some(message)
- });
self.push_endpoint_method_with_kind(
crate::api::schema::Method::PaneSelectionRead(
crate::api::schema::PaneSelectionReadParams {
@@ -302,7 +273,7 @@ impl ClientShellState {
content_revision,
},
),
- PendingEndpointKind::SelectionCopy { fallback },
+ PendingEndpointKind::SelectionCopy,
outcome,
);
}
@@ -654,13 +625,7 @@ impl ClientShellState {
let repaint = self.complete_pane_scroll(pane_id, serial, result, &mut outcome);
return (repaint, outcome.actions);
}
- PendingEndpointKind::SelectionCopy { fallback } => {
- let fallback = || {
- fallback
- .map(ClientShellAction::Request)
- .into_iter()
- .collect::<Vec<_>>()
- };
+ PendingEndpointKind::SelectionCopy => {
return match result {
Ok(crate::api::schema::ResponseResult::PaneSelection { text, .. })
if !text.is_empty() =>
@@ -672,17 +637,14 @@ impl ClientShellState {
)
}
Ok(crate::api::schema::ResponseResult::PaneSelection { .. }) => {
- (false, fallback())
+ (false, Vec::new())
}
Ok(_) => {
self.endpoint_error =
Some("endpoint returned an unexpected selection result".to_owned());
- (true, fallback())
- }
- Err(error) if error.code.as_deref() == Some("endpoint_cancelled") => {
(true, Vec::new())
}
- Err(_) => (true, fallback()),
+ Err(_) => (true, Vec::new()),
};
}
PendingEndpointKind::WordSelection {