How to highlight several options?

For example, I have text in ace-editor and a list of ranges of lines and lines in the text where the selections should be displayed. Like this (they are shown in bold):

Lorem ipsum dolor sit amet , consectetuer adipiscing elit. Nam cursus. Morbi ut mi. Nullam enim leo, egestas id, condimentum at, laoreet mattis, Massa. Sed eleifend nonummy diam. Praesent mauris ante, elementum et, bibendum at, posuere sit amet, nibh.

How to highlight these words using the Ace-Editor API?

How to select multiple lines?

+7
source share
1 answer

Finally, I got an answer.

Highlight the word:

var range = new Range(rowStart, columnStart, rowEnd, columnEnd); var marker = editor.getSession().addMarker(range,"ace_selected_word", "text"); 

Delete selected word:

 editor.getSession().removeMarker(marker); 

Highlight the line:

 editor.getSession().addMarker(range,"ace_active_line","background"); 
+12
source

All Articles