gcmt / wildfire.vim

Smart selection of the closest text object
MIT License
611 stars 19 forks source link

Region shrinks during "expanding" it #18

Closed hoschi closed 3 years ago

hoschi commented 10 years ago

Hi, great plugin! I spotted some strange behaviour. This is my example:

    {
        // test paragraph
        (
            some stuff here

            test
        )
    }

Place the cursor at 'stuff' and start wildfire, now you got:

    {
        // test paragraph
        (<<<
            some stuff here

            test
     >>>)
    }

With the next press to expand the region the last seleced line jumps back to the beginning of the selection which is pretty strange behaviour imho:

<<< {
        // test paragraph
        (
            some stuff here>>>

            test
        )
    }

I would expect the selection to expand only and never shrink again.

itchyny commented 10 years ago

The 'strange' selection is the paragraph, since the next line of some stuff here is a line without a character. By default, g:wildfire_objects is defined as ["ip", "i)", "i]", "i}", "i'", 'i"', "it"], so paragraph selection has priority. If you will not use paragraph selection, use the following configuration.

let g:wildfire_objects = ["i'", 'i"', "i)", "i]", "i}"]

If you just remove the void line, everything works nice.

    {
        // test paragraph
        (
            some stuff here
            test
        )
    }

But the behaviour actually looks weird so I will look into the code.

hoschi commented 10 years ago

You are right, wildfire behaves somewhat logical ... but not uasable/naturally in this case. I think the selection should never shrink, only grow.