ZIm/crates
Felix Packard bbd1e628f0
Fix GPUI keyup events not firing on Windows and macOS (#27290)
While building my own application using GPUI, I found that the `key_up`
event doesn't fire on Windows or macOS, with each platform failing for
different reasons. These events aren't used anywhere in Zed yet, so it
makes sense that the issue hasn't already been caught.

I don't have a Linux machine set up right now, so I don't know if these
events fire correctly on Linux or not.

---

Without this fix, a simple layout like the following:

```rust
div()
    .on_key_down(cx.listener(|_, event, _, _| println!("Key down: {:?}", event)))
    .on_key_up(cx.listener(|_, event, _, _| println!("Key up: {:?}", event)));
```

...would result in the following logs if the 'a' key was pressed:

```text
Key down: KeyDownEvent { keystroke: Keystroke { modifiers: Modifiers { control: false, alt: false, shift: false, platform: false, function: false }, key: "a", key_char: Some("a") }, is_held: false }
<eof>
```

With this fix, the `key_up` event fires correctly, resulting in the
following logs:

```text
Key down: KeyDownEvent { keystroke: Keystroke { modifiers: Modifiers { control: false, alt: false, shift: false, platform: false, function: false }, key: "a", key_char: Some("a") }, is_held: false }
Key up: KeyUpEvent { keystroke: Keystroke { modifiers: Modifiers { control: false, alt: false, shift: false, platform: false, function: false }, key: "a", key_char: None } }
<eof>
```

---

I've made the assumption that the `key_char` field shouldn't be set on
the `key_up` event since, unlike the `key_down` event, it's not an event
that may produce a character.

Happy to make any changes to this PR as required. If it would be
preferable to test this on Linux as well before it's merged, let me know
and I'll sort something out.

Hopefully this makes the experience of building new applications on GPUI
smoother, and potentially saves the Zed team some time if this event is
ever used in the future.

Release Notes:

- N/A
2025-03-28 14:39:15 -07:00
..
activity_indicator Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
anthropic Make serialization backwards-compatible for collab server (#27626) 2025-03-27 18:20:10 -04:00
askpass Bump up default timeout (#27250) 2025-03-21 10:04:39 -06:00
assets Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
assistant assistant: Remove /search (#27661) 2025-03-28 13:40:31 +00:00
assistant2 Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
assistant_context_editor debugger: Fix typing in active buffer resulting a jump to an active debug line (#27439) 2025-03-25 17:08:36 +00:00
assistant_eval Switch fully to Rust Livekit (redux) (#27126) 2025-03-28 17:58:23 +00:00
assistant_settings assistant2: Add ability to configure tools for profiles in the UI (#27562) 2025-03-27 02:19:45 +00:00
assistant_slash_command Allow too many arguments (#26375) 2025-03-10 13:38:30 -06:00
assistant_slash_commands assistant: Remove /search (#27661) 2025-03-28 13:40:31 +00:00
assistant_tool Allow reviewing of agent changes without Git (#27668) 2025-03-28 18:58:53 +00:00
assistant_tools Allow reviewing of agent changes without Git (#27668) 2025-03-28 18:58:53 +00:00
audio Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
auto_update Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
auto_update_ui Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
aws_http_client Add aws_http_client and bedrock crates (#25490) 2025-02-24 20:28:20 +00:00
bedrock bedrock: Support DeepSeek r1 (#27495) 2025-03-27 19:30:30 -04:00
breadcrumbs Add user-visible output for remote operations (#25849) 2025-03-03 09:20:15 +00:00
buffer_diff Git: Fix hunks being skipped when staging too quickly (#27552) 2025-03-26 23:22:37 +00:00
call Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
channel Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
cli Switch fully to Rust Livekit (redux) (#27126) 2025-03-28 17:58:23 +00:00
client Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
clock chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
collab collab: Switch to new encryption format for access tokens (#27691) 2025-03-28 16:19:25 -04:00
collab_ui Prevent toggle_dock from opening assistant panel when it is disabled via settings (#27215) 2025-03-27 19:19:37 +00:00
collections chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
command_palette Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
command_palette_hooks vim: :set support (#24209) 2025-02-11 04:55:40 +00:00
component component_preview: Add component pages (#26284) 2025-03-07 18:56:17 +00:00
component_preview Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
context_server context_server: Only look for context server project settings in visible worktrees (#27633) 2025-03-27 22:58:29 +00:00
context_server_settings Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
copilot copilot: Add Claude 3.7-Sonnet-Thought model to Copilot Chat (#27409) 2025-03-25 10:56:27 +01:00
credentials_provider Use the development credentials provider in development by default (#25273) 2025-02-20 19:07:16 +00:00
dap debugger: Remove fake adapter and un-gate GDB (#27557) 2025-03-27 22:31:58 +00:00
dap_adapters debugger: Remove fake adapter and un-gate GDB (#27557) 2025-03-27 22:31:58 +00:00
db cx.background_executor().spawn(...) -> cx.background_spawn(...) (#25103) 2025-02-18 20:30:33 +00:00
debugger_tools Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
debugger_ui Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
deepseek Add DeepSeek support (#23551) 2025-01-27 13:40:59 -05:00
diagnostics Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
docs_preprocessor docs: Improve Git page (#26566) 2025-03-25 09:22:01 -03:00
editor Correct other end visual block functionality (#27678) 2025-03-28 20:52:38 +00:00
evals Switch fully to Rust Livekit (redux) (#27126) 2025-03-28 17:58:23 +00:00
extension extension: Add support for additional_workspace_configuration and additional_initialization_options (#27407) 2025-03-25 18:23:59 +05:30
extension_api extension: Add support for additional_workspace_configuration and additional_initialization_options (#27407) 2025-03-25 18:23:59 +05:30
extension_cli Make GitRepository::status async and remove cx parameter (#27514) 2025-03-27 09:05:54 +00:00
extension_host Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
extensions_ui extensions_ui : Scroll to top on filter change (#27305) 2025-03-22 18:38:01 +05:30
feature_flags feature_flags: Remove predict-edits-non-eager-mode feature flag (#27610) 2025-03-27 17:25:01 +00:00
feedback zed: Add --system-specs arg (#27285) 2025-03-22 02:56:25 +00:00
file_finder Remove Pixels: Mul<Pixels, Output = Pixels> impl, add ScaledPixels ops (#27451) 2025-03-25 19:34:26 +00:00
file_icons Allow icon themes to provide their own file associations (#24926) 2025-02-15 00:35:13 +00:00
fs If GIT_ASKPASS is already set, assume it will do the right thing (#27681) 2025-03-28 14:50:05 -06:00
fsevent Deflake fs::test_event_stream_simple (#24013) 2025-01-30 23:53:36 -07:00
fuzzy Allow too many arguments (#26375) 2025-03-10 13:38:30 -06:00
git If GIT_ASKPASS is already set, assume it will do the right thing (#27681) 2025-03-28 14:50:05 -06:00
git_hosting_providers git_hosting_providers: Allow configuring additional hosting providers via settings (#26879) 2025-03-17 15:39:52 +00:00
git_ui Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
go_to_line Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
google_ai Add support for Gemini 2.5 Pro Experimental model (#27468) 2025-03-26 00:12:10 +00:00
gpui Fix GPUI keyup events not firing on Windows and macOS (#27290) 2025-03-28 14:39:15 -07:00
gpui_macros Hide the mouse when the user is typing in the editor - take 2 (#27519) 2025-03-27 01:58:26 +05:30
gpui_tokio Switch fully to Rust Livekit (redux) (#27126) 2025-03-28 17:58:23 +00:00
html_to_markdown Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
http_client chore: Extract http-client-tls crate (#26895) 2025-03-17 02:36:37 +00:00
http_client_tls chore: Extract http-client-tls crate (#26895) 2025-03-17 02:36:37 +00:00
icons Debugger: Basic breakpoint improvements (#27687) 2025-03-28 19:55:09 +00:00
image_viewer Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
indexed_docs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
inline_completion edit predictions: Show user if current project is open source (#24587) 2025-02-10 22:28:56 -03:00
inline_completion_button Set edit predictions to default to the Zed provider (#27394) 2025-03-24 20:45:06 -07:00
install_cli Fix missed renames in #22632 (#23688) 2025-01-26 23:37:34 +00:00
journal Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
language Don't consider empty deleted files to be dirty or conflicting (#27701) 2025-03-28 14:17:16 -07:00
language_extension extension: Add support for additional_workspace_configuration and additional_initialization_options (#27407) 2025-03-25 18:23:59 +05:30
language_model Add token usage to LanguageModelTextStream (#27490) 2025-03-26 22:21:01 +00:00
language_model_selector assistant: Dismiss model picker upon selection (#27162) 2025-03-20 10:22:49 -03:00
language_models Make serialization backwards-compatible for collab server (#27626) 2025-03-27 18:20:10 -04:00
language_selector Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
language_tools lsp-config: Allow setting a server's environment variables (#27213) 2025-03-21 09:15:41 +02:00
languages tsx: Insert newline between open and close tags on enter (#27618) 2025-03-27 19:15:12 +00:00
livekit_api Change license of crates/livekit_api from AGPL to GPL (#25206) 2025-02-19 23:32:51 +00:00
livekit_client Switch fully to Rust Livekit (redux) (#27126) 2025-03-28 17:58:23 +00:00
lmstudio lmstudio: Support missing quantization in model metadata (#24054) 2025-01-31 22:28:11 +00:00
lsp lsp: Check if language server supports workspace/symbol request (#27491) 2025-03-26 13:09:41 +00:00
markdown Opt-in to markdown parser options and check all options were considered (#27623) 2025-03-27 20:10:06 +00:00
markdown_preview markdown_preview: Fix code block highlight and indentation (#27463) 2025-03-26 04:14:23 +05:30
media Switch fully to Rust Livekit (redux) (#27126) 2025-03-28 17:58:23 +00:00
menu Remove unneeded inline tables in Cargo.tomls (#27563) 2025-03-27 02:36:47 +00:00
migrator migrator: Add migration for settings changed prior to migrator-introduction (#27375) 2025-03-25 04:35:01 +05:30
mistral assistant: Add Mistral support (#24879) 2025-02-14 13:07:41 -05:00
multi_buffer Don't assume that the excerpt can be found (#27395) 2025-03-24 16:12:26 -06:00
node_runtime node_runtime: Use user/global configuration when using system node installation (#26209) 2025-03-06 12:50:42 +01:00
notifications Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
ollama Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
open_ai Update Assistant context limits (#25087) 2025-02-19 11:06:20 -05:00
outline Fix editor's outline view confirm not working before any queries have (#26761) 2025-03-14 07:19:43 +00:00
outline_panel Move repository state RPC handlers to the GitStore (#27391) 2025-03-26 18:23:44 -04:00
panel Fix syntax highlighting of git commit messages (#26988) 2025-03-18 18:18:56 +00:00
paths Notify about broken task file contents (#27185) 2025-03-20 13:06:10 +00:00
picker Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
prettier Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
project Don't consider empty deleted files to be dirty or conflicting (#27701) 2025-03-28 14:17:16 -07:00
project_panel Move repository state RPC handlers to the GitStore (#27391) 2025-03-26 18:23:44 -04:00
project_symbols lsp: Check if language server supports workspace/symbol request (#27491) 2025-03-26 13:09:41 +00:00
prompt_library Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
prompt_store Initial support for AI assistant rules files (#27168) 2025-03-20 08:30:04 +00:00
proto Move repository state RPC handlers to the GitStore (#27391) 2025-03-26 18:23:44 -04:00
recent_projects debugger: Remove fake adapter and un-gate GDB (#27557) 2025-03-27 22:31:58 +00:00
refineable windows: Fix tests on Windows (#22616) 2025-02-05 14:30:09 +00:00
release_channel windows: Missing commit of #25412 (#25732) 2025-02-27 08:00:42 +00:00
remote Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
remote_server Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
repl Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
reqwest_client Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
rich_text Allow too many arguments (#26375) 2025-03-10 13:38:30 -06:00
rope Add support for auto-closing of JSX tags (#25681) 2025-03-06 08:36:10 -06:00
rpc extensions_ui: Add ability to filter extensions by category (#27005) 2025-03-18 17:59:58 +00:00
schema_generator Improve schema_generator CLI (#25898) 2025-03-06 04:59:57 +00:00
search Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
semantic_index assistant: Remove /auto (#27608) 2025-03-27 17:23:32 +00:00
semantic_version chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
session Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
settings Notify about broken task file contents (#27185) 2025-03-20 13:06:10 +00:00
settings_ui Fix UI font size changes not applying (#25307) 2025-02-21 06:24:02 -03:00
snippet Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
snippet_provider Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
snippets_ui Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
sqlez Allow enabling/disabling breakpoints (#27280) 2025-03-26 02:06:08 -04:00
sqlez_macros windows: Fix tests on Windows (#22616) 2025-02-05 14:30:09 +00:00
story gpui: Rename rounded_md to rounded_sm (#26228) 2025-03-06 17:57:31 +00:00
storybook Switch fully to Rust Livekit (redux) (#27126) 2025-03-28 17:58:23 +00:00
streaming_diff chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
sum_tree git: Fix race condition when [un]staging hunks in quick succession (#26422) 2025-03-13 10:41:04 -07:00
supermaven Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
supermaven_api Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
tab_switcher git_ui: Branch picker improvements (#26287) 2025-03-10 11:39:01 -04:00
task debugger: Remove fake adapter and un-gate GDB (#27557) 2025-03-27 22:31:58 +00:00
tasks_ui debugger: Remove fake adapter and un-gate GDB (#27557) 2025-03-27 22:31:58 +00:00
telemetry Git telemetry (#26222) 2025-03-06 10:56:28 -07:00
telemetry_events Remove unused AssistantThreadFeedback event (#27021) 2025-03-18 20:39:54 +00:00
terminal Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
terminal_view terminal: Make IME work with tab and enter keys (#27572) 2025-03-28 20:44:02 +00:00
text Allow reviewing of agent changes without Git (#27668) 2025-03-28 18:58:53 +00:00
theme theme: Add fallback colors for version_control.<variant> properties (#27104) 2025-03-19 18:48:35 +00:00
theme_extension theme: Don't log errors for missing themes until extensions have loaded (#25098) 2025-02-18 17:47:25 +00:00
theme_importer Add schema_generator for generating JSON schemas (#23991) 2025-01-31 01:22:10 +00:00
theme_selector extensions_ui: Add ability to open the extensions view with a pre-selected filter (#27093) 2025-03-19 17:26:46 +00:00
time_format Add an undo button to the git panel (#24593) 2025-02-12 15:57:08 -07:00
title_bar title bar: Adjust the onboarding banner component API (#27455) 2025-03-25 17:57:42 -03:00
toolchain_selector Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00
ui assistant2: Add support for forking existing profiles (#27627) 2025-03-27 20:17:42 +00:00
ui_input Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
ui_macros Add StatusToast & the ToastLayer (#26232) 2025-03-06 20:37:54 +00:00
ui_prompt Support built-in Zed prompts for all platforms (#26201) 2025-03-18 22:27:09 -06:00
util Fix tools' ui_text to use inline code escaping (#27543) 2025-03-26 21:49:51 +00:00
util_macros Use line_endings macro for the edit tool tests (#26642) 2025-03-15 14:16:10 +08:00
vim Correct other end visual block functionality (#27678) 2025-03-28 20:52:38 +00:00
vim_mode_setting Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00
welcome extensions_ui: Add ability to open the extensions view with a pre-selected filter (#27093) 2025-03-19 17:26:46 +00:00
workspace Switch fully to Rust Livekit (redux) (#27126) 2025-03-28 17:58:23 +00:00
worktree Allow reviewing of agent changes without Git (#27668) 2025-03-28 18:58:53 +00:00
zed Remove unneeded anonymous lifetimes from gpui::Context (#27686) 2025-03-28 19:26:30 +00:00
zed_actions assistant: Allow opening the Prompt Library via the command palette (#27368) 2025-03-24 21:00:33 -03:00
zeta Add support for dashed borders to GPUI (#27139) 2025-03-25 11:11:04 -06:00
zlog zlog: Implement better scope map (#27408) 2025-03-25 03:05:32 +00:00
zlog_settings zlog: Init (#27273) 2025-03-21 20:08:03 +00:00