Add fn modifier to modifier keys in gpui and refactor platform events to use a single modifiers struct
This commit is contained in:
@@ -30,8 +30,8 @@ use gpui::{
|
||||
platform::CursorStyle,
|
||||
text_layout::{self, Line, RunStyle, TextLayoutCache},
|
||||
AppContext, Axis, Border, CursorRegion, Element, ElementBox, EventContext, LayoutContext,
|
||||
MouseButton, MouseButtonEvent, MouseMovedEvent, MouseRegion, MutableAppContext, PaintContext,
|
||||
Quad, Scene, SizeConstraint, ViewContext, WeakViewHandle,
|
||||
Modifiers, MouseButton, MouseButtonEvent, MouseMovedEvent, MouseRegion, MutableAppContext,
|
||||
PaintContext, Quad, Scene, SizeConstraint, ViewContext, WeakViewHandle,
|
||||
};
|
||||
use json::json;
|
||||
use language::{Bias, CursorShape, DiagnosticSeverity, OffsetUtf16, Point, Selection};
|
||||
@@ -209,10 +209,14 @@ impl EditorElement {
|
||||
fn mouse_down(
|
||||
MouseButtonEvent {
|
||||
position,
|
||||
ctrl,
|
||||
alt,
|
||||
shift,
|
||||
cmd,
|
||||
modifiers:
|
||||
Modifiers {
|
||||
shift,
|
||||
ctrl,
|
||||
alt,
|
||||
cmd,
|
||||
..
|
||||
},
|
||||
mut click_count,
|
||||
..
|
||||
}: MouseButtonEvent,
|
||||
@@ -303,8 +307,7 @@ impl EditorElement {
|
||||
fn mouse_dragged(
|
||||
view: WeakViewHandle<Editor>,
|
||||
MouseMovedEvent {
|
||||
cmd,
|
||||
shift,
|
||||
modifiers: Modifiers { cmd, shift, .. },
|
||||
position,
|
||||
..
|
||||
}: MouseMovedEvent,
|
||||
@@ -379,8 +382,7 @@ impl EditorElement {
|
||||
|
||||
fn mouse_moved(
|
||||
MouseMovedEvent {
|
||||
cmd,
|
||||
shift,
|
||||
modifiers: Modifiers { shift, cmd, .. },
|
||||
position,
|
||||
..
|
||||
}: MouseMovedEvent,
|
||||
|
||||
@@ -358,7 +358,7 @@ fn go_to_fetched_definition_of_kind(
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use futures::StreamExt;
|
||||
use gpui::{ModifiersChangedEvent, View};
|
||||
use gpui::{Modifiers, ModifiersChangedEvent, View};
|
||||
use indoc::indoc;
|
||||
use lsp::request::{GotoDefinition, GotoTypeDefinition};
|
||||
|
||||
@@ -431,7 +431,10 @@ mod tests {
|
||||
cx.update_editor(|editor, cx| {
|
||||
editor.modifiers_changed(
|
||||
&gpui::ModifiersChangedEvent {
|
||||
cmd: true,
|
||||
modifiers: Modifiers {
|
||||
cmd: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
cx,
|
||||
@@ -660,8 +663,10 @@ mod tests {
|
||||
cx.update_editor(|editor, cx| {
|
||||
editor.modifiers_changed(
|
||||
&ModifiersChangedEvent {
|
||||
cmd: true,
|
||||
..Default::default()
|
||||
modifiers: Modifiers {
|
||||
cmd: true,
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
cx,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user