'Ace Editor: Prevent markers to be shown for folded lines

I have several logs combined in Ace editor, for example:

/// daemon start
build log: content
build log: content 
indexing log: content
/// daemon end

content

/// daemon start
build log: content
build log: content 
indexing log: content
/// daemon end

The first daemon start...daemon end block is folded via custom folding function like that:

/// daemon start [folded region]

content

/// daemon start
build log: content
build log: content 
indexing log: content
/// daemon end

every build log and indexing log line is highlighted via screenLine marker like that:

editor.session.addMarker(range, "cssClass", "screenLine", false)

In "real world" example this leads to unnecessary highlighting of folded regions. See this example:

How to prevent folded region to be highlighted and remain highlighting for unfolded region only?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source