Add MovePageUp and MovePageDown editor commands

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-10-14 12:36:46 -07:00
parent 137a9cefbd
commit 8df84e0341
5 changed files with 213 additions and 10 deletions

View file

@ -17,10 +17,11 @@ use parking_lot::{Mutex, RwLock};
use smol::stream::StreamExt;
use crate::{
executor, keymap::Keystroke, platform, Action, AnyViewHandle, AppContext, Appearance, Entity,
Event, FontCache, InputHandler, KeyDownEvent, LeakDetector, ModelContext, ModelHandle,
MutableAppContext, Platform, ReadModelWith, ReadViewWith, RenderContext, Task, UpdateModel,
UpdateView, View, ViewContext, ViewHandle, WeakHandle, WindowInputHandler,
executor, geometry::vector::Vector2F, keymap::Keystroke, platform, Action, AnyViewHandle,
AppContext, Appearance, Entity, Event, FontCache, InputHandler, KeyDownEvent, LeakDetector,
ModelContext, ModelHandle, MutableAppContext, Platform, ReadModelWith, ReadViewWith,
RenderContext, Task, UpdateModel, UpdateView, View, ViewContext, ViewHandle, WeakHandle,
WindowInputHandler,
};
use collections::BTreeMap;
@ -275,6 +276,17 @@ impl TestAppContext {
}
}
pub fn simulate_window_resize(&self, window_id: usize, size: Vector2F) {
let mut window = self.window_mut(window_id);
window.size = size;
let mut handlers = mem::take(&mut window.resize_handlers);
drop(window);
for handler in &mut handlers {
handler();
}
self.window_mut(window_id).resize_handlers = handlers;
}
pub fn simulate_window_activation(&self, to_activate: Option<usize>) {
let mut handlers = BTreeMap::new();
{