Skip to content

Fix the diagnostic and correction for non-ascii text#3

Open
benjamin-voisin wants to merge 1 commit into
liba2k:masterfrom
benjamin-voisin:fix-non-ascii-text
Open

Fix the diagnostic and correction for non-ascii text#3
benjamin-voisin wants to merge 1 commit into
liba2k:masterfrom
benjamin-voisin:fix-non-ascii-text

Conversation

@benjamin-voisin
Copy link
Copy Markdown

This PR fixes #2 by using the vim strcharlen instead of the lua length function, providing the actual number of character and not the number of bytes, as the languagetool offset speaks with characters offset.

And then it uses the vim function byteidx to get the byte offset remaining from the number of character, to tell neovim to highlight and fix the proper part of the text.

In lines where some characters were non-ascii, the languagtool offset,
   the byte offset, and the column offset were computed differently,
   creating badly formatted responses. This fix uses the builtin vim
   function to compute the actual number of character in a string,
   instead of using the number of bytes, and provides the correct offset
   for the diagnostic.
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.

Bug: Fix not working properly on non-ASCII text

1 participant