How can you set the text selection in a tab?



there is the API option for reading the cursor position and selection length in a tab — how could you update the visual highlight of the selection, for example to expand it?

I’m working on a plugin that replaces selected text, and after the replacing I’d like to either select nothing and place the cursor where it was or select all that was replaced, thus potentially shrinking or growing the selection length e.g. I might replace a single selected character with several characters, but the selection remains for a single character.



This should work

Font.tabs[0].textCursor = 5
Font.tabs[0].textRange = 1

but it doesn’t because of a small mistake in the wrapper.

Until I fix it use this:

Font.tabs[0].graphicView().setSelectedRange_((5, 1))


Thanks, that works perfect!