Squashed 'deps/nostalgia/' changes from a75c4a11..e758e03d

e758e03d [nostalgia,olympic] Update for ox::Error changes
835e3270 [ox] Make Error use std::source_location
480dd5ec [ox/std] Cleanup
dba6bb58 [ox/std] Make Vector(initializer_list) use list size as capacity
40a456e5 [ox/std] Add Vector::shrink_to_fit
bf5be00c Merge commit 'dc96270ca5e882e41f6b657be14a20e8bd2ad501'
dc7c2559 [studio] Make selection tracker not go below 0

git-subtree-dir: deps/nostalgia
git-subtree-split: e758e03d2bbffbf72d28970ec379e29d7dd0cbf3
This commit is contained in:
2025-01-02 22:03:05 -06:00
parent dc96270ca5
commit 25133af822
14 changed files with 81 additions and 54 deletions

View File

@ -48,8 +48,8 @@ OX_ALLOW_UNSAFE_BUFFERS_END
oxErrf("\tError Message:\t{}\n", err.msg);
}
oxErrf("\tError Code:\t{}\n", static_cast<ErrorCode>(err));
if (err.file != nullptr) {
oxErrf("\tError Location:\t{}:{}\n", err.file, err.line);
if (err.src.file_name() != nullptr) {
oxErrf("\tError Location:\t{}:{}\n", err.src.file_name(), err.src.line());
}
// disable all interrupt handling and IntrWait on no interrupts
REG_IE = 0;

View File

@ -75,7 +75,7 @@ StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexce
} else {
oxErrf(
"Could not open studio config file: {}: {} ({}:{})\n",
err.errCode, toStr(err), err.file, err.line);
err.errCode, toStr(err), err.src.file_name(), err.src.line());
}
}
}
@ -224,7 +224,7 @@ void StudioUI::drawTabs() noexcept {
try {
OX_THROW_ERROR(m_editors.erase(it).moveTo(it));
} catch (ox::Exception const&ex) {
oxErrf("Editor tab deletion failed: {} ({}:{})\n", ex.what(), ex.file, ex.line);
oxErrf("Editor tab deletion failed: {} ({}:{})\n", ex.what(), ex.src.file_name(), ex.src.line());
} catch (std::exception const&ex) {
oxErrf("Editor tab deletion failed: {}\n", ex.what());
}
@ -376,7 +376,7 @@ ox::Error StudioUI::openFileActiveTab(ox::StringViewCR path, bool makeActiveTab)
if constexpr(!ox::defines::Debug) {
oxErrf("Could not open Editor: {}\n", toStr(err));
} else {
oxErrf("Could not open Editor: {} ({}:{})\n", err.errCode, err.file, err.line);
oxErrf("Could not open Editor: {} ({}:{})\n", err.errCode, err.src.file_name(), err.src.line());
}
return err;
}

View File

@ -126,12 +126,12 @@ class SelectionTracker {
constexpr Selection selection() const noexcept {
return {
{
ox::min(m_pointA.x, m_pointB.x),
ox::min(m_pointA.y, m_pointB.y),
ox::max(0, ox::min(m_pointA.x, m_pointB.x)),
ox::max(0, ox::min(m_pointA.y, m_pointB.y)),
},
{
ox::max(m_pointA.x, m_pointB.x),
ox::max(m_pointA.y, m_pointB.y),
ox::max(0, ox::max(m_pointA.x, m_pointB.x)),
ox::max(0, ox::max(m_pointA.y, m_pointB.y)),
},
};
}

View File

@ -13,7 +13,7 @@ namespace studio {
class NoChangesException: public ox::Exception {
public:
inline NoChangesException(std::source_location sloc = std::source_location::current()):
ox::Exception(sloc.file_name(), sloc.line(), 1, "Command makes no changes.") {}
ox::Exception(1, "Command makes no changes.", sloc) {}
};
class UndoCommand {

View File

@ -46,7 +46,7 @@ void BaseEditor::save() noexcept {
setUnsavedChanges(false);
} else {
if constexpr(ox::defines::Debug) {
oxErrorf("Could not save file {}: {} ({}:{})", itemPath(), toStr(err), err.file, err.line);
oxErrorf("Could not save file {}: {} ({}:{})", itemPath(), toStr(err), err.src.file_name(), err.src.line());
} else {
oxErrorf("Could not save file {}: {}", itemPath(), toStr(err));
}