@@ -307,11 +307,9 @@ pub fn select_all(cx: &mut Context) {
307307pub fn select_regex(cx: &mut Context) {
308308 let prompt = ui::regex_prompt(cx, "select:".to_string(), |doc, regex| {
309309 let text = doc.text().slice(..);
310− // TODO: if select on matches returns empty range, we need to abort
311− // if regex empty or no matches, return
312− let selection =
313− selection::select_on_matches(text, doc.selection(), ®ex).expect("no matches");
314− doc.set_selection(selection);
310+ if let Some(selection) = selection::select_on_matches(text, doc.selection(), ®ex) {
311+ doc.set_selection(selection);
312+ }
315313 });
316314
317315 cx.push_layer(Box::new(prompt));