Make full-screen and window bounds callbacks take a WindowContext

This commit is contained in:
Antonio Scandurra 2023-04-14 11:56:31 +02:00
parent 7394bf1cdc
commit 183b9ef809
5 changed files with 98 additions and 103 deletions

View file

@ -31,11 +31,9 @@ impl<'a> VimTestContext<'a> {
});
});
let window_id = cx.window_id;
// Setup search toolbars and keypress hook
cx.update_workspace(|workspace, cx| {
observe_keystrokes(window_id, cx);
observe_keystrokes(cx);
workspace.active_pane().update(cx, |pane, cx| {
pane.toolbar().update(cx, |toolbar, cx| {
let buffer_search_bar = cx.add_view(BufferSearchBar::new);

View file

@ -16,6 +16,7 @@ use collections::CommandPaletteFilter;
use editor::{Bias, Cancel, Editor, EditorMode};
use gpui::{
actions, impl_actions, AppContext, Subscription, ViewContext, ViewHandle, WeakViewHandle,
WindowContext,
};
use language::CursorShape;
use motion::Motion;
@ -95,8 +96,8 @@ pub fn init(cx: &mut AppContext) {
.detach();
}
pub fn observe_keystrokes(window_id: usize, cx: &mut AppContext) {
cx.observe_keystrokes(window_id, |_keystroke, _result, handled_by, cx| {
pub fn observe_keystrokes(cx: &mut WindowContext) {
cx.observe_keystrokes(|_keystroke, _result, handled_by, cx| {
if let Some(handled_by) = handled_by {
// Keystroke is handled by the vim system, so continue forward
// Also short circuit if it is the special cancel action