Cleanup text after calling GetTextInfo

Turns out GetTextInfo changes text internally and because TextBoxTMP#GiveFocus now sets caretPos based on text length it was causing crashes.
This commit is contained in:
js6pak committed 2024-08-20 21:08:04 +02:00
1 parent 32875a2d3d
commit 2b357512c4
1 file changed
+1
+1
View File
@@ -23,6 +23,7 @@ internal static class CursorPosPatch
if (self.textInfo == null || self.textInfo.lineCount == 0 || self.textInfo.lineInfo[0].characterCount <= 0) if (self.textInfo == null || self.textInfo.lineCount == 0 || self.textInfo.lineInfo[0].characterCount <= 0)
{ {
__result = self.GetTextInfo(" ").lineInfo.First().lineExtents.max; __result = self.GetTextInfo(" ").lineInfo.First().lineExtents.max;
self.text = string.Empty;
return false; return false;
} }