MCPcopy Create free account
hub / github.com/bajrangCoder/setu / trigger_editor_search

Function trigger_editor_search

src/utils/editor.rs:5–16  ·  view source on GitHub ↗

Triggers the search panel in an editor by focusing it and dispatching Cmd+F.

(editor: Option<Entity<InputState>>, window: &Window)

Source from the content-addressed store, hash-verified

3
4/// Triggers the search panel in an editor by focusing it and dispatching Cmd+F.
5pub fn trigger_editor_search(editor: Option<Entity<InputState>>, window: &Window) {
6 window.on_next_frame(move |window, cx| {
7 if let Some(editor) = editor {
8 editor.update(cx, |state, cx| {
9 state.focus(window, cx);
10 });
11 if let Ok(keystroke) = Keystroke::parse("cmd-f") {
12 window.dispatch_keystroke(keystroke, cx);
13 }
14 }
15 });
16}

Callers 2

trigger_searchMethod · 0.85
trigger_searchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected