From 368c995211ec264886d7fedcf808179d33adffa0 Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Mon, 31 Jan 2022 18:14:06 -0500 Subject: [PATCH] fix: remove one-frame blank on virtual scrolls --- ChatTwo/Ui/ChatLog.cs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/ChatTwo/Ui/ChatLog.cs b/ChatTwo/Ui/ChatLog.cs index 84151f2..b1c63d3 100755 --- a/ChatTwo/Ui/ChatLog.cs +++ b/ChatTwo/Ui/ChatLog.cs @@ -473,30 +473,40 @@ internal sealed class ChatLog : IUiComponent { message.IsVisible = false; } + // go to next row + if (table) { + ImGui.TableNextColumn(); + } + // message has rendered once if (message.Height.HasValue) { // message isn't visible, so render dummy if (!message.IsVisible) { - // skip columns - if (table) { - if (tab.DisplayTimestamp) { - ImGui.TableNextColumn(); - } + var beforeDummy = ImGui.GetCursorPos(); + if (table) { + // skip to the message column for vis test ImGui.TableNextColumn(); } - ImGui.Dummy(new Vector2(1f, message.Height.Value)); + ImGui.Dummy(new Vector2(10f, message.Height.Value)); message.IsVisible = ImGui.IsItemVisible(); - goto UpdateMessage; + if (message.IsVisible) { + if (table) { + ImGui.TableSetColumnIndex(0); + } + + ImGui.SetCursorPos(beforeDummy); + } else { + goto UpdateMessage; + } } } if (tab.DisplayTimestamp) { var timestamp = message.Date.ToLocalTime().ToString("t"); if (table) { - ImGui.TableNextColumn(); ImGui.TextUnformatted(timestamp); } else { this.DrawChunk(new TextChunk(null, null, $"[{timestamp}]") {