Skip to content

Commit

Permalink
Fixed possible behavior issues around combining characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Richards committed Mar 1, 2010
1 parent 5ce88e2 commit c4350aa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CommandFilter.cs
Expand Up @@ -177,6 +177,16 @@ private ColumnAndOffset GetColumnNumberOfFirstEquals(ITextSnapshotLine line)
column += tabSize - (column % tabSize);
else
column++;

// Also, check to see if this is a surrogate pair. If so, skip the next character by incrementing
// the loop counter and increment the nonWhiteSpaceCount without incrementing the column
// count.
if (char.IsHighSurrogate(ch) &&
i < line.End.Position - 1 && char.IsLowSurrogate(snapshot[i + 1]))
{
nonWhiteSpaceCount++;
i++;
}
}

return new ColumnAndOffset() { Column = -1, Offset = -1 };
Expand Down

0 comments on commit c4350aa

Please sign in to comment.