mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-05 18:25:57 +00:00
collab panel: Unfocus filter editor on escape (#16579)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
This has been bugging me for a while, because it meant I was stuck in the collab panel when I accidentally navigated there via keyboard shortcuts. Now I can press esc and get out of that state. Release Notes: - Fixed `esc` not removing focus from the filter editor in the collaboration panel. ### Before https://github.com/user-attachments/assets/3bebac03-0e6a-49b0-9823-d9f3190aa5d2 ### After https://github.com/user-attachments/assets/d04c309d-9d1c-44b6-abd3-d48f55207e31
This commit is contained in:
parent
f1778dd9de
commit
28568429aa
1 changed files with 13 additions and 6 deletions
|
@ -1395,15 +1395,22 @@ impl CollabPanel {
|
|||
cx.notify();
|
||||
}
|
||||
|
||||
fn reset_filter_editor_text(&mut self, cx: &mut ViewContext<Self>) -> bool {
|
||||
self.filter_editor.update(cx, |editor, cx| {
|
||||
if editor.buffer().read(cx).len(cx) > 0 {
|
||||
editor.set_text("", cx);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn cancel(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
|
||||
if self.take_editing_state(cx) {
|
||||
cx.focus_view(&self.filter_editor);
|
||||
} else {
|
||||
self.filter_editor.update(cx, |editor, cx| {
|
||||
if editor.buffer().read(cx).len(cx) > 0 {
|
||||
editor.set_text("", cx);
|
||||
}
|
||||
});
|
||||
} else if !self.reset_filter_editor_text(cx) {
|
||||
self.focus_handle.focus(cx);
|
||||
}
|
||||
|
||||
if self.context_menu.is_some() {
|
||||
|
|
Loading…
Reference in a new issue