nvim-various-textobjs icon indicating copy to clipboard operation
nvim-various-textobjs copied to clipboard

[Bug]: anyQuote nested quotes edge case, only with `inner`

Open tuurep opened this issue 7 months ago • 0 comments

Bug Description

When there are nested quotes, having the cursor on the first character of a nested quote and doing .anyQuote("inner"), the wrong quote gets matched (the outer nested quote).

This only concerns .anyQuote("inner"), with exact same cursor position and .anyQuote("outer"), it matches as expected (the inner nested quote).

The same happens when the cursor is on the opening quote of an inner nested quote, but I'm not 100% sure of the expected behavior in that case. .anyQuote("outer") from that position matches the inner nested quote however and it feels correct to me.

Reproduction & Sample Text

Before

"'foo' and ´bar´"
  ^

After diq

""
 ^

Expected

"'' and `bar`"
  ^

Before

"'foo' and ´bar´"
            ^

After diq

""
 ^

Expected

"'foo' and ``"
            ^

neovim version

$ nvim --version
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1720049189
Run "nvim -V1 -v" for more info

tuurep avatar Jul 26 '24 21:07 tuurep