Skip to content

Conversation

@alygin
Copy link
Contributor

@alygin alygin commented Feb 4, 2024

This PR is another step to tabless editing (#6424, #4963). It adds support for tab bar settings that allow the user to change its placement or to hide completely.

Configuraton:

"tab_bar": {
  "show": true
}

Placemnet options are "top", "bottom" and "no".

This PR intentionally doesn't affect tab bars of other panes (Terminal for instance) to keep code changes small. I guess we'll do the rest in separate PRs.

Release Notes:

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 4, 2024
@osiewicz
Copy link
Contributor

osiewicz commented Feb 4, 2024

Hey, thanks for a PR! we already have a setting section for tabs (see e.g #2739); I think your change would fit in better in that.

@alygin
Copy link
Contributor Author

alygin commented Feb 4, 2024

Hey, thanks for a PR! we already have a setting section for tabs (see e.g #2739); I think your change would fit in better in that.

Oh, thank you for pointing out! I somehow missed that. I'll move the placement setting to the existing tabs.

@alygin alygin marked this pull request as draft February 4, 2024 11:54
@alygin alygin marked this pull request as ready for review February 4, 2024 15:03
@JosephTLyons
Copy link
Collaborator

JosephTLyons commented Feb 5, 2024

Hey @alygin, we actually had a PR open for this at one time, but it was blocked because the team wanted to ensure that the user had an alternative way to check on the state of their buffers when tabs are hidden. I'm not sure where everyone stands at the moment, but here is the PR with the additional info:

Specifically, @maxbrunsfeld's comment:

I'll let Max / the other devs chime in with their current thoughts on this.

@alygin
Copy link
Contributor Author

alygin commented Feb 5, 2024

@JosephTLyons, thank you for pointing to the existing discussion on the subject! Unfortunately, I didn't see it before.

I'll get back with my ideas / changes later.

@alygin alygin marked this pull request as draft February 5, 2024 09:47
@alygin alygin mentioned this pull request Feb 10, 2024
4 tasks
@alygin
Copy link
Contributor Author

alygin commented Feb 10, 2024

Filed a feature request: #7653

@wmstack
Copy link
Contributor

wmstack commented Feb 29, 2024

Also worthwhile to have a "merge" placement where the title bar is merged with the tab bar #5066 to reduce the editor footprint.

This can be done in VSCode with the help of APC Customize UI++ but is quite buggy and affects the draggability of the title-bar, difficulty in aligning the traffic light buttons and forces you to use "native" windows on VSCode. This means the context menu has to be native instead of custom.

@ConradIrwin
Copy link
Member

@alygin are you still planning to work on this one? If not, I will close to tidy up our PR queue.

@alygin
Copy link
Contributor Author

alygin commented Mar 13, 2024

@ConradIrwin, yes, I'm absolutely committed to this task. This PR is waiting for the TabSwitcher to be implemented. And the tab switcher is pretty close, it's waiting for a couple of other PR's to be merged.

I started all this TabSwitcher thing just to be able to merge this PR and hide the tab bar :)

Though you can close it if it's a burden to keep it in the queue. I'll reopen as soon as all the prerequisites are ready.

@ConradIrwin
Copy link
Member

ConradIrwin commented Mar 13, 2024 via email

@alygin
Copy link
Contributor Author

alygin commented Mar 13, 2024

Sounds good! Happy to work with you on any of this (there are some slots)

Thanks! I've booked a slot.

@alygin alygin mentioned this pull request Mar 22, 2024
@alygin alygin force-pushed the tab-bar-settings branch from e95d1a5 to 9d684d7 Compare March 23, 2024 13:28
mikayla-maki added a commit that referenced this pull request Mar 27, 2024
The Tab Switcher implementation (#7653):
- `ctrl-tab` opens the Tab Switcher and moves selection to the
previously selcted tab. It also cycles selection forward.
- `ctrl-shift-tab` opens the Tab Switcher and moves selection to the
last tab in the list. It also cycles selection backward.
- Tab is selected and the Tab Switcher is closed on the shortcut
modifier key (`ctrl` by default) release.
- List items are in reverse activation history order.
- The list reacts to the item changes in background (new tab, tab
closed, tab title changed etc.)

Intentionally not in scope of this PR:
- File icons
- Close buttons

I will come back to these features. I think they need to be implemented
in separate PRs, and be synchronized with changes in how tabs are
rendered, to reuse the code as it's done in the current implementation.
The Tab Switcher looks usable even without them.

Known Issues:

Tab Switcher doesn't react to mouse click on a list item. It's not a tab
switcher specific problem, it looks like ctrl-clicks are not handled the
same way in Zed as cmd-clicks. For instance, menu items can be activated
with cmd-click, but don't react to ctrl-click. Since the Tab Switcher's
default keybinding is `ctrl-tab`, the user can only click an item with
`ctrl` pushed down, thus preventing `on_click()` from firing.

fixes #7653, #7321

Release Notes:

- Added Tab Switcher which is accessible via `ctrl-tab` and
`ctrl-shift-tab` (#7653) (#7321)

Related issues:

- Unblocks #7356, I hope 😄

How it looks and works (it's only `ctrl-tab`'s and `ctrl-shift-tab`'s,
no `enter`'s or mouse clicks):


https://github.com/zed-industries/zed/assets/2101250/4ad4ec6a-5314-481b-8b35-7ac85e43eb92

---------

Co-authored-by: Conrad Irwin <[email protected]>
Co-authored-by: Mikayla Maki <[email protected]>
@baldwindavid
Copy link
Contributor

baldwindavid commented May 5, 2024

@williamdes To be clear, that comment of mine you quoted was regarding hiding tabs completely. Whether an option for tabs at the bottom is provided is not something that matters to me. But for vim and other modal editors tabs are not expected to be displayed at all.

@alygin I've been using this PR daily and hiding tabs. It works great mixed with the tab switcher.

This PR intentionally doesn't affect tab bars of other panes (Terminal for instance) to keep code changes small. I guess we'll do the rest in separate PRs.

I see this note. I'm not so sure I'd even hide tabs in the terminal just because I typically have a very limited set that I don't mind seeing. Not that they shouldn't be hideable eventually, but it doesn't look surprising to me. The only thing that took me a bit by surprise was that the tabs display in a project search. That might be a good fast follow if this eventually gets in.

@0x2CA
Copy link
Contributor

0x2CA commented May 6, 2024

Well @alygin for your questions, I had some different considerations. But first in your diagram above I think that the title-bar should resemble the concept image in #5066, namely, the tabs should be vertically centred without any margin and unfocused tabs should have the same colour as the title-bar.

The idea that I was initially considering was

  1. When there is a vertical split, it would be a split of the tabs in the title-bar as well, just as if it were a tab bar that is split.
  2. For horizontal splits or splits that are not supposed to be on the title-bar there could be a new tab-bar separate from the title-bar, just like if the tabs are not hidden.

In essence this would be like VSCode with APC Customize UI++ where you hide the title-bar.

However, I do have another suggestion, which is inspired by Vivaldi tiles, all the tabs are in the title-bar to the left, and then when you click on them, the focus moves to the different panes

Vivaldi Relevant Video Tab Tiling Vivaldi Article

It seems to me that tab-tiling doesn't have a way to deal with the same buffer, but in vim-bufferline tabs are just visualizations of the buffer, and the user doesn't really care what's open, just what they're currently editing, or what they want to change the current display to.

For multi-window users who just need to choose the layout, what to display in different windows, and then write or review

Hidden tabs paired with a buffer switcher is an alternative to this functionality, though lacking the possibility of mouse manipulation

vim: when splitting window, buffers shouldn't be split, each split window can access any opened buffer. #8013

@mikayla-maki mikayla-maki dismissed their stale review May 6, 2024 20:57

out of date

Copy link
Member

@mikayla-maki mikayla-maki left a comment

Choose a reason for hiding this comment

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

Given the discussion here, and our designer's skepticism, I'm revising my review:

This PR is great as is, let's remove the 'bottom' placement for tabs until we have more data, and then we can merge this :)

Thanks for all the hard work on this one @alygin, I know it's been a long road!

@alygin
Copy link
Contributor Author

alygin commented May 7, 2024

@mikayla-maki, since we're removing the bottom option, shouldn't we make this setting a simple boolean flag, like show: true?

@alygin alygin marked this pull request as ready for review May 7, 2024 20:50
@alygin
Copy link
Contributor Author

alygin commented May 7, 2024

The only thing that took me a bit by surprise was that the tabs display in a project search.

@baldwindavid, fixed

@mikayla-maki
Copy link
Member

shouldn't we make this setting a simple boolean flag, like show: true

Let's do that. Generally, I like to prefer enums to booleans. But also, the phrasing of placement: none is a little awkward. show: true tells the story well.

@alygin
Copy link
Contributor Author

alygin commented May 8, 2024

Let's do that. Generally, I like to prefer enums to booleans. But also, the phrasing of placement: none is a little awkward. show: true tells the story well.

Done

@iamnbutler
Copy link
Contributor

Thanks – that settings change brings it more in line with other similar settings.

@mikayla-maki mikayla-maki merged commit 0933426 into zed-industries:main May 8, 2024
@mikayla-maki
Copy link
Member

Thank you!

@alygin alygin deleted the tab-bar-settings branch May 8, 2024 18:08
@hedefalk
Copy link

hedefalk commented May 9, 2024

Yey! I've been waiting for this!

@Moshyfawn
Copy link
Contributor

Closes #11727

@Moshyfawn Moshyfawn linked an issue May 12, 2024 that may be closed by this pull request
1 task
@d1y
Copy link
Contributor

d1y commented May 17, 2024

A great option, closer to zen mode, but can you add a command?
Is it like editor:: ToggleTabbarShow ?
@alygin

osiewicz pushed a commit to RemcoSmitsDev/zed that referenced this pull request May 18, 2024
This PR is another step to tabless editing (zed-industries#6424, zed-industries#4963). It adds
support for tab bar settings that allow the user to change its placement
or to hide completely.

Configuraton:

```json
"tab_bar": {
  "show": true
}
```

Placemnet options are "top", "bottom" and "no".

This PR intentionally doesn't affect tab bars of other panes (Terminal
for instance) to keep code changes small. I guess we'll do the rest in
separate PRs.

Release Notes:

- Added support for configuring the editor tab bar (part of zed-industries#6424,
zed-industries#4963).

---------

Co-authored-by: Mikayla <[email protected]>
@alygin
Copy link
Contributor Author

alygin commented May 26, 2024

can you add a command? Is it like editor:: ToggleTabbarShow ?

@d1y, while adding such a command is technically a simple task, I'm not sure if it can be naturally embedded into the existing UX-patterns.

The state of toggable-by-action elements is stored in the local DB and it may conflict with what settings.json contains. For instance, I may have tab_bar.show=true in the settings.json and then hide it via the toggle-action. What should we do in this case on start? Or what if I have tab bar hidden via the toggle-action and via tab_bar.show=false, but then change settings to tab_bar.show=true? If we show the tab, it contradicts the toggle-state, if we don't, it confuses the user because the setting change has no effect. Etc.

Do you know other features in Zed that have both the setting in settings.json and a corresponding toggle-action?

@ConradIrwin
Copy link
Member

Vim has both. The toggle command writes to the settings.

@alygin
Copy link
Contributor Author

alygin commented May 28, 2024

@ConradIrwin, will it be OK if Zed behaves the same way?

@baldwindavid
Copy link
Contributor

baldwindavid commented May 28, 2024

@alygin Just in case it's not clear, the actual workspace::ToggleVimMode command writes to the settings. As does theme_selector::Toggle, though with an additional step.

ConradIrwin pushed a commit that referenced this pull request Jun 6, 2024
This PR adds the `editor: toggle tab bar` action that hides / shows the
tab bar and updates the `tab_bar.show` setting in `settings.json`
accordingly.

First mentioned in
#7356 (comment).

Release Notes:

- Added the `editor: toggle tab bar` action.
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.

tabs.git_status default value inconsistency