code icon indicating copy to clipboard operation
code copied to clipboard

Do not highlight neighbouring words of selected space

Open jeremypw opened this issue 2 years ago • 2 comments
trafficstars

Fixes #1299

The selection extension algorithm is reworked so that leading and trailing space is ignored and the search context is not extended to neighbouring words

jeremypw avatar Apr 01 '23 16:04 jeremypw

I think I can confirm the original issue was fixed, but there's a couple new issues here that aren't in master:

Now selecting whitespace highlights all instances of whitespace. It seems like we should never highlight white space right?

If you highlight some whitespace, whatever comes after that whitespace will count as a selection: Screenshot from 2023-04-24 17 03 15

danirabbit avatar Apr 25 '23 00:04 danirabbit

@danirabbit Hopefully the algorithm now works as expected. It is not entirely clear how a partial selection should be auto-extended by this plugin. Perhaps it should be documented in the code if it can be decided. This PR now autoextends the selection to word boundaries as determined by a couple of UnicodeBreakTypes but will not extend to include e.g. enclosing brackets.

Nothing happens now if you just select space.

Leading and trailing space is ignored even if manually selected (is this correct?)

It is difficult to test this with all possible characters though.

jeremypw avatar Apr 25 '23 19:04 jeremypw