diff --git a/Dalamud/Interface/Internal/UiDebug/Browsing/NodeTree.Component.cs b/Dalamud/Interface/Internal/UiDebug/Browsing/NodeTree.Component.cs
index fb4444be1..b7bb16c46 100644
--- a/Dalamud/Interface/Internal/UiDebug/Browsing/NodeTree.Component.cs
+++ b/Dalamud/Interface/Internal/UiDebug/Browsing/NodeTree.Component.cs
@@ -1,11 +1,10 @@
using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui;
+using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using Lumina.Text.ReadOnly;
-
using static Dalamud.Interface.Internal.UiDebug.Utility.Gui;
using static Dalamud.Utility.Util;
using static FFXIVClientStructs.FFXIV.Component.GUI.ComponentType;
@@ -92,14 +91,14 @@ internal unsafe class ComponentNodeTree : ResNodeTree
{
case TextInput:
var textInputComponent = (AtkComponentTextInput*)this.Component;
- ImGui.Text($"InputBase Text1 (Lumina): {new ReadOnlySeStringSpan(textInputComponent->AtkComponentInputBase.EvaluatedString.AsSpan()).ToMacroString()}");
- ImGui.Text($"InputBase Text2 (Lumina): {new ReadOnlySeStringSpan(textInputComponent->AtkComponentInputBase.RawString.AsSpan()).ToMacroString()}");
+ ImGui.Text($"InputBase Text1: {textInputComponent->AtkComponentInputBase.EvaluatedString.AsReadOnlySeStringSpan().ToMacroString()}");
+ ImGui.Text($"InputBase Text2: {textInputComponent->AtkComponentInputBase.RawString.AsReadOnlySeStringSpan().ToMacroString()}");
// TODO: Reenable when unknowns have been unprivated / named
- // ImGui.Text($"Text1: {new ReadOnlySeStringSpan(textInputComponent->UnkText01.AsSpan()).ToMacroString()}");
- // ImGui.Text($"Text2: {new ReadOnlySeStringSpan(textInputComponent->UnkText02.AsSpan()).ToMacroString()}");
- ImGui.Text($"AvailableLines: {new ReadOnlySeStringSpan(textInputComponent->AvailableLines.AsSpan()).ToMacroString()}");
- ImGui.Text($"HighlightedAutoTranslateOptionColorPrefix: {new ReadOnlySeStringSpan(textInputComponent->HighlightedAutoTranslateOptionColorPrefix.AsSpan()).ToMacroString()}");
- ImGui.Text($"HighlightedAutoTranslateOptionColorSuffix: {new ReadOnlySeStringSpan(textInputComponent->HighlightedAutoTranslateOptionColorSuffix.AsSpan()).ToMacroString()}");
+ // ImGui.Text($"Text1: {textInputComponent->UnkText01.AsReadOnlySeStringSpan().ToMacroString()}");
+ // ImGui.Text($"Text2: {textInputComponent->UnkText02.AsReadOnlySeStringSpan().ToMacroString()}");
+ ImGui.Text($"AvailableLines: {textInputComponent->AvailableLines.AsReadOnlySeStringSpan().ToMacroString()}");
+ ImGui.Text($"HighlightedAutoTranslateOptionColorPrefix: {textInputComponent->HighlightedAutoTranslateOptionColorPrefix.AsReadOnlySeStringSpan().ToMacroString()}");
+ ImGui.Text($"HighlightedAutoTranslateOptionColorSuffix: {textInputComponent->HighlightedAutoTranslateOptionColorSuffix.AsReadOnlySeStringSpan().ToMacroString()}");
break;
case List:
case TreeList:
diff --git a/Dalamud/Utility/CStringExtensions.cs b/Dalamud/Utility/CStringExtensions.cs
index 83ebb186f..59c40f949 100644
--- a/Dalamud/Utility/CStringExtensions.cs
+++ b/Dalamud/Utility/CStringExtensions.cs
@@ -45,7 +45,7 @@ public static class CStringExtensions
/// A new Lumina ReadOnlySeString.
public static ReadOnlySeString AsReadOnlySeString(this CStringPointer ptr)
{
- return new ReadOnlySeString(ptr.AsSpan().ToArray());
+ return new ReadOnlySeString(ptr.AsSpan());
}
///
diff --git a/Dalamud/Utility/Utf8StringExtensions.cs b/Dalamud/Utility/Utf8StringExtensions.cs
new file mode 100644
index 000000000..a566d2b45
--- /dev/null
+++ b/Dalamud/Utility/Utf8StringExtensions.cs
@@ -0,0 +1,60 @@
+using Dalamud.Game.Text.SeStringHandling;
+
+using FFXIVClientStructs.FFXIV.Client.System.String;
+
+using Lumina.Text.ReadOnly;
+
+namespace Dalamud.Utility;
+
+///
+/// A set of helpful utilities for working with s from ClientStructs.
+///
+///
+/// WARNING: Will break if a custom ClientStructs is used. These are here for CONVENIENCE ONLY!.
+///
+public static class Utf8StringExtensions
+{
+ ///
+ /// Convert a Utf8String to a ReadOnlySeStringSpan.
+ ///
+ /// The Utf8String to convert.
+ /// A span.
+ public static ReadOnlySeStringSpan AsReadOnlySeStringSpan(this Utf8String str)
+ {
+ return str.AsSpan();
+ }
+
+ ///
+ /// Convert a Utf8String to a Dalamud SeString.
+ ///
+ /// The Utf8String to convert.
+ /// A Dalamud-flavored SeString.
+ public static SeString AsDalamudSeString(this Utf8String str)
+ {
+ return str.AsReadOnlySeStringSpan().ToDalamudString();
+ }
+
+ ///
+ /// Get a new ReadOnlySeString that's a copy of the text in this Utf8String.
+ ///
+ ///
+ /// This should be functionally identical to , but exists
+ /// for convenience in places that already expect ReadOnlySeString as a type (and where a copy is desired).
+ ///
+ /// The Utf8String to copy.
+ /// A new Lumina ReadOnlySeString.
+ public static ReadOnlySeString AsReadOnlySeString(this Utf8String str)
+ {
+ return new ReadOnlySeString(str.AsSpan());
+ }
+
+ ///
+ /// Extract text from this Utf8String following 's rules.
+ ///
+ /// The Utf8String to process.
+ /// Extracted text.
+ public static string ExtractText(this Utf8String str)
+ {
+ return str.AsReadOnlySeStringSpan().ExtractText();
+ }
+}