diff --git a/src/subs_controller.cpp b/src/subs_controller.cpp index e69af3bf3..7d920333c 100644 --- a/src/subs_controller.cpp +++ b/src/subs_controller.cpp @@ -310,8 +310,6 @@ void SubsController::SetFileName(agi::fs::path const& path) { void SubsController::OnCommit(AssFileCommit c) { if (c.message.empty() && !undo_stack.empty()) return; - static int next_commit_id = 1; - commit_id = next_commit_id++; // Allow coalescing only if it's the last change and the file has not been // saved since the last change diff --git a/src/subs_controller.h b/src/subs_controller.h index 82e44a4b0..ec1c86b07 100644 --- a/src/subs_controller.h +++ b/src/subs_controller.h @@ -48,6 +48,10 @@ class SubsController { int saved_commit_id = 0; /// Last autosaved version of this file int autosaved_commit_id = 0; + /// Version to use for the next commit + /// Needed to handle Save -> Undo -> Edit, which would result in the file + /// being marked unmodified if we reused commit IDs + int next_commit_id = 1; /// Timer for triggering autosaves wxTimer autosave_timer;