1
0
mirror of synced 2024-11-24 15:50:16 +01:00

fix: Loading files into memory

This commit is contained in:
WerWolv 2023-11-27 15:48:46 +01:00
parent 9cbfaed5fe
commit 1b665fa1b3
2 changed files with 12 additions and 2 deletions

View File

@ -44,6 +44,12 @@ namespace hex::prv::undo {
const std::vector<std::unique_ptr<Operation>> &getUndoneOperations() const {
return this->m_redoStack;
}
void reset() {
this->m_undoStack.clear();
this->m_redoStack.clear();
}
private:
[[nodiscard]] Operation* getLastOperation() const {
return this->m_undoStack.back().get();

View File

@ -201,7 +201,7 @@ namespace hex::plugin::builtin {
return {
{ "hex.builtin.provider.file.menu.open_folder"_lang, [this] { fs::openFolderWithSelectionExternal(this->m_path); } },
{ "hex.builtin.provider.file.menu.open_file"_lang, [this] { fs::openFileExternal(this->m_path); } },
{ "hex.builtin.provider.file.menu.into_memory"_lang, [this] { this->convertToMemoryFile(); } }
{ "hex.builtin.provider.file.menu.into_memory"_lang, [this] { this->convertToMemoryFile(); } }
};
}
@ -313,7 +313,11 @@ namespace hex::plugin::builtin {
}
memoryProvider->markDirty(true);
ImHexApi::Provider::remove(this, false);
memoryProvider->getUndoStack().reset();
TaskManager::runWhenTasksFinished([this]{
ImHexApi::Provider::remove(this, false);
});
});
}
}