diff --git a/src/text_editor/commands.cpp b/src/text_editor/commands.cpp index d023f7e..2dcedca 100644 --- a/src/text_editor/commands.cpp +++ b/src/text_editor/commands.cpp @@ -158,15 +158,24 @@ void Appendf(View *view, const char *fmt, ...) { Append(view, string, true); } +void UIMessagef(const char *fmt, ...) { + Scratch scratch; + STRING_FORMAT(scratch, fmt, string); + BSet main = GetBSet(LastActiveLayoutWindowID); + JumpGarbageBuffer(&main); + NextActiveWindowID = main.window->id; + RawAppendf(main.buffer, "\n %S\n", string); +} + void ReportErrorf(const char *fmt, ...) { Scratch scratch; STRING_FORMAT(scratch, fmt, string); - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error!", string.data, NULL); View *view = GetView(NullViewID); if (view) { Appendf(view, "%S\n", string); NextActiveWindowID = NullWindowID; } + UIMessagef("%S", string); } void ReportConsolef(const char *fmt, ...) { @@ -577,7 +586,7 @@ BSet Open(Window *window, String path, String meta, bool set_active = true) { } else if (o.kind == OpenKind_Skip) { return {}; } else { - ReportWarningf("Failed to open: %S", path); + ReportErrorf("Failed to open: %S", path); } return GetBSet(window);