user3751439
user3751439

Reputation: 47

How to work with ace multiple cursors?

I have an ace editor for a project and I want to make colorful cursors which appear under some conditions.

While coding these cursors should be static (the user cannot move them).

How I can add a cursor and fill it with some color?

Upvotes: 3

Views: 852

Answers (1)

Kong
Kong

Reputation: 9556

What you're after are called Markers.

This will set a background marker behind some text on line 0, column 6 through 10:

var Range = ace.require('ace/range').Range;
var range = new Range(0, 6, 0, 10);
var marker = editor.session.addMarker(range, 'ace_myclass', 'text');

To remove it:

editor.session.removeMarker(marker);

See:

http://ace.c9.io/#nav=api&api=edit_session

Upvotes: 4

Related Questions