Fix errors with same name expanding together

This commit is contained in:
ackwell 2024-01-13 20:48:15 +11:00
parent 96f40b7ddc
commit 74ffc56d6c

View file

@ -138,14 +138,14 @@ public partial class ModEditWindow
using var frame = ImRaii.FramedGroup("Exceptions", size, headerPreIcon: FontAwesomeIcon.TimesCircle, borderColor: Colors.RegexWarningBorder); using var frame = ImRaii.FramedGroup("Exceptions", size, headerPreIcon: FontAwesomeIcon.TimesCircle, borderColor: Colors.RegexWarningBorder);
var spaceAvail = ImGui.GetContentRegionAvail().X - ImGui.GetStyle().ItemSpacing.X - 100; var spaceAvail = ImGui.GetContentRegionAvail().X - ImGui.GetStyle().ItemSpacing.X - 100;
foreach (var exception in tab.IoExceptions) foreach (var (exception, index) in tab.IoExceptions.WithIndex())
{ {
var message = $"{exception.GetType().Name}: {exception.Message}"; var message = $"{exception.GetType().Name}: {exception.Message}";
var textSize = ImGui.CalcTextSize(message).X; var textSize = ImGui.CalcTextSize(message).X;
if (textSize > spaceAvail) if (textSize > spaceAvail)
message = message.Substring(0, (int)Math.Floor(message.Length * (spaceAvail / textSize))) + "..."; message = message.Substring(0, (int)Math.Floor(message.Length * (spaceAvail / textSize))) + "...";
using (var exceptionNode = ImRaii.TreeNode(message)) using (var exceptionNode = ImRaii.TreeNode($"{message}###exception{index}"))
{ {
if (exceptionNode) if (exceptionNode)
ImGuiUtil.TextWrapped(exception.ToString()); ImGuiUtil.TextWrapped(exception.ToString());