Commit c85d682
committed
fix: handle difference in nvim-cmp and blink.cmp cursor context
## Details
Issue: #310
`nvim-cmp` passes the cursor position as a (1,1)-indexed value by
adjusting the column output of `nvim_win_get_cursor`.
`blink.cmp` does not make this adjustment and directly passes the
(1,0)-indexed value from `nvim_win_get_cursor`.
Previously we did not handle this difference and would subtract 1 from
the column resulting in an exception due to negative values. The fix is
to account for this difference when adjusting the values to treesitter's
(0,0)-indexed APIs.
I'm not 100% sure why this did not crop up before while testing but
likely related to this note from the `0.11.0` release:
> [!IMPORTANT]
> Blink.cmp now fetches the completion items immediately upon entering
> insert mode by default. More ideas for prefetching are being explored!
So we still had the off by 1 column issue but since items were not being
pre-fetched and due to the trigger characters configuration the column
would always be > 0, so it would not error.1 parent 8004461 commit c85d682
File tree
4 files changed
+10
-5
lines changed- lua/render-markdown
- integ
4 files changed
+10
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
0 commit comments