@@ -307,11 +307,9 @@ pub fn select_all(cx: &mut Context) {
307pub fn select_regex(cx: &mut Context) {
307pub fn select_regex(cx: &mut Context) {
308 let prompt = ui::regex_prompt(cx, "select:".to_string(), |doc, regex| {
308 let prompt = ui::regex_prompt(cx, "select:".to_string(), |doc, regex| {
309 let text = doc.text().slice(..);
309 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
313− selection::select_on_matches(text, doc.selection(), ®ex).expect("no matches");
310+ if let Some(selection) = selection::select_on_matches(text, doc.selection(), ®ex) {
314− doc.set_selection(selection);
311+ doc.set_selection(selection);
317 cx.push_layer(Box::new(prompt));
315 cx.push_layer(Box::new(prompt));