@@ -612,8 +612,11 @@ fn _search(doc: &mut Document, view_id: ViewId, contents: &str, regex: &Regex) {
612612 let text = doc.text();
613613 let start = doc.selection(view_id).cursor();
614614
615− // TODO: use find_at to find the next match after the cursor, loop around the end
616− if let Some(mat) = regex.find_at(contents, start) {
615+ // use find_at to find the next match after the cursor, loop around the end
616+ let mat = regex
617+ .find_at(contents, start)
618+ .or_else(|| regex.find(contents));
619+ if let Some(mat) = mat {
617620 let start = text.byte_to_char(mat.start());
618621 let end = text.byte_to_char(mat.end());
619622 let selection = Selection::single(start, end - 1);