mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 21:32:40 +00:00
Do not try to activate the terminal panel twice (#23029)
Some checks are pending
CI / check_docs_only (push) Waiting to run
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Blocked by required conditions
CI / (Linux) Run Clippy and tests (push) Blocked by required conditions
CI / (Linux) Build Remote Server (push) Blocked by required conditions
CI / (Windows) Run Clippy and tests (push) Blocked by required conditions
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
CI / Auto release preview (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Script / ShellCheck Scripts (push) Waiting to run
Some checks are pending
CI / check_docs_only (push) Waiting to run
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Blocked by required conditions
CI / (Linux) Run Clippy and tests (push) Blocked by required conditions
CI / (Linux) Build Remote Server (push) Blocked by required conditions
CI / (Windows) Run Clippy and tests (push) Blocked by required conditions
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
CI / Auto release preview (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Script / ShellCheck Scripts (push) Waiting to run
Closes https://github.com/zed-industries/zed/issues/23023 Fixes terminal pane button opening two terminals on click. The culprit is in61115bd047/crates/workspace/src/workspace.rs (L2412-L2417)
* We cannot get any panel by index from the Dock, only an active one * Both `dock.activate_panel(panel_index, cx);` and `dock.set_open(true, cx);` do `active_panel.panel.set_active(true, cx);` So, follow other pane's impls that have `active: bool` property for this case, e.g.3ec52d8451/crates/assistant/src/inline_assistant.rs (L2687)
Release Notes: - Fixed terminal pane button opening two terminals on click
This commit is contained in:
parent
61115bd047
commit
b6b87405b0
1 changed files with 5 additions and 1 deletions
|
@ -75,6 +75,7 @@ pub struct TerminalPanel {
|
|||
deferred_tasks: HashMap<TaskId, Task<()>>,
|
||||
assistant_enabled: bool,
|
||||
assistant_tab_bar_button: Option<AnyView>,
|
||||
active: bool,
|
||||
}
|
||||
|
||||
impl TerminalPanel {
|
||||
|
@ -95,6 +96,7 @@ impl TerminalPanel {
|
|||
deferred_tasks: HashMap::default(),
|
||||
assistant_enabled: false,
|
||||
assistant_tab_bar_button: None,
|
||||
active: false,
|
||||
};
|
||||
terminal_panel.apply_tab_bar_buttons(&terminal_panel.active_pane, cx);
|
||||
terminal_panel
|
||||
|
@ -1339,7 +1341,9 @@ impl Panel for TerminalPanel {
|
|||
}
|
||||
|
||||
fn set_active(&mut self, active: bool, cx: &mut ViewContext<Self>) {
|
||||
if !active || !self.has_no_terminals(cx) {
|
||||
let old_active = self.active;
|
||||
self.active = active;
|
||||
if !active || old_active == active || !self.has_no_terminals(cx) {
|
||||
return;
|
||||
}
|
||||
cx.defer(|this, cx| {
|
||||
|
|
Loading…
Reference in a new issue