---@diagnostic disable: duplicate-set-field
-- lx-bundle:true

--- Install indent guides without loading their drawing code until needed
-- @module plugins.indentguide

local DocView = require("core.text.editor")

local main

--- Load indent guide drawing on the first visible text row
-- @return table implementation
local function get_main()
	if not main then
		main = require("plugins.indentguide.main")
	end

	return main
end

local draw_line_underlay = DocView.draw_line_underlay

--- Draw the normal line background followed by its indent guides
-- @param idx number line index
-- @param first_row number first visible visual row
-- @param last_row number last visible visual row
-- @param x number screen x
-- @param y number first visible row y
-- @param line_first_row number|nil first visual row owned by the complete logical line
function DocView:draw_line_underlay(idx, first_row, last_row, x, y, line_first_row)
	draw_line_underlay(self, idx, first_row, last_row, x, y, line_first_row)
	get_main().draw(self, idx, first_row, last_row, x, y, line_first_row or idx)
end
