chrisgrieser / nvim-spider

Use the w, e, b motions like a spider. Move by subwords and skip insignificant punctuation.
MIT License
663 stars 13 forks source link

[Bug]: Cursor gets stuck at end of line with multiple punctuation. #11

Closed Aumnescio closed 1 year ago

Aumnescio commented 1 year ago

Bug Description

Operation: <Cmd>lua require('spider').motion('w')<CR>

This motion operation gets stuck when the last "word" in a line of text consists of only punctuation.

Reproduction & Sample Text

Before:

{( nested thing |)}
next line of text

After:

{( nested thing |)}
next line of text

Expected:

{( nested thing )}
|next line of text

Other example "Before" situations where the cursor gets stuck.

=== Title |===
next line of text
Haha |...
next line of text

neovim version

NVIM v0.9.0-dev-2557+gfd32a9875-Homebrew

Make sure you have done the following

chrisgrieser commented 1 year ago

got it, fixed.

This is really hard, since there are so many off-by-ones to consider for this plugins 🙈 Probably due to lua using one-based indexes and vimscript using zero-based indexes

Aumnescio commented 1 year ago

Kind of hate to keep bothering you constantly, but I think the cursor still gets stuck if there are 3 or more punctuation characters. For 1 or 2 characters, it works.

Example cases: (Bar '|' is cursor location.)

=== Title |===
Next line
OmegaNested |)))))))
Next line

Love the plugin though! And yeah, I've been struggling with Lua indexing too...

chrisgrieser commented 1 year ago

god, this has so many edge cases. fixed that one too

yeah no worry, not your fault that the indexing is so off. I got at least a dozen - 1 or +1 to fix for all the off-by-ones that I have to consider 🙈