Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix focusing terminal when running tasks #13675

Merged

Conversation

hron
Copy link
Contributor

@hron hron commented Jun 29, 2024

When running tasks, the terminal was not focused when the terminal had to be replaced. This is because the code for revealing the terminal had been executed twise: once inside replace_terminal function and also at the end of spawn_task.

Fixes #13674

Release Notes:

  • Fixed focusing the terminal when re-spawning a task (#13674).

After removing the unnecessary reveal strategy handling:

focus-task-fix.webm

When running tasks, the terminal was not focused when the terminal
had to be replaced. This is because the code for revealing the terminal
had been executed twise: once inside `replace_terminal` function and
also at the end of `spawn_task`.

Fixes zed-industries#13674
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jun 29, 2024
@hron
Copy link
Contributor Author

hron commented Jun 29, 2024

To sum up the fix. This match reveal is the same as in replace_terminal.

@SomeoneToIgnore SomeoneToIgnore self-assigned this Jul 2, 2024
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another nice catch, thank you for spotting.

@SomeoneToIgnore SomeoneToIgnore merged commit 193be27 into zed-industries:main Jul 2, 2024
10 checks passed
@coszio
Copy link
Contributor

coszio commented Jul 10, 2024

Hi! I don't know if I am doing something wrong, but before v0.143.6 it worked OK for me, but now it doesn't.

I was using the feature via a "cmd-g": ["task::Spawn", { "task_name": "lazygit" }] binding. Now only it only focuses correctly if the task was not already spawned.

@SomeoneToIgnore
Copy link
Contributor

I wonder if a lazygit task influences that somehow?
Have just tried doing a similar thing but with some simple, console-based action and it seems to work:

Screen.Recording.2024-07-11.at.00.00.07.mov

@coszio
Copy link
Contributor

coszio commented Jul 11, 2024

I can confirm that clippy works fine for me too.

It's weird. The settings are the same for both.

[
  {
    "label": "lazygit",
    "command": "lazygit",
    "use_new_terminal": false,
    "allow_concurrent_runs": false,
    "reveal": "always"
  },
  {
    "label": "clippy",
    "command": "cargo clippy",
    "use_new_terminal": false,
    "allow_concurrent_runs": false,
    "reveal": "always"
  },
]

Although lazygit does not change behavior when setting use_new_terminal to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-spawning a task doesn't move focus to the terminal
3 participants