Skip to content

Commit

Permalink
Reset text field content on text input stop
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte authored and slouken committed Dec 26, 2024
1 parent b2c2a48 commit eadc649
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/video/uikit/SDL_uikitviewcontroller.m
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ - (bool)stopTextInput
return true;
}

[self resetTextState];
return [textField resignFirstResponder];
}

Expand Down Expand Up @@ -657,8 +658,7 @@ - (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRan
{
if (textField.markedTextRange == nil) {
if (textField.text.length < 16) {
textField.text = obligateForBackspace;
committedText = textField.text;
[self resetTextState];
}
}
return YES;
Expand All @@ -675,6 +675,12 @@ - (BOOL)textFieldShouldReturn:(UITextField *)_textField
return YES;
}

- (void)resetTextState
{
textField.text = obligateForBackspace;
committedText = textField.text;
}

#endif

@end
Expand Down

0 comments on commit eadc649

Please sign in to comment.