Remove more references to 'model' in GPUI APIs (#23693)

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2025-01-26 20:00:27 -08:00 committed by GitHub
parent a6b1514246
commit 9cae96f82f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
115 changed files with 309 additions and 311 deletions

View file

@ -20,7 +20,7 @@ impl ModeIndicator {
})
.detach();
let handle = cx.model().clone();
let handle = cx.entity().clone();
let window_handle = window.window_handle();
cx.observe_new::<Vim>(move |_, window, cx| {
let Some(window) = window else {
@ -29,7 +29,7 @@ impl ModeIndicator {
if window.window_handle() != window_handle {
return;
}
let vim = cx.model().clone();
let vim = cx.entity().clone();
handle.update(cx, |_, cx| {
cx.subscribe(&vim, |mode_indicator, vim, event, cx| match event {
VimEvent::Focused => {

View file

@ -130,7 +130,7 @@ impl Replayer {
text,
utf16_range_to_replace,
} => {
let Some(Some(workspace)) = window.root_model::<Workspace>() else {
let Some(Some(workspace)) = window.root::<Workspace>() else {
return;
};
let Some(editor) = workspace

View file

@ -291,7 +291,7 @@ impl Vim {
};
let count = Vim::take_count(cx).unwrap_or(1);
let prior_selections = self.editor_selections(window, cx);
let vim = cx.model().clone();
let vim = cx.entity().clone();
let searched = pane.update(cx, |pane, cx| {
self.search.direction = direction;
@ -425,7 +425,7 @@ impl Vim {
result.notify_err(workspace, cx);
})
}
let vim = cx.model().clone();
let vim = cx.entity().clone();
pane.update(cx, |pane, cx| {
let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() else {
return;

View file

@ -245,7 +245,7 @@ impl Vim {
const NAMESPACE: &'static str = "vim";
pub fn new(window: &mut Window, cx: &mut Context<Editor>) -> Entity<Self> {
let editor = cx.model().clone();
let editor = cx.entity().clone();
cx.new(|cx| Vim {
mode: Mode::Normal,
@ -377,7 +377,7 @@ impl Vim {
editor.unregister_addon::<VimAddon>();
editor.set_relative_line_number(None, cx);
if let Some(vim) = Vim::globals(cx).focused_vim() {
if vim.entity_id() == cx.model().entity_id() {
if vim.entity_id() == cx.entity().entity_id() {
Vim::globals(cx).focused_vim = None;
}
}
@ -398,7 +398,7 @@ impl Vim {
}
pub fn workspace(&self, window: &mut Window) -> Option<Entity<Workspace>> {
window.root_model::<Workspace>().flatten()
window.root::<Workspace>().flatten()
}
pub fn pane(&self, window: &mut Window, cx: &mut Context<Self>) -> Option<Entity<Pane>> {
@ -797,7 +797,7 @@ impl Vim {
if VimSettings::get_global(cx).toggle_relative_line_numbers {
if let Some(old_vim) = Vim::globals(cx).focused_vim() {
if old_vim.entity_id() != cx.model().entity_id() {
if old_vim.entity_id() != cx.entity().entity_id() {
old_vim.update(cx, |vim, cx| {
vim.update_editor(window, cx, |_, editor, _, cx| {
editor.set_relative_line_number(None, cx)
@ -816,7 +816,7 @@ impl Vim {
});
}
}
Vim::globals(cx).focused_vim = Some(cx.model().downgrade());
Vim::globals(cx).focused_vim = Some(cx.entity().downgrade());
}
fn blurred(&mut self, window: &mut Window, cx: &mut Context<Self>) {