# language: Fix larger syntax node when cursor is at end of word or line \(\#29978\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 56402651609746639145a2e3a5b11f53d91be02a

Requested commit: 56402651609746639145a2e3a5b11f53d91be02a

Commit: 56402651609746639145a2e3a5b11f53d91be02a

Tree: b634f7bdd6aa5ceb09a1f0d2fac1381afe68388e

Author: Smit Barmase

Committer: GitHub

## Message

```
language: Fix larger syntax node when cursor is at end of word or line (#29978)

Closes #28699

Fixes two cases in the `editor::SelectLargerSyntaxNode` action:
1. When cursor is at the end of a word, it now selects that word first
instead of selecting the whole line.
2. When cursor is at the end of a line, it now selects that line first
instead of selecting the whole code block.

Before and After:


https://github.com/user-attachments/assets/233b891e-15f1-4f10-a51f-75693323c2bd

Release Notes:

- Fixed `editor::SelectLargerSyntaxNode` to properly select nodes when
the cursor is positioned at the end of words or lines.
```

## Parents

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

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