diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs
index 6c64de9..48a01d2 100755
--- a/ChatTwo/Resources/Language.Designer.cs
+++ b/ChatTwo/Resources/Language.Designer.cs
@@ -2490,7 +2490,7 @@ namespace ChatTwo.Resources {
}
///
- /// Looks up a localized string similar to Only with parameter.
+ /// Looks up a localized string similar to Must contain parameter.
///
internal static string Options_PreviewOnlyIf_Name {
get {
diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx
index c68747e..d91b1cf 100644
--- a/ChatTwo/Resources/Language.resx
+++ b/ChatTwo/Resources/Language.resx
@@ -1076,7 +1076,7 @@
Tooltip
- Only with parameter
+ Must contain parameter
Show only if the text contains special parameter
diff --git a/ChatTwo/Ui/InputPreview.cs b/ChatTwo/Ui/InputPreview.cs
index 133fba4..727707c 100644
--- a/ChatTwo/Ui/InputPreview.cs
+++ b/ChatTwo/Ui/InputPreview.cs
@@ -236,19 +236,30 @@ public class InputPreview : Window
return;
}
- foreach (var letter in text.Content)
+ var splits = text.Content.Split(" ");
+ for (var i = 0; i < splits.Length; i++)
{
- var letterSize = ImGui.CalcTextSize(letter.ToString());
- if (ImGui.GetContentRegionAvail().X < letterSize.X)
+ // The last character should never be an empty string
+ // Sorting this out because it leads to double whitespaces
+ if (i + 1 == splits.Length && splits[i] == "")
+ break;
+
+ var wordSize = ImGui.CalcTextSize(splits[i]);
+ if (ImGui.GetContentRegionAvail().X < wordSize.X)
ImGui.NewLine();
- CursorPosition++;
- if (ImGui.Selectable($"{letter}##{CursorPosition + unique}", false, ImGuiSelectableFlags.None, letterSize))
+ foreach (var letter in $"{splits[i]} ")
{
- SelectedCursorPos = CursorPosition;
- LogWindow.KeepFocusedThroughPreview = true;
+ var letterSize = ImGui.CalcTextSize(letter.ToString());
+
+ CursorPosition++;
+ if (ImGui.Selectable($"{letter}##{CursorPosition + unique}", false, ImGuiSelectableFlags.None, letterSize))
+ {
+ SelectedCursorPos = CursorPosition;
+ LogWindow.KeepFocusedThroughPreview = true;
+ }
+ ImGui.SameLine();
}
- ImGui.SameLine();
}
ImGui.NewLine();
}