# Fix cursor movement in protected files on backspace/delete \(\#36753\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 54df43e06f5340c6e9ae5540550a3a2f102a521f

Requested commit: 54df43e06f5340c6e9ae5540550a3a2f102a521f

Commit: 54df43e06f5340c6e9ae5540550a3a2f102a521f

Tree: d5fb232b5844a3a455d5e2522503929208fd9b7c

Author: Sarah Price

Committer: GitHub

## Message

```
Fix cursor movement in protected files on backspace/delete (#36753)

## Summary

Fixes cursor movement behavior in protected files (like Default
Settings) when pressing backspace or delete keys.

Previously, these keys would cause unwanted cursor movement instead of
being ignored as expected in read-only files.

## Changes

- Added read-only checks to `backspace()` and `delete()` methods in the
editor
- Consistent with existing pattern used by other editing methods
(`indent()`, `outdent()`, `undo()`, etc.)

## Test Plan

1. Open Default Settings in Zed
2. Place cursor at arbitrary position (not at start/end of file)  
3. Press backspace - cursor should remain in place (no movement)
4. Press delete - cursor should remain in place (no movement)

Fixes #36302

Release Notes:

- Fixed backspace and delete keys moving caret in protected files

Co-authored-by: Claude <noreply@anthropic.com>
```

## Parents

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

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