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

fix: wrong buffer encoding breaks accepting suggestions #336

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

traysh
Copy link
Contributor

@traysh traysh commented Nov 6, 2024

These changes ensure that the text edits are applied using the correct encoding for the current buffer, improving compatibility with different file encodings.

The changes made in the suggestion.lua file are as follows:

  1. Dynamic Encoding Retrieval:

    • The code now dynamically retrieves the file encoding of the current buffer using vim.api.nvim_get_option_value('fileencoding', { buf = bufnr }).
    • This replaces the previous hardcoded "utf-16" encoding.
  2. Buffer Number Handling:

    • The current buffer number is stored in the bufnr variable using vim.api.nvim_get_current_buf().
    • This buffer number is then used to retrieve the encoding and apply text edits.

@tsukimizake
Copy link

I surely want this merged. Without this patch, it always shows this error when completing Japanese texts.

スクリーンショット 2024-11-26 19 14 09

@xebecnan
Copy link

xebecnan commented Dec 2, 2024

Also want this merged. It fixes the issue #344.

@Kaiser-Yang
Copy link

This merge needed for the all non-anscii files whose encoding is not utf-16.

@zbirenbaum zbirenbaum merged commit 117a5c9 into zbirenbaum:master Dec 4, 2024
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

Successfully merging this pull request may close these issues.

5 participants