Skip to content

Commit 22c7829

Browse files
committed
Update ManageScript.cs
1 parent eb07941 commit 22c7829

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

MCPForUnity/Editor/Tools/ManageScript.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,10 @@ private static bool TryComputeMethodSpan(
19101910
int probe = lineStart - 1;
19111911
while (probe > searchStart)
19121912
{
1913+
// Skip past line-ending chars so LastIndexOf finds the *previous* newline
1914+
while (probe > searchStart && (source[probe] == '\n' || source[probe] == '\r'))
1915+
probe--;
1916+
if (probe <= searchStart) break;
19131917
int prevNl = source.LastIndexOf('\n', probe);
19141918
if (prevNl < 0 || prevNl < searchStart) break;
19151919
string prev = source.Substring(prevNl + 1, attrStart - (prevNl + 1));

0 commit comments

Comments
 (0)