Add Caps Lock support (#30470)
Closes #21700 Release Notes: - Added caps lock support and show a warning if the user is entering an SSH password with Caps Lock enabled --------- Co-authored-by: Mikayla Maki <mikayla@zed.dev> Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com> Co-authored-by: 张小白 <364772080@qq.com>
This commit is contained in:
co-authored by
Mikayla Maki
Mikayla Maki
张小白
parent
e47c48fd3b
commit
90aa99bb14
@@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
Action, AnyView, AnyWindowHandle, App, AppCell, AppContext, AsyncApp, AvailableSpace,
|
||||
BackgroundExecutor, BorrowAppContext, Bounds, ClipboardItem, DrawPhase, Drawable, Element,
|
||||
Empty, EventEmitter, ForegroundExecutor, Global, InputEvent, Keystroke, Modifiers,
|
||||
BackgroundExecutor, BorrowAppContext, Bounds, Capslock, ClipboardItem, DrawPhase, Drawable,
|
||||
Element, Empty, EventEmitter, ForegroundExecutor, Global, InputEvent, Keystroke, Modifiers,
|
||||
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels,
|
||||
Platform, Point, Render, Result, Size, Task, TestDispatcher, TestPlatform,
|
||||
TestScreenCaptureSource, TestWindow, TextSystem, VisualContext, Window, WindowBounds,
|
||||
@@ -771,7 +771,18 @@ impl VisualTestContext {
|
||||
|
||||
/// Simulate a modifiers changed event
|
||||
pub fn simulate_modifiers_change(&mut self, modifiers: Modifiers) {
|
||||
self.simulate_event(ModifiersChangedEvent { modifiers })
|
||||
self.simulate_event(ModifiersChangedEvent {
|
||||
modifiers,
|
||||
capslock: Capslock { on: false },
|
||||
})
|
||||
}
|
||||
|
||||
/// Simulate a capslock changed event
|
||||
pub fn simulate_capslock_change(&mut self, on: bool) {
|
||||
self.simulate_event(ModifiersChangedEvent {
|
||||
modifiers: Modifiers::none(),
|
||||
capslock: Capslock { on },
|
||||
})
|
||||
}
|
||||
|
||||
/// Simulates the user resizing the window to the new size.
|
||||
|
||||
Reference in New Issue
Block a user