Ace: Ace Marker at wrong position

Created on 5 Sep 2014  ·  4Comments  ·  Source: ajaxorg/ace

Hi

I'm using ace 1.1.5 and got some problems setting markers

i want to highlight some rows. for this i add markers with the following code

var range = new Range(4, 1, 8, 1);
var marker = $scope.editor.getSession().addMarker(range, "ace-related-code-highlight", "line");

my style is :

.ace-related-code-highlight {
     background-color: yellow;
}

But ace highlits the first rows s. ace1.png. i f triger again the exact same code with same range it highlights the next rows s. ace2.png

I found out that he always respects the highgt of the range but starts on top. in de example above he highlights lines 1-5 . second click 5- 10 and so on.
But on scrolling the range moves. some times line 11 is marked and sometimes line 10 is only halfmarked.
so it looks like ace hase some problems with finding the right line ?

Also when sometime when i scroll i get some rendering errors . Only the left part is yellow not the whole line s.ace3.png

any advice of what I am doing wrong?

Most helpful comment

add position:absolute; to .ace-related-code-highlight rule

All 4 comments

add position:absolute; to .ace-related-code-highlight rule

Thx for help. that improved it

but

when callign

var range = new Range(5, 0, 10, 0);
var marker = $scope.editor.getSession().addMarker(range, "ace-related-code-highlight", "fullLine", false);

it highlights lines 6-11 do i missunderstand the api ?

yes, line indexes start at 0.

yeah sure, thx my bad

Was this page helpful?
0 / 5 - 0 ratings