Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoCompleteManager Index out of bounds when using custom prefix #242

Open
bevbomb opened this issue Feb 12, 2023 · 0 comments
Open

AutoCompleteManager Index out of bounds when using custom prefix #242

bevbomb opened this issue Feb 12, 2023 · 0 comments

Comments

@bevbomb
Copy link

bevbomb commented Feb 12, 2023

Describe the bug
When using an autocomplete prefix starting with a forward slash like "/name", I get an index out-of-bounds error at line 180 in AutoCompletemanager
let wordWithoutPrefix = (result.word as NSString).substring(from: result.prefix.utf16.count)

When checking the error, the word registered in the autocomplete is picking up as e, its almost as if the index is out by one due to the forward slash being used and the result returned is showing e as a word following the prefix.

To Reproduce
Steps/code to reproduce the behavior:
Register a new autocomplete prefix like so autocompleteManager.register(prefix: "/name") in the example app and try and use the prefix in the input bar, it will throw an error.

Expected behavior
I am under the assumption I should be able to use /name as a prefix similar to how Slack uses forward slash commands and then select from the results returned.

Environment

  • InputBarAccessoryView version 5.5.0
  • iOS 16.2
  • Swift 5
  • Tested on iPhone 13 Pro max
  • You should be able to reproduce the issue in the example app.

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant