Fix TexMobject.select_unisolated_substring for substrings with escape characters

This commit is contained in:
Grant Sanderson 2022-12-26 09:02:00 -07:00
parent db0770a4fd
commit 3bf5ce5776

View file

@ -561,7 +561,7 @@ class StringMobject(SVGMobject, ABC):
def select_unisolated_substring(self, substr: str) -> VGroup:
result = []
for match in re.finditer(substr.replace("\\", r"\\"), self.string):
for match in re.finditer(re.escape(substr), self.string):
index = match.start()
start = self.substr_to_path_count(self.string[:index])
end = start + self.substr_to_path_count(substr)