zed icon indicating copy to clipboard operation
zed copied to clipboard

Opens new tab instead of switching to an open buffer

Open subash774 opened this issue 1 year ago • 7 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

  • Open a file X
  • Open a different file Y in a new tab
  • search (cmd + P) for file X
  • go to file X will open it again in the current tab rather than switching to the previous tab where the file is open

Environment

Zed: v0.130.6 (Zed)
OS: macOS 14.4.1
Memory: 16 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

page.go is already open in tab 1 but opens again in tab 2

image

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

subash774 avatar Apr 15 '24 12:04 subash774

Could it have to do with preview tabs anyhow @bennetbo ?

osiewicz avatar Apr 15 '24 13:04 osiewicz

Could it have to do with preview tabs anyhow @bennetbo ?

Have not tested this, but preview tabs is only on nightly right now, so it shouldn't

bennetbo avatar Apr 15 '24 13:04 bennetbo

I always assumed this was the desired behavior that opening a file would be in the current pane. That would be my preference anyway as it's not uncommon to want to look at the same file in multiple panes in different places. Additionally, once #7356 gets in we'll have the ability to hide tabs. If I've hidden tabs, search for a file that I haven't touched for a couple hours and it suddenly displaces the content in a different pane, that seems like a confusing experience.

baldwindavid avatar Apr 15 '24 13:04 baldwindavid

It seems like this is actually expected behavior, although I am not sure if this is the "best" behavior.

There are multiple places where you can observe this, e.g. when using two panes, where one pane contains an item and another pane which does not contain the item. If I focus the second pane and use the file finder to open the file, a new tab gets opened in the second pane, regardless if it is already open in another pane.

https://github.com/zed-industries/zed/assets/53836821/ee916489-d116-461f-aa67-a418c137e1a3

bennetbo avatar Apr 15 '24 13:04 bennetbo

I see, makes sense with #7356 but seeing it as "switching" between files, it seemed a bit inconvinient 😅

subash774 avatar Apr 15 '24 14:04 subash774

@subash774 I see how it could be surprising behavior. Just in case you aren't aware, #7987 added a "tab switcher". This might be useful to you if you're trying to use cmd+p for similar. It is also scoped to the pane though so would require you to know which pane the file is in.

Maybe this hints at thinking about some sort of multi-pane tab switcher 🤷

baldwindavid avatar Apr 15 '24 15:04 baldwindavid

I do think this is intentional behavior, so I went ahead and switched this from a defect to a setting enhancement issue.

JosephTLyons avatar Apr 15 '24 19:04 JosephTLyons