Completing Unicode (using \k regex) is broken because common prefix uses bytes instead of characters

Open
#80 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
lua, neovim
Domain
tooling

Research direction

Start by tracing the buffer completion path that calculates the common prefix, then reproduce the Cyrillic example from the issue and inspect how UTF-8 text is measured. Done means completing "пол" from the shown words preserves characters and no longer inserts broken byte-based text.

Written by the indexing model from the issue text.

Description

Here is an example:

# Add some text to provide source words:
получаем битый символ
получив битый символ
# Then type "пол" and attempt to complete it result in adding broken unicode "учÐ":
получÐ

This happens because Cyrillic "а" in UTF8 is 0xD0 0xB0 and Cyrillic "и" in UTF8 is 0xD0 0xB8, so completion returns common part Latin Capital Letter Eth 0xD0.

Dominant language
Lua
Stars
672
Forks
47
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hrsh7th/cmp-buffer

All issues in hrsh7th/cmp-buffer

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.