Task doesn't respect use_new_terminal=false if terminal has been moved
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
As an example, take Zed's clippy task, which has use_new_terminal=false:
- running task::Spawn --> clippy, the task opens in a terminal at the bottom of the window. Rerunning the task will reuse the same terminal as expected.
- Move the terminal created by the clippy task from the bottom of the window to the right of the window
- Rerun the clippy task. This creates a new terminal at the bottom of the window. Expected behaviour is to reuse the terminal which is now on the right hand side, rather than creating a new terminal on the bottom.
Screenshot:
Note that there are two clippy task terminals, when this task should have reused the same terminal.
Environment
Zed: v0.162.5 (Zed) OS: macOS 14.1.0 Memory: 36 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log
I had a go at fixing this but it's not quite working how I'd like. (code here: https://github.com/casperhart/zed/tree/task-terminal).
The issue was that the function terminals_for_task in terminal_panel.rs will only check the 'terminals' pane for existing terminals for the given task, so once a terminal is moved out of that pane it's no longer seen.
I was able to get it working by looking at all panes in the workspace, however, while the task spawns in the correct terminal, a new terminal still gets created in the terminals pane. I haven't yet figured out why this is.
Ran into this as well, it's especially annoying for tasks like clippy or (in my case) rebuilding the project where you mainly care about the "OK" at the end and want a quick button for rerunning the task from the GUI. Having a full terminal pane open takes way more space than is needed there.
Also ran into this:
I am following a bevy tutorial (rust game engine), and put bacon in my regular terminal, but hit the play button to do the cargo run in a second "terminal". When I hit rerun, it constantly spins up a new terminal pane at the bottom:
I'm also experiencing the issue. I'm running a test in Elixir. After moving the task output to the the right, re-running the task spawns a new terminal at the bottom. If I close the bottom dock, it's forced open again on re-run.
As @jansol mentioned, this is surprising disruptive and forces me to avoid Zed for running tests.
Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!
After receiving the "stale" notice, I have re-tested. This is still a problem.
In order to reproduce it:
- Run a task or test
- Drag the pane out of the bottom to split right, left, or top
- Press cmd-opt-r
The task will re-run AND a new terminal pops open in the bottom position.
-- Zed 0.201.7 d5c16d9588636b191fd81d235005579e26e833bc