Add File.disk_state
enum to clarify filesystem states (#20776)
Motivation for this is to make things more understandable while figuring out #20775. This is intended to be a refactoring that does not affect behavior, but there are a few tricky spots: * Previously `File.mtime()` (now `File.disk_state().mtime()`) would return last known modification time for deleted files. Looking at uses, I believe this will not affect anything. If there are behavior changes here I believe they would be improvements. * `BufferEvent::DirtyChanged` is now only emitted if dirtiness actually changed, rather than if it may have changed. This should only be an efficiency improvement. Release Notes: - N/A Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
df1d0dec0a
commit
d99f5fe83e
10 changed files with 161 additions and 134 deletions
|
@ -10,9 +10,9 @@ use itertools::Itertools;
|
|||
use language::{
|
||||
language_settings::{language_settings, LanguageSettings},
|
||||
AutoindentMode, Buffer, BufferChunks, BufferRow, BufferSnapshot, Capability, CharClassifier,
|
||||
CharKind, Chunk, CursorShape, DiagnosticEntry, File, IndentGuide, IndentSize, Language,
|
||||
LanguageScope, OffsetRangeExt, OffsetUtf16, Outline, OutlineItem, Point, PointUtf16, Selection,
|
||||
TextDimension, ToOffset as _, ToOffsetUtf16 as _, ToPoint as _, ToPointUtf16 as _,
|
||||
CharKind, Chunk, CursorShape, DiagnosticEntry, DiskState, File, IndentGuide, IndentSize,
|
||||
Language, LanguageScope, OffsetRangeExt, OffsetUtf16, Outline, OutlineItem, Point, PointUtf16,
|
||||
Selection, TextDimension, ToOffset as _, ToOffsetUtf16 as _, ToPoint as _, ToPointUtf16 as _,
|
||||
TransactionId, Unclipped,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
@ -2035,7 +2035,9 @@ impl MultiBuffer {
|
|||
edited |= buffer_edited;
|
||||
non_text_state_updated |= buffer_non_text_state_updated;
|
||||
is_dirty |= buffer.is_dirty();
|
||||
has_deleted_file |= buffer.file().map_or(false, |file| file.is_deleted());
|
||||
has_deleted_file |= buffer
|
||||
.file()
|
||||
.map_or(false, |file| file.disk_state() == DiskState::Deleted);
|
||||
has_conflict |= buffer.has_conflict();
|
||||
}
|
||||
if edited {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue