diff --git a/Editor/AGS.Editor/GUI/WatchVariablesPanel.cs b/Editor/AGS.Editor/GUI/WatchVariablesPanel.cs index 7aabaa36f5f..169e8150dd9 100644 --- a/Editor/AGS.Editor/GUI/WatchVariablesPanel.cs +++ b/Editor/AGS.Editor/GUI/WatchVariablesPanel.cs @@ -427,9 +427,21 @@ private void listView1_MouseUp(object sender, MouseEventArgs e) } } + private ListViewItem AddToListView(ListViewItem item) + { + if (listView1.Items.Count > 0 && listView1.Items[listView1.Items.Count - 1].Text.Length == 0) + { + listView1.Items[listView1.Items.Count - 1].Remove(); + } + + item = listView1.Items.Add(item); + EnsureEmptyItem(); + return item; + } + public void AddVariableToWatchList(string var_name) { - ListViewItem item = listView1.Items.Add(CreateItem(var_name)); + ListViewItem item = AddToListView(CreateItem(var_name)); lock (_updateItemLock) _itemsToUpdate.Add(item); _updateItemTimer.Start();