@@ -4803,15 +4803,24 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) {
4803 let mut ranges = SmallVec::with_capacity(selection.len());
4803 let mut ranges = SmallVec::with_capacity(selection.len());
4804 let text = doc.text().slice(..);
4804 let text = doc.text().slice(..);
4806+ let mut shell_output: Option<Tendril> = None;
4806 let mut offset = 0isize;
4807 let mut offset = 0isize;
4808 for range in selection.ranges() {
4808 for range in selection.ranges() {
4809+ let (output, success) = if let Some(output) = shell_output.as_ref() {
4810+ (output.clone(), true)
4809− let fragment = range.slice(text);
4812+ let fragment = range.slice(text);
4810− let (output, success) = match shell_impl(shell, cmd, pipe.then(|| fragment.into())) {
4813+ match shell_impl(shell, cmd, pipe.then(|| fragment.into())) {
4811− Ok(result) => result,
4814+ Ok(result) => {
4816+ shell_output = Some(result.0.clone());
4812− Err(err) => {
4820+ Err(err) => {
4813− cx.editor.set_error(err.to_string());
4821+ cx.editor.set_error(err.to_string());
4814− return;
4822+ return;