@SuperCPU
Do you have a solution for changing the background color for the lines after keyword “ENDCODE” too?
A solution requires planning and development though only STARTCODE was previously mentioned. Now may need to revise the solution to what satisfies the new requirement. Indicators cannot do the entire width of the window though styles can do EOL filled styling.
A UDL might be adequate with a little styling enhancement with LuaScript.
Define a new UDL from menu Language -> User Defined Language -> Define your language...
Set Default style backgroud to grey. Need to click styler button to access the styler dialog.
Go to delimiters tab and for style 1 set Open as STARTCODE and Close as ENDCODE.
Optionally. Click styler button and set background to a preferred color or set as transparent.
Save UDL with a name.
The lua script:
local function EnhanceDoc()
-- Enhance UDL with STARTCODE.
if editor.LexerLanguage == 'user' then
local start_pos = editor:findtext('^STARTCODE$', SCFIND_REGEXP |
SCFIND_MATCHCASE)
if start_pos then
-- Style 0.
local bg0 = editor.StyleBack[0]
editor.StyleEOLFilled[0] = true
-- Style 16: Delimiter 1.
editor.StyleEOLFilled[16] = true
-- Style 24: Terminator.
editor.StyleBack[24] = bg0
editor.StyleEOLFilled[24] = true
end
end
end
npp.AddEventHandler('OnReady', function()
EnhanceDoc()
npp.AddEventHandler('OnSwitchFile', EnhanceDoc)
end)
May need to restart Notepad++ after setup of the UDL and the Lua code. Once the editor is ready and the document is active, then set the language to the UDL.
Viewed with the default theme:
startcode2.png
The Python console shows the Style IDs in red so you know where the 0, 16 and 24 originate from.
Other scripting plugins should be able to apply styles with similar code.