@@ -1079,7 +1079,7 @@ fn select_all(cx: &mut Context) {
10791079}
10801080
10811081fn select_regex(cx: &mut Context) {
1082− let prompt = ui::regex_prompt(cx, "select:".to_string(), move |view, doc, _, regex| {
1082+ let prompt = ui::regex_prompt(cx, "select:".into(), move |view, doc, _, regex| {
10831083 let text = doc.text().slice(..);
10841084 if let Some(selection) = selection::select_on_matches(text, doc.selection(view.id), ®ex)
10851085 {
@@ -1091,7 +1091,7 @@ fn select_regex(cx: &mut Context) {
10911091}
10921092
10931093fn split_selection(cx: &mut Context) {
1094− let prompt = ui::regex_prompt(cx, "split:".to_string(), move |view, doc, _, regex| {
1094+ let prompt = ui::regex_prompt(cx, "split:".into(), move |view, doc, _, regex| {
10951095 let text = doc.text().slice(..);
10961096 let selection = selection::split_on_matches(text, doc.selection(view.id), ®ex);
10971097 doc.set_selection(view.id, selection);
@@ -1157,15 +1157,11 @@ fn search(cx: &mut Context) {
11571157 // feed chunks into the regex yet
11581158 let contents = doc.text().slice(..).to_string();
11591159
1160− let prompt = ui::regex_prompt(
1161− cx,
1162− "search:".to_string(),
1163− move |view, doc, registers, regex| {
1164− search_impl(doc, view, &contents, ®ex, false);
1165− // TODO: only store on enter (accept), not update
1166− registers.write('/', vec![regex.as_str().to_string()]);
1167− },
1168− );
1160+ let prompt = ui::regex_prompt(cx, "search:".into(), move |view, doc, registers, regex| {
1161+ search_impl(doc, view, &contents, ®ex, false);
1162+ // TODO: only store on enter (accept), not update
1163+ registers.write('/', vec![regex.as_str().to_string()]);
1164+ });
11691165
11701166 cx.push_layer(Box::new(prompt));
11711167}
@@ -2210,7 +2206,7 @@ mod cmd {
22102206
22112207fn command_mode(cx: &mut Context) {
22122208 let mut prompt = Prompt::new(
2213− ":".to_owned(),
2209+ ":".into(),
22142210 Some(':'),
22152211 |input: &str| {
22162212 // we use .this over split_whitespace() because we care about empty segments
@@ -3819,7 +3815,7 @@ fn join_selections(cx: &mut Context) {
38193815
38203816fn keep_selections(cx: &mut Context) {
38213817 // keep selections matching regex
3822− let prompt = ui::regex_prompt(cx, "keep:".to_string(), move |view, doc, _, regex| {
3818+ let prompt = ui::regex_prompt(cx, "keep:".into(), move |view, doc, _, regex| {
38233819 let text = doc.text().slice(..);
38243820
38253821 if let Some(selection) = selection::keep_matches(text, doc.selection(view.id), ®ex) {
@@ -4307,26 +4303,26 @@ enum ShellBehavior {
43074303}
43084304
43094305fn shell_pipe(cx: &mut Context) {
4310− shell(cx, "pipe:", ShellBehavior::Replace);
4306+ shell(cx, "pipe:".into(), ShellBehavior::Replace);
43114307}
43124308
43134309fn shell_pipe_to(cx: &mut Context) {
4314− shell(cx, "pipe-to:", ShellBehavior::Ignore);
4310+ shell(cx, "pipe-to:".into(), ShellBehavior::Ignore);
43154311}
43164312
43174313fn shell_insert_output(cx: &mut Context) {
4318− shell(cx, "insert-output:", ShellBehavior::Insert);
4314+ shell(cx, "insert-output:".into(), ShellBehavior::Insert);
43194315}
43204316
43214317fn shell_append_output(cx: &mut Context) {
4322− shell(cx, "append-output:", ShellBehavior::Append);
4318+ shell(cx, "append-output:".into(), ShellBehavior::Append);
43234319}
43244320
43254321fn shell_keep_pipe(cx: &mut Context) {
4326− shell(cx, "keep-pipe:", ShellBehavior::Filter);
4322+ shell(cx, "keep-pipe:".into(), ShellBehavior::Filter);
43274323}
43284324
4329−fn shell(cx: &mut Context, prompt: &str, behavior: ShellBehavior) {
4325+fn shell(cx: &mut Context, prompt: Cow<'static, str>, behavior: ShellBehavior) {
43304326 use std::io::Write;
43314327 use std::process::{Command, Stdio};
43324328 if cx.editor.config.shell.is_empty() {
@@ -4338,7 +4334,7 @@ fn shell(cx: &mut Context, prompt: &str, behavior: ShellBehavior) {
43384334 ShellBehavior::Insert | ShellBehavior::Append => false,
43394335 };
43404336 let prompt = Prompt::new(
4341− prompt.to_owned(),
4337+ prompt,
43424338 Some('|'),
43434339 |_input: &str| Vec::new(),
43444340 move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
@@ -4408,9 +4404,8 @@ fn shell(cx: &mut Context, prompt: &str, behavior: ShellBehavior) {
44084404 }
44094405 }
44104406
4411− let transaction = Transaction::change(doc.text(), changes.into_iter());
4412−
44134407 if behavior != ShellBehavior::Ignore {
4408+ let transaction = Transaction::change(doc.text(), changes.into_iter());
44144409 doc.apply(&transaction, view.id);
44154410 doc.append_changes_to_history(view.id);
44164411 }