Skip to content

Commit

Permalink
Accept all punctuation marks as word separators
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Feb 29, 2024
1 parent d4338d0 commit dd9246e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Bonsai.Editor.Tests/WordSeparationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class WordSeparationTests
[DataTestMethod]
[DataRow("")]
[DataRow("Point.X", "Point.", "X")]
[DataRow("Source/1", "Source/", "1")]
[DataRow("Source/Path", "Source/", "Path")]
[DataRow("State Space", "State ", "Space")]
[DataRow("TimeStep.ElapsedTime", "Time", "Step.", "Elapsed", "Time")]
[DataRow("UpdateVRState", "Update", "VR", "State")]
Expand Down
6 changes: 1 addition & 5 deletions Bonsai.Editor/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ static bool IsUpperToLowerCase(char a, char b)

static bool IsWordSeparator(char c)
{
return char.IsWhiteSpace(c) || c switch
{
'_' or '-' or '.' => true,
_ => false
};
return char.IsSeparator(c) || char.IsPunctuation(c);
}

static bool IsWordBreak(string text, int index, char current)
Expand Down

0 comments on commit dd9246e

Please sign in to comment.