# Stop centering when selecting larger syntax nodes \(\#28172\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 656302ee4cbe81acde191451ebbdeb2aa59d7b16

Requested commit: 656302ee4cbe81acde191451ebbdeb2aa59d7b16

Commit: 656302ee4cbe81acde191451ebbdeb2aa59d7b16

Tree: 13e34a2f4aab9d7e7f262ac461cac91c57ab56c7

Author: Julia Ryan

Committer: GitHub

## Message

```
Stop centering when selecting larger syntax nodes (#28172)

With #27295, the cursor would center upon running
`SelectLargerSyntaxNode`. This was done to provide more context when
making large selections, but when making small selections (such as a
single parameter in an argument list) it was confusing that the scroll
position jumped.

This change makes that behavior slightly more conservative: now when the
selection is small enough to fit on the screen scrolling will only occur
to keep the cursor position on the screen (including respecting
`vertical_scroll_margin`).

Release Notes:

- N/A

Co-authored-by: João Marcos <marcospb19@hotmail.com>
```

## Parents

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

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