1
0
forked from liza/Questionable

Remove extra whitespace from copied QW values

This commit is contained in:
Liza 2024-08-14 20:12:57 +02:00
parent 51816a2c8b
commit 02ad56a96c
Signed by: liza
GPG Key ID: 7199F8D727D55F67

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using System.Text.RegularExpressions;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
@ -17,8 +18,11 @@ using Questionable.Model.Questing;
namespace Questionable.Windows.QuestComponents; namespace Questionable.Windows.QuestComponents;
internal sealed class ActiveQuestComponent internal sealed partial class ActiveQuestComponent
{ {
[GeneratedRegex(@"\s\s+", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex MultipleWhitespaceRegex();
private readonly QuestController _questController; private readonly QuestController _questController;
private readonly MovementController _movementController; private readonly MovementController _movementController;
private readonly CombatController _combatController; private readonly CombatController _combatController;
@ -183,8 +187,9 @@ internal sealed class ActiveQuestComponent
if (ImGui.IsItemClicked()) if (ImGui.IsItemClicked())
{ {
ImGui.SetClipboardText(questWork.ToString()); string progressText = MultipleWhitespaceRegex().Replace(questWork.ToString(), " ");
_chatGui.Print($"Copied '{questWork}' to clipboard"); ImGui.SetClipboardText(progressText);
_chatGui.Print($"Copied '{progressText}' to clipboard");
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())