zed/crates
Piotr Osiewicz 95842c7987
gpui: Add scroll anchors (#19894)
## Problem statement
I want to add keyboard navigation support to SSH modal. Doing so is
possible in current landscape, but not particularly ergonomic;
`gpui::ScrollHandle` has `scroll_to_item` API that takes an index of the
item you want to scroll to. The problem is, however, that it only works
with it's immediate children - thus in order to support scrolling via
keyboard you have to bend your UI to have a particular layout. Even when
your list of items is perfectly flat, having decorations inbetween items
is problematic as they are also children of the list, which means that
you either have to maintain the mapping to devise a correct index of an
item that you want to scroll to, or you have to make the decoration a
part of the list item itself, which might render the scrolling imprecise
(you might e.g. not want to scroll to a header, but to a button beneath
it).

## The solution
This PR adds `ScrollAnchor`, a new kind of handle to the gpui. It has a
similar role to that of a ScrollHandle, but instead of tracking how far
along an item has been scrolled, it tracks position of an element
relative to the parent to which a given scroll handle belongs. In short,
it allows us to persist the position of an element in a list of items
and scroll to it even if it's not an immediate children of a container
whose scroll position is tracked via an associated scroll handle.
Additionally this PR adds a new kind of the container to the UI crate
that serves as a convenience wrapper for using ScrollAnchors. This
container provides handlers for `menu::SelectNext` and
`menu::SelectPrev` and figures out which item should be focused next.

Release Notes:

- Improve keyboard navigation in ssh modal
2024-11-01 14:47:46 +01:00
..
activity_indicator activity indicator: Reset formatting failure on click (#20029) 2024-10-31 14:33:36 +01:00
anthropic Switch to Anthropic -latest tags (#19615) 2024-10-23 15:13:52 -04:00
assets
assistant assistant: Add health telemetry (#19928) 2024-10-31 16:21:26 -07:00
assistant_slash_command Adjust design of the slash command picker (#19973) 2024-10-30 19:42:42 -03:00
assistant_tool
audio
auto_update Fail download if download fails (#19990) 2024-10-30 14:50:41 -07:00
breadcrumbs
call Remove dev servers (#19638) 2024-10-24 12:14:03 -06:00
channel Remove hosted projects (#19754) 2024-10-27 19:44:21 -07:00
cli Remove dev servers (#19638) 2024-10-24 12:14:03 -06:00
client assistant: Add health telemetry (#19928) 2024-10-31 16:21:26 -07:00
clock
collab Migration to remove dev servers (#19639) 2024-10-30 11:55:55 -06:00
collab_ui Fix mouse clicks on remote-open-folder UI (#19851) 2024-10-28 12:55:55 -07:00
collections
command_palette
command_palette_hooks
context_servers context_servers: Support tools (#19548) 2024-10-28 10:37:58 -04:00
copilot Fix mouse clicks on remote-open-folder UI (#19851) 2024-10-28 12:55:55 -07:00
db
dev_server_projects/src Remove dev servers (#19638) 2024-10-24 12:14:03 -06:00
diagnostics Take a mutable context when resolving selections (#19948) 2024-10-30 15:21:51 +01:00
docs_preprocessor
editor tasks: Add editor: Spawn Nearest Task action (#19901) 2024-10-31 14:25:57 +01:00
evals Restore HTTP client transition, but use reqwest everywhere (#19055) 2024-10-11 14:58:58 -07:00
extension Add language toolchains (#19576) 2024-10-28 15:34:03 +01:00
extension_api
extension_cli Restore HTTP client transition, but use reqwest everywhere (#19055) 2024-10-11 14:58:58 -07:00
extensions_ui Add settings to remote servers, use XDG paths on remote, and enable node LSPs (#19176) 2024-10-15 23:32:44 -07:00
feature_flags Initial Notebook UI structure (#19756) 2024-10-29 11:30:07 -07:00
feedback
file_finder Add more context to the save new file path picker (#19863) 2024-10-28 17:21:41 -07:00
file_icons
fs Add support for git branches on remote projects (#19755) 2024-10-27 15:50:54 -07:00
fsevent
fuzzy
git Make Git remote URL parsing more robust (#19924) 2024-10-29 16:19:05 -04:00
git_hosting_providers git_hosting_providers: Fix support for GitLab remotes containing subgroups (#19962) 2024-10-30 11:16:44 -04:00
go_to_line Take a mutable context when resolving selections (#19948) 2024-10-30 15:21:51 +01:00
google_ai
gpui gpui: Add scroll anchors (#19894) 2024-11-01 14:47:46 +01:00
gpui_macros
html_to_markdown
http_client Add settings to remote servers, use XDG paths on remote, and enable node LSPs (#19176) 2024-10-15 23:32:44 -07:00
image_viewer Fix mouse clicks on remote-open-folder UI (#19851) 2024-10-28 12:55:55 -07:00
indexed_docs
inline_completion_button Support .editorconfig (#19455) 2024-10-21 13:05:30 +03:00
install_cli
journal
language Fix missing diagnostic and text highlights after blocks (#19920) 2024-10-29 13:47:43 -07:00
language_model assistant: Add health telemetry (#19928) 2024-10-31 16:21:26 -07:00
language_selector
language_tools Add KeyContextView (#19872) 2024-10-30 11:26:54 -06:00
languages Fix quotes in Rust (#19914) 2024-10-29 12:35:34 -06:00
live_kit_client
live_kit_server Restore HTTP client transition, but use reqwest everywhere (#19055) 2024-10-11 14:58:58 -07:00
lsp Fix a few Windows tests (#19773) 2024-10-26 03:32:22 +03:00
markdown SSH Remoting: Fix yes/no/fingerprint prompt (#19526) 2024-10-21 15:28:22 -06:00
markdown_preview Take a mutable context when resolving selections (#19948) 2024-10-30 15:21:51 +01:00
media
menu
multi_buffer vim: Copy comment to new lines with o/O (#19766) 2024-10-25 16:47:44 -06:00
node_runtime
notifications
ollama
open_ai
outline Take a mutable context when resolving selections (#19948) 2024-10-30 15:21:51 +01:00
outline_panel Do less work when revealing entries in the outline panel (#20031) 2024-10-31 16:29:19 +02:00
paths Support .editorconfig (#19455) 2024-10-21 13:05:30 +03:00
picker Add more context to the save new file path picker (#19863) 2024-10-28 17:21:41 -07:00
prettier Log prettier errors on failures (#19951) 2024-10-30 14:49:47 +02:00
project activity indicator: Reset formatting failure on click (#20029) 2024-10-31 14:33:36 +01:00
project_panel Future-proof indent guides settings for panels (#19878) 2024-10-29 09:52:36 +01:00
project_symbols
proto proto: Remove unused UpdateUserSettings message (#20005) 2024-10-31 09:36:18 +01:00
quick_action_bar
recent_projects gpui: Add scroll anchors (#19894) 2024-11-01 14:47:46 +01:00
refineable
release_channel
remote SSHHELL escaping.... (#20046) 2024-10-31 16:10:03 -06:00
remote_server remote dev: Allow canceling language server work in editor (#19946) 2024-10-30 13:27:11 +01:00
repl Clean up notebook item creation in project (#20030) 2024-10-31 07:01:46 -07:00
reqwest_client reqwest_client: Fix socks proxy settings (#19123) 2024-10-18 09:57:00 -07:00
rich_text
rope Speed up point translation in the Rope (#19913) 2024-10-30 10:59:03 +01:00
rpc Add support for git branches on remote projects (#19755) 2024-10-27 15:50:54 -07:00
search vim: Add :noh[lsearch] (#20056) 2024-10-31 23:25:59 -06:00
semantic_index semantic_index: Disable embeddings index for non-staff (#19618) 2024-10-23 12:34:51 -04:00
semantic_version
session
settings Add support for git branches on remote projects (#19755) 2024-10-27 15:50:54 -07:00
settings_ui
snippet
snippet_provider
snippets_ui
sqlez Fix a rare crash on startup (#19922) 2024-10-29 12:30:55 -07:00
sqlez_macros
story
storybook project panel: Add indent guides (#18260) 2024-10-24 13:07:20 +02:00
sum_tree Speed up point translation in the Rope (#19913) 2024-10-30 10:59:03 +01:00
supermaven Cap the size of the Supermaven states buffer (#19246) 2024-10-23 10:36:14 +03:00
supermaven_api
tab_switcher
task tasks: Add editor: Spawn Nearest Task action (#19901) 2024-10-31 14:25:57 +01:00
tasks_ui Add more context to the save new file path picker (#19863) 2024-10-28 17:21:41 -07:00
telemetry_events assistant: Add health telemetry (#19928) 2024-10-31 16:21:26 -07:00
terminal ssh remoting: Fix wrong working directory for SSH terminals (#19672) 2024-10-24 13:52:26 +02:00
terminal_view tasks: Add editor: Spawn Nearest Task action (#19901) 2024-10-31 14:25:57 +01:00
text Simplify line normalization (#19712) 2024-10-31 22:24:24 -06:00
theme Add theme preview (#20039) 2024-10-31 11:40:38 -04:00
theme_importer
theme_selector
time_format
title_bar ssh remoting: Hide share button while connecting to project (#19885) 2024-10-29 12:13:21 +01:00
toolchain_selector Add language toolchains (#19576) 2024-10-28 15:34:03 +01:00
ui gpui: Add scroll anchors (#19894) 2024-11-01 14:47:46 +01:00
ui_input
ui_macros
util Add support for git branches on remote projects (#19755) 2024-10-27 15:50:54 -07:00
vcs_menu vsc menu: Fix issue when switching branch while non-visible worktree is open (#19888) 2024-10-29 12:27:30 +01:00
vim vim: o should scroll (#20054) 2024-10-31 23:26:04 -06:00
welcome Fix mouse clicks on remote-open-folder UI (#19851) 2024-10-28 12:55:55 -07:00
workspace Add theme preview (#20039) 2024-10-31 11:40:38 -04:00
worktree Add support for self-hosted GitLab instances for Git permalinks (#19909) 2024-10-29 12:31:51 -04:00
zed Support zed://ssh (#19970) 2024-10-30 11:28:25 -06:00
zed_actions Add KeyContextView (#19872) 2024-10-30 11:26:54 -06:00