# acp: Fix behavior of read_text_file for ACP agents \(\#38401\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 32c868ff7d50f4163072c72bc2a09cf710e7b521

Requested commit: 32c868ff7d50f4163072c72bc2a09cf710e7b521

Commit: 32c868ff7d50f4163072c72bc2a09cf710e7b521

Tree: 975ce4c9536b3a7a311514dd2bf3f26f656c95c1

Author: Ben Brandt

Committer: GitHub

## Message

```
acp: Fix behavior of read_text_file for ACP agents (#38401)

We were incorrectly handling the line number as well as stripping out
line breaks when returning portions of files.

It also makes sure following is updated even when we load a snapshot
from cache, which wasn't the case before.

We also are able to load the text via a range in the snapshot, rather
than allocating a string for the entire file and then another after
iterating over lines in the file.

Release Notes:

- acp: Fix incorrect behavior when ACP agents requested to read portions
of files.
```

## Parents

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

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