Open d3m1gd opened 3 months ago
I have some insight on this one from working on #1810. Turns out that there is a helper line_ending::rope_is_line_ending
that is tempting to use rather than implementing your own "emtpy line" detector logic. The paragraph textobject implementation uses this. I also used this in my PR when I discovered its existence, and then later discovered that it does not handle the case of whitespace-only. I still haven't fixed it in my PR, but while looking at the paragraph textobject implementation I realized that my indent detection logic is really a stone's throw away from the paragraph detection. There's even a question in my mind similar to #5182.
In any case, we could fix this by implementing a new empty line detecting function that delegates to rope_is_line_ending
for the special case, then checks for only whitespace characters. It would fix both these issues, and help my PR.
given text with empty line with spaces between paragraphs and cursor inside
foo
block,mip
will choose bothfoo
andbar
blocks, when it should only selectfoo
block.if the empty line contains no whitespace (or tabs) then the behavior is as expected - only
foo
block is selected.probably related to #5182