markdown-togglecheck icon indicating copy to clipboard operation
markdown-togglecheck copied to clipboard

Wrong box is toggled if cursor is to the left of the box

Open benbrastmckie opened this issue 3 years ago • 1 comments

I have noticed a small bug: if the cursor is on the line one wishes to toggle, but to the left of the box, then running the plugin toggles the line above rather than the line the cursor is on.

benbrastmckie avatar Nov 19 '22 09:11 benbrastmckie

well, that's because we don't really have an easy way to detect treesitter nodes on current line rather than under cursor. The item begins from its marker so everything before it is treated as previous node.

The behaviour is kinda inconvenient tho, I'll try to come up with something. For now you can do something like going to the end of a line / to a list marker when toggling via mapping. Something like that:

vim.api.nvim_set_keymap('n', '<leader>nn', '$:lua require("markdown-togglecheck").toggle()<CR>')

nfrid avatar Nov 21 '22 12:11 nfrid