fix: don't allow empty tags and trim tags

This commit is contained in:
Anna 2021-12-13 05:28:21 -05:00
parent 4077719af2
commit a9822fefd0
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
1 changed files with 10 additions and 6 deletions

View File

@ -720,13 +720,17 @@ namespace Glamaholic.Ui {
ImGui.SetNextItemWidth(-1);
if (ImGui.InputTextWithHint("##tag-input", "Input a tag and press Enter", ref this._tagInput, 128, ImGuiInputTextFlags.EnterReturnsTrue)) {
if (!plate.Tags.Contains(this._tagInput)) {
plate.Tags.Add(this._tagInput);
plate.Tags.Sort();
this.Ui.Plugin.SaveConfig();
}
if (!string.IsNullOrWhiteSpace(this._tagInput)) {
var tag = this._tagInput.Trim();
this._tagInput = string.Empty;
if (!plate.Tags.Contains(tag)) {
plate.Tags.Add(tag);
plate.Tags.Sort();
this.Ui.Plugin.SaveConfig();
}
this._tagInput = string.Empty;
}
}
if (ImGui.BeginChild("tag-list")) {