rhysd / vim-grammarous

A powerful grammar checker for Vim using LanguageTool.
1.1k stars 41 forks source link

Convert byte offset to char, to fix wrong highlight in non ascii text #95

Open artur-shaik opened 3 years ago

artur-shaik commented 3 years ago

This PR contains code for fixing wrong highlight due to that vim works with bytes not chars. Should fix #61.

Must say that byteidx method in vim sometimes return not exact result, so I used some hacks to shift highlight in right position.

I did't test it with multyline highlight, because couldn't emulate such grammatic error.

This feature disabled by default, to enable it you need to set g:grammarous#convert_char_to_byte to 1.

artur-shaik commented 3 years ago

Ok, I finally could make deep dive in this feature. As a result I could remove this hacky condition.

artur-shaik commented 3 years ago

Also, added --line-by-line argument to LanguageTool. This fix LT response, when fromx position is in wrong place.