Add select.rs to the new helix directory

This commit is contained in:
fantacell 2025-07-09 12:45:32 +02:00
parent 63771f1f1b
commit 5d4cd65c6b
3 changed files with 1 additions and 30 deletions

View file

@ -1,4 +1,5 @@
mod object;
mod select;
use editor::{DisplayPoint, Editor, movement};
use gpui::{Action, actions};

View file

@ -7,7 +7,6 @@ mod paste;
pub(crate) mod repeat;
mod scroll;
pub(crate) mod search;
mod select;
pub mod substitute;
mod toggle_comments;
pub(crate) mod yank;

View file

@ -1,29 +0,0 @@
use text::SelectionGoal;
use ui::{Context, Window};
use crate::{Vim, object::Object};
impl Vim {
/// Selects the text object each cursor is over.
pub fn select_object(
&mut self,
object: Object,
around: bool,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.stop_recording(cx);
self.update_editor(window, cx, |_, editor, window, cx| {
editor.change_selections(Default::default(), window, cx, |s| {
s.move_with(|map, selection| {
let Some(range) = object.helix_range(map, selection.clone(), around) else {
return;
};
selection.set_head(range.end, SelectionGoal::None);
selection.start = range.start;
});
});
});
}
}