Fix panic when using fuzzy completion in a folder containing files starting with a multibyte unicode char#918
Conversation
|
Hi, thanks for the PR! Haven't tested it out yet, but code looks good to me.
I don't think only handling the match_position = 0 case would be enough, so the way you did it is fine. There's some weirdness here, like the fact that we find the shortest base string by number of bytes but then use the number of characters for The IDE menu has the same problem. Could you duplicate the logic (and test) there? In the future, we can reduce the duplication a bit, but it's tolerable for now. |
|
LGTM! Thanks for working on this. |

This fixes #919 see the issue for a full description
I see a lot of discussion about newer code coming related to fuzzy matching, so this is just to temporarily fix the immediate issue of the panic. I think the most useful thing here is the addition of the test case to catch it.
I wasn't sure if I should handle the match_position = 0 case specially, or modify match_len to mean characters, not bytes. I went with the latter as I thought it looked cleaner, but there's definitely an argument for keeping the old code path for the majority of cases.
This is my first PR, very open to any feedback. Did my best but there's a lot of guidelines to absorb and I don't know most of the code base.