Skip to content

editor: Respect read_only in newline_below#50804

Merged
bennetbo merged 2 commits intomainfrom
editor-newline-respect-readonly
Mar 5, 2026
Merged

editor: Respect read_only in newline_below#50804
bennetbo merged 2 commits intomainfrom
editor-newline-respect-readonly

Conversation

@bennetbo
Copy link
Copy Markdown
Member

@bennetbo bennetbo commented Mar 5, 2026

Turns out Editor::newline_below was not respecting the read_only flag because it uses buffer.edit. Editor::newline and Editor::newline_above behaved correctly because they used editor.edit which ignores edits if read_only is true.

Added an early return if the editor is read only, also added it to newline/newline_above for clarity.

Release Notes:

  • Fixed an issue where newlines could be inserted into read-only editors

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 5, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Mar 5, 2026
@bennetbo bennetbo enabled auto-merge (squash) March 5, 2026 09:57
@bennetbo bennetbo merged commit 1a8005f into main Mar 5, 2026
28 checks passed
@bennetbo bennetbo deleted the editor-newline-respect-readonly branch March 5, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant