-- lx-bundle:true

--- Built-in document-level commands
-- Keeps shared document command registration separate from text-editor specifics
-- @module core.doc.commands

local core = require("core")
local command = require("core.command")
local config = require("core.config")
local keymap = require("core.keymap")
local zoom = require("core.zoom")

local doc_commands = {}

command.add({
	["zoom:reset"] = function(context)
		-- Report false when no visible document can receive content zoom
		return zoom.reset(context)
	end,

	["zoom:out"] = function(context)
		-- Keep hidden workspaces from accumulating content zoom state
		return zoom.step(-1, context)
	end,

	["zoom:in"] = function(context)
		-- Keep hidden workspaces from accumulating content zoom state
		return zoom.step(1, context)
	end,
})

if config.zoom_bind_ctrl_wheel then
	keymap.add({
		-- Optional wheel bindings stay opt-in to avoid collisions with wheel-heavy workflows
		["ctrl+wheelup"] = "zoom:in",
		["ctrl+wheeldown"] = "zoom:out",
	})
end

return doc_commands
