]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Merge branch 'master' into fix_highlight
authorvitopigno <103512727+VitusVeit@users.noreply.github.com>
Thu, 12 Jun 2025 15:20:50 +0000 (17:20 +0200)
committerGitHub <noreply@github.com>
Thu, 12 Jun 2025 15:20:50 +0000 (17:20 +0200)
1  2 
Content.Client/UserInterface/Systems/Chat/ChatUIController.Highlighting.cs

index 809713ddf773ca84401e9dbc2ce95f41dbd690b6,1670823aabaee157ff80fc8f16cdbf391fc0b643..dd73e3dd665784a6333c026aa4c97740e2c71f41
@@@ -102,18 -107,17 +107,18 @@@ public sealed partial class ChatUIContr
              // that make sure the words to match are separated by spaces or punctuation.
              // NOTE: The reason why we don't use \b tags is that \b doesn't match reverse slash characters "\" so
              // a pre-sanitized (see 1.) string like "\[test]" wouldn't get picked up by the \b.
-             if (keyword.Count(c => (c == '"')) > 0)
+             if (keyword.Any(c => c == '"'))
              {
                  // Matches the last double quote character.
-                 keyword = Regex.Replace(keyword, "\"$", "(?!\\w)");
+                 keyword = StartDoubleQuote.Replace(keyword, "(?!\\w)");
                  // When matching for the first double quote character we also consider the possibility
                  // of the double quote being preceded by a @ character.
-                 keyword = Regex.Replace(keyword, "^\"|(?<=^@)\"", "(?<!\\w)");
+                 keyword = EndDoubleQuote.Replace(keyword, "(?<!\\w)");
              }
  
 -            // Make sure any name tagged as ours gets highlighted only when others say it.
 -            keyword = StartAtSign.Replace(keyword, "(?<=(?<=/name.*)|(?<=,.*\"\".*))");
 +            // Make sure the character's name is highlighted only when mentioned directly (eg. it's said by someone),
 +            // for example in 'Name Surname says, "..."' 'Name Surname' won't be highlighted.
-             keyword = Regex.Replace(keyword, "^@", @"(?<=(?<=,.*"".*)|(?<!\[Name].*))");
++            keyword = StartAtSign.Replace(keyword, @"(?<=(?<=,.*"".*)|(?<!\[Name].*))");
  
              _highlights.Add(keyword);
          }