i have setup ace to render html code let's say for example that he renderer the following code
1 <html>
2 <body>
3 <table>
4 <tr>
5 <td>
6 test
7 </td>
I would like to get the line number for a given fragment of my code, so for example if i search
"<html><body><table><tr><td>"
i would like to move the cursor and higlight line 6. Unfortunately ace built in find function only seems to find code that are at the same line so
ace.find('<html>', options)
work and highlight line 1 but
ace.find('<html><body>', options)
doesn't find anything at all.
Could you explain me why or give me a workaround ? Thanks by advance ;)
if <html>
and <body>
are on different lines you need to search for ace.find('<html>\n<body>', options)
(with \n
)
another way is to use regexp to find offset you want in the editor.getValue()
string, and use
pos = session.doc.indexToPosition(100)
session.selection.moveToPosition(pos)
to move cursor to it