Merge branch 'main' into vim-visual-selection

This commit is contained in:
Conrad Irwin 2023-08-14 15:06:59 -06:00
commit fb90eada70
199 changed files with 6473 additions and 3725 deletions

View file

@ -10,7 +10,7 @@ pub fn init(cx: &mut AppContext) {
fn focused(EditorFocused(editor): &EditorFocused, cx: &mut AppContext) {
if let Some(previously_active_editor) = Vim::read(cx).active_editor.clone() {
cx.update_window(previously_active_editor.window_id(), |cx| {
previously_active_editor.window().update(cx, |cx| {
Vim::update(cx, |vim, cx| {
vim.update_active_editor(cx, |previously_active_editor, cx| {
vim.unhook_vim_settings(previously_active_editor, cx)
@ -19,7 +19,7 @@ fn focused(EditorFocused(editor): &EditorFocused, cx: &mut AppContext) {
});
}
cx.update_window(editor.window_id(), |cx| {
editor.window().update(cx, |cx| {
Vim::update(cx, |vim, cx| {
vim.set_active_editor(editor.clone(), cx);
});
@ -27,7 +27,7 @@ fn focused(EditorFocused(editor): &EditorFocused, cx: &mut AppContext) {
}
fn blurred(EditorBlurred(editor): &EditorBlurred, cx: &mut AppContext) {
cx.update_window(editor.window_id(), |cx| {
editor.window().update(cx, |cx| {
Vim::update(cx, |vim, cx| {
if let Some(previous_editor) = vim.active_editor.clone() {
if previous_editor == editor.clone() {
@ -41,7 +41,7 @@ fn blurred(EditorBlurred(editor): &EditorBlurred, cx: &mut AppContext) {
}
fn released(EditorReleased(editor): &EditorReleased, cx: &mut AppContext) {
cx.update_window(editor.window_id(), |cx| {
editor.window().update(cx, |cx| {
cx.update_default_global(|vim: &mut Vim, _| {
if let Some(previous_editor) = vim.active_editor.clone() {
if previous_editor == editor.clone() {

View file

@ -20,7 +20,7 @@ impl ModeIndicator {
if let Some(mode_indicator) = handle.upgrade(cx) {
match event {
VimEvent::ModeChanged { mode } => {
cx.update_window(mode_indicator.window_id(), |cx| {
mode_indicator.window().update(cx, |cx| {
mode_indicator.update(cx, move |mode_indicator, cx| {
mode_indicator.set_mode(mode, cx);
})

View file

@ -93,7 +93,7 @@ fn search_submit(workspace: &mut Workspace, _: &SearchSubmit, cx: &mut ViewConte
pane.update(cx, |pane, cx| {
if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() {
search_bar.update(cx, |search_bar, cx| {
let mut state = &mut vim.state.search;
let state = &mut vim.state.search;
let mut count = state.count;
// in the case that the query has changed, the search bar
@ -222,7 +222,7 @@ mod test {
});
search_bar.read_with(cx.cx, |bar, cx| {
assert_eq!(bar.query_editor.read(cx).text(cx), "cc");
assert_eq!(bar.query(cx), "cc");
});
deterministic.run_until_parked();

View file

@ -99,7 +99,7 @@ async fn test_buffer_search(cx: &mut gpui::TestAppContext) {
});
search_bar.read_with(cx.cx, |bar, cx| {
assert_eq!(bar.query_editor.read(cx).text(cx), "");
assert_eq!(bar.query(cx), "");
})
}
@ -175,7 +175,7 @@ async fn test_selection_on_search(cx: &mut gpui::TestAppContext) {
});
search_bar.read_with(cx.cx, |bar, cx| {
assert_eq!(bar.query_editor.read(cx).text(cx), "cc");
assert_eq!(bar.query(cx), "cc");
});
// wait for the query editor change event to fire.

View file

@ -85,9 +85,9 @@ impl<'a> VimTestContext<'a> {
}
pub fn set_state(&mut self, text: &str, mode: Mode) -> ContextHandle {
let window_id = self.window_id;
let window = self.window;
let context_handle = self.cx.set_state(text);
self.update_window(window_id, |cx| {
window.update(self.cx.cx.cx, |cx| {
Vim::update(cx, |vim, cx| {
vim.switch_mode(mode, true, cx);
})