From 5a3618912f3a4ab64c323a2f9a4a8e275122472d Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Thu, 18 Mar 2021 18:51:24 +0000 Subject: [PATCH] Convert only up to 0. Signed-off-by: Andrea Odetti --- source/frontends/sdl/imgui/sdlsettings.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/frontends/sdl/imgui/sdlsettings.cpp b/source/frontends/sdl/imgui/sdlsettings.cpp index 84ff6ba8..8db398a7 100644 --- a/source/frontends/sdl/imgui/sdlsettings.cpp +++ b/source/frontends/sdl/imgui/sdlsettings.cpp @@ -316,22 +316,22 @@ namespace sa2 const ImGuiTableFlags flags = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_ScrollY; if (ImGui::BeginTable("Console", 1, flags)) { -// ImGuiListClipper clipper; -// clipper.Begin(CONSOLE_HEIGHT); -// while (clipper.Step()) { -// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; ++i) for (int i = 0; i < CONSOLE_HEIGHT; ++i) { char line[CONSOLE_WIDTH + 1]; + line[CONSOLE_WIDTH] = 0; const conchar_t * src = g_aConsoleDisplay[CONSOLE_HEIGHT - i - 1]; for (size_t j = 0; j < CONSOLE_WIDTH; ++j) { line[j] = ConsoleChar_GetChar(src[j]); + if (!line[j]) + { + break; + } } if (line[0]) { - line[CONSOLE_WIDTH] = 0; ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::TextUnformatted(line);