@@ -1,7 +1,7 @@
1use helix_core::{
1use helix_core::{
2 comment, graphemes,
2 comment, graphemes,
3 indent::TAB_WIDTH,
3 indent::TAB_WIDTH,
4− regex::Regex,
4+ regex::{self, Regex},
5 register, selection,
5 register, selection,
6 state::{Direction, Granularity, State},
6 state::{Direction, Granularity, State},
7 ChangeSet, Range, Selection, Tendril, Transaction,
7 ChangeSet, Range, Selection, Tendril, Transaction,
@@ -412,6 +412,15 @@ pub fn search_next(cx: &mut Context) {
415+pub fn search_selection(cx: &mut Context) {
417+ let contents = doc.text().slice(..);
418+ let query = doc.selection().primary().fragment(contents);
419+ let regex = regex::escape(&query);
420+ register::set('\\', vec![regex]);
415// TODO: N -> search_prev
424// TODO: N -> search_prev
416// need to loop around buffer also and show a message
425// need to loop around buffer also and show a message
417// same for no matches
426// same for no matches