Editor/HotCodeEditor/EditorDocument.cs
/// <summary>
/// A file open in a tab. Each document keeps its own CodeView so undo history and
/// scroll position survive switching tabs.
/// </summary>
public class EditorDocument
{
/// <summary>
/// Where the file lives. Changes when it's renamed or moved from the file tree.
/// </summary>
public string Path { get; set; }
public CodeView Editor { get; }
/// <summary>
/// Has edits that aren't written to disk yet.
/// </summary>
public bool IsDirty { get; set; }
/// <summary>
/// Opened with a single click; gets replaced by the next single-clicked file
/// unless it's edited or double-clicked.
/// </summary>
public bool IsPreview { get; set; }
/// <summary>
/// The file started with a UTF-8 byte order mark, so keep writing one.
/// </summary>
public bool HasBom { get; init; }
/// <summary>
/// RealTime.Now of the last edit, for auto save.
/// </summary>
public double LastEdit { get; set; }
public string Title => System.IO.Path.GetFileName( Path );
public EditorDocument( string path, CodeView editor )
{
Path = path;
Editor = editor;
}
}