Set background window colour between 2 text keys

Hello.

I’m trying to setup a highlighter to change the background colour between two text markers "TODO_START" and "TODO_END" in a txt file.

I’ve tried using a region highlighter with:

add-highlighter global/todos/open region '^TODO_START$' '^TODO_END$' fill "default,rgba:%opt{green}25"

But this only changes the background colour of the text and not the full width of the window.

Is there a recommended way to actually change the full width of the window?

I tried using a line highlighter but this only accepts a single line number. Would I need to create a line highlighter for each line between the 2 markers?

1 Like

I don’t think that’s possible. How do other editors behave?

I wondered if something like the following could work:

All lines:

add-highlighter global/todos/open region '^TODO_START$' '^TODO_END$' line "default,green"

Or all lines via a regex:

add-highlighter global/todos/open region '^TODO_START$' '^TODO_END$' line .* "default,green"

For anyone interested I’ve solved this by added a new highlighter that is similar to line but without requiring a line # - so it applies the face to all lines. When used on a region this does what I wanted.

This sounds great, could you please post your code? I would assume you used the line highlighter with .* as regex.