mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-27 02:27:18 +00:00
use history variant
This commit is contained in:
1 parent
187296a277
commit
1bfd319758
14 files changed
+181
-121
No files matched your search
@@ -57,6 +57,8 @@ impl GlobalHistory {
|
||||
}
|
||||
|
||||
impl History for GlobalHistory {
|
||||
const KEEPS_ORIGINALS: bool = false;
|
||||
|
||||
fn restored(entry: Files) -> Self {
|
||||
Self {
|
||||
entries: vec![entry],
|
||||
|
||||
@@ -26,6 +26,11 @@ pub type Files = HashMap<FileId, Rc<File>>;
|
||||
///
|
||||
/// Files are told apart by their identity (`Rc::ptr_eq`), not their content.
|
||||
pub trait History: Default + Debug {
|
||||
/// Whether the commands that replace files by others (split into files, extract, merge) must
|
||||
/// keep the files they start from, and produce new ones. A history that forgets a file when it
|
||||
/// goes could not undo the command, which a history of the whole workspace can.
|
||||
const KEEPS_ORIGINALS: bool;
|
||||
|
||||
/// A history that starts from `files`, which cannot be undone.
|
||||
fn restored(files: Files) -> Self;
|
||||
|
||||
|
||||
@@ -82,6 +82,8 @@ impl PerFileHistory {
|
||||
}
|
||||
|
||||
impl History for PerFileHistory {
|
||||
const KEEPS_ORIGINALS: bool = true;
|
||||
|
||||
fn restored(files: Files) -> Self {
|
||||
let stacks = files
|
||||
.iter()
|
||||
|
||||
Reference in new issue
Block a user