I’m trying to add some missing functionality to a bundle and stumbled upon some odd behavior of the selection string in TM_SELECTION regarding the range…
When I select a block of text and my cursor is somewhere in the middle of a line, the selection string contains exactly the highlighted range. Consider the following selection (see screenshot):
TM_SELECTION is now "5:5-3”, so lines 3-5 are included.
Example 2, column selection:
TM_SELECTION is “5x3”, lines 3-5 included.
But whenever I’m using CMD-L for “Select line”, like here, it gets somewhat problematic:
TM_SELECTION is now "6-3”, the range now includes line 6, but the *visible* part of the selection is still 3-5.
I can work somewhat around this checking if the last character in TM_SELECTED_TEXT is a newline (\n) (because that is where the additional line in the range is coming from - as one can make the same selection in example 3 when the cursor is on the first row of line 6, holding shift and hitting UP 2 times. Standard OSX behavior).
But the more I think about it, the less I’m sure if this is intentional.
Can this be considered a bug or is it intended behavior / a feature?