diff --git a/CHANGELOG.md b/CHANGELOG.md
index f416d60..92fdda8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ Improvements
- Allow changing the default values used by default TextFormatter codes
- Allow setting ExternalGestureHandling through the InputHandler constructor
- Allow specifying start and end indices when drawing a TokenizedString
+- Include control characters in TextInput FileNames and PathNames rules
Fixes
- Fixed control characters being included in TextInput
diff --git a/MLEM/Input/TextInput.cs b/MLEM/Input/TextInput.cs
index 8095d5a..f91fc87 100644
--- a/MLEM/Input/TextInput.cs
+++ b/MLEM/Input/TextInput.cs
@@ -61,11 +61,23 @@ namespace MLEM.Input {
///
/// A that only allows characters not contained in
///
- public static readonly Rule PathNames = (input, add) => add.IndexOfAny(Path.GetInvalidPathChars()) < 0;
+ public static readonly Rule PathNames = (input, add) => {
+ foreach (var c in add) {
+ if (char.IsControl(c) || Path.GetInvalidPathChars().Contains(c))
+ return false;
+ }
+ return true;
+ };
///
/// A that only allows characters not contained in
///
- public static readonly Rule FileNames = (input, add) => add.IndexOfAny(Path.GetInvalidFileNameChars()) < 0;
+ public static readonly Rule FileNames = (input, add) => {
+ foreach (var c in add) {
+ if (char.IsControl(c) || Path.GetInvalidFileNameChars().Contains(c))
+ return false;
+ }
+ return true;
+ };
///
/// This text input's current text