Skip to content

Commit

Permalink
Check whether event type is KeyDown after processing typed events. (#…
Browse files Browse the repository at this point in the history
…1264)

## Proposed Changes

In BasicTextField2 input processing: Ignore non-`KeyDown` events only
after processing typed events.
On the desktop, typed events are *not* `KeyDown` events, so checking for
`KeyDown` first prevents processing typed events completely.

## Testing

Test: Tested a `BasicTextField2` manually.
  • Loading branch information
m-sasha committed Apr 12, 2024
1 parent b42476d commit 3e5ff0c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ internal abstract class TextFieldKeyEventHandler {
singleLine: Boolean,
onSubmit: () -> Unit
): Boolean {
if (event.type != KeyEventType.KeyDown) {
return false
}

if (event.isTypedEvent) {
val codePoint = deadKeyCombiner.consume(event)
if (codePoint != null) {
Expand All @@ -97,6 +93,10 @@ internal abstract class TextFieldKeyEventHandler {
}
}

if (event.type != KeyEventType.KeyDown) {
return false
}

val command = keyMapping.map(event)
if (command == null || (command.editsText && !editable)) {
return false
Expand Down

0 comments on commit 3e5ff0c

Please sign in to comment.