Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ace editor set text selection

My text is:

My favourite singer is {Bruce Springsteen} and he was born in New Jersey.

I want to programmatically select the text between the curly braces including them. I cannot find a straightforward way.

like image 755
GRboss Avatar asked Feb 12 '23 18:02

GRboss


1 Answers

you can do editor.find("{Bruce Springsteen}") or

var Range = require("ace/range").Range;
editor.selection.setRange(new Range(0, 23, 0, 42));
// use .setRange(.., true) for setting cursor at the beginning of the selection
like image 80
a user Avatar answered May 01 '23 14:05

a user