# markdown_preview: Add ScrollToTop and ScrollToBottom actions \(\#50460\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/4e9ffa3ee18d5ac2dff78be7e6d20b6d614f0b3f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 4e9ffa3ee18d5ac2dff78be7e6d20b6d614f0b3f

Requested commit: 4e9ffa3ee18d5ac2dff78be7e6d20b6d614f0b3f

Commit: 4e9ffa3ee18d5ac2dff78be7e6d20b6d614f0b3f

Tree: 43cabcba20ba36c57a74488a344c67e24c7d64d7

Author: andrew j

Committer: GitHub

## Message

```
markdown_preview: Add ScrollToTop and ScrollToBottom actions (#50460)

Add `gg`/`G` (vim), `cmd-up`/`cmd-down` (macOS), and
`ctrl-home`/`ctrl-end` (Linux/Windows) keybindings to scroll to the top
and bottom of the markdown preview.

The markdown preview already has page scroll (`ctrl-d`/`ctrl-u`), line
scroll (`ctrl-e`/`ctrl-y`), and item scroll (`alt-up`/`alt-down`) but
was missing top/bottom navigation. This adds two new actions —
`ScrollToTop` and `ScrollToBottom` — using the existing
`ListState::scroll_to()` infrastructure, following the same pattern as
the other scroll actions.

- [x] Done a self-review taking into account security and performance
aspects

Release Notes:

- Added scroll-to-top and scroll-to-bottom keybindings for markdown
preview (`gg`/`G` in vim mode, `cmd-up`/`cmd-down` on macOS,
`ctrl-home`/`ctrl-end` on Linux/Windows)
```

## Parents

- [5eb4d334f29e2da40a62899827fcd16dae18d472](https://git.cafe/gitcafe/zed/commit/5eb4d334f29e2da40a62899827fcd16dae18d472?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/4e9ffa3ee18d5ac2dff78be7e6d20b6d614f0b3f?format=markdown)
