Improve Dalamud ConsoleWindow plugin search (#1582)

* Improve Dalamud ConsoleWindow plugin search

* Improve Dalamud ConsoleWindow plugin search

* Add `no results` message to plugin filter
This commit is contained in:
MidoriKami 2023-12-21 18:10:44 -08:00 committed by GitHub
parent 6eb8153a99
commit e015da0447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,6 +39,7 @@ internal class ConsoleWindow : Window, IDisposable
private string commandText = string.Empty;
private string textFilter = string.Empty;
private string selectedSource = "DalamudInternal";
private string pluginFilter = string.Empty;
private bool filterShowUncaughtExceptions;
private bool showFilterToolbar;
@ -475,14 +476,24 @@ internal class ConsoleWindow : Window, IDisposable
ImGui.TableNextColumn();
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
if (ImGui.BeginCombo("##Sources", this.selectedSource))
if (ImGui.BeginCombo("##Sources", this.selectedSource, ImGuiComboFlags.HeightLarge))
{
var sourceNames = Service<PluginManager>.Get().InstalledPlugins
.Select(p => p.Manifest.InternalName)
.OrderBy(s => s)
.Prepend("DalamudInternal")
.Where(name => this.pluginFilter is "" || new FuzzyMatcher(this.pluginFilter.ToLowerInvariant(), MatchMode.Fuzzy).Matches(name.ToLowerInvariant()) != 0)
.ToList();
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
ImGui.InputTextWithHint("##PluginSearchFilter", "Filter Plugin List", ref this.pluginFilter, 2048);
ImGui.Separator();
if (!sourceNames.Any())
{
ImGui.TextColored(KnownColor.OrangeRed.Vector(), "No Results");
}
foreach (var selectable in sourceNames)
{
if (ImGui.Selectable(selectable, this.selectedSource == selectable))