Add tab switcher (#7987)
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 <conrad.irwin@gmail.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-27 21:15:08 +03:00
|
|
|
[package]
|
|
|
|
name = "tab_switcher"
|
|
|
|
version = "0.1.0"
|
|
|
|
edition = "2021"
|
|
|
|
publish = false
|
|
|
|
license = "GPL-3.0-or-later"
|
|
|
|
|
|
|
|
[lib]
|
|
|
|
path = "src/tab_switcher.rs"
|
|
|
|
doctest = false
|
|
|
|
|
|
|
|
[dependencies]
|
|
|
|
collections.workspace = true
|
|
|
|
gpui.workspace = true
|
|
|
|
menu.workspace = true
|
|
|
|
picker.workspace = true
|
|
|
|
serde.workspace = true
|
2024-03-30 02:19:02 +03:00
|
|
|
terminal_view.workspace = true
|
Add tab switcher (#7987)
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 <conrad.irwin@gmail.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-27 21:15:08 +03:00
|
|
|
ui.workspace = true
|
|
|
|
util.workspace = true
|
|
|
|
workspace.workspace = true
|
|
|
|
|
|
|
|
[dev-dependencies]
|
|
|
|
anyhow.workspace = true
|
|
|
|
ctor.workspace = true
|
|
|
|
editor.workspace = true
|
|
|
|
env_logger.workspace = true
|
|
|
|
gpui = { workspace = true, features = ["test-support"] }
|
|
|
|
language = { workspace = true, features = ["test-support"] }
|
|
|
|
project.workspace = true
|
|
|
|
serde_json.workspace = true
|
|
|
|
theme = { workspace = true, features = ["test-support"] }
|
|
|
|
workspace = { workspace = true, features = ["test-support"] }
|