Skip to content

Commit

Permalink
Optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
kerams committed Jan 23, 2025
1 parent 948f9ac commit 4ed5a3e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/iOS/Avalonia.iOS/TextInputResponder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ string IUITextInput.TextInRange(UITextRange range)
var r = (AvaloniaTextRange)range;
var surroundingText = _client.SurroundingText;

var currentSelection = _client.Selection;

Logger.TryGet(LogEventLevel.Debug, ImeLog)?.Log(null, "IUIKeyInput.TextInRange {start} {end}", r.StartIndex, r.EndIndex);

string result = "";
Expand All @@ -233,9 +231,10 @@ string IUITextInput.TextInRange(UITextRange range)
}
else
{
var span = new CombinedSpan3<char>(surroundingText.AsSpan().Slice(0, currentSelection.Start),
var currentSelection = _client.Selection;
var span = new CombinedSpan3<char>(surroundingText.AsSpan(0, currentSelection.Start),
_markedText,
surroundingText.AsSpan().Slice(currentSelection.Start, currentSelection.End - currentSelection.Start));
surroundingText.AsSpan(currentSelection.Start, currentSelection.End - currentSelection.Start));
var buf = new char[r.EndIndex - r.StartIndex];
span.CopyTo(buf, r.StartIndex);
result = new string(buf);
Expand Down

0 comments on commit 4ed5a3e

Please sign in to comment.