Browse Source

fix character replacement when selecting with left/right arrow keys

pull/21569/head
Anastassia Pellja 4 months ago
parent
commit
1bb18fc127
  1. 13
      native/Avalonia.Native/src/OSX/AvnView.mm

13
native/Avalonia.Native/src/OSX/AvnView.mm

@ -877,6 +877,19 @@ static void ConvertTilt(NSPoint tilt, float* xTilt, float* yTilt)
parent->InputMethod->Client->SelectInSurroundingText(start, end); parent->InputMethod->Client->SelectInSurroundingText(start, end);
} }
} }
// If special character is selected with left/right arrow keys
// macOS reports NSNotFound instead of a replacement range.
// If there is a single marked character, select it so the committed
// character replaces the preview character.
// Only handle marked range of 1 character to avoid affecting IME.
if (replacementRange.location == NSNotFound &&
_markedRange.length == 1 &&
parent->InputMethod->IsActive())
{
int start = (int)_markedRange.location;
int end = start + 1;
parent->InputMethod->Client->SelectInSurroundingText(start, end);
}
[self unmarkText]; [self unmarkText];

Loading…
Cancel
Save