diff --git a/src/text_editor/commands.cpp b/src/text_editor/commands.cpp index 40abfcd..8f1dc4a 100644 --- a/src/text_editor/commands.cpp +++ b/src/text_editor/commands.cpp @@ -177,6 +177,21 @@ void ReportErrorf(const char *fmt, ...) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error!", string.data, NULL); View *view = GetView(NullViewID); Command_Append(view, string, true); + + // Set console view as active + { + Window *w = GetWindowWithView(NullViewID); + if (!w) { + BSet bset = GetActiveMainSet(); + w = GetNextLayoutWindow(bset.window); + + Buffer *b = GetBuffer(NullBufferID); + CheckpointBeforeGoto(w); + WindowOpenBufferView(w, b->name); + } + + ActiveWindow = w->id; + } } void ReportConsolef(const char *fmt, ...) { @@ -191,6 +206,21 @@ void ReportWarningf(const char *fmt, ...) { STRING_FORMAT(scratch, fmt, string); View *null_view = GetView(NullViewID); Command_Append(null_view, string, true); + + // Set console view as active + { + Window *w = GetWindowWithView(NullViewID); + if (!w) { + BSet bset = GetActiveMainSet(); + w = GetNextLayoutWindow(bset.window); + + Buffer *b = GetBuffer(NullBufferID); + CheckpointBeforeGoto(w); + WindowOpenBufferView(w, b->name); + } + + ActiveWindow = w->id; + } } void Command_MoveCursorsByPageSize(Window *window, int direction, bool shift = false) {