repl: Make output buffer be readonly, never dirty (#17121)

This commit is contained in:
Kyle Kelley 2024-08-29 18:22:28 -07:00 committed by GitHub
parent 6646b15f29
commit 02cd5128c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 11 deletions

View file

@ -1591,12 +1591,13 @@ impl Buffer {
/// Checks if the buffer has unsaved changes.
pub fn is_dirty(&self) -> bool {
self.has_conflict
|| self.has_unsaved_edits()
|| self
.file
.as_ref()
.map_or(false, |file| file.is_deleted() || !file.is_created())
self.capability != Capability::ReadOnly
&& (self.has_conflict
|| self.has_unsaved_edits()
|| self
.file
.as_ref()
.map_or(false, |file| file.is_deleted() || !file.is_created()))
}
/// Checks if the buffer and its file have both changed since the buffer