Highlight current item


#1

I think this is an easy one…but I can’t seem to figure it out despite much searching through code and forums.

Here is a nice plugin that lightens the rest of the text (does NOT fold it) in the document and focuses only on the current sentence. I like it. But it doesn’t work if you have a period in the text that means something other than the end of a sentence (for example initials). Rather, I’d like to have the same behavior and functionality but works with the current “item.”

The plugin uses a style sheet for this that looks something like:

body.jmk-concentrate * {
    Color: #ccc !important;
}

body.jmk-concentrate .cm-currentsentence {
    Color: black !important;
}

I can’t figure out if there’s a way to modify the CSS for the current item rather than sentence. Is this possible, or am I stuck with currentsentence? Thanks.


#2

I thought this was an easy one too… but my memory is foggy and it’s turning out tricky. Maybe easier way, but I got it working by activating the active-line add-on that ships with code mirror:

First add some style:

.CodeMirror-activeline-background {
  background: green;
}

Next activate the add-on like this:

tell front document of application "FoldingText"
	evaluate script "
    function(editor, options) {
	editor.cm().setOption('styleActiveLine', true)
    }"
end tell

#3

Thanks @jessegrosjean. I think this will work. It looks like I can only change the background, not the text color itself (unless I’m missing something). I spent some time trying to find out if I could use CodeMirror to change the text color itself, but I can’t see how. But I think it’s close enough.