Scrollbar markers for cursors (#10816)

How it looks:

https://github.com/zed-industries/zed/assets/2101250/f564111c-1019-4442-b8a6-de338e12b12e

This PR adds cursor markers to the scrollbar. They work similar to
VSCode:

1. A cursor marker takes the whole scrollbar width.
2. It's always 2px high.
3. It uses the player's `cursor` color, so it may be helpful in the
collaboration mode.

There's a setting to switch cursor markers on/off:

```json
{
  "scrollbar": {
    "cursors": true
  }
}
```

Implementation details:

- Unlike other markers, cursor markers are displayed synchronously.
Otherwise they don't feel smooth and sometimes freez on prolonged
up/down navigation.
- Cursor markers are automatically switched off when it's more than 100
of them.
- The minimum (non-cursor) marker height is now 5px. It allows the user
to see other markers under the cursor marker.
- The way the minimum height is imposed on markers has changed a bit to
keep consistency between markers of different types.
- Selected symbol markers use less vibrant color (`info` faded out a
little).

Release Notes:

- Added displaying of cursor markers in the scrollbar. They can be
switched on/off by the `scrollbar.cursors` setting.
This commit is contained in:
Andrew Lygin 2024-04-27 02:26:42 +03:00 committed by GitHub
parent 848bb97ba7
commit 1aa9c868d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 174 additions and 45 deletions

View file

@ -217,6 +217,7 @@ List of `string` values
```json
"scrollbar": {
"show": "auto",
"cursors": true,
"git_diff": true,
"search_results": true,
"selected_symbol": true,
@ -264,6 +265,16 @@ List of `string` values
}
```
### Cursor Indicators
- Description: Whether to show cursor positions in the scrollbar.
- Setting: `cursors`
- Default: `true`
**Options**
`boolean` values
### Git Diff Indicators
- Description: Whether to show git diff indicators in the scrollbar.