@@ -766,7 +766,7 @@ fn trim_selections(cx: &mut Context) {
766766 .selection(view.id)
767767 .iter()
768768 .filter_map(|range| {
769− if range.is_empty() || range.fragment(text).chars().all(|ch| ch.is_whitespace()) {
769+ if range.is_empty() || range.slice(text).chars().all(|ch| ch.is_whitespace()) {
770770 return None;
771771 }
772772 let mut start = range.from();
@@ -1289,12 +1289,12 @@ fn replace(cx: &mut Context) {
12891289
12901290fn switch_case_impl<F>(cx: &mut Context, change_fn: F)
12911291where
1292− F: Fn(Cow<str>) -> Tendril,
1292+ F: Fn(RopeSlice) -> Tendril,
12931293{
12941294 let (view, doc) = current!(cx.editor);
12951295 let selection = doc.selection(view.id);
12961296 let transaction = Transaction::change_by_selection(doc.text(), selection, |range| {
1297− let text: Tendril = change_fn(range.fragment(doc.text().slice(..)));
1297+ let text: Tendril = change_fn(range.slice(doc.text().slice(..)));
12981298
12991299 (range.from(), range.to(), Some(text))
13001300 });
@@ -1320,11 +1320,15 @@ fn switch_case(cx: &mut Context) {
13201320}
13211321
13221322fn switch_to_uppercase(cx: &mut Context) {
1323− switch_case_impl(cx, |string| string.to_uppercase().into());
1323+ switch_case_impl(cx, |string| {
1324+ string.chunks().map(|chunk| chunk.to_uppercase()).collect()
1325+ });
13241326}
13251327
13261328fn switch_to_lowercase(cx: &mut Context) {
1327− switch_case_impl(cx, |string| string.to_lowercase().into());
1329+ switch_case_impl(cx, |string| {
1330+ string.chunks().map(|chunk| chunk.to_lowercase()).collect()
1331+ });
13281332}
13291333
13301334pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
@@ -3903,8 +3907,8 @@ fn rotate_selection_contents(cx: &mut Context, direction: Direction) {
39033907
39043908 let selection = doc.selection(view.id);
39053909 let mut fragments: Vec<_> = selection
3906− .fragments(text)
3907− .map(|fragment| Tendril::from(fragment.as_ref()))
3910+ .slices(text)
3911+ .map(|fragment| fragment.chunks().collect())
39083912 .collect();
39093913
39103914 let group = count
@@ -4510,8 +4514,8 @@ fn shell_keep_pipe(cx: &mut Context) {
45104514 let text = doc.text().slice(..);
45114515
45124516 for (i, range) in selection.ranges().iter().enumerate() {
4513− let fragment = range.fragment(text);
4514− let (_output, success) = match shell_impl(shell, input, Some(fragment.as_bytes())) {
4517+ let fragment = range.slice(text);
4518+ let (_output, success) = match shell_impl(shell, input, Some(fragment)) {
45154519 Ok(result) => result,
45164520 Err(err) => {
45174521 cx.editor.set_error(err.to_string());
@@ -4542,7 +4546,7 @@ fn shell_keep_pipe(cx: &mut Context) {
45424546fn shell_impl(
45434547 shell: &[String],
45444548 cmd: &str,
4545− input: Option<&[u8]>,
4549+ input: Option<RopeSlice>,
45464550) -> anyhow::Result<(Tendril, bool)> {
45474551 use std::io::Write;
45484552 use std::process::{Command, Stdio};
@@ -4564,7 +4568,9 @@ fn shell_impl(
45644568 };
45654569 if let Some(input) = input {
45664570 let mut stdin = process.stdin.take().unwrap();
4567− stdin.write_all(input)?;
4571+ for chunk in input.chunks() {
4572+ stdin.write_all(chunk.as_bytes())?;
4573+ }
45684574 }
45694575 let output = process.wait_with_output()?;
45704576
@@ -4593,8 +4599,8 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) {
45934599 let text = doc.text().slice(..);
45944600
45954601 for range in selection.ranges() {
4596− let fragment = range.fragment(text);
4597− let (output, success) = match shell_impl(shell, cmd, pipe.then(|| fragment.as_bytes())) {
4602+ let fragment = range.slice(text);
4603+ let (output, success) = match shell_impl(shell, cmd, pipe.then(|| fragment)) {
45984604 Ok(result) => result,
45994605 Err(err) => {
46004606 cx.editor.set_error(err.to_string());