Skip to content
Snippets Groups Projects
Unverified Commit 7bc674a6 authored by sam's avatar sam Committed by GitHub
Browse files

fix first edit not being undoable (#79)


Co-authored-by: default avatarStaffEngineer <111751109+StaffEngineer@users.noreply.github.com>
parent 65e636d4
No related branches found
No related tags found
No related merge requests found
......@@ -450,7 +450,7 @@ pub(crate) fn input_kb(
if edits.is_empty() {
return;
}
if edit_history.current_edit <= 1 {
if edit_history.current_edit == 0 {
return;
}
let idx = edit_history.current_edit - 1;
......
......@@ -420,6 +420,7 @@ impl Plugin for CosmicEditPlugin {
.add_systems(
Update,
(
init_history,
input_kb,
input_mouse,
blink_cursor,
......@@ -494,6 +495,14 @@ fn save_edit_history(
};
}
fn init_history(
mut q: Query<(&mut CosmicEditor, &CosmicAttrs, &mut CosmicEditHistory), Added<CosmicEditor>>,
) {
for (mut editor, attrs, mut history) in q.iter_mut() {
save_edit_history(&mut editor.0, &attrs.0, &mut history);
}
}
/// Adds the font system to each editor when added
fn cosmic_editor_builder(
mut added_editors: Query<(Entity, &CosmicMetrics), Added<CosmicText>>,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment