Skip to content

fix: wrong buffer encoding breaks accepting suggestions#336

Merged
zbirenbaum merged 1 commit intozbirenbaum:masterfrom
traysh:fix_issue_330
Dec 4, 2024
Merged

fix: wrong buffer encoding breaks accepting suggestions#336
zbirenbaum merged 1 commit intozbirenbaum:masterfrom
traysh:fix_issue_330

Conversation

@traysh
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown

xebecnan commented Dec 2, 2024

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

@Kaiser-Yang
Copy link
Copy Markdown
Contributor

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

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