[nostalgia,studio] Update for Ox changes, cleanup

This commit is contained in:
2023-06-13 23:52:27 -05:00
parent dde51151ff
commit ba50b083ff
10 changed files with 195 additions and 138 deletions

View File

@ -349,7 +349,7 @@ ox::Error StudioUI::openFileActiveTab(ox::CRStringView path, bool makeActiveTab)
m_editors.emplace_back(editor);
m_openFiles.emplace_back(path);
if (makeActiveTab) {
m_activeEditor = m_editors.back().value.get();
m_activeEditor = m_editors.back().value->get();
m_activeEditorUpdatePending = editor;
}
// save to config

View File

@ -49,7 +49,7 @@ ox::Error writeConfig(keel::Context *ctx, ox::CRStringView name, T *data) noexce
return err;
}
oxRequireM(buff, ox::writeOC(*data));
buff.back().value = '\n';
*buff.back().value = '\n';
if (const auto err = fs.write(path, buff.data(), buff.size())) {
oxErrf("Could not read config file: {}\n", toStr(err));
return OxError(2, "Could not read config file");

View File

@ -120,7 +120,7 @@ ox::Error Project::writeObj(const ox::StringView &path, const T *obj, ox::ClawFo
for (const auto &t : m_typeStore.typeList()) {
oxRequireM(typeOut, ox::writeClaw(*t, ox::ClawFormat::Organic));
// replace garbage last character with new line
typeOut.back().value = '\n';
*typeOut.back().value = '\n';
// write to FS
const auto typePath = ox::sfmt("/{}/{}", descPath, buildTypeId(*t));
oxReturnError(writeBuff(typePath, typeOut));

View File

@ -17,7 +17,7 @@ void UndoStack::push(UndoCommand *cmd) noexcept {
cmd->redo();
redoTriggered.emit(cmd);
changeTriggered.emit(cmd);
if (!m_stack.size() || !m_stack.back().value->mergeWith(cmd)) {
if (!m_stack.size() || !(*m_stack.back().value)->mergeWith(cmd)) {
m_stack.emplace_back(cmd);
++m_stackIdx;
} else {