# Fix inverted char boundary check causing invalid offsets \(\#47112\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 376e9585696bd50b5352e0a971dc032fa065f61d

Requested commit: 376e9585696bd50b5352e0a971dc032fa065f61d

Commit: 376e9585696bd50b5352e0a971dc032fa065f61d

Tree: 07ea33eb3dadfa61edd125b403723f0a2b56022c

Author: Jordi Villar

Committer: GitHub

## Message

```
Fix inverted char boundary check causing invalid offsets (#47112)

The logic in `anchor_at_offset` and `to_offset` seems inverted when
checking character boundaries. `assert_char_boundary` returns `true`
when the offset IS valid, but the code was adjusting offsets when the
function returned `true` (valid) instead of `false` (invalid).

Release Notes:

- N/A
```

## Parents

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

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